Index: /trunk/SophyaPI/PI/Tests/pitst.cc
===================================================================
--- /trunk/SophyaPI/PI/Tests/pitst.cc	(revision 184)
+++ /trunk/SophyaPI/PI/Tests/pitst.cc	(revision 184)
@@ -0,0 +1,435 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+/*  Ceci est un programme test des differents composants de PI : PEIDA Interactif */
+/*                 Reza ,  96-98                                                  */
+
+/*   C'est ecrit n'importe comment !     */
+ 
+#include "pisysdep.h"
+
+#include PIAPP_H
+#include PIWIN_H 
+#include PIMENU_H 
+#include PIOPTMENU_H 
+#include PISTDWDG_H 
+#include PIBWDG_H 
+#include PIPIXMAP_H 
+#include PIFILECHO_H 
+#include PILIST_H
+
+#include "piscdrawwdg.h"
+
+/*
+int SysBeep(int n)
+{
+for(int i=0; i<n; i++)  putchar('\007');
+return(0);
+}
+*/
+
+class PITestApp : public PIApplication {
+public:
+	PITestApp(int sx, int sy);
+	~PITestApp();
+
+	virtual void	Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+    PIMenu  *m[5];
+    PIMenu  *mc[2];
+    PICheckBox * ckb;
+    PIText * text;
+    PIButton * bouton;
+    PIButton * bouton2, * bouton3, * bouton4, * bouton5;
+    PIButton * bouton11, * bouton12, * bouton13,* bouton14 ,* bouton15 ;
+    PILabel * label;
+    PIScale * scl;
+    PIMenu  * menu;
+    PIOptMenu * opt, * opt2;
+    bool stnewmen[2];
+
+};
+
+
+
+PITestApp::PITestApp(int sx, int sy)
+: PIApplication(550, 350)
+{
+char ans[128];
+   m[0] = new PIMenu(Menubar(),"File");
+   m[0]->AppendItem("Open", 10101);
+   m[0]->AppendItem("Close", 10102);
+   m[0]->AppendItem("New", 10103);
+//   m[0]->AppendItem("ScBar", 10105);
+   m[0]->AppendItem("Quit", 10104);
+
+   m[1] = new PIMenu(Menubar(),"Edit");
+   m[1]->AppendItem("Copier", 10201);
+   m[1]->AppendItem("Coller", 10202);
+   m[1]->AppendItem("Couper", 10203);
+   m[1]->AppendCheckItem("Check It", 10205);
+   mc[0] = new PIMenu(m[1], "Cascade");
+   mc[0]->AppendItem("EdeCas-1", 10221);
+   mc[0]->AppendItem("EdeCas-2", 10222);
+   mc[0]->AppendItem("EdeCas-3", 10223);
+   m[1]->AppendPDMenu(mc[0]);
+
+   m[2] = new PIMenu(Menubar(),"Operation");
+   m[2]->AppendItem("AddItem", 10301);
+   m[2]->AppendItem("DelItemName", 10302);
+   m[2]->AppendItem("DelItemMsg", 10303);
+
+   m[3] = new PIMenu(Menubar(),"Special");
+   m[3]->AppendItem("Spec-Opt1", 10401);
+   m[3]->AppendItem("Spec-Opt2", 10402);
+   m[3]->AppendItem("Spec-Cascade", 10403);
+   mc[1] = new PIMenu(m[3], "Spec-Cascade");
+   mc[1]->AppendItem("Spec-Cas-1", 10441);
+   mc[1]->AppendItem("Spec-Cas-2", 10442);
+   mc[1]->AppendItem("Spec-Cas-3", 10443);
+   m[3]->AppendPDMenu(mc[1]);
+   m[3]->AppendCheckItem("Checkable", 10414);
+
+   m[4] = new PIMenu(Menubar(),"AddMenu2");
+   m[4]->AppendItem("option-A", 10501);
+   m[4]->AppendItem("option-B", 10502);
+   m[4]->AppendItem("option-C", 10503);
+
+   AppendMenu(m[0]);
+   AppendMenu(m[1]);   
+   AppendMenu(m[2]);
+
+  ckb = new PICheckBox(this->MainWin(), "CheckBox", 166, 60, 20, 10, 10);
+  text = new PIText(this->MainWin(), "TEXTE", 180, 30, 20,40);
+  text->SetMsg(7440);
+  label  = new PILabel(this->MainWin(), "Label", 180, 20, 20,80);
+  label->SetBorderWidth(1);
+  bouton = new PIButton(this->MainWin(), "->Menu", 33, 60, 25, 20, 120);
+  bouton2 = new PIButton(this->MainWin(), "Dialog", 333, 60, 25, 100, 120);
+  bouton3 = new PIButton(this->MainWin(), "ScDraw", 433, 60, 25, 180, 120);
+  bouton4 = new PIButton(this->MainWin(), "Pixmap", 133, 60, 25, 260, 120);
+  bouton5 = new PIButton(this->MainWin(), "List", 533, 60, 25, 340, 120);
+
+  scl = new PIScale(this->MainWin(), "Scale", 88, kSDirRtoL, 200, 20, 10, 150);
+  scl->SetMinMax(5, 45);
+
+  int psx, psy;
+  PrefCompSz(psx, psy);
+  cout << " Creation bouton 11 -14 avec Sx,Sy= " << psx << " , " << psy << endl;
+
+  bouton11 = new PIButton(this->MainWin(), "AddMen-1", 1133, psx*1.5, psy, 20, 250);
+  bouton12 = new PIButton(this->MainWin(), "AddMen-2", 1233, psx*1.5, psy, 40+psx*1.5, 250);
+  stnewmen[0] = stnewmen[1] = false;
+  bouton13 = new PIButton(this->MainWin(), "Ready/Bloc", 1333, psx*1.5, psy, 20, 300);
+  bouton14 = new PIButton(this->MainWin(), "TS-BWdg", 1433, psx*1.5, psy, 40+psx*1.5, 300);
+  bouton15 = new PIButton(this->MainWin(), "TS-MenuIt", 1533, psx*1.5, psy, 60+psx*3, 300);
+
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Creation PIPUMenu DoIt-1... \n");   gets(ans);
+  menu = new PIMenu(this->MainWin(), "myMenu");
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 1 ... \n");   gets(ans);
+
+  menu->AppendItem("DoIt-1", 4401);
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 2 ... \n");   gets(ans);
+
+  menu->AppendItem("DoIt-2", 4402);
+  menu->AppendItem("DoIt-25", 4425);
+  menu->AppendItem("DoIt-26", 4426);
+  menu->AppendItem("Check-33", 4433);
+
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Creation PIPUMenu Copier ... \n");   gets(ans);
+
+
+  opt = new PIOptMenu(this->MainWin(), "Option-Menu-1", 120, 25, 10, 200);
+  opt->AppendItem("Linear", 5601);
+  opt->AppendItem("Log.", 5602);
+  opt->AppendItem("Sqrt", 5603);
+  opt->AppendItem("Expon", 5604);
+  opt->AppendItem("Polyn", 5605);
+
+  string ops = "Sqrt";
+  opt->SetValueStr(ops);
+
+  opt2 = new PIOptMenu(this->MainWin(), "Option-Menu-1", 120, 25, 150, 200);
+  opt2->AppendItem("Copier", 80201);
+  opt2->AppendItem("Coller", 80202);
+  opt2->AppendItem("Couper", 80203);
+  opt2->AppendItem("Undo", 80204);
+  opt2->AppendItem("Select-All", 80205);
+  
+}
+
+PITestApp::~PITestApp()
+{
+  delete ckb;
+  delete text;
+  delete label;
+  delete bouton;
+  delete bouton2;
+  delete bouton3;
+  delete bouton4;
+  delete bouton5;
+  delete bouton11;
+  delete bouton12;
+  delete bouton13;
+  delete bouton14;
+  delete bouton15;
+  delete menu;
+  delete m[0]; delete m[1]; delete m[2]; delete m[3]; delete m[4];
+  delete mc[0]; delete mc[1];
+  delete opt;
+  delete opt2;
+  delete scl;
+}
+
+/* ........................................................... */
+/*                         Classe ScSample                     */
+/* ........................................................... */
+
+class ScSample : public PIScDrawWdg {
+public:
+  ScSample(PIContainerGen *par, char *nom,
+           int sx=10, int sy=10, int px=0, int py=0);
+  virtual ~ScSample();
+};
+
+static double fpol(double x) {return (0.3*x*x*x-x*x+7.);}
+static double fx2(double x) {return (0.5*x*x);}
+
+ScSample::ScSample(PIContainerGen *par, char *nom,
+                  int sx, int sy, int px, int py)
+:PIScDrawWdg(par, nom, sx, sy, px, py)
+
+{
+// Definition des limites
+SetLimits(-3,5,-10,15);
+
+// Creation et ajout d'un drawer de fonctions
+PIFuncDrawer* mfd = new PIFuncDrawer(fpol);
+mfd->SetColAtt(PI_Blue);
+mfd->SetLineAtt(PI_NormalLine);
+AddScDrawer(mfd,true);
+PIFuncDrawer* mfd2 = new PIFuncDrawer(fx2);
+mfd2->SetColAtt(PI_Red);
+mfd2->SetLineAtt(PI_NormalLine);
+AddScDrawer(mfd2,true);
+SetAxesFlags(kAxesDflt);
+}
+
+ScSample::~ScSample()
+{
+}
+
+static ScSample *scs1, *scs2, *scs3;
+static PIScrollBar *scb, *scb2;
+
+static PIWindow * wp3, *wp4, *wp5, *wp6;
+static PIPixmap * pxm;
+static unsigned char  pixels[25000];
+static PIFileChooser *pfc;
+static bool  fgpxm = false;
+static bool  fgt = false;
+static bool  fgt2 = false;
+static bool  fgt3 = false;
+
+static PIListX * pil;
+
+void
+PITestApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+  static int x = 0;
+  static numsg=8800;
+
+  char truc[256];
+  sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind());
+  this->label->SetLabel(truc);
+  sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)  Data= (%ld - %lx)",x, msg, (int)UserMsg(msg),
+         (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind(), (long)data, (long)data);
+  puts(truc);
+
+  if (ModMsg(msg) == PIMsg_Active) 
+     printf("Process: Setting active Wdg (%lx) \n", (long)sender); 
+
+  if (ModMsg(msg) == PIMsg_Close)
+    {
+    printf("Close Message received (Sender= %lx)\n", (long)sender);
+    return;
+    }
+
+  msg = UserMsg(msg);
+  if (msg == 33) { ckb->SetState(true);  menu->Show(); }
+    
+  if (msg == 133)
+    {
+    if (!fgpxm)  { wp3->Show();  fgpxm = true; }
+    for (int i=0; i<25000; i++)  pixels[i] = rand()%256;
+    if ((x % 3) == 0)  pxm->SetColMapId(CMAP_GREY32);
+    if ((x % 3) == 1)  pxm->SetColMapId(CMAP_COLRJ32);
+    if ((x % 3) == 2)  pxm->SetColMapId(CMAP_COLBR32);
+    }
+
+  if (msg == 333)  wp4->Show();
+  if ( (msg == 6001) || (msg == 6002) )  wp4->Hide();
+
+  if (msg == 433)
+    {
+    if (fgt2) { wp5->Hide();   fgt2 = false; }
+    else { wp5->Show();   fgt2 = true; }
+    }
+
+  if (msg == 533)
+    {
+    if (fgt3) { wp6->Hide(); fgt3 = false; }
+    else { wp6->Show(); fgt3 = true; }
+    }
+
+  if ( (msg == 1133) || (msg == 1233) )  {  // On ajoute ou on enleve un  menu du menu-bar
+    int idxmen = (msg-1133)/100;
+    cout << " Add/Remove Menu idxmen= " << idxmen << " Bool= " 
+         << Menubar()->IsSensitive(m[idxmen+3])  << " ( " << stnewmen[idxmen] << ")" << endl;
+    if ( Menubar()->IsSensitive(m[idxmen+3]) ) 
+      { Menubar()->RemoveMenu(m[idxmen+3]); stnewmen[idxmen] = false; }
+    else  { Menubar()->AppendMenu(m[idxmen+3]); stnewmen[idxmen] = true; }
+  }
+
+  if (msg == 1333) {  // Changement de sensibilite de Menu-Bar (par SetBusy())
+    cout << " SetSens() Menubar,  State= " <<  GetState()  << endl;
+    if (GetState() != kReadyState)  SetReady();
+    else  SetBlocked();
+  }
+
+  if (msg == 1533) {  // Changement de sensibilite de  Cascade
+    cout << " ChangeSensitivity()  Cascade Bool= " <<  m[1]->IsSensitive("Cascade")  << endl;
+    if (m[1]->IsSensitive("Cascade") )  m[1]->SetSensitivity("Cascade", false); 
+    else  m[1]->SetSensitivity("Cascade", true); 
+  }
+
+  if (msg == 1433) {  // Changement de sensibilite de  BaseWidget (ScSample)
+    if (scs1->IfSensitive())  scs1->SetUnSensitive();
+    else scs1->SetSensitive();
+  }
+//  if (msg == 555)   (this->menu)->Show(); 
+
+  if (msg == 10105)  scb->SetSlSize(atoi(((char *)text->GetText().c_str())));
+  if (msg == 10104)  Stop();
+  if (msg == 10101)  { pfc->AcceptNewFile(false); pfc->Show(); }
+  if (msg == 10103)  { pfc->AcceptNewFile(true); pfc->Show(); }
+
+  if ((msg == 10205) || (msg == 166))  { // CheckItem Menu  or checkbox
+    cout << "PITestApp::Process CheckItem/Box Menu (" << msg 
+         << ") State=" <<  *((bool *)data) << endl; 
+  }
+
+  if (msg == 10301)  
+   { 
+   numsg++;    
+   string nit;
+   nit = text->GetText();
+   m[1]->AppendItem((char *)nit.c_str(), numsg); 
+   opt2->SetValue(numsg);
+   }
+
+  if (msg == 10302)  { m[1]->DeleteItem((char *)text->GetText().c_str()); }
+  if (msg == 10303)  
+    {
+    string nit;
+    nit = text->GetText();
+    long ml =  atol(nit.c_str());
+    m[1]->DeleteItemMsg(ml);
+    opt2->SetValue(10201);
+    }
+
+
+  if (msg > 9000) printf("PITestApp::MenubarReturn: %d --> %lx \n", msg, (long)data);
+  if (msg == 5000)  
+    { 
+    if (data) 
+      { 
+      printf("PITestApp::Process(5000) OK from PIFileChooser: %s \n", (char *)data); 
+    }
+    else printf("PITestApp::Process(5000) Cancel from PIFileChooser (data=NULL) \n");  }
+
+  if ((msg / 100) == 56) 
+    printf("PITestApp::Process(%d) : %lx \n", (int)msg, (long)data); 
+
+  if (msg == 8811) printf("PITestApp::Process(8811) ScrollBar( %d ) \n", *( (int*)data) );
+  else if (msg == 8821) printf("PITestApp::Process(8821) ScrollBar( %d ) \n", *( (int*)data) );
+
+}
+
+int main(int narg, char *arg[])
+{
+  int mii;
+
+  if (narg < 2) {
+    printf("Usage pitst str1 [str2 ....] \n");  exit(1); 
+  }
+
+  PITestApp * app;
+  app = new PITestApp(350, 350);
+
+
+  wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  200, 200, 350, 350);
+  PIButton bt1(wp4, "OK", 6001, 60, 30, 20, 160);
+  PIButton bt2(wp4, "Cancel", 6002, 60, 30, 100, 160);
+  bt1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  bt2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  PILabel  lb1(wp4, "Editable", 40, 30, 10, 10);
+    lb1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  PIText  tx1(wp4, "A00", 100, 30, 60, 10);  
+    tx1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  tx1.SetText("Hello");
+  tx1.SetTextEditable(false);
+  //  PILabel  lb2(wp4, "", 30, 20, 10, 40);
+  PIText  tx2(wp4, "A11", 180, 100, 15, 50);
+  tx2.SetMutiLineMode(true);
+  tx2.SetText(" Bonjour, \n Comment ca va ? \n A demain. ");
+    tx2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+
+  wp3 = new PIWindow(app, "Window-3", PIWK_normal, 200, 200, 350, 350);
+  pxm = new PIPixmap(wp3, "myPixmap", 150, 150, 10, 10);
+  pxm->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed );
+  pxm->SetPixmap(pixels, 150, 150);
+
+  wp5 = new PIWindow(app, "Window-5", PIWK_normal,  420, 450, 200, 200);
+  scs1 = new ScSample(wp5, "ScSample", 200, 200, 0, 0);
+  scs1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  scs2 = new ScSample(wp5, "ScSample", 160, 160, 220, 20);
+  printf("DBG-WP5 (A) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+//  scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
+  scs2->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  printf("DBG-WP5 (B) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+
+  scb = new PIScrollBar(wp5, "ScBar", 8811, kSDirUpDown, 15, 420, 405, 0);
+  scb->SetBinding(PIBK_free,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  scb->ActivateDrag(true);
+  scb2 = new PIScrollBar(wp5, "ScBar", 8821, kSDirRtoL, 420, 15, 0, 425);
+  scb2->SetBinding(PIBK_fixed,PIBK_free,PIBK_fixed,PIBK_fixed);
+
+  scs3 = new ScSample(wp5, "ScSample", 200, 200, 100, 220);
+  scs3->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+
+  pfc = new PIFileChooser(app,"FileChooser", 5000); 
+//  pfc->SetPath("/exp/eros/ImagRed/");
+
+  wp6 = new PIWindow(app, "Window-List", PIWK_normal,  200, 250, 300, 400);
+  pil = new PIListX(wp6, "MyList", 200, 250, 0, 0);
+  pil->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  for(mii=1; mii<narg; mii++)
+    {
+//    printf("AppendItem[%d] - %s (%ld) \n", mii, arg[mii],  3330+mii);  
+     pil->AppendItem(arg[mii], 3330+mii);  
+//    puts("Append-OK");
+    }
+  pil->SetMultipleSelect(true);
+  pil->SelectItem("user.cc");
+//  Int32 ioNumber = 100;
+  app->Run();
+  delete app;
+  exit(0);
+}
Index: /trunk/SophyaPI/PI/pi3ddrw.cc
===================================================================
--- /trunk/SophyaPI/PI/pi3ddrw.cc	(revision 183)
+++ /trunk/SophyaPI/PI/pi3ddrw.cc	(revision 184)
@@ -26,6 +26,6 @@
   lCO = 10.;  dlCO = 3.;  
   v3D_obs = false;
-  xMin = yMin = zMin = -1.;  
-  xMax = yMax = zMax = 1.;
+  x3Min = y3Min = z3Min = -1.;  
+  x3Max = y3Max = z3Max = 1.;
 }
 
@@ -84,5 +84,102 @@
 }
 
