Index: trunk/SophyaPI/PI/Makefile
===================================================================
--- trunk/SophyaPI/PI/Makefile	(revision 2079)
+++ trunk/SophyaPI/PI/Makefile	(revision 2080)
@@ -1,17 +1,12 @@
-MODULECXXREPNAME := PI
-MODULEDECCXXFLAGS := -msg_quiet
 include ../Mgr/Makefile.h
  
 all: $(LIB)libPI.a
-$(LIB)libPI.a : $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)piaxestools.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)pieldrw.o $(OBJ)pievthandler.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pifontgen.o $(OBJ)pifontx.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pigratt.o $(OBJ)piimage.o $(OBJ)piimgtools.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)pistzwin.o $(OBJ)pisurfdr.o $(OBJ)pitherm.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)piyfxdrw.o $(OBJ)psfile.o
-	$(AR) $(ARFLAGS)  $@ $($(ARARGS)) 
+clean:
+	rm -f $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplmac.o $(OBJ)piapplx.o $(OBJ)piaxes.o $(OBJ)piaxestools.o $(OBJ)pibwdggen.o $(OBJ)pibwdgmac.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapmac.o $(OBJ)picmapview.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainermac.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pidrwtools.o $(OBJ)pieldrw.o $(OBJ)pierrdisp.o $(OBJ)pievthandler.o $(OBJ)pifilechogen.o $(OBJ)pifilechomac.o $(OBJ)pifilechox.o $(OBJ)pifontgen.o $(OBJ)pifontmac.o $(OBJ)pifontx.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphmac.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pigratt.o $(OBJ)piimage.o $(OBJ)piimgtools.o $(OBJ)pilistgen.o $(OBJ)pilistmac.o $(OBJ)pilistx.o $(OBJ)pimenubargen.o $(OBJ)pimenubarmac.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenumac.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenumac.o $(OBJ)pioptmenux.o $(OBJ)piperiodmac.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapmac.o $(OBJ)pipixmapx.o $(OBJ)pippapplmac.o $(OBJ)pipplist.o $(OBJ)pippmenubar.o $(OBJ)pippoptmenu.o $(OBJ)pippviewadapter.o $(OBJ)pippwindowmac.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgmac.o $(OBJ)pistdwdgx.o $(OBJ)pistzwin.o $(OBJ)pisurfdr.o $(OBJ)pitherm.o $(OBJ)piup.o $(OBJ)piup_def.o $(OBJ)piupdattachment.o $(OBJ)piwdggen.o $(OBJ)piwdgmac.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowmac.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)piyfxdrw.o $(OBJ)psfile.o $(OBJ)xdispim.o
+	rm -f $(LIB)libPI.a
+$(LIB)libPI.a : $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)piaxes.o $(OBJ)piaxestools.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)pieldrw.o $(OBJ)pievthandler.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pifontgen.o $(OBJ)pifontx.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pigratt.o $(OBJ)piimage.o $(OBJ)piimgtools.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)pistzwin.o $(OBJ)pisurfdr.o $(OBJ)pitherm.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)piyfxdrw.o $(OBJ)psfile.o
+	$(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))
 ifeq ($(CXX),cxx)
 	$(CXX) $? $(CPPFLAGS) $(CXXFLAGS) -o $(OBJ)xx.x -Hf
-endif 
- 
-clean:
-	rm -f $(OBJ)lut.o $(OBJ)parradapter.o $(OBJ)pi3ddrw.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)piaxestools.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)pieldrw.o $(OBJ)pievthandler.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pifontgen.o $(OBJ)pifontx.o $(OBJ)pigraph3d.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pigratt.o $(OBJ)piimage.o $(OBJ)piimgtools.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)pistzwin.o $(OBJ)pisurfdr.o $(OBJ)pitherm.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o $(OBJ)piyfxdrw.o $(OBJ)psfile.o
-ifeq ($(CXX),cxx)
-	cd $(REPM); rm -f *.o
 endif 
  
@@ -23,9 +18,9 @@
  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
- pievthandler.h psfile.h pigratt.h pieldrw.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
+ pievthandler.h psfile.h pigratt.h piaxes.h pieldrw.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 \
  $(INC)machdefs.h pisysdep.h picontainerx.h \
@@ -42,21 +37,25 @@
  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
  pievthandler.h psfile.h pigraphps.h
