Index: /trunk/SophyaPI/PI/Makefile
===================================================================
--- /trunk/SophyaPI/PI/Makefile	(revision 118)
+++ /trunk/SophyaPI/PI/Makefile	(revision 119)
@@ -4,5 +4,5 @@
  
 all: $(LIB)libPI.a
-$(LIB)libPI.a : $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.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)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o
+$(LIB)libPI.a : $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)pipodrw.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o
 	$(AR) $(ARFLAGS)  $@ $? 
 ifeq ($(CXX),cxx)
@@ -12,5 +12,5 @@
  
 clean:
-	rm -f $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.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)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o
+	rm -f $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)piinit.o $(OBJ)pilistgen.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pintup3d.o $(OBJ)pintuple.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)pipodrw.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)pistlist.o $(OBJ)pisurfdr.o $(OBJ)piup.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)psfile.o
 ifeq ($(CXX),cxx)
 	cd $(REPM); rm -f *.o
@@ -24,5 +24,9 @@
  piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
  pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
- $(EROSDEVREP)/Include/defs.h pigraph3d.h pibwdgx.h pigraphps.h
+ $(EROSDEVREP)/Include/defs.h pigraph3d.h pibwdgx.h pigraphps.h \
+ pidrwtools.h pistdwdgx.h pistdwdggen.h pioptmenux.h pioptmenugen.h \
+ pimenux.h pimenugen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
+ picons.h
 $(OBJ)piapplgen.o: piapplgen.cc piapplgen.h pimsghandler.h pisysdep.h \
  picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \
@@ -40,5 +44,8 @@
  pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
  pigraphuc.h psfile.h $(EROSDEVREP)/Include/defs.h pidrawer.h \
- pigraphps.h
+ pigraphps.h pidrwtools.h pistdwdgx.h pistdwdggen.h pioptmenux.h \
+ pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
+ picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
+ pimenubargen.h picons.h pibwdgx.h
 $(OBJ)pibwdgx.o: pibwdgx.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
  piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
@@ -71,11 +78,11 @@
  $(EROSDEVREP)/Include/defs.h pigraphps.h pistdwdgx.h pistdwdggen.h \
  pidrawer.h
-$(OBJ)pidrwtools.o: pidrwtools.cc pidrwtools.h pisysdep.h pimenux.h \
- pimenugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h piapplgen.h \
- picontainerx.h picontainergen.h pimenubarx.h pimenubargen.h picons.h \
- pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
- picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
- $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h piwindowx.h \
- piwindowgen.h pidrawer.h
+$(OBJ)pidrwtools.o: pidrwtools.cc pidrwtools.h pisysdep.h pistdwdgx.h \
+ pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pioptmenux.h \
+ pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
+ picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
+ pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
+ picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphps.h piscdrawwdg.h pidrawer.h
 $(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
  piwdggen.h pimsghandler.h
@@ -127,8 +134,10 @@
  pigraphuc.h psfile.h pipixmapx.h pipixmapgen.h pibwdgx.h pigraphps.h \
  pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
- picontainergen.h
+ picontainergen.h piimgtools.h pioptmenux.h pioptmenugen.h pimenux.h \
+ pimenugen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
+ picons.h pidrwtools.h
 $(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h pistdwdgx.h \
- pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pimenux.h \
- pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \
+ pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h pioptmenux.h \
+ pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
  picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
  pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
@@ -200,6 +209,9 @@
  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
  $(EROSDEVREP)/Include/defs.h pigraphps.h
-$(OBJ)piscdrawwdg.o: piscdrawwdg.cc $(EROSDEVREP)/Include/generalfit.h \
- $(EROSDEVREP)/Include/exceptions.h $(EROSDEVREP)/Include/defs.h \
+$(OBJ)pipodrw.o: pipodrw.cc pipodrw.h pidrawer.h pibwdggen.h pisysdep.h \
+ piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h $(EROSDEVREP)/Include/generalfit.h \
+ $(EROSDEVREP)/Include/exceptions.h \
  $(EROSDEVREP)/Include/peidainit.h \
  $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/peida.h \
@@ -208,9 +220,12 @@
  $(EROSDEVREP)/Include/ppersist.h \
  $(EROSDEVREP)/Include/pclassids.h \
- $(EROSDEVREP)/Include/cvector.h piscdrawwdg.h pisysdep.h pibwdgx.h \
+ $(EROSDEVREP)/Include/cvector.h
+$(OBJ)piscdrawwdg.o: piscdrawwdg.cc piscdrawwdg.h pisysdep.h pibwdgx.h \
  pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
- picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h pigraphps.h \
- pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
- picontainergen.h pidrawer.h
+ picmapgen.h pigraphx.h pigraphgen.h pigraphuc.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphps.h pistdwdgx.h pistdwdggen.h \
+ piwindowx.h piwindowgen.h picontainerx.h picontainergen.h pidrawer.h \
+ pidrwtools.h pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h \
+ piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h
 $(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
  piwdggen.h pimsghandler.h
Index: /trunk/SophyaPI/PI/parradapter.h
===================================================================
--- /trunk/SophyaPI/PI/parradapter.h	(revision 118)
+++ /trunk/SophyaPI/PI/parradapter.h	(revision 119)
@@ -3,7 +3,4 @@
 // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 
-// Cette classe est un adaptateur pour les PIImages et 
-// autres classes de PI qui operent sur des structures 
-// de type Tableaux 2-D (images, ...) 
 
 #ifndef PARRADAPTER_SEEN
@@ -14,5 +11,20 @@
 #include "lut.h"
 
-class LUT;
+class P1DArrayAdapter {
+public :
+                  P1DArrayAdapter(int sz=0) {mSize=sz; } 
+                  ~P1DArrayAdapter();
+ 
+  virtual float   Value(int i) = 0;
+  inline  int     Size() { return (mSize) ; }
+     
+protected :
+  int mSize;
+};
+
+// Cette classe est un adaptateur pour les PIImages et 
+// autres classes de PI qui operent sur des structures 
+// de type Tableaux 2-D (images, ...) 
+
 class P2DArrayAdapter {
 public :
@@ -66,4 +78,20 @@
 };
 
+template <class T> 
+class P1DAdapter : public P1DArrayAdapter {
+public :
+                  P1DAdapter(T* data, int sz, bool ad=false) :
+                    P1DArrayAdapter(sz)
+                    { aDel = ad; mData = data; }
+
+  virtual 	  ~P1DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; }
+  virtual float   Value(int i) 
+                    {  if ( (i < 0) || (i >= mSize) ) return(0.); 
+                    return(mData[i]); }
+protected :
+  bool aDel;
+  T* mData;
+};
+
 
 template <class T> 
Index: /trunk/SophyaPI/PI/pi3ddrw.cc
===================================================================
--- /trunk/SophyaPI/PI/pi3ddrw.cc	(revision 118)
+++ /trunk/SophyaPI/PI/pi3ddrw.cc	(revision 119)
@@ -8,4 +8,5 @@
 
 #include "pi3ddrw.h"
+#include "pidrwtools.h"
 
 
@@ -238,4 +239,5 @@
   DrawXYZAxes();
   Send(Msg(), PIMsg_Active);
+  PIDrwTools::SetCurrentBaseWdg(this);
 }
 
@@ -296,4 +298,5 @@
   DrawXYZAxes();
   Send(Msg(), PIMsg_Active);
+  PIDrwTools::SetCurrentBaseWdg(this);
 }
 
