Index: /trunk/SophyaPI/PI/Makefile
===================================================================
--- /trunk/SophyaPI/PI/Makefile	(revision 36)
+++ /trunk/SophyaPI/PI/Makefile	(revision 37)
@@ -4,5 +4,5 @@
  
 all: $(LIB)libPI.a
-$(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
+$(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psdict.o $(OBJ)psfile.o
 	$(AR) $(ARFLAGS)  $@ $?
  
@@ -14,7 +14,9 @@
  pimenubargen.h pimenux.h pimenugen.h
 $(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
- pimsghandler.h
+ pimsghandler.h psfile.h $(INC)defs.h \
+ pibwdgx.h picmap.h picmapx.h picmapgen.h
 $(OBJ)pibwdgx.o: pibwdgx.cc pibwdgx.h pisysdep.h pibwdggen.h piwdgx.h \
- piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h
+ piwdggen.h pimsghandler.h pixtbaseP.h pixtbase.h psfile.h \
+ $(INC)defs.h picmap.h picmapx.h picmapgen.h
 $(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h
 $(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h
@@ -44,5 +46,6 @@
  $(INC)perrors.h \
  $(INC)exceptions.h \
- $(INC)peidainit.h
+ $(INC)peidainit.h \
+ $(INC)fmath.h
 $(OBJ)piimage.o: piimage.cc piimage.h $(INC)cimage.h \
  $(INC)rzimage.h \
@@ -55,4 +58,7 @@
  $(INC)imaginit.h \
  $(INC)datatypes.h \
+ $(INC)ppersist.h \
+ $(INC)pclassids.h \
+ $(INC)dvlist.h \
  $(INC)lut.h pisysdep.h pipixmapx.h \
  pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h \
@@ -71,4 +77,5 @@
  $(INC)peida.h \
  $(INC)utils.h \
+ $(INC)fmath.h \
  $(INC)array.h \
  $(INC)lockfile.h \
@@ -104,5 +111,5 @@
 $(OBJ)pipixmapx.o: pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \
  pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
- picmapx.h picmapgen.h
+ picmapx.h picmapgen.h psfile.h $(INC)defs.h
 $(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
  pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \
@@ -117,4 +124,5 @@
  $(INC)machine.h \
  $(INC)perrors.h \
+ $(INC)fmath.h \
  $(INC)ppersist.h \
  $(INC)pclassids.h \
@@ -124,4 +132,35 @@
 $(OBJ)pistdwdgx.o: pistdwdgx.cc pisysdep.h pistdwdgx.h pistdwdggen.h \
  piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)pistlist.o: pistlist.cc pistlist.h piscdrawwdg.h pisysdep.h pibwdgx.h \
+ pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h pistdwdgx.h \
+ pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h $(INC)stlist.h \
+ $(INC)machine.h \
+ $(INC)defs.h \
+ $(INC)exceptions.h \
+ $(INC)peidainit.h \
+ $(INC)perrors.h \
+ $(INC)dynccd.h \
+ $(INC)ppersist.h \
+ $(INC)pclassids.h \
+ $(INC)imaginit.h \
+ $(INC)star.h \
+ $(INC)strecinit.h \
+ $(INC)starmacro.h \
+ $(INC)psf.h \
+ $(INC)peida.h \
+ $(INC)utils.h \
+ $(INC)fmath.h \
+ $(INC)cimage.h \
+ $(INC)rzimage.h \
+ $(INC)rzvect.h \
+ $(INC)datatypes.h \
+ $(INC)dvlist.h \
+ $(INC)generalfit.h \
+ $(INC)matrix.h \
+ $(INC)cvector.h \
+ $(INC)transfo.h \
+ $(INC)poly.h \
+ $(INC)zfidu.h
 $(OBJ)piup.o: piup.cc $(INC)ctimer.h \
  $(INC)peida.h \
@@ -132,4 +171,5 @@
  $(INC)exceptions.h \
  $(INC)peidainit.h \
+ $(INC)fmath.h \
  $(INC)imageop.h \
  $(INC)cimage.h \
@@ -138,4 +178,7 @@
  $(INC)imaginit.h \
  $(INC)datatypes.h \
+ $(INC)ppersist.h \
+ $(INC)pclassids.h \
+ $(INC)dvlist.h \
  $(INC)fitsimage.h \
  $(INC)fitsheader.h \
@@ -153,11 +196,20 @@
  $(INC)tarlib.h piup.h
 $(OBJ)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \
- pisysdep.h piwdgx.h
+ pisysdep.h piwdgx.h psfile.h $(INC)defs.h \
+ pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h
 $(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \
  pisysdep.h picontainergen.h
 $(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \
- picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
+ picontainergen.h piwdgx.h piwdggen.h pimsghandler.h psfile.h \
+ $(INC)defs.h pibwdgx.h pibwdggen.h picmap.h \
+ picmapx.h picmapgen.h
 $(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \
  picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
 $(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
  piwdgx.h piwdggen.h pimsghandler.h pixtbase.h
+$(OBJ)psdict.o: psdict.cc psfile.h $(INC)defs.h \
+ pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
+ picmap.h picmapx.h picmapgen.h
+$(OBJ)psfile.o: psfile.cc psfile.h $(INC)defs.h \
+ pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
+ picmap.h picmapx.h picmapgen.h
Index: /trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.h	(revision 36)
+++ /trunk/SophyaPI/PI/pibwdggen.h	(revision 37)
@@ -57,5 +57,5 @@
 //  Trace graphiques
   virtual void       EraseWindow()             = 0;
-  virtual void       DrawString(int x, int y, char* s, int pos = 0)        = 0;
+  virtual void       DrawString(int x, int y, char* s, int pos = 0)  = 0;
   virtual void       DrawLine(int x1, int y1, int x2, int y2)              = 0;
   virtual void       DrawBox(int x0, int y0, int dx, int dy)               = 0;
Index: /trunk/SophyaPI/PI/picmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/picmapx.cc	(revision 36)
+++ /trunk/SophyaPI/PI/picmapx.cc	(revision 37)
@@ -95,7 +95,16 @@
 
 if ( (index < 0) || (index > mNCol) )  return;
+
+if ( (col.red == 0) && (col.green == 0) && (col.blue == 0) )
+  {
+  mColors[index] = BlackPixel(PIXDisplay(), PIXScreen());
+  mColRGB[index] = col; 
+  return;
+  }
+
 myxcol.red = col.red; 
 myxcol.blue = col.blue;
 myxcol.green = col.green;
+
 
 if ( XAllocColor(PIXDisplay(), defxcmap, &myxcol) )
@@ -121,4 +130,7 @@
 void PIColorMapX::FreeColors()
 {
+PIXColor bpix;
+PIColor blc;
+
 if (!xinicmap)  
   {
@@ -127,9 +139,12 @@
   }
 
-XFreeColors(PIXDisplay(), defxcmap, mColors,  mNCol, 0);
+for (int i=0; i<mNCol; i++)
+  if ( (mColRGB[i].red != 0) && (mColRGB[i].blue != 0) &&  (mColRGB[i].green != 0) )
+    XFreeColors(PIXDisplay(), defxcmap, mColors+i, 1, 0);
 
+bpix = BlackPixel(PIXDisplay(), PIXScreen());
+blc.red = blc.green = blc.blue = 0;
 for (int i=0; i<mNCol; i++)  
-  { mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
-  mColRGB[i].red = mColRGB[i].green = mColRGB[i].blue = 0; }
+  { mColors[i] = bpix;   mColRGB[i] = blc; }
 
 printf("PIColorMapX::FreeColors()  Type= %d mNCol= %d \n",
Index: /trunk/SophyaPI/PI/pifilechox.cc
===================================================================
--- /trunk/SophyaPI/PI/pifilechox.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pifilechox.cc	(revision 37)
@@ -10,4 +10,7 @@
 #include <X11/Shell.h>
 #include <Xm/FileSB.h>
+
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
 
 // Fonctions privees (CallBack)
@@ -24,7 +27,5 @@
 pif->MWin()->Unmanage();
 //pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str()));
-char *flnm;
-XmStringGetLtoR(calld->value, XmSTRING_DEFAULT_CHARSET, &flnm); 
-strncpy(pif->mFName, flnm, 511); 
+CStrFrXmStr(calld->value, pif->mFName, 512); 
 pif->Send( pif->Msg(), PIMsg_OK, (void *) pif->mFName);
 return;
@@ -142,5 +143,4 @@
 if (mSt)
   {
-  char *buff;
   XmString xmstr;
   Arg warg[2];
@@ -148,6 +148,6 @@
   XtSetArg(warg[0], XmNtextString, &xmstr);
   XtGetValues(XtWdg(), warg, 1);
-  XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff); 
-  string s(buff);
+  CStrFrXmStr(xmstr, mFName, 512); 
+  string s(mFName);
   XmStringFree(xmstr);
   return(s);
@@ -155,5 +155,6 @@
 else
   {
-  string s("");
+  mFName[0] = '\0';
+  string s(mFName);
   return(s);
   }
Index: /trunk/SophyaPI/PI/pihisto.cc
===================================================================
--- /trunk/SophyaPI/PI/pihisto.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pihisto.cc	(revision 37)
@@ -12,10 +12,4 @@
   if (ahisup)
     delete mHisto;
-}
-
-void
-PIHisto::SetAutoDelHisto(bool ad)
-{
-  ahisup = ad;
 }
 
Index: /trunk/SophyaPI/PI/pihisto.h
===================================================================
--- /trunk/SophyaPI/PI/pihisto.h	(revision 36)
+++ /trunk/SophyaPI/PI/pihisto.h	(revision 37)
@@ -13,5 +13,7 @@
   virtual void       DrawStats();
   virtual void       Refresh();  // Recalcule les limites, et reaffiche
-  void               SetAutoDelHisto(bool ad=false);
+  inline  void       SetAutoDelHisto(bool ad=false) {  ahisup = ad; } 
+  inline  Histo*     Histogram() { return(mHisto); }
+
 protected:
   Histo* mHisto;
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 37)
@@ -24,11 +24,17 @@
 curshow = true;
 winovis = true;     // $CHECK$ Reza A enlever si possible 17/6/96
-zow = NULL; 
+
+admrk = true;
+xpmrk = ypmrk = NULL;   nbmrk = 0;
+mrkt = PI_PlusMarker;   mrkbsz = 3;
+
+zow = NULL;
+gvw = NULL; 
 trtw = NULL;
 trtlb = txw = NULL;
 SetTextWin(NULL);
-zpixm = pixm = NULL;
-xszpxm = xspxm = 0;
-yszpxm = yspxm = 0;
+gpixm = zpixm = pixm = NULL;
+xsgpxm = xszpxm = xspxm = 0;
+ysgpxm = yszpxm = yspxm = 0;
 lut = NULL; 
 offx = offy = 0;
@@ -40,4 +46,5 @@
 xcurs = ycurs = -1;
 zoom = 1;
+zmgv = 1;
 
 SetColMap(CMAP_COLRJ32);
@@ -60,7 +67,40 @@
 if (pixm) delete pixm;
 if (zpixm) delete zpixm;
+if (txw)  txw->SetLabel("");
+if (zow) 
+  {
+  zow->SetPixmap(NULL,0,0);
+  zow->EraseWindow();
+  }
+if (gpixm) delete gpixm;
+if (gvw) 
+  {
+  gvw->SetPixmap(NULL,0,0);
+  gvw->EraseWindow();
+  gvw->SetMsg(0); gvw->SetMsgParent(NULL); 
+  gvw->SetUserData(NULL, 0); 
+  }
 if (lut) delete lut;
 if (aisup)  delete img;   // Suppression automatique d'image
+if (admrk) 
+  {
+  if (xpmrk)  delete xpmrk;
+  if (ypmrk)  delete ypmrk;
+  }
 if (trtw)  delete trtw;
+}
+
+/* --Methode-- */
+void PIImage::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+if (UserMsg(msg) == (Msg()+626))
+  {
+  if (ModMsg(msg) == PIMsg_Click) 
+    { int* pxy=(int *)data;   SetPave(pxy[0]*zmgv, pxy[1]*zmgv); }
+  if (ModMsg(msg) == PIMsg_Resize)
+    { ComputeGloVPixmap();   SetGloVPixmap(); }
+  }
+else ReSend(msg, sender, data);
+return;
 }
 
@@ -73,4 +113,9 @@
 xszpav = yszpav = 1;
 img = pim;
+if (gpixm) delete gpixm;
+gpixm = NULL;
+xsgpxm = ysgpxm = 0;
+zmgv = 1;
+
 if (img)
   {
@@ -83,4 +128,29 @@
 }
 
+/* --Methode-- */
+void PIImage::AddMarks(int nm, float* px, float* py, bool refr, bool ad, PIMarker mrk, int msz)
+{
+if ( (nbmrk > 0) && admrk ) {
+  if (xpmrk)  delete xpmrk;
+  if (ypmrk)  delete ypmrk;
+}
+if (nm <= 0) { nbmrk = 0; xpmrk = ypmrk = NULL; }
+else { nbmrk = nm;  xpmrk = px, ypmrk = py; }
+admrk = ad;  mrkt = mrk;  mrkbsz = msz;
+if (refr)  DrawMarks(0, XSize(), 0, YSize());
+return;
+}
+
+/* --Methode-- */
+void PIImage::RemoveMarks(bool refr)
+{
+if (nbmrk < 1)  return;
+if (admrk ) {
+  if (xpmrk)  delete xpmrk;
+  if (ypmrk)  delete ypmrk;
+}
+nbmrk = 0; xpmrk = ypmrk = NULL;
+if (refr)  Refresh();
+}
 
 /* --Methode-- */
@@ -89,10 +159,19 @@
 zow = zw;
 if (zow && refr && img)
-  {
-  zow->SetColMap(GetColMapId(), false);
   ComputeZoomPixmap();
-  }
-return;
-}
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetGloVWin(PIPixmap * zw, bool refr) 
+{
+gvw = zw;
+if (gvw && img)  
+  { ComputeGloVPixmap();
+  if (refr) SetGloVPixmap(); } 
+return;
+}
+
+
 
 /* --Methode-- */
@@ -170,4 +249,5 @@
 lut = new LUT(min, max, NbCol(), typlut);
 
+ComputeGloVPixmap();
 if (refr) Apply();
 return;
@@ -182,4 +262,5 @@
 if (olut) delete olut;
 
+ComputeGloVPixmap();
 if (refr) Apply();
 return;
@@ -202,6 +283,6 @@
 {
 if ((zm == 0) || (zm == -1) )  zoom = 1;
-else if (zm > 10)  zoom = 10;
-else if (zm < -10) zoom = -10;
+else if (zm > 20)  zoom = 20;
+else if (zm < -20) zoom = -20;
 else zoom = zm;
 if (img)
@@ -235,5 +316,5 @@
 
 /* --Methode-- */
-void PIImage::SetPave(int x, int y, bool refr)
+void PIImage::SetPave(int x, int y, bool refr, bool cent)
 {
 int xc, yc;
@@ -247,6 +328,8 @@
      (y >= (img->YSize()-1)) || ( y < 0)  ) return;
 
+if ( (x == xpav) && (y == ypav) )  return;
 xpav = x;  ypav = y;
-if (PosImg2W(xpav,ypav,&xc, &yc))  // Il faut recenter l'image
+
+if ( PosImg2W(xpav,ypav,&xc, &yc) || cent)  // Il faut recenter l'image
   { SetOffsetFromPave();  
   if (refr) Apply(true);  }
@@ -263,4 +346,5 @@
 PIPixmap::SetColMap(cmap, refr);
 if (zow)  zow->SetColMap(cmap, refr);
+if (gvw)  gvw->SetColMap(cmap, refr);
 return;
 }
@@ -272,13 +356,12 @@
 if (img == NULL)  return;
 if (mw)
-  { 
+  {  
   ComputePixmap();
   Send(Msg(), PIMsg_Active);
   }
-if (zow != NULL) 
-  {
-  zow->SetColMap(GetColMapId(), false);
-  ComputeZoomPixmap();
-  }
+if (zow != NULL)   ComputeZoomPixmap();
+if (gvw != NULL)
+  if ( (gvw->UserData() != this) || (mw) )  SetGloVPixmap();
+
 if (txw || trtlb)
   {
@@ -315,4 +398,6 @@
       (yc >= y0) && (yc < y0+dy) )  DrawCursor(xc, yc);
   }
+
+DrawMarks(x0, x0+dx, y0, y0+dy);
 return;
 }
@@ -360,5 +445,4 @@
 void PIImage::But2Press(int x, int y)
 {
-int xp, yp;
 
 Send(Msg(), PIMsg_Active);
@@ -614,4 +698,5 @@
 
 zpixm = ComputePixmap(ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);
+zow->SetColMap(GetColMapId(), false);
 zow->SetPixmap(zpixm, xszpxm, yszpxm); 
 zow->SetUserData((void *)this, 0);
@@ -621,4 +706,54 @@
 }
 
+
+/* --Methode-- */
+void PIImage::ComputeGloVPixmap()
+{
+unsigned int xwsz, ywsz;
+int zmx,zmy;
+
+if (gvw == NULL)  return;
+if (img == NULL)  return;
+
+xwsz = gvw->XSize();
+ywsz = gvw->YSize();
+
+zmx = img->XSize()/xwsz;
+zmy = img->YSize()/ywsz;
+
+if (zmx < zmy)   zmx = zmy;
+if (zmx < 1)  zmx = 1;
+zmgv = zmx;
+if (zmx > 1)  zmx = -zmx; 
+gpixm = ComputePixmap(0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm);
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetGloVPixmap()
+{
+float zm;
+int x,y, dx,dy;
+
+if (zoom > 0) zm = zmgv*zoom;
+else zm = (float)zmgv/(float)(-zoom);
+x = offx/zmgv+1;
+y = offy/zmgv+1;
+dx =  (int) ( (float)XSize()/zm-1. );  
+dy =  (int) ( (float)YSize()/zm-1. );  
+
+gvw->ElDelAll();
+gvw->SelForeground(PI_Yellow);
+gvw->SelLine(PI_NormalLine);
+gvw->ElAddRect(x,y,dx,dy);
+gvw->SetColMap(GetColMapId(), false);
+gvw->SetPixmap(gpixm, xsgpxm, ysgpxm); 
+gvw->SetUserData((void *)this, 0);
+gvw->SetMsg(Msg()+626);
+gvw->SetMsgParent(this);
+
+return; 
+}
+
 /* --Methode-- */
 void PIImage::DrawCursor() 
@@ -645,4 +780,7 @@
   if (zoom < 3)  SelLine(PI_NormalLine);
   else SelLine(PI_ThickLine);
+  if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
+    SelForeground(PI_Red);
+  else SelForeground(PI_White);
   SelGOMode(PI_GOCopy);
   DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
@@ -653,4 +791,31 @@
 else { xcurs = ycurs = -1; }
 
+return;
+}
+
+/* --Methode-- */
+void PIImage::DrawMarks(int x1, int x2, int y1, int y2)
+{
+float fz;
+float tofx, tofy;
+int i,x,y;
+
+if ( (winovis || (nbmrk < 1) ) ) return;
+tofx = tofy = 0;
+if ( img ) { tofx = img->XOrg(); tofy = img->YOrg(); }  
+tofx += offx;  tofy += offy; 
+fz = GetZoomF();
+SelGOMode(PI_GOCopy);
+SelMarker((int)(fz*mrkbsz), mrkt);
+if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
+  SelForeground(PI_Red);
+else SelForeground(PI_White);
+for(i=0; i<nbmrk; i++)
+  { 
+  x = (int) ((xpmrk[i]-tofx)*fz);
+  y = (int) ((ypmrk[i]-tofy)*fz);
+  if ((x < x1) || (x > x2) || (y < y1) || (y > y2))  continue;
+  DrawMarker(x,y);
+  }
 return;
 }
Index: /trunk/SophyaPI/PI/piimage.h
===================================================================
--- /trunk/SophyaPI/PI/piimage.h	(revision 36)
+++ /trunk/SophyaPI/PI/piimage.h	(revision 37)
@@ -19,4 +19,6 @@
 
 public:
+  enum {ClassId = 5150};
+
 //  Les methodes 
 
@@ -25,8 +27,16 @@
   ~PIImage();
 
-  void SetImage(RzImage *pim, bool refr=true);
+  virtual long    kind() {return ClassId; }
+  virtual void    Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+  void SetImage(RzImage* pim, bool refr=true);
   void SetAutoDelImage(bool ad = false);
 
+  void AddMarks(int nm, float* px, float* py, bool refr=true, 
+                bool ad=true, PIMarker mrk=PI_PlusMarker, int msz=3);
+  void RemoveMarks(bool refr=true);                
+
   void SetZoomWin(PIPixmap * zw, bool refr=true);
+  void SetGloVWin(PIPixmap * zw, bool refr=true);
   void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30);
   void ShowCursor(bool sc=true); 
@@ -41,5 +51,5 @@
 
   void SetOffset(int ox, int oy, bool refr=true);
-  void SetPave(int x, int y, bool refr=true);
+  void SetPave(int x, int y, bool refr=true, bool cent=true);
 
   virtual void SetColMap(CMapId cmap, bool refr=true);
@@ -75,7 +85,10 @@
   void ComputePixmap();
   void ComputeZoomPixmap();
+  void ComputeGloVPixmap();
+  void SetGloVPixmap();
 
   void DrawCursor();
   void DrawCursor(int xc, int yc);
+  void DrawMarks(int x1, int x2, int y1, int y2);
 
   void ShowTrTxW();
@@ -94,19 +107,29 @@
   bool winovis;   // $CHECK$ Reza A enlever si possible 17/6/96
 
+// Pour gerer les marques ajoutees
+  bool admrk;
+  int nbmrk, mrkbsz;
+  float * xpmrk, * ypmrk;
+  PIMarker mrkt;
+// Tableau des pixels principal  
   unsigned char * pixm;
   int xspxm, yspxm;
-
   LUT * lut;
   int offx, offy;
-
+// Fenetre de zoom
   int zoom;
   PIPixmap * zow;
   unsigned char * zpixm;
   int xszpxm, yszpxm;
-
+// Fenetre pour l'image entiere  
+  int zmgv;
+  PIPixmap * gvw;
+  unsigned char * gpixm;
+  int xsgpxm, ysgpxm;
+// Fenetre/champ de texte
   PILabel * txw;
   PILabel * trtlb;
   PIWindow * trtw;
-
+// Le pave et le curseur
   int xpav, ypav;
   int xpv0, ypv0;
Index: /trunk/SophyaPI/PI/pilistx.cc
===================================================================
--- /trunk/SophyaPI/PI/pilistx.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pilistx.cc	(revision 37)
@@ -7,6 +7,9 @@
 #include <Xm/List.h>
 
+
 /************* PIListX ************/
 
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
 
 // Fonction prive (CallBack)
@@ -228,13 +231,12 @@
 {
 Arg  warg[2];
-char *buff;
 XmString *xmst;
 
-if ( (n < 0) || (n >= mNItem))  return("");
+if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
 
 XtSetArg(warg[0], XmNitems, &xmst);  
 XtGetValues(mlist, warg, 1);
-XmStringGetLtoR(xmst[n], XmSTRING_DEFAULT_CHARSET, &buff);
-return(buff);
+CStrFrXmStr(xmst[n], mSItem, 320);
+return(mSItem);
 }
 
Index: /trunk/SophyaPI/PI/pilistx.h
===================================================================
--- /trunk/SophyaPI/PI/pilistx.h	(revision 36)
+++ /trunk/SophyaPI/PI/pilistx.h	(revision 37)
@@ -43,4 +43,5 @@
 int * mSelNum;
 bool mMultSel;
+char mSItem[320];
 
 SysDWdg mlist;
Index: /trunk/SophyaPI/PI/pimenugen.h
===================================================================
--- /trunk/SophyaPI/PI/pimenugen.h	(revision 36)
+++ /trunk/SophyaPI/PI/pimenugen.h	(revision 37)
@@ -14,5 +14,5 @@
 	          ~PIMenuGen();
 				   
-  virtual void	  AppendItem(char* nom, PIMessage msg)=0;
+  virtual void	  AppendItem(char* nom, PIMessage msg, char* sc=NULL)=0;
 
   virtual void    DeleteItem(char *nom)=0;
Index: /trunk/SophyaPI/PI/pimenumac.cc
===================================================================
--- /trunk/SophyaPI/PI/pimenumac.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pimenumac.cc	(revision 37)
@@ -43,5 +43,5 @@
 
 void
-PIMenuMac::AppendItem(char* nom, PIMessage msg)
+PIMenuMac::AppendItem(char* nom, PIMessage msg, char* sc)  // sc = short-cut , raccourci clavier
 {
   LStr255 titre(nom);
Index: /trunk/SophyaPI/PI/pimenumac.h
===================================================================
--- /trunk/SophyaPI/PI/pimenumac.h	(revision 36)
+++ /trunk/SophyaPI/PI/pimenumac.h	(revision 37)
@@ -13,5 +13,5 @@
 				   ~PIMenuMac();
 				   
-	virtual void	AppendItem(char* nom, PIMessage msg);
+    virtual void    AppendItem(char* nom, PIMessage msg, char* sc=NULL);
 
     virtual void    DeleteItem(char *nom);
Index: /trunk/SophyaPI/PI/pimenux.cc
===================================================================
--- /trunk/SophyaPI/PI/pimenux.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pimenux.cc	(revision 37)
@@ -11,4 +11,6 @@
 /************* PIMenuX ************/
 
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
 
 // Fonction prive (CallBack)
@@ -25,5 +27,5 @@
 
 // pim->Hide();
-pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb).c_str());
+pim->Send(cusd->msg, PIMsg_Click, (void *)pim->ItemNameWdg(cusd->itb));
 #ifdef DEBUG_PIMenuX
 printf("%%%Debug_menub_action: Msg= %d  %lx\n", (int)cusd->msg, (long)pim);
@@ -60,7 +62,7 @@
 
 /* --Methode-- */
-void PIMenuX::AppendItem(char* nom, PIMessage msg)
-{
-AddItem(nom, msg, false);
+void PIMenuX::AppendItem(char* nom, PIMessage msg, char* sc)
+{
+AddItem(nom, msg, false, sc);
 }
 
@@ -68,8 +70,7 @@
 void PIMenuX::DeleteItem(char *nom)
 {
-string s(nom);
-
-for(int i=0; i<mNItem; i++)
-  if (ItemName(i) == s)  
+
+for(int i=0; i<mNItem; i++)
+  if (strcmp(ItemName(i), nom) == 0)  
     { DeleteItemNum(i);  break; }
 
@@ -111,8 +112,7 @@
 void PIMenuX::CheckItem(char *nom, bool st)
 {
-string s(nom);
-
-for(int i=0; i<mNItem; i++)
-  if (ItemName(i) == s)  
+
+for(int i=0; i<mNItem; i++)
+  if (strcmp(ItemName(i), nom) == 0)  
     { CheckItemNum(i, st);  break; }
 
@@ -159,16 +159,14 @@
 
 /* --Methode-- */
-string PIMenuX::ItemName(int n)
-{
-if ( (n < 0) || (n >= mNItem))  return("");
-return (ItemNameWdg(mBut[n].itb));
-}
-
-
-/* --Methode-- */
-string PIMenuX::ItemNameWdg(SysDWdg itw)
-{
-string s;
-char *buff;
+char* PIMenuX::ItemName(int n)
+{
+if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
+else return (ItemNameWdg(mBut[n].itb));
+}
+
+
+/* --Methode-- */
+char* PIMenuX::ItemNameWdg(SysDWdg itw)
+{
 XmString xmstr;
 Arg warg[2];
@@ -178,11 +176,10 @@
 if (xmstr)
   {
-  XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);
-  s=buff;
+  CStrFrXmStr(xmstr, mSItem, 96);
   XmStringFree(xmstr);
   }
-else s = "";
-
-return(s);
+else mSItem[0] = '\0';
+
+return(mSItem);
 }
 
@@ -200,8 +197,7 @@
 int PIMenuX::GetNumItem(char *nom)
 {
-string s(nom);
-
-for(int i=0; i<mNItem; i++)
-  if (ItemName(i) == s)  return(i);
+
+for(int i=0; i<mNItem; i++)
+  if (strcmp(ItemName(i),nom) == 0)  return(i);
 return(-1);
 }
@@ -224,5 +220,5 @@
 
 /* --Methode-- */
-void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog)
+void PIMenuX::AddItem(char* nom, PIMessage msg, bool tog, char* sc)
 {
 _pimxit_ *buto;
@@ -264,4 +260,20 @@
 XtAddCallback(mBut[mNItem].itb, cbckn, 
               menub_action, (XtPointer)(mBut+mNItem));
+if (sc)  // Raccourci clavier 
+  {
+  char acc[16];
+  int n=0;
+  Arg warg[2];
+  XmString xmstr;
+
+  sprintf(acc,"Ctrl/%c", sc[0]);
+  xmstr = XmStringLtoRCreate(acc, XmSTRING_DEFAULT_CHARSET);
+  XtSetArg(warg[n], XmNacceleratorText, xmstr); n++;
+  sprintf(acc,"Ctrl<Key>%c", sc[0]);
+  XtSetArg(warg[n], XmNaccelerator, acc); n++;
+  XtSetValues(mBut[mNItem].itb, warg, n);  
+  XmStringFree(xmstr);
+  }
+
 #ifdef DEBUG_PIMenuX
 printf("DBG>> %d (%d) %lx \n", mNItem, mNItemMax, (long)(mBut+mNItem));
@@ -394,2 +406,3 @@
 }
 
+
Index: /trunk/SophyaPI/PI/pimenux.h
===================================================================
--- /trunk/SophyaPI/PI/pimenux.h	(revision 36)
+++ /trunk/SophyaPI/PI/pimenux.h	(revision 37)
@@ -22,5 +22,5 @@
 	          ~PIMenuX();
 				   
-  virtual void	  AppendItem(char* nom, PIMessage msg);
+  virtual void	  AppendItem(char* nom, PIMessage msg, char* sc=NULL);
 
   virtual void    DeleteItem(char *nom);
@@ -41,14 +41,14 @@
   int             GetNumItemMsg(PIMessage msg);
   SysDWdg         GetItemWdg(int n);
-  string          ItemName(int n);
-  string          ItemNameWdg(SysDWdg itw);
+  char*           ItemName(int n);
+  char*           ItemNameWdg(SysDWdg itw);
 
 protected:
-        void      AddItem(char* nom, PIMessage msg, bool tog);
+        void      AddItem(char* nom, PIMessage msg, bool tog, char* sc=NULL);
         void      Check();
 
 int mNItem, mNItemMax;
 _pimxit_  * mBut;
-
+char mSItem[96];
 };
 
Index: /trunk/SophyaPI/PI/pimsghandler.h
===================================================================
--- /trunk/SophyaPI/PI/pimsghandler.h	(revision 36)
+++ /trunk/SophyaPI/PI/pimsghandler.h	(revision 37)
@@ -11,4 +11,5 @@
 	PIMsg_Active        = 1,
         PIMsg_Close         = 2,
+        PIMsg_Resize        = 3,
 
 	PIMsg_OK            = 11,
@@ -20,4 +21,5 @@
         PIMsg_Press         = 23,
         PIMsg_Drag          = 24,
+        PIMsg_Drop          = 25,
 
         PIMsg_Select        = 31,
Index: /trunk/SophyaPI/PI/pipixmapgen.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 37)
@@ -18,5 +18,9 @@
 pixmap = NULL;
 nx = ny = 0;
+ofx = ofy = 0;
+mPpos[0] = mPpos[0] = 0;
 cmap = new PIColorMap(CMAP_GREY32);
+mEn = 0;
+ActivateButton(1);
 }
 
@@ -29,7 +33,17 @@
 
 /* --Methode-- */
-void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
+void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy)
 {
-pixmap = pix; nx = sx; ny = sy;
+pixmap = pix; 
+if (pixmap)
+  {
+  if (sx < 0)  sx = 0;
+  if (sy < 0)  sy = 0;
+  if (ox < 0)  ox = 0;
+  if (oy < 0)  oy = 0;
+  nx = sx; ny = sy;
+  ofx = ox;  ofy = oy;
+  }
+else { ofx = ofy = nx = ny = 0; }
 if (refr) Refresh();   
 }
@@ -45,4 +59,77 @@
 
 
+/* --Methode-- */
+void  PIPixmapGen::But1Press(int x, int y)
+{
+mPpos[0] = x;  mPpos[1] = y;  
+if (Msg())  Send(Msg(), PIMsg_Click, mPpos);
+return;
+}
+
+
+/* --Methode-- */
+int PIPixmapGen::ElAdd(int typ, int x, int y, int dx, int dy, char* s)
+{
+DrwEl dre;
+mEn++;
+dre.eid = mEn;  dre.etyp = typ;
+dre.ex = x;   dre.ey = y;
+dre.edx = dx;  dre.edy = dy;
+if (s)  dre.es = s;
+mElist.push_back(dre);
+return(mEn);
+}
+
+/* --Methode-- */
+void  PIPixmapGen::ElDel(int id)
+{
+DrwElList::iterator it;
+for (it = mElist.begin(); it != mElist.end(); it++)
+  if ( (*it).eid == id) { mElist.erase(it);   break; }
+return;
+}
+
+/* --Methode-- */
+void  PIPixmapGen::ElDelAll()
+{
+mElist.erase(mElist.begin(), mElist.end());
+return;
+}
+
+/* --Methode-- */
+void  PIPixmapGen::DrawElements()
+{
+char* txt;
+DrwElList::iterator it;
+for (it = mElist.begin(); it != mElist.end(); it++)
+  {
+  switch ( (*it).etyp )
+    {
+    case PIDEL_Line :
+      DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_Text :
+      txt = (*it).es.c_str();
+      DrawString((*it).ex, (*it).ey, txt ); 
+      break;
+    case PIDEL_Rect :
+      DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_FRect :
+      DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_Circ :
+      DrawCircle((*it).ex, (*it).ey, (*it).edx ); 
+      break;
+    case PIDEL_FCirc :
+      DrawFCircle((*it).ex, (*it).ey, (*it).edx ); 
+      break;
+    default :
+      break;
+    }
+  }
+return;
+}
+
 
 // Fin des methodes de la classe 
Index: /trunk/SophyaPI/PI/pipixmapgen.h
===================================================================
--- /trunk/SophyaPI/PI/pipixmapgen.h	(revision 36)
+++ /trunk/SophyaPI/PI/pipixmapgen.h	(revision 37)
@@ -9,4 +9,6 @@
 #include PICMAP_H
 
+#include <list.h>
+
 class PIPixmapGen : public PIBaseWdg
 {
@@ -14,19 +16,60 @@
   enum {ClassId = 5100};
 
+  enum { PIDEL_Line = 1, PIDEL_Text = 2,
+         PIDEL_Rect = 3, PIDEL_FRect = 4, 
+         PIDEL_Circ = 5, PIDEL_FCirc = 6 } ; 
+
                 PIPixmapGen(PIContainerGen *par, char *nom,
                          int sx=10, int sy=10, int px=0, int py=0);
-  virtual      ~PIPixmapGen();
+  virtual       ~PIPixmapGen();
 
-  virtual long    kind() {return ClassId; }
+  virtual long  kind() {return ClassId; }
 
-  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
+  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, 
+                          bool refr=true, int ox=0, int oy=0);
   void          SetColMap(CMapId cmapid, bool refr=true);
   inline CMapId GetColMapId() { return (cmap->Type()); }; 
   inline int    NbCol() { return(cmap->NCol()); };
 
+  virtual void  But1Press(int x, int y);
+  inline  int   XPPos() { return mPpos[0]; }
+  inline  int   YPPos() { return mPpos[1]; }
+
+  inline int    ElAddLine(int x1, int y1, int x2, int y2)
+    { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL) ); }  
+  inline int    ElAddText(int x, int y, char* s)
+    { return( ElAdd(PIDEL_Text, x, y, 0, 0, s) ); }  
+  inline int    ElAddRect(int x, int y, int dx, int dy)
+    { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL) ); }  
+  inline int    ElAddFRect(int x, int y, int dx, int dy)
+    { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL) ); }  
+  inline int    ElAddCirc(int x, int y, int r)
+    { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL) ); }  
+  inline int    ElAddFCirc(int x, int y, int r)
+    { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL) ); }  
+
+  void          ElDel(int id);
+  void          ElDelAll();
+
 protected:
+  int           ElAdd(int typ, int x, int y, int dx, int dy, char* s);
+  virtual void  DrawElements();
+
   unsigned char *pixmap;
   int nx, ny;
+  int ofx, ofy;
   PIColorMap* cmap;
+
+  typedef struct {
+    int eid, etyp;
+    int ex,ey;
+    int edx,edy;
+    string es;
+  } DrwEl;
+  typedef list<DrwEl> DrwElList;
+
+  DrwElList mElist;
+  int mEn;
+  int mPpos[2];
 };  
   
Index: /trunk/SophyaPI/PI/pipixmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapx.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pipixmapx.cc	(revision 37)
@@ -41,9 +41,10 @@
       { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
     }
+  }
 
-  for(j=ny; j<YSize(); j++)
-    for(i=nx; i<XSize(); i++)
-      XPutPixel(myximg, i, j, 0 );
-  }
+for(j=ny; j<YSize(); j++)
+  for(i=nx; i<XSize(); i++)
+     XPutPixel(myximg, i, j, 0 );
+
 PIBaseWdgX::Refresh();
 }
@@ -56,13 +57,17 @@
 XFree(myximg); 
 AllocXImg();
+if (Msg())  Send(Msg(), PIMsg_Resize, mPpos);
 }
+
 /* --Methode-- */
 void PIPixmapX::Draw()
 {
 if(mPSOut)
+  {
   if(pixmap) 
     mPSOut->Image(0, 0, (float)XSize(), (float)YSize(), nx, ny, pixmap, cmap);
-  else
-    return; /* pour l'instant */
+  /*  Il faut faire quelque chose Sinon ??! */ 
+  DrawElements();
+  }
 else
   Draw(0, 0, XSize(), YSize());
@@ -72,4 +77,5 @@
 void PIPixmapX::Draw(int x0, int y0, int dx, int dy)
 {
+int mx, my, ox, oy;
 Window xw;
 Display * mdsp;
@@ -81,18 +87,30 @@
 if (x0 < 0)  x0 = 0;
 if (y0 < 0)  y0 = 0;
-
+mx = nx+ofx;   my = ny+ofy;
 if (dx > (XSize()-x0)) dx = XSize()-x0;
 if (dy > (YSize()-y0)) dy = YSize()-y0;
 if ((dx <= 0) || (dy <= 0))  return;
 
-if ( (nx < x0 ) || (ny < y0) )
+if ( (mx < x0 ) || (my < y0) )
   { XClearArea(mdsp, xw, x0, y0, dx, dy, False);  return; }
 
-if (nx < (x0+dx))
-  { XClearArea(mdsp, xw, nx, y0, x0+dx-nx, dy, False);  dx = nx-x0; }
-if (ny < (y0+dy))
-  { XClearArea(mdsp, xw, x0, ny, dx, y0+dy-ny, False);  dy = ny-y0; }
-  
-XPutImage(mdsp, xw, mygc, myximg, x0, y0, x0, y0, dx, dy);
+ox = oy = 0;  
+
+if (ofx > x0)
+  { XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False);   
+  dx -= (ofx-x0);  x0 = ofx;  ox = 0; }
+else  ox = x0-ofx;
+if (ofy > y0)
+  { XClearArea(mdsp, xw, x0, y0, dx, ofy-y0, False);  
+  dy -= (ofy-y0);  y0 = ofy;  oy = 0; }
+else  oy = y0-ofy;
+ 
+if (mx < (x0+dx))
+  { XClearArea(mdsp, xw, mx, y0, x0+dx-mx, dy, False);  dx = mx-x0; }
+if (my < (y0+dy))
+  { XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False);  dy = my-y0; }
+ 
+XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy);
+DrawElements();
 XFlush(mdsp);
 