-
+/* --Methode-- */
+void PIDrawer3D::DrawAxes(PIGraphicUC* g)
+{
+  if (axesFlags == kAxesNone) return;
+#if defined(__DECCXX) || defined(__KCC__)
+  PIGraphic3D* g3 = dynamic_cast<PIGraphic3D*>(g);
+#else
+  PIGraphic3D* g3 = (PIGraphic3D*)(g);
+#endif
+  Draw3DBoxe(g3, XMin3(), XMax3(), YMin3(), YMax3(), ZMin3(), ZMax3(),
+                 XMin3(), XMax3(), YMin3(), YMax3(), ZMin3(), ZMax3());  
+}
+
+/* --Methode-- */
+void PIDrawer3D::Draw3DBoxe(PIGraphic3D* g3, 
+                            float xx1, float xx2, float yy1, float yy2, 
+                            float zz1, float zz2, float xl1, float xl2, 
+                            float yl1, float yl2, float zl1, float zl2)
+{
+  if (mLAtt == PI_NotDefLineAtt)    g3->SelLine(PI_ThinLine);
+
+  PIGrCoord x1,y1,z1,x2,y2,z2;
+  char strg[64];
+  int k;
+  int NTicks = 5;  // Nb de ticks sur chaque axe
+
+  x1 = xx1;  y1 = yy1;  z1 = zz1;
+  x2 = xx2;   y2 = yy1;   z2 = zz1; 
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  y1 = y2 = yy2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  z1 = z2 = zz2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  y1 = y2 = yy1;  
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+
+// Trace des ticks et labels axe X :
+  x1 = x2 = xx1;   y1 = y2 = yy1;  z1 = z2 = zz1;
+  for (k=0; k<NTicks; k++) {
+    x1 = x2 = (xx1+(float)k*(xx2-xx1)/(NTicks-1.));
+    z1 = zz1; z2 = zz1-0.02*(zz2-zz1);
+    y1 = y2 = yy1;
+    g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+    z2 = zz1-0.05*(zz2-zz1); 
+    y2 = yy1-0.075*(yy2-yy1);  
+    sprintf(strg,"%.2g", xl1+(float)k*(xl2-xl1)/(NTicks-1.));
+    g3->DrawString3D(x2, y2, z2, strg);
+    }
+  x2 = xx2+0.075*(xx2-xx1);  y2 = yy1;   z2 = zz1-0.05*(zz2-zz1); 
+  g3->DrawString3D(x2, y2, z2, "X");
+
+  x1 = xx1;  y1 = yy1;  z1 = zz1;
+  x2 = xx1;   y2 = yy2;   z2 = zz1; 
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  z1 = z2 = zz2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx1;  
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx2;   y1 = y2 = yy1;  z1 = z2 = zz1;
+  for (k=1; k<NTicks; k++) {   // Attention, par le tick 0 pour Y
+    y1 = y2 = (yy1+(float)k*(yy2-yy1)/(NTicks-1.));
+    z2 = zz1-0.02*(zz2-zz1);
+    x1 = x2 = xx2; 
+    g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+    z2 = zz1-0.05*(zz2-zz1); 
+    x2 = xx2+0.075*(xx2-xx1);  
+    sprintf(strg,"%.2g", yl1+(float)k*(yl2-yl1)/(NTicks-1.));
+    g3->DrawString3D(x2, y2, z2, strg);
+    }
+  x2 = xx2;  y2 = yy2+0.075*(yy2-yy1);   z2 = zz1-0.05*(zz2-zz1); 
+  g3->DrawString3D(x2, y2, z2, "Y");
+
+  x1 = xx1;  y1 = yy1;  z1 = zz1;
+  x2 = xx1;   y2 = yy1;   z2 = zz2; 
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  y1 = y2 = yy2;
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx1;  
+  g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+  x1 = x2 = xx1;   y1 = y2 = yy1;  z1 = z2 = zz1;
+  for (k=0; k<NTicks; k++) {
+    z1 = z2 = (zz1+(float)k*(zz2-zz1)/(NTicks-1.));
+    y2 = yy1-0.015*(yy2-yy1);
+    x2 = xx1-0.015*(xx2-xx1);
+    g3->DrawLine3D(x1, y1, z1, x2, y2, z2);
+    x2 = xx1-0.1*(xx2-xx1);  
+    y2 = yy1-0.1*(yy2-yy1);  
+    sprintf(strg,"%.2g", zl1+(float)k*(zl2-zl1)/(NTicks-1.));
+    g3->DrawString3D(x2, y2, z2, strg);
+    }
+  x2 = xx1-0.075*(xx2-xx1);  y2 = yy1-0.075*(yy2-yy1);   z2 = zz2+0.05*(zz2-zz1); 
+  g3->DrawString3D(x2, y2, z2, "Z");
+
+}
 
 // ......................................................................