@@ -370,4 +373,5 @@
 {
   Send(Msg(), PIMsg_Active);
+  PIDrwTools::SetCurrentBaseWdg(this);
   if ( (x > 50) || ( y > 50) ) return; 
   list<int>::iterator it = m3DrIl.begin();
Index: /trunk/SophyaPI/PI/pibwdggen.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.cc	(revision 118)
+++ /trunk/SophyaPI/PI/pibwdggen.cc	(revision 119)
@@ -4,4 +4,5 @@
 #include "pidrawer.h"
 #include "pigraphps.h"
+#include "pidrwtools.h"
 
 // Les methodes de la classe  PIBWdgGen
@@ -25,4 +26,6 @@
 delete mWGrC;
 DeleteDrawers();
+if (PIDrwTools::GetCurrentBaseWdg() == this) 
+  PIDrwTools::SetCurrentBaseWdg(NULL);
 }
  
Index: /trunk/SophyaPI/PI/pidrwtools.cc
===================================================================
--- /trunk/SophyaPI/PI/pidrwtools.cc	(revision 118)
+++ /trunk/SophyaPI/PI/pidrwtools.cc	(revision 119)
@@ -4,27 +4,344 @@
 
 #include <stdlib.h>
+
 #include "pidrwtools.h"
 #include "piscdrawwdg.h"
 
 