-$(OBJ)piaxestools.o: piaxestools.cc piaxestools.h pisysdep.h \
- $(INC)machdefs.h pistdwdgx.h pistdwdggen.h \
- piwdgx.h piwdggen.h pimsghandler.h picolist.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 pifontx.h pifontgen.h pigraphuc.h \
- pievthandler.h psfile.h pigraphps.h piscdrawwdg.h pidrawer.h \
- pigratt.h pieldrw.h
+$(OBJ)piaxes.o: piaxes.cc $(INC)machdefs.h piaxes.h \
+ pigraphuc.h pisysdep.h pigraphgen.h piwdgx.h piwdggen.h \
+ pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+ pifontgen.h pigratt.h
+$(OBJ)piaxestools.o: piaxestools.cc piaxes.h pigraphuc.h pisysdep.h \
+ $(INC)machdefs.h pigraphgen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+ pifontx.h pifontgen.h pigratt.h piaxestools.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 \
+ pibwdggen.h pigraphx.h pievthandler.h psfile.h pigraphps.h \
+ piscdrawwdg.h pidrawer.h pieldrw.h
 $(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h \
  $(INC)machdefs.h piwdgx.h piwdggen.h \
  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
  pigraphgen.h pifontx.h pifontgen.h pigraphuc.h pievthandler.h \
- psfile.h pidrawer.h pigratt.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
+ psfile.h pidrawer.h pigratt.h piaxes.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 \
  $(INC)machdefs.h pibwdggen.h piwdgx.h \
@@ -89,12 +88,11 @@
  piwdggen.h pimsghandler.h picolist.h
 $(OBJ)pidrawer.o: pidrawer.cc $(INC)machdefs.h \
- $(INC)utilgeom.h pidrawer.h pibwdggen.h \
- pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
- picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
- pigraphuc.h pievthandler.h psfile.h pigratt.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 \
- pigraphps.h ucckprot.h
+ pidrawer.h pibwdggen.h pisysdep.h piwdgx.h piwdggen.h pimsghandler.h \
+ picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
+ pifontx.h pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h \
+ piaxes.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 pigraphps.h ucckprot.h
 $(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h \
  $(INC)machdefs.h piwindowx.h piwindowgen.h \
@@ -103,5 +101,5 @@
  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
  pievthandler.h psfile.h pigraphps.h pistdwdgx.h pistdwdggen.h \
- pidrawer.h pigratt.h pieldrw.h
+ pidrawer.h pigratt.h piaxes.h pieldrw.h
 $(OBJ)pidrwtools.o: pidrwtools.cc pidrwtools.h pisysdep.h \
  $(INC)machdefs.h pistdwdgx.h pistdwdggen.h \
@@ -112,10 +110,10 @@
  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
  pievthandler.h psfile.h pigraphps.h piscdrawwdg.h pidrawer.h \
- pigratt.h pieldrw.h pi3ddrw.h pigraph3d.h
+ pigratt.h piaxes.h pieldrw.h pi3ddrw.h pigraph3d.h
 $(OBJ)pieldrw.o: pieldrw.cc $(INC)machdefs.h \
  pieldrw.h pidrawer.h pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
  pigraphgen.h pifontx.h pifontgen.h pigraphuc.h pievthandler.h \
- psfile.h pigratt.h
+ psfile.h pigratt.h piaxes.h
 $(OBJ)pievthandler.o: pievthandler.cc pievthandler.h pisysdep.h \
  $(INC)machdefs.h pimsghandler.h piwdgx.h \
@@ -168,10 +166,11 @@
  pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
- pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h pipixmapx.h \
- pipixmapgen.h pibwdgx.h pigraphps.h pistdwdgx.h pistdwdggen.h \
- piwindowx.h piwindowgen.h picontainerx.h picontainergen.h \
- picmapview.h piimgtools.h pioptmenux.h pioptmenugen.h pimenux.h \
- pimenugen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
- picons.h pidrwtools.h piscdrawwdg.h piyfxdrw.h
+ pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h piaxes.h \
+ pipixmapx.h pipixmapgen.h pibwdgx.h pigraphps.h pistdwdgx.h \
+ pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h picmapview.h piimgtools.h pioptmenux.h \
+ pioptmenugen.h pimenux.h pimenugen.h piapplx.h piapplgen.h \
+ pimenubarx.h pimenubargen.h picons.h pidrwtools.h piscdrawwdg.h \
+ piyfxdrw.h
 $(OBJ)piimgtools.o: piimgtools.cc piimgtools.h pisysdep.h \
  $(INC)machdefs.h pistdwdgx.h pistdwdggen.h \
@@ -182,5 +181,6 @@
  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
  pievthandler.h psfile.h pigraphps.h piimage.h parradapter.h lut.h \
- pieldrw.h pidrawer.h pigratt.h pipixmapx.h pipixmapgen.h picmapview.h
+ pieldrw.h pidrawer.h pigratt.h piaxes.h pipixmapx.h pipixmapgen.h \
+ picmapview.h
 $(OBJ)pilistgen.o: pilistgen.cc pilistgen.h pisysdep.h \
  $(INC)machdefs.h piwdgx.h piwdggen.h \
@@ -240,5 +240,5 @@
  pifontgen.h pigraphuc.h pievthandler.h psfile.h pigraphps.h \
  pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
- picontainergen.h pidrawer.h pigratt.h pieldrw.h pidrwtools.h \
+ picontainergen.h pidrawer.h pigratt.h piaxes.h pieldrw.h pidrwtools.h \
  pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h piapplx.h \
  piapplgen.h pimenubarx.h pimenubargen.h picons.h piaxestools.h
@@ -260,6 +260,6 @@
  pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
- pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h pieldrw.h \
- pigraph3d.h pibwdgx.h pigraphps.h
+ pifontgen.h pigraphuc.h pievthandler.h psfile.h pigratt.h piaxes.h \
+ pieldrw.h pigraph3d.h pibwdgx.h pigraphps.h
 $(OBJ)pitherm.o: pitherm.cc pitherm.h pisysdep.h \
  $(INC)machdefs.h pibwdgx.h pibwdggen.h \
@@ -293,5 +293,5 @@
  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigraphuc.h \
- pievthandler.h psfile.h pigratt.h
+ pievthandler.h psfile.h pigratt.h piaxes.h
 $(OBJ)psfile.o: psfile.cc psfile.h $(INC)machdefs.h \
  pisysdep.h pifontgen.h pigraphgen.h piwdgx.h piwdggen.h \
Index: trunk/SophyaPI/PI/objlist.list
===================================================================
--- trunk/SophyaPI/PI/objlist.list	(revision 2079)
+++ trunk/SophyaPI/PI/objlist.list	(revision 2080)
@@ -4,4 +4,5 @@
 piapplgen.o
 piapplx.o
+piaxes.o
 piaxestools.o
 pibwdggen.o
Index: trunk/SophyaPI/PI/piaxes.cc
===================================================================
--- trunk/SophyaPI/PI/piaxes.cc	(revision 2080)
+++ trunk/SophyaPI/PI/piaxes.cc	(revision 2080)
@@ -0,0 +1,424 @@
+// Module PI : Peida Interactive     PIAxes
+// Methodes de trace des axes 
+//                    R. Ansari - 2002
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "machdefs.h"
+#include "piaxes.h"
+#include <math.h>
+
+inline void dble_SWAP(double a, double b) {double tmp=a; a=b; b=tmp;}
+
+/* --Methode-- */
+PIAxes::PIAxes()
+{
+}
+
+/* --Methode-- */
+PIAxes::~PIAxes()
+{
+}
+
+/* --Methode-- */
+void PIAxes::DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 
+			unsigned int flags, bool afsz)
+{
+  PIGrCoord xmin, xmax, ymin, ymax;
+  g->GetGrSpace(xmin, xmax, ymin, ymax);
+  DrawXYAxes(g, gratt, flags, afsz, (double)xmin, (double)xmax, 
+	     (double)ymin, (double)ymax);
+}
+
+/* --Methode-- */
+void PIAxes::DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 
+			unsigned int flags, bool afsz,
+			double xmin, double xmax, double ymin, double ymax)
+{
+  Setup(g, xmin, xmax, ymin, ymax);
+  //  g->NoClip();
+
+  if (gratt.GetLineAtt() == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
+  else g->SelLine(gratt.GetLineAtt());
+  if (gratt.GetColor() == PI_NotDefColor) g->SelForeground(PI_Black);
+  else g->SelForeground(gratt.GetColor());
+
+  if(afsz) { 
+    double fsz = xMajTickLen*3.5;
+    g->SelFontSz(fsz);
+  }
+
+  if (flags & kStdAxes) {
+
+    // Les axes
+    
+    g->DrawLine(xMin, (yMin+yMax)/2., xMax, (yMin+yMax)/2.);
+    g->DrawLine((xMin+xMax)/2., yMin, (xMin+xMax)/2., yMax);
+
+    // La grille en pointilles
+
+    if (flags & kGridOn) DrawGrid(g);
+  
+    // Les ticks majeurs
+  
+    if (flags & kMajTicks) {
+        DrawHTicks(g, (yMin+yMax)/2., xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
+        DrawVTicks(g, (xMin+xMax)/2., yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
+    }
+    
+    // Les ticks mineurs
+  
+    if (flags & kMinTicks) {
+        DrawHTicks(g, (yMin+yMax)/2., xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
+        DrawVTicks(g, (xMin+xMax)/2., yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
+    }
+    
+    // Les labels
+    
+    if (flags & kLabels) {
+      if (!aYdir)
+        DrawHLabels(g, (yMin+yMax)/2.-xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
+      else 
+        DrawHLabels(g, (yMin+yMax)/2.+xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
+      if (!aXdir)
+        DrawVLabels(g, (xMin+xMax)/2.-yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
+      else 
+        DrawVLabels(g, (xMin+xMax)/2.+yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
+    }
+    
+  }
+  
+  if (flags & kBoxAxes) {
+  
+    // La boite
+    
+    g->DrawLine(xMin, yMin, xMax, yMin);
+    g->DrawLine(xMax, yMin, xMax, yMax);
+    g->DrawLine(xMax, yMax, xMin, yMax);
+    g->DrawLine(xMin, yMax, xMin, yMin);
+
+    // Longueur des ticks
+    
+    double extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
+    double intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
+    double extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
+    double intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
+    double extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
+    double intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
+    double extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
+    double intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
+
+    // La grille en pointilles
+
+    if (flags & kGridOn) DrawGrid(g);
+
+    // Les ticks majeurs
+  
+    if (flags & kMajTicks) {
+        DrawHTicks(g, yMin, intXMajTickLen, extXMajTickLen, xFirstMajTick, xMajTickStep);
+        DrawHTicks(g, yMax, extXMajTickLen, intXMajTickLen, xFirstMajTick, xMajTickStep);
+        DrawVTicks(g, xMin, extYMajTickLen, intYMajTickLen, yFirstMajTick, yMajTickStep);
+        DrawVTicks(g, xMax, intYMajTickLen, extYMajTickLen, yFirstMajTick, yMajTickStep);
+    }
+    
+    // Les ticks mineurs
+  
+    if (flags & kMinTicks) {
+        DrawHTicks(g, yMin, intXMinTickLen, extXMinTickLen, xFirstMinTick, xMinTickStep);
+        DrawHTicks(g, yMax, extXMinTickLen, intXMinTickLen, xFirstMinTick, xMinTickStep);
+        DrawVTicks(g, xMin, extYMinTickLen, intYMinTickLen, yFirstMinTick, yMinTickStep);
+        DrawVTicks(g, xMax, intYMinTickLen, extYMinTickLen, yFirstMinTick, yMinTickStep);
+    }
+
+
+    // Les labels
+    
+    if (flags & kLabels) {
+      if (!aYdir) {
+        DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
+        //DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
+      }
+      else {
+        //DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
+        DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
+      }
+      if (!aXdir) {
+        DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
+        //DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
+      }
+      else {
+        //DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
+        DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
+      }
+    }
+  }
+  g->Clip();
+  
+}
+
+/* --Methode-- */
+void PIAxes::Setup(PIGraphicUC* g, double xmin, double xmax, 
+		       double ymin, double ymax)
+{
+  
+  xMin = xmin;  xMax = xmax;
+  yMin = ymin;  yMax = ymax;
+
+  aXdir = g->isAxeXDirRtoL();
+  aYdir = g->isAxeYDirUpDown();
+  aXlog = g->isLogScaleX();
+  aYlog = g->isLogScaleY();
+
+  int ntick_x = (aXlog) ? 6 : 10;
+  BestTicks(xMin,xMax,ntick_x,xMajTickStep,xFirstMajTick);
+  xMinTickStep = xMajTickStep/5;
+  xFirstMinTick = floor(xMin / xMinTickStep) * xMinTickStep;
+  if(xFirstMinTick < xMin) xFirstMinTick += xMinTickStep;
+
+  int ntick_y = (aYlog) ? 6 : 12;
+  BestTicks(yMin,yMax,ntick_y,yMajTickStep,yFirstMajTick);
+  yMinTickStep = yMajTickStep/5;
+  yFirstMinTick = floor(yMin / yMinTickStep) * yMinTickStep;
+  if(yFirstMinTick < yMin) yFirstMinTick += yMinTickStep;
+
+  yMajTickLen = (xMax-xMin)/100;
+  yMinTickLen = (xMax-xMin)/250;
+  xMajTickLen = (yMax-yMin)/100;
+  xMinTickLen = (yMax-yMin)/250;
+}
+
+
+/* --Methode-- */
+void PIAxes::DrawHTicks(PIGraphicUC* g, double y, double tickUp, 
+			double tickDown, double xBeg, double xStep)
+{
+  for (double x=xBeg; x<=xMax+xStep/10.; x += xStep)
+    g->DrawLine(x, g->DeltaUCY(y, -tickDown), x, g->DeltaUCY(y, tickUp));
+}
+
+/* --Methode-- */
+void PIAxes::DrawVTicks(PIGraphicUC* g, double x, double tickLeft, 
+			double tickRight, double yBeg, double yStep)
+{
+  for (double y=yBeg; y<=yMax; y += yStep)
+    g->DrawLine(g->DeltaUCX(x, -tickLeft), y, g->DeltaUCX(x,tickRight), y);
+}
+
+/* --Methode-- */
+void PIAxes::DrawHLabels(PIGraphicUC* g, double y, double xBeg, 
+			 double xStep, unsigned long just)
+{
+
+  // Choix du bon format pour les labels des axes;
+  char label[64]; string format; double fac=1.; bool p10=false;
+  int npuiss = BonFormatAxes(xBeg,xMax,xStep,format,2,1);
+  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
+  else BonFormatAxes(xBeg,xMax,xStep,format,0,1);
+
+  double xOffset = 0;
+  double xlastlabelfin = xBeg - 2.*(xMax-xBeg);
+  for(double x=xBeg; x<=xMax+xStep/10.; x+=xStep) {
+    //Attention erreur d'arrondi x->0 (on code 5.1698e-26 au lieu de 0)
+    double xx = (fabs(x/xStep)<1.e-5) ? 0.: x;
+    sprintf(label,format.c_str(),xx/fac);
+    for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
+    double largeur = g->CalcStringWidth(label);
+    if(aXdir) xOffset = largeur/2; else xOffset=-largeur/2;
+    if(x+xOffset > xlastlabelfin) {
+      g->DrawString(x,y,label,PI_HorizontalCenter|just);
+      xlastlabelfin = x + xOffset + 1.1*largeur;
+    }
+  }
+
+  if(p10) {
+    PIGrCoord asc,desc;
+    double h = g->GetFontHeight(asc,desc);
+    if((aYdir && (just&PI_VerticalBottom)) || (!aYdir && (just&PI_VerticalTop)) ) h = -h; 
+    double xm = (aXdir)? xMin: xMax;
+    double ym = g->DeltaUCY(y,1.5*h);
+    sprintf(label,"%d",npuiss);
+    g->DrawCompString(xm,ym,"x 10",label,NULL,PI_HorizontalCenter|just);
+  }
+
+}
+
+/* --Methode-- */
+void PIAxes::DrawVLabels(PIGraphicUC* g, double x, double yBeg, 
+			 double yStep, unsigned long just)
+{
+
+  // Choix du bon format pour les labels des axes;
+  char label[64]; string format; double fac=1.; bool p10=false;
+  int npuiss = BonFormatAxes(yBeg,yMax,yStep,format,2,1);
+  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
+  else BonFormatAxes(yBeg,yMax,yStep,format,0,1);
+
+  for(double y=yBeg; y<=yMax; y += yStep) {
+    double yy = (fabs(y/yStep)<1.e-5) ? 0.: y;
+    sprintf(label,format.c_str(),yy/fac);
+    for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
+    g->DrawString(x,y,label,PI_VerticalCenter|just);
+  }
+
+  if(p10) {
+    PIGrCoord asc,desc;
+    double h = g->GetFontHeight(asc,desc);
+    if(aYdir) h = -h; 
+    double ym = (aYdir)? yMin: yMax; ym = g->DeltaUCY(ym,h);
+    sprintf(label,"%d",npuiss);
+    g->DrawCompString(x,ym,"x 10",label,NULL,PI_VerticalBottom|just);
+  }
+
+}
+
+/* --Methode-- */
+void PIAxes::DrawGrid(PIGraphicUC* g)
+{
+  PILineAtt savlineatt = g->GetLineAtt();
+//  g->SelLine(PI_ThinDashedLine);
+  g->SelLine(PI_ThinDottedLine);
+
+  for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep)
+    g->DrawLine(x, yMin, x, yMax);
+
+  for (double y=yFirstMajTick; y<=yMax; y += yMajTickStep)
+    g->DrawLine(xMin, y, xMax, y);
+
+  g->SelLine(savlineatt);
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+/* --Methode-Static-- */
+void PIAxes::BestTicks(double xmin,double xmax,int nticks
+                        ,double& steptick,double& xfirsttick)
+// *** Calcul de l'intervalle entre les ticks et de la valeur du premier tick
+{
+double d=xmax-xmin; if(d<1.e-100) d=1.e-100; //if (d<1.e-39) d=1.e-39;
+double ld  = log10(d);
+double fld = floor( ((ld<0.)? -ld: ld) );
+double del,del0;
+if(ld>=0.) {fld-=1.; del0=del=pow(10.,fld);}
+  else     {fld+=2.; del0=del=pow(10.,-fld);}
+// *** Intervalle entre les ticks
+// xmin  xmax    d       ld       fld -->fld  del0
+// 1     1500    1499    3.17     3      2    10^2
+// 1     9500    9499    3.98     3      2    10^2
+// 1     1.005   0.005   -2.3     2      4    10^-4
+// 1     1.995   0.995   -0.0022  0      2    10^-2
+// - Et recherche de la valeur del={del0,2*del0,...,20*del0}
+// telle que "nticks*del" soit le plus petit nombre ">=d"
+// Par exemple, si nticks=10:
+// 1-/ pour le 2sd cas ou d=9499 et del0=100 :
+// del        =    100    200    500    1000    2000
+// nticks*del =   1000   2000   5000   10000   20000
+// d/del      =   94.9   47.4   18.9 | 9.499   4.749  ==> majt = 1000
+// 2-/ pour le 3ieme cas ou d=5e-3 et del0=1e-4 :
+// del        =  1e-4   2e-4   5e-4  1e-3   2e-3
+// nticks*del =  1e-3   2e-3   5e-3  1e-2   2e-2
+// d/del      =  50     25   | 10    5      2.5       ==> majt = 5e-4
+int k=0;
+double fac[4] = {2.,5.,10.,20.};
+while(d/del>(double)nticks && k<4 ) {del=fac[k]*del0; k++;}
+steptick=del;
+//***  Valeur du premier tick
+xfirsttick = floor(xmin/steptick); if(xmin<0.) xfirsttick+=1.;
+xfirsttick *= steptick;
+if(xfirsttick<xmin) xfirsttick += steptick;
+}
+
+/* --Methode-Static-- */
+int PIAxes::BonFormatAxes(double xmin,double xmax,double xstep
+                           ,string& format,int typf,int add_digit)
+// *** Calcul format optimal pour ecrire les labels numeriques des axes:
+// ---- Input
+// . xmin,xmax : limites du plot sur l'axe considere.
+// . xstep : distance entre les ticks.
+// . add_digit : nombre de digits a ajouter au nombre de digits minimum.
+// . typf : type de format en sortie
+//        0 : format optimum %-nn.mme ou %-nn.mmf selon valeurs
+//        1 : format %-nn.mme
+//        2 : format %-nn.mmf pour imprimer x/10^npuiss
+//            tel que x/10^npuiss soit entre 0 et 10
+// ---- Output
+// . format : le format d'impression
+// ---- Return:
+// Si typ=0 ou 1 
+//   "ndig" : nombre de digits necessaires pour distinguer
+//            les valeurs xmin+k*dx (<=xmax)
+// Si typ=2
+//   "npuiss" : tel que x/10^npuiss soit entre 0 et 10
+//              Dans ce cas le format est celui qui imprime x/10^npuiss
+{
+ format = "%-5g";  // format par default
+ if(xmin>=xmax) {if(typf==2) return 0; else return -1;}
+
+ if(xstep<=0. || xstep>xmax-xmin) xstep = xmax-xmin;
+
+ double axmin=fabs(xmin), axmax=fabs(xmax);
+ if(axmin>axmax) dble_SWAP(axmin,axmax);
+
+ double l10amax = log10(axmax), l10xstep = log10(xstep);
+ int il10amax = int(floor(l10amax));
+
+ // choix du type de format
+ char ftype = 'e';
+ int npuiss = 0;
+ if(typf==2) {
+   npuiss = il10amax;
+   if(npuiss<-300 || npuiss>300) {
+     ftype='e'; npuiss=0;
+   } else {
+     // On recalcule les valeurs de decision pour  axmax/10^npuiss, xstep/10^npuiss
+     l10amax -= (double)npuiss; l10xstep -=  (double)npuiss;
+     il10amax = int(floor(l10amax));
+     ftype = 'f';
+   }
+ } else if(typf==1) {
+   ftype='e';
+ } else {
+   ftype='e';
+   // On evite d'ecrire +a.bbbe+ccc -> format %f
+   // Ex: 1.2345e+2 -> 123.45   /  -1.2345e+2 -> -123.45
+   //     1.2345e-1 -> 0.12345  /  -1.2345e-1 -> -0.12345
+   if((axmin>=1e-4 || axmin==0.) && axmax<1e4) ftype='f';
+ }
+
+ //printf("BonFormatAxes[npuiss=%d]: xmin=%-21.14e xmax=%-21.14e\n",npuiss,xmin,xmax);
+ //printf("        xstep=%-21.14e log10(xstep/10^%d)=%g\n",xstep,npuiss,l10xstep);
+ //printf("        axmax=%-21.14e log10(axmax/10^%d)=%g diff=%g\n"
+ //      ,axmax,npuiss,l10amax,l10amax-l10xstep);
+
+ // Nombre de digits necessaires pour ecrire axmax et xstep
+ int ndig = il10amax  -  int(floor(l10xstep));
+ if(ndig<0) ndig *= -1;  ndig += 1;
+ //printf("ndig=%d",ndig);
+ 
+ // Add more digits (or suppress digits)
+ ndig += add_digit; if(ndig<0) ndig=0;
+ //printf(" + %d  ==> ndig=%d\n",add_digit,ndig);
+
+ // Calcul du bon format
+ char str[16];
+ if(ftype=='f') { // Calcul du format %-nn.mmf
+   int mm=-1, nn;
+   if(il10amax<0) { // +0.12345 +0.0012345 +0.0012345 ...
+     mm = ndig - il10amax - 1; nn = mm+3;
+   } else {         // +1.2345 +12.345 +123.45 ...
+     mm = ndig - il10amax - 1; nn = ndig+2;
+   }
+   //printf("format %%f : mm=%d  nn=%d\n",mm,nn);
+   if(mm<0.) mm=0; if(nn<mm+3) nn=mm+3;
+   sprintf(str,"%%-%d.%df",nn,mm);
+ } else if(ftype=='e') { // Calcul du format %-nn.mme
+   //   +d.<--ddd-->e+123
+   //   1 2         34567  ==> nn=ndig+7   mm=ndig-1
+   sprintf(str,"%%-%d.%de",ndig+7,ndig-1);
+ }
+
+ format = str;
+ //printf("format=[%s]\n",format.c_str());
+
+ if(typf==2) return npuiss;
+ return ndig;
+}
+
Index: trunk/SophyaPI/PI/piaxes.h
===================================================================
--- trunk/SophyaPI/PI/piaxes.h	(revision 2080)
+++ trunk/SophyaPI/PI/piaxes.h	(revision 2080)
@@ -0,0 +1,74 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Methodes de trace d'axes - 
+//                             R. Ansari  2002
+// (C) LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#ifndef PIAXES_H
+#define PIAXES_H
+
+#include "pigraphuc.h"
+#include "pigratt.h"
+
+enum {
+  kStdAxes     = 0x0001,
+  kBoxAxes     = 0x0002,
+  kTicks       = 0x0004,
+  kIntTicks    = 0x0010,
+  kExtTicks    = 0x0020,
+  kMajTicks    = 0x0040,
+  kMinTicks    = 0x0080,
+  kLabels      = 0x1000,
+  kGridOn      = 0x2000,
+  kAxesDflt    = kStdAxes | kTicks | kLabels,       // Axes trace par defaut
+  kAxesNone    = 0                                  // Pas de trace d axe  
+};
+
+
+class PIAxes {
+public:
+
+                    PIAxes();
+  virtual           ~PIAxes();
+
+  virtual void      DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 
+			       unsigned int flags, bool afsz);
+
+  virtual void      DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 
+			       unsigned int flags, bool afsz, 
+			       double xmin, double xmax, 
+			       double ymin, double ymax);
+
+  //  virtual void      DrawHorizontalAxe(double xmin, double xmax, double y, 
+
+//  --- Methodes static ----
+//  Calcul des Distances optimales des subdivisions 
+  static void BestTicks(double xmin,double xmax,int nticks
+                       ,double& steptick,double& xfirsttick);
+//  Calcul du format optimal pour les axes
+  static int BonFormatAxes(double xmin,double xmax,double xstep
+                          ,string& format,int typf=0,int add_digit=0);
+protected:
+  void Setup(PIGraphicUC* g, double xmin, double xmax, 
+	     double ymin, double ymax);
+
+  void DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep);
+  void DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep);
+  void DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, unsigned long just=0);
+  void DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, unsigned long just=0);
+  void DrawGrid(PIGraphicUC* g);
+
+  double xMin, xMax, yMin, yMax; 
+  bool   aXdir, aYdir;           // Sens des axes horiz, vertical 
+  bool   aXlog, aYlog;           // Echelle log pour les axes horiz, vertical 
+  bool   axesAFSz;
+  
+  double xFirstMajTick, xFirstMinTick;
+  double yFirstMajTick, yFirstMinTick;
+  double xMajTickStep, xMinTickStep;
+  double yMajTickStep, yMinTickStep;
+  double xMajTickLen,  xMinTickLen;
+  double yMajTickLen,  yMinTickLen;
+
+};
+
+#endif
Index: trunk/SophyaPI/PI/piaxestools.cc
===================================================================
--- trunk/SophyaPI/PI/piaxestools.cc	(revision 2079)
+++ trunk/SophyaPI/PI/piaxestools.cc	(revision 2080)
@@ -7,4 +7,5 @@
 #include <iostream.h>
 
+#include "piaxes.h"
 #include "piaxestools.h"
 
@@ -196,9 +197,9 @@
   string format,dum;
   PIScDrawWdg* scd = curscdwdg;
-    PIDrawer::BonFormatAxes(scd->XMin(),scd->XMax(),-1.,format,0,2);
+    PIAxes::BonFormatAxes(scd->XMin(),scd->XMax(),-1.,format,0,2);
     dum = format; dum += "  "; dum += format;
   sprintf(buff,dum.c_str(),scd->XMin(),scd->XMax());
   mText[0]->SetText(buff);
-    PIDrawer::BonFormatAxes(scd->YMin(),scd->YMax(),-1.,format,0,2);
+    PIAxes::BonFormatAxes(scd->YMin(),scd->YMax(),-1.,format,0,2);
     sprintf(buff,dum.c_str(),scd->YMin(),scd->YMax());
   mText[1]->SetText(buff);
Index: trunk/SophyaPI/PI/pidrawer.cc
===================================================================
--- trunk/SophyaPI/PI/pidrawer.cc	(revision 2079)
+++ trunk/SophyaPI/PI/pidrawer.cc	(revision 2080)
@@ -12,5 +12,4 @@
 #include "ucckprot.h"
 
-#define dble_SWAP(__a,__b) {double __tmp=__a; __a=__b; __b=__tmp;}
 
 //++
@@ -360,25 +359,4 @@
 
 void
-PIDrawer::CalcTicks()
-{
-  int ntick_x = (aXlog) ? 6 : 10;
-  BestTicks(xMin,xMax,ntick_x,xMajTickStep,xFirstMajTick);
-  xMinTickStep = xMajTickStep/5;
-  xFirstMinTick = floor(xMin / xMinTickStep) * xMinTickStep;
-  if(xFirstMinTick < xMin) xFirstMinTick += xMinTickStep;
-
-  int ntick_y = (aYlog) ? 6 : 12;
-  BestTicks(yMin,yMax,ntick_y,yMajTickStep,yFirstMajTick);
-  yMinTickStep = yMajTickStep/5;
-  yFirstMinTick = floor(yMin / yMinTickStep) * yMinTickStep;
-  if(yFirstMinTick < yMin) yFirstMinTick += yMinTickStep;
-
-  yMajTickLen = (xMax-xMin)/100;
-  yMinTickLen = (xMax-xMin)/250;
-  xMajTickLen = (yMax-yMin)/100;
-  xMinTickLen = (yMax-yMin)/250;
-}
-
-void
 PIDrawer::SetAxesFlags(unsigned int flags)
 {
@@ -397,121 +375,10 @@
 {
   g->NoClip();
-  if (GetGraphicAtt().GetLineAtt() == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
-  else g->SelLine(GetGraphicAtt().GetLineAtt());
-  if (GetGraphicAtt().GetColor() == PI_NotDefColor) g->SelForeground(PI_Black);
-  else g->SelForeground(GetGraphicAtt().GetColor());
-  //  On calcule les ticks 
-  CalcTicks();
-
-  unsigned int flags = axesFlags;
-
-  if (flags & kStdAxes) {
-
-    // Les axes
-    
-    g->DrawLine(xMin, (yMin+yMax)/2., xMax, (yMin+yMax)/2.);
-    g->DrawLine((xMin+xMax)/2., yMin, (xMin+xMax)/2., yMax);
-
-    // La grille en pointilles
-
-    if (flags & kGridOn) DrawGrid(g);
+  PIAxes axes;
+  axes.DrawXYAxes(g, mGrAtt, axesFlags, axesAFSz, XMin(), XMax(), YMin(), YMax()); 
+  g->Clip();
+}
+
   
-    // Les ticks majeurs
-  
-    if (flags & kMajTicks) {
-        DrawHTicks(g, (yMin+yMax)/2., xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
-        DrawVTicks(g, (xMin+xMax)/2., yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
-    }
-    
-    // Les ticks mineurs
-  
-    if (flags & kMinTicks) {
-        DrawHTicks(g, (yMin+yMax)/2., xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
-        DrawVTicks(g, (xMin+xMax)/2., yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
-    }
-    
-    // Les labels
-    
-    if (flags & kLabels) {
-      if (!aYdir)
-        DrawHLabels(g, (yMin+yMax)/2.-xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
-      else 
-        DrawHLabels(g, (yMin+yMax)/2.+xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
-      if (!aXdir)
-        DrawVLabels(g, (xMin+xMax)/2.-yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
-      else 
-        DrawVLabels(g, (xMin+xMax)/2.+yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
-    }
-    
-  }
-  
-  if (flags & kBoxAxes) {
-  
-    // La boite
-    
-    g->DrawLine(xMin, yMin, xMax, yMin);
-    g->DrawLine(xMax, yMin, xMax, yMax);
-    g->DrawLine(xMax, yMax, xMin, yMax);
-    g->DrawLine(xMin, yMax, xMin, yMin);
-
-    // Longueur des ticks
-    
-    double extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
-    double intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
-    double extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
-    double intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
-    double extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
-    double intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
-    double extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
-    double intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
-
-    // La grille en pointilles
-
-    if (flags & kGridOn) DrawGrid(g);
-
-    // Les ticks majeurs
-  
-    if (flags & kMajTicks) {
-        DrawHTicks(g, yMin, intXMajTickLen, extXMajTickLen, xFirstMajTick, xMajTickStep);
-        DrawHTicks(g, yMax, extXMajTickLen, intXMajTickLen, xFirstMajTick, xMajTickStep);
-        DrawVTicks(g, xMin, extYMajTickLen, intYMajTickLen, yFirstMajTick, yMajTickStep);
-        DrawVTicks(g, xMax, intYMajTickLen, extYMajTickLen, yFirstMajTick, yMajTickStep);
-    }
-    
-    // Les ticks mineurs
-  
-    if (flags & kMinTicks) {
-        DrawHTicks(g, yMin, intXMinTickLen, extXMinTickLen, xFirstMinTick, xMinTickStep);
-        DrawHTicks(g, yMax, extXMinTickLen, intXMinTickLen, xFirstMinTick, xMinTickStep);
-        DrawVTicks(g, xMin, extYMinTickLen, intYMinTickLen, yFirstMinTick, yMinTickStep);
-        DrawVTicks(g, xMax, intYMinTickLen, extYMinTickLen, yFirstMinTick, yMinTickStep);
-    }
-
-
-    // Les labels
-    
-    if (flags & kLabels) {
-      if (!aYdir) {
-        DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
-        //DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
-      }
-      else {
-        //DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
-        DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
-      }
-      if (!aXdir) {
-        DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
-        //DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
-      }
-      else {
-        //DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
-        DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
-      }
-    }
-  }
-  g->Clip();
-}
-
-  
 
 void
@@ -529,236 +396,2 @@
 {
 }
-
-void
-PIDrawer::DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep)
-{
-  for (double x=xBeg; x<=xMax+xStep/10.; x += xStep)
-    g->DrawLine(x, g->DeltaUCY(y, -tickDown), x, g->DeltaUCY(y, tickUp));
-}
-
-void
-PIDrawer::DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep)
-{
-  for (double y=yBeg; y<=yMax; y += yStep)
-    g->DrawLine(g->DeltaUCX(x, -tickLeft), y, g->DeltaUCX(x,tickRight), y);
-}
-
-void
-PIDrawer::DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, unsigned long just)
-{
-  double fsz = xMajTickLen*3.5;
-  if(axesAFSz) g->SelFontSz(fsz);
-
-  // Choix du bon format pour les labels des axes;
-  char label[64]; string format; double fac=1.; bool p10=false;
-  int npuiss = BonFormatAxes(xBeg,xMax,xStep,format,2,1);
-  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
-  else BonFormatAxes(xBeg,xMax,xStep,format,0,1);
-
-  double xOffset = 0;
-  double xlastlabelfin = xBeg - 2.*(xMax-xBeg);
-  for(double x=xBeg; x<=xMax+xStep/10.; x+=xStep) {
-    //Attention erreur d'arrondi x->0 (on code 5.1698e-26 au lieu de 0)
-    double xx = (fabs(x/xStep)<1.e-5) ? 0.: x;
-    sprintf(label,format.c_str(),xx/fac);
-    for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
-    double largeur = g->CalcStringWidth(label);
-    if(aXdir) xOffset = largeur/2; else xOffset=-largeur/2;
-    if(x+xOffset > xlastlabelfin) {
-      g->DrawString(x,y,label,PI_HorizontalCenter|just);
-      xlastlabelfin = x + xOffset + 1.1*largeur;
-    }
-  }
-
-  if(p10) {
-    PIGrCoord asc,desc;
-    double h = g->GetFontHeight(asc,desc);
-    if((aYdir && (just&PI_VerticalBottom)) || (!aYdir && (just&PI_VerticalTop)) ) h = -h; 
-    double xm = (aXdir)? xMin: xMax;
-    double ym = g->DeltaUCY(y,1.5*h);
-    sprintf(label,"%d",npuiss);
-    g->DrawCompString(xm,ym,"x 10",label,NULL,PI_HorizontalCenter|just);
-  }
-
-}
-
-void
-PIDrawer::DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, unsigned long just)
-{
-  double fsz = xMajTickLen*3.5;
-  if(axesAFSz) g->SelFontSz(fsz);
-
-  // Choix du bon format pour les labels des axes;
-  char label[64]; string format; double fac=1.; bool p10=false;
-  int npuiss = BonFormatAxes(yBeg,yMax,yStep,format,2,1);
-  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
-  else BonFormatAxes(yBeg,yMax,yStep,format,0,1);
-
-  for(double y=yBeg; y<=yMax; y += yStep) {
-    double yy = (fabs(y/yStep)<1.e-5) ? 0.: y;
-    sprintf(label,format.c_str(),yy/fac);
-    for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
-    g->DrawString(x,y,label,PI_VerticalCenter|just);
-  }
-
-  if(p10) {
-    PIGrCoord asc,desc;
-    double h = g->GetFontHeight(asc,desc);
-    if(aYdir) h = -h; 
-    double ym = (aYdir)? yMin: yMax; ym = g->DeltaUCY(ym,h);
-    sprintf(label,"%d",npuiss);
-    g->DrawCompString(x,ym,"x 10",label,NULL,PI_VerticalBottom|just);
-  }
-
-}
-
-void
-PIDrawer::DrawGrid(PIGraphicUC* g)
-{
-  PILineAtt savlineatt = g->GetLineAtt();
-//  g->SelLine(PI_ThinDashedLine);
-  g->SelLine(PI_ThinDottedLine);
-
-  for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep)
-    g->DrawLine(x, yMin, x, yMax);
-
-  for (double y=yFirstMajTick; y<=yMax; y += yMajTickStep)
-    g->DrawLine(xMin, y, xMax, y);
-
-  g->SelLine(savlineatt);
-}
-
-///////////////////////////////////////////////////////////////////////////
-/* --Methode-Static-- */
-void PIDrawer::BestTicks(double xmin,double xmax,int nticks
-                        ,double& steptick,double& xfirsttick)
-// *** Calcul de l'intervalle entre les ticks et de la valeur du premier tick
-{
-double d=xmax-xmin; if(d<1.e-100) d=1.e-100; //if (d<1.e-39) d=1.e-39;
-double ld  = log10(d);
-double fld = floor( ((ld<0.)? -ld: ld) );
-double del,del0;
-if(ld>=0.) {fld-=1.; del0=del=pow(10.,fld);}
-  else     {fld+=2.; del0=del=pow(10.,-fld);}
-// *** Intervalle entre les ticks
-// xmin  xmax    d       ld       fld -->fld  del0
-// 1     1500    1499    3.17     3      2    10^2
-// 1     9500    9499    3.98     3      2    10^2
-// 1     1.005   0.005   -2.3     2      4    10^-4
-// 1     1.995   0.995   -0.0022  0      2    10^-2
-// - Et recherche de la valeur del={del0,2*del0,...,20*del0}
-// telle que "nticks*del" soit le plus petit nombre ">=d"
-// Par exemple, si nticks=10:
-// 1-/ pour le 2sd cas ou d=9499 et del0=100 :
-// del        =    100    200    500    1000    2000
-// nticks*del =   1000   2000   5000   10000   20000
-// d/del      =   94.9   47.4   18.9 | 9.499   4.749  ==> majt = 1000
-// 2-/ pour le 3ieme cas ou d=5e-3 et del0=1e-4 :
-// del        =  1e-4   2e-4   5e-4  1e-3   2e-3
-// nticks*del =  1e-3   2e-3   5e-3  1e-2   2e-2
-// d/del      =  50     25   | 10    5      2.5       ==> majt = 5e-4
-int k=0;
-double fac[4] = {2.,5.,10.,20.};
-while(d/del>(double)nticks && k<4 ) {del=fac[k]*del0; k++;}
-steptick=del;
-//***  Valeur du premier tick
-xfirsttick = floor(xmin/steptick); if(xmin<0.) xfirsttick+=1.;
-xfirsttick *= steptick;
-if(xfirsttick<xmin) xfirsttick += steptick;
-}
-
-/* --Methode-Static-- */
-int PIDrawer::BonFormatAxes(double xmin,double xmax,double xstep
-                           ,string& format,int typf,int add_digit)
-// *** Calcul format optimal pour ecrire les labels numeriques des axes:
-// ---- Input
-// . xmin,xmax : limites du plot sur l'axe considere.
-// . xstep : distance entre les ticks.
-// . add_digit : nombre de digits a ajouter au nombre de digits minimum.
-// . typf : type de format en sortie
-//        0 : format optimum %-nn.mme ou %-nn.mmf selon valeurs
-//        1 : format %-nn.mme
-//        2 : format %-nn.mmf pour imprimer x/10^npuiss
-//            tel que x/10^npuiss soit entre 0 et 10
-// ---- Output
-// . format : le format d'impression
-// ---- Return:
-// Si typ=0 ou 1 
-//   "ndig" : nombre de digits necessaires pour distinguer
-//            les valeurs xmin+k*dx (<=xmax)
-// Si typ=2
-//   "npuiss" : tel que x/10^npuiss soit entre 0 et 10
-//              Dans ce cas le format est celui qui imprime x/10^npuiss
-{
- format = "%-5g";  // format par default
- if(xmin>=xmax) {if(typf==2) return 0; else return -1;}
-
- if(xstep<=0. || xstep>xmax-xmin) xstep = xmax-xmin;
-
- double axmin=fabs(xmin), axmax=fabs(xmax);
- if(axmin>axmax) dble_SWAP(axmin,axmax)
-
- double l10amax = log10(axmax), l10xstep = log10(xstep);
- int il10amax = int(floor(l10amax));
-
- // choix du type de format
- char ftype = 'e';
- int npuiss = 0;
- if(typf==2) {
-   npuiss = il10amax;
-   if(npuiss<-300 || npuiss>300) {
-     ftype='e'; npuiss=0;
-   } else {
-     // On recalcule les valeurs de decision pour  axmax/10^npuiss, xstep/10^npuiss
-     l10amax -= (double)npuiss; l10xstep -=  (double)npuiss;
-     il10amax = int(floor(l10amax));
-     ftype = 'f';
-   }
- } else if(typf==1) {
-   ftype='e';
- } else {
-   ftype='e';
-   // On evite d'ecrire +a.bbbe+ccc -> format %f
-   // Ex: 1.2345e+2 -> 123.45   /  -1.2345e+2 -> -123.45
-   //     1.2345e-1 -> 0.12345  /  -1.2345e-1 -> -0.12345
-   if((axmin>=1e-4 || axmin==0.) && axmax<1e4) ftype='f';
- }
-
- //printf("BonFormatAxes[npuiss=%d]: xmin=%-21.14e xmax=%-21.14e\n",npuiss,xmin,xmax);
- //printf("        xstep=%-21.14e log10(xstep/10^%d)=%g\n",xstep,npuiss,l10xstep);
- //printf("        axmax=%-21.14e log10(axmax/10^%d)=%g diff=%g\n"
- //      ,axmax,npuiss,l10amax,l10amax-l10xstep);
-
- // Nombre de digits necessaires pour ecrire axmax et xstep
- int ndig = il10amax  -  int(floor(l10xstep));
- if(ndig<0) ndig *= -1;  ndig += 1;
- //printf("ndig=%d",ndig);
- 
- // Add more digits (or suppress digits)
- ndig += add_digit; if(ndig<0) ndig=0;
- //printf(" + %d  ==> ndig=%d\n",add_digit,ndig);
-
- // Calcul du bon format
- char str[16];
- if(ftype=='f') { // Calcul du format %-nn.mmf
-   int mm=-1, nn;
-   if(il10amax<0) { // +0.12345 +0.0012345 +0.0012345 ...
-     mm = ndig - il10amax - 1; nn = mm+3;
-   } else {         // +1.2345 +12.345 +123.45 ...
-     mm = ndig - il10amax - 1; nn = ndig+2;
-   }
-   //printf("format %%f : mm=%d  nn=%d\n",mm,nn);
-   if(mm<0.) mm=0; if(nn<mm+3) nn=mm+3;
-   sprintf(str,"%%-%d.%df",nn,mm);
- } else if(ftype=='e') { // Calcul du format %-nn.mme
-   //   +d.<--ddd-->e+123
-   //   1 2         34567  ==> nn=ndig+7   mm=ndig-1
-   sprintf(str,"%%-%d.%de",ndig+7,ndig-1);
- }
-
- format = str;
- //printf("format=[%s]\n",format.c_str());
-
- if(typf==2) return npuiss;
- return ndig;
-}
Index: trunk/SophyaPI/PI/pidrawer.h
===================================================================
--- trunk/SophyaPI/PI/pidrawer.h	(revision 2079)
+++ trunk/SophyaPI/PI/pidrawer.h	(revision 2080)
@@ -9,19 +9,5 @@
 #include "pigraphuc.h"
 #include "pigratt.h"
-
-
-enum {
-  kStdAxes     = 0x0001,
-  kBoxAxes     = 0x0002,
-  kTicks       = 0x0004,
-  kIntTicks    = 0x0010,
-  kExtTicks    = 0x0020,
-  kMajTicks    = 0x0040,
-  kMinTicks    = 0x0080,
-  kLabels      = 0x1000,
-  kGridOn      = 0x2000,
-  kAxesDflt    = kStdAxes | kTicks | kLabels,       // Axes trace par defaut
-  kAxesNone    = 0                                  // Pas de trace d axe  
-};
+#include "piaxes.h"
 
 
@@ -100,11 +86,4 @@
   inline string&     Name() { return mName; }
   inline void	     SetName(string const& name) { mName = name; } 
-//  --- Methode- static ----
-//  Calcul des Distances optimales des subdivisions 
-  static void BestTicks(double xmin,double xmax,int nticks
-                       ,double& steptick,double& xfirsttick);
-//  Calcul du format optimal pour les axes
-  static int BonFormatAxes(double xmin,double xmax,double xstep
-                          ,string& format,int typf=0,int add_digit=0);
 
 //  Les objets/methodes suivants devraient etre protected     
@@ -120,12 +99,4 @@
   virtual void       Detach(PIBaseWdgGen*, int id);
 
-  void CalcTicks();
-
-  void DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep);
-  void DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep);
-  void DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, unsigned long just=0);
-  void DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, unsigned long just=0);
-  void DrawGrid(PIGraphicUC* g);
-
 
   bool mFgDeleteOnDetach;         // si true -> delete drawer on detach
@@ -138,11 +109,4 @@
   int aXFlg, aYFlg;
 
-  double xFirstMajTick, xFirstMinTick;
-  double yFirstMajTick, yFirstMinTick;
-  double xMajTickStep, xMinTickStep;
-  double yMajTickStep, yMinTickStep;
-  double xMajTickLen,  xMinTickLen;
-  double yMajTickLen,  yMinTickLen;
-  
   int limitsFixed;
   unsigned int axesFlags;
Index: trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 2079)
+++ trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 2080)
@@ -9,4 +9,5 @@
 #include "piscdrawwdg.h"
 #include "pidrwtools.h"
+#include "piaxes.h"
 #include "piaxestools.h"
 
@@ -650,5 +651,5 @@
   double xm = (fabs(xmax)>fabs(xmin)) ? fabs(xmax): fabs(xmin);
   double dx = fabs(xmax-xmin)/500.;
-  PIDrawer::BonFormatAxes(xm,xm+dx,dx,format,0,1);
+  PIAxes::BonFormatAxes(xm,xm+dx,dx,format,0,1);
   return format;
 }