@@ -115,4 +212,7 @@
 
   mGr3d = new PIGraphic3D(mWGrC, 0, 0, sx, sy);
+  rOfg = false;
+  axfg = true;
+  skcfg = false;
 }
 
@@ -180,5 +280,4 @@
   else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi);
   Refresh();
-  mBDrw->Refresh();  // ? Pour reecrire par-dessus ce qui a ete efface 
 }
 
@@ -226,4 +325,5 @@
   }
 int id = AddDrawer(dr3, false, false, ad);
+if (m3DrIl.size() == 0)  dr3->SetAxesFlags(kStdAxes);
 m3DrIl.push_back(id);
 return(id);
@@ -256,6 +356,22 @@
     PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
     }
-  }
-}
+  if (key == 'A' || key == 'a')  {    // On affiche ou on enleve les axes
+    axfg = !axfg;
+    list<int>::iterator it;
+    if (axfg) 
+      for(it = m3DrIl.begin(); it != m3DrIl.end(); it++)  
+         GetDrawerId(*it)->SetAxesFlags(kAxesNone);
+    else { 
+      it = m3DrIl.begin(); 
+      if (it != m3DrIl.end())  GetDrawerId(*it)->SetAxesFlags(kStdAxes);
+      }
+    Refresh(); 
+    }
+//  <Alt>S active la sensibilite de la zone centrale pour tourner l'objet
+  if (key == 'S' || key == 's')  skcfg = !skcfg;  
+  if (key == 'R' || key == 'r')  Update3DView();
+  }
+}
+
 /* --Methode-- */
 void PIDraw3DWdg::PasteSelection(unsigned int typ, void *pdata, unsigned int l)