-/* --Methode-- */
-PIDrwMenu::PIDrwMenu(PIApplication* par) 
-        : PIMenu(par->Menubar(), "DrawerTools")
-{
-pdm[0] = new PIMenu(this, "Color");
-pdm[0]->AppendItem("White", 303);
-AppendPDMenu(pdm[0]);
-}
-
-/* --Methode-- */
-PIDrwMenu::~PIDrwMenu()
-{
-int i;
-for(i=0; i<1; i++)  delete pdm[i];
-}
-
-/* --Methode-- */
-void PIDrwMenu::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
-{
+PIDrwTools* PIDrwTools::cwdrwt = NULL;
+PIBaseWdgGen* PIDrwTools::mCurBW = NULL;
+
+/* --Methode-- */
+void PIDrwTools::ShowPIDrwTools() 
+{
+if (cwdrwt == NULL)  cwdrwt = new PIDrwTools(PIApplicationGetApp());
+cwdrwt->Show();
+}
+
+/* --Methode-- */
+void PIDrwTools::SetCurrentBaseWdg(PIBaseWdgGen* cbw)
+{
+mCurBW = cbw;
+if (cwdrwt)  { 
+  cwdrwt->mNlb->SetLabel("0");  
+  cwdrwt->mNDr = 0; 
+  }
+}
+/* --Methode-- */
+PIBaseWdgGen* PIDrwTools::GetCurrentBaseWdg()
+{
+return(mCurBW);
+}
+
+/* --Methode-- */
+PIDrwTools::PIDrwTools(PIApplication* par)
+: PIWindow((PIMsgHandler*)par, "PIDrawerTools", PIWK_dialog, 240, 240, 150, 150)
+{
+int bsx, bsy, spx, spy;
+
+// On definit la taille a partir de la taille par defaut des composantes 
+// PIApplicationPrefCompSize(bsx, bsy);
+par->PrefCompSz(bsx, bsy);
+spx = bsx/10;
+spy = bsy/4;
+
+int wszx = 5*spx+3.5*bsx; 
+int wszy = (6+3*0.85)*(spy+bsy);
+SetSize(wszx, wszy);
+
+int cpx = spx*2;
+int cpy = spy*2;
+int csx = cpx;
+int csy = cpy;
+mLab[0] = new PILabel(this, "X Min Max", 1.5*bsx, bsy, cpx, cpy);
+cpy += spy+bsy; 
+mLab[1] = new PILabel(this, "Y Min Max", 1.5*bsx, bsy, cpx, cpy);
+mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+cpy = spy*2;
+cpx += spx+1.5*bsx; 
+mText[0] = new PIText(this, "x_min_max", 2.0*bsx, bsy, cpx, cpy);
+mText[0]->SetText("-1.0  1.0");
+cpy += spy+bsy; 
+mText[1] = new PIText(this, "y_min_max", 2.0*bsx, bsy, cpx, cpy);
+mText[1]->SetText("-1.0  1.0");
+mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mText[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+cpx = 2*spx;
+cpy += spy+bsy; 
+mCkb[0] = new PICheckBox(this,"AxeX-RtoL", 2000, 1.5*bsx, bsy, cpx, cpy);
+cpx += spx+1.5*bsx; 
+mCkb[1] = new PICheckBox(this,"AxeY-UpDown", 2000, 1.5*bsx, bsy, cpx, cpy);
+mCkb[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mCkb[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+cpy += spy+bsy; 
+cpx = 4*spx;;
+mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.5, bsy, cpx, cpy);
+cpx += bsx*1.5+2*spx;
+mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.5, bsy, cpx, cpy);
+mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+int offy = cpy+bsy+spy*2;
+
+//  Option-Menu  Marker, Line, couleur, etc...
+cpx = 2*spx;
+cpy += 3*spy+bsy;
+
+int bsyo = bsy;  
+int spyo = spy; 
+bsy = 0.85*bsy;   spy = 0.85*spy;
+
+mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*1.75, bsy, cpx, cpy);
+mOpt[0]->AppendItem("Black", 101);
+mOpt[0]->AppendItem("White", 102);
+mOpt[0]->AppendItem("Grey", 103);
+mOpt[0]->AppendItem("Red", 104);
+mOpt[0]->AppendItem("Blue", 105);
+mOpt[0]->AppendItem("Green", 106);
+mOpt[0]->AppendItem("Yellow", 107);
+mOpt[0]->AppendItem("Magenta", 108);
+mOpt[0]->SetValue(101);
+mOpt[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx += spx+1.75*bsx; 
+mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*1.75, bsy, cpx, cpy);
+mOpt[1]->AppendItem("NoColor", 200);
+mOpt[1]->AppendItem("Grey32", 201);
+mOpt[1]->AppendItem("GreyInv32", 202);
+mOpt[1]->AppendItem("ColRJ32", 203);
+mOpt[1]->AppendItem("ColBR32", 204);
+mOpt[1]->AppendItem("ColRV32", 205);
+mOpt[1]->AppendItem("Grey128", 206);
+mOpt[1]->AppendItem("GreyInv128", 207);
+mOpt[1]->AppendItem("ColRJ128", 208);
+mOpt[1]->AppendItem("ColBR128", 209);
+mOpt[1]->AppendItem("Col16", 210);
+mOpt[1]->SetValue(200);
+mOpt[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+
+cpx = 2*spx;
+cpy += spy+bsy;
+mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*1.75, bsy, cpx, cpy);
+mOpt[2]->AppendItem("Undef-Mrk", 300);
+mOpt[2]->AppendItem("Mrk Dot(.)", 301);
+mOpt[2]->AppendItem("Mrk Plus(+)", 302);
+mOpt[2]->AppendItem("Mrk Cross(x)", 303);
+mOpt[2]->AppendItem("Mrk Circle", 304);
+mOpt[2]->AppendItem("Mrk FCircle", 305);
+mOpt[2]->AppendItem("Mrk Box", 306);
+mOpt[2]->AppendItem("Mrk FBox", 307);
+mOpt[2]->AppendItem("Mrk Triangle", 308);
+mOpt[2]->AppendItem("Mrk FTriangle", 309);
+mOpt[2]->AppendItem("Mrk Star", 310);
+mOpt[2]->AppendItem("Mrk FStar", 311);
+mOpt[2]->SetValue(301);
+mOpt[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx += spx+1.75*bsx; 
+mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*1.75, bsy, cpx, cpy);
+mOpt[3]->AppendItem("Mrk 3 pt", 403);
+mOpt[3]->AppendItem("Mrk 5 pt", 405);
+mOpt[3]->AppendItem("Mrk 7 pt", 407);
+mOpt[3]->AppendItem("Mrk 9 pt", 409);
+mOpt[3]->AppendItem("Mrk 11 pt", 411);
+mOpt[3]->AppendItem("Mrk 13 pt", 413);
+mOpt[3]->AppendItem("Mrk 15 pt", 415);
+mOpt[3]->SetValue(405);
+mOpt[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx = 2*spx;
+cpy += spy+bsy;
+mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*1.75, bsy, cpx, cpy);
+mOpt[4]->AppendItem("Normal-Font", 500);
+mOpt[4]->AppendItem("Bold-Font", 501);
+mOpt[4]->AppendItem("Ital-Font", 502);
+mOpt[4]->AppendItem("Small-Font", 510);
+mOpt[4]->AppendItem("Small-Bold-Font", 511);
+mOpt[4]->AppendItem("Small-Ital-Font", 512);
+mOpt[4]->AppendItem("Big-Font", 521);
+mOpt[4]->AppendItem("Big-Bold-Font", 522);
+mOpt[4]->AppendItem("Big-Ital-Font", 523);
+mOpt[4]->SetValue(500);
+mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx += spx+1.75*bsx; 
+mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*1.75, bsy, cpx, cpy);
+mOpt[5]->AppendItem("Undef-Line", 600);
+mOpt[5]->AppendItem("Thin-Line", 601);
+mOpt[5]->AppendItem("Normal-Line", 602);
+mOpt[5]->AppendItem("Thick-Line", 603);
+mOpt[5]->SetValue(601);
+mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx = 2*spx;
+cpy += spy+bsyo;
+bsy = bsyo; spy = spyo;
+mButdr[0] = new PIButton(this, "Dr-", 3501, bsy, bsy, cpx, cpy, PIBtn_ArrowLeft);
+cpx += bsy+0.25*spy;
+mNlb = new PILabel(this,"NumDr", bsy, bsy, cpx, cpy);
+mNlb->SetLabel("0");
+mNDr = 0;
+cpx += bsy+0.25*spy;
+mButdr[1] = new PIButton(this, "Dr+", 3502, bsy, bsy, cpx, cpy, PIBtn_ArrowRight);
+mButdr[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+mButdr[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cpx += bsy+3*spx;
+mButcf[0] = new PIButton(this, "SetAtt", 2800, bsx*0.85, bsy, cpx, cpy);
+cpx += 0.85*bsx+spx;
+mButcf[1] = new PIButton(this, "Refresh", 2900, bsx*0.85, bsy, cpx, cpy);
+mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
+
+cwdrwt = this;
+
+}
+
+/* --Methode-- */
+PIDrwTools::~PIDrwTools()
+{
+if (cwdrwt == this)  cwdrwt = NULL;
+for(int i=0; i<2; i++)
+  {
+  delete mLab[i];
+  delete mBut[i];
+  delete mText[i];
+  delete mButdr[i];
+  delete mButcf[i];
+  }
+for(int i=0; i<6; i++)  delete mOpt[i];
+delete mNlb;
+}
+
+/* --Methode-- */
+void PIDrwTools::Show()
+{
+PIWindow::Show();
+char buff[92]; 
+mNDr = 0;
+if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) {
+  PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW;
+  sprintf(buff, "%g  %g", scd->XMin(), scd->XMax());
+  mText[0]->SetText(buff);
+  sprintf(buff, "%g  %g", scd->YMin(), scd->YMax());
+  mText[1]->SetText(buff);
+  if (scd->NbDrawers() > 1)  mNDr = 1;
+  }
+else {
+  mText[0]->SetText("-1.0  1.0");
+  mText[1]->SetText("-1.0  1.0");
+  }
+sprintf(buff, "%d", mNDr);
+mNlb->SetLabel(buff);
+
+mCkb[0]->SetState(false);
+mCkb[1]->SetState(false);
+
+mOpt[0]->SetValue(101);
+mOpt[1]->SetValue(200);
+mOpt[2]->SetValue(301);
+mOpt[3]->SetValue(405);
+mOpt[4]->SetValue(500);
+mOpt[5]->SetValue(601);
+
 return;
 }
+
+
+/* --Methode-- */
+void PIDrwTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
+{
+PIColors cols[9] = { PI_NotDefColor, PI_Black, PI_White,  
+                     PI_Grey, PI_Red, PI_Blue, 
+                     PI_Green, PI_Yellow, PI_Magenta};
+
+PIMarker mrk[11] = { PI_DotMarker, PI_PlusMarker, PI_CrossMarker,
+                     PI_CircleMarker, PI_FCircleMarker,
+                     PI_BoxMarker, PI_FBoxMarker,
+                     PI_TriangleMarker, PI_FTriangleMarker,
+                     PI_StarMarker, PI_FStarMarker };
+PILineAtt line[4] = { PI_NotDefLineAtt, PI_ThinLine, PI_NormalLine, PI_ThickLine};
+
+PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont };
+PIFontSize fntsz[3] = { PI_NormalSizeFont, PI_SmallSizeFont, PI_BigSizeFont };
+CMapId cmap[11] = {  CMAP_OTHER, CMAP_GREY32, CMAP_GREYINV32,
+                     CMAP_COLRJ32, CMAP_COLBR32, CMAP_COLRV32,  
+                     CMAP_GREY128, CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, CMAP_COL16 };
+
+msg = UserMsg(msg);
+if (msg == 2600)  { Hide(); return; }
+
+if (mCurBW == NULL)   return;
+
+char strg[64];
+float xmin, xmax, ymin, ymax;
+int axrl = kAxeDirLtoR;
+int ayud = kAxeDirDownUp;
+int k, kk;
+
+switch (msg) {
+
+  case 2500 :
+    sscanf(mText[0]->GetText().c_str(), "%g %g" , &xmin, &xmax);
+    sscanf(mText[1]->GetText().c_str(), "%g %g" , &ymin, &ymax);
+    if (mCkb[0]->GetState())  axrl = kAxeDirRtoL ;
+    if (mCkb[1]->GetState())  ayud = kAxeDirUpDown;
+    printf("--DBG-- %g-%g , %g-%g , %d %d \n", xmin, xmax, ymin, ymax, axrl, ayud);
+    if ( mCurBW->kind() == PIScDrawWdg::ClassId ) ((PIScDrawWdg*)mCurBW)-> SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
+    else mCurBW->SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
+    mCurBW->Refresh();
+    break;
+
+  case 2800 :
+  case 2900 :
+    {
+    PIDrawer* drw = mCurBW->GetDrawer(mNDr);
+    if (drw == NULL)  return;
+    k = mOpt[0]->GetValue()-100;
+    if ( (k < 0) || (k > 8) )  k = 0;
+    drw->SetColAtt(cols[k]);
+    k = mOpt[1]->GetValue()-200;
+    if ( (k < 0) || (k > 10) )  k = 0;
+    drw->SetColMapId(cmap[k]);
+    k =  mOpt[2]->GetValue()-300;
+    if ( (k < 0) || (k > 10) )  k = 0;
+    kk =  mOpt[3]->GetValue()-400;
+    if ( (kk < 1) || (kk > 27) )  kk = 1;
+    drw->SetMarkerAtt(kk, mrk[k]);
+    k =  ((mOpt[4]->GetValue()-500)/10)%3;
+    kk = (mOpt[4]->GetValue()-500-10*k)%3;
+    drw->SetFontAtt(fntsz[k], fntatt[kk]);
+    k =  mOpt[5]->GetValue()-600;
+    if ( (k < 0) || (k > 3) )  k = 0;
+    drw->SetLineAtt(line[k]);
+    if (msg == 2800) drw->Refresh();
+    else mCurBW->Refresh();
+    }
+    break;        
+
+  case 3501 :
+    mNDr--;  
+    if (mNDr < 0)  mNDr = 0;
+    sprintf(strg, "%d", mNDr);
+    mNlb->SetLabel(strg);
+    break;
+  case 3502 :
+    mNDr++;  
+    if (mNDr >= mCurBW->NbDrawers())  mNDr--;
+    sprintf(strg, "%d", mNDr);
+    mNlb->SetLabel(strg);
+    break;
+
+  default :
+    break;
+  }
+
+return;
+}
+
Index: /trunk/SophyaPI/PI/pidrwtools.h
===================================================================
--- /trunk/SophyaPI/PI/pidrwtools.h	(revision 118)
+++ /trunk/SophyaPI/PI/pidrwtools.h	(revision 119)
@@ -7,15 +7,45 @@
 
 #include "pisysdep.h"