Index: /trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 37)
@@ -32,13 +32,17 @@
 
 void
-PIScDrawWdg::SetLimits(double xmin, double xmax, 
-                       double ymin, double ymax, bool tmp)
+PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax,
+                       bool axrl, bool ayud, bool tmp)
 {
   if (xmax <= xmin || ymax <= ymin)
     return; // $CHECK$ exception ?
+  aXdir = axrl;      // Vrai si Axe X de Droite vers Gauche
+  aYdir = ayud;      // Vrai si Axe Y de Haut vers Bas
   xMin = xmin;
   xMax = xmax;
   yMin = ymin;
   yMax = ymax;
+  mPPos[0] = 0.5*(xMin+xMax);
+  mPPos[1] = 0.5*(yMin+yMax);
   if (!tmp) {
     xMinS = xmin;
@@ -63,10 +67,19 @@
 PIScDrawWdg::CalcScale()
 {
-  double margeH = (xMax-xMin)*0.2;
-  double margeV = (yMax-yMin)*0.2;
+  double margeH = (xMax-xMin)*0.15;
+  double margeV = (yMax-yMin)*0.15;
   xScale = XSize() / (xMax-xMin + 2*margeH);
-  yScale = -YSize() / (yMax-yMin + 2*margeV);
-  xOrg   = (-xMin + margeH) * xScale;// + XPos();
-  yOrg   = (-yMax - margeV) * yScale;// + YPos();
+  if (aXdir)  { 
+    xScale = -xScale;
+    xOrg   = (-xMax - margeH) * xScale;// + XPos();
+  }
+  else xOrg   = (-xMin + margeH) * xScale;// + XPos();
+  yScale = YSize() / (yMax-yMin + 2*margeV);
+  if (!aYdir) {
+    yScale = -yScale;
+    yOrg   = (-yMax - margeV) * yScale;// + YPos();
+  }
+  else yOrg   = (-yMin + margeV) * yScale;// + YPos();
+return;
 }
 
@@ -361,8 +374,10 @@
 {
   double xOffset = 0;
-  
+  int kk;
   ScSelFontSz(xMajTickLen*4);
   for (double x=xBeg; x<=xMax; x += xStep) {
       char label[20]; sprintf(label, "%-6g", x);
+      for(kk=0; kk<20; kk++)
+        if (label[kk] == ' ')   { label[kk] = '\0' ; break; }
       double largeur = ScStringWidth(label);
       if (just == 1)
@@ -372,4 +387,5 @@
       else
         xOffset = 0;
+      if (aXdir)  xOffset = -xOffset;
       ScDrawString(x+xOffset, y, label);
   }
@@ -390,4 +406,5 @@
       else
         xOffset = 0;
+      if (aXdir)  xOffset = -xOffset;
       ScDrawString(x+xOffset, y, label);
   }
@@ -427,6 +444,12 @@
     
     if (flags & kLabels) {
+      if (!aYdir)
         DrawHLabels(-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      else 
+        DrawHLabels(xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      if (!aXdir)
         DrawVLabels(-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+      else 
+        DrawVLabels(yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
     }
     
@@ -475,8 +498,20 @@
     
     if (flags & kLabels) {
+      if (!aYdir) {
         DrawHLabels(yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
         DrawHLabels(yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
+      }
+      else {
+        DrawHLabels(yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
+        DrawHLabels(yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      }
+      if (!aXdir) {
         DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
         DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
+      }
+      else {
+        DrawVLabels(xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
+        DrawVLabels(xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+      }
     }
   }
@@ -604,9 +639,11 @@
 PIScDrawWdg::UpdateText(int xp, int yp)
 {
-  if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
-
-  char buff[128];
+
   double dx, dy;
   Local2Sc(xp, yp, dx, dy); 
+  mPPos[0] = dx;  mPPos[1] = dy; 
+  if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
+
+  char buff[128];
   sprintf(buff, "X= %g  Y= %g",  dx, dy);
   if (mTxw)
@@ -647,5 +684,5 @@
   
   if (xBegDrag == xEndDrag || yBegDrag == yEndDrag)
-    SetLimits(xMinS, xMaxS, yMinS, yMaxS);
+    SetLimits(xMinS, xMaxS, yMinS, yMaxS, aXdir, aYdir );
   else {
     double xl,yl,xh,yh;
@@ -654,5 +691,5 @@
     if (xl > xh) swap(xl, xh);
     if (yl > yh) swap(yl, yh);
-    SetLimits(xl,xh,yl,yh, true);
+    SetLimits(xl,xh,yl,yh, aXdir, aYdir, true);
   }
   
Index: /trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 36)
+++ /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 37)
@@ -29,5 +29,6 @@
   virtual           ~PIScDrawWdg();
 
-  virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax, bool tmp=false);
+  virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax, 
+                               bool axrl=false, bool ayud=false, bool tmp=false);
   
   virtual void       ScDrawString(double x, double y, char* s, int pos = 0);
@@ -75,4 +76,6 @@
   double YMin() const {return yMin;}
   double YMax() const {return yMax;}
+  double XPPos() const { return mPPos[0]; }
+  double YPPos() const { return mPPos[1]; }
   int    LimitsFixed() const {return limitsFixed;}
   void   FreeLimits() {limitsFixed = 0;}
@@ -94,4 +97,6 @@
   double xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
   double xScale, yScale;         // Pixels par unites graphiques
+  bool   aXdir, aYdir;           // Sens des axes horiz, vertical 
+  double mPPos[2];               // Position click souris X,Y
   double xFirstMajTick, xFirstMinTick;
   double yFirstMajTick, yFirstMinTick;
Index: /trunk/SophyaPI/PI/pistdwdgx.cc
===================================================================
--- /trunk/SophyaPI/PI/pistdwdgx.cc	(revision 36)
+++ /trunk/SophyaPI/PI/pistdwdgx.cc	(revision 37)
@@ -225,12 +225,14 @@
 
 // Fonction prive (CallBack)
-static void toggb_action(Widget w, XtPointer *usd, XtPointer *calld);
+static void toggb_action(Widget w, XtPointer *usd, XmToggleButtonCallbackStruct* calld);
 
 /* Nouvelle-Fonction */
-void  toggb_action(Widget , XtPointer *usd, XtPointer *)
+void  toggb_action(Widget , XtPointer *usd, XmToggleButtonCallbackStruct* calld)
 {
 PICheckBoxX *picb;
 picb = (PICheckBoxX *) usd ;
-picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState());
+if (calld->set == True)   picb->mSt = true;
+else picb->mSt = false;
+picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)(picb->mSt));
 return;
 }
@@ -247,4 +249,5 @@
 XtSetArg(warg[0],XmNhighlightThickness, 0);
 XtSetValues(XtWdg(), warg, 1);
+SetState(false);
 Manage();
 }
@@ -260,5 +263,6 @@
 {
 Arg warg[2];
-XtSetArg(warg[0],XmNset, st);
+mSt = st;
+XtSetArg(warg[0],XmNset, mSt);
 XtSetValues(XtWdg(), warg, 1);
 return;
@@ -268,9 +272,5 @@
 bool PICheckBoxX::GetState()
 {
-int val;
-Arg warg[2];
-XtSetArg(warg[0], XmNset, &val); 
-XtGetValues(XtWdg(), warg, 1);
-return ((bool)val);
+return(mSt);
 }
 
Index: /trunk/SophyaPI/PI/pistdwdgx.h
===================================================================
--- /trunk/SophyaPI/PI/pistdwdgx.h	(revision 36)
+++ /trunk/SophyaPI/PI/pistdwdgx.h	(revision 37)
@@ -60,4 +60,6 @@
   virtual void       SetState(bool st=false);
   virtual bool       GetState();
+
+  bool mSt;          // Etat du bouton, en public a cause du Callback
 };
 
Index: /trunk/SophyaPI/PI/pistlist.cc
===================================================================
--- /trunk/SophyaPI/PI/pistlist.cc	(revision 37)
+++ /trunk/SophyaPI/PI/pistlist.cc	(revision 37)
@@ -0,0 +1,133 @@
+#include <stdio.h>
+#include "pistlist.h"
+
+ 
+/* --Methode-- */
+PIStarList::PIStarList(StarList* stl, bool ayud)
+: PIScDrawer(), mStL(stl)
+{
+  mAdelStl = false;   
+  mAYdir = ayud;  
+  if (stl == NULL) return;
+  SetFluxLimits(1., -1.);
+  SetXYLimits(1., -1., 1., -1.);
+}
+
+PIStarList::~PIStarList()
+{
+  if (mAdelStl && mStL)
+    delete mStL;
+}
+
+/* --Methode-- */
+void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, int msz0, bool refr)
+{
+  if (!mStL)  return;  
+  if (fmin < fmax)  { mFmin = fmin;  mFmax = fmax; }
+  else mStL->CalcFluxLimits(mFmin, mFmax);
+  if (mFmin < 1.e-10)  mFmin = 1.e-10;
+  if (mFmax < mFmin)  mFmax = 1.5*mFmin;
+  mDLgF = log10((double)mFmax/(double)mFmin);
+  mF0 = mFmin;
+  if (nl < 1)  nl = 1;
+  if (nl > 20)  nl = 20;
+  mNLev = nl;  
+  if (msz0 < 0)  msz0 = 0;
+  if (msz0 > 10)  msz0 = 10; 
+  mMSz0 = msz0;
+  if (refr)  Refresh();
+  return;
+}
+
+/* --Methode-- */
+void  PIStarList::SetXYLimits(float xmin, float xmax, float ymin, float ymax, bool dfv, bool refr)
+{
+  if (!mStL)  return;  
+  if ((xmin < xmax) && (ymin < ymax)) {
+    mXMin = xmin; mXMax = xmax; mYMin = ymin; mYMax = ymax; 
+    }
+  else {
+    double x1, x2, y1, y2;
+    mStL->CalcXYLimits(x1, x2, y1, y2);
+    mXMin = (float)x1; mXMax = (float)x2; mYMin = (float)y1; mYMax = (float)y2; 
+    }
+  mDspFV = dfv;
+  if (refr)  Refresh();
+  return;    
+}  
+
+/* --Methode-- */
+void  PIStarList::AttachTo(PIScDrawWdg* wdg)
+{
+  PIScDrawer::AttachTo(wdg);
+  UpdateSize();
+}
+
+
+/* --Methode-- */
+void PIStarList::UpdateSize()
+{
+  if (!mStL) return;
+  if (!mDrawWdg) return;
+  if (mDrawWdg->LimitsFixed()) return;
+
+  // Commencer par trouver nos limites
+  float dx, dy;
+  
+  dx = 0.02*(mXMax-mXMin);
+  dy = 0.02*(mYMax-mYMin);
+  
+  mDrawWdg->SetLimits(mXMin-dx, mXMax+dx, mYMin-dy, mYMax+dy, false, mAYdir); 
+  mDrawWdg->SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+}
+
+
+/* --Methode-- */
+void PIStarList::Draw()
+{
+BStar *sti;
+float xp,yp,flx;
+int sz,ixp, iyp;
+char buff[128];
+int nok, nl2;
+
+if (!mStL) return;
+if (!mDrawWdg) return;
+
+mDrawWdg->SelFont();
+nok = 0;  nl2 = mNLev*2-1;
+for (int i=0; i<mStL->NbStars(); i++) {
+  sti = mStL->Star(i);
+  if ( !(sti->Nice(BStar::flagOK)) )  continue;
+  flx = sti->Flux();
+  if ( (flx < mFmin) || (flx > mFmax) )  continue;
+  xp = sti->PosX();   yp = sti->PosY();
+  if ( (xp < mXMin) || (xp > mXMax) || (yp < mYMin) || (yp > mYMax) )  continue;
+  nok++;
+  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + mMSz0;
+  if (sz < 2)  mDrawWdg->SelMarker(sz, PI_DotMarker);
+  else mDrawWdg->SelMarker(sz, PI_FCircleMarker);
+  mDrawWdg->ScDrawMarker((double)xp,(double)yp ); 
+  if (mDspFV) {  
+    sprintf(buff," F=%g", flx);
+    mDrawWdg->Sc2Local(xp, yp, ixp, iyp);
+    mDrawWdg->DrawString( ixp+sz/2+1, iyp-4, buff);
+    } 
+  }
+
+sprintf(buff, "StarList:  NbStars= %d  NDisp= %d", (int)mStL->NbStars(), nok);
+mDrawWdg->DrawString(15,15,buff);
+sprintf(buff, "FMin= %g  FMax= %g Nl= %d Sz0= %d", mFmin, mFmax, mNLev, mMSz0);
+mDrawWdg->DrawString(15,30,buff);
+
+}
+
+
+/* --Methode-- */
+void PIStarList::Refresh()
+{
+  if (!mDrawWdg) return;
+  mDrawWdg->FreeLimits();
+  UpdateSize();
+  mDrawWdg->Refresh();
+}
Index: /trunk/SophyaPI/PI/pistlist.h
===================================================================
--- /trunk/SophyaPI/PI/pistlist.h	(revision 37)
+++ /trunk/SophyaPI/PI/pistlist.h	(revision 37)
@@ -0,0 +1,45 @@
+#ifndef PISTLIST_H
+#define PISTLIST_H
+
+
+#include "piscdrawwdg.h"
+#include "stlist.h"
+
+class PIStarList : public PIScDrawer {
+public:
+                     PIStarList(StarList* stl, bool ayud=true);
+  virtual           ~PIStarList();
+  
+  virtual void       Draw();
+  virtual void       Refresh();  // Recalcule les limites, et reaffiche
+  
+  inline  void       SetAutoDelStList(bool ad=false)   { mAdelStl = ad; }
+  void               SetFluxLimits(float min=1., float max=-1., int nl=5, 
+                                   int msz0=0, bool refr=false);
+  void               SetXYLimits(float xmin=1., float xmax=-1., float ymin=1., float ymax=-1., 
+                                 bool dfv=false, bool refr=false);              
+
+  inline StarList*   StList()  { return(mStL); }  
+  inline float       XMin()    { return(mXMin); }       
+  inline float       XMax()    { return(mXMax); }       
+  inline float       YMin()    { return(mYMin); }       
+  inline float       YMax()    { return(mYMax); }       
+  inline float       FluxMin() { return(mFmin); }       
+  inline float       FluxMax() { return(mFmax); }
+       
+protected:
+  StarList* mStL;
+  bool   mAdelStl;
+  float mFmin, mFmax;
+  int mNLev, mMSz0;
+  double mF0, mDLgF;
+  float mXMin, mXMax;
+  float mYMin, mYMax;
+  bool mDspFV;
+  bool mAYdir;
+
+  virtual void       AttachTo(PIScDrawWdg*);
+  virtual void       UpdateSize();
+};
+
+#endif
Index: /trunk/SophyaPI/PI/piup.cc
===================================================================
--- /trunk/SophyaPI/PI/piup.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piup.cc	(revision 37)
@@ -8,5 +8,5 @@
 #include "piup.h"
 
-ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
@@ -23,11 +23,11 @@
 
 filt.PrintImage();
-out = new ImageR4(myimg->XSize(), myimg->YSize());
+out = new ImageR4(myimg.XSize(), myimg.YSize());
 TIMEF ;
-FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt); 
-return(out);
+FilterImage(&myimg, out, &filt); 
+return((RzImage*)out);
 }
  
-ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
@@ -46,12 +46,12 @@
 filt(2,0) = 2.;
 filt.PrintImage();
-out = new ImageR4(myimg->XSize(), myimg->YSize());
+out = new ImageR4(myimg.XSize(), myimg.YSize());
 TIMEF ;
-FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt); 
-return(out);
+FilterImage(&myimg, out, &filt); 
+return((RzImage*)out);
 }
 
  
-ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_3(ImageR4& , int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
Index: /trunk/SophyaPI/PI/piup.h
===================================================================
--- /trunk/SophyaPI/PI/piup.h	(revision 36)
+++ /trunk/SophyaPI/PI/piup.h	(revision 37)
@@ -1,8 +1,8 @@
 #include "cimage.h"
 
-ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2);
-ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2);
-ImageR4 * PIUserProc_3(ImageR4 * myimg, int xp, int yp, int dx, int dy, 
+RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy, 
                        char * arg1, char * arg2);
Index: /trunk/SophyaPI/PI/piup_def.cc
===================================================================
--- /trunk/SophyaPI/PI/piup_def.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piup_def.cc	(revision 37)
@@ -8,5 +8,5 @@
 #include "piup.h"
 
-ImageR4 * PIUserProc_1(ImageR4 * , int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_1(ImageR4 & , int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
@@ -16,5 +16,5 @@
 }
  
-ImageR4 * PIUserProc_2(ImageR4 * , int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_2(ImageR4 & , int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
@@ -24,5 +24,5 @@
 }
  
-ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
+RzImage * PIUserProc_3(ImageR4 & , int xp, int yp, int dx, int dy,
                        char * arg1, char * arg2)
 {
Index: /trunk/SophyaPI/PI/piwdggen.cc
===================================================================
--- /trunk/SophyaPI/PI/piwdggen.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piwdggen.cc	(revision 37)
@@ -13,4 +13,5 @@
 parent = par;
 SetMsg(0);
+SetUserData(NULL, 0);
 if (par)  par->ChildAdd(this);   //  On previent le container parent  
 return;
Index: /trunk/SophyaPI/PI/piwdgx.cc
===================================================================
--- /trunk/SophyaPI/PI/piwdgx.cc	(revision 36)
+++ /trunk/SophyaPI/PI/piwdgx.cc	(revision 37)
@@ -42,8 +42,39 @@
 }
 
+/* Nouvelle-Fonction */
+int CStrFrXmStr(XmString xms, char* buff, int nmx)
+/*  Pour recuperer le contenu d'un string Motif  */
+{
+int n,l,m;
+XmStringContext cntx;
+char *txs;
+XmStringDirection dir;
+XmStringCharSet cset;
+Boolean sep;
+
+if (nmx < 2)  return(0);
+n = 0;  m = nmx-1;  buff[0] = buff[m] = '\0';
+XmStringInitContext (&cntx, xms);
+while (m > 0)
+  {
+  if (XmStringGetNextSegment( cntx, &txs, &cset, &dir, &sep) )
+    {
+    l = strlen(txs);
+    if (m < l)  txs[m] = '\0';
+    strcpy(buff+n, txs);
+    n += l;   m -= l;
+    if (sep)  m = -2;
+    XtFree(txs);
+    }
+  else m = -1;
+  }
+
+return(n);
+} 
+
 
 /* --Methode-- */
 PIWdgX::PIWdgX(int narg, char *arg[])
-:PIWdgGen(NULL, "PITopLevel"), mNom("PITopLevel")
+:PIWdgGen(NULL, "PITopLevel")  
 {
 if (top == NULL)  InitXt(narg, arg);
@@ -61,5 +92,5 @@
 PIWdgX::PIWdgX(PIContainerGen *par, char *nom, 
                int sx, int sy, int px, int py)
-:PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
+:PIWdgGen(par, nom, sx, sy, px, py) 
 {
 sdw = NULL;
@@ -378,4 +409,10 @@
 XtGetValues(this->sdw, wargs, 1);
 return(bw);
+}
+
+/* --Methode-- */
+string PIWdgX::Nom()
+{
+return(XtName(this->sdw));
 }
 
Index: /trunk/SophyaPI/PI/piwdgx.h
===================================================================
--- /trunk/SophyaPI/PI/piwdgx.h	(revision 36)
+++ /trunk/SophyaPI/PI/piwdgx.h	(revision 37)
@@ -50,5 +50,5 @@
   virtual int    BorderWidth();
 
-  virtual string Nom()  { return mNom; }
+  virtual string Nom();  
   virtual void   GetScreenPos(int & spx, int & spy);
 
@@ -67,5 +67,4 @@
   WmIntState wmis;
   int stmng;
-  string mNom;
   
 };
Index: /trunk/SophyaPI/PI/psdict.cc
===================================================================
--- /trunk/SophyaPI/PI/psdict.cc	(revision 36)
+++ /trunk/SophyaPI/PI/psdict.cc	(revision 37)
@@ -72,5 +72,5 @@
 $BlocEnteredState restore} bind def\n\
 \
-%% Trace\
+%% Trace\n\
 /n  {newpath} bind def    /c  {closepath} bind def\n\
 /gs {gsave}  bind def     /gr {grestore} bind def\n\