@@ -291,5 +407,5 @@
   rOfg = false;
   if (kmod ==  PIKM_Shift)  rOfg = true;
-  else {
+  else if (skcfg) {
     int dmix = x-XSize()/2;
     int dmiy = y-YSize()/2;
@@ -361,5 +477,4 @@
   SetDrawers3DView();
   Refresh();
-  mBDrw->Refresh();
 }
 
@@ -425,5 +540,4 @@
   SetDrawers3DView();
   Refresh();
-  mBDrw->Refresh();
 }
 
Index: /trunk/SophyaPI/PI/pi3ddrw.h
===================================================================
--- /trunk/SophyaPI/PI/pi3ddrw.h	(revision 183)
+++ /trunk/SophyaPI/PI/pi3ddrw.h	(revision 184)
@@ -31,6 +31,15 @@
   virtual PIGraphicUC*	SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g);
 
-  float ZMin() const {return zMin;}
-  float ZMax() const {return zMax;}
+  virtual void       	DrawAxes(PIGraphicUC* g);
+  virtual void       	Draw3DBoxe(PIGraphic3D* g3, float xx1, float xx2, float yy1, float yy2, 
+                                                    float zz1, float zz2, float xl1, float xl2, 
+                                                    float yl1, float yl2, float zl1, float zl2);
+
+  float XMin3() const {return x3Min;}
+  float XMax3() const {return x3Max;}
+  float YMin3() const {return y3Min;}
+  float YMax3() const {return y3Max;}
+  float ZMin3() const {return z3Min;}
+  float ZMax3() const {return z3Max;}
 
 protected :