-#include PIMENU_H
+#include PISTDWDG_H
+#include PIOPTMENU_H
+#include PIWIN_H
 #include PIAPP_H
+#include "pibwdggen.h"
 
-class PIDrwMenu : public PIMenu 
+// --------- fenetre de dialogue pour modifs axes et options des Drawers ----------
+// --------------------------------------------------------------------------------
+
+
+class PIDrwTools : public PIWindow 
 {
 public :
-			PIDrwMenu(PIApplication* app);
- virtual		~PIDrwMenu();
+  PIDrwTools(PIApplication* par);
+  ~PIDrwTools();
+  virtual void  Show();
+
+  static PIDrwTools* curlutw;
+  static void ShowPIDrwTools();
+  static void SetCurrentBaseWdg(PIBaseWdgGen* cbw);
+  static PIBaseWdgGen* GetCurrentBaseWdg();
+
 protected:
-  virtual void		Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
-PIMenu* pdm[2];
+  virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+private:
+// Pour changer les axes
+  PILabel* mLab[2];
+  PIButton* mBut[2];
+  PIText* mText[2];
+  PICheckBox* mCkb[2];
+// Pour couleur, fontes, etc 
+  PIOptMenu* mOpt[6];
+  PILabel* mNlb;
+  PIButton* mButdr[2];
+  PIButton* mButcf[2];
+  int mNDr;
+  int mtyp, msz;
+//
+  static PIBaseWdgGen* mCurBW;
+  static PIDrwTools* cwdrwt;
 };
 
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 118)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 119)
@@ -12,4 +12,5 @@
 #include "piimage.h"
 #include "piimgtools.h"
+#include "pidrwtools.h"
 
 // --------------------------------------------------------------------------------
@@ -338,4 +339,5 @@
   Send(Msg(), PIMsg_Active);
   cur_piimage = this;
+  PIDrwTools::SetCurrentBaseWdg(this);
   }
 if (zow != NULL)   ComputeZoomPixmap();
@@ -386,8 +388,9 @@
 void PIImage::Keyboard(int key, PIKeyModifier kmod)
 {
+cur_piimage = this;
 if (kmod == PIKM_Alt) {
   if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller)  
   if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes 
-  if (key == 'O' || key == 'o') PIImgLutWind::ShowPIImgLutWind();   // Fentre LUT et options 
+  if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options 
   }
 
@@ -421,4 +424,5 @@
 Send(Msg(), PIMsg_Active);
 cur_piimage = this;
+PIDrwTools::SetCurrentBaseWdg(this);
 if (img == NULL)  return;
 if ( PosW2Img(x, y, &xp, &yp) )  return;
@@ -460,4 +464,5 @@
 Send(Msg(), PIMsg_Active);
 cur_piimage = this;
+PIDrwTools::SetCurrentBaseWdg(this);
 if (img == NULL)  return;
 if ( PosW2Img(x, y, &xpv0, &ypv0) )  {  xmv0 = -1;  return; }
@@ -527,4 +532,5 @@
 Send(Msg(), PIMsg_Active);
 cur_piimage = this;
+PIDrwTools::SetCurrentBaseWdg(this);
 if (img == NULL)  return;
 if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