@@ -41,5 +50,7 @@
   float lCO, dlCO;   // Distance Camera-Centre du champ et profondeur de champ 
   bool v3D_obs;      // Si defini par Set3DView_Obs 
-  float zMin, zMax;  // Pour delimiter le cube 3D (avec x/yMin-Max)
+  float x3Min, x3Max;  // Pour delimiter le cube 3D 
+  float y3Min, y3Max;  // Pour delimiter le cube 3D 
+  float z3Min, z3Max;  // Pour delimiter le cube 3D 
 };
 
@@ -106,5 +117,7 @@
   float cXc, cYc, cZc;         // Pour garder position du centre de champ 
   float clCO, cDax, cDay;      // Pour garder les valeurs avant Zoom In/Out
-  bool  rOfg;                  // Vrai si on fait tourner l'objet et pas la camera
+  bool  rOfg;                  // si Vrai  on fait tourner l'objet et pas la camera
+  bool  axfg;                  // si Vrai on trace les axes
+  bool  skcfg;                 // si Vrai click-2 au centre -> rotation objet
 };
 
Index: /trunk/SophyaPI/PI/pisurfdr.cc
===================================================================
--- /trunk/SophyaPI/PI/pisurfdr.cc	(revision 183)
+++ /trunk/SophyaPI/PI/pisurfdr.cc	(revision 184)
@@ -55,12 +55,9 @@
   
   Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.40, 