@@ -583,6 +589,6 @@
 {
 if (typ != PICP_string) return;
-int ll = (l<128) ? l+1 : 128;
-char pc[128];
+int ll = (l<256) ? l+1 : 256;
+char pc[256];
 strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
 float fx, fy;
Index: /trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.cc	(revision 118)
+++ /trunk/SophyaPI/PI/piimgtools.cc	(revision 119)
@@ -6,20 +6,18 @@
 
 #include "piimgtools.h"
-#include PISTDWDG_H
-#include PIOPTMENU_H
 #include "piimage.h"
 
 // ------ Menu des options et fenetre de dialogue pour changement de LUT --------
 
-PIImgLutWind* PIImgLutWind::curlutw = NULL;
-/* --Methode-- */
-void PIImgLutWind::ShowPIImgLutWind() 
-{
-if (curlutw == NULL)  curlutw = new PIImgLutWind(PIApplicationGetApp());
+PIImgTools* PIImgTools::curlutw = NULL;
+/* --Methode-- */
+void PIImgTools::ShowPIImgTools() 
+{
+if (curlutw == NULL)  curlutw = new PIImgTools(PIApplicationGetApp());
 curlutw->Show();
 }
 
 /* --Methode-- */
-PIImgLutWind::PIImgLutWind(PIApplication* par)
+PIImgTools::PIImgTools(PIApplication* par)
 : PIWindow((PIMsgHandler*)par, "PIImageTools", PIWK_dialog, 240, 240, 150, 150)
 {
@@ -91,5 +89,5 @@
 
 int offy = cpy+bsy+spy*2;
-// printf("-DBG- PIImgLutWind()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
+// printf("-DBG- PIImgTools()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
 
 cpx = 4*spx+2.75*bsx;
@@ -198,5 +196,5 @@
 
 /* --Methode-- */
-PIImgLutWind::~PIImgLutWind()
+PIImgTools::~PIImgTools()
 {
 if (curlutw == this)  curlutw = NULL;
@@ -218,5 +216,5 @@
 
 /* --Methode-- */
-void PIImgLutWind::Show()
+void PIImgTools::Show()
 {
 char buff[32];
@@ -245,5 +243,5 @@
 
 /* --Methode-- */
-void PIImgLutWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
+void PIImgTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
 {
 float min, max, del;
@@ -357,5 +355,5 @@
 
   default:
-//    printf("PIImgLutWind::Process Msg %d received \n", (int)msg);
+//    printf("PIImgTools::Process Msg %d received \n", (int)msg);
     break;
   }
Index: /trunk/SophyaPI/PI/piimgtools.h
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.h	(revision 118)
+++ /trunk/SophyaPI/PI/piimgtools.h	(revision 119)
@@ -15,12 +15,12 @@
 // --------------------------------------------------------------------------------
 
-class PIImgLutWind : public PIWindow {
+class PIImgTools : public PIWindow {
 public :
-  PIImgLutWind(PIApplication* par);
-  ~PIImgLutWind();
+  PIImgTools(PIApplication* par);
+  ~PIImgTools();
   virtual void  Show();
 
-  static PIImgLutWind* curlutw;
-  static void ShowPIImgLutWind();
+  static PIImgTools* curlutw;
+  static void ShowPIImgTools();
 protected:
   virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
Index: /trunk/SophyaPI/PI/pintuple.h
===================================================================
--- /trunk/SophyaPI/PI/pintuple.h	(revision 118)
+++ /trunk/SophyaPI/PI/pintuple.h	(revision 119)
@@ -3,5 +3,5 @@
 
 #include "ntuple.h"
-#include "piscdrawwdg.h"
+#include "pidrawer.h"
 
 class PINTuple : public PIDrawer {
Index: /trunk/SophyaPI/PI/pipodrw.cc
===================================================================
--- /trunk/SophyaPI/PI/pipodrw.cc	(revision 119)
+++ /trunk/SophyaPI/PI/pipodrw.cc	(revision 119)
@@ -0,0 +1,84 @@
+#include "pipodrw.h"
+#include "generalfit.h"
+
+//================================================================
+// PIFuncDrawer
+//================================================================
+
+PIFuncDrawer::PIFuncDrawer(PIFuncDrawer::FUNC f)
+: mFunc(f)
+{}
+
+PIFuncDrawer::~PIFuncDrawer()
+{
+}
+
+void
+PIFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
+{
+  PIGrCoord x1, x2, y1, y2;
+  g->GetGrSpace(x1, x2, y1, y2);
+  float xMax = x2;
+  float xMin = x1;
+  float yMax = y2;
+  float yMin = y1;
+  float xStep = (xMax - xMin)/100;
+  float xOld = xMin;
+  float yOld = mFunc(xMin);
+  for (float x = xMin+xStep; x<xMax; x+=xStep) {
+    double y = mFunc(x);
+    if (y>yMin && yOld>yMin && 
+        y<yMax && yOld<yMax) 
+           g->DrawLine(xOld, yOld, x, y);
+    xOld = x;
+    yOld = y;
+  }
+}
+
+//================================================================
+// PIGFFDrawer
+//================================================================
+
+PIGFFDrawer::PIGFFDrawer(GeneralFunction* f)
+: mFunc(f), mNParms(f->NPar()), mParms(new double[mNParms])
+{
+  ASSERT(f->NVar() == 1);
+}
+
+PIGFFDrawer::~PIGFFDrawer()
+{
+  delete[] mParms;
+}
+
+void
+PIGFFDrawer::SetParms(double const* p)
+{
+  for (int i=0; i<mNParms; i++)
+    mParms[i] = p[i];
+}
+
+
+void
+PIGFFDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
+{
+  PIGrCoord x1, x2, y1, y2;
+  g->GetGrSpace(x1, x2, y1, y2);
+  float xMax = x2;
+  float xMin = x1;
+  float yMax = y2;
+  float yMin = y1;
+  float xStep = (xMax - xMin)/100;
+  float xOld = xMin;
+  float yOld = 0;
+//  float yOld = f->Value(&xMin, mParms);
+  for (float x = xMin+xStep; x<xMax; x+=xStep) {
+   float y = 0; // $CHECK$
+//    float y = f->Value(&x, mParms);
+    if (y>yMin && yOld>yMin && 
+        y<yMax && yOld<yMax) 
+           g->DrawLine(xOld, yOld, x, y);
+    xOld = x;
+    yOld = y;
+  }
+}
+
Index: /trunk/SophyaPI/PI/pipodrw.h
===================================================================
--- /trunk/SophyaPI/PI/pipodrw.h	(revision 119)
+++ /trunk/SophyaPI/PI/pipodrw.h	(revision 119)
@@ -0,0 +1,31 @@
+#ifndef PIPODRW_H_SEEN
+#define PIPODRW_H_SEEN
+
+#include "pidrawer.h"
+
+class PIFuncDrawer : public PIDrawer {
+public:
+  typedef double(*FUNC)(double);
+                     PIFuncDrawer(FUNC);
+  virtual           ~PIFuncDrawer();
+  
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+protected:
+  FUNC               mFunc;
+};
+
+class GeneralFunction;
+class PIGFFDrawer : public PIDrawer {
+public:
+                     PIGFFDrawer(GeneralFunction*);
+  virtual           ~PIGFFDrawer();
+  
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+  virtual void       SetParms(double const*);
+protected:
+  GeneralFunction*    mFunc;
+  int                 mNParms;
+  double*             mParms;
+};
+
+#endif
Index: /trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 118)
+++ /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 119)
@@ -1,4 +1,4 @@
-#include "generalfit.h"
 #include "piscdrawwdg.h"
+#include "pidrwtools.h"
 
 PIScDrawWdg::PIScDrawWdg(PIContainerGen *par, char *nom,
@@ -17,4 +17,6 @@
   mTrW = NULL;
   SetTextWin(NULL);
+
+  ActivateKeyboard();
   ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
   ActivateMove(1);      //    "         "         "        "
@@ -30,4 +32,26 @@
 }
 
+void 
+PIScDrawWdg::Keyboard(int key, PIKeyModifier kmod)
+{
+if (kmod == PIKM_Alt) {
+  if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller)  
+  if (key == 'Z' || key == 'z') { mBDrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes 
+  if (key == 'O' || key == 'o') { 
+    PIDrwTools::SetCurrentBaseWdg(this);
+    PIDrwTools::ShowPIDrwTools();   // Fentre axes et 
+    }
+  }
+}
+void 
+PIScDrawWdg::PasteSelection(unsigned int typ, void *pdata, unsigned int l)
+{
+if (typ != PICP_string) return;
+int ll = (l<256) ? l+1 : 256;
+char pc[256];
+strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
+mBDrw->ElAddText(mPPos[0], mPPos[1], pc );
+mBDrw->Refresh();
+}
 
 void
@@ -38,4 +62,5 @@
     return; // $CHECK$ exception ?
   SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
+  mBDrw->SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
   mPPos[0] = 0.5*(XMin()+XMax());
   mPPos[1] = 0.5*(YMin()+YMax());
@@ -83,33 +108,4 @@
 
 
-/*
-void
-PIScDrawWdg::Draw(PIGraphic* g)
-{
-  EraseWindow();
-  if (! LimitsFixed() ) {  //  On met a jour les limites a partir du premier Drawer
-    PIDrawer* drw = GetDrawer(1);
-    if (drw != NULL)   {    
-      drw->UpdateSize();
-      SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
-      }
-    else SetLimits(0., 1., 0., 1.);
-    }
-}
-
-void
-PIScDrawWdg::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
-{
-//  EraseWindow();
-  if (! LimitsFixed() ) {  //  On met a jour les limites a partir du premier Drawer
-    PIDrawer* drw = GetDrawer(1);
-    if (drw != NULL)   {    
-      drw->UpdateSize();
-      SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
-      }
-    else SetLimits(0., 1., 0., 1.);
-    }
-}
-*/
 
 // Gestion affichage coordonnees du point 
@@ -140,5 +136,5 @@
      }
   Send(Msg(), PIMsg_Active);
-
+  PIDrwTools::SetCurrentBaseWdg(this);
 }
 
@@ -191,4 +187,5 @@
   mWGrC->SelLine(PI_ThinLine);
   Send(Msg(), PIMsg_Active);
+  PIDrwTools::SetCurrentBaseWdg(this);
 }
 
@@ -228,83 +225,2 @@
 
 
-//================================================================
-// PIFuncDrawer
-//================================================================
-
-PIFuncDrawer::PIFuncDrawer(PIFuncDrawer::FUNC f)
-: mFunc(f)
-{}
-
-PIFuncDrawer::~PIFuncDrawer()
-{
-}
-
-void
-PIFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
-{
-  PIGrCoord x1, x2, y1, y2;
-  g->GetGrSpace(x1, x2, y1, y2);
-  float xMax = x2;
-  float xMin = x1;
-  float yMax = y2;
-  float yMin = y1;
-  float xStep = (xMax - xMin)/100;
-  float xOld = xMin;
-  float yOld = mFunc(xMin);
-  for (float x = xMin+xStep; x<xMax; x+=xStep) {
-    double y = mFunc(x);
-    if (y>yMin && yOld>yMin && 
-        y<yMax && yOld<yMax) 
-           g->DrawLine(xOld, yOld, x, y);
-    xOld = x;
-    yOld = y;
-  }
-}
-
-//================================================================
-// PIGFFDrawer
-//================================================================
-
-PIGFFDrawer::PIGFFDrawer(GeneralFunction* f)
-: mFunc(f), mNParms(f->NPar()), mParms(new double[mNParms])
-{
-  ASSERT(f->NVar() == 1);
-}
-
-PIGFFDrawer::~PIGFFDrawer()
-{
-  delete[] mParms;
-}
-
-void
-PIGFFDrawer::SetParms(double const* p)
-{
-  for (int i=0; i<mNParms; i++)
-    mParms[i] = p[i];
-}
-
-
-void
-PIGFFDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
-{
-  PIGrCoord x1, x2, y1, y2;
-  g->GetGrSpace(x1, x2, y1, y2);
-  float xMax = x2;
-  float xMin = x1;
-  float yMax = y2;
-  float yMin = y1;
-  float xStep = (xMax - xMin)/100;
-  float xOld = xMin;
-  float yOld = 0;
-//  float yOld = f->Value(&xMin, mParms);
-  for (float x = xMin+xStep; x<xMax; x+=xStep) {
-   float y = 0; // $CHECK$
-//    float y = f->Value(&x, mParms);
-    if (y>yMin && yOld>yMin && 
-        y<yMax && yOld<yMax) 
-           g->DrawLine(xOld, yOld, x, y);
-    xOld = x;
-    yOld = y;
-  }
-}
-
Index: /trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 118)
+++ /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 119)
@@ -11,6 +11,4 @@
 
 
-
-
 class PIScDrawWdg : public PIBaseWdg {
 public:
@@ -23,6 +21,6 @@
   virtual long       kind() {return ClassId; }
   
-//  virtual void       Draw(PIGraphic* g);
-//  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+  virtual void       Keyboard(int key, PIKeyModifier kmod);
+  virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
   
   void               SetLimits(float xmin, float xmax, float ymin, float ymax, 
@@ -78,29 +76,3 @@
 
 
-class PIFuncDrawer : public PIDrawer {
-public:
-  typedef double(*FUNC)(double);
-                     PIFuncDrawer(FUNC);
-  virtual           ~PIFuncDrawer();
-  
-  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
-protected:
-  FUNC               mFunc;
-};
-
-class GeneralFunction;
-class PIGFFDrawer : public PIDrawer {
-public:
-                     PIGFFDrawer(GeneralFunction*);
-  virtual           ~PIGFFDrawer();
-  
-  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
-  virtual void       SetParms(double const*);
-protected:
-  GeneralFunction*    mFunc;
-  int                 mNParms;
-  double*             mParms;
-};
-
-
 #endif
Index: /trunk/SophyaPI/PI/pistlist.cc
===================================================================
--- /trunk/SophyaPI/PI/pistlist.cc	(revision 118)
+++ /trunk/SophyaPI/PI/pistlist.cc	(revision 119)
@@ -4,12 +4,10 @@
  
 /* --Methode-- */
-PIStarList::PIStarList(StarList* stl, bool ad, int ayud)
+PIStarList::PIStarList(StarList* stl, bool ad)
 : PIDrawer(), mStL(stl)
 {
   mAdDO = ad;   
-  mAYdir = ayud;  
   if (stl == NULL) return;
   SetFluxLimits(1., -1.);
-  SetXYLimits(1., -1., 1., -1.);
 }
 
@@ -20,5 +18,5 @@
 
 /* --Methode-- */
-void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, int msz0, bool refr)
+void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, bool dispflx, bool refr)
 {
   if (!mStL)  return;  
@@ -32,27 +30,8 @@
   if (nl > 20)  nl = 20;
   mNLev = nl;  
-  if (msz0 < 0)  msz0 = 0;
-  if (msz0 > 10)  msz0 = 10; 
-  mMSz0 = msz0;
+  mDspFV = dispflx;
   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;    
-}  
 
 
@@ -64,9 +43,11 @@
   // Commencer par trouver nos limites
   float dx, dy;
+  double x1, x2, y1, y2;
+  mStL->CalcXYLimits(x1, x2, y1, y2);
   
-  dx = 0.02*(mXMax-mXMin);
-  dy = 0.02*(mYMax-mYMin);
+  dx = 0.02*(x2-x1);
+  dy = 0.02*(y2-y1);
   
-  SetLimits(mXMin-dx, mXMax+dx, mYMin-dy, mYMax+dy, kAxeDirLtoR, mAYdir); 
+  SetLimits(x1-dx, x2+dx, y1-dy, y2+dy); 
   SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
 }