-            (xmin+xmax)/2.+D , (ymin+ymax)/2.+2*D , zmin+(zmax-zmin)*0.60, 0.25, 0.25);  
+            (xmin+xmax)/2.+D , (ymin+ymax)/2.-2.5*D , zmin+(zmax-zmin)*0.85, 0.25, 0.25);  
   
-  xMin = xmin - 0.05*(xmax-xmin);
-  xMax = xmax + 0.05*(xmax-xmin);
-  yMin = ymin - 0.05*(ymax-ymin);
-  yMax = ymax + 0.05*(ymax-ymin);
-  zMin = zmin - 0.05*(zmax-zmin);
-  zMax = zmax + 0.05*(zmax-zmin);
+  x3Min = xmin;   x3Max = xmax;
+  y3Min = ymin;   y3Max = ymax;
+  z3Min = zmin-0.05*(zmax-zmin);   z3Max = zmax+0.05*(zmax-zmin);
 
 //  printf("PISurfaceDrawer::UpdateLimits() : %g-%g  %g-%g  %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D);
@@ -86,8 +83,7 @@
 
 /* --Methode-- */
-void PISurfaceDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
-{
-  if (mArr == NULL)  return;
-
+void PISurfaceDrawer::DrawAxes(PIGraphicUC* g)
+{
+  if (axesFlags == kAxesNone) return;
 #if defined(__DECCXX) || defined(__KCC__)
   PIGraphic3D* g3 = dynamic_cast<PIGraphic3D*>(g);
@@ -95,6 +91,22 @@
   PIGraphic3D* g3 = (PIGraphic3D*)(g);
 #endif
-
-//  g3->SelForeground(PI_White);
+  Draw3DBoxe(g3, XMin3(), XMax3(), YMin3(), YMax3(), ZMin3(), ZMax3(),
+                 mXmin, mXmax, mYmin, mYmax, mZmin-0.05*(mZmax-mZmin), mZmax+0.05*(mZmax-mZmin));
+}
+
+/* --Methode-- */
+void PISurfaceDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
+{
+// On trace les axes - En attendant de faire mieux - Reza 8/12/98
+  if (axesFlags != kAxesNone)  DrawAxes(g);
+
+  if (mArr == NULL)  return;
+
+#if defined(__DECCXX) || defined(__KCC__)
+  PIGraphic3D* g3 = dynamic_cast<PIGraphic3D*>(g);
+#else
+  PIGraphic3D* g3 = (PIGraphic3D*)(g);
+#endif
+
   g3->SelBackground(PI_White);
 //  g3->Erase(xmin, ymin, xmax-xmin, ymax-ymin);
Index: /trunk/SophyaPI/PI/pisurfdr.h
===================================================================
--- /trunk/SophyaPI/PI/pisurfdr.h	(revision 183)
+++ /trunk/SophyaPI/PI/pisurfdr.h	(revision 184)
@@ -18,4 +18,6 @@
 
   virtual void 		Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax); 
+  virtual void       	DrawAxes(PIGraphicUC* g);
+
 protected :
   P2DArrayAdapter* mArr;