@@ -84,4 +65,7 @@
 if (!mStL) return;
 
+int msz = mMSz;
+if (msz < 1) msz = 1;
+
 g->SelFont();
 nok = 0;  nl2 = mNLev*2-1;
@@ -92,8 +76,7 @@
   if ( (flx < mFmin) || (flx > mFmax) )  continue;
   xp = sti->PosX();   yp = sti->PosY();
-  if ( (xp < mXMin) || (xp > mXMax) || (yp < mYMin) || (yp > mYMax) )  continue;
   if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
   nok++;
-  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + mMSz0;
+  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + msz;
   if (sz < 2)  g->SelMarker(sz, PI_DotMarker);
   else g->SelMarker(sz, PI_FCircleMarker);
Index: /trunk/SophyaPI/PI/pistlist.h
===================================================================
--- /trunk/SophyaPI/PI/pistlist.h	(revision 118)
+++ /trunk/SophyaPI/PI/pistlist.h	(revision 119)
@@ -7,5 +7,5 @@
 class PIStarList : public PIDrawer {
 public:
-                     PIStarList(StarList* stl, bool ad, int ayud=kAxeDirUpDown);
+                     PIStarList(StarList* stl, bool ad);
   virtual           ~PIStarList();
   
@@ -13,14 +13,7 @@
   virtual void       UpdateSize();
   
-  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);              
+  void               SetFluxLimits(float min=1., float max=-1., int nl=5, bool dispflx=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); }
@@ -30,11 +23,7 @@
   bool mAdDO;
   float mFmin, mFmax;
-  int mNLev, mMSz0;
+  int mNLev;
   double mF0, mDLgF;
-  float mXMin, mXMax;
-  float mYMin, mYMax;
   bool mDspFV;
-  int  mAYdir;
-
 };
 
