Index: /branches/EA_Juin98/SophyaPI/PI/Makefile
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/Makefile	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/Makefile	(revision 108)
@@ -0,0 +1,264 @@
+MODULENAME := PI
+MODULECXXFLAGS := -msg_quiet
+include ../Mgr/Makefile.h
+ 
+all: $(LIB)libPI.a
+$(LIB)libPI.a : $(OBJ)lut.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picons.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawer.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pigraphgen.o $(OBJ)pigraphps.o $(OBJ)pigraphuc.o $(OBJ)pigraphx.o $(OBJ)pihisto.o $(OBJ)pihisto2d.o $(OBJ)piimage.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)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)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)
+	$(CXX) $? $(CPPFLAGS) $(CXXFLAGS) -L$(LIB) -lPI -lOutils++ -lImages++ -lStarReco++ -o $(OBJ)xx.x -Hf
+	$(AR) $(ARFLAGS)  $@ $(REPM)/*.o 
+endif 
+ 
+$(OBJ)lut.o: lut.cc $(EROSDEVREP)/Include/defs.h lut.h
+$(OBJ)piapplgen.o: piapplgen.cc piapplgen.h pimsghandler.h pisysdep.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \
+ pimenubargen.h pimenux.h pimenugen.h picons.h pistdwdgx.h \
+ pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h
+$(OBJ)piapplx.o: piapplx.cc piapplx.h piapplgen.h pimsghandler.h pisysdep.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimenubarx.h \
+ pimenubargen.h pimenux.h pimenugen.h picons.h pistdwdgx.h \
+ pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h
+$(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
+ pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
+ psfile.h $(EROSDEVREP)/Include/defs.h pidrawer.h pigraphuc.h \
+ pigraphps.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 \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h pixtbase.h
+$(OBJ)picmap.o: picmap.cc picmap.h pisysdep.h picmapx.h picmapgen.h
+$(OBJ)picmapgen.o: picmapgen.cc picmapgen.h pisysdep.h picmapx.h picmap.h
+$(OBJ)picmapx.o: picmapx.cc piwdgx.h piwdggen.h pimsghandler.h picmapx.h \
+ picmapgen.h pisysdep.h
+$(OBJ)picons.o: picons.cc pisysdep.h pimenux.h pimenugen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picons.h pistdwdgx.h pistdwdggen.h \
+ picontainerx.h picontainergen.h pibwdgx.h pibwdggen.h picmap.h \
+ picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphps.h
+$(OBJ)picontainergen.o: picontainergen.cc picontainergen.h pisysdep.h \
+ piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)picontainerx.o: picontainerx.cc picontainerx.h pisysdep.h \
+ picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)pidrawer.o: pidrawer.cc pidrawer.h pibwdggen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h \
+ pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h pigraphuc.h
+$(OBJ)pidrawwin.o: pidrawwin.cc pidrawwin.h pisysdep.h piwindowx.h \
+ piwindowgen.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \
+ pimsghandler.h piscdrawwdg.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
+ picmapgen.h pigraphx.h pigraphgen.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphps.h pistdwdgx.h pistdwdggen.h \
+ pidrawer.h pigraphuc.h
+$(OBJ)pifilechogen.o: pifilechogen.cc pifilechogen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h
+$(OBJ)pifilechox.o: pifilechox.cc pisysdep.h pifilechox.h pifilechogen.h \
+ piwdgx.h piwdggen.h pimsghandler.h piwindowx.h piwindowgen.h \
+ picontainerx.h picontainergen.h
+$(OBJ)pigraphgen.o: pigraphgen.cc pigraphgen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
+$(OBJ)pigraphps.o: pigraphps.cc pigraphps.h pisysdep.h pigraphgen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h
+$(OBJ)pigraphuc.o: pigraphuc.cc pigraphuc.h pisysdep.h pigraphgen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
+$(OBJ)pigraphx.o: pigraphx.cc pigraphx.h pisysdep.h pigraphgen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h
+$(OBJ)pihisto.o: pihisto.cc pihisto.h $(EROSDEVREP)/Include/histos.h \
+ $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \
+ $(EROSDEVREP)/Include/perrors.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h $(EROSDEVREP)/Include/fmath.h \
+ $(EROSDEVREP)/Include/cvector.h $(EROSDEVREP)/Include/matrix.h \
+ $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h piscdrawwdg.h pisysdep.h \
+ pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
+ picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
+ pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h pidrawer.h pigraphuc.h
+$(OBJ)pihisto2d.o: pihisto2d.cc pihisto2d.h pisysdep.h pimenux.h pimenugen.h \
+ piwdgx.h piwdggen.h pimsghandler.h pimenubarx.h pimenubargen.h \
+ pioptmenux.h pioptmenugen.h picontainerx.h picontainergen.h \
+ pistdwdgx.h pistdwdggen.h $(EROSDEVREP)/Include/histos2.h \
+ $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \
+ $(EROSDEVREP)/Include/perrors.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h $(EROSDEVREP)/Include/fmath.h \
+ $(EROSDEVREP)/Include/histos.h $(EROSDEVREP)/Include/cvector.h \
+ $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h piscdrawwdg.h pibwdgx.h \
+ pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
+ psfile.h pigraphps.h piwindowx.h piwindowgen.h pidrawer.h pigraphuc.h \
+ $(EROSDEVREP)/Include/nbrandom.h
+$(OBJ)piimage.o: piimage.cc piimage.h $(EROSDEVREP)/Include/cimage.h \
+ $(EROSDEVREP)/Include/rzimage.h $(EROSDEVREP)/Include/rzvect.h \
+ $(EROSDEVREP)/Include/machine.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h \
+ $(EROSDEVREP)/Include/perrors.h \
+ $(EROSDEVREP)/Include/imaginit.h \
+ $(EROSDEVREP)/Include/datatypes.h \
+ $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h \
+ $(EROSDEVREP)/Include/dvlist.h lut.h pisysdep.h pipixmapx.h \
+ pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h \
+ pimsghandler.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
+ psfile.h pigraphps.h pistdwdgx.h pistdwdggen.h piwindowx.h \
+ piwindowgen.h picontainerx.h picontainergen.h \
+ $(EROSDEVREP)/Include/imageop.h \
+ $(EROSDEVREP)/Include/fitsimage.h \
+ $(EROSDEVREP)/Include/fitsheader.h \
+ $(EROSDEVREP)/Include/erosio.h $(EROSDEVREP)/Include/fitskeys.h \
+ $(EROSDEVREP)/Include/erostape.h \
+ $(EROSDEVREP)/Include/strutil.h \
+ $(EROSDEVREP)/Include/ptrarray.h \
+ $(EROSDEVREP)/Include/voidptrarray.h \
+ $(EROSDEVREP)/Include/basearray.h $(EROSDEVREP)/Include/peida.h \
+ $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/fmath.h \
+ $(EROSDEVREP)/Include/array.h $(EROSDEVREP)/Include/lockfile.h \
+ $(EROSDEVREP)/Include/erostarfile.h \
+ $(EROSDEVREP)/Include/xstrstream.h \
+ $(EROSDEVREP)/Include/dates.h $(EROSDEVREP)/Include/tarlib.h
+$(OBJ)piinit.o: piinit.cc $(EROSDEVREP)/Include/defs.h piinit.h \
+ $(EROSDEVREP)/Include/strecinit.h \
+ $(EROSDEVREP)/Include/imaginit.h \
+ $(EROSDEVREP)/Include/peidainit.h
+$(OBJ)pilistgen.o: pilistgen.cc pilistgen.h pisysdep.h piwdgx.h piwdggen.h \
+ pimsghandler.h
+$(OBJ)pilistx.o: pilistx.cc pilistx.h pilistgen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h picontainerx.h picontainergen.h
+$(OBJ)pimenubargen.o: pimenubargen.cc pimenubargen.h pisysdep.h pimenux.h \
+ pimenugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h piapplgen.h \
+ picontainerx.h picontainergen.h pimenubarx.h picons.h pistdwdgx.h \
+ pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h
+$(OBJ)pimenubarx.o: pimenubarx.cc pimenubarx.h pimenubargen.h pisysdep.h \
+ pimenux.h pimenugen.h piwdgx.h piwdggen.h pimsghandler.h piapplx.h \
+ piapplgen.h picontainerx.h picontainergen.h picons.h pistdwdgx.h \
+ pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h
+$(OBJ)pimenugen.o: pimenugen.cc pimenugen.h pisysdep.h piwdgx.h piwdggen.h \
+ pimsghandler.h
+$(OBJ)pimenux.o: pimenux.cc pimenux.h pimenugen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h
+$(OBJ)pimsghandler.o: pimsghandler.cc pimsghandler.h
+$(OBJ)pintuple.o: pintuple.cc pintuple.h $(EROSDEVREP)/Include/ntuple.h \
+ $(EROSDEVREP)/Include/ppersist.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/machine.h $(EROSDEVREP)/Include/perrors.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h \
+ $(EROSDEVREP)/Include/pclassids.h piscdrawwdg.h pisysdep.h \
+ pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
+ picmapx.h picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h \
+ pistdwdgx.h pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h pidrawer.h pigraphuc.h
+$(OBJ)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
+ pimenux.h pimenugen.h
+$(OBJ)pioptmenux.o: pioptmenux.cc pisysdep.h pioptmenux.h pioptmenugen.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
+ pimenux.h pimenugen.h pistdwdgx.h pistdwdggen.h
+$(OBJ)piperiodx.o: piperiodx.cc piwdgx.h piwdggen.h pimsghandler.h \
+ piperiodx.h $(EROSDEVREP)/Include/periodic.h \
+ $(EROSDEVREP)/Include/defs.h
+$(OBJ)pipixmapgen.o: pipixmapgen.cc pipixmapgen.h pisysdep.h pibwdgx.h \
+ pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
+ picmapgen.h pigraphx.h pigraphgen.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphps.h
+$(OBJ)pipixmapx.o: pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \
+ pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
+ picmapx.h picmapgen.h pigraphx.h pigraphgen.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 \
+ $(EROSDEVREP)/Include/peidainit.h \
+ $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/peida.h \
+ $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \
+ $(EROSDEVREP)/Include/perrors.h $(EROSDEVREP)/Include/fmath.h \
+ $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h \
+ $(EROSDEVREP)/Include/cvector.h piscdrawwdg.h pisysdep.h pibwdgx.h \
+ pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
+ picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h pistdwdgx.h \
+ pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h pidrawer.h pigraphuc.h
+$(OBJ)pistdwdggen.o: pistdwdggen.cc pistdwdggen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h
+$(OBJ)pistdwdgx.o: pistdwdgx.cc pisysdep.h pistdwdgx.h pistdwdggen.h \
+ piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)pistlist.o: pistlist.cc pistlist.h $(EROSDEVREP)/Include/stlist.h \
+ $(EROSDEVREP)/Include/machine.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h \
+ $(EROSDEVREP)/Include/perrors.h $(EROSDEVREP)/Include/dynccd.h \
+ $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h \
+ $(EROSDEVREP)/Include/imaginit.h $(EROSDEVREP)/Include/star.h \
+ $(EROSDEVREP)/Include/strecinit.h \
+ $(EROSDEVREP)/Include/starmacro.h $(EROSDEVREP)/Include/psf.h \
+ $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/utils.h \
+ $(EROSDEVREP)/Include/fmath.h $(EROSDEVREP)/Include/cimage.h \
+ $(EROSDEVREP)/Include/rzimage.h $(EROSDEVREP)/Include/rzvect.h \
+ $(EROSDEVREP)/Include/datatypes.h \
+ $(EROSDEVREP)/Include/dvlist.h $(EROSDEVREP)/Include/fct1dfit.h \
+ $(EROSDEVREP)/Include/generalfit.h \
+ $(EROSDEVREP)/Include/matrix.h $(EROSDEVREP)/Include/cvector.h \
+ $(EROSDEVREP)/Include/fct2dfit.h \
+ $(EROSDEVREP)/Include/pixelmap.h \
+ $(EROSDEVREP)/Include/transfo.h $(EROSDEVREP)/Include/poly.h \
+ $(EROSDEVREP)/Include/zfidu.h piscdrawwdg.h pisysdep.h pibwdgx.h \
+ pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
+ picmapgen.h pigraphx.h pigraphgen.h psfile.h pigraphps.h pistdwdgx.h \
+ pistdwdggen.h piwindowx.h piwindowgen.h picontainerx.h \
+ picontainergen.h pidrawer.h pigraphuc.h
+$(OBJ)piup.o: piup.cc $(EROSDEVREP)/Include/ctimer.h \
+ $(EROSDEVREP)/Include/peida.h $(EROSDEVREP)/Include/defs.h \
+ $(EROSDEVREP)/Include/utils.h $(EROSDEVREP)/Include/machine.h \
+ $(EROSDEVREP)/Include/perrors.h \
+ $(EROSDEVREP)/Include/exceptions.h \
+ $(EROSDEVREP)/Include/peidainit.h $(EROSDEVREP)/Include/fmath.h \
+ $(EROSDEVREP)/Include/imageop.h $(EROSDEVREP)/Include/cimage.h \
+ $(EROSDEVREP)/Include/rzimage.h $(EROSDEVREP)/Include/rzvect.h \
+ $(EROSDEVREP)/Include/imaginit.h \
+ $(EROSDEVREP)/Include/datatypes.h \
+ $(EROSDEVREP)/Include/ppersist.h \
+ $(EROSDEVREP)/Include/pclassids.h \
+ $(EROSDEVREP)/Include/dvlist.h \
+ $(EROSDEVREP)/Include/fitsimage.h \
+ $(EROSDEVREP)/Include/fitsheader.h \
+ $(EROSDEVREP)/Include/erosio.h $(EROSDEVREP)/Include/fitskeys.h \
+ $(EROSDEVREP)/Include/erostape.h \
+ $(EROSDEVREP)/Include/strutil.h \
+ $(EROSDEVREP)/Include/ptrarray.h \
+ $(EROSDEVREP)/Include/voidptrarray.h \
+ $(EROSDEVREP)/Include/basearray.h $(EROSDEVREP)/Include/array.h \
+ $(EROSDEVREP)/Include/lockfile.h \
+ $(EROSDEVREP)/Include/erostarfile.h \
+ $(EROSDEVREP)/Include/xstrstream.h \
+ $(EROSDEVREP)/Include/dates.h $(EROSDEVREP)/Include/tarlib.h \
+ piup.h
+$(OBJ)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \
+ pisysdep.h piwdgx.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphgen.h picmap.h picmapx.h picmapgen.h
+$(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \
+ pisysdep.h picontainergen.h
+$(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \
+ picontainergen.h piwdgx.h piwdggen.h pimsghandler.h psfile.h \
+ $(EROSDEVREP)/Include/defs.h pigraphgen.h picmap.h picmapx.h \
+ picmapgen.h
+$(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
+ piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h \
+ pigraphx.h pigraphgen.h psfile.h $(EROSDEVREP)/Include/defs.h \
+ pigraphps.h pixtbase.h
+$(OBJ)psfile.o: psfile.cc psfile.h $(EROSDEVREP)/Include/defs.h \
+ pisysdep.h pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
+ picmapx.h picmapgen.h
Index: /branches/EA_Juin98/SophyaPI/PI/ex_dessin.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/ex_dessin.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/ex_dessin.cc	(revision 108)
@@ -0,0 +1,166 @@
+#include <stdio.h>
+#include <string.h>
+
+#include "ex_dessin.h"
+
+
+
+/* --Methode-- */
+ExBWdg::ExBWdg(PIContainerGen *par, char *nom,
+                       int sx, int sy, int px, int py) 
+: PIBaseWdg(par, nom, sx, sy, px, py)
+
+{
+mmrk = mfnt = nc = 0;
+strcpy(str, "Bonjour");
+for(int i=strlen(str); i<20; i++) str[i] = ' ';
+str[20] = '\0';
+
+ActivateKeyboard();
+ActivateButton(1);
+ActivateButton(2);
+ActivateButton(3);
+}
+
+
+/* --Methode-- */
+ExBWdg::~ExBWdg()
+{
+}
+
+ 
+
+
+/* --Methode-- */
+void ExBWdg::Resize()
+{
+
+}
+
+
+/* --Methode-- */
+void ExBWdg::Draw(PIGraphicGen* g)
+{
+EraseWindow();
+g->SelLine(PI_NormalLine);
+g->DrawBox(10,10, XSize()-20, YSize()-20);
+
+g->SelLine(PI_ThinLine);
+g->DrawFBox(20, 20, 20, 20);
+g->DrawCircle(30, 30, 15);
+
+g->SelForeground(PI_Red);
+g->DrawFCircle(70, 30, 15);
+
+g->SelForeground(PI_Yellow);
+g->DrawFBox(10, 60, 100, 15);
+
+g->SelForeground(PI_Black);
+g->DrawString(20, 90, str);
+
+g->SelLine(PI_ThinLine);
+g->DrawLine(10, 120, 40, 120);
+g->SelLine(PI_NormalLine);
+g->DrawLine(40, 120, 70, 120);
+g->SelLine(PI_ThickLine);
+g->DrawLine(70, 120, 100, 120);
+
+g->SelForeground(PI_Magenta);
+g->DrawFCircle(120, 30, 15);
+g->SelForeground(PI_Grey);
+g->DrawFCircle(120, 60, 15);
+
+PIGrCoord x[5] = { 20, 35, 50, 65, 80 };
+PIGrCoord y[5] = { 130, 130, 130, 130, 130 };
+
+g->SelForeground(PI_Black);
+g->DrawMarkers(x, y, 5);
+return;
+}
+
+
+
+
+/* --Methode-- */
+void ExBWdg::But1Press(int x, int y)
+{
+SelPointerShape(PI_CrossPointer);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But1Release(int x, int y)
+{
+SelPointerShape(PI_ArrowPointer);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But2Press(int x, int y)
+{
+PIFontAtt att[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont};
+PIMarker  pmk[9] = { PI_DotMarker , PI_PlusMarker, PI_CrossMarker,  
+                 PI_CircleMarker, PI_FCircleMarker,
+                 PI_BoxMarker, PI_FBoxMarker,
+                 PI_TriangleMarker, PI_FTriangleMarker };
+
+if (++mfnt > 2)  mfnt = 0;
+if (++mmrk > 8)  mmrk = 0; 
+mWGrC->SelFont(PI_NormalSizeFont, att[mfnt]);
+mWGrC->SelMarker(8, pmk[mmrk]);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But2Release(int x, int y)
+{
+Refresh();
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But3Press(int x, int y)
+{
+SelPointerShape(PI_HandPointer);
+mWGrC->SelForeground(PI_Blue);
+mWGrC->DrawFBox(0, 0, 8, 8);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But3Release(int x, int y)
+{
+mWGrC->SelForeground(PI_White);
+mWGrC->DrawFBox(0, 0, 8, 8);
+mWGrC->SelForeground(PI_Black);
+SelPointerShape(PI_ArrowPointer);
+return;
+}
+
+
+
+/* --Methode-- */
+void ExBWdg::Keyboard(int key, PIKeyModifier kmod)
+{
+char buf[4];
+str[nc] = key;
+if (++nc > 15)  nc = 0;
+buf[0] = key;  buf[1] = '\0';
+
+printf("ExBWdg::Keyboard: Key= %d (%c) , Mod= %d \n", key, (char)key, (int)kmod);
+mWGrC->SelFont(PI_BigSizeFont, PI_BoldFont);
+mWGrC->DrawString(20, 75, buf);
+
+if ( (kmod == PIKM_Alt) && (key == 'c') ) {
+  printf("ExBWdg::Keyboard: Test-Copy ... \n"); 
+  ClaimSelection();
+}
+if ( (kmod == PIKM_Alt) && (key == 'v') ) {
+  printf("ExBWdg::Keyboard: Test-Paste ... \n"); 
+  RequestSelection();
+}
+
+return;
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/ex_dessin.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/ex_dessin.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/ex_dessin.h	(revision 108)
@@ -0,0 +1,41 @@
+/*  Exemple d'utilisation PIBaseWdg   */
+
+#ifndef EXBWDG_H_SEEN
+#define EXBWDG_H_SEEN
+
+#include "pisysdep.h"
+
+#include PIBWDG_H
+
+class ExBWdg : public PIBaseWdg
+{
+
+public:
+// Les methodes ...
+
+                  ExBWdg(PIContainerGen *par, char *nom,
+                         int sx=10, int sy=10, int px=0, int py=0);
+  virtual         ~ExBWdg();
+
+
+// Traitement des evenements   
+
+  virtual void   Resize();
+  virtual void   Draw(PIGraphicGen* g);
+
+  virtual void   But1Press(int x, int y);
+  virtual void   But1Release(int x, int y);
+  virtual void   But2Press(int x, int y);
+  virtual void   But2Release(int x, int y);
+  virtual void   But3Press(int x, int y);
+  virtual void   But3Release(int x, int y);
+  virtual void   Keyboard(int key, PIKeyModifier kmod);
+
+protected:
+  int mfnt, mmrk;
+  int nc;
+  char str[21];
+};
+
+
+#endif 
Index: /branches/EA_Juin98/SophyaPI/PI/exapp_1.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/exapp_1.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/exapp_1.cc	(revision 108)
@@ -0,0 +1,313 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctimer.h"
+#include "strecinit.h"
+
+#include "pidrawwin.h"
+#include "pihisto.h"
+#include "psfile.h"
+
+#include "exapp_1.h"
+
+static int nbhis = 0;
+static void mypact(void *);
+
+/* --Methode-- */
+PITApp::PITApp(int narg, char* arg[])
+: PIApplication(230, 100, narg, arg), mPeriod(1)   // Periode de 1 seconde pour le "timer"
+{
+
+//  Menus, les numeros ds AppendItem sont les numeros de messages
+//  qui seront passes a Process() et permettent d'identifier l'action
+
+//  Creation du premier menu  
+//  Update :
+//  Mis a jour du Label se trouvant ds la fenetre principal avec l'heure
+//  Start, Stop :
+//  Demarrage et Arret d'une fonction Timer (PIPeriodic) pour 
+//  la mise a jour periodique de ce champ
+//  Exit : 
+//  Arret et sortie du programme
+
+m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"Fichier");
+m[0]->AppendItem("Update", 10101);
+m[0]->AppendItem("Start", 10102);
+m[0]->AppendItem("Stop", 10103);
+m[0]->AppendItem("Exit", 10105);
+// On accroche le menu au Menubar
+AppendMenu(m[0]);
+
+// 2eme Menu
+// Histo :  Creation, affichage d'un histo
+// Args : Affichage d'une fenetre de dialogue avec champs texte
+// Fermeture fenetre histo + suppression d'histo
+
+m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Actions");
+m[1]->AppendItem("Histo", 10201);
+m[1]->AppendItem("Args", 10202);
+m[1]->AppendItem("Close", 10203);
+m[1]->AppendItem("PS", 10205);
+// On accroche le menu au Menubar
+AppendMenu(m[1]);
+
+// Creation de deux labels - Un pour l'heure, l'autre pour X-Y 
+// de la fenetre histo
+lab[0] = new PILabel(this->MainWin(), "time", 210, 30, 10, 10);
+lab[1] = new PILabel(this->MainWin(), "info", 210, 30, 10, 50);
+mPeriod.SetAction(mypact);
+
+// Fenetre de dialogue
+mAW = new ArgsWind(this);
+
+mCurW = NULL;    // Fenetre courante
+SetReady();
+}
+
+/* --Methode-- */
+PITApp::~PITApp()
+{
+int i;
+for(i=0; i<2; i++)  { delete lab[i]; delete m[i]; }
+delete mAW;
+}  
+
+/* --Methode-- */
+void PITApp::Process(PIMessage msg, PIMsgHandler* sender, void* /*data*/)
+{
+
+char strg[64];
+
+// Gestion fenetre courante
+if (ModMsg(msg) == PIMsg_Active)
+  {
+  PIWdg *sndw;
+  sndw = (PIWdg *)sender;      
+  if (sndw->kind() ==  PIWindow::ClassId)   mCurW = (PIWindow *)sender;
+  }
+
+else
+  {
+  switch(UserMsg(msg))
+    {
+
+// --------- 1er menu ----------
+    case 10101:     // On met a l'heure
+      mypact(NULL);    
+      break;
+
+    case 10102:
+      mPeriod.Start();   // On demarre la montre 
+      break;
+
+    case 10103:
+      mPeriod.Stop();    // On demarre la montre 
+      break;
+
+    case 10105:          // Sortie d'application
+      Stop();
+      break;
+
+// ----------  2eme menu --------
+
+    case 10201 :        //  Creation, Affichage d'histo
+      PIDrawWindow *  draw;
+      PIHisto *pih;
+      Histo *h;
+      float x;
+
+      SetBusy();    // souris -> montre 
+      // Creation et remplissage d'histo 
+      h = new Histo(0., 200., 100);  
+      for(int i=0; i<100; i++)  
+        { x = (2*i+1.);  h->Add(x, x*(200.-x)); }
+
+      nbhis++;  sprintf(strg, "Histo %d", nbhis);
+      // Creation d'une fenetre de trace 
+      draw = new PIDrawWindow(this, strg, PIWK_normal, 200, 200, 300, 300);
+      // Creation d'un traceur d'histo
+      pih = new PIHisto(h);   
+
+      pih->SetAutoDelHisto(true);   // Histo delete quand window -> close
+      // Accrochage du traceur d'histo a la fenetre de Draw
+      draw->AddDrawer(pih);   
+      // Designation du champ label pour affichage coordonnees quand click souris
+      draw->DrawWdg()->SetTextWin(lab[1]);
+      draw->SetAutoDelChilds(true);  
+      // On affiche  la fenetre 
+      draw->Show();    
+
+      SetReady();    //  souris->pointeur , on n'est plus occupe
+      break;
+
+    case 10202 :     // Apparition de la fenetre de dialogue
+      mAW->Show();
+      break;
+
+    case 10203 :     // Suppression de la fenetre courante
+      if (mCurW)  { mCurW->Hide();  delete mCurW;}
+      lab[1]->SetLabel("");
+      mCurW = NULL;
+      break;
+
+
+    case 10205 :      // Creation fichier PostScript 
+      if(mCurW) {
+        PSFile *mps;
+        printf("Open PSFile (exapp_1.ps) \n");
+	mps = new PSFile("exapp_1.ps",14,10,
+			 mCurW->XSize(),mCurW->YSize());
+	// Contenu fenetre courante ds .ps 
+	mCurW->PSPrint(mps,0,0);
+	delete mps;
+      }
+      break;
+
+    default :
+      printf("PITApp::Process() Msg= %d (%d - %d)??? \n", 
+            (int)msg, (int)UserMsg(msg),(int)ModMsg(msg));
+     break;
+    }
+  }
+return;
+}
+
+/* ........................................................... */
+/*       Classe ArgsWindow  (Appel UserProc Function)      */
+/* ........................................................... */
+
+
+/* --Methode-- */
+ArgsWind::ArgsWind(PIApplication *par)
+: PIWindow((PIMsgHandler *)par, "Args", PIWK_dialog, 260, 200, 150, 150)
+{
+pap = par;
+
+// Creation de champs "labels"
+mLab[0] = new PILabel(this, "FMin Max:", 100, 35, 20, 10); 
+mLab[1] = new PILabel(this, "XMin Max:", 100, 35, 20, 55);
+mLab[2] = new PILabel(this, "YMin Max:", 100, 35, 20, 100);
+
+// Creation de champs textes 
+mText[0] = new PIText(this, "UsArg1", 130, 35, 120, 10);
+mText[0]->SetText("1. -1.");
+mText[1] = new PIText(this, "UsArg2", 130, 35, 120, 55);
+mText[1]->SetText("1. -1.");
+mText[2] = new PIText(this, "UsArg3", 130, 35, 120, 100);
+mText[2]->SetText("1. -1.");
+
+// Creation de bouton d'action 
+//  Attention : Numero de message pour Process()
+mBut[0] = new PIButton(this, "OK", 555, 70, 30, 30, 160);
+mBut[1] = new PIButton(this, "Cancel", 777, 70, 30, 160, 160);
+FinishCreate();
+
+}
+
+/* --Methode-- */
+ArgsWind::~ArgsWind()
+{
+for(int i=0; i<3; i++)
+  {
+  delete mLab[i];
+  delete mText[i];
+  }
+
+delete mBut[0]; 
+delete mBut[1]; 
+}
+
+/* --Methode-- */
+void ArgsWind::SetLabels(char *lab1, char *lab2, char *lab3)
+// Permet de changer les etiquettes (les label)
+{
+mLab[0]->SetLabel(lab1);
+mLab[1]->SetLabel(lab2);
+mLab[2]->SetLabel(lab3);
+}
+
+/* --Methode-- */
+void ArgsWind::SetTexts(char *tx1, char *tx2, char *tx3)
+// Permet de changer les contenu des champs texte
+{
+mText[0]->SetText(tx1);
+mText[1]->SetText(tx2);
+mText[2]->SetText(tx3);
+
+}
+
+/* --Methode-- */
+void ArgsWind::GetTexts(char *tx1, char *tx2, char *tx3)
+// Permet de recuperer les contenus des champs texte
+// ATTENTION : Il faut qu'il y ait assez de place 
+// ds tx1, tx2, tx3 pour que la fonction puisse y copier 
+// les chaines
+{
+strcpy(tx1, mText[0]->GetText().c_str());
+strcpy(tx2, mText[1]->GetText().c_str());
+strcpy(tx3, mText[2]->GetText().c_str());
+
+}
+
+/* --Methode-- */
+void ArgsWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
+{
+float xmin, xmax, ymin, ymax;
+float fmin, fmax;
+
+switch (UserMsg(msg))
+  {
+  case 777:   // Bouton cancel - On s'en va 
+    this->Hide();
+    pap->SetReady();
+    break;
+
+  case 555:    // Bouton OK
+// On recupere les textes des 3 champs :
+    for(int i=0; i<3; i++)  
+      printf("ArgsWind::Process() Txt[%d] = %s \n", i, mText[i]->GetText().c_str());
+    sscanf(mText[0]->GetText().c_str(),"%g %g", &fmin, &fmax);
+    sscanf(mText[1]->GetText().c_str(),"%g %g", &xmin, &xmax);
+    sscanf(mText[2]->GetText().c_str(),"%g %g", &ymin, &ymax);
+    
+    printf("... FMin/Max= %g %g  XMin/Max= %g %g YMin/Max= %g %g\n",
+           fmin, fmax, xmin, xmax, ymin, ymax); 
+    this->Hide();
+    pap->SetReady();
+    break;    
+  }
+    
+return;
+}
+
+static PITApp * app;
+
+/* Nouvelle-Fonction */
+void mypact(void *)
+// Fonction pour lire l'heure de la machine et mettre a jour le champ label
+{
+int tm;
+char *s;
+time(&tm);
+s = ctime(&tm);
+// printf("mypact_Info:  %d  (%s)", tm, s);
+app->lab[0]->SetLabel((string)s);
+return;
+}
+
+int main(int narg, char *arg[])
+{
+
+// Initialisation de tout PEIDA (avec StarReco++)
+PeidaStarRecoInitiator InitStar;
+
+app = new PITApp(narg, arg);
+puts("appel de Application.Run() ... ");
+app->Run();
+
+delete app;
+exit(0);
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/exapp_1.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/exapp_1.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/exapp_1.h	(revision 108)
@@ -0,0 +1,43 @@
+#include <string.h>
+
+#include "pisysdep.h"
+
+#include PIAPP_H
+#include PIMENU_H 
+#include PISTDWDG_H 
+#include PIWIN_H
+#include "piperiodx.h"  // PIPERIODIC_H
+
+class ArgsWind;
+
+class PITApp : public PIApplication {
+public:
+     PITApp(int narg=0, char* arg[]=NULL);
+     ~PITApp();
+     virtual void   Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+// protected :
+     
+  PIPDMenu * m[2];
+  PILabel *lab[2];
+  PIPeriodX mPeriod;
+  PIWindow *mCurW;
+  ArgsWind *mAW;
+};
+
+
+class ArgsWind : public PIWindow {
+public :
+                ArgsWind(PIApplication *par);
+                ~ArgsWind();
+          void  SetLabels(char *lab1, char *lab2, char *lab3);
+          void  SetTexts(char *tx1, char *tx2, char *tx3);
+          void  GetTexts(char *tx1, char *tx2, char *tx3);
+  virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+private:
+  PIApplication * pap;
+  PILabel  * mLab[3];
+  PIButton * mBut[2];
+  PIText * mText[3];
+  };
Index: /branches/EA_Juin98/SophyaPI/PI/exclude
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/exclude	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/exclude	(revision 108)
@@ -0,0 +1,29 @@
+piapplmac.cc
+pibwdgmac.cc
+picmapmac.cc
+picontainermac.cc
+pifilechomac.cc
+pigraphmac.cc
+pilistmac.cc
+pimenubarmac.cc
+pimenumac.cc
+pioptmenumac.cc
+pipixmapmac.cc
+pippapplmac.cc
+pippwindowmac.cc
+pistdwdgmac.cc
+piwdgmac.cc
+piwindowmac.cc
+pippapplmac.cc
+pipplist.cc
+pippmenubar.cc
+pippoptmenu.cc
+pippviewadapter.cc
+pippwindowmac.cc
+piupdattachment.cc
+pierrdisp.cc
+ex_dessin.cc
+sc_sample.cc
+exapp_1.cc
+pitestapp.cc
+piup_def.cc
Index: /branches/EA_Juin98/SophyaPI/PI/lut.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/lut.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/lut.cc	(revision 108)
@@ -0,0 +1,106 @@
+// Classe Look-Up-Table  pour convertir image en entree ds
+// une table de couleur.
+//       Classe LUT              R. Ansari  05/95
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "defs.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "lut.h"
+
+
+/* --Methode-- */
+
+LUT::LUT(float min, float max, unsigned short ncol, int typ, int ntable) 
+{
+int nlev;
+
+bornes=NULL;  
+nlev = ncol-2;
+if (nlev < 1)  nlev = 1;
+bornes = new float[nlev+1];
+
+if (bornes == NULL)  return;
+type = typ;  nLevel = nlev;
+SetLut(min, max, typ);
+table = NULL;  
+ComputeTable(ntable);
+return;
+}
+
+/* --Methode-- */
+LUT::~LUT()
+{
+if (type<0)  return;
+delete[] bornes;
+delete[] table;
+}
+
+/* --Methode-- */
+void LUT::SetLut(float min, float max, int typ)
+{
+
+if ( (typ != kLutType_Lin) && (typ != kLutType_Log) )  typ = kLutType_Lin;
+type = typ;
+if (max <= min)  max = min+1.;
+if (nLevel > 0)
+  {
+  int i;
+  float dx;
+  double dlx;
+  switch (typ)
+    {
+    case kLutType_Lin :
+      dx = (max-min)/(float)nLevel;
+      for(i=0; i<nLevel; i++)
+        bornes[i] = min+(float)i*dx;
+      break;
+    case kLutType_Log :
+      dlx = log(max-min) / (float)nLevel;
+      for(i=0; i<nLevel; i++)
+        bornes[i] = min+(float)exp((double)i*dlx);
+      break;
+    default:
+      for(i=0; i<nLevel; i++)
+        bornes[i] = min;
+      break;
+    }
+  bornes[nLevel] = max; 
+  }
+else  bornes[0] = 0.5*(min+max);
+return; 
+}
+
+/* --Methode-- */
+void LUT::Print()
+{
+int i;
+
+printf("LUT_Info: Type= %d NLevel= %d Min,Max= %g %g \n",
+       type, nLevel, bornes[0], bornes[nLevel]);
+for(i=0; i<=nLevel; i++)
+  printf("..Bornes[%d] = %g \n", i, bornes[i]);
+return;
+}
+
+/* --Methode-- */
+unsigned short LUT::Apply(float x)
+{
+int i;
+for(i=0;i<=nLevel;i++)  
+  if (x < bornes[i])  return(i);
+return(nLevel+1);
+}
+
+/* --Methode-- */
+void LUT::ComputeTable(int nt)
+{
+if (nt < 0) nt = 16*(nLevel+2);
+else if (nt < (nLevel+2))  nt = (nLevel+2);
+table = new unsigned short [nt-2];
+tablebinwidth = (Max()-Min())/(nt-2);
+float x = Min()+0.5*tablebinwidth;
+for(int i=0; i<nt-2; i++)  { table[i] = Apply(x); x += tablebinwidth; }
+}
Index: /branches/EA_Juin98/SophyaPI/PI/lut.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/lut.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/lut.h	(revision 108)
@@ -0,0 +1,54 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Classe Look-Up-Table  pour convertir image en entree ds
+// une table de couleur.
+//       Classe LUT              R. Ansari  05/95
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#ifndef LUT_SEEN
+#define LUT_SEEN
+
+// LUT : Look-Up-Table avec nLevel bins entre min et max
+// Apply retourne * 0 < min   * nLevel+1 > max 
+// et de 1 a nLevel pour min<=x<max
+
+// Type de lut possibles (Seul Lineaire implemente 05/95
+enum {kLutType_Lin=1, kLutType_Log=2};
+
+class LUT 
+{
+public:
+  
+  LUT(float min, float max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable=-1);
+  ~LUT();
+  void SetLut(float min, float max, int typ=0);
+  void Print();
+  unsigned short Apply(float x);
+  inline unsigned short ApplyFast(float x)
+    { 
+    if (x < Min())  return(0);
+    if (x >= Max() )  return(nLevel+1);  
+    int k = (x-Min())/tablebinwidth;
+    return(table[k]); 
+    } 
+
+  inline float Min() { return(bornes[0]); };
+  inline float Max() { return(bornes[nLevel]); };
+  inline int Type() { return(type); };
+  inline int NCol() { return(nLevel+2); };
+
+protected:
+  void ComputeTable(int nt);
+
+  int type;
+  int nLevel;
+  float * bornes;
+  unsigned short * table;
+  float tablebinwidth;
+
+};
+
+#endif
+
+
+
+  
Index: /branches/EA_Juin98/SophyaPI/PI/parradapter.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/parradapter.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/parradapter.cc	(revision 108)
@@ -0,0 +1,335 @@
+//     Classes ArrayAdapter           R. Ansari  05/98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "ctimer.h"
+#include "parradapter.h"
+
+/* --Methode-- */
+P2DArrayAdapter::P2DArrayAdapter(int sx, int sy)
+{
+sX = sx; sY = sy; 
+sgnX = sgnY = 1;
+offX = offY = 0;
+invX = invY = eXY = false;
+}
+
+/* --Methode-- */
+P2DArrayAdapter::~P2DArrayAdapter()
+{
+}
+
+/* --Methode-- */
+void P2DArrayAdapter::ConfigureAxes(bool invx, bool invy, bool exy, int sx, int sy)
+{
+invX = invx;  invY = invy;  eXY = exy; 
+if ( (sx > 0) && (sy > 0) )   { sX = sx; sY = sy; }
+if (invX) { sgnX = -1;  offX = sX; } 
+else { sgnX = 1; offX = 0; }
+if (invY) { sgnY = -1;  offY = sY; } 
+else { sgnY = 1; offY = 0; }
+}
+
+/* --Methode-- */
+void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)
+{
+x = ix+0.5;
+y = iy+0.5; 
+}
+
+/* --Methode-- */
+int P2DArrayAdapter::CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)
+{
+TIMEF ; 
+double m = 0.;
+double s = 0.;
+double dv; 
+
+int n9 = 0;
+int n0 = 0;
+
+if (min >= max) { min = -9.e19; max = 9.e19; }
+float minpix = max;
+float maxpix = min; 
+float pixv;
+printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max);
+
+int n = 0;
+if (vit < 1) vit = 1;
+if (sX*sY/vit < 1000) {
+  vit = sX*sY/1000;
+  if (vit < 1) vit = 1;
+}
+
+printf(" -> vit=%d \n", vit);
+for(int j=0; j<sY; j++) 
+  for(int i=0; i<sX; i++)   {
+    if (++n % vit != 0)  continue;
+    pixv = Value(i,j);
+    if (pixv <= max && pixv >= min) {  
+      if (pixv < minpix)  minpix = pixv;
+      if (pixv > maxpix)  maxpix = pixv; 
+      dv = (double)pixv;
+      m += dv;  s += (dv*dv);
+      }
+    else  {  
+      if (pixv > max)  n9++;
+      if (pixv < min)  n0++; 
+    }
+  }
+
+nbnul = n0*vit;  nbsat = n9*vit;
+min = minpix;  max = maxpix; 
+
+n -= (n0+n9);
+if (n > 0)
+  { dv = (double)n;  m /= dv;  s = s/dv - m*m;
+  if (s>0.)  s = sqrt(s);  else s = 0.;
+  moy = m;  sig = s; }
+else { moy = 0.;  sig = -1.; }
+
+printf("DEBUG_CHECKDYN: %d %g %g - %g %g \n", n, min, max, moy, sig);
+return(n);
+}
+
+
+/* --Methode-- */
+void P2DArrayAdapter::ComputeLut_PicHisto(float& min, float& max, int nbsig, float fracmax)
+{
+TIMEF ; 
+int MINNBIN = 64;
+int MAXNBIN = 1024;
+
+int nbin = sX*sY/10;
+nbin = (nbin < MINNBIN) ? MINNBIN : ((nbin > MAXNBIN) ? MAXNBIN : nbin );
+int vitesse = sX*sY / 20000;
+vitesse = (vitesse < 1) ? 1 : ((vitesse > 25) ? 25 : vitesse );
+
+
+//  Variable decrivant l'histogramme 
+float minhis, maxhis, binwidth;
+int under,over,tothis;
+int *phis;
+int *q;
+
+float MINDYNAMIC = 1.e-5;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
+float FRACPIC =	0.6065;            /*  Valeur de exp(-0.5)   */
+
+
+int nbnul, nbsat, nok;
+float moy, sig;
+if ( min >= (max-MINDYNAMIC) ) nok = CheckDyn(min, max, moy, sig, nbnul, nbsat);
+if (nok < 1) { min=0.; max = 1.; return; }
+if ( min >= (max-MINDYNAMIC) )  max = min+MINDYNAMIC;
+minhis = min;
+maxhis = max;
+binwidth = (maxhis-minhis) / nbin;
+if (binwidth < MINDYNAMIC/MINNBIN) { 
+  binwidth = MINDYNAMIC/MINNBIN;
+  maxhis = nbin*binwidth + minhis;
+  }
+
+/* allocation dynamique de memoire et mise a zero de l'histogramme */
+phis = new int_4[nbin];
+for ( q=phis ; q<phis+nbin ; *q++ = 0 )  ;
+under = over = tothis = 0;
+
+//  Boucle sur les pixels   
+//  Pour aller plus vite, on prend un pixel sur vitesse   
+int kk = 0;
+int bin;
+for(int j=0; j<sY; j++)
+  for(int i=0; i<sX; i++) {
+    if ( (++kk % vitesse) != 0) continue;
+   /* remplissage de l'histogramme */
+    bin = (int)((Value(i, j) - minhis) / binwidth) ;
+    if ( bin < 0 )  under++;
+    else  {
+      if (bin < nbin) { (*(phis+bin))++; tothis++; }
+      else   over++; 
+      }
+    }     /*  Fin de for : Boucle sur les pixels   */
+
+/*  On verifie qu'il y a eu une entree ds l'histo */
+if (tothis <= 0)
+  { delete[] phis;  return; }
+  
+/* recherche du maximum */
+int binmax = -1 ; 
+int hmax = -1 ; 
+q = phis;
+for (kk = 0 ; kk < nbin ;  kk++, q++ )
+  if ( *(q) > hmax ) {hmax = *(q) ; binmax = kk ;}
+
+if ( (binmax < 0) || (binmax >= nbin) )
+  { delete[] phis;  return; }
+
+
+/*   On va chercher le sigma du fond  SigmaLeft, SigmaRight */
+int hmin = (int) ( (float)(hmax) * FRACPIC ) ;
+
+int sigr = 0;
+q = phis+binmax;
+while ( ((*q) > hmin) && (sigr < (nbin-binmax)) )  { sigr++;  q++; }
+int sigl = 0;
+q = phis+binmax;
+while ( ((*q) > hmin) && (sigl < binmax) )  { sigl++; q--; }
+
+
+if (nbsig == 0) nbsig = 1;
+if (nbsig < 0)  {  /*   On considere le cas ou NbSigmas est negatif   */
+  if ( (bin = binmax+nbsig*sigl) < 0 )  bin = 0;
+  min = minhis + (float)bin*binwidth;
+  if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1;
+  max = minhis + (float)bin*binwidth;
+  if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
+  delete[] phis;  return; 
+  }
+
+// NbSigma positif 
+if ( (bin = binmax+nbsig*sigl) >= nbin ) {
+  min = minhis + binmax*binwidth;
+  max = maxhis;
+  if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
+  delete[] phis;  return;
+  }
+
+min = minhis + bin*binwidth;
+
+/*   Calcul du nb de pixel entre MinAff et ValSat  */
+int nbpix = 0;
+for( q = phis+bin ; q < phis+nbin ; q++)  nbpix += (*q);
+nbpix = (int_4)((float)nbpix * fracmax);
+int nbpix2 = 0; q = phis+bin; 
+int k = bin;
+while( (nbpix2 < nbpix) && (k < nbin) )  
+  { nbpix2 += (*q); k++; q++; }
+
+max = minhis + (float)k*binwidth;
+delete[] phis;
+if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
+
+return;
+}
+
+
+/* --Methode-- */
+unsigned char * P2DArrayAdapter::ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
+                int xwsz, int ywsz, unsigned char * opix, int * oxsp, int * oysp)
+{
+TIMEF ; 
+unsigned char *pix, *pp, ucp;
+int zmm=1;
+int npx, npy, nppx, nppy, nszp, oszp;
+int i,j,k,l;
+float vpx;
+
+
+if ( (XSize() <= 0) || (YSize() <= 0) || (lut == NULL) ) 
+  { *oxsp = *oysp = 0; return(NULL); }
+
+npx = XSize()-ofx;
+npy = YSize()-ofy;
+
+if ((zm == 0) || (zm == -1))  zm = 1;
+
+if (zm >= 1)
+  {
+  if (npx > (xwsz/zm))  npx = xwsz/zm; 
+  if (npy > (ywsz/zm))  npy = ywsz/zm;
+  nppx = npx*zm;   nppy = npy*zm;
+  }
+else
+  {
+  zmm = -zm;
+  nppx = npx/zmm;   nppy = npy/zmm;
+  if (nppx > xwsz)  nppx = xwsz; 
+  if (nppy > ywsz)  nppy = ywsz;
+  npx = nppx*zmm;   npy = nppy*zmm; 
+  }
+
+oszp = (*oxsp)*(*oysp);
+nszp = nppx*nppy;
+if ( oszp != nszp )
+  {
+  if (opix)  delete[] opix;
+  pix = new unsigned char[nppx*nppy];
+  if (pix == NULL)  { *oxsp = *oysp = 0; ; return(NULL); }
+  }
+else  pix = opix;
+*oxsp = nppx; *oysp = nppy;
+
+/*
+printf("Debug_ComputePixmap %d %d %d (%d-%d %d-%d)\n", 
+      ofx, ofy, zm, npx,nppx, npy,nppy);
+*/
+
+pp = pix;
+if (eXY) { // Echange Axe X,Y 
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->ApplyFast( 
+                this->Value(j*sgnX+offX, i*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    float fv = (float)(zmm*zmm); 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) {
+        vpx = 0;
+        for(l=0; l<zmm; l++)
+          for(k=0; k<zmm; k++)
+            vpx += this->Value( (j+l)*sgnX+offX, (i+k)*sgnY+offY);
+        *pp = (unsigned char) lut->ApplyFast(vpx/fv); 
+        pp++;
+        }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }     // Fin du cas avec echange d'axe X/Y 
+else {
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->ApplyFast( 
+                this->Value(i*sgnX+offX, j*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    float fv = (float)(zmm*zmm); 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) {
+        vpx = 0;
+        for(l=0; l<zmm; l++)
+          for(k=0; k<zmm; k++)
+            vpx += this->Value( (i+k)*sgnX+offX, (j+l)*sgnY+offY);
+        *pp = (unsigned char) lut->ApplyFast(vpx/fv); 
+        pp++;
+        }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }
+return(pix);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/parradapter.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/parradapter.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/parradapter.h	(revision 108)
@@ -0,0 +1,79 @@
+// This may look like C code, but it is really -*- C++ -*-
+//     Classes ArrayAdapter           R. Ansari  05/98
+// 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
+#define PARRADAPTER_SEEN
+
+#include "defs.h"
+#include "machine.h"
+#include "lut.h"
+
+class LUT;
+class P2DArrayAdapter {
+public :
+                  P2DArrayAdapter(int sx=0, int sy=0);
+  virtual 	  ~P2DArrayAdapter();
+
+  void  	  ConfigureAxes(bool invx=false, bool invy=false, bool exy=false,
+                                int sx=-1, int sy=-1);
+
+// Doit etre defini par les classes derivees
+  virtual float   Value(int ix, int iy) = 0;   
+
+  virtual void    XYfromxy(int ix, int iy, float& x, float& y);
+
+  inline  int     XSize() { return ( eXY ? sY : sX ) ; }
+  inline  int     YSize() { return ( eXY ? sX : sY ) ; }
+
+  inline  void    XYCoord(int i, int j, float& x, float& y)
+                         { int ix, iy;  IJ2xy(i, j, ix, iy); 
+                           XYfromxy(ix, iy, x, y); }
+  inline  float   operator() (int i, int j) 
+                         { int ix, iy;  IJ2xy(i, j, ix, iy); 
+                         return Value(ix, iy); }
+  inline void     IJ2xy(int i, int j, int& x, int& y)
+                  { if  (eXY) {int ii = i; i = j; j = ii; }
+                  x = i*sgnX+offX; y = j*sgnY+offY; 
+                  return; }
+
+//    Calcul Min-Max, Moy-Sig
+  virtual int     CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit=10);
+//    Calcul AutoLut
+  virtual void    ComputeLut_PicHisto(float& min, float& max, int nbsig=1, float fracmax=0.95);
+
+//    Calcul pixmap avec un LUT
+  virtual unsigned char * ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
+                           int xwsz, int ywsz, unsigned char * opix, 
+                           int * oxsp, int * oysp);
+protected :
+  int sX, sY;
+  int sgnX, sgnY;
+  int offX, offY;
+  bool invX, invY, eXY;
+};
+
+
+template <class T> 
+class P2DAdapter : public P2DArrayAdapter {
+public :
+                  P2DAdapter(T* data, int sx, int sy, bool ad=false) :
+                    P2DArrayAdapter(sx, sy)
+                    { aDel = ad; mData = data; }
+
+  virtual 	  ~P2DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; }
+  virtual float   Value(int ix, int iy) 
+                    {  if ( (ix < 0)  || (iy < 0) || (ix >= sX) || (iy >= sY) ) return(0.); 
+                    return(mData[ix+iy*sX]); }
+protected :
+  bool aDel;
+  T* mData;
+};
+
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pi.rsc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pi.rsc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pi.rsc	(revision 108)
@@ -0,0 +1,28 @@
+PeidaInt*background:                         LightGrey
+PeidaInt*default*background:                 LightGrey
+PeidaInt*bottomShadowColor:                  Black
+PeidaInt*default*bottomShadowColor:          Black
+PeidaInt*Foreground:                         Black
+PeidaInt*default*Foreground:                 Black
+PeidaInt*topShadowColor:                     White
+PeidaInt*default*topShadowColor:             White
+PeidaInt*borderColor:                        Black
+
+PeidaInt*XmLabel.borderWidth:                1
+PeidaInt*XmScrollBar*background:             LightBlue
+PeidaInt*XmDrawingArea*background:           Black
+PeidaInt*XmPushButton*borderWidth:           0
+
+PeidaInt*XmText*XmNshadowThickness:          1
+PeidaInt*XmText*XmNhighlightThickness:          2
+
+PeidaInt*DefMenubar*XtNwidth:           250
+PeidaInt*DefMenubar*XtNheight:          30
+
+PeidaInt*fontList:           -*-helvetica-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1
+PeidaInt*default*fontList:    -*-helvetica-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1
+
+# Attention, ne pas mettre de blanc a la fin du nom de fonte
+PeidaInt*fontFamilyName:   *-helvetica
+
+PeidaInt*XmToggleButton*selectColor:                  Red
Index: /branches/EA_Juin98/SophyaPI/PI/piapplgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplgen.cc	(revision 108)
@@ -0,0 +1,159 @@
+//  Classe de base d'objets application pour 
+//  les programmes graphiques interactives
+//
+//                  E.Aubourg , R. Ansari  96 - 98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+//++
+// Class	PIApplication
+// Lib		PI
+// include	piapplgen.h
+//
+//	Classe de base pour l'objet application. L'objet PIApplication 
+//	doit être créé avant la création des autres objets de PI.
+//	La classe "PIApplication" a implémentation dépendante 
+//	du systeme utilisé (Mac, XWindow, ...). La classe "PIApplicationGen" 
+//	est la classe qui définit l'interface, et ne doit pas être instanciée 
+//	directement (Méthodes virtuelles pures). Les objets instanciés sont 
+//	de la classes "PIApplication" et le fichier entête correspondant est 
+//	"PIAPP_H" défini dans "pisysdep.h".
+//--
+//++
+// Links	Parents
+// PIMsgHandler
+//--
+//++
+// Titre	Constructeur
+//--
+//++
+// PIApplication(int sx=200, int sy=30, int narg=0, char *arg[]=NULL)
+//	Constructeur. "sx,sy" est la taille de la fenêtre principale
+//	(ou PIContainer) associée à l'application. Des arguments
+//	optionnels, par exemple celle de la ligne de commande peuvent 
+//	être transmis à l'objet PIApplication. Dans le cas d'Unix/XWindow
+//	par exemple, les options reconnues par la Xtoolkit peuvent 
+//	être passées à l'objet application.
+//--
+
+//++
+// Titre	Méthodes
+//--
+//++
+// PIContainer*   MainWin()
+//	Renvoie le pointeur de l'objet "PIContainer" associé à l'application.
+// PIMenubar*   Menubar()
+//	Renvoie le pointeur de l'objet "PIMenubar" associé à l'application.
+// void AppendMenu(PIPDMenu *pdm)
+//	Ajoute le "PIPDMenu *pdm" au Menubar de l'application. Le titre 
+//	du menu dans le menubar est le nom de l'objet menu. 
+// void Run() Stop
+//	Démarre, arrête la boucle d'événements.
+//--
+
+
+#include "piapplgen.h"
+
+// Variable qui contient le pointeur de l'application courante
+// permet de recuperer la taille pref pour la fonction globale 
+static PIApplicationGen * curapp = NULL;
+
+PIApplicationGen::PIApplicationGen()
+:topcont(NULL), menubar(NULL), mState(0)
+{
+curapp = this;   
+}
+
+PIApplicationGen::~PIApplicationGen()
+{}
+
+
+void PIApplicationGen::AppendMenu(PIPDMenu *pdm)
+{
+if (menubar)
+  menubar->AppendMenu(pdm);
+return;
+}
+
+//++
+// void SetReady()
+//	Modifie l'état global de l'application - Pssage à l'état normal,
+//	prêt à traiter les actions utilisateur.
+// void SetBusy()
+//	Passage en mode de calcul - La souris prend la forme de la montre
+//	pour la fenêtre principale
+// void SetBlocked()
+//	Passge en mode bloqué. La barre de menu devient insensible
+// int GetState()
+//	Renvoie l'état global de l'application "(kReadyState, kBusyState, kBlockedState)".
+//--
+void PIApplicationGen::SetReady()
+{
+mState = kReadyState;
+}
+
+void PIApplicationGen::SetBusy()
+{
+mState = kBusyState;
+}
+
+void PIApplicationGen::SetBlocked()
+{
+mState = kBlockedState;
+}
+
+int PIApplicationGen::GetState()
+{
+return mState;
+}
+
+//++
+// Titre	Redirection StdOut, StdErr
+//	Il est possible de rediriger les flots de sortie
+//	standard et d'erreur vers un objet PIConsol.
+//--
+
+//++
+// void  RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def)
+//	Redirige le flot de sortie ("stdout" sous Unix) vers l'objet 
+//	PIConsole "cons".  
+//
+// void  RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Def)
+//	Redirige le flot des messages d'erreur ("stderr" sous Unix) 
+//	vers l'objet PIConsole "cons".  
+//--
+
+//++
+// Titre	Informations globales
+//	Les méthodes suivantes permettent d'acceder aux informations  
+//	concernant l'écran (tailles, ...). Des fonctions globales sont 
+//	prévues ( "PIApplicationPrefCompSize()" et "PIApplicationScreenSize()" )
+//	afin d'obtenir ces informations sans avoir besoin d'une instance de la 
+//	classes application.
+//--
+//++
+// void  PIApplicationPrefCompSize(int& szx, int& szy)
+//	Fonction globale
+// void  PrefCompSz(int& szx, int& szy)
+//	Renvoie la taille préférée pour les composantes standard. "szx,szy" 
+//	est la taille (en pixels) pour un champ texte, ou un bouton "(PIText, PIButton)" 
+//	avec l'étiquette ou un contenu de 6 caractères (Ex: Cancel).
+//
+// void  PIApplicationScreenSize()
+//	Fonction globale
+// void  ScreenSz(int& szx, int& szy)
+//	Renvoie la taille en pixels de l'écran
+//  
+//--
+
+void     PIApplicationPrefCompSize(int& szx, int& szy)
+{
+szx = szy = 10;
+if (curapp)  curapp->PrefCompSz(szx, szy);
+return; 
+}
+void     PIApplicationScreenSize(int& szx, int& szy)
+{
+szx = szy = 500;
+if (curapp)  curapp->ScreenSz(szx, szy);
+return; 
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piapplgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplgen.h	(revision 108)
@@ -0,0 +1,48 @@
+#ifndef PIAPPLGEN_H_SEEN
+#define PIAPPLGEN_H_SEEN
+
+#include "pimsghandler.h"
+#include "pisysdep.h"
+#include PICONT_H
+#include PIMENUBAR_H
+
+#include "picons.h"
+
+class PIApplicationGen : public PIMsgHandler {
+public:
+        enum { kReadyState=0, kBusyState=1, kBlockedState=2 };
+
+				  PIApplicationGen();
+	virtual		          ~PIApplicationGen();
+	
+	virtual void              Run()=0;
+	virtual void              Stop()=0;
+
+        virtual void              SetReady();
+        virtual void              SetBusy(); 
+        virtual void              SetBlocked();
+        virtual int               GetState();
+
+
+	virtual PIContainer*      MainWin() {return topcont;}
+        virtual PIMenubar*        Menubar() {return menubar;}
+
+        virtual void              AppendMenu(PIPDMenu *pdm);
+
+        virtual void              PrefCompSz(int& szx, int& szy) = 0;
+        virtual void              ScreenSz(int& szx, int& szy) = 0;
+
+        virtual void              RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def)  = 0;
+        virtual void              RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital) = 0;
+
+protected:
+    PIContainer               *topcont;
+    PIMenubar                 *menubar;
+    int                       mState;
+};
+
+//   Fonction globale pour recuperer la taille standard des composants (taille x,y) 
+void     PIApplicationPrefCompSize(int& szx, int& szy);  
+void     PIApplicationScreenSize(int& szx, int& szy);  
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piapplmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplmac.cc	(revision 108)
@@ -0,0 +1,112 @@
+
+#include "piapplmac.h"
+#include "pippmenubar.h"
+#include "pippapplmac.h"
+#include "piwindowmac.h"
+
+#include <LApplication.h>
+#include <LGrowZone.h>
+#include <UDrawingState.h>
+#include <UMemoryMgr.h>
+#include <SIOUX.h>
+#include <LAttachment.h>
+
+class PIInit {
+public:
+  PIInit() {
+    SIOUXSettings.initializeTB = false;
+    SIOUXSettings.standalone = false;
+    SIOUXSettings.setupmenus = false;
+    SIOUXSettings.showstatusline = true;
+  }
+};
+
+PIInit piInit;
+
+class PISIOUXAttachment : public LAttachment {
+public:
+  PISIOUXAttachment();
+protected:
+ virtual void	ExecuteSelf(
+							MessageT		inMessage,
+							void			*ioParam);
+};
+
+PISIOUXAttachment::PISIOUXAttachment()
+: LAttachment()
+{}
+
+void PISIOUXAttachment::ExecuteSelf(MessageT msg, void* p)
+{
+  if (msg == msg_Event)
+    mExecuteHost = !SIOUXHandleOneEvent((EventRecord*)p);
+  if (!mExecuteHost)
+    UDesktop::NormalizeWindowOrder();
+}
+
+PIApplicationMac::PIApplicationMac(int sx, int sy, int /*narg*/, char** /*arg*/)
+{
+  SIOUXSettings.initializeTB = false;
+  SIOUXSettings.standalone = false;
+  SIOUXSettings.setupmenus = false;
+  SIOUXSettings.showstatusline = true;
+									// Set Debugging options
+	SetDebugThrow_(debugAction_Alert);
+	SetDebugSignal_(debugAction_Alert);
+
+	InitializeHeap(3);				// Initialize Memory Manager
+									// Parameter is number of Master Pointer
+									//   blocks to allocate
+	
+									// Initialize standard Toolbox managers
+	UQDGlobals::InitializeToolbox(&qd);
+	
+	new LGrowZone(20000);			// Install a GrowZone function to catch
+									//    low memory situations.
+									
+		// Register functions to create core PowerPlant classes
+	
+	RegisterAllPPClasses();
+
+	macAppli = new PIPPApplMac;
+	macAppli->AddAttachment(new PISIOUXAttachment);
+	
+    menubar = new PIMenubar(this, "DefMenubar");
+    topcont = new PIWindowMac(this, "TopLevel", PIWK_floating, sx, sy, 10, 45);
+}
+
+
+PIApplicationMac::~PIApplicationMac()
+{
+	delete macAppli;
+}
+
+void
+PIApplicationMac::Run()
+{
+    topcont->Show();
+	macAppli->Run();
+}
+
+void
+PIApplicationMac::Stop()
+{
+	macAppli->DoQuit();
+}
+
+/* --Methode-- */
+int PIApplicationMac::PrefXSize()
+{
+  return(10);  // $CHECK$ A remplacer Reza 13/02/98 
+}
+
+/* --Methode-- */
+int PIApplicationMac::PrefYSize()
+{
+  return(18);  // $CHECK$ A remplacer Reza 13/02/98 
+}
+
+void PIApplicationMac::RedirectOutStream(PIConsole* cons, unsigned char va)
+{}
+void PIApplicationMac::RedirectErrStream(PIConsole* cons, unsigned char va)
+{}
Index: /branches/EA_Juin98/SophyaPI/PI/piapplmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplmac.h	(revision 108)
@@ -0,0 +1,26 @@
+#ifndef PIAPPLMAC_H_SEEN
+#define PIAPPLMAC_H_SEEN
+
+#include "piapplgen.h"
+
+class LApplication;
+class PIApplicationMac : public PIApplicationGen {
+public:
+					PIApplicationMac(int sx=200, int sy=30, int narg=0, char *arg[]=NULL);
+	virtual		   ~PIApplicationMac();
+	
+	virtual void    Run();
+	virtual void    Stop();
+	
+  virtual int     PrefXSize();
+  virtual int     PrefYSize();
+
+        virtual void              RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def);
+        virtual void              RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital);
+//protected:
+	LApplication* macAppli;
+};
+
+typedef PIApplicationMac PIApplication;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piapplx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplx.cc	(revision 108)
@@ -0,0 +1,235 @@
+#include <stdio.h>
+#include <X11/cursorfont.h>
+#include "piapplx.h"
+#include "picontainerx.h"
+
+
+// Pour rediriger stdout 
+#include <unistd.h>
+#include <fcntl.h>
+
+
+// #define DEBUG_APPLX
+
+static Cursor a_curs[3];
+static bool a_fgcur=false;
+
+//  Voir fichier pimenux.cc , Pour resoudre certains conflits avec les WindowManagers
+void SetTopWdgForMenuX(SysDWdg mtw);
+
+/* --Methode-- */
+PIApplicationX::PIApplicationX(int sx, int sy, int narg, char *arg[])
+: PIApplicationGen()
+{
+int sxt, syt;
+
+#ifdef DEBUG_APPLX
+puts("PIApplicationX::PIApplicationX()_info : App creation");
+#endif
+mStop = true;
+topwdg = new PIWdgX(narg, arg);
+
+intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont", 
+                            10, 10, 0, 0);
+// Pb avec les Popup MenuX et certains Window Manager , voir pimenux.cc
+SetTopWdgForMenuX(intcont->XtWdg());
+
+menubar = new PIMenubar(this, "DefMenubar");
+Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
+sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
+syt = ( sy > 0 ) ? sy : 0;
+int msx,msy;
+PrefCompSz(msx, msy);
+//syt += Menubar()->YSize();
+syt += msy;
+MBCont()->SetSize(sxt, syt);
+if ( (sx > 0) && (sy > 0) )
+  {
+  topcont = new PIContainerX(MBCont(), "TopLevelCont", 
+                             sx, sy, 0, msy);
+  topcont->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+  topcont->Show();
+  }
+else topcont = MBCont();
+
+MBCont()->Show();
+topwdg->Manage();
+
+if (!a_fgcur)
+  {
+  Display *mdsp;
+  mdsp = XtDisplay (topwdg->XtWdg()); 
+  a_curs[0] = XCreateFontCursor(mdsp, XC_arrow);
+  a_curs[1] = XCreateFontCursor(mdsp, XC_X_cursor);
+  a_curs[2] = XCreateFontCursor(mdsp, XC_watch);
+  }
+
+mState = -1;
+SetReady();
+}
+
+/* --Methode-- */
+PIApplicationX::~PIApplicationX()
+{
+#ifdef DEBUG_APPLX
+puts("PIApplicationX::~PIApplicationX()_info : App delete");
+#endif
+Display *mdsp;
+mdsp = XtDisplay (topwdg->XtWdg()); 
+topwdg->UnManage();
+delete menubar;
+if (topcont != MBCont())  delete topcont;
+delete intcont;
+delete topwdg;
+XtCloseDisplay(mdsp);
+return;
+}
+
+/* --Methode-- */
+void PIApplicationX::Run()
+{
+XEvent evt;
+#ifdef DEBUG_APPLX
+puts("PIApplicationX::Run()_info : App Run ");
+#endif
+
+topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
+
+int szx, szy;
+XtAppContext * appctx = PIXtAppCtx(szx, szy);
+
+while (mStop)
+  {
+  XtAppNextEvent(*appctx, &evt);
+  XtDispatchEvent(&evt);
+  }
+return;
+}
+
+
+/* --Methode-- */
+void PIApplicationX::SetReady()
+{
+if (mState != kReadyState)
+  {
+  Display * mdsp;
+  mState = kReadyState;
+  Menubar()->SetSensitive();
+  mdsp = XtDisplay (topwdg->XtWdg());
+  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[0]);
+  XFlush(mdsp);
+  }
+}
+
+/* --Methode-- */
+void PIApplicationX::SetBusy()
+{
+if (mState != kBusyState)
+  {
+  Display * mdsp;
+  mState = kBusyState;
+  Menubar()->SetSensitive();
+  mdsp = XtDisplay (topwdg->XtWdg());
+//  if ( XtIsRealized(topwdg->XtWdg()) )
+  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[2]);
+  XFlush(mdsp);
+  }
+return;
+}
+
+/* --Methode-- */
+void PIApplicationX::SetBlocked()
+{
+if (mState != kBlockedState)
+  {
+  Display * mdsp;
+  mState = kBlockedState;
+  Menubar()->SetUnSensitive();
+  mdsp = XtDisplay (topwdg->XtWdg());
+  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[1]);
+  XFlush(mdsp);
+  }
+}
+
+
+/* --Methode-- */
+void PIApplicationX::PrefCompSz(int& szx, int& szy)
+{
+PIXtAppCtx(szx, szy);
+return;
+}
+
+/* --Methode-- */
+void PIApplicationX::ScreenSz(int& szx, int& szy)
+{
+Display * dsp = PIXDisplay();
+szx = DisplayWidth(dsp, DefaultScreen(dsp));
+szy = DisplayHeight(dsp, DefaultScreen(dsp));
+}
+
+
+
+/* Call-Back - Fonction privee de ce fichier */
+static void redirectstream_callback(XtPointer, int *, XtInputId*);
+
+static PIConsole* consstream[2] = {NULL, NULL};
+static unsigned char streamva[2] = { PIVA_Def, PIVA_Ital};
+static int streamno[2] = {0,1};
+
+static void redirectstream_callback(XtPointer cld, int * fd, XtInputId* /*iid*/)
+{
+char buff[128];
+int nr;
+
+int idx = *((int*)cld);
+if (idx != 1) idx = 0; 
+while ( (nr=read(*fd, buff, 127)) > 0 ) {
+  buff[nr] = '\0'; consstream[idx]->AddStr(buff, streamva[idx], false);
+  }
+consstream[idx]->Refresh();
+}
+
+/* --Methode-- */
+void PIApplicationX::RedirectOutStream(PIConsole* cons, unsigned char va)
+{
+if (!cons) return;
+
+if (consstream[0]) { consstream[0] = cons; streamva[0] = va; return; }
+consstream[0] = cons; streamva[0] = va;
+
+int p[2];
+pipe(p);
+// Redirection de stdout (fid=1) :  
+close(1);
+dup(p[1]);
+close(p[1]);
+fcntl(p[0], F_SETFL, O_NONBLOCK);
+setlinebuf(stdout);
+
+int szx, szy;
+XtAppContext * appctx = PIXtAppCtx(szx, szy);
+XtAppAddInput(*appctx, p[0], (XtPointer) XtInputReadMask, redirectstream_callback, (XtPointer) streamno);
+}
+
+/* --Methode-- */
+void PIApplicationX::RedirectErrStream(PIConsole* cons, unsigned char va)
+{
+if (!cons) return;
+
+if (consstream[1]) { consstream[1] = cons; streamva[1] = va; return; }
+consstream[1] = cons; streamva[1] = va;
+
+int p[2];
+pipe(p);
+// Redirection de stderr (fid=0) :
+close(2);
+dup(p[1]);
+close(p[1]);
+fcntl(p[0], F_SETFL, O_NONBLOCK);
+setlinebuf(stderr);
+
+int szx, szy;
+XtAppContext * appctx = PIXtAppCtx(szx, szy);
+XtAppAddInput(*appctx, p[0], (XtPointer) XtInputReadMask, redirectstream_callback, (XtPointer) (streamno+1));
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/piapplx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piapplx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piapplx.h	(revision 108)
@@ -0,0 +1,36 @@
+#ifndef PIAPPLX_H_SEEN
+#define PIAPPLX_H_SEEN
+
+#include "piapplgen.h"
+#include "piwdgx.h"
+#include "picontainerx.h"
+
+class PIApplicationX : public PIApplicationGen {
+public:
+  		            PIApplicationX(int sx=200, int sy=30, int narg=0, char *arg[]=NULL);
+
+  virtual	            ~PIApplicationX();
+	
+  virtual void              Run();
+  virtual void              Stop() { mStop = false; }
+
+  virtual void              SetReady();
+  virtual void              SetBusy(); 
+  virtual void              SetBlocked();
+
+  virtual void              PrefCompSz(int& szx, int& szy);
+  virtual void              ScreenSz(int& szx, int& szy);
+
+  virtual void              RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def);
+  virtual void              RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital);
+
+  PIContainer*              MBCont() { return intcont; }
+protected:
+  PIWdg * topwdg;
+  PIContainer * intcont;
+  bool mStop;
+};
+
+typedef PIApplicationX PIApplication;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdggen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdggen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdggen.cc	(revision 108)
@@ -0,0 +1,419 @@
+#include <stdio.h>
+
+#include "pibwdggen.h"
+#include "pidrawer.h"
+#include "pigraphps.h"
+
+// Les methodes de la classe  PIBWdgGen
+ 
+/* --Methode-- */
+PIBaseWdgGen::PIBaseWdgGen(PIContainerGen *par, char *nom,
+                       int sx, int sy, int px, int py) :
+PIWdg(par, nom, sx, sy, px, py)
+{
+mDrwId=0;   // Compteur des numeros sequentiel des PIDrawer
+mAdfg=false;    // Pour controle d'appel de RemoveDrawer()
+mWGrC = NULL;   // PIGraphic (Contexte graphique) associe a la fenetre}
+                // Doit etre cree par PIBaseWdgX/Mac/... 
+SetDefaultDrawRectangle(0., 0., 1., 1., true);
+SetDefaultDrawerLimits(0., 1., 0., 1., kAxeDirLtoR, kAxeDirUpDown);
+}
+
+/* --Methode-- */
+PIBaseWdgGen::~PIBaseWdgGen()
+{
+delete mWGrC;
+DeleteDrawers();
+}
+ 
+
+/* --Methode-- */
+void PIBaseWdgGen::Refresh()
+{
+if ( IsVisible() )  { 
+  Draw(mWGrC);
+  CallDrawers(mWGrC); 
+}
+return;
+}
+
+// On met une variable pour eviter des boucles infinies entre les deux methodes 
+// Draw(PIGraphic* g, int, int, int, int) et Draw(PIGraphic* g) 
+static int fgdrawloop = 0;
+
+/* --Methode-- */
+void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
+{
+if (fgdrawloop == 0) 
+  { fgdrawloop=1;  Draw(g); }
+fgdrawloop = 0;
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::Draw(PIGraphic* g)
+{
+#ifdef DEBUG_RZXB
+puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! ");
+#endif
+if (fgdrawloop == 0) 
+  { fgdrawloop=2;  Draw(g, 0, 0, XSize(), YSize()); }
+fgdrawloop = 0;
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::Resize()
+{
+#ifdef DEBUG_RZXB
+puts("Debug_PIBaseWdgGen::Resize()  resize notify ");
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::Enter()
+{
+#ifdef DEBUG_RZXB
+puts("Debug_PIBaseWdgGen::Enter() enter notify ");
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::Leave()
+{
+#ifdef DEBUG_RZXB
+puts("Debug_PIBaseWdgGen::Leave() leave notify ");
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::But1Press(int /*x*/, int /*y*/)
+{
+Send(Msg(), PIMsg_Active);
+#ifdef DEBUG_RZXB
+printf ("PIBaseWdgGen::But1Press PosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::But1Release(int /*x*/, int /*y*/)
+{
+#ifdef DEBUG_RZXB
+printf ("PIBaseWdgGen::ButReleasePosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::But2Press(int /*x*/, int /*y*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::But2Release(int /*x*/, int /*y*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::But3Press(int /*x*/, int /*y*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::But3Release(int /*x*/, int /*y*/)
+{
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::Ptr1Move(int /*x*/, int /*y*/)
+{
+#ifdef DEBUG_RZXB
+printf ("Debug_PIBaseWdgGen::Ptr1Move PosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::Ptr2Move(int /*x*/, int /*y*/)
+{
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::Ptr3Move(int /*x*/, int /*y*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::Keyboard(int /*key*/, PIKeyModifier /*kmod*/)
+{
+#ifdef DEBUG_RZXB
+printf("PIBaseWdgGen::Keyboard: Key= %d (%c)  Mod= %d \n", key, (char)key, (int)kmod); 
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::PSPrint(PSFile * psf, int ofx, int ofy)
+{
+if (!psf) return;
+PIGraphicPS grpsf(psf, (PIWdg *)this, ofx, ofy);
+Draw(&grpsf);
+CallDrawers(&grpsf); 
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, bool psz)
+{
+mDrX1 = x1;  mDrY1 = y1;
+mDrX2 = x2;  mDrY2 = y2;   mDrElastic = psz;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
+                                          int axrl, int ayud)
+{
+mDrXmin = xmin;   mDrXmax = xmax; 
+mDrYmin = ymin;   mDrYmax = ymax; 
+mDXdir = axrl;    mDYdir = ayud;
+}
+
+
+/* --Methode-- */
+int PIBaseWdgGen::AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1,  
+                            PIGrCoord x2, PIGrCoord y2, bool psz, bool ad)
+{
+if (drw == NULL)   return(0);
+mDrwId++;
+BWDrwId did;
+did.x1 = x1;  did.y1 = y1;
+did.x2 = x2;  did.y2 = y2;
+did.autoszp = did.autolim = false;   did.elastic = psz;
+did.id = mDrwId;  did.ad = ad; 
+did.drw = drw;
+mDrwList.push_back(did);
+drw->Attach(this, mDrwId);
+return(mDrwId);
+}
+
+/* --Methode-- */
+int PIBaseWdgGen::AddDrawer(PIDrawer* drw, bool autolim, bool ad)
+{
+if (drw == NULL)   return(0);
+mDrwId++;
+BWDrwId did;
+did.x1 = 0.;  did.y1 = 0.;
+did.x2 = 1.;  did.y2 = 1.;
+did.autoszp = true;   did.autolim = autolim;   did.elastic = false;
+did.id = mDrwId;  did.ad = ad; 
+did.drw = drw;
+mDrwList.push_back(did);
+drw->Attach(this, mDrwId);
+return(mDrwId);
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::MoveResizeDrawer(int id,  PIGrCoord x1, PIGrCoord y1,  PIGrCoord x2, PIGrCoord y2, bool psz)
+{
+vector<BWDrwId>::iterator it;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++)  
+  if ((*it).id == id) { 
+    (*it).x1 = x1;  (*it).y1 = y1;
+    (*it).x2 = x2;  (*it).y2 = y2;
+    (*it).elastic = psz;
+    break;
+  }
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::RemoveDrawer(int id)
+{
+if (mAdfg)  return;
+vector<BWDrwId>::iterator it;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++)
+  if ((*it).id == id) 
+    { (*it).drw->Detach(this, id); mDrwList.erase(it); break; }
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::DeleteDrawers()
+{
+mAdfg = true;
+vector<BWDrwId>::iterator it;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++)  
+  if ((*it).ad)  delete (*it).drw;
+mDrwList.erase(mDrwList.begin(), mDrwList.end() );
+mAdfg = false;
+return;
+}
+
+/* --Methode-- */
+int PIBaseWdgGen::NbDrawers()
+{
+return(mDrwList.size());
+}
+
+
+/* --Methode-- */
+PIDrawer* PIBaseWdgGen::GetDrawer(int n)
+{
+if ( (n < 0) || (n >= mDrwList.size()) ) return(NULL);
+return(mDrwList[n].drw);
+}
+
+/* --Methode-- */
+PIDrawer* PIBaseWdgGen::GetDrawerId(int id)
+{
+vector<BWDrwId>::iterator it;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++)  
+  if ((*it).id == id)  return((*it).drw);
+return(NULL);
+}
+
+
+/* --Methode-- */
+void PIBaseWdgGen::CallDrawers(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+{
+float xmin,ymin, xmax, ymax;
+PIGraphicUC* guc;
+int drx0, dry0, drdx, drdy;
+int ddrx0, ddry0, ddrdx, ddrdy;
+
+if (mDrElastic) { 
+  ddrx0 = (int)((float) mDrX1 * (float)XSize());
+  ddry0 = (int)((float) mDrY1 * (float)YSize());
+  ddrdx = (int)((float) mDrX2 * (float)XSize()) - ddrx0 ;
+  ddrdy = (int)((float) mDrY2 * (float)YSize()) - ddry0 ;
+  }
+else {
+  ddrx0 = (int)mDrX1;   ddry0 = (int)mDrY1;  
+  ddrdx = (int)mDrX2-ddrx0;   ddrdy = (int)mDrY2-ddry0;  
+  }
+
+bool sxy = false;
+if ((dx > 0) && (dy > 0))  sxy = true;
+
+vector<BWDrwId>::iterator it;
+bool fgc=false;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++) {
+  g->SaveGraphicAtt();
+  if ( (*it).autoszp )   // Taille/position  par defaut impose par PIBaseWdg 
+    { drx0 = ddrx0;  dry0 = ddry0;   drdx = ddrdx;  drdy = ddrdy; } 
+  else {
+    if ( (*it).elastic  ) {   // Taille/position defin en fraction de la taille du PIBaseWdg
+      drx0 = (int)((float)(*it).x1 * (float)XSize());
+      dry0 = (int)((float)(*it).y1 * (float)YSize());
+      drdx = (int)((float)(*it).x2 * (float)XSize()) - drx0 ;
+      drdy = (int)((float)(*it).y2 * (float)YSize()) - dry0 ;
+      }
+    else {
+      drx0 = (int)(*it).x1 ;  dry0 = (int)(*it).y1 ; 
+      drdx = (int)(*it).x2-drx0 ;  drdy = (int)(*it).y2-dry0 ; 
+      }
+    }
+// L'ordre des operations ici est importante 
+  if ( (*it).autolim )  
+     (*it).drw->SetLimits(mDrXmin, mDrXmax, mDrYmin, mDrYmax, mDXdir, mDYdir);
+  guc = (*it).drw->SetDrwWdg(this, drx0, dry0, drdx, drdy, g);
+  g->SetClipRectangle(drx0, dry0, drdx , drdy);
+  (*it).drw->SelGraAtt(guc);
+  fgc = true;
+  if (sxy) {
+    guc->GrC2UC(x0, y0, xmin, ymin);
+    guc->GrC2UC(x0+dx, y0+dy, xmax, ymax);
+    }
+  else {
+    guc->GrC2UC(0, 0, xmin, ymin);
+    guc->GrC2UC(XSize(), YSize(), xmax, ymax);    
+    } 
+  if (xmin > xmax)  swap(xmin,xmax);
+  if (ymin > ymax)  swap(ymin,ymax);
+  (*it).drw->Draw(guc, xmin, ymin, xmax, ymax);
+  g->RestoreGraphicAtt();
+  }
+if (fgc)  g->ClearClipRectangle();
+
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgGen::CallDrawer(int id)
+{
+float xmin,ymin, xmax, ymax;
+PIGraphicUC* guc;
+int drx0, dry0, drdx, drdy;
+int ddrx0, ddry0, ddrdx, ddrdy;
+
+PIGraphic* g = WindowGraphic();
+
+if (mDrElastic) { 
+  ddrx0 = (int)((float) mDrX1 * (float)XSize());
+  ddry0 = (int)((float) mDrY1 * (float)YSize());
+  ddrdx = (int)((float) mDrX2 * (float)XSize()) - ddrx0 ;
+  ddrdy = (int)((float) mDrY2 * (float)YSize()) - ddry0 ;
+  }
+else {
+  ddrx0 = (int)mDrX1;   ddry0 = (int)mDrY1;  
+  ddrdx = (int)mDrX2-ddrx0;   ddrdy = (int)mDrY2-ddry0;  
+  }
+vector<BWDrwId>::iterator it;
+for(it = mDrwList.begin(); it != mDrwList.end(); it++) 
+  if ((*it).id == id) {
+    g->SaveGraphicAtt();
+    if ( (*it).autoszp )   // Taille/position  par defaut impose par PIBaseWdg 
+      { drx0 = ddrx0;  dry0 = ddry0;   drdx = ddrdx;  drdy = ddrdy; } 
+    else {
+      if ( (*it).elastic  ) {   // Taille/position defin en fraction de la taille du PIBaseWdg
+        drx0 = (int)((float)(*it).x1 * (float)XSize());
+        dry0 = (int)((float)(*it).y1 * (float)YSize());
+        drdx = (int)((float)(*it).x2 * (float)XSize()) - drx0 ;
+        drdy = (int)((float)(*it).y2 * (float)YSize()) - dry0 ;
+        }
+      else {
+        drx0 = (int)(*it).x1 ;  dry0 = (int)(*it).y1 ; 
+        drdx = (int)(*it).x2-drx0 ;  drdy = (int)(*it).y2-dry0 ; 
+        }
+      }
+// L'ordre des operations ici est importante 
+    if ( (*it).autolim )  
+       (*it).drw->SetLimits(mDrXmin, mDrXmax, mDrYmin, mDrYmax, mDXdir, mDYdir);
+    guc = (*it).drw->SetDrwWdg(this, drx0, dry0, drdx, drdy, g);
+    g->SetClipRectangle(drx0, dry0, drdx , drdy);
+    (*it).drw->SelGraAtt(guc);
+    guc->GrC2UC(0, 0, xmin, ymin);
+    guc->GrC2UC(XSize(), YSize(), xmax, ymax);     
+    if (xmin > xmax)  swap(xmin,xmax);
+    if (ymin > ymax)  swap(ymin,ymax);
+    (*it).drw->Draw(guc, xmin, ymin, xmax, ymax);
+    g->RestoreGraphicAtt();    
+    g->ClearClipRectangle();
+    break;
+  }
+return;
+}
+
+
+/* --Methode-- */
+PIGraphic* PIBaseWdgGen::WindowGraphic()
+{
+return(mWGrC);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdggen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdggen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdggen.h	(revision 108)
@@ -0,0 +1,125 @@
+#ifndef PIBWDGGEN_H_SEEN
+#define PIBWDGGEN_H_SEEN
+
+
+#include "pisysdep.h"
+#include PIWDG_H
+#include PICMAP_H
+#include PIGRAPHIC_H
+#include "pigraphuc.h"
+#include "psfile.h"
+
+// Mettre dans cet ordre, sinon g++ a des problemes   
+#include <vector>   
+
+enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 
+
+enum PIKeyValues { PIK_Return = 1+0x2000, PIK_Enter = 2+0x2000 , 
+                   PIK_BackSpace = 3+0x2000, PIK_Delete = 4+0x2000,
+                   PIK_Tab = 5+0x2000, PIK_Escape = 6+0x2000, 
+                   PIK_Up = 11+0x2000, PIK_Down = 12+0x2000, 
+                   PIK_Right = 13+0x2000, PIK_Left = 14+0x2000,
+                   PIK_Previous = 21+0x2000, PIK_Next = 22+0x2000  } ; 
+
+
+enum PIPointer { PI_ArrowPointer = 1, PI_CrossPointer = 2, 
+                 PI_HandPointer = 3, PI_TDLRArrowPointer = 4 };
+
+
+class PIBaseWdgGen : public PIWdg
+{
+public:
+  enum {ClassId = 5000};
+
+// Les methodes ...
+
+                     PIBaseWdgGen(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PIBaseWdgGen();
+
+  virtual long       kind() {return ClassId; }
+
+//  Activation des evenements
+  virtual void       ActivatePtrCross()        = 0;
+  virtual void       ActivateButton(int bid)   = 0;
+  virtual void       ActivateMove(int bid)     = 0;
+  virtual void       ActivateKeyboard()        = 0;
+
+//  Divers : couleur de fond, Effacement fenetre,  forme de la souris
+  virtual void       SetBackgroundColor(PIColors col=PI_White)               = 0;
+  virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0)     = 0;
+  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer)          = 0;
+  virtual PIColors   GetBackgroundColor()                                    = 0;
+  virtual PIPointer  GetPointerShape()                                       = 0;
+  virtual void       AssignKeyboard()                                        = 0;
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+  virtual void       Refresh();
+
+//  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
+  virtual void       Draw(PIGraphic* g);
+  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+  
+// Traitement des evenements   
+  virtual void       Resize();
+  virtual void       Enter();
+  virtual void       Leave();  
+  virtual void       But1Press(int x, int y);  
+  virtual void       But1Release(int x, int y); 
+  virtual void       But2Press(int x, int y);
+  virtual void       But2Release(int x, int y);
+  virtual void       But3Press(int x, int y);
+  virtual void       But3Release(int x, int y);
+  virtual void       Ptr1Move(int x, int y);
+  virtual void       Ptr2Move(int x, int y);
+  virtual void       Ptr3Move(int x, int y);
+  virtual void       Keyboard(int key, PIKeyModifier kmod);
+
+// PostScript output
+  virtual void       PSPrint(PSFile* psf, int ofx = 0, int ofy = 0);
+
+// ------ Gestion des Drawers  ------
+  friend class PIDrawer;
+          void       SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, 
+                                             PIGrCoord x2, PIGrCoord y2, bool psz=true); 
+          void       SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
+                                            int axrl=kAxeDirSame, int ayud=kAxeDirSame); 
+          int        AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1, 
+                               PIGrCoord x2, PIGrCoord y2, 
+                               bool psz=true, bool ad=false);
+          int        AddDrawer(PIDrawer* drw, bool autolim=false, bool ad=false);
+          void       MoveResizeDrawer(int id, PIGrCoord x1, PIGrCoord y1, 
+                                      PIGrCoord x2, PIGrCoord y2, bool psz=true);
+          void       RemoveDrawer(int id);       // Ote un drawer de la liste
+          void       DeleteDrawers();            // Ote et detruit tous les drawers
+// Acces aux drawers 
+          int        NbDrawers();
+          PIDrawer*  GetDrawerId(int id);   
+          PIDrawer*  GetDrawer(int n);   
+
+//  Trace des Drawers ...          
+  virtual void       CallDrawers(PIGraphicGen* g, int x0=0, int y0=0, int dx=0, int dy=0); 
+  virtual void       CallDrawer(int id);
+
+// Devrait etre protected - mis ici a cause de cxx  11/07/97  Reza
+  struct BWDrwId { int id; PIGrCoord x1, y1, x2, y2; bool autoszp, autolim, elastic, ad;  PIDrawer* drw; };
+
+  virtual PIGraphic*  WindowGraphic();
+
+// -------------- Variables membre protegees -------------------
+protected:
+  PIGraphicWin* mWGrC;  // PIGraphic (Contexte graphique) associe a la fenetre
+  bool mAdfg;           // Pour la gestion de DeleteDrawers() quand appele par delete de PIBaseWdg
+  int mDrwId;           // Compteur pour DrawerId
+  vector<BWDrwId> mDrwList;
+//  Definition de la zone de trace et limites UC des drawers par defaut  
+  PIGrCoord mDrX1, mDrY1,  mDrX2,  mDrY2;  
+  bool mDrElastic;   // true --> Coord en fraction de la taille 
+  float mDrXmin, mDrXmax, mDrYmin, mDrYmax;   // Limites par defaut - UC
+  int  mDXdir, mDYdir;                        // Sens des axes par defaut
+
+};
+
+
+#endif /* PIBWDGGEN_H_SEEN */
+
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.cc	(revision 108)
@@ -0,0 +1,157 @@
+#include <stdio.h>
+
+#include <LString.h>
+#include "pibwdgmac.h"
+#include "piupdattachment.h"
+#include <algobase.h>
+#include <string.h>
+
+#define mGraphic mWGrC  
+
+// Les methodes de la classe  PIBWdgGen
+ 
+/* --Methode-- */
+PIBaseWdgMac::PIBaseWdgMac(PIContainerGen *par, char *nom,
+                       int sx, int sy, int px, int py) :
+PIBaseWdgGen(par, nom, sx, sy, px, py) 
+{
+    mGraphic = new PIGraphicMac(this);
+
+    mAdapter->AddAttachment(new PIUpdAttachment(this));
+    mPane->AddAttachment(new PIUpdAttachment(this));
+    cursor = NULL;
+    
+
+}
+
+
+/* --Methode-- */
+PIBaseWdgMac::~PIBaseWdgMac()
+{
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::ActivatePtrCross()
+{
+// toujours actif pour le moment
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::ActivateButton(int /*bid*/)
+{
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::ActivateMove(int /*bid*/)
+{
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::ActivateKeyboard()
+{
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::EraseWindow(int x0, int y0, int dx, int dy)
+{
+  if (mPane->FocusDraw()) {
+     GrafPtr p = mPane->GetMacPort();
+     if (p) EraseRgn(p->visRgn);
+//	   Rect r;
+//	   mPane->CalcPortFrameRect(r);
+//       EraseRect(&r);
+  }
+}
+
+
+
+/* --Methode-- */
+void PIBaseWdgMac::SelPointerShape(PIPointer ptr)
+{
+  CursHandle c;
+  if (mPane->FocusDraw()) {
+    switch(ptr) {
+      case PI_ArrowPointer:
+        cursor = &qd.arrow;
+        break;
+      case PI_CrossPointer:
+        c = GetCursor(crossCursor);
+        HLock((Handle)c);
+        cursor = c ? *c : NULL;
+        break;
+      case PI_HandPointer:
+        c = GetCursor(128);
+        HLock((Handle)c);
+        cursor = c ? *c : NULL;
+        break;
+    }
+  }
+  mPtrS = ptr;
+}
+
+
+
+/* --Methode-- */
+PIPointer  PIBaseWdgMac::GetPointerShape()
+{
+return (mPtrS);
+}
+
+
+
+/* --Methode-- */
+bool PIBaseWdgMac::AdjustCursor()
+{
+  if (cursor) {
+    ::SetCursor(cursor);
+    return true;
+  }
+  return false;
+}
+
+/* --Methode-- 
+void PIBaseWdgMac::Refresh()
+{
+if (mPane->IsVisible())
+  Draw();
+}
+   J'ai mis cette fonction ds PIWdgMac::IsVisible()    Reza $CHECK$  01/12/97 
+*/
+
+
+
+void PIBaseWdgMac::SetBackgroundColor(PIColors col)
+{
+  if (mPane->FocusDraw()) {
+    long color;
+    switch (col) {
+      case PI_Black:
+        color = blackColor;
+        break;
+      case PI_White:
+        color = whiteColor;
+        break;
+      case PI_Red:
+        color = redColor;
+        break;
+      case PI_Blue:
+        color = blueColor;
+        break;
+      case PI_Green:
+        color = greenColor;
+        break;
+      case PI_Yellow:
+        color = yellowColor;
+        break;
+      default:
+        color = blackColor;
+    }
+    mBCol = col;
+    ::BackColor(color);
+  }
+}
+
+PIColors  PIBaseWdgMac::GetBackgroundColor() 
+{
+return (mBCol);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdgmac.h	(revision 108)
@@ -0,0 +1,45 @@
+/* Widget Xt pour affichage d'image  Interface Public    */
+/*                                    Reza 10/95         */
+
+#ifndef PIBWDGMAC_H_SEEN
+#define PIBWDGMAC_H_SEEN
+
+#include "pisysdep.h"
+#include "pibwdggen.h"
+
+
+class PIBaseWdgMac : public PIBaseWdgGen
+{
+public:
+// Les methodes ...
+
+                     PIBaseWdgMac(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PIBaseWdgMac();
+
+//  Activation des evenements
+  virtual void       ActivatePtrCross();
+  virtual void       ActivateButton(int bid);
+  virtual void       ActivateMove(int bid);
+  virtual void       ActivateKeyboard();
+
+  virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
+  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer);
+  virtual void       SetBackgroundColor(PIColors col=PI_White);
+  virtual PIColors   GetBackgroundColor();
+  virtual PIPointer  GetPointerShape();
+  virtual void       AssignKeyboard() {}
+
+protected:
+  friend class       PIUpdAttachment;
+  virtual bool       AdjustCursor();
+  CursPtr            cursor;
+  
+
+  PIPointer mPtrS;
+  PIColors  mBCol;
+};
+
+typedef PIBaseWdgMac PIBaseWdg;
+
+#endif /* RZXBASE_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdgx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdgx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdgx.cc	(revision 108)
@@ -0,0 +1,205 @@
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/cursorfont.h>
+
+#include <X11/IntrinsicP.h>
+#include <X11/CoreP.h>
+
+#include "pixtbaseP.h"
+#include "pixtbase.h"
+
+#include "pibwdgx.h"
+
+
+// #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
+static unsigned long colpixwhite, colpixblack;
+#define NMAXCURS 5 
+static Cursor curs[NMAXCURS];
+
+
+/* --Methode-- */
+PIBaseWdgX::PIBaseWdgX(PIContainerGen *par, char *nom,
+                       int sx, int sy, int px, int py) 
+: PIBaseWdgGen(par, nom, sx, sy, px, py)
+
+{
+Arg  wargs[3];
+
+Init();
+
+CreateXtWdg(nom, piXtBaseWidgetClass, NULL, sx, sy, px, py);
+
+XtSetArg(wargs[0],PIXNobject,this); 
+XtSetArg(wargs[1],XtNbackground, colpixwhite);  
+XtSetArg(wargs[2],XtNborderWidth, (Dimension)0);  
+XtSetValues(XtWdg(), wargs, 3);
+
+((PIXtBaseWidget)XtWdg())->pixtbase.myeventmask = 0;
+XtUninstallTranslations(XtWdg());
+
+mPtrS = PI_CrossPointer;
+SelPointerShape();
+
+Manage();
+mWGrC = new PIGraphicX(this);   // PIGraphic (Contexte graphique) associe a la fenetre
+}
+
+
+/* --Methode-- */
+PIBaseWdgX::~PIBaseWdgX()
+{
+#ifdef DEBUG_PIBWDGX 
+printf("PIBaseWdgX::~PIBaseWdgX()_Debug: Object= %lx (%lx) Wdg= %lx \n",
+(long)this, (long)(((PIXtBaseWidget)XtWdg())->pixtbase.objet), (long)XtWdg() );  
+#endif
+Arg  wargs[2];
+XtSetArg(wargs[0],PIXNobject,NULL); 
+XtSetValues(XtWdg(), wargs, 1);
+}
+
+/* --Methode-- */
+void PIBaseWdgX::FinishCreate()
+{
+// appele par la fenetre mere, apres XtRealize()
+// J'active le backing store pour la fenetre X
+XSetWindowAttributes xswa;
+Window mwi;
+mwi = XtWindow(XtWdg());
+xswa.backing_store = WhenMapped;
+xswa.backing_planes = ~0;
+XChangeWindowAttributes(PIXDisplay(), XtWindow(XtWdg()), CWBackingPlanes|CWBackingStore, &xswa);
+} 
+
+/* --Methode-- */
+void PIBaseWdgX::ActivatePtrCross()
+{
+XtAddEventHandler( XtWdg(), EnterWindowMask | LeaveWindowMask, 
+                   FALSE, event_handler_pixtbase, NULL);
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateButton(int bid)
+{
+#ifdef DEBUG_PIBWDGX
+printf("PIBaseWdgX::ActivateButton %d \n \n", bid);
+#endif
+if ( (bid < 1) && (bid > 3) ) return; 
+XtAddEventHandler( XtWdg(), ButtonPressMask | ButtonReleaseMask, 
+                   FALSE, event_handler_pixtbase, NULL);
+if (bid == 1)  ((PIXtBaseWidget)XtWdg())->pixtbase.myeventmask |= Button1Mask ;
+else if (bid == 2) ((PIXtBaseWidget)XtWdg())->pixtbase.myeventmask |= Button2Mask ;
+else if (bid == 3) ((PIXtBaseWidget)XtWdg())->pixtbase.myeventmask |= Button3Mask ;
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateMove(int bid)
+{
+#ifdef DEBUG_PIBWDGX
+printf("PIBaseWdgX::ActivateMove %d \n \n", bid);
+#endif
+unsigned long evtmask ;
+
+if ( (bid < 1) && (bid > 3) ) return; 
+if (bid == 1)  evtmask = Button1MotionMask | PointerMotionHintMask ;
+else if (bid == 2) evtmask = Button2MotionMask | PointerMotionHintMask ;
+else if (bid == 3) evtmask = Button3MotionMask | PointerMotionHintMask ;
+XtAddEventHandler( XtWdg(), evtmask, FALSE, event_handler_pixtbase, NULL);
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateKeyboard()
+{
+XtAddEventHandler( XtWdg(), KeyPressMask, FALSE, event_handler_pixtbase, NULL);
+((PIXtBaseWidget)XtWdg())->pixtbase.myeventmask |= ShiftMask ;
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::SetBackgroundColor(PIColors col)
+{
+Arg  wargs[2];
+XtSetArg(wargs[0],XtNbackground, mWGrC->GetPixelValueforColor(col) );  
+XtSetValues(XtWdg(), wargs, 1);
+mBCol = col;
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::EraseWindow(int x0, int y0, int dx, int dy)
+{
+XClearArea (XtDisplay(XtWdg()),XtWindow(XtWdg()), x0, y0, dx, dy, False );
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::SelPointerShape(PIPointer ptr)  
+{
+if (ptr == mPtrS)  return;
+if ( (ptr < 0) || (ptr >= NMAXCURS))  return;
+if ( XtIsRealized(XtWdg()) )
+  XDefineCursor(XtDisplay (XtWdg()), XtWindow(XtWdg()), curs[ptr]);
+mPtrS = ptr;
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::AssignKeyboard()
+{
+XSetInputFocus(XtDisplay (XtWdg()), XtWindow(XtWdg()), RevertToParent, PIXGetLastEventTime());
+}
+
+/* --Methode-- */
+PIColors   PIBaseWdgX::GetBackgroundColor()
+{
+return(mBCol);
+}
+
+/* --Methode-- */
+PIPointer  PIBaseWdgX::GetPointerShape()
+{
+return (mPtrS);
+}
+
+
+static bool fgbwdg = false ;
+
+/* --Methode-- */
+void PIBaseWdgX::Init()
+{
+int i;
+
+if (fgbwdg)  return;
+fgbwdg = true;
+
+Display *mdsp = PIXDisplay();
+int scr = XDefaultScreen(mdsp);
+
+colpixwhite = XWhitePixel(mdsp, scr);
+colpixblack = XBlackPixel(mdsp, scr);
+
+curs[0] = XCreateFontCursor(mdsp, XC_X_cursor);
+for(i=1; i<NMAXCURS; i++)  curs[i] = curs[0];
+
+curs[PI_ArrowPointer] =  XCreateFontCursor(mdsp, XC_arrow);
+curs[PI_CrossPointer] =  XCreateFontCursor(mdsp, XC_crosshair);
+curs[PI_HandPointer] =  XCreateFontCursor(mdsp, XC_hand2);
+curs[PI_TDLRArrowPointer] =  XCreateFontCursor(mdsp, XC_fleur);
+
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::eXposeProcess(int x0, int y0, int dx, int dy)                                 
+{ 
+// Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt )
+Draw(mWGrC, x0, y0, dx, dy);
+CallDrawers(mWGrC, x0, y0, dx, dy); 
+return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pibwdgx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pibwdgx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pibwdgx.h	(revision 108)
@@ -0,0 +1,47 @@
+#ifndef PIBWDGX_H_SEEN
+#define PIBWDGX_H_SEEN
+
+#include "pisysdep.h"
+#include "pibwdggen.h"
+
+#include "pigraphx.h"
+#include "pigraphps.h"
+
+class PIBaseWdgX : public PIBaseWdgGen
+{
+
+public:
+// Les methodes ...
+
+                     PIBaseWdgX(PIContainerGen *par, char *nom,
+                                int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PIBaseWdgX();
+
+  virtual void       FinishCreate();   // appele par la fenetre mere, apres XtRealize()
+
+//  Activation des evenements   
+  virtual void       ActivatePtrCross();
+  virtual void       ActivateButton(int bid);
+  virtual void       ActivateMove(int bid);
+  virtual void       ActivateKeyboard();
+
+//  Divers : couleur de fond, Effacement fenetre,  forme de la souris
+  virtual void       SetBackgroundColor(PIColors col=PI_White);
+  virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
+  virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer);
+  virtual PIColors   GetBackgroundColor();
+  virtual PIPointer  GetPointerShape();
+  virtual void       AssignKeyboard();
+
+//  Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt )
+  virtual void       eXposeProcess(int x0, int y0, int dx, int dy);
+ 
+protected:
+  void               Init();
+  PIPointer mPtrS;
+  PIColors mBCol;
+};
+
+typedef PIBaseWdgX PIBaseWdg;
+
+#endif /* PIBWDGX_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/picmap.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmap.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmap.cc	(revision 108)
@@ -0,0 +1,284 @@
+#include "picmap.h"
+
+#define  MXMAPIDS   10 
+static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256};
+static   char*  MapNoms[MXMAPIDS]  = {"Grey32","InvGrey32","ColRJ32","ColBR32",
+                               "ColRV32", "Grey128", "InvGrey128", "ColRJ128",
+                               "ColBR128", "Col16"};
+static   CMapId MapIds[MXMAPIDS] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
+                               CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128, 
+                               CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128,  
+                               CMAP_COL16 } ;
+
+static   int mColTNums[8192];   // Max 8192 tables differentes pour le moment  
+static   int CTNum = 0;        //  Numero des tables ds mColTNum - s'incremente a chaque creation 
+
+static   int NMaxTableAuto = 0;
+static   PIColorMap* mMaps[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+
+PIColorMap::PIColorMap(CMapId id)
+: PIColorMapNative()
+{
+   int k, kdx;
+   string mnom;
+
+   if (NMaxTableAuto == 0) { //  Il faut allouer les tables de depart
+     if ( TotNbColors() > 2048 ) NMaxTableAuto = MXMAPIDS-1;
+     else NMaxTableAuto = 3; 
+     for(k=0; k<NMaxTableAuto; k++)  { 
+        mnom = MapNoms[k]; 
+        mMaps[k] = new PIColorMap(MapIds[k], MapNCols[k], mnom);
+     }
+   }
+
+//  Protection pour valeur de Id  
+   for(kdx=0; kdx<MXMAPIDS; kdx++)  if (id == MapIds[kdx])  break;
+   if (kdx == MXMAPIDS)  { id = MapIds[0];  kdx = 0; }
+   for(k=0; k<NMaxTableAuto; k++)  
+     if (id == mMaps[k]->Type()) {
+       CopyFrom(mMaps[k]);  
+       mCTId = mMaps[k]->mCTId;  mColTNums[mCTId]++;
+       break;
+     }
+   if (Type() != id)  {  // Table pas encore trouve dans la liste
+     k = NMaxTableAuto;
+     if (!mMaps[k] || mMaps[k]->Type() != id) {
+       if ( mMaps[k] ) {  
+         mColTNums[mMaps[k]->mCTId] = 1;  // Je force a liberer les couleurs 
+         delete mMaps[k] ;
+       }
+       mnom = MapNoms[kdx];
+       mMaps[k] = new PIColorMap(MapIds[kdx],  MapNCols[kdx], mnom); 
+     }
+    CopyFrom(mMaps[k]);  
+    mCTId = mMaps[k]->mCTId;  mColTNums[mCTId]++;
+   }
+}
+
+
+PIColorMap::PIColorMap(string const& nom, int nCol)
+: PIColorMapNative(CMAP_OTHER, nCol, nom)
+{
+  MakeColMap();
+  mCTId = CTNum;
+  mColTNums[mCTId] = 1;
+  CTNum++;
+}
+
+PIColorMap::PIColorMap(CMapId id, int nCol, string const& nom)
+: PIColorMapNative(id, nCol, nom)
+{
+  MakeColMap();
+  mCTId = CTNum;
+  mColTNums[mCTId] = 1;
+  CTNum++;
+//  printf("PIColorMap/Debug-Creation:  %d %d - %s ", Type(), NCol(), Nom().c_str());
+//  printf("  ..CRE.. %d %d \n", CTNum-1, mColTNums[CTNum-1]);
+}
+
+PIColorMap::PIColorMap(PIColorMap& cm)
+{
+  CopyFrom(&cm);
+  mCTId = cm.mCTId;
+  mColTNums[mCTId]++;
+}
+
+PIColorMap::~PIColorMap()
+{
+//  printf("PIColorMap/Debug-Delete:  %d %d - %s ", Type(), NCol(), Nom().c_str());
+//  printf("...DEL.CTNum,mColTNums= %d %d (%d %d) ", 
+//        CTNum, mColTNums[CTNum], mCTId,mColTNums[mCTId] );
+  mColTNums[mCTId]--; 
+  if ( mColTNums[mCTId] == 0 )  { FreeColors();  mColTNums[mCTId] = 0; }
+//  printf("\n");
+}
+
+
+
+void PIColorMap::CleanColorMaps()
+{
+  int k;
+  for(k=0; k<MXMAPIDS; k++)  { 
+    if (!mMaps[k])  continue;
+    mMaps[k]->FreeColors();
+    delete mMaps[k];
+  }
+}
+
+/*  Definition d' une table de couleurs  R G B   */
+
+static float R_RGB1[16] =
+{0.0,0.00,0.0,0.0,0.0,0.00,0.0,0.6,0.8,1.0,1.00,1.0,0.75,1.0,0.85,1.0};
+static float G_RGB1[16] =
+{0.0,0.00,0.0,0.8,1.0,1.00,1.0,0.8,0.8,1.0,0.75,0.6,0.00,0.0,0.0,0.0};
+static float B_RGB1[16] =
+{0.0,0.75,1.0,1.0,1.0,0.75,0.0,0.0,0.0,0.0,0.00,0.5,0.75,1.0,0.0,0.0};
+
+
+
+void PIColorMap::MakeColMap()
+{
+  PIColor mycol;
+  int i,j,k;
+
+  switch (mType) {
+
+    case CMAP_GREY32 :
+      for(i=0; i<32; i++) {
+        mycol.red = mycol.green = mycol.blue = 3535+(i*62000/32);
+        for(k=0; k<8; k++)     AllocColor(mycol, i*8+k);
+      }
+      break;
+    
+
+    case CMAP_GREYINV32 :
+      for(i=0; i<32; i++) {
+        mycol.red = mycol.green = mycol.blue = 3535+(i*62000/32);
+        for(k=0; k<8; k++)     AllocColor(mycol, mNCol-(i*8+k)-1);
+      }
+      break;
+
+    case CMAP_COL16 :
+      for(i=0; i<16; i++) {
+        mycol.red = (int)(R_RGB1[i]*65535.);
+        mycol.green = (int)(G_RGB1[i]*65535.);
+        mycol.blue =(int)(B_RGB1[i]*65535.) ;
+        for(k=0; k<16; k++)     AllocColor(mycol, i*16+k);
+      }
+      break;
+
+    case CMAP_COLRJ32 :
+      for( i=0; i<32; i++) {
+        if (i < 12)  { 
+          mycol.green = mycol.blue = 0;  
+          mycol.red = 21535+(i*4000);  }
+        else if (i < 24) { 
+          mycol.blue = 0;   mycol.red = 65535;
+          mycol.green = 21535+(i-12)*4000;  }
+        else { 
+          mycol.green = mycol.red = 65535;
+          mycol.blue = 17535+(i-23)*6000; }
+        for(k=0; k<8; k++)   AllocColor(mycol, i*8+k); 
+        }
+      break;
+
+  case CMAP_COLBR32 :
+    for( i=0; i<32; i++) {
+      if (i < 5) { 
+        mycol.green = mycol.red = 0;    // Du bleu sombre au bleu clair
+        mycol.blue = 5535+i*15000; }
+      else if (i < 10) { 
+        mycol.blue = 65535;             // Plein bleu - On rajoute du vert -> bleu clair
+        mycol.green = 5535+(i-5)*9000;
+        mycol.red = 0;  }
+      else if (i < 15) { 
+        mycol.blue = 60000-(i-10)*15000;   // On passe au vert
+        mycol.green = 41535+(i-10)*6000;
+        mycol.red = 0;  }
+      else if (i < 21) { 
+        mycol.blue = 0;
+        mycol.green = 65535;               // Plein vert, on rajoute du rouge -> jaune
+        mycol.red = 5535+(i-15)*12000;  }
+      else if (i < 27) {  
+        mycol.blue = 0;                     //  On diminue vert -> Orange
+        mycol.green = 60000-(i-21)*12000;
+        mycol.red = 65535-(i-21)*2000;  }
+      else {
+        mycol.blue = 0;                     // Plein rouge
+        mycol.green = 0;
+        mycol.red = 57535+(i-27)*2000; }
+
+      for(k=0; k<8; k++)   AllocColor(mycol, i*8+k); 
+      }
+    break;
+
+  case CMAP_COLRV32 :
+    for( i=0; i<32; i++) {
+      if (i < 8) {
+        mycol.green = 15000+(i*5000); mycol.blue = 0;  
+        mycol.red = 15000+(i*5000); }
+      else if (i < 21) {
+        mycol.green = 50000-(i-7)*5000;   
+        if (mycol.green < 0)  mycol.green = 0;
+        mycol.blue = 0;
+        mycol.red = 53535+(i-8)*1000;  }
+      else { 
+        mycol.green = 0;  mycol.red = 65535;
+        mycol.blue = 15535+(i-21)*5000; }
+
+      for(k=0; k<8; k++)   AllocColor(mycol, i*8+k); 
+      }
+    break;
+
+    case CMAP_GREY128 :
+      for(i=0; i<128; i++) {
+        mycol.red = mycol.green = mycol.blue = 2035+(i*500);
+        for(k=0; k<2; k++)     AllocColor(mycol, i*2+k);
+      }
+      break;
+    
+
+    case CMAP_GREYINV128 :
+      for(i=0; i<128; i++) {
+        mycol.red = mycol.green = mycol.blue = 2035+(i*500);
+        for(k=0; k<2; k++)     AllocColor(mycol, mNCol-(i*2+k)-1);
+      }
+      break;
+
+    case CMAP_COLRJ128 :
+      for( i=0; i<128; i++) {
+        if (i < 48)  { 
+          mycol.green = mycol.blue = 0;  
+          mycol.red = 5375+(i*1280);  }
+        else if (i < 96) { 
+          mycol.blue = 0;   mycol.red = 65535;
+          mycol.green = 5375+((i-48)*1280);  }
+        else { 
+          mycol.green = mycol.red = 65535;
+          mycol.blue = 3535+(i-96)*2000; }
+        for(k=0; k<2; k++)   AllocColor(mycol, i*2+k); 
+        }
+      break;
+
+    case CMAP_COLBR128 :
+      for( i=0; i<128; i++) {
+        if (i < 20) { 
+          mycol.green = mycol.red = 0;  // Du bleu sombre au bleu clair
+          mycol.blue = 2835+i*3300; }
+        else if (i < 36) { 
+          mycol.blue = 65535;           // Plein bleu - On rajoute du vert -> bleu clair
+          mycol.green = 3000+(i-20)*2000;
+          mycol.red = 0;  }
+        else if (i < 56) { 
+          mycol.blue = 64600-(i-36)*3400;    // On passe au vert 
+          mycol.green = 32300+(i-36)*1700;
+          mycol.red = 0;  }
+        else if (i < 81) {         
+          mycol.blue = 0;              // Plein vert, on rajoute du rouge -> jaune
+          mycol.green = 65535;
+          mycol.red = 3135+(i-56)*2600;  }
+        else if (i < 96) { 
+          mycol.blue = 0;
+          mycol.green = 63535-(i-80)*2000;
+          mycol.red = 65535;  }
+        else if (i < 112) { 
+          mycol.blue = 0;
+          mycol.green = 30000-(i-96)*2000;
+          mycol.red = 65535-(i-96)*1000;  }
+        else {
+          mycol.blue = 0;
+          mycol.green = 0 ;
+          mycol.red = 50535+(i-112)*1000; }
+
+        for(k=0; k<2; k++)   AllocColor(mycol, i*2+k); 
+      }
+      break;
+
+  default :
+    for(i=0; i<mNCol; i++) {
+      mycol.green = mycol.red = mycol.blue = 0;
+      AllocColor(mycol, i);
+    }
+    break;
+  }
+}
Index: /branches/EA_Juin98/SophyaPI/PI/picmap.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmap.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmap.h	(revision 108)
@@ -0,0 +1,40 @@
+#ifndef PICMAP_H_SEEN
+#define PICMAP_H_SEEN
+
+#include "pisysdep.h"
+#include PICMAPNTV_H
+
+enum CMapId
+ {
+ CMAP_OTHER       = 0, 
+ CMAP_GREY32      = 1,     // 32 niveaux de gris                    * permanent
+ CMAP_GREYINV32   = 2,     // 32 niveaux gris du blan au noir       * permanent
+ CMAP_COLRJ32     = 3,     // 32 couleurs, du Rouge au Jaune/blanc  * permanent
+ CMAP_COLBR32     = 4,     // 32 couleurs du bleu au rouge
+ CMAP_COLRV32     = 5,     // 32 couleurs 
+ CMAP_GREY128     = 6,     // 128 couleurs  niveaux de gris
+ CMAP_GREYINV128  = 7,     //    "     "      "      " 
+ CMAP_COLRJ128    = 8,     // 128 couleurs du rouge au jaune/blanc
+ CMAP_COLBR128    = 9,     // 128 couleurs du bleu au rouge
+ CMAP_COL16       = 10     // 16 Couleurs Arcenciel
+ };
+
+
+class PIColorMap : public PIColorMapNative {
+public:
+  PIColorMap(CMapId);
+  PIColorMap(string const& nom, int nCol); 
+  PIColorMap(PIColorMap&);
+  virtual ~PIColorMap();
+
+  static void CleanColorMaps();
+
+protected:
+  PIColorMap(CMapId id, int nc, string const& nom);  // Fait l'allocation des couleurs     
+  void     MakeColMap();
+
+  int mCTId;    // Pour tenir trace de la derniere table qui doit liberer les couleurs 
+};
+
+#endif
+
Index: /branches/EA_Juin98/SophyaPI/PI/picmapgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapgen.cc	(revision 108)
@@ -0,0 +1,35 @@
+#include "picmapgen.h"
+#include <list>
+#include <algorithm>
+#include "pisysdep.h"
+#include PICMAPNTV_H
+#include PICMAP_H
+
+
+
+PIColorMapGen::PIColorMapGen()
+{
+  mNom = "";
+  mNCol = 0;
+  mType = -1;
+}
+PIColorMapGen::PIColorMapGen(int id, int nc, string const& nom)
+{
+  mNom = nom;
+  mNCol = nc;
+  mType = id;
+}
+
+
+PIColorMapGen::~PIColorMapGen()
+{
+}
+
+void PIColorMapGen::CopyFromGen(PIColorMapGen* m)
+{
+  mNom = m->mNom;
+  mNCol = m->mNCol;
+  mType = m->mType;
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/picmapgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapgen.h	(revision 108)
@@ -0,0 +1,44 @@
+#ifndef PICMAPBASE_H_SEEN
+#define PICMAPBASE_H_SEEN
+
+#include "pisysdep.h"
+#include <string>
+#include <string.h>
+
+
+ 
+struct PIColor {
+  unsigned short red;
+  unsigned short green;
+  unsigned short blue;
+};
+
+class PIColorMapGen {
+public:
+  PIColorMapGen();  
+  PIColorMapGen(int id, int nc, string const& nom);  
+  virtual ~PIColorMapGen();
+
+  int Type() const          {return mType;}
+  int NCol() const          {return mNCol;}
+  string const& Nom() const {return mNom;}
+
+  virtual PIColor GetColor(int n)=0;
+  virtual bool AllocColor(PIColor const& col, int index)=0;
+  virtual void FreeColors()=0;     // Desalloue les couleurs
+
+  virtual long   TotNbColors()=0;   // Donne le nombre total de couleurs disponibles
+  virtual int   NbAllocColors()=0;  // Nb de couleurs deja allouees 
+protected:
+  void CopyFromGen(PIColorMapGen*);
+  virtual void CopyFrom(PIColorMapGen*)=0;
+  
+
+  int    mNCol;
+  int    mType;
+  string mNom;
+  
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picmapmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapmac.cc	(revision 108)
@@ -0,0 +1,114 @@
+#include "picmapmac.h"
+#include <UDebugging.h>
+
+static int NTotAllocCol;
+
+
+PIColorMapMac::PIColorMapMac()
+: PIColorMapGen(), mPalette(NULL), mCTab(NULL)
+{
+}
+
+PIColorMapMac::PIColorMapMac(int id, int nc, string const& nom) 
+: PIColorMapGen(id, nc, nom)
+{
+    int n = nc+2;
+	mCTab = (CTabHandle) ::NewHandle(sizeof(long) + 
+				sizeof(short) + sizeof(short) + 
+				n*sizeof(ColorSpec));
+	(**mCTab).ctFlags = 0;
+	(**mCTab).ctSeed = GetCTSeed();
+	(**mCTab).ctSize = n;
+    ColorSpec* sp = (**mCTab).ctTable;
+    sp[0].rgb.red   = 0;
+    sp[0].rgb.green = 0;
+    sp[0].rgb.blue  = 0;
+    sp[0].value     = 0;
+    sp[1].rgb.red   = 65535;
+    sp[1].rgb.green = 65535;
+    sp[1].rgb.blue  = 65535;
+    sp[1].value     = 1;
+    for (int i=2; i<n; i++) {
+      sp[i].rgb.red   = 0;
+      sp[i].rgb.green = 0;
+      sp[i].rgb.blue  = 0;
+      sp[i].value     = i;
+    }
+  mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
+}
+
+PIColorMapMac::~PIColorMapMac()
+{
+  DisposePalette(mPalette);
+  DisposeHandle((Handle)mCTab);
+}
+
+/* --Methode-- */
+PIColor PIColorMapMac::GetColor(int n)
+{
+PIColor picr;
+picr.red = picr.green = picr.blue = 0;
+
+if ((n<0) || (n >= NCol()))   
+  return(picr);
+
+RGBColor qdCol;
+GetEntryColor(mPalette,n+2,&qdCol);
+
+picr.red   = qdCol.red;
+picr.green = qdCol.green;
+picr.blue  = qdCol.blue;
+
+return(picr);
+}
+
+
+bool PIColorMapMac::AllocColor(PIColor const& col, int index)
+{
+  if (!mPalette) return false;
+  if ((index < 0) || (index > mNCol))  return(false);
+  
+  RGBColor srcRGB;
+  srcRGB.red   = col.red;
+  srcRGB.green = col.green;
+  srcRGB.blue  = col.blue;
+  
+  SetEntryColor(mPalette,index+2,&srcRGB);
+  ((**mCTab).ctTable)[index+2].rgb = srcRGB;
+  NTotAllocCol++;
+  return true;    //  $CHECK$  retourne true si OK - Reza 01/12/97
+}
+
+long PIColorMapMac::TotNbColors()
+{
+   PixMapHandle pmh = ((CGrafPort*)qd.thePort)->portPixMap;
+   int depth = (**pmh).cmpSize * (**pmh).cmpCount;
+   long nbcol = 1;
+   for (int i=0; i<depth; i++)
+     nbcol *= 2;
+   return nbcol;
+}
+
+void PIColorMapMac::FreeColors()
+{
+  Assert_(mPalette);
+  DisposePalette(mPalette);
+  DisposeCTable(mCTab);
+}
+
+int PIColorMapMac::NbAllocColors()
+{
+return(NTotAllocCol);
+}
+
+
+void PIColorMapMac::CopyFrom(PIColorMapGen* x)
+{
+  CopyFromGen(x);
+  PIColorMapMac* y = (PIColorMapMac*) x;
+  mPalette = y->mPalette;
+  mCTab = y->mCTab;
+  HandToHand(&(Handle)mCTab);
+  HandToHand(&(Handle)mPalette);
+  Assert_(mPalette);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/picmapmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapmac.h	(revision 108)
@@ -0,0 +1,34 @@
+#ifndef PICMAPMAC_H_SEEN
+#define PICMAPMAC_H_SEEN
+
+#include "picmapgen.h"
+#include <Palettes.h>
+
+
+class PIColorMapMac : public PIColorMapGen {
+public:
+  PIColorMapMac();
+  PIColorMapMac(int id, int nc, string const& nom);  
+  ~PIColorMapMac();
+  
+  virtual PIColor GetColor(int n);
+  virtual bool AllocColor(PIColor const& col, int index);   // $CHECK$  Reza 01/12/97(Modif)
+  virtual void FreeColors();
+
+  virtual long  TotNbColors();
+  virtual int   NbAllocColors();
+  
+  CTabHandle    GetCTab() {return mCTab;}
+protected:
+  void CopyFrom(PIColorMapGen*);
+  
+  CTabHandle    mCTab;
+  PaletteHandle mPalette;
+
+  friend class PIColorMapGen;
+  friend class PIPixmapMac;
+};
+
+typedef PIColorMapMac PIColorMapNative;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picmapx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapx.cc	(revision 108)
@@ -0,0 +1,174 @@
+#include <stdio.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#include "piwdgx.h"
+#include "picmapx.h"
+
+/* --Methode-- */
+PIColorMapX::PIColorMapX()    
+: PIColorMapGen()
+{
+mColors = NULL;
+mColRGB = NULL;
+}
+
+/* --Methode-- */
+PIColorMapX::PIColorMapX(int id, int nc, string const& nom)    
+: PIColorMapGen(id, nc, nom)
+{
+
+int n = nc;
+mColors = new PIXColor[n];
+mColRGB = new PIColor[n];
+{for(int i=0; i<n; i++)  
+  { mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
+  mColRGB[i].red = mColRGB[i].green = mColRGB[i].blue = 0; }
+}// printf("PIColorMapX::PIColorMapX(CMapId, int) %d %d \n", mNCol, Type());
+
+return;
+}
+
+
+/* --Methode-- */
+PIColorMapX::~PIColorMapX()
+{
+if (mColors)  delete[] mColors;
+if (mColRGB)  delete[] mColRGB;
+}
+
+
+/* --Methode-- */
+PIColor PIColorMapX::GetColor(int n)
+{
+PIColor picr;
+picr.red = picr.green = picr.blue = 0;
+
+if ((n<0) || (n >= NCol()))   
+  {
+  PIColor picr;
+  picr.red = picr.green = picr.blue = 0;
+  return(picr);
+  }
+return(mColRGB[n]);
+}
+
+static  Colormap  defxcmap;
+static  xinicmap = 0;
+static int NTotColors = 0;
+static int NTotAllocCol = 0;
+
+/* --Methode-- */
+bool PIColorMapX::AllocColor(PIColor const& col, int index)
+{
+XColor myxcol;
+
+if (!xinicmap)  
+  {
+  defxcmap = XDefaultColormap (PIXDisplay(), PIXScreen());
+  xinicmap = 1;
+  }
+
+if ( (index < 0) || (index > mNCol) )  return(false);
+
+if ( (col.red == 0) && (col.green == 0) && (col.blue == 0) )
+  {
+  mColors[index] = BlackPixel(PIXDisplay(), PIXScreen());
+  mColRGB[index] = col; 
+  return(true);
+  }
+
+myxcol.red = col.red; 
+myxcol.blue = col.blue;
+myxcol.green = col.green;
+
+
+if ( XAllocColor(PIXDisplay(), defxcmap, &myxcol) ) {
+  mColors[index] = myxcol.pixel;
+  mColRGB[index] = col; 
+//  printf("PIColorMapX::AllocColor()  RGB= %d %d %d \n",
+//         (int) col.red, (int) col.blue, (int) col.green);
+  NTotAllocCol++;  
+  return(true);
+  }
+else {
+  printf("PIColorMapX::AllocColor() Error: Pb Allocation RGB= %d %d %d \n",
+         (int) col.red, (int) col.blue, (int) col.green);
+  return(false);
+  }
+}
+
+/* --Methode-- 
+void PIColorMapX::MakeColMap()
+{
+}
+*/
+
+/* --Methode-- */
+void PIColorMapX::FreeColors()
+{
+PIXColor bpix;
+PIColor blc;
+
+if (!xinicmap)  
+  {
+  defxcmap = XDefaultColormap (PIXDisplay(), PIXScreen());
+  xinicmap = 1;
+  }
+
+for (int i=0; i<mNCol; i++)
+  if ( (mColRGB[i].red != 0) && (mColRGB[i].blue != 0) &&  (mColRGB[i].green != 0) )
+    XFreeColors(PIXDisplay(), defxcmap, mColors+i, 1, 0);
+
+bpix = BlackPixel(PIXDisplay(), PIXScreen());
+blc.red = blc.green = blc.blue = 0;
+{for (int i=0; i<mNCol; i++)  
+  { mColors[i] = bpix;   mColRGB[i] = blc; }
+}
+printf("PIColorMapX::FreeColors()  Type= %d mNCol= %d \n",
+       Type(), NCol());
+
+}
+
+
+/* --Methode-- */
+long PIColorMapX::TotNbColors()
+{
+if (NTotColors > 0)  return(NTotColors);
+// Visual* vis;
+// DefaultVisual(PIXDisplay(),  PIXScreen() );
+int k,kk;
+// On calcule le nombre de couleurs a partir du nb de plans image
+kk = DefaultDepth(PIXDisplay(),  PIXScreen() );
+NTotColors = 1;
+for(k=0; k<kk; k++) NTotColors *= 2;
+/*
+ printf("PIColorMapX::TotNbColor() / Debug : Nb Tot Colors = %d - D=%d - NCol=%d NP= %d \n", NTotColors, 
+ DefaultDepth(PIXDisplay(),  PIXScreen()), 
+ DisplayCells(PIXDisplay(),  PIXScreen()), 
+ DisplayPlanes(PIXDisplay(),  PIXScreen()) );
+*/
+return(NTotColors);
+}
+
+/* --Methode-- */
+int PIColorMapX::NbAllocColors()
+{
+return(NTotAllocCol);
+}
+
+
+/* --Methode-- */
+void PIColorMapX::CopyFrom(PIColorMapGen* x)
+{
+  if (mColors)  delete mColors;
+  if (mColRGB)  delete mColRGB;
+  CopyFromGen(x);
+  mColors = new PIXColor[mNCol];
+  mColRGB = new PIColor[mNCol];
+  for (int i=0; i<mNCol; i++)  
+    { mColors[i] = ((PIColorMapX *)x)->mColors[i];
+    mColRGB[i] = ((PIColorMapX *)x)->mColRGB[i]; }
+}
Index: /branches/EA_Juin98/SophyaPI/PI/picmapx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picmapx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picmapx.h	(revision 108)
@@ -0,0 +1,34 @@
+#ifndef PICMAPX_H_SEEN
+#define PICMAPX_H_SEEN
+
+#include "picmapgen.h"
+
+typedef   unsigned long PIXColor ;
+
+
+class PIColorMapX : public PIColorMapGen {
+public:
+  PIColorMapX();  
+  PIColorMapX(int id, int nc, string const& nom);  
+  virtual ~PIColorMapX();
+
+  inline PIXColor  Color(int index) 
+    { return ((index < mNCol) ? mColors[index] : 0); } ;
+
+  virtual PIColor GetColor(int n);
+  virtual bool AllocColor(PIColor const& col, int index);
+  virtual void FreeColors();
+
+  virtual long TotNbColors();
+  virtual int  NbAllocColors();
+
+protected:
+  virtual void CopyFrom(PIColorMapGen*);
+  
+  PIXColor  * mColors;     // La table des couleurs ...
+  PIColor   * mColRGB;     // Composantes RGB  
+};
+
+typedef PIColorMapX PIColorMapNative;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picons.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picons.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picons.cc	(revision 108)
@@ -0,0 +1,887 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "pisysdep.h"
+#include PIMENU_H
+#include "picons.h"
+
+
+// #define DEBUG_PICONS 1
+
+//  Le menu qui va servir a changer de fontes, couleurs, ...
+// de bouton-3
+static PIPUMenu* opmc=NULL;
+static int nb_opmc = 0;
+
+/*  --------------------------------------------------------------------------------- */
+/*  ---------  Classe PIConsole : I/O (Ecriture/lecture) texte standard  ------------ */
+/*  --------------------------------------------------------------------------------- */
+
+static int CmdStrLen = 256;
+static int PIVA_Select = 128;
+
+/* --Methode-- */
+PIConsole::PIConsole(PIContainer* par, char* nom, PIMessage msg,
+                     int nl, int nc, int sx, int sy, int px, int py, bool scb) :
+PIBaseWdg(par, nom, sx, sy, px, py) 
+{
+mNL = (nl > 10) ? nl : 10;
+mNC = (nc > 40) ? nc : 40;
+mText = new char[mNL*mNC];
+mAtt = new unsigned char[mNL*mNC];
+mLPo = new int[mNL];
+mStrBuf = new char[mNC+1];
+mCmdStr = new char[CmdStrLen+1];
+mCCP = mCLC = 0;
+mDCOff = 0;
+
+SetMsg(msg);
+
+int i;
+for(i=0; i<mNL; i++) {
+  mLPo[i] = i*mNC;
+  ClearLine(i);
+  }
+
+mOffL = 0;
+mNCmdL = 0;
+
+// Pile de rappel des commandes 
+mRStr = NULL;
+mNComm = NMxRecall = 0;
+mRCindx = mRindx = 0;
+
+// Copier/coller
+mCPBuffer = NULL;
+mCPBufLen = 0;
+mCPbeginC =  mCPendC = -1;
+mCPbeginL = mCPendL = -1;
+
+SetPrompt("Cmd> ");
+ClrCmd();
+SelectFont();
+SelFgBgCol();
+mCurL = mNL-mWSzL-1; 
+mCurC = 0;
+
+// Pour ajouter un scroll-bar
+AssocScrollBar(par, nom, scb, sx, sy, px, py);
+
+// Pour le menu des options : Fontes, couleur, ...
+if (!opmc) {
+  opmc = new PIPUMenu((PIMsgHandler *)this, "OptCons");
+  opmc->AppendItem("SmallFont", 3101);
+  opmc->AppendItem("NormalFont", 3102);
+  opmc->AppendItem("LargeFont", 3103);
+  opmc->AppendItem("White-Black", 3201);
+  opmc->AppendItem("Black-White", 3202);
+  opmc->AppendItem("Black-Yellow", 3203);
+  }
+nb_opmc++;
+
+ActivateKeyboard();  // Gestion de l'edition 
+ActivateButton(1);   //  Action selection / copier - coller 
+ActivateMove(1);     //      "    "     "  
+ActivateButton(2);   //      "    "     "  
+ActivateButton(3);   // Pour afficher le menu des options (Fontes/couleur)
+Manage();
+return;
+}
+
+/* --Methode-- */
+PIConsole::~PIConsole()
+{
+delete[] mText;
+delete[] mAtt;
+delete[] mLPo;
+delete[] mStrBuf;
+delete[] mCmdStr;
+if (mScb) delete mScb;
+nb_opmc--;
+if (nb_opmc == 0) { delete opmc;  opmc=NULL; }
+}
+
+/* --Methode-- */
+void PIConsole::AddChar(char c, unsigned char va, bool ref)
+{
+int l1, l2;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+else l1 = l2 = mCurL; 
+if (c == '\n') {
+  mCurC = 0;
+  mCurL++;   
+  }
+else {
+  mText[mLPo[mCurL]+mCurC] = c;
+  mAtt[mLPo[mCurL]+mCurC] = va;
+  if (++mCurC == mNC) {mCurC = 0;  mCurL++; }
+  }
+
+if (mCurL >= (mNL-mNCmdL) ) { // Il faut scroller 
+  ScrollUp();
+  mCurL = mNL-mNCmdL-1;
+  l1 = mNL-mWSzL-1; 
+}
+if (l2 < mCurL) l2 = mCurL;
+if (ref) DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+
+/* --Methode-- */
+void PIConsole::AddStr(char* strg, unsigned char va, bool ref)
+{
+int l1, l2;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+else l1 = l2 = mCurL; 
+
+char c;
+while ( (c = *strg) != '\0') {
+  if ( c != '\n' ) {
+    mText[mLPo[mCurL]+mCurC] = c;
+    mAtt[mLPo[mCurL]+mCurC] = va;
+    if (++mCurC == mNC) {mCurC = 0;  mCurL++; }
+    }
+  else { mCurL++; mCurC = 0; } 
+  if (mCurL >= (mNL-mNCmdL) ) { // Il faut scroller 
+    ScrollUp();
+    mCurL = mNL-mNCmdL-1;
+    }
+  strg++;
+  }
+
+if (l2 < mCurL) l2 = mCurL;
+if (ref) DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SelectFont(PIFontSize sz)
+{
+int asc, desc;
+mWGrC->SelFont(sz);
+mFTaille = sz;
+mFHaut = mWGrC->GetFontHeight(asc, desc);
+mFLarg = (int)mWGrC->CalcStringWidth("ABCDEFGHIJ")/10;
+mWSzL = YSize()/mFHaut - 1;
+mWSzC = XSize()/mFLarg - 2;
+mOffL = 0;
+if (mScb) {
+  mScb->SetMinMax(0, NbLines()-1);
+  mScb->SetSlSize(WindNbLines());
+  mScb->SetValue(NbLines()-WindNbLines()-1);
+  }
+}
+
+/* --Methode-- */
+void PIConsole::AutoSize()
+{
+int dsz[2];
+dsz[0] = (mNC+2)*mFLarg - XSize();
+dsz[1] = (mWSzL+1)*mFHaut - YSize();
+Send(Msg(), PIMsg_ResizeRequest, dsz);
+SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut);
+}
+
+/* --Methode-- */
+void PIConsole::PreferedSize(int& sx, int& sy)
+{
+sx = (mNC+2)*mFLarg;
+sy = (mWSzL+1)*mFHaut;
+return;
+}
+
+/* --Methode-- */
+void PIConsole::AcceptCmd(bool acc, int nmxrec)
+{
+int l1, l2;
+if (acc) {
+  if (mNCmdL)  return;  // Pas de changement d'etat
+  if (mCurL == (mNL-1) ) { l1 = mNL-mWSzL-1; ScrollUp(); mCurL = (mNL-2); }
+  else l1 = mNL-1;
+  mNCmdL = 1;
+  ClrCmd();
+  UpdCmdLine();
+  l2 = mNL-1;
+  if (nmxrec > 0) {
+    NMxRecall = (nmxrec > 5) ? nmxrec : 5;
+    mRStr = new string[NMxRecall];
+    mNComm = mRCindx = mRindx = 0;
+    }
+  }
+else {
+  if (mNCmdL == 0)  return;  // Pas de changement d'etat
+  mNCmdL = 0;
+  ClearLine(mNL-1);
+  ClrCmd();
+  l1 = l2 = mNL-1;
+  delete[] mRStr;
+  mRCindx = mRindx = 0;
+  }
+DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SetPrompt(char* prompt)
+{
+strncpy(mPrompt, prompt, 31);  
+mPrompt[31] = '\0';
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SetDispOffset(int ldeb)
+{
+if (ldeb < 0)    { 
+  if (mScb) mScb->SetValue(NbLines()-WindNbLines()-1);
+  mOffL = 0;
+}
+else if (ldeb >= mNL-mWSzL-1)  mOffL = 0;
+else mOffL = (mNL-mWSzL-1)-ldeb;
+if (mOffL < 0)  mOffL = 0;
+}
+
+
+/* --Methode-- */
+void PIConsole::Resize()
+{
+mWSzL = YSize()/mFHaut - 1;
+mWSzC = XSize()/mFLarg - 2;
+if (mScb) {
+  mScb->SetMinMax(0, NbLines()-1);
+  mScb->SetSlSize(WindNbLines());
+  mScb->SetValue(NbLines()-WindNbLines()-1);
+  }
+mOffL = 0;
+}
+
+/* --Methode-- */
+void PIConsole::Draw(PIGraphicGen* g)
+{
+EraseWindow();
+DisplayLines(g, 0, mNL);
+}
+
+
+/* --Methode-- */
+void PIConsole::Keyboard(int key, PIKeyModifier kmod)
+{
+
+if (kmod == PIKM_Alt) {
+  if (key == 'O' || key == 'o') {   // Menu des options 
+    opmc->SetMsgParent((PIMsgHandler*)this);
+    opmc->Show(); 
+    return;
+    }
+  else if (key == 'A' || key == 'a') {  // Pour tout selectionner
+    mCPbeginC = 0; mCPendC = XSize(); 
+    mCPbeginL = 0;  mCPendL = YSize(); 
+    SaveSelection();
+    return;
+    }
+  }
+
+if (mNCmdL < 1)  return;
+
+int k;
+bool fgfk = false;
+
+if (kmod == PIKM_Cntl) {
+  switch (key) {
+    case 1 :  // <Cntl> A
+      mCCP = 0;
+      break;
+    case 5 :  // <Cntl> E
+      mCCP = mCLC;
+      break;
+    case 11 :  // <Cntl> K
+      mCLC = mCCP;
+      break;
+    }
+  }
+
+else if (kmod == PIKM_Alt) {
+  if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller)
+  }
+
+else if (kmod == PIKM_Blank) {
+  switch (key) {
+    case PIK_Return :    
+    case PIK_Enter :
+      mCmdStr[mCLC] = '\0';
+//      printf("Process()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
+
+// Gestion de rappel des commandes 
+      mRStr[mRCindx] = mCmdStr;
+      mRCindx++;  mNComm++;
+      if (mRCindx >= NMxRecall)  mRCindx = 0;
+      mRindx = mRCindx;
+      
+      Send( Msg(), PIMsg_OK, mCmdStr);
+      ClrCmd();
+      break;
+
+    case PIK_BackSpace :
+    case 127 :    // Touche del
+    case 8 :      // Touche backspace
+      if (mCCP > 0)  { 
+        for(k=mCCP-1; k<mCLC-1; k++)  mCmdStr[k] = mCmdStr[k+1];
+        mCmdStr[mCLC-1] = ' ';   mCCP--;  mCLC--;
+      }
+      //      printf("Process()-Debug- Backspace CCP,CLC= %d %d CmdStr= %s (L=%d) \n", mCCP, mCLC, 
+      //      mCmdStr, strlen(mCmdStr));
+      break;
+      
+    case PIK_Up :
+    case PIK_Down :
+//      printf("Process()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
+      if (mNComm > 0) {
+        int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall;
+        if (key == PIK_Up)  {
+          mRindx--; 
+          if (mRindx < 0)  mRindx = 0;
+          }
+        else { 
+          mRindx++;
+          if (mRindx >= nmxrec) mRindx= nmxrec-1;
+          }
+        mCLC = mCCP = mRStr[mRindx].length();
+        for(k=0; k< mCLC; k++)  mCmdStr[k] =  mRStr[mRindx][k];
+        mCmdStr[mCLC] = '\0';      
+        }      
+      break;
+
+    case PIK_Left :
+      if (mCCP > 0)  mCCP--;
+      //      printf("Process()-Debug- Left CCP,CLC= %d %d  \n", mCCP, mCLC);
+      break;
+    case PIK_Right :
+      if (mCCP < mCLC)  mCCP++;
+      //      printf("Process()-Debug- Right CCP,CLC= %d %d  \n", mCCP, mCLC);
+      break;
+    default :
+      fgfk = true;
+      break;
+    }
+  }
+if ( ( fgfk && (kmod == PIKM_Blank) ) || (kmod == PIKM_Shift)  ) CmdAddChar(key);
+UpdCmdLine();
+// DisplayLines(mNL-1, mNL-1);
+return;
+}
+
+/*   Pour debugger le code - Reza 23/02/98 
+#ifdef DEBUG_PICONS
+static int lines = 0;
+if ( (kmod == PIKM_Alt) ) {
+  char buff[128];
+  int l = 0;
+  switch (toupper(key)) {
+  case 'P' :
+    DebugPrint(1);
+    break;
+  case 'H' :
+    DebugPrint(0);
+    break;
+  case 'J' :
+     AddChar('\n');
+    DebugPrint(0);
+     break;     
+  case 'R' :
+    for(l=0; l<1; l++) {
+      sprintf(buff, "Line type Reverse No %d ", lines);
+      AddStr(buff, PIVA_Reverse, false);
+      sprintf(buff, "Normal  ");
+      AddStr(buff, PIVA_Def, false);
+      sprintf(buff, "Bold  ");
+      AddStr(buff, PIVA_Bold, false);
+      lines++;
+    }   
+    Refresh();
+    break;
+  
+  case 'B' :
+    for(l=0; l<3; l++) {
+      sprintf(buff, "Line type Bold No %d \n", lines);
+      AddStr(buff, PIVA_Bold, false);
+      lines++;
+    }   
+    Refresh();
+    break;
+  
+  case 'I' :
+    for(l=0; l<3; l++) {
+      sprintf(buff, "Line type Italique No %d \n", lines);
+      AddStr(buff, PIVA_Ital, false);
+      lines++;
+    }   
+    Refresh();
+    break;
+  
+  case 'N' :
+    for(l=0; l<3; l++) {
+      sprintf(buff, "Line type Normal No %d \n", lines);
+      AddStr(buff, PIVA_Def, false);
+      lines++;
+    }   
+    Refresh();
+    break;
+  }
+}
+#endif
+*/
+
+/* --Methode-- */
+void PIConsole::But1Press(int x, int y)
+{
+Send(Msg(), PIMsg_Active);
+AssignKeyboard();
+mWGrC->SelGOMode(PI_GOXOR);
+mWGrC->SelForeground(PI_Grey);
+mCPbeginC = x;  mCPbeginL = y;
+mCPendC = mCPendL = -1;
+} 
+
+/* --Methode-- */
+void PIConsole::Ptr1Move(int x, int y)
+{
+if (mCPendC >= 0) mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+mCPendC = x;  mCPendL = y;
+mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+}
+ 
+/* --Methode-- */
+void PIConsole::But1Release(int x, int y)
+{
+if ( (mCPendC >= 0) && (mCPbeginC >= 0) ) { 
+  mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+  mCPendC = x;  mCPendL = y;
+  }
+else { 
+  mCPbeginC =  mCPendC = -1;
+  mCPbeginL = mCPendL = -1;
+  }
+mWGrC->SelGOMode(PI_GOCopy);
+mWGrC->SelForeground(mFgC);
+SaveSelection();
+} 
+
+/* --Methode-- */
+void PIConsole::But2Press(int x, int y)
+{
+RequestSelection();  // Pour recuperer la selection = coller (copier/coller)
+} 
+
+/* --Methode-- */
+void PIConsole::But3Press(int x, int y)
+{
+opmc->SetMsgParent((PIMsgHandler*)this);
+opmc->Show((PIWdg*)this, x, y);
+}
+
+/* --Methode-- */
+void PIConsole::PasteSelection(unsigned int typ, void *pdata, unsigned int l)
+{
+if (typ != PICP_string) return;
+int i;
+char *pc = (char *)pdata;
+for(i=0; i<l; i++) CmdAddChar(pc[i]);
+UpdCmdLine();
+}
+
+/* --Methode-- */
+void PIConsole::SelectionLost()
+{
+// printf("Debug PIConsole::SelectionLost() %lx (L=%d)\n",(long)mCPBuffer, mCPBufLen);
+if (!mCPBuffer) return;
+delete[] mCPBuffer;  
+mCPBuffer = NULL;
+mCPBufLen = 0;
+mCPbeginC =  mCPendC = -1;
+mCPbeginL = mCPendL = -1;
+int i,j;
+int l1,l2;
+l1 = mNL+1; l2 = -1;
+for(i=0; i<mNL; i++)   // On enleve le bit select a tous les caracteres 
+  for(j=0; j<mNC; j++) 
+    if ( mAtt[mLPo[i]+j] & PIVA_Select) {
+      if (l1 > i)  l1 = i;
+      if (l2 < i)  l2 = i;
+      mAtt[mLPo[i]+j] &= ~PIVA_Select ;
+    }
+
+if (IsVisible() && l2 > -1)  DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SelectionTransferEnd()
+{
+// printf("Debug PIConsole::SelectionTransferEnd() -Rien- %lx (L=%d)\n",(long)mCPBuffer, mCPBufLen);
+}
+
+
+/* --Methode-- */
+void * PIConsole::ProvideSelection(unsigned int& typ, unsigned int& len)
+{
+typ = PICP_string;
+len = mCPBufLen;
+return(mCPBuffer);
+}
+
+/* ----------------------------------------------------------------------------- */
+/*    ---------------------- Methodes protected -------------------------        */
+/* ----------------------------------------------------------------------------- */
+
+
+/* --Methode-- 
+void PIConsole::DebugPrint(int lp)
+{
+printf("PIConsole::DebugPrint() - NL,NC= %d %d - WSzL,C= %d %d Cur= %d %d\n", mNL, mNC, 
+        mWSzL, mWSzC, mCurL, mCurC);
+printf(" OffL, NCmdL= %d %d - mCCP, mCLC= %d %d - LPo= %d %d \n", 
+        mOffL, mNCmdL, mCCP, mCLC, mLPo[mNL-2], mLPo[mNL-1]);
+
+if (lp == 0)  return;
+int i,j;
+for(j=0; j<mNL; j++) {
+  printf("Line[%d] (%d) = ", j, mLPo[j]);
+  for(i=0; i<mNC; i++)  putchar(mText[mLPo[j]+i]);
+  putchar('\n');
+  }
+return;
+}
+*/
+
+//  Gestion du scroll-bar
+static int Scb_Width = 14;
+
+/* --Methode-- */
+void PIConsole::AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py)
+{
+if (!scb) {
+  mScb = NULL;
+  msgScb = 0;
+  SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+  return;   
+}
+
+sx -= Scb_Width;
+SetSize(sx, sy);
+SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+char name[128];
+strcpy(name,"ScrollBar_");
+strncat(name, nom, 127);
+msgScb = Msg()+55;
+mScb = new PIScrollBar (par, name, msgScb, true, Scb_Width, sy, px+sx, py);
+mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+  
+mScb->SetMsgParent(this);
+mScb->SetMinMax(0, NbLines()-1);
+mScb->SetSlSize(WindNbLines());
+mScb->SetValue(NbLines()-WindNbLines()-1);
+}
+
+/* --Methode-- */
+void PIConsole::ScrollUp()
+{
+int i,l,kpo;
+l = mNL-1-mNCmdL;
+kpo = mLPo[0];
+for(i=0; i<mNL-mNCmdL-1; i++)   mLPo[i] = mLPo[i+1];
+mLPo[l] = kpo;
+ClearLine(l);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::ClearLine(int l)
+{
+if ((l<0) || (l >= mNL)) return;
+int j;
+for(j=0; j<mNC; j++) {
+  mText[mLPo[l]+j] = ' ';
+  mAtt[mLPo[l]+j] = PIVA_Def;
+  }
+return;
+}
+
+/* --Methode-- */
+void PIConsole::DisplayLines(PIGraphicGen* g, int l1, int l2)
+{
+int j,l,k,l0;
+int x,y;
+
+// printf("PIConsole::DisplayLines(%d %d ) \n ", l1, l2);
+
+if (! IsVisible() )   return;
+
+int lva = -1;
+
+PIFontAtt vafat[8] = {PI_RomanFont, PI_BoldFont, PI_ItalicFont,
+                      PI_RomanFont, PI_RomanFont, PI_BoldFont, 
+                      PI_ItalicFont, PI_RomanFont};
+PIColors fgc, bgc, dbgc;
+
+g->SelForeground(mFgC);
+g->SelBackground(mBgC);
+fgc =  g->GetForeground();
+dbgc = bgc =  g->GetBackground();
+
+int dx = mFLarg;
+int dy = mFHaut/2;
+int dxo2 = dx/2;
+if (dxo2 > 3)  dxo2 = 3;
+int dyo2 = dy/2;
+if (dyo2 > 3)  dyo2 = 3;
+
+g->DrawBox(dxo2, dyo2, (mNC+2)*mFLarg-2*dxo2, (mWSzL+1)*mFHaut-dyo2);
+
+l0 = mNL-mWSzL-mOffL;
+if (l0 < 0) l0 = 0;
+if (l1 < l0) l1 = l0;
+if (++l2 > mNL-mOffL) l2 =  mNL-mOffL;
+
+for(l=l1; l<l2; l++) {
+ y = (l-l0+1)*mFHaut+dy;
+ k = 0;   x = dx;
+ for(j=0; j<mNC; j++) {
+   if (mAtt[mLPo[l]+j] != lva) {
+     if (k > 0) {
+       mStrBuf[k] = '\0';     
+       g->DrawOpaqueString(x, y, mStrBuf);
+       //     printf("l,J,K=%d %d %d - X,Y= %d %d - %s \n", l,j,k,x,y,mStrBuf);
+       x += k*mFLarg;  k = 0;  
+       }
+     lva = mAtt[mLPo[l]+j];
+     if (lva & PIVA_Select) 
+       { bgc = PI_Grey;   g->SelFont(mFTaille, vafat[lva-PIVA_Select]); }
+     else { bgc = dbgc; g->SelFont(mFTaille, vafat[lva]); }
+     
+     if (lva & PIVA_Reverse) { 
+       g->SelForeground(bgc);
+       g->SelBackground(fgc);
+       }
+     else  { 
+       g->SelForeground(fgc);
+       g->SelBackground(bgc);
+       }
+     }
+   mStrBuf[k] = mText[mLPo[l]+j];
+   k++;
+   }
+   if (k > 0) {
+     mStrBuf[k] = '\0';     
+     g->DrawOpaqueString(x, y, mStrBuf);
+     //     printf("l,J,K=%d %d %d - X,Y= %d %d - %s \n", l,j,k,x,y,mStrBuf);
+   }
+ }
+
+g->SelForeground(fgc);
+g->SelBackground(dbgc);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::UpdCmdLine()
+{
+//  char strg[260];  debug
+int l1,l2;
+l1 = l2 = mNL-1;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+
+ClearLine(mNL-1);
+int j1,j2,j,jj2;
+j1 = strlen(mPrompt);
+for(j=0; j<j1; j++) {
+  mText[mLPo[mNL-1]+j] = mPrompt[j];
+  mAtt[mLPo[mNL-1]+j] = PIVA_Def;
+//  strg[j] = mPrompt[j];    debug
+  }  
+jj2 = mWSzC-j1;
+if (mDCOff>=mCCP) mDCOff = 0;
+int koff = ((mCCP-mDCOff) >= jj2) ? mCCP-(jj2/2) : mDCOff;
+mDCOff = koff;
+int kmx = mCLC-koff;
+j2 = j1+kmx;
+if (j2 > mWSzC)  j2 = mWSzC;
+int k = koff;
+for(j=j1; j<j2; j++) {
+  mText[mLPo[mNL-1]+j] = mCmdStr[k];
+  mAtt[mLPo[mNL-1]+j] = PIVA_Bold;
+//  strg[j] = mCmdStr[k];   debug 
+  k++;
+  }  
+
+// strg[j] = '\0';   Debug
+// printf("UpdCmdLine() %d %d - %s (%d) \n [%d %d %d] %d\n", koff,kmx,strg,j1+mCCP-koff, mWSzC, j1, jj2, mCCP-(jj2/2));
+mAtt[mLPo[mNL-1]+j1+mCCP-koff] = PIVA_Reverse;    // Pour le curseur
+DisplayLines(mWGrC, l1, l2);
+}
+
+/* --Methode-- */
+void PIConsole::ClrCmd() 
+{ 
+mCCP = 0; mCLC = 0; mDCOff = 0;
+mCmdStr[0] = '\0'; 
+}  
+
+/* --Methode-- */
+void PIConsole::CmdAddChar(int key)
+{
+  int k, kmx;
+  if ( (mCCP < CmdStrLen) && isprint(key) ) {   // Ajout de caracteres
+    if (mCCP < mCLC)  { // Insertion au milieu de la chaine
+      kmx = (mCLC < CmdStrLen) ? mCLC : CmdStrLen-1;
+      //      printf(" ++DBG++ C=%d L=%d MX=%d KMX=%d\n", mCCP, mCLC, CmdStrLen,kmx);
+      for(k=kmx; k>mCCP; k--) mCmdStr[k] = mCmdStr[k-1];   mCLC = kmx+1;      
+    }
+    mCmdStr[mCCP] = key;  mCCP++; 
+    if (mCCP > mCLC)  mCLC = mCCP;
+    }
+}
+
+
+/* --Methode-- */
+void PIConsole::SelFgBgCol(PIColors fc, PIColors bc)
+{
+mFgC = fc; mBgC = bc;
+SetBackgroundColor(bc);
+}
+
+
+/* --Methode-- */
+void PIConsole::SaveSelection()
+{
+int i,j,k,l;
+int l1, l2, nl, nc;
+
+if (mCPbeginC > mCPendC) { j = mCPbeginC; mCPbeginC = mCPendC ; mCPendC = j; }
+if (mCPbeginL > mCPendL) { j = mCPbeginL; mCPbeginL = mCPendL ; mCPendL = j; }
+
+nc = (mCPendC-mCPbeginC)/mFLarg;
+nl = (mCPendL-mCPbeginL)/mFHaut;
+// printf("*DBG* NC=%d NL=%d \n",nc, nl); 
+l1 = mNL+1; l2 = -1;
+
+if (mCPBuffer) {
+  delete[] mCPBuffer;  
+  mCPBuffer = NULL;
+  mCPBufLen = 0;
+  for(i=0; i<mNL; i++)   // On enleve le bit select a tous les caracteres 
+    for(j=0; j<mNC; j++) 
+      if ( mAtt[mLPo[i]+j] & PIVA_Select) {
+        if (l1 > i)  l1 = i;
+        if (l2 < i)  l2 = i;
+        mAtt[mLPo[i]+j] &= ~PIVA_Select ;
+      }
+  }
+
+// printf("**DBG** Save: C= %d %d  L = %d %d \n", mCPbeginC, mCPendC, mCPbeginL, mCPendL);
+
+
+// On transforme la position sur la fenetre en position en caracteres ds les buffers
+
+mCPbeginC = mCPbeginC/mFLarg-1;
+mCPendC = (int) ( (float)mCPendC/(float)mFLarg-0.8 );
+mCPbeginL = (int) ( (float)mCPbeginL/(float)mFHaut-0.5 ) ;
+mCPendL = (int) ( (float)mCPendL/(float)mFHaut-0.3 ) ;
+// printf("..DBG.. C= %d %d  L = %d %d ", mCPbeginC, mCPendC, mCPbeginL, mCPendL);
+j = mNL-mWSzL-mOffL;
+mCPbeginL += j;  mCPendL += j;
+// printf(" -> %d %d \n", mCPbeginL, mCPendL);
+
+if (mCPbeginC < 0) mCPbeginC = 0;
+if (mCPendC > mNC) mCPendC = mNC;
+if (mCPbeginL < 0) mCPbeginL = 0;
+if (mCPendL > mNL) mCPendL = mNL;
+
+if ( (nc > 0) && (nl > 0) ) {
+if (!ClaimSelection()) { 
+  mCPbeginC = mCPendC = -1;
+  mCPbeginL = mCPendL = -1;
+  if (l2 > -1) DisplayLines(mWGrC, l1, l2);  
+  return;
+  }
+  l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL);
+  if (l < 0) l = 0;
+  mCPBufLen = l;
+  mCPBuffer = new char[l+1];  
+  k = 0;  
+  for(j=mCPbeginL; j<mCPendL; j++) { 
+    for(i=mCPbeginC; i<mCPendC; i++)  { 
+      mAtt[mLPo[j]+i] |= PIVA_Select;
+      mCPBuffer[k] = mText[mLPo[j]+i]; k++; 
+      }
+    mCPBuffer[k] = '\n'; k++;
+    }
+  mCPBuffer[l] = '\0';
+  if (l1 > mCPbeginL) l1 = mCPbeginL;
+  if (l2 < (mCPendL-1))  l2 = mCPendL-1;
+  }
+else {  
+  l = 0;   
+  mCPbeginC =  mCPendC = mCPbeginL = mCPendL = -1; 
+  mCPBufLen = 0;
+  mCPBuffer = new char[10];  
+  mCPBuffer[0] = mCPBuffer[1] = '\0';
+  }
+
+//  printf("*DBG* Save_Display %d %d \n", l1, l2);
+
+if (l2 > -1) DisplayLines(mWGrC, l1, l2);
+}
+
+/* --Methode-- */
+void PIConsole::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+int off;
+// printf("PIConsole::Process() UserMsg()= %d ModMsg= %d \n", (int)UserMsg(msg), 
+//        (int)ModMsg(msg) );
+
+if (sender == opmc) { // Menu des options 
+  bool fgr = true;
+  switch (UserMsg(msg)) {
+    case 3101 :
+      SelectFont(PI_SmallSizeFont);
+      AutoSize();
+      break;
+    case 3102 :
+      SelectFont(PI_NormalSizeFont);
+      AutoSize();
+      break;
+    case 3103 :
+      SelectFont(PI_BigSizeFont);
+      AutoSize();
+      break;
+    case 3201 :
+      SelFgBgCol(PI_Black, PI_White);
+      break;
+    case 3202 :
+      SelFgBgCol(PI_White, PI_Black);
+      break;
+    case 3203 :
+      SelFgBgCol(PI_Yellow, PI_Black);
+      break;
+    default :
+      fgr = false;
+      break;
+    }
+  if (fgr) Refresh();
+  }
+// Le traitement du scroll-bar
+else if ((ModMsg(msg) == PIMsg_DataChanged) && (UserMsg(msg) == msgScb) ) {
+  off = * ((int *)data);
+//  printf(" PIConsole::Process() From ScrollBar : Off=%d \n ", off);
+  SetDispOffset(off);
+  Refresh();
+  }
+// Sinon, on retranmet le message
+else ReSend(msg, sender, data); 
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/picons.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picons.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picons.h	(revision 108)
@@ -0,0 +1,102 @@
+#ifndef PICONSOLE_H
+#define PICONSOLE_H
+
+#include "pisysdep.h"
+
+#include PISTDWDG_H 
+#include PICONT_H
+#include PIBWDG_H
+
+enum PIVAType {    
+  PIVA_Def = 0,
+  PIVA_Bold = 1,
+  PIVA_Ital = 2,
+  PIVA_Reverse = 4
+};
+
+class PIConsole : public PIBaseWdg {
+public:
+                     PIConsole(PIContainer* par, char* nom, PIMessage msg, int nl, int nc, 
+                               int sx=300, int sy=200, int px=0, int py=0, bool scb=true);
+                     ~PIConsole();
+
+// Interface d utilisation : 
+          void       AddChar(char c, unsigned char va= PIVA_Def, bool ref=true);
+          void       AddStr(char* strg, unsigned char va= PIVA_Def, bool ref=true);
+
+          void       SelectFont(PIFontSize sz=PI_NormalSizeFont);
+          void       AutoSize();
+          void       PreferedSize(int& sx, int& sy);
+          void       AcceptCmd(bool acc=true, int nrecmx=20);
+          void       SetPrompt(char* prompt); 
+
+  inline  int        WindNbLines() { return mWSzL; }
+  inline  int        NbLines() { return mNL; }          
+  inline  string     GetCmdString() { mCmdStr[mCLC] = '\0'; return((string)mCmdStr); }
+
+// Gestion des evenements input/draw 
+  virtual void       Draw(PIGraphicGen* g);
+  virtual void       Resize();
+  virtual void       Keyboard(int key, PIKeyModifier kmod);
+  virtual void       But1Press(int x, int y);
+  virtual void       Ptr1Move(int x, int y);
+  virtual void       But1Release(int x, int y);
+  virtual void       But2Press(int x, int y);
+  virtual void       But3Press(int x, int y);
+
+// Gestion de copier/coller
+  virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
+  virtual void*      ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void       SelectionLost();
+  virtual void       SelectionTransferEnd();
+
+protected:
+          void       AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py);
+          void       ScrollUp();
+          void       SetDispOffset(int ldeb=-1);
+          void       ClearLine(int l);
+          void       DisplayLines(PIGraphicGen* g, int l1, int l2);
+          void       UpdCmdLine();
+          void       ClrCmd();
+          void       CmdAddChar(int key);
+          void       SelFgBgCol(PIColors fc=PI_Black, PIColors bc=PI_White);
+          void       SaveSelection();  // Pour copier la selection dans un buffer
+
+  virtual void       Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+
+  int mNL, mNC;         // Nb de lignes, colonnes total de la console
+  int mCurL, mCurC;     // Numero de ligne, colonne courante
+  int mWSzL, mWSzC;     // Taille de fenetre en lignes, colonnes
+  int mOffL;            // Offset d affichage (lignes) 
+  int mNCmdL, mLCOff;   // Nb de lignes reserve a l entree des commandes
+  int mDCOff;           // Offset (en caractere) pour l affichage de la ligne de commande
+  char* mText;          // Contenu de la console
+  unsigned char* mAtt;  // Attributs du contenu (bold, ...)
+  int* mLPo;            // Adresse des lignes ds les tableaux mText, mAtt
+  char* mStrBuf;        // Buffer 
+  int mFHaut, mFLarg;   // Hauteur, Largeur des caracteres 
+  PIFontSize mFTaille;  // Taille des caracteres 
+  PIColors mFgC, mBgC;  // Couleur Avant - arriere plan
+  char  mPrompt[32];    // Le prompt
+  char* mCmdStr;        // La commande 
+  int mCCP, mCLC;       // Position du curseur, longeur de la commande
+
+// Pour le rappel des commandes
+  int NMxRecall, mNComm;    // Profondeur de la pile de rappels, nb de commandes
+  string * mRStr;           // Stockage des chaines 
+  int mRCindx, mRindx;      // Index pour le rappel
+  
+// Gestion du buffer de copie
+  char* mCPBuffer;
+  unsigned int mCPBufLen;
+  int mCPbeginC, mCPbeginL;
+  int mCPendC, mCPendL;
+  
+// S il y a un scroll-bar associe
+  PIScrollBar* mScb;
+  PIMessage msgScb;
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picontainergen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainergen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainergen.cc	(revision 108)
@@ -0,0 +1,149 @@
+//  Classe de base pour les conteneurs de PIWdg pour
+//  programmes graphiques interactives
+//
+//                  E.Aubourg , R. Ansari  96 - 98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "picontainergen.h"
+
+//++
+// Class	PIContainer
+// Lib		PI
+// include	picontainergen.h
+//
+//	Classe conteneur gérant un ensemble d'objets "PIWdg". Cette classe 
+//	organise la hiérarchie des objets "PIWdg" et donc aussi des "PIMsgHandler",
+//	contrôle la géométrie des objets "PIWdg" contenus, ainsi que leur 
+//	visibilité et activité. La classe "PIContainer" est une des 
+//	classes de PI qui ont une implementation dépendante du systeme utilisé
+//	(Mac, XWindow, ...). La classe "PIContainerGen" est la classe qui
+//	définit l'interface, et ne pas doit être instanciée directement
+//	(Méthodes virtuelles pures). Les objets instanciés sont de la 
+//	classes "PIContainer" et le fichier entête correspondant est "PICONT_H"
+//	défini dans "pisysdep.h"
+//--
+//++
+// Links	Parents
+// PIWdg
+//--
+//++
+// Titre	Constructeur
+//--
+//++
+// PIContainer(PIContainerGen *par, char *nom, int sx, int sy, int px, int py)
+//	Création d'un objet "PIContainer" dans le conteneur parent "par", de
+//	taille "sx,sy", se trouvant à la position "px,py" avec le nom "nom"
+// long kind()
+//	Renvoie le type de la classe de l'objet ("=PIContainerGen::ClassId") pour cette classe.
+//--
+//++
+// Titre	Méthodes
+//--
+//++
+// void Show()
+//	Rend l'objet visible à l'écran. Tous les objets "PIWdg" contenus et qui sont dans 
+//	l'état actif sont visibles.
+// void Hide()
+//	Rend l'objet et tous les objets contenus invisibles.
+// void  PSPrint(PSFile *psf, int ofx=0, int ofy=0)
+//	Appelle la méthode "PSPrint()" pour tous les objets contenus.
+// void  SetAutoDelChilds(bool ad = false)
+//	Contrôle le comportement de l'objet conteneur vis à vis des objets
+//	contenus lors de la destruction. si "ad=true", les objets contenus 
+//	sont détruits lors de l'appel du destructeur de l'objet conteneur. 
+//--
+
+#define NCHALGRP 4
+
+/* --Methode-- */
+PIContainerGen::PIContainerGen(PIContainerGen *par, char *nom, 
+                               int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) , stvis(0) 
+{
+mNCh = 0;
+mACSup = false;   // Pas de suppression auto des widgets fils au delete
+mPaSup = false;
+mChilds = new (PIWdgGen * [NCHALGRP]);
+mMxCh = NCHALGRP;
+}
+
+
+/* --Methode-- */
+PIContainerGen::~PIContainerGen()
+{
+mPaSup = true;   // Pour prevenir ChildDel()
+if (mACSup)
+  for(int i=0; i<mNCh; i++)  delete mChilds[i];
+delete[] mChilds;
+}
+
+/* --Methode-- */
+void PIContainerGen::PSPrint(PSFile *psf, int ofx, int ofy)
+{
+int i;
+if (!psf)  return;
+if (!Visible())  return;
+for(i=0; i<mNCh; i++)  mChilds[i]->PSPrint(psf, ofx+XPos(), ofy+YPos()); 
+return;
+}
+
+/* --Methode-- */
+void PIContainerGen::Show()
+{
+stvis = 1;
+Manage();
+return;
+}
+
+/* --Methode-- */
+void PIContainerGen::Hide()
+{
+stvis = 0;
+UnManage();
+return;
+}
+
+/* --Methode-- */
+int PIContainerGen::Visible()
+{
+return(stvis);
+}
+
+/* --Methode-- */
+void PIContainerGen::ChildAdd(PIWdgGen* child)
+{
+if (child == NULL)  return;
+if (mNCh == mMxCh)
+  {
+  PIWdgGen ** och = mChilds;
+  mChilds = new (PIWdgGen * [mMxCh+NCHALGRP]);
+  for(int i=0; i<mNCh; i++)  mChilds[i] = och[i];
+  delete[] och;
+  mMxCh += NCHALGRP;
+  }  
+mChilds[mNCh] = child;   mNCh++; 
+return;
+}
+
+/* --Methode-- */
+void PIContainerGen::ChildDel(PIWdgGen* child)
+{
+if (mPaSup) return;  // Ne rien faire si delete initie par Container-parent
+if ((child == NULL) || (mNCh < 1))  return;
+for(int i=0; i<mNCh; i++)  
+  if (mChilds[i] == child)
+    {
+    mNCh--;
+    mChilds[i] = mChilds[mNCh];
+    break;
+    }
+return;
+}
+
+
+/* --Methode-- */
+void PIContainerGen::SetAutoDelChilds(bool ad)
+{
+mACSup = ad;
+return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/picontainergen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainergen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainergen.h	(revision 108)
@@ -0,0 +1,37 @@
+#ifndef PICONTAINERBASE_SEEN
+#define PICONTAINERBASE_SEEN
+
+#include "pisysdep.h"
+
+#include PIWDG_H
+
+
+class PIContainerGen : public PIWdg 
+{
+public:
+  enum {ClassId = 1500};
+
+               PIContainerGen(PIContainerGen *par, char *nom, 
+                              int sx=10, int sy=10, int px=0, int py=0);
+  virtual      ~PIContainerGen();
+
+  virtual long         kind() {return ClassId; }
+
+  virtual void         PSPrint(PSFile *psf, int ofx=0, int ofy=0);
+
+  virtual void         Show();
+  virtual void         Hide();
+  virtual int          Visible();
+
+  virtual void         ChildAdd(PIWdgGen * child);
+  virtual void         ChildDel(PIWdgGen * child);
+
+  void                 SetAutoDelChilds(bool ad = false);
+protected:
+  int                  stvis;
+  PIWdgGen          ** mChilds;
+  int                  mNCh, mMxCh;
+  bool                 mPaSup,mACSup;
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picontainermac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainermac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainermac.cc	(revision 108)
@@ -0,0 +1,13 @@
+#include "picontainermac.h"
+
+PIContainerMac::PIContainerMac(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIContainerGen(par, nom, sx, sy, px, py)
+{
+  // Par dfaut, un container est invisible.
+  UnManage();
+}
+
+PIContainerMac::~PIContainerMac()
+{}
+
Index: /branches/EA_Juin98/SophyaPI/PI/picontainermac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainermac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainermac.h	(revision 108)
@@ -0,0 +1,20 @@
+#ifndef PICONTAINERMAC_SEEN
+#define PICONTAINERMAC_SEEN
+
+#include "picontainergen.h"
+#include "pisysdep.h"
+#include <LView.h>
+
+class PIContainerMac : public PIContainerGen {
+public:
+                         PIContainerMac(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual                ~PIContainerMac();
+  
+protected:
+
+};
+
+typedef PIContainerMac PIContainer;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/picontainerx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainerx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainerx.cc	(revision 108)
@@ -0,0 +1,41 @@
+#include "picontainerx.h"
+
+#include <Xm/Form.h>
+
+/* --Methode-- */
+PIContainerX::PIContainerX(PIContainerGen *par, char *nom, 
+                           int sx, int sy, int px, int py) 
+: PIContainerGen(par, nom, sx, sy, px, py)
+{
+if ((sx > 0) && (sy > 0)) 
+  CreateXtWdg(nom, xmFormWidgetClass , NULL, sx, sy, px, py);
+//  CreateXtWdg(nom, xmBulletinBoardWidgetClass , NULL, sx, sy, px, py);
+}
+
+PIContainerX::PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom,  
+                           int sx, int sy, int px, int py) 
+: PIContainerGen(NULL, nom, sx, sy, px, py)
+{
+SetMsgParent(par);
+if ((sx > 0) && (sy > 0)) 
+  CreateXtWdg(nom, xmFormWidgetClass , parwdg->XtWdg(), sx, sy, px, py);
+}
+
+/* --Methode-- */
+PIContainerX::~PIContainerX()
+{}
+
+/* --Methode-- 
+void PIContainerX::Show()
+{
+PIContainerGen::Show();
+Manage();
+}
+
+void PIContainerX::Hide()
+{
+PIContainerGen::Hide();
+UnManage();
+}
+
+*/
Index: /branches/EA_Juin98/SophyaPI/PI/picontainerx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/picontainerx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/picontainerx.h	(revision 108)
@@ -0,0 +1,24 @@
+#ifndef PICONTAINERX_SEEN
+#define PICONTAINERX_SEEN
+
+#include "pisysdep.h"
+#include "picontainergen.h"
+
+
+class PIContainerX : public PIContainerGen 
+{
+public:
+              PIContainerX(PIContainerGen *par, char *nom,
+                           int sx=10, int sy=10, int px=0, int py=0);
+
+// Ce constructeur est a utiliser par PIApplicationX ...
+              PIContainerX(PIMsgHandler *par, PIWdgX *parwdg, char *nom,
+                           int sx=10, int sy=10, int px=0, int py=0);
+
+  virtual     ~PIContainerX();
+
+};
+
+typedef PIContainerX PIContainer;
+
+#endif  /* PICONTAINERX_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/pidemoup.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidemoup.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidemoup.cc	(revision 108)
@@ -0,0 +1,57 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctimer.h"
+#include "imageop.h"
+
+#include "pidemoup.h"
+
+FitsImageR4 * PIUserProc_1(FitsImageR4 * myimg, int xp, int yp, 
+                           char * arg1, char * arg2)
+{
+printf(" PIUserProc_1(%d %d %s %s)  Filtrage passe-bas 3*3 \n", xp, yp, arg1, arg2);
+ImageR4 filt(3,3);
+FitsImageR4 * out;
+
+// Definition du filtre passe-bas
+int i,j;
+for(i=0; i<3; i++)
+  for(j=0; j<3; j++)  filt(i,j) = 0.06;
+filt(1,1) = 0.52;
+
+filt.PrintPave();
+out = new FitsImageR4(myimg->XSize(), myimg->YSize());
+TIMEF ;
+FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt); 
+return(out);
+}
+ 
+FitsImageR4 * PIUserProc_2(FitsImageR4 * myimg, int xp, int yp, 
+                           char * arg1, char * arg2)
+{
+printf(" PIUserProc_2(%d %d %s %s)  Ombre 3*3 \n", xp, yp, arg1, arg2);
+ImageR4 filt(3,3);
+FitsImageR4 * out;
+
+// Definition du filtre ombre
+int i,j;
+filt(0,0) = filt(1,1) = filt(2,2) = 0.;
+filt(0,1) = filt(1,2) = -1.;
+filt(1,0) = filt(2,1) = 1.;
+filt(0,2) = -2.;
+filt(2,0) = 2.;
+filt.PrintPave();
+out = new FitsImageR4(myimg->XSize(), myimg->YSize());
+TIMEF ;
+FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt); 
+return(out);
+}
+ 
+FitsImageR4 * PIUserProc_3(FitsImageR4 * /*myimg*/, int xp, int yp, 
+                           char * arg1, char * arg2)
+{
+printf(" PIUserProc_3(%d %d %s %s) ne fait rien \n", xp, yp, arg1, arg2);
+return(NULL);
+}
+ 
Index: /branches/EA_Juin98/SophyaPI/PI/pidemoup.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidemoup.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidemoup.h	(revision 108)
@@ -0,0 +1,8 @@
+#include "fitsimage.h"
+
+FitsImageR4 * PIUserProc_1(FitsImageR4 * myimg, int xp, int yp, 
+                           char * arg1, char * arg2);
+FitsImageR4 * PIUserProc_2(FitsImageR4 * myimg, int xp, int yp, 
+                           char * arg1, char * arg2);
+FitsImageR4 * PIUserProc_3(FitsImageR4 * myimg, int xp, int yp, 
+                           char * arg1, char * arg2);
Index: /branches/EA_Juin98/SophyaPI/PI/pidrawer.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidrawer.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidrawer.cc	(revision 108)
@@ -0,0 +1,359 @@
+#include "pidrawer.h"
+#include "psfile.h"
+
+PIDrawer::PIDrawer()
+{
+  mBWdg = NULL; 
+  mGrUC = NULL;
+  xW0 = yW0 = 0; xWd = yWd = 100; 
+  aXdir = false;  // Vrai si Axe X de Droite vers Gauche 
+  aYdir = false;  // Vrai si Axe Y de Haut vers Bas
+  SetLimits(-1, 1, -1, 1, kAxeDirLtoR, kAxeDirDownUp);
+  limitsFixed = 0;
+  SetAxesFlags(kAxesDflt);
+  mDndfg = false;  // Pour controle de l'appel de Detach() si delete
+
+  mFCol = mBCol = PI_NotDefColor;
+  mLAtt = PI_NotDefLineAtt;
+  mFSz = PI_NotDefFontSize;
+  mFAtt = PI_NotDefFontAtt;
+  mMSz = -1;
+  mMrk = PI_NotDefMarker;
+}
+
+PIDrawer::~PIDrawer()
+{
+  list<DrwBWId>::iterator it;
+  mDndfg = true;
+  for(it = mBWdgList.begin(); it != mBWdgList.end(); it++)
+         (*it).wdg->RemoveDrawer((*it).id);
+  if (mGrUC)  delete mGrUC;
+}
+
+
+void
+PIDrawer::SetLimits(float xmin, float xmax, float ymin, float ymax,
+                    int axrl, int ayud)
+{
+  if (xmax <= xmin || ymax <= ymin)
+    return; // $CHECK$ exception ?
+  if (axrl == kAxeDirLtoR)  aXdir = false;
+  else if (axrl == kAxeDirRtoL)  aXdir = true;
+  if (ayud == kAxeDirDownUp)  aYdir = false;
+  else if (ayud == kAxeDirUpDown)  aYdir = true;
+  xMin = xmin;
+  xMax = xmax;
+  yMin = ymin;
+  yMax = ymax;
+  aXFlg = axrl;  aYFlg = ayud;
+  CalcTicks();
+  limitsFixed = 1;
+}
+
+
+void
+PIDrawer::UpdateSize()
+{
+// Ne fait rien !
+  return;
+}
+
+void
+PIDrawer::Refresh()
+{
+  list<DrwBWId>::iterator it;
+  for(it = mBWdgList.begin(); it != mBWdgList.end(); it++)
+         (*it).wdg->CallDrawer((*it).id);
+
+}
+
+void 
+PIDrawer::SetColAtt(PIColors fg, PIColors bg)
+{
+  if (fg != PI_NotDefColor) mFCol = fg;
+  if (bg != PI_NotDefColor) mBCol = bg;
+}
+
+void 
+PIDrawer::SetLineAtt(PILineAtt lat)
+{
+  if (lat != PI_NotDefLineAtt) mLAtt = lat;
+}
+
+void 
+PIDrawer::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
+{
+  if (fsz != PI_NotDefFontSize) mFSz = fsz;
+  if (fat != PI_NotDefFontAtt) mFAtt = fat;
+}
+
+void 
+PIDrawer::SetMarkerAtt(int sz, PIMarker mrk)
+{
+  if (sz >= 0)  mMSz = sz;
+  if (mrk != PI_NotDefMarker) mMrk = mrk;
+}
+
+void 
+PIDrawer::SelGraAtt(PIGraphicUC* g)
+{
+  if (mFCol != PI_NotDefColor)    g->SelForeground(mFCol);
+  if (mBCol != PI_NotDefColor)    g->SelBackground(mBCol);
+  if (mLAtt != PI_NotDefLineAtt)  g->SelLine(mLAtt);
+  if ( (mFSz != PI_NotDefFontSize) || (mFAtt != PI_NotDefFontAtt) )
+                                  g->SelFont(mFSz, mFAtt);
+  if ( (mMrk != PI_NotDefMarker) || (mMSz >= 0) )
+                                  g->SelMarker(mMSz, mMrk);
+}
+
+void
+PIDrawer::Attach(PIBaseWdgGen* wdg, int id)
+{
+  if (!wdg) return;
+  DrwBWId bwi;
+  bwi.id = id;  bwi.wdg = wdg;
+  mBWdgList.push_back(bwi);
+  return;
+}
+
+void
+PIDrawer::Detach(PIBaseWdgGen* wdg, int id)
+{
+  if (mDndfg) return;
+  if (!wdg) return;
+  list<DrwBWId>::iterator it;
+  for(it = mBWdgList.begin(); it != mBWdgList.end(); it++)
+     if ( ((*it).id == id) && ((*it).wdg == wdg) ) { mBWdgList.erase(it);  break; }
+  return;
+}
+
+
+PIGraphicUC*
+PIDrawer::SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g)
+{
+  mBWdg = drw;
+  xW0 = x0;   yW0 = y0;
+  xWd = dx;   yWd = dy;
+  if (mGrUC)  delete mGrUC;
+  mGrUC = new PIGraphicUC(g, x0, y0, dx, dy);
+  mGrUC->SetUCS(xMin, xMax, yMin, yMax, aXFlg, aYFlg);
+  return(mGrUC);
+}
+
+
+void
+PIDrawer::CalcTicks()
+{
+	float xExt = xMax-xMin;
+	int lx = (int) ceil(log10(xExt)-0.1);
+	xExt = (float)pow(10.0,lx);
+	xMajTickStep = xExt/10;
+	xMinTickStep = xMajTickStep/10;
+    xFirstMajTick = int(xMin / xMajTickStep) * xMajTickStep;
+    if (xFirstMajTick < xMin) xFirstMajTick += xMajTickStep;
+    xFirstMinTick = int(xMin / xMinTickStep) * xMinTickStep;
+    if (xFirstMinTick < xMin) xFirstMinTick += xMinTickStep;
+    
+    
+	float yExt = yMax-yMin;
+	int ly = (int) ceil(log10(yExt)-0.1);
+	yExt = (float)pow(10.0,ly);
+	yMajTickStep = yExt/10;
+	yMinTickStep = yMajTickStep/10;
+    yFirstMajTick = int(yMin / yMajTickStep) * yMajTickStep;
+    if (yFirstMajTick < yMin) yFirstMajTick += yMajTickStep;
+    yFirstMinTick = int(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(int flags)
+{
+  axesFlags = flags;
+  if (axesFlags & (kIntTicks | kExtTicks | kMajTicks | kMinTicks))
+    axesFlags |= kTicks;
+  if ((axesFlags & (kTicks | kIntTicks | kExtTicks)) == kTicks)
+    axesFlags |= kIntTicks | kExtTicks;
+  if ((axesFlags & (kTicks | kMajTicks | kMinTicks)) == kTicks)
+    axesFlags |= kMajTicks;
+}
+
+
+void
+PIDrawer::DrawAxes(PIGraphicUC* g, int flags)
+{
+  g->NoClip();
+  if (flags == -1)
+    flags = axesFlags;
+    
+  
+  if (flags & kStdAxes) {
+  
+    // Les axes
+    
+    g->DrawLine(xMin, 0, xMax, 0);
+    g->DrawLine(0, yMin, 0, yMax);
+  
+    // Les ticks majeurs
+  
+    if (flags & kMajTicks) {
+        DrawHTicks(g, 0, xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
+        DrawVTicks(g, 0, yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
+    }
+    
+    // Les ticks mineurs
+  
+    if (flags & kMinTicks) {
+        DrawHTicks(g, 0, xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
+        DrawVTicks(g, 0, yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
+    }
+    
+    // Les labels
+    
+    if (flags & kLabels) {
+      if (!aYdir)
+        DrawHLabels(g, -xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      else 
+        DrawHLabels(g, xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      if (!aXdir)
+        DrawVLabels(g, -yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+      else 
+        DrawVLabels(g, yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+    }
+    
+  }
+  
+  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
+    
+    float extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
+    float intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
+    float extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
+    float intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
+    float extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
+    float intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
+    float extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
+    float intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
+
+    // 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, yMin-xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+        DrawHLabels(g, yMax+xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
+      }
+      else {
+        DrawHLabels(g, yMin-xMajTickLen*2, xFirstMajTick, xMajTickStep,0);
+        DrawHLabels(g, yMax+xMajTickLen*8, xFirstMajTick, xMajTickStep,0);
+      }
+      if (!aXdir) {
+        DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+        DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
+      }
+      else {
+        DrawVLabels(g, xMin-yMajTickLen*2, yFirstMajTick, yMajTickStep,-1);
+        DrawVLabels(g, xMax+yMajTickLen*2, yFirstMajTick, yMajTickStep,1);
+      }
+    }
+  }
+  g->Clip();
+}
+
+  
+
+void
+PIDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
+{
+}
+
+
+void
+PIDrawer::DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep)
+{
+  for (float x=xBeg; x<=xMax; x += xStep)
+    g->DrawLine(x, y-tickDown, x, y+tickUp);
+}
+
+void
+PIDrawer::DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep)
+{
+  for (float y=yBeg; y<=yMax; y += yStep)
+    g->DrawLine(x-tickLeft, y, x+tickRight, y);
+}
+
+void
+PIDrawer::DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just)
+{
+  float xOffset = 0;
+  int kk;
+  g->SelFontSz(xMajTickLen*4.);
+  for (float x=xBeg; x<=xMax; x += xStep) {
+      char label[20]; sprintf(label, "%-6g", x);
+      for(kk=0; kk<20; kk++)
+        if (label[kk] == ' ')   { label[kk] = '\0' ; break; }
+      float largeur = g->CalcStringWidth(label);
+      if (just == 1)
+        xOffset = -largeur;
+      else if (just == 0)
+        xOffset = -largeur/2;
+      else
+        xOffset = 0;
+      if (aXdir)  xOffset = -xOffset;
+      g->DrawString(x+xOffset, y, label);
+  }
+}
+
+void
+PIDrawer::DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just)
+{
+  float xOffset = 0;
+  g->SelFontSz(xMajTickLen*4.);
+  for (float y=yBeg; y<=yMax; y += yStep) {
+      char label[20]; sprintf(label, "%-6g", y);
+      float largeur = g->CalcStringWidth(label);
+      if (just == 1)
+        xOffset = -largeur;
+      else if (just == 0)
+        xOffset = -largeur/2;
+      else
+        xOffset = 0;
+      if (aXdir)  xOffset = -xOffset;
+      g->DrawString(x+xOffset, y, label);
+  }
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pidrawer.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidrawer.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidrawer.h	(revision 108)
@@ -0,0 +1,108 @@
+#ifndef PIDRAWER_H
+#define PIDRAWER_H
+
+#include "pibwdggen.h"
+#include "pigraphuc.h"
+#include <list>
+
+enum {
+  kStdAxes     = 0x0001,
+  kBoxAxes     = 0x0002,
+  kTicks       = 0x0004,
+  kIntTicks    = 0x0010,
+  kExtTicks    = 0x0020,
+  kMajTicks    = 0x0040,
+  kMinTicks    = 0x0080,
+  kLabels      = 0x1000,
+  kAxesDflt    = kStdAxes | kTicks | kLabels
+};
+
+
+class PIDrawer {
+public:
+                     PIDrawer();
+  virtual           ~PIDrawer();
+
+  virtual void       SetLimits(float xmin, float xmax, float ymin, float ymax,
+                               int axrl=kAxeDirSame, int ayud=kAxeDirSame);
+
+  virtual void       DrawAxes(PIGraphicUC* g, int flags = -1);
+  virtual void       SetAxesFlags(int flags=kAxesDflt);
+    
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax); 
+   
+  virtual void       Refresh();      // Recalcule les limites et reaffiche
+  virtual void       UpdateSize();   // Calcule et change les limites si non fixees 
+
+  float XMin() const {return xMin;}
+  float XMax() const {return xMax;}
+  float YMin() const {return yMin;}
+  float YMax() const {return yMax;}
+  
+  inline PIGraphicUC*    GetGraphicUC() { return(mGrUC); }
+
+  int    LimitsFixed() const {return limitsFixed;}
+  void   FreeLimits() {limitsFixed = 0;}
+
+  void               SetColAtt(PIColors fg=PI_NotDefColor, 
+                               PIColors bg=PI_NotDefColor);
+  void               SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
+  void               SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
+                                PIFontAtt fat=PI_NotDefFontAtt);
+  void               SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
+
+  void               SelGraAtt(PIGraphicUC* g);
+
+//  Les objets/methodes suivants devraient etre protected     
+//  Pb avec acces depuis PIBaseWdgGen (Reza 11/07/97) 
+  virtual  PIGraphicUC*  SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g);
+
+//  Je declare en public a cause de cxx - Reza 11/07/97 
+  struct DrwBWId { int id; PIBaseWdgGen* wdg; };
+  
+protected:
+  friend class PIBaseWdgGen;
+  virtual void       Attach(PIBaseWdgGen*, int id);
+  virtual void       Detach(PIBaseWdgGen*, int id);
+
+  void CalcTicks();
+
+  void DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep);
+  void DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep);
+  void DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just=0);
+  void DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just=0);
+
+  
+  float xMin, xMax, yMin, yMax;  // Valeurs en unites user
+  int xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
+  bool   aXdir, aYdir;           // Sens des axes horiz, vertical 
+  int aXFlg, aYFlg;
+
+  float xFirstMajTick, xFirstMinTick;
+  float yFirstMajTick, yFirstMinTick;
+  float xMajTickStep, xMinTickStep;
+  float yMajTickStep, yMinTickStep;
+  float xMajTickLen,  xMinTickLen;
+  float yMajTickLen,  yMinTickLen;
+  
+  int limitsFixed;
+  int axesFlags;
+  
+  PIBaseWdgGen* mBWdg;
+  PIGraphicUC* mGrUC;
+
+  list<DrwBWId>  mBWdgList;
+  bool mDndfg;
+
+//  Gestion d attributs graphiques associes a chaque drawer
+  PIColors           mFCol, mBCol;
+  PILineAtt          mLAtt;
+  PIFontSize         mFSz;
+  PIFontAtt          mFAtt;
+  int                mMSz;
+  PIMarker           mMrk;     
+  
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pidrawwin.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidrawwin.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidrawwin.cc	(revision 108)
@@ -0,0 +1,28 @@
+#include "pidrawwin.h"
+
+PIDrawWindow::PIDrawWindow(PIMsgHandler* par, char *nom,
+                               PIWindowKind k, int sx, int sy, int px, int py)
+:PIWindow(par, nom, k, sx, sy, px, py)
+{
+   mDrawWdg = new PIScDrawWdg(this, nom, sx-20, sy-20, 10, 10);
+   mDrawWdg->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);   
+}
+
+
+PIDrawWindow::~PIDrawWindow()
+{
+  delete mDrawWdg;
+}
+
+void
+PIDrawWindow::AddScDrawer(PIDrawer* d, bool ad)
+{
+  mDrawWdg->AddScDrawer(d, ad);
+}
+
+void
+PIDrawWindow::SetAxesFlags(int flags)
+{
+  mDrawWdg->SetAxesFlags(flags);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pidrawwin.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pidrawwin.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pidrawwin.h	(revision 108)
@@ -0,0 +1,26 @@
+#ifndef PIDRAWWIN_H
+#define PIDRAWWIN_H
+
+// Une fenetre qui contient un drawwdg...
+
+#include "pisysdep.h"
+#include PIWIN_H
+#include "piscdrawwdg.h"
+
+class PIDrawWindow : public PIWindow {
+public:
+                 PIDrawWindow(PIMsgHandler* par, char *nom, 
+                                PIWindowKind k=PIWK_normal, int sx=10, int sy=10, 
+                                int px=0, int py=0);
+                ~PIDrawWindow();
+                
+ virtual void    AddScDrawer(PIDrawer*, bool ad=false);                
+ virtual void    SetAxesFlags(int flags=-1);
+ inline PIScDrawWdg * DrawWdg() { return mDrawWdg; }
+private:
+  PIScDrawWdg*   mDrawWdg;
+};
+
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pierrdisp.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pierrdisp.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pierrdisp.cc	(revision 108)
@@ -0,0 +1,105 @@
+#include "pierrdisp.h"
+#include "utils.h"
+
+
+PIErrorBox::PIErrorBox(PIContainerGen* par, int sx, int sy,
+	     int px, int py)
+: PIBaseWdg(par, "Error Message", sx, sy, px, py)
+{
+  currErrText = "";
+  state = 0;
+}
+
+PIErrorBox::~PIErrorBox()
+{
+}
+
+void
+PIErrorBox::Draw()
+{
+  if (currErrText == "") {
+    SelBackground();
+    EraseWindow();
+  } else {
+    switch(state) {
+    case 0:
+      EraseWindow();
+      SelForeground(PI_Red);
+      DrawFBox(0,0,1000,1000);
+      SelForeground(PI_Black);
+      break;
+    default:
+      SelBackground();
+      SelForeground();
+    }
+    SelFont(PI_BigSizeFont, PI_BoldFont);
+    DrawString(20,30,(char*)currErrText.c_str());
+  }
+}
+
+void
+PIErrorBox::Cycle()
+{
+  state = (state + 1) % 2;
+}
+
+
+
+
+PIErrorDisplay::PIErrorDisplay(PIContainerGen* par, int sx, int sy,
+			       int px, int py)
+: PIContainer(par, "Error Display", sx, sy, px, py), PIPeriodX(1)
+{
+  currErrId = 0;
+
+  errorBox  = new PIErrorBox(this, 150, 80, 0, 0);
+  ackButton = new PIButton(this, "OK", 5000, 40, 20, 155, 20);
+  updButton = new PIButton(this, "Upd", 5001, 40, 20, 155, 50);
+  Start();
+}
+
+PIErrorDisplay::~PIErrorDisplay()
+{
+  delete updButton;
+  delete ackButton;
+  delete errorBox;
+}
+
+void
+PIErrorDisplay::Process(PIMessage msg, PIMsgHandler *sender, void *data)
+{
+msg = UserMsg(msg);
+  switch(msg) {
+  case 5000:
+    // On valide
+    if (currErrId) 
+      AcqAckError(currErrId);
+    UpdData();
+    break;
+  case 5001:
+    UpdData();
+    break;
+    
+  default:
+    PIContainer::Process(msg, sender, data);
+  }
+}
+
+void
+PIErrorDisplay::UpdData()
+{
+  currErrId = 0;
+  char tache[80];
+  char msg[200];
+  int code;
+  int severite;
+  int rc = AcqGetNextError(&currErrId, tache, &code, &severite, msg);
+  if (rc)
+    errorBox->SetText("");
+  else
+    errorBox->SetText(string(tache) + " : (" + itos(code) + "/" +
+		     itos(severite) +") " + msg);
+  errorBox->Draw();
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pierrdisp.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pierrdisp.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pierrdisp.h	(revision 108)
@@ -0,0 +1,49 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIERRDISP_H_SEEN
+#define PIERRDISP_H_SEEN
+
+#include "pisysdep.h"
+#include PIBWDG_H
+#include PISTDWDG_H
+#include PICONT_H
+#include PIPERIOD_H
+#include <string>
+
+#include "errorhandlerc.h"
+
+class PIErrorBox : public PIBaseWdg {
+public:
+  PIErrorBox(PIContainerGen* par, int sx=100, int sy = 50,
+	     int px=0, int py=0);
+  ~PIErrorBox();
+
+  void Draw();
+  
+  void SetText(string const& txt) {currErrText = txt;}
+  void Cycle();
+
+protected:
+  string currErrText;
+  int           state;     // Cycle decoratif en couleurs violentes...  
+};
+
+class PIErrorDisplay : public PIContainer, public PIPeriodic {
+public:
+  
+  PIErrorDisplay(PIContainerGen* par, int sx=150, int sy=50,
+		 int px=0, int py=0);
+  virtual      ~PIErrorDisplay();
+  
+  void          UpdData();
+  void          Process(PIMessage msg, PIMsgHandler *sender, void *data);
+  void          DoPeriodic() {UpdData();}
+protected:
+  int           currErrId;
+
+  PIErrorBox*   errorBox;
+  PIButton*     ackButton;
+  PIButton*     updButton;   // TEMPORAIRE
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechogen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechogen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechogen.cc	(revision 108)
@@ -0,0 +1,27 @@
+#include "pifilechogen.h"
+
+
+/************* PIFileChooserGen ************/
+
+PIFileChooserGen::PIFileChooserGen(PIMsgHandler* par, char* nom, PIMessage msg)
+: PIWdg(NULL, nom)
+{
+SetMsg(msg);
+SetMsgParent(par);
+}
+
+PIFileChooserGen::~PIFileChooserGen()
+{}
+
+void PIFileChooserGen::Show()
+{
+return;
+}
+
+
+void PIFileChooserGen::AcceptNewFile(bool)
+{
+return;
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechogen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechogen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechogen.h	(revision 108)
@@ -0,0 +1,35 @@
+#ifndef PIFILCHOGEN_H_SEEN
+#define PIFILCHOGEN_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include PIWDG_H
+
+class PIFileChooserGen : public PIWdg {
+public:
+  enum {ClassId = 2100};
+
+                     PIFileChooserGen(PIMsgHandler* par, char* nom, PIMessage msg);
+  virtual            ~PIFileChooserGen();
+
+  virtual void       Show();
+
+  virtual void       AcceptNewFile(bool acc);
+  virtual void       SetPath(string const&) = 0;
+  virtual void       SetFileName(string const&) = 0;
+
+  virtual string     GetPath() = 0;
+  virtual string     GetFileName() = 0;
+
+  virtual long       kind() {return ClassId; }
+
+protected:
+
+};
+
+
+#endif
+
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechomac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechomac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechomac.cc	(revision 108)
@@ -0,0 +1,123 @@
+#include "pifilechomac.h"
+
+string PathNameFromDirID(long dirID, short vRefNum);
+
+string PIGetFileName(string dir);
+string PIGetExistingFileName(string dir);
+
+string PIGetFileName(string dir)
+{
+  StandardFileReply reply;
+  
+  
+  string fName;
+  int i = dir.rfind(':');
+  if (i == string::npos)
+    fName = dir;
+  else if (i == dir.length())
+    fName = "";
+  else
+    fName = dir.substr(i+1);
+    
+  LStr255 defaultName(fName.c_str());
+  
+  StandardPutFile("\pSave as:",defaultName,&reply);
+  
+  if (!reply.sfGood) return "";
+  
+  string directory = PathNameFromDirID(reply.sfFile.parID,reply.sfFile.vRefNum);
+  p2cstr(reply.sfFile.name);
+  
+//  return directory + '/' + (char*)reply.sfFile.name;
+  return directory + ':' + (char*)reply.sfFile.name;
+}
+
+string PIGetExistingFileName(string /*dir*/)
+{
+  StandardFileReply reply;
+  SFTypeList typeList;
+  
+  StandardGetFile(NULL,-1,typeList,&reply);
+  
+  if (!reply.sfGood) return "";
+  
+  string directory = PathNameFromDirID(reply.sfFile.parID,reply.sfFile.vRefNum);
+  p2cstr(reply.sfFile.name);
+  
+//  return directory + '/' + (char*)reply.sfFile.name;
+  return directory + ':' + (char*)reply.sfFile.name;
+}
+
+
+string PathNameFromDirID(long dirID, short vRefNum)
+{
+	DirInfo 	block;
+	Str255		directoryName;
+	OSErr		err;
+
+	string fullPathName = "";
+
+	block.ioDrParID = dirID;
+	block.ioNamePtr = directoryName;
+	do {
+			block.ioVRefNum = vRefNum;
+			block.ioFDirIndex = -1;
+			block.ioDrDirID = block.ioDrParID;
+			err = PBGetCatInfoSync(CInfoPBPtr(&block));
+			p2cstr(directoryName);
+			if (fullPathName != "") fullPathName = ':' + fullPathName;
+			fullPathName =  ((char*)directoryName + fullPathName);
+//			fullPathName = '/' + ((char*)directoryName + fullPathName);
+	} while (block.ioDrDirID != 2);
+	return fullPathName;
+}
+
+
+PIFileChooserMac::PIFileChooserMac(PIMsgHandler* par, char* nom, PIMessage msg)
+: PIFileChooserGen(par, nom, msg)
+{
+  mAccNew = false;
+  mFileName = "";
+}
+
+PIFileChooserMac::~PIFileChooserMac()
+{}
+
+void
+PIFileChooserMac::Show()
+{
+  if (mAccNew)
+    mFileName = PIGetFileName("");
+  else
+    mFileName = PIGetExistingFileName("");
+
+// Envoyer un message....
+  if (mFileName == "")
+    Send(Msg(), PIMsg_Cancel, NULL);
+  else
+    Send(Msg(), PIMsg_OK, (void *) (GetFileName().c_str()));
+}
+
+void
+PIFileChooserMac::AcceptNewFile(bool acc)
+{
+  mAccNew = acc;
+}
+
+void
+PIFileChooserMac::SetPath(string const& /*path*/) {}
+void
+PIFileChooserMac::SetFileName(string const& /*fname*/) {}
+
+string
+PIFileChooserMac::GetPath()
+{
+  return "";
+}
+
+string
+PIFileChooserMac::GetFileName()
+{
+  return mFileName;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechomac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechomac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechomac.h	(revision 108)
@@ -0,0 +1,33 @@
+#ifndef PIFILECHOMAC_H_SEEN
+#define PIFILECHOMAC_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include "pifilechogen.h"
+
+class PIFileChooserMac : public PIFileChooserGen {
+public:
+
+                   PIFileChooserMac(PIMsgHandler* par, char* nom, PIMessage msg);
+  virtual          ~PIFileChooserMac();
+
+  virtual void     Show();
+
+  virtual void     AcceptNewFile(bool acc);
+  virtual void     SetPath(string const& path);
+  virtual void     SetFileName(string const& fname);
+
+  virtual string   GetPath();
+  virtual string   GetFileName();
+
+protected:
+  bool             mAccNew;
+  string           mFileName;
+};
+
+typedef PIFileChooserMac     PIFileChooser ;
+
+#define FILESEP ':'
+
+#endif
+
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechox.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechox.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechox.cc	(revision 108)
@@ -0,0 +1,170 @@
+#include<stdio.h>
+#include<string.h>
+
+#include "pisysdep.h"
+
+#include "pifilechox.h"
+
+
+/************* PIFileChooserX ************/
+#include <X11/Shell.h>
+#include <Xm/FileSB.h>
+
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
+
+// Fonctions privees (CallBack)
+//static void filesel_okact(Widget w, XtPointer *usd, XtPointer *calld);
+static void filesel_cancelact(Widget w, XtPointer *usd, XtPointer *calld);
+
+/* Nouvelle-Fonction */
+void  filesel_okact(Widget /*w*/, XtPointer *usd, 
+                    XmFileSelectionBoxCallbackStruct *calld)
+{
+PIFileChooserX *pif;
+pif = (PIFileChooserX *) usd ;
+pif->mSt = 1;
+pif->MWin()->UnManage();
+//pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str()));
+CStrFrXmStr(calld->value, pif->mFName, 512); 
+pif->Send( pif->Msg(), PIMsg_OK, (void *) pif->mFName);
+return;
+}
+
+/* Nouvelle-Fonction */
+void  filesel_cancelact(Widget /*w*/, XtPointer *usd, XtPointer */*calld*/)
+{
+PIFileChooserX *pif;
+pif = (PIFileChooserX *) usd ;
+pif->mSt = 0;
+pif->mFName[0] = '\0';
+pif->MWin()->UnManage();
+pif->Send(pif->Msg(), PIMsg_Cancel, NULL);
+return;
+}
+
+#define PIFC_SzX  350
+#define PIFC_SzY  300
+
+/* --Methode-- */
+PIFileChooserX::PIFileChooserX(PIMsgHandler* par, char* nom, PIMessage msg)
+: PIFileChooserGen(par, nom, msg)
+{
+SysDWdg wdg;
+
+mWin = NULL;
+mWin = new PIWdgX(NULL, nom, PIFC_SzX, PIFC_SzY, 150, 150);
+mWin->CreateXtWdg(nom, topLevelShellWidgetClass, NULL, PIFC_SzX, PIFC_SzY, 200, 200);
+
+mSt = 0;
+mFName[0] = mFName[511] = '\0';
+
+CreateXtWdg(nom, xmFileSelectionBoxWidgetClass, mWin->XtWdg(), PIFC_SzX, PIFC_SzY, 0, 0);
+XtAddCallback(XtWdg(), XmNokCallback, 
+              (XtCallbackProc)filesel_okact, (XtPointer)this);
+XtAddCallback(XtWdg(), XmNcancelCallback, 
+              (XtCallbackProc)filesel_cancelact, (XtPointer)this);
+// Pour avoir une version simplifiee 
+/* wdg = XmFileSelectionBoxGetChild(XtWdg(),XmDIALOG_DIR_LIST);
+XtUnmanageChild(wdg);
+wdg = XmFileSelectionBoxGetChild(XtWdg(),XmDIALOG_DIR_LIST_LABEL);
+XtUnmanageChild(wdg);
+*/
+wdg = XmFileSelectionBoxGetChild(XtWdg(),XmDIALOG_HELP_BUTTON);
+XtUnmanageChild(wdg);
+
+fnl = XmFileSelectionBoxGetChild(XtWdg(),XmDIALOG_SELECTION_LABEL);
+fnw = XmFileSelectionBoxGetChild(XtWdg(),XmDIALOG_TEXT);
+
+Arg warg[2];
+XtSetArg(warg[0], XmNfileTypeMask, XmFILE_REGULAR);
+XtSetValues(XtWdg(), warg, 1);
+
+AcceptNewFile(false);
+Manage();
+}
+
+/* --Methode-- */
+PIFileChooserX::~PIFileChooserX()
+{
+delete mWin;
+}
+
+/* --Methode-- */
+void PIFileChooserX::AcceptNewFile(bool acc)
+{
+if (acc) 
+  {
+  mWin->SetSize( PIFC_SzX, PIFC_SzY+75);
+  XtManageChild(fnl);  XtManageChild(fnw); 
+  }
+else 
+  { 
+  mWin->SetSize( PIFC_SzX, PIFC_SzY+50);
+  XtUnmanageChild(fnl); XtUnmanageChild(fnw); 
+  }
+}
+
+/* --Methode-- */
+void PIFileChooserX::Show()
+{
+mWin->Manage();
+}
+
+/* --Methode-- */
+void PIFileChooserX::SetPath(string const& path)
+{
+XmString xmstr;
+xmstr = XmStringLtoRCreate((char *)path.c_str(), XmSTRING_DEFAULT_CHARSET);
+Arg warg[2];
+XtSetArg(warg[0], XmNdirectory, xmstr); 
+XtSetValues(XtWdg(), warg, 1);
+XmStringFree(xmstr);
+return;
+}
+
+/* --Methode-- */
+void PIFileChooserX::SetFileName(string const& fname)
+{
+XmString xmstr;
+xmstr = XmStringLtoRCreate((char *)fname.c_str(), XmSTRING_DEFAULT_CHARSET);
+Arg warg[2];
+XtSetArg(warg[0], XmNtextString, xmstr); 
+XtSetValues(XtWdg(), warg, 1);
+XmStringFree(xmstr);
+return;
+}
+
+
+/* --Methode-- */
+string PIFileChooserX::GetFileName()
+{
+
+if (mSt)
+  {
+  XmString xmstr;
+  Arg warg[2];
+
+  XtSetArg(warg[0], XmNtextString, &xmstr);
+  XtGetValues(XtWdg(), warg, 1);
+  CStrFrXmStr(xmstr, mFName, 512); 
+  string s(mFName);
+  XmStringFree(xmstr);
+  return(s);
+  }
+else
+  {
+  mFName[0] = '\0';
+  string s(mFName);
+  return(s);
+  }
+}
+
+/* --Methode-- */
+string PIFileChooserX::GetPath()
+{
+printf("PIFileChooserX::GetPath() not implemented ! \n");
+string s("");
+return(s);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pifilechox.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pifilechox.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pifilechox.h	(revision 108)
@@ -0,0 +1,42 @@
+#ifndef PIFILCHOX_H_SEEN
+#define PIFILCHOX_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include "pifilechogen.h"
+
+#include PIWIN_H
+
+class PIFileChooserX : public PIFileChooserGen {
+public:
+
+                   PIFileChooserX(PIMsgHandler* par, char* nom, PIMessage msg);
+  virtual          ~PIFileChooserX();
+
+  virtual void     Show();
+
+  virtual void     AcceptNewFile(bool acc);
+  virtual void     SetPath(string const& path);
+  virtual void     SetFileName(string const& fname);
+
+  virtual string   GetPath();
+  virtual string   GetFileName();
+
+  inline PIWdg *   MWin() { return mWin; }
+
+//  Je les declare ici, en public, a cause des callback
+  int mSt;
+  char mFName[512];     
+
+protected:
+  PIWdg * mWin;
+  SysDWdg  fnw, fnl;
+};
+
+typedef PIFileChooserX     PIFileChooser ;
+
+#define FILESEP '/'
+
+
+#endif
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigfname.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigfname.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigfname.h	(revision 108)
@@ -0,0 +1,11 @@
+#ifndef PIGFNAME_H_SEEN
+#define PIGFNAME_H_SEEN
+
+#include <string>
+
+string PIGetFileName(string = "");
+string PIGetExistingFileName(string = "");
+
+
+#endif
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphgen.cc	(revision 108)
@@ -0,0 +1,62 @@
+// Classe generique de trace graphique de base (Ne peut etre instancie)
+
+#include "pigraphgen.h"
+
+/* --Methode-- */
+PIGraphicGen::PIGraphicGen()
+{
+myWdg = NULL;
+}
+
+/* --Methode-- */
+PIGraphicGen::PIGraphicGen(PIWdg* wdg)
+{
+myWdg = wdg;
+}
+
+/* --Methode-- */
+PIGraphicGen::~PIGraphicGen()
+{
+}
+/* --Methode-- */
+int PIGraphicGen::kind() 
+{
+return PI_ScrWindowGraphics; 
+}
+
+/* --Methode-- */
+void PIGraphicGen::GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax)
+{
+xmin = ymin = 0;  
+xmax = ymax = 0;
+if (myWdg) {
+  xmax = myWdg->XSize();
+  ymax = myWdg->YSize();
+  }
+}
+
+/* --Methode-- */
+void PIGraphicGen::SaveGraphicAtt()
+{
+  sFCol = GetForeground();
+  sBCol = GetBackground();
+  sGOm = GetGOMode();
+  sFAtt = GetFontAtt();   
+  sFSize = GetFontSize();
+  sLAtt = GetLineAtt();
+  sMrk = GetMarker();   
+  sMrkSz = GetMarkerSize();
+  return;
+}
+
+/* --Methode-- */
+void PIGraphicGen::RestoreGraphicAtt()
+{
+  SelForeground(sFCol);
+  SelBackground(sBCol);
+  SelGOMode(sGOm);
+  SelFontSzPt(sFSize, sFAtt);
+  SelLine(sLAtt);
+  SelMarker(sMrkSz, sMrk);
+  return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphgen.h	(revision 108)
@@ -0,0 +1,140 @@
+#ifndef PIGRAPHICGEN_H_SEEN
+#define PIGRAPHICGEN_H_SEEN
+
+#include "pisysdep.h"
+
+#include PIWDG_H
+#include PICMAP_H
+
+
+enum PIColors  { PI_ColorFromMap = -2, PI_NotDefColor = -1, 
+                 PI_Black = 0, PI_White = 1,  PI_Grey = 2,
+                 PI_Red = 3, PI_Blue = 4, PI_Green = 5,  
+                 PI_Yellow = 6, PI_Magenta = 7 }; 
+
+enum PIFontSize { PI_NotDefFontSize = -1, 
+                  PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 };
+
+enum PIFontAtt { PI_NotDefFontAtt = -1,
+                 PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 };
+
+enum PILineAtt { PI_NotDefLineAtt = -1,
+                 PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 };
+
+enum PIMarker  { PI_NotDefMarker = -1,
+                 PI_DotMarker = 0, PI_PlusMarker=1, PI_CrossMarker=2,  
+                 PI_CircleMarker=3, PI_FCircleMarker=4,
+                 PI_BoxMarker=5, PI_FBoxMarker=6,
+                 PI_TriangleMarker=7, PI_FTriangleMarker=8,
+                 PI_StarMarker=9, PI_FStarMarker=10 };
+
+enum PIGOMode { PI_GOCopy = 0, PI_GOXOR = 1 }; 
+
+
+//  Classe pour gerer indifferement des coordonnees float ou int 
+class PIGrCoord {
+public:
+  inline PIGrCoord() { iv = 0; fv = 0.;}
+  inline PIGrCoord(int a) { iv = a; fv = (float)a;}
+  inline PIGrCoord(float a) { iv = (int)a; fv = a;}
+  inline PIGrCoord(double a) { iv = (int)a; fv = (float)a;}
+  inline operator int() { return(iv); }
+  inline operator short() { return((short)iv); }
+  inline operator unsigned int() { return((unsigned int)iv); }
+  inline operator unsigned short() { return((unsigned short)iv); }
+  inline operator float() { return(fv); }
+  inline PIGrCoord& operator= (int a) { iv = a; fv = (float)a; return(*this); }
+  inline PIGrCoord& operator= (float a) { iv = (int)a; fv = a; return(*this); }
+  inline PIGrCoord& operator= (double a) { iv = (int)a; fv = (float)a; return(*this); }
+  int iv;
+  float fv;
+};
+
+enum PIGraphicsType { PI_ScrWindowGraphics = 0, PI_PSFileGraphics = 1, 
+                      PI_UCGraphics = 2, PI_UC3DGraphics = 3 };
+
+// Classe generique de trace graphique de base :
+
+class PIGraphicGen
+{
+public:
+                     PIGraphicGen();
+                     PIGraphicGen(PIWdg* wdg);
+  virtual           ~PIGraphicGen();
+
+  virtual int        kind();
+
+//  Espace des coordonnees
+  virtual void       GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax); 
+
+//  Trace graphiques
+  virtual void       Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)     = 0;
+  virtual void       DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0)        = 0;
+  virtual void       DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0)  = 0;
+  virtual void       DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)  = 0;
+  virtual void       DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)   = 0;
+  virtual void       DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)  = 0;
+  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)               = 0;
+  virtual void       DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)              = 0;
+  virtual void       DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)                    = 0;  
+  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)                   = 0;  
+  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0)                            = 0;
+  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)                    = 0;
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                                int sx, int sy, PIColorMap* cmap)              = 0;
+
+// Modifications attributs graphiques
+  virtual void       SelForeground(PIColors col=PI_Black)                      = 0;
+  virtual void       SelBackground(PIColors col=PI_White)                      = 0;
+  virtual void       SelForeground(PIColorMap& cmap, int cid)                  = 0;
+  virtual void       SelBackground(PIColorMap& cmap, int cid)                  = 0;
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy)                         = 0;
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont)                       = 0;
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont)       = 0; 
+  virtual void       SelLine(PILineAtt att=PI_NormalLine)                      = 0;
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker)           = 0;
+
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)  = 0;
+  virtual void       ClearClipRectangle()                                      = 0;
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground()    = 0;
+  virtual PIColors   GetBackground()    = 0;
+  virtual PIGOMode   GetGOMode()        = 0;
+  virtual PIFontAtt  GetFontAtt()       = 0;
+  virtual int        GetFontSize()      = 0;
+  virtual PILineAtt  GetLineAtt()       = 0;
+  virtual PIMarker   GetMarker()        = 0;
+  virtual int        GetMarkerSize()    = 0;
+
+  virtual int        GetFontHeight(int& asc, int& desc)      = 0;
+  virtual PIGrCoord  CalcStringWidth(char const* s)          = 0;
+
+// Sauvegarde des attributs graphiques 
+  virtual void       SaveGraphicAtt();
+  virtual void       RestoreGraphicAtt();
+
+protected:
+// Pour Save/Restore des attributs graphiques 
+  PIWdg* myWdg;
+
+  PIColors  sFCol, sBCol;
+  PIGOMode sGOm;
+  PIFontAtt sFAtt;
+  PILineAtt sLAtt;
+  int sFSize;
+  PIMarker sMrk;
+  int sMrkSz;
+};
+
+#endif
+
+typedef PIGraphicGen PIGraphic;
+
+// hierarchie apparente
+//   PIGraphic               ( == Gen, mais pas visible de l'utilisateur).
+//     PIGraphicWin   ( == X ou Mac)
+//     PIGraphicPS
+//     PIGraphicUC
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphics.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphics.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphics.h	(revision 108)
@@ -0,0 +1,16 @@
+PIGraphics : = 0 sauf save et restore a reprendre de pibwdggen.cc
+
+Toutes methodes de trace et de selection.
+kind : retourne window, ps ou autre
+
+constructeur sans argument.
+
+->  PIGraphicsWinGen     rien de plus  sauf kind = window
+           constructeur prend un PIWdg
+     -> PIGraphicsWinMac 
+     -> PIGraphicsWinX
+
+->  PIGraphicsPS -> constructeur accepte un PSFile.
+
+
+=> toutes coords en float dans les draw
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphmac.cc	(revision 108)
@@ -0,0 +1,535 @@
+#include <stdio.h>
+
+#include "pigraphmac.h"
+
+
+
+// #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
+
+/* --Methode-- */
+PIGraphicMac::PIGraphicMac(PIWdg* wdg)
+: PIGraphicGen(wdg)
+{
+  mPane = wdg->mPane;
+}
+
+/* --Methode-- */
+PIGraphicMac::~PIGraphicMac()
+{
+}
+
+/* --Methode-- */
+void PIGraphicMac::Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+  if (mPane->FocusDraw()) {
+    Rect theRect = {(int)y0, (int)x0, (int)y0+(int)dy, (int)x0+(int)dx};
+    ::EraseRect(&theRect);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+  if (!mPane->FocusDraw()) {
+    ::MoveTo(x, y);
+    LStr255 ps = s;
+    ::TextFont(applFont);
+    ::DrawString(ps);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+  if (mPane->FocusDraw()) {
+    ::MoveTo(x, y);
+    LStr255 ps = s;
+    ::TextFont(applFont);
+	Rect box;
+	box.left = x;
+	box.bottom = y;
+	int iWidth = TextWidth(s,0,strlen(s));
+	box.right = box.left + iWidth;
+	int z;
+	box.top = box.bottom + GetFontHeight(z,z);
+    ::TETextBox(s,strlen(s),&box,teForceLeft);
+  }
+}
+
+ 
+/* --Methode-- */
+void PIGraphicMac::DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)
+{
+  if (mPane->FocusDraw()) {
+    ::MoveTo(x1,y1);
+    ::LineTo(x2,y2);
+  }
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+  if (mPane->FocusDraw()) {
+    Rect r = {y0, x0, (int)y0+(int)dy, (int)x0+(int)dx};
+    if (r.top  > r.bottom) swap(r.top,  r.bottom);
+    if (r.left > r.right)  swap(r.left, r.right);
+    r.right++; r.bottom++;
+    ::FrameRect(&r);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+  if (mPane->FocusDraw()) {
+    Rect r = {y0, x0, (int)y0+(int)dy, (int)x0+(int)dx};
+    if (r.top  > r.bottom) swap(r.top,  r.bottom);
+    if (r.left > r.right)  swap(r.left, r.right);
+    r.right++; r.bottom++;
+    ::PaintRect(&r);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+  if (mPane->FocusDraw()) {
+    Rect rr = {(int)y0-(int)r, (int)x0-(int)r, (int)y0+(int)r, (int)x0+(int)r};
+    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
+    if (rr.left > rr.right)  swap(rr.left, rr.right);
+    ::FrameOval(&rr);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+  if (mPane->FocusDraw()) {
+    Rect rr = {(int)y0-(int)r, (int)x0-(int)r, (int)y0+(int)r, (int)x0+(int)r};
+    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
+    if (rr.left > rr.right)  swap(rr.left, rr.right);
+    ::PaintOval(&rr);
+  }
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  PolyHandle h = MakePoly(x,y,n);
+  if (h) {
+    ::FramePoly(h);
+    ::KillPoly(h);
+  }
+  
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  PolyHandle h = MakePoly(x,y,n);
+  if (h) {
+    ::PaintPoly(h);
+    ::KillPoly(h);
+  }
+}
+
+/* --Methode-- */
+PolyHandle PIGraphicMac::MakePoly(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  if (mPane->FocusDraw()) {
+    PolyHandle h = ::OpenPoly();
+    ::MoveTo(x[0], y[0]);
+    for (int i=1; i<n; i++) {
+      ::LineTo(x[i], y[i]);
+    }
+    ::MoveTo(x[0], y[0]);
+    ClosePoly();
+    return h;
+  }
+  return NULL;
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::DrawMarker(PIGrCoord x0, PIGrCoord y0)
+{
+int hmsz = mMrkSz/2;
+int dmsz = mMrkSz-hmsz;
+PIGrCoord x[4],y[4];
+PILineAtt clatt;
+
+if (mMrk == PI_DotMarker) {
+  ::MoveTo( x0, y0);
+  ::Line(0,0);
+}
+
+else
+  {
+  clatt = mLAtt;
+  SelLine(PI_ThinLine);
+  switch (mMrk)
+    {
+    case  PI_PlusMarker :
+      DrawLine((int)x0-hmsz, y0, (int)x0+dmsz, y0);
+      DrawLine(x0, (int)y0-hmsz, x0, (int)y0+dmsz);
+      break;
+    case  PI_CrossMarker :
+      DrawLine((int)x0-hmsz, (int)y0-hmsz, (int)x0+dmsz, (int)y0+dmsz);
+      DrawLine((int)x0-hmsz, (int)y0+dmsz, (int)x0+dmsz, (int)y0-hmsz);
+      break;  
+    case PI_CircleMarker :
+      DrawCircle(x0, y0, hmsz);
+      break;
+    case PI_FCircleMarker :
+      DrawFCircle(x0, y0, hmsz);
+      break;
+    case PI_BoxMarker :
+      DrawBox((int)x0-hmsz, (int)y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case PI_FBoxMarker :
+      DrawFBox((int)x0-hmsz, (int)y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case  PI_TriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = (int)x0-hmsz; y[0] = (int)y0+hmsz;  
+      DrawPolygon(x, y, 4);
+      break;
+    case  PI_FTriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = (int)x0-hmsz; y[0] = (int)y0+hmsz;  
+      DrawFPolygon(x, y, 4);
+      break;
+    default :
+      ::MoveTo( x0, y0);
+      ::Line(0,0);
+      break;
+    }
+  SelLine(clatt);
+  }
+return;
+}
+
+/* --Methode-- */
+void PIGraphicMac::DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)
+{
+int i;
+
+if (n <= 0)  return;
+for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                            int sx, int sy, PIColorMap* cmap)
+{
+  Rect	frame;
+  SetRect(&frame, 0, 0, sx, sy);
+  Rect dstFrame;
+  SetRect(&dstFrame, x, y, sx, sy);
+  GWorldPtr gWorld;
+  ThrowIfOSErr_(NewGWorld(&gWorld, 8, &frame, cmap->GetCTab(), nil, 0));
+  PixMapHandle pmh = GetGWorldPixMap(gWorld);
+  ::LockPixels (pmh);
+  Ptr pmap = GetPixBaseAddr(pmh);
+  memcpy(pmap, pix, sx*sy);
+  ::ForeColor (blackColor);
+  ::BackColor (whiteColor);
+  ::CopyBits((BitMap *) (*pmh),
+				&mPane->GetMacPort()->portBits,
+				&frame, &dstFrame, srcCopy, nil);
+  ::UnlockPixels (pmh);
+  DisposeGWorld(gWorld);
+}
+
+
+
+/* --Methode-- */
+void PIGraphicMac::SelForeground(PIColors col)
+{
+  if (mPane->FocusDraw()) {
+    long color;
+    switch (col) {
+      case PI_Black:
+        color = blackColor;
+        break;
+      case PI_White:
+        color = whiteColor;
+        break;
+      case PI_Red:
+        color = redColor;
+        break;
+      case PI_Blue:
+        color = blueColor;
+        break;
+      case PI_Green:
+        color = greenColor;
+        break;
+      case PI_Yellow:
+        color = yellowColor;
+        break;
+      default:
+        color = blackColor;
+    }
+    ::ForeColor(color);
+    mFCol = col;
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::SelBackground(PIColors col)
+{
+  if (mPane->FocusDraw()) {
+    long color;
+    switch (col) {
+      case PI_Black:
+        color = blackColor;
+        break;
+      case PI_White:
+        color = whiteColor;
+        break;
+      case PI_Red:
+        color = redColor;
+        break;
+      case PI_Blue:
+        color = blueColor;
+        break;
+      case PI_Green:
+        color = greenColor;
+        break;
+      case PI_Yellow:
+        color = yellowColor;
+        break;
+      default:
+        color = blackColor;
+    }
+    mBCol = col;
+    ::BackColor(color);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::SelForeground(PIColorMap& cmap, int cid)
+{
+  if (mPane->FocusDraw()) {
+    PIColor picol = cmap.GetColor(cid);
+    RGBColor qdCol;
+ 
+    qdCol.red   = picol.red;
+    qdCol.green = picol.green;
+    qdCol.blue  = picol.blue;
+
+    ::RGBForeColor(&qdCol);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::SelBackground(PIColorMap& cmap, int cid)
+{
+  if (mPane->FocusDraw()) {
+    PIColor picol = cmap.GetColor(cid);
+    RGBColor qdCol;
+ 
+    qdCol.red   = picol.red;
+    qdCol.green = picol.green;
+    qdCol.blue  = picol.blue;
+
+    ::RGBBackColor(&qdCol);
+  }
+}
+
+/* --Methode-- */
+void PIGraphicMac::SelGOMode(PIGOMode mod)
+{
+if (mod == mGOm)  return;
+  if (mPane->FocusDraw())
+    switch (mod)
+    {
+      case PI_GOCopy :
+        ::PenMode(patCopy);
+        mGOm = mod;
+        break;
+      case PI_GOXOR :
+        ::PenMode(patXor);
+        mGOm = mod;
+        break;
+    }
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::SelFontSzPt(int npt, PIFontAtt att)
+{
+  if (mPane->FocusDraw()) {
+    ::TextFont(applFont);
+    ::TextSize(npt);
+    switch(att) {
+      case PI_RomanFont:
+        ::TextFace(0);
+        break;
+      case PI_BoldFont:
+        ::TextFace(bold);
+        break;
+      case PI_ItalicFont:
+        ::TextFace(italic);
+        break;
+    }
+  }
+  mFSize = npt;
+  mFAtt  = att;
+}
+
+/* --Methode-- */
+void PIGraphicMac::SelFont(PIFontSize sz, PIFontAtt att)
+{
+  switch(sz) {
+      case PI_SmallSizeFont:
+        SelFontSzPt(9, att);
+        break;
+      case PI_NormalSizeFont:
+        SelFontSzPt(12, att);
+        break;
+      case PI_BigSizeFont:
+        SelFontSzPt(14, att);
+        break;
+  }
+}
+
+
+
+/* --Methode-- */
+void PIGraphicMac::SelLine(PILineAtt att)
+{
+  if (mPane->FocusDraw()) {
+    switch(att) {
+      case PI_NormalLine:
+        ::PenSize(1,1);
+        break;
+      case PI_ThinLine:
+        ::PenSize(1,1);  // Mettre en pointille, ou bien commentaire pour Laser ?
+        break;
+      case PI_ThickLine:
+        ::PenSize(2,2);
+        break;
+    }
+  }
+  mLAtt = att;
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::SelMarker(int msz, PIMarker mrk)
+{
+if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
+else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicMac::SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+//$CHECK
+}
+
+/* --Methode-- */
+void PIGraphicMac::ClearClipRectangle()
+{ 
+//$CHECK
+}
+
+/* --Methode-- */
+PIColors  PIGraphicMac::GetForeground() 
+{
+return (mFCol);
+}
+
+/* --Methode-- */
+PIColors  PIGraphicMac::GetBackground() 
+{
+return (mBCol);
+}
+
+
+/* --Methode-- */
+PIGOMode   PIGraphicMac::GetGOMode()
+{
+return (mGOm);
+}
+
+/* --Methode-- */
+PIFontAtt  PIGraphicMac::GetFontAtt()
+{
+return (mFAtt);
+}
+
+/* --Methode-- */
+int        PIGraphicMac::GetFontSize()
+{
+return (mFSize);
+}
+
+/* --Methode-- */
+PILineAtt  PIGraphicMac::GetLineAtt()
+{
+return (mLAtt);
+}
+
+/* --Methode-- */
+PIMarker   PIGraphicMac::GetMarker()
+{
+return (mMrk);
+}
+
+/* --Methode-- */
+int        PIGraphicMac::GetMarkerSize()
+{
+return (mMrkSz);
+}
+
+/* --Methode-- */
+int        PIGraphicMac::GetFontHeight(int& asc, int& desc)   
+{
+  if (mPane->FocusDraw()) {
+    FontInfo info;
+    GetFontInfo(&info);
+    asc = info.ascent;
+    desc = info.descent;
+    return (asc + desc);
+  } else {
+    return 0;
+  }
+}
+
+/* --Methode-- */
+PIGrCoord PIGraphicMac::CalcStringWidth(char const* s)
+{
+//  if (mPane->FocusDraw())
+//    ::TextFont(applFont);
+  return ::TextWidth(s,0,strlen(s));
+}
+
+/* --Methode-- */
+void PIGraphicMac::SaveGraphicAtt()
+{  
+// Pour optimier l'implementation de PIBaseWdgGen
+
+// $CHECK$ faut faire quoi en plus de Gen ?
+PIGraphicGen::SaveGraphicAtt(); 
+return;
+}
+
+/* --Methode-- */
+void PIGraphicMac::RestoreGraphicAtt()
+{
+PIGraphicGen::RestoreGraphicAtt();
+}
+
+
+
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphmac.h	(revision 108)
@@ -0,0 +1,79 @@
+#ifndef PIGRAPHICMAC_H_SEEN
+#define PIGRAPHICMAC_H_SEEN
+
+#include "pisysdep.h"
+#include "pigraphgen.h"
+
+class PIGraphicMac : public PIGraphicGen
+{
+public:
+                     PIGraphicMac(PIWdg* wdg);
+  virtual           ~PIGraphicMac();
+
+//  Trace graphiques
+  virtual void       Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2);
+  virtual void       DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
+  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                                int sx, int sy, PIColorMap* cmap);
+
+// Modifications attributs graphiques
+  virtual void       SelForeground(PIColors col=PI_Black);
+  virtual void       SelBackground(PIColors col=PI_White);
+  virtual void       SelForeground(PIColorMap& cmap, int cid);
+  virtual void       SelBackground(PIColorMap& cmap, int cid);
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont);
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       ClearClipRectangle();
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground();
+  virtual PIColors   GetBackground();
+  virtual PIGOMode   GetGOMode();
+  virtual PIFontAtt  GetFontAtt();
+  virtual int        GetFontSize();
+  virtual PILineAtt  GetLineAtt();
+  virtual PIMarker   GetMarker();
+  virtual int        GetMarkerSize();
+
+  virtual int        GetFontHeight(int& asc, int& desc);
+  virtual PIGrCoord  CalcStringWidth(char const* s);
+
+// Sauvegarde des attributs graphiques 
+  virtual void       SaveGraphicAtt();
+  virtual void       RestoreGraphicAtt();
+
+protected:
+  LPane* mPane;
+  
+  PolyHandle         MakePoly(PIGrCoord *x, PIGrCoord *y, int n);
+
+  PIColors  mFCol, mBCol;
+  PIGOMode  mGOm;
+  PIFontAtt mFAtt;
+  PILineAtt mLAtt;
+  int       mFSize;
+  PIMarker  mMrk;
+  int       mMrkSz;
+
+};
+
+typedef PIGraphicMac PIGraphicWin;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphps.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphps.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphps.cc	(revision 108)
@@ -0,0 +1,411 @@
+#include <stdio.h>
+
+#include "pigraphps.h"
+
+
+/* --Methode-- */
+PIGraphicPS::PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, float ofy)
+: PIGraphicGen()
+{
+BuildFromPSFile(psf, (float)wdg->XPos()+ofx, (float)wdg->YPos()+ofy, 
+                     (float)wdg->XSize(), (float)wdg->YSize() );  
+}
+
+/* --Methode-- */
+PIGraphicPS::PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy)
+: PIGraphicGen()
+{
+BuildFromPSFile(psf, x0, y0, dx, dy);
+}
+
+/* --Methode-- */
+PIGraphicPS::~PIGraphicPS()
+{
+mPSOut->EndBloc();
+}
+
+/* --Methode-- */
+int PIGraphicPS::kind()
+{
+return PI_PSFileGraphics; 
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, float dy)
+{
+mPSOut = psf;
+
+mGOm = PI_GOCopy;
+
+mFCol = mBCol = PI_Grey;
+SelForeground(PI_Black);
+SelBackground(PI_White);
+mLAtt = PI_ThinLine;
+SelLine();
+mFAtt = PI_BoldFont;  mFSize = 0;
+SelFont();
+SelMarker(1, PI_DotMarker);
+
+if (psf) psf->NewBloc(x0, y0, dx, dx, dy, dy);
+mXmin = mYmin = 0.;
+mXmax = dx;  mYmax = dy;
+mFCfMap.red = mFCfMap.blue = mFCfMap.blue = 0;
+mBCfMap = mFCfMap; 
+}
+
+/* --Methode-- */
+void PIGraphicPS::GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax)
+{
+xmin = ymin = 0;  
+xmax = mXmax; ymax = mYmax;
+}
+
+/* --Methode-- */
+void PIGraphicPS::Erase(PIGrCoord, PIGrCoord, PIGrCoord, PIGrCoord)
+{
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+if(mPSOut)
+  mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+if(mPSOut)
+  mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
+return;
+}
+
+ 
+/* --Methode-- */
+void PIGraphicPS::DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)
+{
+if(mPSOut)
+  mPSOut->DrawLine((float)x1,(float)y1,(float)x2,(float)y2,mFCol,mLAtt);
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+if(mPSOut)
+  mPSOut->DrawBox((float)x0,(float)y0,(float)dx,(float)dy,mFCol,mLAtt);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+if(mPSOut)
+  mPSOut->DrawFBox((float)x0,(float)y0,(float)dx,(float)dy, mFCol, mFCol, mLAtt);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+if(mPSOut)
+  mPSOut->DrawCircle((float)x0,(float)y0,(float)r,mFCol,mLAtt);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+if(mPSOut)
+  mPSOut->DrawFCircle((float)x0,(float)y0,(float)r,mFCol,mFCol,mLAtt);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+int i;
+float *xtmp;
+float *ytmp;
+
+if(! mPSOut) return;
+
+xtmp = new float[n];
+ytmp = new float[n];
+for(i=0;i<n;i++){
+  xtmp[i] = (float)x[i];
+  ytmp[i] = (float)y[i];
+}
+mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt);
+delete[] xtmp;
+delete[] ytmp;
+
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+int i;
+float *xtmp;
+float *ytmp;
+
+if(! mPSOut) return;
+
+xtmp = new float[n];
+ytmp = new float[n];
+for(i=0;i<n;i++){
+  xtmp[i] = (float)x[i];
+  ytmp[i] = (float)y[i];
+}
+mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt);
+delete[] xtmp;
+delete[] ytmp;
+
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawMarker(PIGrCoord x0, PIGrCoord y0)
+{
+if(mPSOut)
+  mPSOut->DrawMarker((float)x0,(float)y0,mMrk,mFCol,mMrkSz);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)
+{
+int i;
+float *xtmp;
+float *ytmp;
+
+if( !mPSOut)  return;
+
+xtmp = new float[n];
+ytmp = new float[n];
+for(i=0;i<n;i++){
+  xtmp[i] = (float)x[i];
+  ytmp[i] = (float)y[i];
+}
+mPSOut->DrawMarkers(xtmp,ytmp,n,mMrk,mFCol, mMrkSz);
+delete[] xtmp;
+delete[] ytmp;
+
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                            int sx, int sy, PIColorMap* cmap)
+{
+if ( (sx < 1) || (sy < 1) )  return;
+if ((pix == NULL) || (cmap == NULL)) return; 
+if(mPSOut) 
+  mPSOut->Image((float)x, (float)y, (float)sx, (float)sy, sx, sy, pix, cmap);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelForeground(PIColors col)
+{
+mFCol = col;
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelBackground(PIColors col)
+{
+mBCol = col;
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelForeground(PIColorMap& cmap, int cid)
+{
+mFCfMap = cmap.GetColor(cid);
+mFCol = PI_ColorFromMap;
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelBackground(PIColorMap& cmap, int cid)
+{
+mBCfMap = cmap.GetColor(cid);
+mBCol = PI_ColorFromMap;
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelGOMode(PIGOMode mod)
+{
+mGOm = mod;
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::SelFontSzPt(int npt, PIFontAtt att)
+{
+mFSize = npt;
+mFAtt = att;
+return;
+}
+
+static int fntsz[5] = {8,10,12,14,16};
+
+/* --Methode-- */
+void PIGraphicPS::SelFont(PIFontSize sz, PIFontAtt att)
+{
+int i;
+switch (sz) {
+  case PI_SmallSizeFont:
+    i = 0;
+    break;
+  case PI_NormalSizeFont:
+    i = 2;
+    break;
+  case PI_BigSizeFont:
+    i = 4;
+    break;
+  default:
+    i=2;
+    break;
+  }
+mFSize = fntsz[i];
+mFAtt = att;
+return;
+}
+
+
+
+/* --Methode-- */
+void PIGraphicPS::SelLine(PILineAtt att)
+{
+mLAtt = att;
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::SelMarker(int msz, PIMarker mrk)
+{
+if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
+else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::SetClipRectangle(PIGrCoord /*x0*/, PIGrCoord /*y0*/, PIGrCoord /*dx*/, PIGrCoord /*dy*/)
+{
+/*  $CHECK$  A FAIRE , voir Nicolas  */
+return;
+}
+
+/* --Methode-- */
+void PIGraphicPS::ClearClipRectangle()
+{ 
+/*  $CHECK$  A FAIRE , voir Nicolas  */
+return;
+}
+
+/* --Methode-- */
+PIColors  PIGraphicPS::GetForeground() 
+{
+return (mFCol);
+}
+
+/* --Methode-- */
+PIColors  PIGraphicPS::GetBackground() 
+{
+return (mBCol);
+}
+
+
+/* --Methode-- */
+PIGOMode   PIGraphicPS::GetGOMode()
+{
+return (mGOm);
+}
+
+/* --Methode-- */
+PIFontAtt  PIGraphicPS::GetFontAtt()
+{
+return (mFAtt);
+}
+
+/* --Methode-- */
+int        PIGraphicPS::GetFontSize()
+{
+return (mFSize);
+}
+
+/* --Methode-- */
+PILineAtt  PIGraphicPS::GetLineAtt()
+{
+return (mLAtt);
+}
+
+/* --Methode-- */
+PIMarker   PIGraphicPS::GetMarker()
+{
+return (mMrk);
+}
+
+/* --Methode-- */
+int        PIGraphicPS::GetMarkerSize()
+{
+return (mMrkSz);
+}
+
+/* --Methode-- */
+int        PIGraphicPS::GetFontHeight(int& asc, int& desc)   
+{
+/*  $CHECK$  A refaire , voir Nicolas  */
+asc = mFSize; desc = 0; 
+return(asc+desc);
+}
+
+
+/* --Methode-- */
+PIGrCoord PIGraphicPS::CalcStringWidth(char const* s)
+{
+return((float)(mFSize*strlen(s)));   /*  $CHECK$  Voir Nicolas ! */
+}
+
+/* --Methode-- */
+void PIGraphicPS::SaveGraphicAtt()
+{  
+// Pour optimier l'implementation de PIBaseWdgGen
+sFCol = mFCol;    sBCol = mBCol;
+sGOm = mGOm;
+sFAtt = mFAtt;   sFSize = mFSize;
+sMrk = mMrk;   sMrkSz = mMrkSz;
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicPS::RestoreGraphicAtt()
+{
+  if (sFCol != PI_ColorFromMap) SelForeground(sFCol);  
+// else    A faire Nicolas  
+  if (sBCol != PI_ColorFromMap) SelBackground(sBCol);
+// else    A faire Nicolas  
+  SelGOMode(sGOm);
+  SelFontSzPt(sFSize, sFAtt);
+  SelLine(sLAtt);
+  SelMarker(sMrkSz, sMrk);
+  return;
+}
+
+
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphps.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphps.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphps.h	(revision 108)
@@ -0,0 +1,87 @@
+#ifndef PIGRAPHICPS_H_SEEN
+#define PIGRAPHICPS_H_SEEN
+
+#include "pisysdep.h"
+#include "pigraphgen.h"
+#include "psfile.h"
+
+class PIGraphicPS : public PIGraphicGen
+{
+public:
+                     PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx=0., float ofy=0.);
+                     PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy);
+  virtual           ~PIGraphicPS();
+
+  virtual int        kind();
+
+//  Espace des coordonnees
+  virtual void       GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax); 
+
+//  Trace graphiques
+  virtual void       Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2);
+  virtual void       DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
+  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                                int sx, int sy, PIColorMap* cmap);
+
+// Modifications attributs graphiques
+  virtual void       SelForeground(PIColors col=PI_Black);
+  virtual void       SelBackground(PIColors col=PI_White);
+  virtual void       SelForeground(PIColorMap& cmap, int cid);
+  virtual void       SelBackground(PIColorMap& cmap, int cid);
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont);
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       ClearClipRectangle();
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground();
+  virtual PIColors   GetBackground();
+  virtual PIGOMode   GetGOMode();
+  virtual PIFontAtt  GetFontAtt();
+  virtual int        GetFontSize();
+  virtual PILineAtt  GetLineAtt();
+  virtual PIMarker   GetMarker();
+  virtual int        GetMarkerSize();
+
+  virtual int        GetFontHeight(int& asc, int& desc);
+  virtual PIGrCoord  CalcStringWidth(char const* s);
+
+// Sauvegarde des attributs graphiques 
+  virtual void       SaveGraphicAtt();
+  virtual void       RestoreGraphicAtt();
+
+protected:
+  void           BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, float dy);
+
+  PSFile * mPSOut;  /* Fichier PostScript */
+  float mXmin, mYmin;
+  float mXmax, mYmax;
+
+  PIColors  mFCol, mBCol;
+  PIColor  mFCfMap, mBCfMap;
+  PIGOMode mGOm;
+  PIFontAtt mFAtt;
+  PILineAtt mLAtt;
+  int mFSize;
+  PIMarker mMrk;
+  int mMrkSz;
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphuc.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphuc.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphuc.cc	(revision 108)
@@ -0,0 +1,605 @@
+#include "pigraphuc.h"
+
+
+
+// Pour echanger deux valeurs PIGrCoord
+static float swpfl;
+static inline void fl_swap(float& grc1, float& grc2)
+{ swpfl = grc1; grc1 = grc2; grc2 = swpfl; }
+
+/* --Methode-- */
+PIGraphicUC::PIGraphicUC(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+  : PIGraphicGen()
+{
+  mGrC = g;
+  xW0 = x0;  yW0 = y0; 
+  xWd = dx;  yWd = dy; 
+  aXdir = false;  // Vrai si Axe X de Droite vers Gauche 
+  aYdir = false;  // Vrai si Axe Y de Haut vers Bas
+  SetUCS(0., 1., 0., 1., kAxeDirLtoR, kAxeDirDownUp);
+  clip = true;  
+}
+
+/* --Methode-- */
+PIGraphicUC::~PIGraphicUC()
+{
+}
+
+/* --Methode-- */
+int PIGraphicUC::kind() 
+{
+return PI_UCGraphics; 
+}
+
+/* --Methode-- */
+void PIGraphicUC::GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax)
+{
+xmin = xMin;  ymin = yMin;  
+xmax = xMax;  ymax = yMax;
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SetUCS(float xmin, float xmax, float ymin, float ymax,
+                         int axrl, int ayud)
+{
+  if (xmax <= xmin || ymax <= ymin)
+    return; // $CHECK$ exception ?
+  if (axrl == kAxeDirLtoR)  aXdir = false;
+  else if (axrl == kAxeDirRtoL)  aXdir = true;
+  if (ayud == kAxeDirDownUp)  aYdir = false;
+  else if (ayud == kAxeDirUpDown)  aYdir = true;
+  xMin = xmin;
+  xMax = xmax;
+  yMin = ymin;
+  yMax = ymax;
+
+  xScale = xWd/(xMax-xMin);
+  if (aXdir)  { 
+    xScale = -xScale;
+    xOrg   = -xMax * xScale;
+  }
+  else xOrg   = -xMin * xScale;
+  xOrg += xW0;
+
+  yScale = yWd/(yMax-yMin);
+  if (!aYdir) {
+    yScale = -yScale;
+    yOrg   = -yMax  * yScale;
+    }
+  else yOrg   = -yMin * yScale;
+  yOrg += yW0;
+  return;
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::UC2GrC(float x, float y, float& xpix, float& ypix)
+{
+  xpix = (float)(xOrg + x*xScale + .5);
+  ypix = (float)(yOrg + y*yScale + .5);
+}
+
+/* --Methode-- */
+void PIGraphicUC::GrC2UC(float xpix, float ypix, float& x, float& y)
+{
+  x = (xpix-xOrg)/xScale;
+  y = (ypix-yOrg)/yScale;
+}
+
+/* --Methode-- */
+void PIGraphicUC::DUC2GrC(float dx, float dy, float& dxpix, float& dypix)
+{
+  dxpix = dx*xScale;
+  if (dxpix < 0)  dxpix = -dxpix;
+  dypix = dy*yScale;
+  if (dypix < 0)  dypix = -dypix;
+}
+
+/* --Methode-- */
+void PIGraphicUC::DGrC2UC(float dxpix, float dypix, float& dx, float& dy)
+{
+  dx = dxpix/xScale;
+  dy = dypix/yScale;
+  if (dx < 0.) dx = -dx;
+  if (dy < 0.) dy = -dy;
+}
+
+/* --Methode-- */
+void PIGraphicUC::Erase(PIGrCoord xc, PIGrCoord yc, PIGrCoord dxc, PIGrCoord dyc)
+{
+  if (!mGrC) return;
+  float x, y, dx, dy;
+  x = xc;  dx = dxc;
+  y = yc;  dy = dyc;
+  if (clip) {
+    if (dx < 0) {
+      x = x+dx;
+      dx = -dx;
+    }
+    if (dy < 0) {
+      y = y+dy;
+      dy = -dy;
+    }
+    if (x > xMax || x+dx < xMin || y > yMax || y+dy < yMin) return;
+    if (x < xMin) {
+      dx -= (xMin-x);
+      x = xMin;
+    }
+    if (y < yMin) {
+      dy -= (yMin-y);
+      y = yMin;
+    }
+    if (x+dx > xMax)
+      dx = (xMax-x);
+    if (y+dy > yMax)
+      dy = (yMax-y);
+  }
+
+  float xf, yf, xf2, yf2;
+  UC2GrC(x, y, xf, yf);
+  UC2GrC(x+dx, y+dy, xf2, yf2);
+  if (xf2 < xf)  fl_swap(xf, xf2);
+  if (yf2 < yf)  fl_swap(yf, yf2);
+  mGrC->Erase(xf, yf, xf2-xf, yf2-yf);
+}
+
+/* --Methode-- */
+void PIGraphicUC::DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos)
+{
+  if (!mGrC) return;
+  float xf, yf;
+  UC2GrC(x, y, xf, yf);
+  mGrC->DrawString(xf, yf, s, pos);  
+}
+
+/* --Methode-- */
+void PIGraphicUC::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos)
+{
+  if (!mGrC) return;
+  float xf, yf;
+  UC2GrC(x, y, xf, yf);
+  mGrC->DrawOpaqueString(xf, yf, s, pos);  
+}
+
+/* --Methode-- */
+void PIGraphicUC::DrawLine(PIGrCoord xc1, PIGrCoord yc1, PIGrCoord xc2, PIGrCoord yc2)
+{
+  
+  if (!mGrC) return;
+  float x1, y1, x2, y2;
+  x1 = xc1;  y1 = yc1;
+  x2 = xc2;  y2 = yc2;
+  if (clip) {
+    if (x2 < xMin && x1 < xMin) return;
+    if (x2 > xMax && x1 > xMax) return;
+    if (y1 < yMin && y2 < yMin) return;
+    if (y1 > yMax && y2 > yMax) return;
+    if (x2 < x1) {
+      fl_swap(x1,x2);
+      fl_swap(y1,y2);
+    }
+    if (x2>xMax) {
+      y2 = y1 + (y2-y1)/(x2-x1)*(xMax-x1);
+      x2 = xMax;
+    }
+    if (x1<xMin) {
+      y1 = y2 + (y1-y2)/(x1-x2)*(xMin-x2);
+      x1 = xMin;
+    }
+    if (y2 < y1) {
+      fl_swap(x1,x2);
+      fl_swap(y1,y2);
+    }
+    if (y2>yMax) {
+      x2 = x1 + (x2-x1)/(y2-y1)*(yMax-y1);
+      y2 = yMax;
+    }
+    if (y1<yMin) {
+      x1 = x2 + (x1-x2)/(y1-y2)*(yMin-y2);
+      y1 = yMin;
+    }
+  }
+
+  float xf1, yf1, xf2, yf2;
+  UC2GrC(x1, y1, xf1, yf1);
+  UC2GrC(x2, y2, xf2, yf2);
+  mGrC->DrawLine(xf1, yf1, xf2, yf2);
+
+}  
+
+
+/* --Methode-- */
+void PIGraphicUC::DrawBox(PIGrCoord xc, PIGrCoord yc, PIGrCoord dxc, PIGrCoord dyc)
+{
+  if (!mGrC) return;
+  float x, y, dx, dy;
+  x = xc;  dx = dxc;
+  y = yc;  dy = dyc;
+  if (clip) {
+    if (dx < 0) {
+      x = x+dx;
+      dx = -dx;
+    }
+    if (dy < 0) {
+      y = y+dy;
+      dy = -dy;
+    }
+    if (x > xMax || x+dx < xMin || y > yMax || y+dy < yMin) return;
+    if (x < xMin) {
+      dx -= (xMin-x);
+      x = xMin;
+    }
+    if (y < yMin) {
+      dy -= (yMin-y);
+      y = yMin;
+    }
+    if (x+dx > xMax)
+      dx = (xMax-x);
+    if (y+dy > yMax)
+      dy = (yMax-y);
+  }
+
+  float xf, yf, xf2, yf2;
+  UC2GrC(x, y, xf, yf);
+  UC2GrC(x+dx, y+dy, xf2, yf2);
+  if (xf2 < xf)  fl_swap(xf, xf2);
+  if (yf2 < yf)  fl_swap(yf, yf2);
+  mGrC->DrawBox(xf, yf, xf2-xf, yf2-yf);
+}  
+
+/* --Methode-- */
+void PIGraphicUC::DrawFBox(PIGrCoord xc, PIGrCoord yc, PIGrCoord dxc, PIGrCoord dyc)
+{
+  if (!mGrC) return;
+  float x, y, dx, dy;
+  x = xc;  dx = dxc;
+  y = yc;  dy = dyc;
+  if (clip) {
+    if (dx < 0) {
+      x = x+dx;
+      dx = -dx;
+    }
+    if (dy < 0) {
+      y = y+dy;
+      dy = -dy;
+    }
+    if (x > xMax || x+dx < xMin || y > yMax || y+dy < yMin) return;
+    if (x < xMin) {
+      dx -= (xMin-x);
+      x = xMin;
+    }
+    if (y < yMin) {
+      dy -= (yMin-y);
+      y = yMin;
+    }
+    if (x+dx > xMax)
+      dx = (xMax-x);
+    if (y+dy > yMax)
+      dy = (yMax-y);
+  }
+
+  float xf, yf, xf2, yf2;
+  UC2GrC(x, y, xf, yf);
+  UC2GrC(x+dx, y+dy, xf2, yf2);
+  if (xf2 < xf)  fl_swap(xf, xf2);
+  if (yf2 < yf)  fl_swap(yf, yf2);
+  mGrC->DrawFBox(xf, yf, xf2-xf, yf2-yf);
+}  
+
+/* --Methode-- */
+void PIGraphicUC::DrawCircle(PIGrCoord x, PIGrCoord y, PIGrCoord r)
+{
+  if (!mGrC) return;
+
+  float xf, yf, rf,rfy;
+  UC2GrC(x, y, xf, yf);
+  DUC2GrC(r,r,rf,rfy);
+  rf = 0.5*(rf+rfy);
+  mGrC->DrawCircle(xf, yf, rf);
+}  
+
+/* --Methode-- */
+void PIGraphicUC::DrawFCircle(PIGrCoord x, PIGrCoord y, PIGrCoord r)
+{
+  if (!mGrC) return;
+
+  float xf, yf, rf, rfy;
+  UC2GrC(x, y, xf, yf);
+  DUC2GrC(r,r,rf,rfy);
+  rf = 0.5*(rf+rfy);
+  mGrC->DrawFCircle(xf, yf, rf);
+}
+
+#define NMXMULTP  30   // Pour multipoint sans new
+
+/* --Methode-- */
+void PIGraphicUC::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  PIGrCoord xc[NMXMULTP], yc[NMXMULTP];
+  PIGrCoord *pxc, *pyc;
+  int i;
+  float xf, yf;
+ 
+  if (!mGrC) return;
+  if (n <= 0)  return;
+
+  if (n > NMXMULTP) { pxc = new PIGrCoord[n];  pyc = new PIGrCoord[n]; }
+  else { pxc = xc;  pyc = yc; }
+  for(i=0; i<n; i++) {
+    UC2GrC(x[i], y[i], xf, yf);
+    pxc[i] = xf;  pyc[i] = yf; 
+  }
+  mGrC->DrawPolygon(pxc, pyc, n);
+  if (n > NMXMULTP) { delete[] pxc;  delete[] pyc; }
+  return;
+}
+  
+/* --Methode-- */
+void PIGraphicUC::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  PIGrCoord xc[NMXMULTP], yc[NMXMULTP];
+  PIGrCoord *pxc, *pyc;
+  int i;
+  float xf, yf;
+ 
+  if (!mGrC) return;
+  if (n <= 0)  return;
+
+  if (n > NMXMULTP) { pxc = new PIGrCoord[n];  pyc = new PIGrCoord[n]; }
+  else { pxc = xc;  pyc = yc; }
+  for(i=0; i<n; i++) {
+    UC2GrC(x[i], y[i], xf, yf);
+    pxc[i] = xf;  pyc[i] = yf; 
+  }
+  mGrC->DrawFPolygon(pxc, pyc, n);
+  if (n > NMXMULTP) { delete[] pxc;  delete[] pyc; }
+  return;
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::DrawMarker(PIGrCoord x0, PIGrCoord y0)
+{
+  if (!mGrC) return;
+  float xf, yf;
+  UC2GrC(x0, y0, xf, yf);
+  mGrC->DrawMarker(xf, yf);
+  return;
+}
+
+/* --Methode-- */
+void PIGraphicUC::DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)
+{
+  PIGrCoord xc[NMXMULTP], yc[NMXMULTP];
+  PIGrCoord *pxc, *pyc;
+  int i;
+  float xf, yf;
+ 
+  if (!mGrC) return;
+  if (n <= 0)  return;
+
+  if (n > NMXMULTP) { pxc = new PIGrCoord[n];  pyc = new PIGrCoord[n]; }
+  else { pxc = xc;  pyc = yc; }
+  for(i=0; i<n; i++) {
+    UC2GrC(x[i], y[i], xf, yf);
+    pxc[i] = xf;  pyc[i] = yf; 
+  }
+  mGrC->DrawMarkers(pxc, pyc, n);
+  if (n > NMXMULTP) { delete[] pxc;  delete[] pyc; }
+  return;
+}
+
+/* --Methode-- */
+void PIGraphicUC::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix,
+                        int sx, int sy, PIColorMap* cmap)
+{
+  if (!mGrC) return;
+  if ( (sx < 1) || (sy < 1) )  return;
+  if ((pix == NULL) || (cmap == NULL)) return; 
+  float xf,yf;
+  UC2GrC(x, y, xf, yf);
+  mGrC->DrawPixmap(xf, yf, pix, sx, sy, cmap);
+}
+
+
+
+/* --Methode-- */
+void PIGraphicUC::SelForeground(PIColors col)
+{
+  if (!mGrC) return;
+  mGrC->SelForeground(col);
+  return;  
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SelBackground(PIColors col)
+{
+  if (!mGrC) return;
+  mGrC->SelBackground(col);
+  return;  
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelForeground(PIColorMap& cmap, int cid)
+{
+  if (!mGrC) return;
+  mGrC->SelForeground(cmap, cid);
+  return;  
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SelBackground(PIColorMap& cmap, int cid)
+{
+  if (!mGrC) return;
+  mGrC->SelBackground(cmap, cid);
+  return;  
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelGOMode(PIGOMode mod)
+{
+  if (!mGrC) return;
+  mGrC->SelGOMode(mod);
+  return;  
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelFont(PIFontSize sz, PIFontAtt att)
+{
+  if (!mGrC) return;
+  mGrC->SelFont(sz, att);
+  return;  
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelFontSzPt(int npt, PIFontAtt att)
+{
+  if (!mGrC) return;
+  mGrC->SelFontSzPt(npt, att);
+  return;  
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SelLine(PILineAtt att)
+{
+  if (!mGrC) return;
+  mGrC->SelLine(att);
+  return;  
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelMarker(int msz, PIMarker mrk)
+{
+  if (!mGrC) return;
+  mGrC->SelMarker( msz, mrk);
+}
+
+/* --Methode-- */
+void PIGraphicUC::SelFontSz(PIGrCoord sz, PIFontAtt att)
+{
+  if (!mGrC) return;
+  float fx, fy;
+  DUC2GrC((float)sz, (float)sz, fx, fy);
+  int npt = (int)fy;
+  if (npt < 8) npt = 8;
+  if (npt > 127) npt = 127;
+  mGrC->SelFontSzPt(npt, att);
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SelMarkerSz(PIGrCoord sz, PIMarker mrk)
+{
+  if (!mGrC) return;
+  float fx, fy;
+  DUC2GrC((float)sz, (float)sz, fx, fy);
+  int isz = int(0.5*(fx+fy+1));
+  mGrC->SelMarker( isz, mrk);
+}
+
+/* --Methode-- */
+void PIGraphicUC::SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+  /* $CHECK$  A faire Reza 08/02/97  */
+return;
+}
+/* --Methode-- */
+void PIGraphicUC::ClearClipRectangle()
+{
+  /* $CHECK$  A faire Reza 08/02/97  */
+return;
+}
+
+/* --Methode-- */
+PIColors PIGraphicUC::GetForeground()
+{
+  if (!mGrC) return(PI_NotDefColor);
+  return(mGrC->GetForeground());
+}
+
+/* --Methode-- */
+PIColors PIGraphicUC::GetBackground()
+{
+  if (!mGrC) return(PI_NotDefColor);
+  return(mGrC->GetBackground());
+}
+
+/* --Methode-- */
+PIGOMode PIGraphicUC::GetGOMode()
+{
+  if (!mGrC) return(PI_GOCopy);
+  return(mGrC->GetGOMode());
+}
+
+/* --Methode-- */
+PIFontAtt PIGraphicUC::GetFontAtt()
+{
+  if (!mGrC) return(PI_NotDefFontAtt);
+  return(mGrC->GetFontAtt());
+}
+
+/* --Methode-- */
+int PIGraphicUC::GetFontSize()
+{
+  if (!mGrC) return(0);
+  return(mGrC->GetFontSize());
+}
+
+/* --Methode-- */
+PILineAtt PIGraphicUC::GetLineAtt()
+{
+  if (!mGrC) return(PI_NotDefLineAtt);
+  return(mGrC->GetLineAtt());
+}
+
+/* --Methode-- */
+PIMarker PIGraphicUC::GetMarker()
+{
+  if (!mGrC) return(PI_NotDefMarker);
+  return(mGrC->GetMarker());
+}
+
+/* --Methode-- */
+int PIGraphicUC::GetMarkerSize()
+{
+  if (!mGrC) return(0);
+  return(mGrC->GetMarkerSize());
+}
+
+/* --Methode-- */
+int PIGraphicUC::GetFontHeight(int& asc, int& desc)
+{
+  asc = desc = 0;
+  if (!mGrC) return(0);
+  return( mGrC->GetFontHeight(asc, desc) );
+}
+
+/* --Methode-- */
+PIGrCoord PIGraphicUC::CalcStringWidth(char const* s)
+{
+  if (!mGrC) return(0.);
+  float dx = mGrC->CalcStringWidth(s);
+  float dxx, dxy;
+  DGrC2UC(dx, dx, dxx, dxy);
+  return(dxx);
+}
+
+
+/* --Methode-- */
+void PIGraphicUC::SaveGraphicAtt()
+{
+  if (!mGrC) return;
+  mGrC->SaveGraphicAtt();
+}
+
+/* --Methode-- */
+void PIGraphicUC::RestoreGraphicAtt()
+{
+  if (!mGrC) return;
+  mGrC->RestoreGraphicAtt();
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphuc.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphuc.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphuc.h	(revision 108)
@@ -0,0 +1,106 @@
+#ifndef PIGRAPHICUC_H_SEEN
+#define PIGRAPHICUC_H_SEEN
+
+#include "pisysdep.h"
+#include "pigraphgen.h"
+
+enum {
+  kAxeDirSame     = 0,
+  kAxeDirLtoR     = 1,
+  kAxeDirRtoL     = 2,
+  kAxeDirDownUp   = 3,
+  kAxeDirUpDown   = 4
+};
+
+class PIGraphicUC : public PIGraphicGen
+{
+public:
+                     PIGraphicUC(PIGraphicGen* g, PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual           ~PIGraphicUC();
+
+  virtual int        kind();
+
+//  Espace des coordonnees
+  virtual void       GetGrSpace(PIGrCoord& xmin, PIGrCoord& xmax, PIGrCoord& ymin, PIGrCoord& ymax);
+
+//  Definition des coordonnees utilisateur
+  virtual void       SetUCS(float xmin, float xmax, float ymin, float ymax,
+                            int axrl=kAxeDirSame, int ayud=kAxeDirSame);     
+
+//  Trace graphiques
+  virtual void       Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2);
+  virtual void       DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
+  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                                int sx, int sy, PIColorMap* cmap);
+
+// Modifications attributs graphiques
+  virtual void       SelForeground(PIColors col=PI_Black);
+  virtual void       SelBackground(PIColors col=PI_White);
+  virtual void       SelForeground(PIColorMap& cmap, int cid);
+  virtual void       SelBackground(PIColorMap& cmap, int cid);
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont);
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+//  Fonctions specifiques a PIGraphicUC :
+  virtual void       SelFontSz(PIGrCoord sz, PIFontAtt att=PI_RomanFont);
+  virtual void       SelMarkerSz(PIGrCoord msz, PIMarker mrk=PI_DotMarker);
+
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       ClearClipRectangle();
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground();
+  virtual PIColors   GetBackground();
+  virtual PIGOMode   GetGOMode();
+  virtual PIFontAtt  GetFontAtt();
+  virtual int        GetFontSize();
+  virtual PILineAtt  GetLineAtt();
+  virtual PIMarker   GetMarker();
+  virtual int        GetMarkerSize();
+
+  virtual int        GetFontHeight(int& asc, int& desc);
+  virtual PIGrCoord  CalcStringWidth(char const* s);
+
+// Sauvegarde des attributs graphiques 
+  virtual void       SaveGraphicAtt();
+  virtual void       RestoreGraphicAtt();
+
+//  Transformation des ccordonnees
+  virtual void       UC2GrC(float x, float y, float& xpix, float& ypix);
+  virtual void       GrC2UC(float xpix, float ypix, float& x, float& y);
+  virtual void       DUC2GrC(float dx, float dy, float& dxpix, float& dypix);
+  virtual void       DGrC2UC(float dxpix, float dypix, float& dx, float& dy);
+
+  void   NoClip() {clip = false; }
+  void   Clip() {clip = true; }
+  inline PIGraphicGen*  BaseGraphic() { return(mGrC); }
+
+protected:
+
+  PIGraphicGen* mGrC;
+
+  float xMin, xMax, yMin, yMax; // Valeurs en unites user
+  float xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
+  float xScale, yScale;         // Pixels par unites graphiques
+  float xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
+  bool   aXdir, aYdir;           // Sens des axes horiz, vertical 
+  bool   clip;
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphx.cc	(revision 108)
@@ -0,0 +1,698 @@
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+
+#include "pigraphx.h"
+
+
+/*  Variables globales pour modifier les GC  */
+#define NMAXFONTSZ  7
+static XFontStruct * fntst[NMAXFONTSZ][3];
+static int fntsz[NMAXFONTSZ] = {8,10,12,14,16,20,24};
+static  PIFontAtt fntatt[3] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont }; 
+#define NMAXCOL  10
+static  PIXColor colpix[NMAXCOL];
+
+/*  GC pour DrawPixmap   */
+static GC dpxgc;
+
+// #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
+
+/* --Methode-- */
+PIGraphicX::PIGraphicX(PIWdg* wdg)
+: PIGraphicGen(wdg)
+{
+Init();
+
+mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL);
+mGOm = PI_GOCopy;
+
+mFCol = mBCol = PI_Grey;
+SelForeground(PI_Black);
+SelBackground(PI_White);
+mLAtt = PI_ThinLine;
+SelLine();
+mFAtt = PI_BoldFont;  mFSize = 0;
+SelFont();
+SelMarker(1, PI_DotMarker);  
+mFCfMap = colpix[PI_Black];  mBCfMap = colpix[PI_White];
+}
+
+/* --Methode-- */
+PIGraphicX::~PIGraphicX()
+{
+}
+
+/* --Methode-- */
+void PIGraphicX::Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+XClearArea (XtDisplay(MyWdg()),XtWindow(MyWdg()), (int)x0, (int)y0, (int)dx, (int)dy, False );
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+XDrawString (XtDisplay (MyWdg()),XtWindow(MyWdg()), 
+                  DefGC(), (int)x, (int)y, s, strlen(s));
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int /*pos*/)
+{
+XDrawImageString (XtDisplay (MyWdg()),XtWindow(MyWdg()), 
+                  DefGC(), (int)x, (int)y, s, strlen(s));
+return;
+}
+
+ 
+/* --Methode-- */
+void PIGraphicX::DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2)
+{
+XDrawLine(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), (int)x1, (int)y1, (int)x2, (int)y2);
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+int ix0 = x0;
+int iy0 = y0;
+int idx = dx;
+int idy = dy;
+if (idx < 0)  { ix0 += idx;  idx = -idx; }
+if (idy < 0)  { iy0 += idy;  idy = -idy; }
+XDrawRectangle(XtDisplay (MyWdg()), XtWindow(MyWdg()), 
+               DefGC(), ix0, iy0, idx, idy);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+int ix0 = x0;
+int iy0 = y0;
+int idx = dx;
+int idy = dy;
+if (idx < 0)  { ix0 += idx;  idx = -idx; }
+if (idy < 0)  { iy0 += idy;  idy = -idy; }
+XFillRectangle(XtDisplay (MyWdg()), XtWindow(MyWdg()), 
+               DefGC(), ix0, iy0, idx, idy);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+XDrawArc(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(),
+         (int)x0-(int)r, (int)y0-(int)r, 2*(int)r, 2*(int)r, 0, 360*64);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r)
+{
+XFillArc(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(),
+         (int)x0-(int)r, (int)y0-(int)r, 2*(int)r, 2*(int)r, 0, 360*64);
+return;
+}
+
+// Pour les fonctions de trace avec un plusieurs coordonnees
+#define NMXXPOINTS  30 
+
+/* --Methode-- */
+void PIGraphicX::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+XPoint multipoint[NMXXPOINTS];
+XPoint *pxp;
+int i;
+
+if (n <= 0)  return;
+if (n > NMXXPOINTS)  pxp = new XPoint[n];
+else pxp = multipoint;
+for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; } 
+XDrawLines(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, CoordModePrevious);
+if (n > NMXXPOINTS)  delete[] pxp;
+
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n)
+{
+XPoint multipoint[NMXXPOINTS];
+XPoint *pxp;
+int i;
+
+if (n <= 0)  return;
+if (n > NMXXPOINTS)  pxp = new XPoint[n];
+else pxp = multipoint;
+for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; } 
+XFillPolygon(XtDisplay (MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, 
+                        Complex, CoordModePrevious);
+if (n > NMXXPOINTS)  delete[] pxp;
+
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawMarker(PIGrCoord x0, PIGrCoord y0)
+{
+float hmsz = mMrkSz/2;
+float dmsz = mMrkSz-hmsz;
+PIGrCoord x[4],y[4];
+PILineAtt clatt;
+
+if (mMrk == PI_DotMarker)
+  XDrawPoint(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), (int)x0, (int)y0);
+
+else  {
+  clatt = mLAtt;
+  SelLine(PI_ThinLine);
+  switch (mMrk) {
+    case  PI_PlusMarker :
+      DrawLine((float)x0-hmsz, y0, (float)x0+dmsz, y0);
+      DrawLine(x0, (float)y0-hmsz, x0, (float)y0+dmsz);
+      break;
+    case  PI_CrossMarker :
+      DrawLine((float)x0-hmsz, (float)y0-hmsz, (float)x0+dmsz, (float)y0+dmsz);
+      DrawLine((float)x0-hmsz, (float)y0+dmsz, (float)x0+dmsz, (float)y0-hmsz);
+      break;  
+    case PI_CircleMarker :
+      DrawCircle(x0, y0, hmsz);
+      break;
+    case PI_FCircleMarker :
+      DrawFCircle(x0, y0, hmsz);
+      break;
+    case PI_BoxMarker :
+      DrawBox((float)x0-hmsz, (float)y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case PI_FBoxMarker :
+      DrawFBox((float)x0-hmsz, (float)y0-hmsz, mMrkSz, mMrkSz);
+      break;
+    case  PI_TriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = (float)x0-hmsz; y[0] = (float)y0+hmsz;  
+      DrawPolygon(x, y, 4);
+      break;
+    case  PI_FTriangleMarker :
+      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
+      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = (float)x0-hmsz; y[0] = (float)y0+hmsz;  
+      DrawFPolygon(x, y, 4);
+      break;
+    default :
+      XDrawPoint(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), x0, y0);
+      break;
+    }
+  SelLine(clatt);
+  }
+
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)
+{
+int i;
+if (n <= 0)  return;
+if (mMrk == PI_DotMarker)
+  {
+  XPoint multipoint[NMXXPOINTS];
+  XPoint *pxp;
+  if (n > NMXXPOINTS)  pxp = new XPoint[n];
+  else pxp = multipoint;
+  for(i=0; i<n; i++)  { pxp[i].x = x[i];  pxp[i].y = y[i]; } 
+  XDrawPoints(XtDisplay(MyWdg()), XtWindow(MyWdg()), DefGC(), pxp, n, CoordModeOrigin);
+  if (n > NMXXPOINTS)  delete[] pxp;  
+  }
+else for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                            int sx, int sy, PIColorMap* cmap)
+{
+Window xw;
+Display * mdsp;
+int scr;
+int depth;
+int pad;
+int i,j;
+XImage * ximg;
+
+if ( (sx < 1) || (sy < 1) )  return;
+if ((pix == NULL) || (cmap == NULL)) return; 
+
+  
+xw = XtWindow(MyWdg());
+mdsp = PIXDisplay();
+scr = PIXScreen();
+
+depth = DefaultDepth(mdsp,scr);
+pad = (depth > 8) ? 32 : 8;
+ximg = XCreateImage (mdsp,DefaultVisual(mdsp,scr),
+                     depth,ZPixmap,0,NULL, sx, sy, pad,0);
+if (ximg == NULL)  return;
+ximg->data = new char [sy*ximg->bytes_per_line];
+if (ximg->data == NULL)  
+  { XFree(ximg); return; }
+
+for(j=0; j<sy; j++)
+  for(i=0; i<sx; i++)
+    { XPutPixel(ximg, i, j, cmap->Color(*pix) );  pix++; }
+
+XPutImage(mdsp, xw, dpxgc, ximg, 0, 0, (int)x, (int)y, sx, sy);
+
+delete[] ximg->data;
+XFree(ximg); 
+return;
+}
+
+
+
+/* --Methode-- */
+void PIGraphicX::SelForeground(PIColors col)
+{
+if (col == mFCol)  return;
+if ( (col < 0) || (col >= NMAXCOL))  return;
+XSetForeground(XtDisplay(MyWdg()), DefGC(), colpix[col]); 
+mFCol = col;  
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::SelBackground(PIColors col)
+{
+if (col == mBCol)  return;
+if ( (col < 0) || (col >= NMAXCOL))  return;
+XSetBackground(XtDisplay(MyWdg()), DefGC(), colpix[col]); 
+mBCol = col;  
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::SelForeground(PIColorMap& cmap, int cid)
+{
+SelectFCol(cmap.Color(cid));
+}
+
+/* --Methode-- */
+void PIGraphicX::SelBackground(PIColorMap& cmap, int cid)
+{
+SelectBCol(cmap.Color(cid));
+}
+
+/* --Methode-- */
+void PIGraphicX::SelGOMode(PIGOMode mod)
+{
+if (mod == mGOm)  return;
+switch (mod)
+  {
+  case PI_GOCopy :
+    XSetFunction(XtDisplay(MyWdg()), DefGC(), GXcopy);
+    mGOm = mod;
+    break;
+  case PI_GOXOR :
+    XSetFunction(XtDisplay(MyWdg()), DefGC(), GXxor);
+    mGOm = mod;
+    break;
+  }
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::SelFontSzPt(int npt, PIFontAtt att)
+{
+int dsz,i,isel, j;
+
+if ((npt == mFSize) && (att == mFAtt))  return;
+isel = 0;
+dsz = 9999;
+for(i=0; i<NMAXFONTSZ; i++)
+  {
+  j = npt - fntsz[i];   if (j < 0)  j = -j;
+  if (j < dsz)  {  isel = i; dsz = j; }
+  }
+
+j = 0;
+if (att & PI_RomanFont) j = 0;
+if (att & PI_BoldFont) j = 1;
+if (att & PI_ItalicFont) j = 2;
+SelectFont(isel, j);
+
+}
+
+/* --Methode-- */
+void PIGraphicX::SelFont(PIFontSize sz, PIFontAtt att)
+{
+int i,j;
+switch (sz)
+  {
+  case PI_SmallSizeFont:
+    i = 1;
+    break;
+  case PI_NormalSizeFont:
+    i = 3;
+    break;
+  case PI_BigSizeFont:
+    i = 5;
+    break;
+  default:
+    i=2;
+    break;
+  }
+
+j = 0;
+if (att & PI_RomanFont) j = 0;
+if (att & PI_BoldFont) j = 1;
+if (att & PI_ItalicFont) j = 2;
+
+SelectFont(i, j);
+}
+
+
+
+/* --Methode-- */
+void PIGraphicX::SelLine(PILineAtt att)
+{
+unsigned int lt;
+
+if (att == mLAtt)  return;
+
+switch (att)
+  {
+  case PI_NormalLine :
+    lt = 2;
+    break;
+  case PI_ThickLine :
+    lt = 4;
+    break;
+  case  PI_ThinLine :
+    lt = 0;
+    break;
+  default:
+    lt = 0;
+    break;
+  }
+    
+XSetLineAttributes(XtDisplay(MyWdg()), DefGC(), lt, LineSolid, CapButt, JoinMiter);
+mLAtt = att;
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::SelMarker(int msz, PIMarker mrk)
+{
+if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
+else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy)
+{
+XRectangle xr;
+xr.x = x0;  xr.y = y0;
+xr.width = dx;  xr.height = dy;
+XSetClipRectangles(XtDisplay(MyWdg()), DefGC(), 0, 0, &xr, 1, Unsorted);
+XSetClipRectangles(XtDisplay(MyWdg()), dpxgc, 0, 0, &xr, 1, Unsorted);
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::ClearClipRectangle()
+{ 
+XSetClipMask(XtDisplay(MyWdg()), DefGC(), None);
+XSetClipMask(XtDisplay(MyWdg()), dpxgc, None);
+return;
+}
+
+/* --Methode-- */
+PIColors  PIGraphicX::GetForeground() 
+{
+return (mFCol);
+}
+
+/* --Methode-- */
+PIColors  PIGraphicX::GetBackground() 
+{
+return (mBCol);
+}
+
+
+/* --Methode-- */
+PIGOMode   PIGraphicX::GetGOMode()
+{
+return (mGOm);
+}
+
+/* --Methode-- */
+PIFontAtt  PIGraphicX::GetFontAtt()
+{
+return (mFAtt);
+}
+
+/* --Methode-- */
+int        PIGraphicX::GetFontSize()
+{
+return (mFSize);
+}
+
+/* --Methode-- */
+PILineAtt  PIGraphicX::GetLineAtt()
+{
+return (mLAtt);
+}
+
+/* --Methode-- */
+PIMarker   PIGraphicX::GetMarker()
+{
+return (mMrk);
+}
+
+/* --Methode-- */
+int        PIGraphicX::GetMarkerSize()
+{
+return (mMrkSz);
+}
+
+/* --Methode-- */
+int        PIGraphicX::GetFontHeight(int& asc, int& desc)   
+{
+char a[2];
+XCharStruct  ovr;
+int hd, fa, fd;
+XTextExtents(mFSt, a, 0, &hd, &fa, &fd, &ovr);
+asc = fa; desc = fd; 
+return(fa+fd);
+}
+
+/* --Methode-- */
+PIGrCoord PIGraphicX::CalcStringWidth(char const* s)
+{
+return(XTextWidth(mFSt, s, strlen(s)));
+}
+
+/* --Methode-- */
+void PIGraphicX::SaveGraphicAtt()
+{  
+// Pour optimier l'implementation de PIBaseWdgGen
+sFCol = mFCol;    sBCol = mBCol;
+sGOm = mGOm;
+sFAtt = mFAtt;   sFSize = mFSize;
+sMrk = mMrk;   sMrkSz = mMrkSz;
+sFCfMap = mFCfMap; sBCfMap = mBCfMap; 
+return;
+}
+
+/* --Methode-- */
+void PIGraphicX::RestoreGraphicAtt()
+{
+  if (sFCol != PI_ColorFromMap) SelForeground(sFCol);
+  else SelectFCol(sFCfMap);
+  if (sBCol != PI_ColorFromMap) SelBackground(sBCol);
+  else SelectBCol(sBCfMap);
+  SelGOMode(sGOm);
+  SelFontSzPt(sFSize, sFAtt);
+  SelLine(sLAtt);
+  SelMarker(sMrkSz, sMrk);
+  return;
+}
+
+
+/* --Methode-- */
+unsigned long PIGraphicX::GetPixelValueforColor(PIColors col)
+{
+if ( (col < 0) || (col >= NMAXCOL))  return(0);
+return(colpix[col]); 
+}
+
+
+static bool fggrcx = false ;
+
+// Le bazar pour recuperer des resources de .Xdefault et autres 
+typedef struct 
+  {
+  String fntFam;
+  } myAppData;
+static myAppData  apd;
+
+static XtResource resources[] = {
+  { "fontFamilyName", "FontFamilyName", XtRString, sizeof(String),
+    /*XtOffset(apdp, fntFam)*/ 0, XtRString, "*-courier" }
+};
+ 
+static char * fnbi_b[4] = { "medium-r-normal", "bold-r-normal", 
+                          "medium-o-normal", "medium-i-normal" };
+
+static XFontStruct * defnt = NULL;
+static char * fnbi[3];
+
+
+/* --Methode-- */
+void PIGraphicX::Init()
+{
+char buff[256];
+int i,j,count;
+char **list;
+
+if (fggrcx)  return;
+fggrcx = true;
+
+Display *mdsp;
+int scr;
+XColor exact,mycol;
+Colormap  cmap;
+
+mdsp = PIXDisplay();
+scr = XDefaultScreen(mdsp);
+
+XtGetApplicationResources(PIXtTopWdg(), &apd, resources, 
+                          XtNumber(resources), NULL, 0);
+sprintf(buff,"-%s-*-*-*-*-*-*-*-*-*-*-*-*", apd.fntFam);
+list = XListFonts(mdsp, buff, 15, &count);
+XFreeFontNames(list);
+if (count < 5)
+  { 
+  printf("PIGraphicX::Init %d fonts found for %s , switching to courier\n",
+         count, apd.fntFam);
+  apd.fntFam = "*-courier";
+  }
+sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[0]);
+list = XListFonts(mdsp, buff, 10, &count);
+XFreeFontNames(list);
+if (count < 2) fnbi[0] = "*-*-*";
+else  fnbi[0] = fnbi_b[0];
+sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[1]);
+list = XListFonts(mdsp, buff, 10, &count);
+XFreeFontNames(list);
+if (count < 2) fnbi[1] = "*-*-*";
+else  fnbi[1] = fnbi_b[1];
+sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[2]);
+list = XListFonts(mdsp, buff, 10, &count);
+XFreeFontNames(list);
+fnbi[2] = fnbi_b[2];
+if (count < 2) 
+  {
+  sprintf(buff,"-%s-%s-*-*-*-*-*-*-*-*-*", apd.fntFam, fnbi_b[3]);
+  list = XListFonts(mdsp, buff, 10, &count);
+  XFreeFontNames(list);
+  fnbi[2] = fnbi_b[3];
+  }
+if (count < 2) fnbi[2] = "*-*-*";
+
+sprintf(buff,"-*-fixed-*-*-*-*-14-*-*-*-*-*-*-*");
+list = XListFonts(mdsp, buff, 10, &count);
+XFreeFontNames(list);
+if (count < 1) 
+  {  
+  sprintf(buff,"fixed");
+  list = XListFonts(mdsp, buff, 10, &count);
+  XFreeFontNames(list);
+  }
+if (count < 1) 
+  {  
+  strcpy(buff,"");
+  list = XListFonts(mdsp, buff, 10, &count);
+  XFreeFontNames(list);
+  printf("PIGraphicX::Init/ Erreur, no font found ... \n");
+  defnt = NULL;
+  }
+else defnt = XLoadQueryFont(mdsp, buff);
+
+for (i=0; i<NMAXFONTSZ; i++)
+  for (j=0; j<3; j++)  fntst[i][j] = NULL;
+
+ 
+/*  Les couleurs  */
+cmap = XDefaultColormap (mdsp, scr);
+
+for(i=0; i<NMAXCOL; i++)  colpix[i] = XWhitePixel(mdsp, scr);
+colpix[PI_Black] = XBlackPixel(mdsp, scr);
+colpix[PI_White] = XWhitePixel(mdsp, scr);
+if ( XAllocNamedColor (mdsp, cmap, "LightGray", &mycol, &exact) )
+  colpix[PI_Grey] = mycol.pixel;
+if ( XAllocNamedColor (mdsp, cmap, "red", &mycol, &exact) )
+  colpix[PI_Red] = mycol.pixel;
+if ( XAllocNamedColor (mdsp, cmap, "blue", &mycol, &exact) )
+  colpix[PI_Blue] = mycol.pixel;
+if ( XAllocNamedColor (mdsp, cmap, "green", &mycol, &exact) )
+  colpix[PI_Green] = mycol.pixel;
+if ( XAllocNamedColor (mdsp, cmap, "yellow", &mycol, &exact) )
+  colpix[PI_Yellow] = mycol.pixel;
+if ( XAllocNamedColor (mdsp, cmap, "magenta", &mycol, &exact) )
+  colpix[PI_Magenta] = mycol.pixel;
+
+/*  le GC pour DrawPixmap  */
+XGCValues  xgv;
+xgv.function = GXcopy;
+xgv.plane_mask = ~0;
+dpxgc = XCreateGC(mdsp, DefaultRootWindow(mdsp), GCFunction | GCPlaneMask, &xgv);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIGraphicX::SelectFont(int isz, int jat)
+{
+
+if (!fntst[isz][jat])  // Il faut charger la fonte
+  {
+  char buff[256];
+  int count,k;
+  Display * mdsp = PIXDisplay();
+  char **list;
+
+  for (k=0; k<5; k++)    // Recherche de la fonte pour tailles croissantes
+    {
+    sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam, fnbi[jat], fntsz[isz]+k);
+    list = XListFonts(mdsp, buff, 10, &count);
+    XFreeFontNames(list);
+    if (count > 0)  break;
+    }
+  if (count > 0) 
+    fntst[isz][jat] = XLoadQueryFont(mdsp, buff);
+  else
+    { printf("PIGraphicX::SelectFont/ Pb font %s - Using default \n", buff);    
+    fntst[isz][jat] = defnt; }
+  }
+
+mFAtt = fntatt[jat];
+mFSize = fntsz[isz];
+mFSt = fntst[isz][jat];
+XSetFont(XtDisplay(MyWdg()), DefGC(), fntst[isz][jat]->fid);
+return;
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pigraphx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pigraphx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pigraphx.h	(revision 108)
@@ -0,0 +1,90 @@
+#ifndef PIGRAPHICX_H_SEEN
+#define PIGRAPHICX_H_SEEN
+
+#include "pisysdep.h"
+#include "pigraphgen.h"
+
+class PIGraphicX : public PIGraphicGen
+{
+public:
+                     PIGraphicX(PIWdg* wdg);
+  virtual           ~PIGraphicX();
+
+//  Trace graphiques
+  virtual void       Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawOpaqueString(PIGrCoord x, PIGrCoord y, char* s, int pos = 0);
+  virtual void       DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2);
+  virtual void       DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawFBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r);
+  virtual void       DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n);  
+  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
+  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
+                                int sx, int sy, PIColorMap* cmap);
+
+// Modifications attributs graphiques
+  virtual void       SelForeground(PIColors col=PI_Black);
+  virtual void       SelBackground(PIColors col=PI_White);
+  virtual void       SelForeground(PIColorMap& cmap, int cid);
+  virtual void       SelBackground(PIColorMap& cmap, int cid);
+  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont);
+  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelMarker(int msz=3, PIMarker mrk=PI_DotMarker);
+
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy);
+  virtual void       ClearClipRectangle();
+
+// Acces aux attributs graphiques 
+  virtual PIColors   GetForeground();
+  virtual PIColors   GetBackground();
+  virtual PIGOMode   GetGOMode();
+  virtual PIFontAtt  GetFontAtt();
+  virtual int        GetFontSize();
+  virtual PILineAtt  GetLineAtt();
+  virtual PIMarker   GetMarker();
+  virtual int        GetMarkerSize();
+
+  virtual int        GetFontHeight(int& asc, int& desc);
+  virtual PIGrCoord  CalcStringWidth(char const* s);
+
+// Sauvegarde des attributs graphiques 
+  virtual void       SaveGraphicAtt();
+  virtual void       RestoreGraphicAtt();
+
+//  Pour recuperer le pixcol d une couleur  (pour X) 
+  PIXColor           GetPixelValueforColor(PIColors col);
+protected:
+  void           Init();
+  void           SelectFont(int isz, int jat);
+  inline  GC     DefGC() { return mDefGC; }
+  inline SysDWdg MyWdg()  {return(myWdg->XtWdg()); }
+  inline void    SelectBCol(PIXColor col) 
+    {XSetBackground(XtDisplay(MyWdg()), DefGC(), col);  mBCol = PI_ColorFromMap; mBCfMap = col; }
+  inline void    SelectFCol(PIXColor col) 
+    {XSetForeground(XtDisplay(MyWdg()), DefGC(), col);  mFCol = PI_ColorFromMap; mFCfMap = col; }
+
+
+  GC mDefGC;
+  PIColors  mFCol, mBCol;
+  PIGOMode mGOm;
+  PIFontAtt mFAtt;
+  PILineAtt mLAtt;
+  int mFSize;
+  XFontStruct *mFSt;
+  PIMarker mMrk;
+  int mMrkSz;
+  PIXColor mFCfMap, mBCfMap;
+  PIXColor sFCfMap, sBCfMap;
+};
+
+typedef PIGraphicX PIGraphicWin;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pihisto.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pihisto.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pihisto.cc	(revision 108)
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include "pihisto.h"
+
+PIHisto::PIHisto(Histo* histo, bool ad)
+: PIDrawer(), mHisto(histo)
+{
+  mAdDO = ad;     // Flag pour suppression automatique de mHisto
+}
+
+PIHisto::~PIHisto()
+{
+  if (mAdDO)
+    delete mHisto;
+}
+
+
+
+void
+PIHisto::UpdateSize()
+{
+  if (!mHisto)  return;  
+  SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->VMin(), mHisto->VMax()*1.2);
+  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+}
+
+
+void
+PIHisto::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
+{
+  if (!mHisto)  return;  
+  for (int i=0; i<mHisto->NBins(); i++) {
+		float left   = mHisto->BinLowEdge(i);
+		float width  = mHisto->BinWidth();
+		float bottom = 0;
+		float height = (*mHisto)(i);
+		g->DrawFBox(left,bottom,width,height);
+		g->DrawLine(left, bottom, left, bottom + height); // Au moins une ligne...
+	}
+  DrawStats(g);
+}
+
+void
+PIHisto::DrawStats(PIGraphicUC* g)
+{
+  if (!mHisto) return;
+  float cellHeight = (YMax() - YMin()) * 0.05;
+  float cellWidth  = (XMax() - XMin()) * 0.23;
+  g->DrawLine(XMax() - cellWidth, YMax(),
+                       XMax() - cellWidth, YMax() - cellHeight);
+  g->DrawLine(XMax() - cellWidth, YMax() - cellHeight,
+                       XMax()            , YMax() - cellHeight);
+  char label[50];
+  sprintf(label, "N = %.6g", mHisto->NData());
+  g->SelFontSz((YMax() - YMin())/30);
+  g->DrawString(XMax() - cellWidth*0.9, YMax() - cellHeight*0.8, label);
+                       
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pihisto.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pihisto.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pihisto.h	(revision 108)
@@ -0,0 +1,21 @@
+#ifndef PIHISTO_H
+#define PIHISTO_H
+
+#include "histos.h"
+#include "pidrawer.h"
+
+class PIHisto : public PIDrawer {
+public:
+                     PIHisto(Histo* histo, bool ad=false);
+  virtual           ~PIHisto();
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+  virtual void       UpdateSize();
+  virtual void       DrawStats(PIGraphicUC* g);
+  inline  Histo*     Histogram() { return(mHisto); }
+
+protected:
+  Histo* mHisto;
+  bool mAdDO;
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pihisto2d.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pihisto2d.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pihisto2d.cc	(revision 108)
@@ -0,0 +1,695 @@
+#include <stdio.h>
+#include "pihisto2d.h"
+#include "nbrandom.h"
+
+static int dbg = 0;
+
+//++
+// Class	PIHisto2D,PIH2DWdg,H2WinArg
+// Lib	PI
+// include	pihisto2d.h
+//
+//	Classes de dessin des histogrammes a 2 dimensions.
+//--
+
+//++
+// Titre	Dessin d'un histogramme 2D.
+//--
+
+//++
+PIHisto2D::PIHisto2D(Histo2D* histo, bool ad)
+//
+//	Createur d'une classe de dessin pour l'histogramme 2D histo.
+//--
+: PIDrawer(), mHisto(histo)
+{
+mAdDO = ad;     // Flag pour suppression automatique de mHisto  
+
+mLogScale = 10.;
+mFPoints = 0.5;
+
+UseColors();
+UseDisplay();
+UseDyn();
+UseFrac();
+}
+
+//++
+PIHisto2D::~PIHisto2D()
+//
+//	Destructeur.
+//--
+{
+if(mAdDO) delete mHisto;
+}
+
+//++
+void PIHisto2D::UseColors(bool fg, CMapId cmap)
+//
+//	Choix de la couleur si fg=true
+//	(pour la couleur cmap cf picmap.h).
+//--
+{
+mFgCol = fg; mCmap = cmap;
+}
+
+//++
+void PIHisto2D::UseScale(unsigned short type,float logscale)
+//
+//	Pour changer les echelles.
+//| Type = 0 : echelle lineaire
+//|      = 1 : echelle log10
+//| - Explication du codage en type=1 (log10) :
+//|   1-/ map lineaire :
+//|       [0,1] -> [lmin,lmax]
+//|       f     -> F = lmin+f*(lmax-lmin)
+//|   2-/ transformation log10 :
+//|       [lmin,lmax] -> [log10(lmin),log10(lmax)]
+//|       F           -> LF = lg10(F)
+//|   3-/ rescaling entre 0 et 1 :
+//|       [log10(lmin),log10(lmax)] -> [0,1]
+//|       LF -> (LF-log10(lmin))/(log10(lmax)-log10(lmin))
+//|       soit en definissant logscale = lmax/lmin
+//|       LF = log10(1.+f*(logscale-1))/log10(logscale)
+//--
+{
+if(type==0) mTypScal = 0;
+if(type==1) {
+  mTypScal = 1;
+  if(logscale>1.) mLogScale = logscale;
+} else mTypScal = 0;
+}
+
+//++
+void PIHisto2D::UseDisplay(unsigned short type, float fnpt)
+//
+//	Type de Display
+//| Type = 0 : carres de tailles variables
+//| Type = 1 : nuages de points
+//|            Le nombre de points a utiliser est fnpt*N
+//|            ou N est le nombre de pixels ecran contenu
+//|            dans un bin de l'histogramme.
+//| Type = 2 : code a la "hbook2" " .+123...9AB...YZ*"
+//|            (cf detail PIHisto2D::HPrint2)
+//| Type = 3 : carres de tailles fixes (couleur).
+//--
+{
+if(fnpt<0.) fnpt=0; else if(fnpt>1.) fnpt=1.;
+if(type==0)        mTypDisp = 0;
+else if(type==1) { mTypDisp = 1; mFPoints = fnpt;}
+else if(type==2)   mTypDisp = 2;
+else if(type==3)   mTypDisp = 3;
+else               mTypDisp = 1;
+}
+
+//++
+void PIHisto2D::UseDyn(float hmin, float hmax)
+//
+//	Gestion de la dynamique a representer:
+//	la dynamique va etre transformee de [hmin,hmax] vers [0,1].
+//--
+{
+if(hmin>=hmax) {hmin = mHisto->VMin(); hmax = mHisto->VMax();}
+if(hmin>=hmax) hmax = hmin+1.;
+mHMin = hmin; mHMax = hmax;
+}
+
+//++
+void PIHisto2D::UseFrac(float frmin, float frmax)
+//
+//	Pour definir la fraction de la dynamique a dessiner:
+//| Certains type de display (f=[0,1] cf PIHisto2D::UseDyn),
+//|    - on ne dessine rien si f <= frmin
+//|    - on limite l'excursion a f*frmax cad [...,frmax]
+//--
+{
+if(frmax<=0. || frmax>1.) frmax = 1.;
+if(frmin>=frmax) {frmin=0.1; frmax=0.9;}
+mFracMin = frmin; mFracMax = frmax;
+}
+
+//++
+void PIHisto2D::Print(int lp)
+//
+//	Print de l'etat des options du display.
+//--
+{
+printf("PIHisto2D::Print FgCol=%d Cmap=%d TypScal=%d TypDisp=%d (FPoints=%g)\n"
+      ,(int)mFgCol,(int)mCmap,mTypScal,mTypDisp,mFPoints);
+printf("                 Dyn=%g,%g Frac=%g,%g LogSc=%g H=%lx\n"
+      ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,(long)mHisto);
+if(lp<1) return;
+mHisto->PrintStatus();
+}
+
+//++
+void PIHisto2D::UpdateSize()
+//
+//	Definition des tailles graphiques en fonction
+//	des caracteristiques de l'histogramme a dessiner.
+//--
+{
+  if(!mHisto) return;
+  SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());
+  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+}
+
+//++
+void PIHisto2D::Draw(PIGraphicUC* g,float,float, float, float)
+//
+//	Dessin de l'histogramme.
+//--
+{
+if(!mHisto) return;
+// Caracteristiques histogramme
+float dx = mHisto->WBinX(),dy = mHisto->WBinY();
+float p1dx,p1dy;
+g->DGrC2UC(1.f,1.f,p1dx,p1dy);
+
+// Gamme a representer entre [0,1] mais >=fracmin et scale fracmax
+float fracmin=FMin(), fracmax=FMax();
+float llscale = (float) log10((double)LogScale());
+
+// gestion Couleurs.
+PIColorMap* cmap=NULL;
+PIColors coul = g->GetForeground();
+int ncol = 0;
+if (mFgCol) {
+  cmap = new PIColorMap(mCmap); ncol = cmap->NCol();
+  if(mTypDisp==3) fracmin=-1.;
+}
+
+// gestion Markers ou plot avec des points.
+PIMarker Mk = g->GetMarker();
+int MkSz = g->GetMarkerSize();
+int npt = 1;
+if(mTypDisp==1) {
+  g->SelMarker(1,PI_DotMarker);
+  npt = (int) ((float)NPixBin(g)*FPoints()); if(npt<=0) npt = 2;
+}
+
+// gestion Font.
+PIFontAtt FontAtt = g->GetFontAtt();
+int FontSize = g->GetFontSize();
+if(mTypDisp==2) {
+  float dxg,dyg,dg;
+  g->DUC2GrC(dx,dy,dxg,dyg);
+  dg =(dxg<dyg) ? dxg : dyg;
+  int npix = (int) (dg*0.9); if(npix<8) npix = 8;
+  //printf("PIHisto2D::Draw_Font H dx=%g dy=%g, G dx=%g dy=%g, npix = %g,%d\n"
+  //      ,dx,dy,dxg,dyg,dg,npix);
+  g->SelFontSzPt(npix,PI_RomanFont);
+  fracmin = 0;
+}
+
+// Print();
+
+// Plot de l'histogramme
+for (int i=0; i<mHisto->NBinX(); i++)
+for (int j=0; j<mHisto->NBinY(); j++) {
+
+  float left0,bottom0;
+  mHisto->BinLowEdge(i,j,left0,bottom0);
+
+  // Gestion de la dynamique a dessiner
+  float frac = ((*mHisto)(i,j)-HMin())/(HMax()-HMin());
+  if(frac<0.) continue;
+  if(mTypScal==1) {              // echelle log10
+    frac = log10(1.+frac*(LogScale()-1.))/llscale;
+    if(frac<0.) continue;
+  }
+  if(frac<=fracmin) continue;
+  if(frac>1.) frac = 1.;
+  float fracred = frac * fracmax;
+
+  // Gestion de la couleur
+  int icol = 0;
+  if (cmap) {
+    icol = int( (float) ncol*frac );
+    if(icol>=ncol) icol = ncol-1; else if(icol<0) icol=0;
+    g->SelForeground(*cmap,icol);
+  }
+
+  // Dessin proprement dit selon le choix graphique.
+  if(mTypDisp==0) {
+    //..... carres de tailles variables
+    float left   = left0   + 0.5*(1.-fracred)*dx, width  = fracred*dx;
+    float bottom = bottom0 + 0.5*(1.-fracred)*dy, height = fracred*dy;
+    if (cmap) g->DrawFBox(left,bottom,width,height);
+    else      g->DrawBox(left,bottom,width,height);
+  } else if(mTypDisp==1) {
+    //..... nuage de points .....
+    int ipt  = int( (float) npt *frac );
+    for(int k=0;k<ipt;k++) {
+      float x = left0 + frand01()*dx;
+      float y = bottom0 + frand01()*dy;
+      g->DrawMarker(x,y);
+    }
+  } else if(mTypDisp==2) {
+    //..... type hbook2/hprint .+23-Z*
+    char c[2];
+    c[0] = HPrint2(frac); c[1]='\0';
+    float x = left0 + dx/2.;
+    float y = bottom0 + dy/2.;
+    g->DrawString(x,y,c);
+  } else if(mTypDisp==3) {
+    //..... carres de tailles fixes (avec gestion de continuite)
+    if (cmap) g->DrawFBox(left0,bottom0,dx+p1dx,dy+p1dy);
+    else      g->DrawBox(left0,bottom0,dx+p1dx,dy+p1dy);
+  }
+
+}
+
+// Remise dans les conditions ulterieures pour la suite du graphique.
+g->SelMarker(MkSz,Mk);
+g->SelForeground(coul);
+g->SelFontSzPt(FontSize,FontAtt);
+if (cmap) delete cmap;
+
+// Fin du dessin, ecriture de la statistique.
+DrawStats(g);
+}
+
+//++
+void PIHisto2D::DrawStats(PIGraphicUC* g)
+//
+//	Dessin des informations statistiques de l'histogramme.
+//--
+{
+  // Une boite dans le coin superieur droit
+  float cellHeight = (YMax() - YMin()) * 0.05;
+  float cellWidth  = (XMax() - XMin()) * 0.23;
+  g->DrawLine(XMax() - cellWidth, YMax(),
+                       XMax() - cellWidth, YMax() - cellHeight);
+  g->DrawLine(XMax() - cellWidth, YMax() - cellHeight,
+                       XMax()            , YMax() - cellHeight);
+  char label[50];
+  sprintf(label, "N = %.6g", mHisto->NData());
+  g->SelFontSz((YMax() - YMin())/30);
+  g->DrawString(XMax() - cellWidth*0.9, YMax() - cellHeight*0.8, label);
+  printf("H[%d,%d] Dynamique: [%g,%g] Frac [%g,%g]\n"
+        ,mHisto->NBinX(),mHisto->NBinY(),HMin(),HMax(),FMin(),FMax());
+}
+
+//++
+char PIHisto2D::HPrint2(float f)
+//
+//	Codage des valeurs en caracteres (fct privee).
+//| f entre [0,1] mappee entre valeur=[0,37]
+//| si <0 alors =0, si >1 alors 1
+//| Display 4   ==> 4<=valeur<5
+//|         C   ==> 12<=valeur<13
+//|             ==> valeur<=0
+//|         *   ==> valeur>=1
+//|         .   ==> 0<valeur<1
+//|------------------------------------------
+//|            C1111111111222222222233333333
+//|  C01234567890123456789012345678901234567
+//| " .+23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*"
+//|------------------------------------------
+//--
+{
+char str[39] = " .+23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*";
+int i;
+if(f<=0.) i = 0;
+else if(f>=1.) i = 37;
+else { i = (int) (f*36.); i++;}
+if(i<0) i=0; else if (i>=38) i = 37;
+return str[i];
+}
+
+//++
+int PIHisto2D::NPixBin(PIGraphicUC* g)
+//
+//	Nombre de pixels ecran dans un bin d'histogramme
+//	(fct privee).
+//--
+{
+float dx = mHisto->WBinX(),dy = mHisto->WBinY();
+float dxg,dyg;
+g->DUC2GrC(dx,dy,dxg,dyg);
+int np = (int) dxg * (int) dyg;
+//printf("PIHisto2D::NPixBin H dx=%g dy=%g, G dx=%g dy=%g, np = %d\n"
+//      ,dx,dy,dxg,dyg,np);
+return np;
+}
+
+
+/////////////////////////////////////////////////////////////////
+//  Classe PIH2DWdg
+/////////////////////////////////////////////////////////////////
+//++
+// Titre	Widget de dessin d'un histogramme 2D.
+//--
+
+static H2WinArg* h2dWinArg=NULL;
+static int nb_h2dWinArg = 0;
+
+//++
+PIH2DWdg::PIH2DWdg(PIContainerGen *par, char *nom, int sx, int sy, int px, int py)
+//
+//	Createur d'un Widget de dessin d'histogramme 2D.
+//	Le menu pour choisir les options d'affichage apparait
+//	suite au clic du bouton-3 de la souris (cf H2WinArg::H2WinArg).
+//--
+: PIScDrawWdg(par,nom,sx,sy,px,py)
+{
+if (!h2dWinArg) h2dWinArg = new H2WinArg(this);
+nb_h2dWinArg++;
+if(dbg) printf("PIH2DWdg::PIH2DWdg %lx h2dWinArg=%lx %d\n"
+              ,(long)this,(long)h2dWinArg,nb_h2dWinArg);
+mPih = NULL;
+// Pour afficher le menu option de trace
+ActivateButton(3);
+}
+
+//++
+PIH2DWdg::~PIH2DWdg()
+//
+//	Destructeur.
+//--
+{
+nb_h2dWinArg--;
+if (nb_h2dWinArg == 0) {
+  h2dWinArg->Hide();
+  delete h2dWinArg;
+  h2dWinArg=NULL;
+}
+if(dbg) printf("PIH2DWdg::~PIH2DWdg h2dWinArg=%lx %d\n"
+              ,(long)h2dWinArg,nb_h2dWinArg);
+if (mPih) delete mPih;
+}
+
+//++
+void PIH2DWdg::SetHisto(Histo2D* histo)
+//
+//	Pour connecter un histogramme 2D au Widget.
+//--
+{
+if (!histo) return;
+if (mPih)  delete mPih;
+mPih = new PIHisto2D(histo, true);
+AddScDrawer(mPih);
+if(dbg) printf("PIH2DWdg::SetHisto mPih=%lx\n",(long)mPih);
+}
+
+//++
+string  PIH2DWdg::GetClickText(float x, float y)
+//
+//	Quand on click (and drag) le bouton-1, affichage
+//	des positions x,y et de la valeur du bin de l'histogramme 2D.
+//--
+{
+int i,j;
+char str[128];
+
+if ((!mPih) || (!mPih->Histogram())) {
+  sprintf(str,"X=%g Y=%g ???",x,y);
+  return((string)str);
+}
+
+Histo2D* h = mPih->Histogram();
+
+h->FindBin(x,y,i,j);
+if(i<0 || i>=h->NBinX() || j<0 || j>=h->NBinY())
+  sprintf(str,"x= %g y= %g ???",x,y);
+else sprintf(str,"x= %g y= %g v= %g",x,y,(*h)(i,j));
+
+return((string)str);
+}
+
+//++
+void PIH2DWdg::But3Press(int x, int y)
+//
+//	Gestion de l'utilisation du bouton-3 de la souris.
+//	Un seul objet est cree pour tous les histogrammes 2D.
+//	Il est connecte a un histogramme donnee par l'action du
+//	du bouton-3 de la souris dans la fenetre contenant
+//	le dessin de l'histogramme (cf H2WinArg::H2WinArg).
+//--
+{
+h2dWinArg->SetPIH2DWdg(this);
+h2dWinArg->SetMsgParent((PIMsgHandler*)this);
+if(!h2dWinArg->Visible()) h2dWinArg->Show();
+if(dbg) printf("PIH2DWdg::But3Press(%d,%d) h2dWinArg=%lx\n"
+              ,x,y,(long)h2dWinArg);
+}
+
+
+/////////////////////////////////////////////////////////////////
+//  Classe H2WinArg
+/////////////////////////////////////////////////////////////////
+//++
+// Titre	Fenetre de dialogue pour le choix des options..
+//--
+
+//++
+H2WinArg::H2WinArg(PIH2DWdg *par)
+//
+//	Creation de la fenetre de gestion des parametres
+//	des dessins des histogrammes 2D. Cette fenetre de
+//	dialogue est partagee par tous les widget de dessin
+//	des histogrammes 2D. Pour la faire apparaitre pour la
+//	faire apparaitre la premiere fois, cliquez avec le bouton
+//	numero 3 de la souris (bouton de droite) dans la fenetre
+//	de dessin de l'histogramme. Si elle est deja presente,
+//	pour la connecter a une autre fenetre de dessin cliquez avec
+//	le meme bouton dans cette fenetre.
+//--
+//++
+//| - Menu 1: Choix du type de display
+//|     Carres variables, nuages de points, caracteres a la hbook2
+//|     et carres de tailles fixe (couleur ou niveauz de gris).
+//| - Menu 2: Choix du type d'echelle
+//|     Lineaire ou logarithmique
+//| - Menu 3: Choix de la couleur
+//|     noir et blanc, niveau de gris et couleurs diverses.
+//| - Champ texte Dyn: Pour donner la dynamique, si min>=max
+//|     alors prend le min et le max de l'histogramme
+//| - Champ texte Frac: fraction mini et maxi
+//|     (cf PIHisto2D::UseFrac)
+//| - Champ texte LogScal: niveau de scaling pour le choix d'une
+//|     echelle logarithmique (cf PIHisto2D::UseScale)
+//--
+//++
+//| - Curseur interactif PerPt: pourcentage de points a dessiner
+//|     dans chaque bin (cf PIHisto2D::UseDisplay)
+//| - Bouton Apply: dessiner avec les options affichees
+//| - Bouton close: fermeture de la fenetre de dialogue.
+//| - Bouton Get: re-prendre les valeurs de display stoquees
+//|     pour un histogramme donne.
+//| - Bouton Print: Imprimer les caracteristiques du display
+//|     et de l'histogramme.
+//--
+: PIWindow((PIMsgHandler *)par, "Options", PIWK_dialog,250,260,150,150)
+{
+string sdum;
+if(dbg) printf("H2WinArg::H2WinArg %lx par=%lx\n",(long)this,(long)par);
+
+mH2Wdg = NULL;
+
+mFgCol    = false;
+mCmap     = CMAP_GREYINV32;
+mTypScal  = 0;
+mTypDisp  = 0;
+mFPoints  = 0.5;
+mHMin     = 1.;
+mHMax     = -1.;
+mFracMin  = 0.1;
+mFracMax  = 0.9;
+mLogScale = 10.;
+
+// menus bar
+mPop[0] = new PIPUMenu((PIMsgHandler *)this,"Display");
+mPop[0]->AppendItem("Carres Var."  , 6101);
+mPop[0]->AppendItem("....."        , 6102);
+mPop[0]->AppendItem(".+12..Z*"     , 6103);
+mPop[0]->AppendItem("Carres Pleins", 6104);
+mOPop[0] = new PIOptMenu(this,mPop[0],100,25,10,10);
+sdum = "Carres Var."; mOPop[0]->SetValueStr(sdum);
+
+mPop[1] = new PIPUMenu((PIMsgHandler *)this,"Scale");
+mPop[1]->AppendItem("Lineaire", 6201);
+mPop[1]->AppendItem("Log10"   , 6202);
+mOPop[1] = new PIOptMenu(this,mPop[1],100,25,10,40);
+sdum = "Lineaire"; mOPop[1]->SetValueStr(sdum);
+
+mPop[2] = new PIPUMenu((PIMsgHandler *)this,"Color");
+mPop[2]->AppendItem("B&W"      , 6301);
+mPop[2]->AppendItem("Grey32"   , 6302);
+mPop[2]->AppendItem("GreyInv32", 6303);
+mPop[2]->AppendItem("RJ32"     , 6304);
+mPop[2]->AppendItem("BR32"     , 6305);
+mPop[2]->AppendItem("RV32"     , 6306);
+mPop[2]->AppendItem("Arc16"    , 6307);
+mOPop[2] = new PIOptMenu(this,mPop[2],100,25,10,70);
+sdum = "B&W"; mOPop[2]->SetValueStr(sdum);
+
+// Labels et zone de saisie texte
+mLab[0] = new PILabel(this, "     Dyn: ",60,30,10,110); 
+mLab[1] = new PILabel(this, "    Frac: ",60,30,10,145);
+mLab[2] = new PILabel(this, " LogScal: ",60,30,10,180);
+
+mText[0] = new PIText(this, "Dynamique",150,30,80,110);
+mText[1] = new PIText(this, "Fraction" ,150,30,80,145);
+mText[2] = new PIText(this, "LogScale" ,150,30,80,180);
+SetText();
+
+// Labels et curseur mobile
+mLab[3] = new PILabel(this, "   PerPt: ",60,30,10,215);
+mPScal = new PIScale(this,"FracPoints",6401,true,150,20,80,215);
+mPScal->SetMinMax(0,100);
+int imfp = mFPoints*100.f;
+mPScal->SetValue(imfp);
+
+// Boutons
+mBut[0] = new PIButton(this, "Apply", 6001, 50, 20, 150,10);
+mBut[1] = new PIButton(this, "Close", 6002, 50, 20, 150,35);
+mBut[2] = new PIButton(this, "Get"  , 6003, 50, 20, 150,60);
+mBut[3] = new PIButton(this, "Print", 6004, 50, 20, 150,85);
+FinishCreate();
+}
+
+//++
+H2WinArg::~H2WinArg()
+//
+//	Destructeur.
+//--
+{
+int i;
+if(dbg) printf("H2WinArg::~H2WinArg %lx\n",(long)this);
+for(i=0;i<3;i++) {delete mPop[i]; delete mOPop[i];}
+for(i=0;i<4;i++) delete mBut[i];
+for(i=0;i<4;i++) delete mLab[i];
+for(i=0;i<3;i++) delete mText[i];
+delete mPScal;
+}
+
+//++
+void H2WinArg::SetText()
+//
+//	Gestion des fenetres de saisie de texte.
+//--
+{
+string sdum;
+char str[256];
+sprintf(str,"%g %g",mHMin,mHMax);
+mText[0]->SetText(str);
+sprintf(str,"%g %g",mFracMin,mFracMax);
+mText[1]->SetText(str);
+sprintf(str,"%g",mLogScale);
+mText[2]->SetText(str);
+
+if(mTypDisp==0)      { sdum="Carres Var.";   mOPop[0]->SetValueStr(sdum);}
+else if(mTypDisp==1) { sdum=".....";         mOPop[0]->SetValueStr(sdum);}
+else if(mTypDisp==2) { sdum=".+12..Z*";      mOPop[0]->SetValueStr(sdum);}
+else if(mTypDisp==3) { sdum="Carres Pleins"; mOPop[0]->SetValueStr(sdum);}
+
+if(mTypScal==0)      { sdum="Lineaire"; mOPop[1]->SetValueStr(sdum);}
+else if(mTypScal==1) { sdum="Log10";    mOPop[1]->SetValueStr(sdum);}
+
+if(!mFgCol)                      { sdum="B&W";       mOPop[2]->SetValueStr(sdum);}
+else {
+  if(mCmap==CMAP_GREY32)         { sdum="Grey32";    mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_GREYINV32) { sdum="GreyInv32"; mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLRJ32)   { sdum="RJ32";      mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLBR32)   { sdum="BR32";      mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLRV32)   { sdum="RV32";      mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COL16)     { sdum="Arc16";     mOPop[2]->SetValueStr(sdum);}
+}
+
+printf("H2WinArg::SetText\n");
+}
+
+//++
+void H2WinArg::GetText()
+//
+//	Gestion des fenetres de saisie de texte.
+//--
+{
+sscanf(mText[0]->GetText().c_str(),"%g %g",&mHMin,&mHMax);
+sscanf(mText[1]->GetText().c_str(),"%g %g",&mFracMin,&mFracMax);
+sscanf(mText[2]->GetText().c_str(),"%g",&mLogScale);
+if(dbg) printf("H2WinArg::GetText\n");
+}
+
+//++
+void H2WinArg::SetPIH2DWdg(PIH2DWdg* h2wdg)
+//
+//	Connexion du widget de representation d'un histogramme 2D
+//	avec la fenetre de gestion des parametres.
+//--
+{
+mH2Wdg = h2wdg;
+if(dbg) printf("H2WinArg::SetPIH2DWdg mH2Wdg = %lx\n",(long)mH2Wdg);
+}
+
+//++
+void H2WinArg::Process(PIMessage msg, PIMsgHandler* sender, void*)
+//
+//	Gestions des messages.
+//--
+{
+if(dbg) printf("PIH2DWdg::Process(%d-%d , %lx ...) \n"
+              ,(int)UserMsg(msg),(int)ModMsg(msg), (long)sender);
+
+if(!mH2Wdg) return;
+PIHisto2D* mpih = mH2Wdg->GetPIHisto();
+if(!mpih) return;
+
+int opt = UserMsg(msg);
+     if (opt == 6101) { mTypDisp = 0; }
+else if (opt == 6102) { mTypDisp = 1; }
+else if (opt == 6103) { mTypDisp = 2; }
+else if (opt == 6104) { mTypDisp = 3; }
+
+else if (opt == 6201) { mTypScal = 0; }
+else if (opt == 6202) { mTypScal = 1; }
+
+else if (opt == 6301) { mFgCol = false; }
+else if (opt == 6302) { mFgCol = true;  mCmap = CMAP_GREY32; }
+else if (opt == 6303) { mFgCol = true;  mCmap = CMAP_GREYINV32; }
+else if (opt == 6304) { mFgCol = true;  mCmap = CMAP_COLRJ32; }
+else if (opt == 6305) { mFgCol = true;  mCmap = CMAP_COLBR32; }
+else if (opt == 6306) { mFgCol = true;  mCmap = CMAP_COLRV32; }
+else if (opt == 6307) { mFgCol = true;  mCmap = CMAP_COL16; }
+
+else if (opt == 6401) mFPoints = mPScal->GetValue()/100.;
+
+else if (opt==6001) {
+  GetText();
+  mpih->UseColors(mFgCol, mCmap);
+  mpih->UseScale(mTypScal,mLogScale);
+  mpih->UseDisplay(mTypDisp,mFPoints);
+  mpih->UseDyn(mHMin,mHMax);
+  mpih->UseFrac(mFracMin,mFracMax);
+  mH2Wdg->Refresh();  // On rafraichit le dessin (tout le PIScDrawWdg)
+}
+else if (opt==6002) {
+  this->Hide();
+}
+else if (opt==6003) {
+  mFgCol    = mpih->Color();
+  mCmap     = mpih->ColMap();
+  mTypScal  = mpih->TypScale();
+  mTypDisp  = mpih->TypDisplay();
+  mFPoints  = mpih->FPoints();
+  mHMin     = mpih->HMin();
+  mHMax     = mpih->HMax();
+  mFracMin  = mpih->FMin();
+  mFracMax  = mpih->FMax();
+  mLogScale = mpih->LogScale();
+  SetText();
+}
+else if (opt==6004) {
+  mpih->Print(2);
+}
+
+if(dbg) {
+  printf("H2WinArg::Process opt=%d col=%d,%d scal=%d disp=%d npt=%g\n"
+        ,opt,(int) mFgCol,(int) mCmap,mTypScal,mTypDisp,mFPoints);
+  printf("                  min,max= %g,%g frac= %g,%g logsc= %g\n"
+        ,mHMin,mHMax,mFracMin,mFracMax,mLogScale);
+}
+
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pihisto2d.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pihisto2d.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pihisto2d.h	(revision 108)
@@ -0,0 +1,103 @@
+#ifndef PIHISTO2D_H
+#define PIHISTO2D_H
+
+#include "pisysdep.h"
+#include PIMENU_H 
+#include PIMENUBAR_H 
+#include PIOPTMENU_H
+
+#include "histos2.h"
+#include "piscdrawwdg.h"
+
+////////////////////////////////////////////////////////////////////
+class PIHisto2D : public PIDrawer {
+public:
+                     PIHisto2D(Histo2D* histo, bool ad=false);
+  virtual            ~PIHisto2D();
+          void       UseColors(bool fg=false, CMapId cmap=CMAP_GREYINV32);
+          void       UseScale(unsigned short type=0,float logscale=10.);
+          void       UseDisplay(unsigned short type=0, float fnpt=0.5);
+          void       UseDyn(float hmin=1., float hmax=-1.);
+          void       UseFrac(float frmin=0.1, float frmax=0.9);
+          void       Print(int lp=0);
+  virtual void       Draw(PIGraphicUC* g,float xmin,float ymin,float xmax,float ymax);
+  virtual void       UpdateSize();
+  virtual void       DrawStats(PIGraphicUC* g);
+
+  inline Histo2D*       Histogram() { return(mHisto); }
+  inline bool           Color() { return(mFgCol); }
+  inline CMapId         ColMap() { return(mCmap); }
+  inline unsigned short TypScale() { return(mTypScal); }
+  inline unsigned short TypDisplay() { return(mTypDisp); }
+  inline float          FPoints() { return(mFPoints); }
+  inline float          HMax() { return(mHMax);}
+  inline float          HMin() { return(mHMin);}
+  inline float          FMax() { return(mFracMax);}
+  inline float          FMin() { return(mFracMin);}
+  inline float          LogScale() { return(mLogScale);}
+
+protected:
+  int NPixBin(PIGraphicUC* g);
+  char HPrint2(float f);
+
+  Histo2D* mHisto;
+  bool mAdDO;
+  bool mFgCol;
+  CMapId mCmap;
+  unsigned short mTypScal;
+  unsigned short mTypDisp;
+  float mFPoints;
+  float mHMin,mHMax;
+  float mFracMin,mFracMax;
+  float mLogScale;
+};
+
+////////////////////////////////////////////////////////////////////
+class PIH2DWdg : public PIScDrawWdg {
+public:
+                     PIH2DWdg(PIContainerGen *par, char *nom, int sx=300, int sy=300, 
+                              int px=0, int py=0);
+                     ~PIH2DWdg();
+
+  void               SetHisto(Histo2D* histo);
+  inline PIHisto2D*  GetPIHisto() {return mPih;}
+
+  virtual string     GetClickText(float x, float y); 
+  virtual void       But3Press(int x, int y);
+
+protected:
+  PIHisto2D*  mPih;
+
+};
+
+////////////////////////////////////////////////////////////////////
+class H2WinArg : public PIWindow {
+public :
+               H2WinArg(PIH2DWdg *par);
+               ~H2WinArg();
+          void SetPIH2DWdg(PIH2DWdg* h2wdg);
+          void SetText();
+          void GetText();
+  virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+protected:
+  PIH2DWdg  * mH2Wdg;
+
+  PIPUMenu  * mPop[3];
+  PIOptMenu * mOPop[3];
+  PIButton  * mBut[4];
+  PILabel   * mLab[4];
+  PIText    * mText[3];
+  PIScale   * mPScal;
+
+  bool mFgCol;
+  CMapId mCmap;
+  unsigned short mTypScal;
+  unsigned short mTypDisp;
+  float mFPoints;
+  float mHMin,mHMax;
+  float mFracMin,mFracMax;
+  float mLogScale;
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piimage.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piimage.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piimage.cc	(revision 108)
@@ -0,0 +1,752 @@
+// Affichage d'image            R. Ansari  05/95
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+//                        Refonte   Reza   10/95
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string>
+#include <string.h>
+
+#include "piimage.h"
+
+#include "imageop.h"
+
+
+/* --Methode-- */
+PIImage::PIImage(PIContainerGen *par, char *nom,
+   int sx, int sy, int px, int py) :
+  PIPixmap(par, nom, sx, sy, px, py)
+{
+
+img = NULL;
+aisup = false;
+curshow = true;
+winovis = true;     // $CHECK$ Reza A enlever si possible 17/6/96
+
+
+zow = NULL;
+gvw = NULL; 
+trtw = NULL;
+trtlb = txw = NULL;
+SetTextWin(NULL);
+gpixm = zpixm = pixm = NULL;
+xsgpxm = xszpxm = xspxm = 0;
+ysgpxm = yszpxm = yspxm = 0;
+lut = NULL; 
+offx = offy = 0;
+xpav = ypav = 0;
+xpv0 = ypv0 = 0;
+xszpav = yszpav = 1;
+xmv0 = ymv0 = -1;
+dxmv = dymv = 0;
+xcurs = ycurs = -1;
+zoom = 1;
+zmgv = 1;
+
+SetColMap(CMAP_COLRJ32);
+
+SetBackgroundColor(PI_Black);
+
+ActivateButton(1);
+ActivateMove(1);
+ActivateButton(2);
+ActivateMove(2);
+ActivateButton(3);
+ActivateMove(3);
+
+}
+
+/* --Methode-- */
+PIImage::~PIImage()
+{
+if (pixm) delete pixm;
+if (zpixm) delete zpixm;
+if (txw)  txw->SetLabel("");
+if (zow) 
+  {
+  zow->SetPixmap(NULL,0,0);
+  zow->EraseWindow();
+  }
+if (gpixm) delete gpixm;
+if (gvw) 
+  {
+  gvw->SetPixmap(NULL,0,0);
+  gvw->EraseWindow();
+  gvw->SetMsg(0); gvw->SetMsgParent(NULL); 
+  gvw->SetUserData(NULL, 0); 
+  }
+if (lut) delete lut;
+if (aisup)  delete img;   // Suppression automatique d'image
+if (trtw)  delete trtw;
+}
+
+/* --Methode-- */
+void PIImage::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+if (UserMsg(msg) == (Msg()+626))
+  {
+  if (ModMsg(msg) == PIMsg_Click) 
+    { int* pxy=(int *)data;   SetPave(pxy[0]*zmgv, pxy[1]*zmgv); }
+  if (ModMsg(msg) == PIMsg_Resize)
+    { ComputeGloVPixmap();   SetGloVPixmap(); }
+  }
+else ReSend(msg, sender, data);
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetImage(P2DArrayAdapter *pim, bool ad, bool refr)
+{
+
+offx = offy = 0;
+xpav = ypav = 0;
+xszpav = yszpav = 1;
+img = pim;
+if (gpixm) delete gpixm;
+gpixm = NULL;
+xsgpxm = ysgpxm = 0;
+zmgv = 1;
+
+if (img)  {
+//  SetSize(img->XSize(), img->YSize());
+  CenterPave();
+  float min=1., max=-1., moy, sig;
+  int nbnul, nbsat;
+  img->CheckDyn(min, max, moy, sig, nbnul, nbsat);
+  SetLut(min, max, kLutType_Lin, 1, refr);
+  aisup = ad;
+  }
+else aisup = false;
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetZoomWin(PIPixmap * zw, bool refr) 
+{
+zow = zw;
+if (zow && refr && img)
+  ComputeZoomPixmap();
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetGloVWin(PIPixmap * zw, bool refr) 
+{
+gvw = zw;
+if (gvw && img)  
+  { ComputeGloVPixmap();
+  if (refr) SetGloVPixmap(); } 
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetTextWin(PILabel * tw, bool trw, int tx, int ty)
+{
+txw = tw;
+if (trw)
+  {
+  if (trtw)  trtw->SetSize(tx, ty);
+  else
+    {
+    trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0);
+    trtw->SetAutoDelChilds(true);
+    trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0);
+    trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
+    }
+  }
+else
+  if (trtw) { delete trtw; trtw = NULL;  trtlb = NULL; }
+
+return;
+}
+
+/* --Methode-- */
+void PIImage::ShowCursor(bool sc)
+{
+if (curshow == sc) return;
+curshow = sc;
+if (curshow)  DrawCursor(mWGrC);
+else DrawCursor(mWGrC, -1, -1);
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetLut(float min, float max, int typlut, int lauto, bool refr)
+{
+if (lut) delete(lut);
+if (lauto && img) 
+  {
+  int nbsig = lauto;  
+  float fracmax = 1. - 0.05*nbsig;
+  img->ComputeLut_PicHisto(min, max, nbsig, fracmax);
+  }
+
+lut = new LUT(min, max, NbCol(), typlut);
+
+ComputeGloVPixmap();
+if (refr) Apply();
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetLut(LUT *clut, bool refr)
+{
+LUT * olut = lut;
+lut = new LUT(clut->Min(), clut->Max(), NbCol(), clut->Type());
+if (olut) delete olut;
+
+ComputeGloVPixmap();
+if (refr) Apply();
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetZoomF(float fzm, bool refr)
+{
+int zm;
+
+if (fzm < 0.01) return;
+if (fzm < 1.)  zm = (int)(-(1./fzm));
+else zm = (int)(fzm+0.25);
+SetZoom(zm, refr);
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetZoom(int zm, bool refr)
+{
+if ((zm == 0) || (zm == -1) )  zoom = 1;
+else if (zm > 20)  zoom = 20;
+else if (zm < -20) zoom = -20;
+else zoom = zm;
+if (img)
+  { SetOffsetFromPave();
+  if (refr) Apply(); }
+return;
+}
+
+/* --Methode-- */
+float PIImage::GetZoomF()
+{
+if (zoom >= 1)  return((float)zoom);
+else return(-1./(float)zoom);
+}
+
+
+/* --Methode-- */
+void PIImage::SetOffset(int ox, int oy, bool refr)
+{
+if (img == NULL)  {offx = offy = 0;  return; }
+if (ox < 0)  ox = 0;
+if (ox >= (img->XSize()-1))  ox = img->XSize()-2;
+if (oy < 0)  oy = 0;
+if (oy >= (img->YSize()-1))  oy = img->YSize()-2;
+offx = ox;  offy = oy;
+CenterPave();
+if (refr) Apply();
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetPave(int x, int y, bool refr, bool cent)
+{
+int xc, yc;
+
+if (img == NULL)  
+  { offx = offy = 0; 
+  xpav = ypav = 0; 
+  return; }
+
+if ( (x >= (img->XSize()-1)) || ( x < 0)  ||
+     (y >= (img->YSize()-1)) || ( y < 0)  ) return;
+
+if ( (x == xpav) && (y == ypav) )  return;
+xpav = x;  ypav = y;
+
+if ( PosImg2W(xpav,ypav,&xc, &yc) || cent)  // Il faut recenter l'image
+  { SetOffsetFromPave();  
+  if (refr) Apply(true);  }
+else if (refr)
+  { Apply(false);  if (curshow)  DrawCursor(mWGrC);  }
+
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetColMap(CMapId cmap, bool refr)
+{
+PIPixmap::SetColMap(cmap, refr);
+if (zow)  zow->SetColMap(cmap, refr);
+if (gvw)  gvw->SetColMap(cmap, refr);
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::Apply(bool mw)
+{
+if (img == NULL)  return;
+if (mw)
+  {  
+  ComputePixmap();
+  Send(Msg(), PIMsg_Active);
+  }
+if (zow != NULL)   ComputeZoomPixmap();
+if (gvw != NULL)
+  if ( (gvw->UserData() != this) || (mw) )  SetGloVPixmap();
+
+if (txw || trtlb)
+  {
+  char buff[256];
+  float x,y;
+  img->XYCoord(xpav, ypav, x, y);
+  sprintf(buff,"X= %g , Y= %g  PixVal= %g (%d,%d)", 
+          x, y , (*img)(xpav, ypav), xpav, ypav );
+  if (txw)  txw->SetLabel((string)buff);
+  if (trtlb)  trtlb->SetLabel((string)buff);
+  }
+
+return;
+}
+
+/* --Methode-- */
+void PIImage::Resize()
+{
+// printf("PIImage::Resize\n");
+PIPixmap::Resize();
+CenterPave();
+Apply();
+return;
+}
+
+/* --Methode-- */
+void PIImage::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
+{
+PIPixmap::Draw(g, x0, y0, dx, dy);
+winovis = false;    // $CHECK$ Reza A enlever si possible 17/6/96
+if (curshow)
+  {
+  int xc,yc;
+  PosImg2W(xpav, ypav, &xc, &yc);
+  if ((xc >= x0) && (xc < x0+dx) && 
+      (yc >= y0) && (yc < y0+dy) )  DrawCursor(g, xc, yc);
+  }
+
+return;
+}
+
+/* --Methode-- */
+void PIImage::But1Press(int x, int y)
+{
+int xp, yp;
+
+Send(Msg(), PIMsg_Active);
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+SelPointerShape(PI_CrossPointer);
+xpav = xp;  ypav = yp;
+ShowTrTxW();
+Apply(false);
+if (curshow)  DrawCursor(mWGrC, -1,-1);
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::Ptr1Move(int x, int y)
+{
+int xp, yp;
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+xpav = xp;  ypav = yp;
+Apply(false);
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::But1Release(int /*x*/,  int /*y*/)
+{
+SelPointerShape(PI_ArrowPointer);
+if (curshow)  DrawCursor(mWGrC);
+if (trtw)  trtw->Hide();
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::But2Press(int x, int y)
+{
+
+Send(Msg(), PIMsg_Active);
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xpv0, &ypv0) )  {  xmv0 = -1;  return; }
+xmv0 = x;  ymv0 = y;  dxmv = dymv = 0;
+if (curshow)  DrawCursor(mWGrC,-1,-1);
+mWGrC->SelGOMode(PI_GOXOR);
+if (GetColMapId() == CMAP_COLRJ32)
+mWGrC->SelForeground(PI_Yellow);
+else mWGrC->SelForeground(PI_Magenta);
+mWGrC->SelLine(PI_NormalLine);
+ShowTrTxW();
+return;
+}
+
+/* --Methode-- */
+void PIImage::Ptr2Move(int x, int y)
+{
+int xp, yp;
+if (img == NULL)  return;
+if (xmv0 < 0)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
+dxmv = x-xmv0;  dymv = y-ymv0;
+mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
+if (txw || trtlb)
+  {
+  char buff[256];  
+  float x,y;
+  img->XYCoord(xp, yp, x, y);
+  sprintf(buff,"X= %g , Y= %g  PixVal= %g  (C= %d,%d)", 
+          x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
+  if (txw)  txw->SetLabel((string)buff);
+  if (trtlb)  trtlb->SetLabel((string)buff);
+  }
+return;
+}
+
+/* --Methode-- */
+void PIImage::But2Release(int x, int y)
+{
+int xp2, yp2;
+
+if (img == NULL)  return;
+if (xmv0 < 0)  return;
+mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
+mWGrC->SelGOMode(PI_GOCopy);
+mWGrC->SelForeground(PI_White);
+if ( PosW2Img(x, y, &xp2, &yp2) )  
+  PosW2Img(xmv0+dxmv, ymv0+dymv, &xp2, &yp2);
+xpav = (xpv0+xp2)/2;
+ypav = (ypv0+yp2)/2;
+xszpav = ((xp2-xpv0) > 0) ? (xp2-xpv0) : 1;
+yszpav = ((yp2-ypv0) > 0) ? (yp2-ypv0) : 1;
+
+Apply(false);
+if (curshow)  DrawCursor(mWGrC);
+if (trtw)  trtw->Hide();
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::But3Press(int x, int y)
+{
+int xp, yp;
+
+Send(Msg(), PIMsg_Active);
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
+if (curshow)  DrawCursor(mWGrC,-1,-1);
+ShowTrTxW();
+SelPointerShape(PI_TDLRArrowPointer);
+xmv0 = xp;
+ymv0 = yp;
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::Ptr3Move(int x, int y)
+{
+int xp, yp;
+if (img == NULL)  return;
+if (xmv0 < 0)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+if (txw || trtlb)
+  {
+  char buff[256];
+  sprintf(buff,"DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0);
+  if (txw) txw->SetLabel((string)buff);
+  if (trtlb) trtlb->SetLabel((string)buff);
+  }
+}
+
+/* --Methode-- */
+void PIImage::But3Release(int x, int y)
+{
+int xp, yp;
+
+SelPointerShape(PI_ArrowPointer);
+if (trtw)  trtw->Hide();
+if (img == NULL)  return;
+if (xmv0 < 0)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+
+offx -= (xp-xmv0);
+offy -= (yp-ymv0);
+
+if (offx < 0)  offx = 0;
+if (offy < 0)  offy = 0;
+if (offx >= img->XSize())  offx = img->XSize();
+if (offy >= img->YSize())  offy = img->YSize();
+xpav = xmv0;  ypav = ymv0;
+xmv0 = ymv0 = -1;
+Apply();
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::ComputePixmap()
+{
+unsigned int xwsz, ywsz;
+
+if (img == NULL)  return;
+xwsz = this->XSize();
+ywsz = this->YSize();
+
+pixm = img->ComputePixmap(lut, offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm);
+SetPixmap(pixm, xspxm, yspxm); 
+// Refresh();
+return; 
+}
+
+
+/* --Methode-- */
+void PIImage::ComputeZoomPixmap()
+{
+unsigned int xwsz, ywsz;
+int ofx, ofy;
+int zm;
+
+if (zow == NULL)  return;
+if (img == NULL)  return;
+
+xwsz = zow->XSize();
+ywsz = zow->YSize();
+
+zm = zoom+4;
+if ( (zm==-1) || (zm == 0) ) zm = 1;
+if (zm > 0)
+  {
+  ofx = xpav-(xwsz/2/zm);
+  ofy = ypav-(ywsz/2/zm);
+  }
+else 
+  {
+  ofx = xpav+(xwsz*zm/2);
+  ofy = ypav+(ywsz*zm/2);
+  }
+if (ofx < 0)  ofx = 0;
+if (ofy < 0)  ofy = 0;
+
+zpixm = img->ComputePixmap(lut, ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);
+zow->SetColMap(GetColMapId(), false);
+zow->SetPixmap(zpixm, xszpxm, yszpxm); 
+zow->SetUserData((void *)this, 0);
+// zow->Refresh();
+return; 
+
+}
+
+
+/* --Methode-- */
+void PIImage::ComputeGloVPixmap()
+{
+unsigned int xwsz, ywsz;
+int zmx,zmy;
+
+if (gvw == NULL)  return;
+if (img == NULL)  return;
+
+xwsz = gvw->XSize();
+ywsz = gvw->YSize();
+
+zmx = img->XSize()/xwsz;
+zmy = img->YSize()/ywsz;
+
+if (zmx < zmy)   zmx = zmy;
+if (zmx < 1)  zmx = 1;
+zmgv = zmx;
+if (zmx > 1)  zmx = -zmx;
+gpixm = img->ComputePixmap(lut, 0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm);
+printf("DEBUG-ComputeGloVPixmap()  %d-%d , (%d,%d) , %d-%d \n", xwsz, ywsz, zmx, zmy, xsgpxm, ysgpxm);
+return;
+}
+
+/* --Methode-- */
+void PIImage::SetGloVPixmap()
+{
+float zm;
+int x,y, dx,dy;
+
+if (zoom > 0) zm = zmgv*zoom;
+else zm = (float)zmgv/(float)(-zoom);
+x = offx/zmgv+1;
+y = offy/zmgv+1;
+dx =  (int) ( (float)XSize()/zm-1. );  
+dy =  (int) ( (float)YSize()/zm-1. );  
+
+
+gvw->ElDelAll();
+gvw->WindowGraphic()->SelForeground(PI_Yellow);
+gvw->WindowGraphic()->SelLine(PI_NormalLine);
+gvw->ElAddRect(x,y,dx,dy);
+gvw->SetColMap(GetColMapId(), false);
+gvw->SetPixmap(gpixm, xsgpxm, ysgpxm); 
+gvw->SetUserData((void *)this, 0);
+gvw->SetMsg(Msg()+626);
+gvw->SetMsgParent(this);
+
+return; 
+}
+
+/* --Methode-- */
+void PIImage::DrawCursor(PIGraphicGen* g) 
+{
+int xc, yc;
+if (PosImg2W(xpav, ypav, &xc, &yc)) DrawCursor(g, -1, -1);
+else DrawCursor(g, xc, yc);
+return;
+}
+
+#define CURSHSIZE  25
+ 
+/* --Methode-- */
+void PIImage::DrawCursor(PIGraphicGen* g, int xc, int yc)
+{
+
+if ((xcurs>=0) && (ycurs>=0))
+  PIPixmap::Draw(g, xcurs-CURSHSIZE, ycurs-CURSHSIZE, CURSHSIZE*2, CURSHSIZE*2); 
+
+if ((xc >= 0) && (yc >= 0)) 
+  {
+  xcurs = xc;   ycurs = yc;
+  if (winovis)  return;      // $CHECK$ Reza A enlever si possible 17/6/96
+  if (zoom < 3)  g->SelLine(PI_NormalLine);
+  else g->SelLine(PI_ThickLine);
+  if ( (GetColMapId() == CMAP_GREY32) || (GetColMapId() == CMAP_GREYINV32) )
+    g->SelForeground(PI_Red);
+  else g->SelForeground(PI_White);
+  g->SelGOMode(PI_GOCopy);
+  g->DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
+  g->DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs);
+  g->DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4);
+  g->DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE);
+  }
+else { xcurs = ycurs = -1; }
+
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::ShowTrTxW()
+{
+if (trtw) 
+  {
+  int tpx, tpy;
+  GetScreenPos(tpx, tpy);
+  tpy -= (trtw->YSize()+5);
+  if (tpy < 0)  tpy = 0;
+  trtw->SetPos(tpx, tpy);
+  trtw->Show();  
+  }
+
+return;
+}
+
+/* --Methode-- */
+int PIImage::PosW2Img(int xiw, int yiw, int * xp, int * yp)
+{
+
+if (zoom > 0)
+  {
+  *xp = xiw/zoom+offx;
+  *yp = yiw/zoom+offy;
+  }
+else
+  {
+  *xp = offx-xiw*zoom;
+  *yp = offy-yiw*zoom;
+  }
+
+if ( (*xp >= 0) && (*xp < img->XSize() ) &&
+     (*yp >= 0) && (*yp < img->YSize() )  )   return(0);
+else return(1);
+}
+
+
+/* --Methode-- */
+int PIImage::PosImg2W(int xp, int yp, int * xiw, int * yiw)
+{
+if (zoom > 0)
+  {
+  *xiw = (xp-offx)*zoom+(zoom/2);
+  *yiw = (yp-offy)*zoom+(zoom/2);
+  }
+else
+  {
+  *xiw = (offx-xp)/zoom;
+  *yiw = (offy-yp)/zoom;
+  }
+
+if (*xiw > XSize())  *xiw = -1;
+if (*yiw > YSize())  *yiw = -1;
+
+if ((*xiw < 0) || (*yiw < 0))  return(1);
+else return(0);
+}
+
+
+/* --Methode-- */
+void PIImage::SetOffsetFromPave()
+{
+if (zoom > 0)
+  {
+  offx = xpav-XSize()/2/zoom;
+  offy = ypav-YSize()/2/zoom;
+  }
+else
+  {
+  offx = xpav+XSize()/2*zoom;
+  offy = ypav+YSize()/2*zoom;
+  }
+
+if (offx < 0)  offx = 0;
+if (offx >= (img->XSize()-1))  offx = img->XSize()-2;
+if (offy < 0)  offy = 0;
+if (offy >= (img->YSize()-1))  offy = img->YSize()-2;
+
+return;
+}
+
+/* --Methode-- */
+void PIImage::CenterPave()
+{
+int xwsz, ywsz;
+
+if (zoom > 0)
+  { xwsz = XSize()/zoom;  
+  ywsz = YSize()/zoom;  }
+else
+  { xwsz = -(XSize()*zoom); 
+  ywsz = -(YSize()*zoom); }
+  
+if (xwsz > (img->XSize()-offx)) xwsz = (img->XSize()-offx);
+if (ywsz > (img->YSize()-offy)) ywsz = (img->YSize()-offy);
+xpav = offx+xwsz/2; 
+ypav = offx+ywsz/2;
+xszpav = ((xwsz+ywsz)/20) ;
+if (xszpav < 1) xszpav = 1;
+yszpav = xszpav; 
+
+return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piimage.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piimage.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piimage.h	(revision 108)
@@ -0,0 +1,126 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Affichage d'image            R. Ansari  05/95
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#ifndef PIIMAGEBASE_H_SEEN
+#define PIIMAGEBASE_H_SEEN
+
+#include "parradapter.h"
+
+#include "pisysdep.h"
+
+#include PIPIXMAP_H
+#include PISTDWDG_H
+#include PIWIN_H
+
+class PIImage : public PIPixmap
+{
+
+public:
+  enum {ClassId = 5150};
+
+//  Les methodes 
+
+  PIImage(PIContainerGen *par, char *nom=NULL, 
+           int sx=0, int sy=0, int px=0, int py=0);
+  ~PIImage();
+
+  virtual long    kind() {return ClassId; }
+  virtual void    Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+  void SetImage(P2DArrayAdapter* pim, bool ad = true, bool refr=true);
+
+  void SetZoomWin(PIPixmap * zw, bool refr=true);
+  void SetGloVWin(PIPixmap * zw, bool refr=true);
+  void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30);
+  void ShowCursor(bool sc=true); 
+
+  void SetLut(float min, float max, int typlut=kLutType_Lin,
+              int lauto=0, bool refr=true);
+  void SetLut(LUT *clut, bool refr=true);
+
+  void SetZoom(int zm, bool refr=true);
+  void SetZoomF(float fzm, bool refr=true);
+  float GetZoomF();
+
+  void SetOffset(int ox, int oy, bool refr=true);
+  void SetPave(int x, int y, bool refr=true, bool cent=true);
+
+  virtual void SetColMap(CMapId cmap, bool refr=true);
+
+  inline P2DArrayAdapter * Image() { return(img); }
+  inline LUT *     Lut() { return(lut); }
+  inline int XPave() { return(xpav); } ;
+  inline int YPave() { return(ypav); } ;
+
+  inline int XSzPave() { return(xszpav); }
+  inline int YSzPave() { return(yszpav); }
+
+  void Apply(bool mw=true);
+
+  virtual void Resize();
+  virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+
+  virtual void But1Press(int x, int y);
+  virtual void But1Release(int x, int y);
+  virtual void Ptr1Move(int x, int y);
+  virtual void But2Press(int x, int y);
+  virtual void But2Release(int x, int y);
+  virtual void Ptr2Move(int x, int y);
+  virtual void But3Press(int x, int y);
+  virtual void But3Release(int x, int y);
+  virtual void Ptr3Move(int x, int y);
+
+private:
+      
+  void ComputePixmap();
+  void ComputeZoomPixmap();
+  void ComputeGloVPixmap();
+  void SetGloVPixmap();
+
+  void DrawCursor(PIGraphicGen* g);
+  void DrawCursor(PIGraphicGen* g, int xc, int yc);
+
+  void ShowTrTxW();
+
+  int PosW2Img(int xiw, int yiw, int * xp, int * yp);
+  int PosImg2W(int xp, int yp, int * xiw, int * yiw);
+
+  void SetOffsetFromPave();
+  void CenterPave();
+
+// Les donnees 
+  P2DArrayAdapter * img;
+  bool aisup;     // Flag de suppression automatique de img
+  bool curshow;
+  bool winovis;   // $CHECK$ Reza A enlever si possible 17/6/96
+// Tableau des pixels principal  
+  unsigned char * pixm;
+  int xspxm, yspxm;
+  LUT * lut;
+  int offx, offy;
+// Fenetre de zoom
+  int zoom;
+  PIPixmap * zow;
+  unsigned char * zpixm;
+  int xszpxm, yszpxm;
+// Fenetre pour l'image entiere  
+  int zmgv;
+  PIPixmap * gvw;
+  unsigned char * gpixm;
+  int xsgpxm, ysgpxm;
+// Fenetre/champ de texte
+  PILabel * txw;
+  PILabel * trtlb;
+  PIWindow * trtw;
+// Le pave et le curseur
+  int xpav, ypav;
+  int xpv0, ypv0;
+  int xmv0, ymv0;
+  int dxmv, dymv;
+  int xcurs, ycurs;
+  int xszpav, yszpav;
+
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piinit.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piinit.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piinit.cc	(revision 108)
@@ -0,0 +1,22 @@
+#include "defs.h"
+#include "piinit.h"
+
+
+int PeidaInteractiveInitiator::FgInit = 0;
+
+PeidaInteractiveInitiator::PeidaInteractiveInitiator()
+ : PeidaStarRecoInitiator()
+{
+  FgInit++;
+  if (FgInit > 1)  return;
+  
+} 
+
+PeidaInteractiveInitiator::~PeidaInteractiveInitiator()
+{
+  FgInit--;
+/*  if (FgInit == 0)
+    {
+    }  */
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/piinit.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piinit.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piinit.h	(revision 108)
@@ -0,0 +1,19 @@
+#ifndef PIINIT_H_SEEN
+#define PIINIT_H_SEEN
+
+#include "strecinit.h"
+
+// Classe d'initialisation pour le module PI de PEIDA
+
+class PeidaInteractiveInitiator : public PeidaStarRecoInitiator{
+private:
+  static int FgInit;
+public:
+  PeidaInteractiveInitiator();
+ ~PeidaInteractiveInitiator();
+};
+
+#undef PeidaInit
+#define PeidaInit() PeidaInteractiveInitiator peidainitiator
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pilistgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistgen.cc	(revision 108)
@@ -0,0 +1,10 @@
+#include "pilistgen.h"
+
+
+PIListGen::PIListGen(PIContainerGen *par, char *nom,
+                     int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{}
+
+PIListGen::~PIListGen()
+{}
Index: /branches/EA_Juin98/SophyaPI/PI/pilistgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistgen.h	(revision 108)
@@ -0,0 +1,37 @@
+#ifndef PILISTGEN_H_SEEN
+#define PILISTGEN_H_SEEN
+
+#include "pisysdep.h"
+#include PIWDG_H
+
+
+class PIListGen : public PIWdg {
+public:
+  enum {ClassId = 1110};
+
+	             PIListGen(PIContainerGen* par, char* nom,
+                               int sx=100, int sy=100, int px=0, int py=0);
+	             ~PIListGen();
+				   
+  virtual void	     AppendItem(const char * item, PIMessage msg)=0;
+  virtual void       DeleteItem(const char *item)=0;
+  virtual void       DeleteItem(PIMessage msg)=0;
+  
+  virtual void       SetMultipleSelect(bool ms=false)=0;
+
+  virtual int        GetNbSelection()=0;
+  virtual PIMessage  GetSelection(int num=0)=0;
+  virtual string     GetSelectionStr(int num=0)=0;
+
+  virtual void       SelectItem(const char * item)=0;
+  virtual void       SelectItem(PIMessage msg)=0;
+  virtual void       ClearSelItem(const char * item)=0;
+  virtual void       ClearSelItem(PIMessage msg)=0;
+
+  virtual long       kind() {return ClassId; }
+
+protected:
+}; 
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pilistmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistmac.cc	(revision 108)
@@ -0,0 +1,92 @@
+#include<stdio.h>
+
+#include "pilistmac.h"
+
+
+
+
+/* --Methode-- */
+PIListMac::PIListMac(PIContainerGen* par, char* nom,
+                 int sx, int sy, int px, int py)
+: PIListGen(par, nom, sx, sy, px, py)
+{
+  delete mPane;
+  mPane = mPIPPList = new PIPPList(mPaneInfo, mViewInfo, this);
+  Manage();
+}
+
+/* --Methode-- */
+PIListMac::~PIListMac()
+{
+}
+
+
+/* --Methode-- */
+void PIListMac::AppendItem(const char * item, PIMessage msg)
+{
+  mPIPPList->AppendItem(item, msg);
+}
+
+/* --Methode-- */
+void PIListMac::DeleteItem(const char * item)
+{
+  mPIPPList->DeleteItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::DeleteItem(PIMessage msg)
+{
+  mPIPPList->DeleteItem(msg);
+}
+
+
+/* --Methode-- */
+void PIListMac::SetMultipleSelect(bool ms)
+{
+  mPIPPList->SetMultipleSelect(ms);
+}
+
+/* --Methode-- */
+int PIListMac::GetNbSelection()
+{
+  return mPIPPList->GetNbSel();
+}
+
+/* --Methode-- */
+PIMessage PIListMac::GetSelection(int num)
+{
+  return mPIPPList->GetSelMsg(num);
+}
+
+/* --Methode-- */
+string PIListMac::GetSelectionStr(int num)
+{
+  return mPIPPList->GetSelStr(num);
+}
+
+/* --Methode-- */
+void PIListMac::SelectItem(const char * item)
+{
+  mPIPPList->SelectItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::SelectItem(PIMessage msg)
+{
+  mPIPPList->SelectItem(msg);
+}
+
+
+/* --Methode-- */
+void PIListMac::ClearSelItem(const char * item)
+{
+  mPIPPList->ClearSelItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::ClearSelItem(PIMessage msg)
+{
+  mPIPPList->ClearSelItem(msg);
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pilistmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistmac.h	(revision 108)
@@ -0,0 +1,35 @@
+#ifndef PILISTMAC_H_SEEN
+#define PILISTMAC_H_SEEN
+
+#include "pilistgen.h"
+#include "pipplist.h"
+
+class PIListMac : public PIListGen {
+public:
+	             PIListMac(PIContainerGen* par, char* nom,
+                             int sx=100, int sy=100, int px=0, int py=0);
+	             ~PIListMac();
+				   
+  virtual void	     AppendItem(const char * item, PIMessage msg);
+  virtual void       DeleteItem(const char *item);
+  virtual void       DeleteItem(PIMessage msg);
+
+  virtual void       SetMultipleSelect(bool ms=false);
+
+  virtual int        GetNbSelection();
+  virtual PIMessage  GetSelection(int num=0);
+  virtual string     GetSelectionStr(int num=0);
+
+  virtual void       SelectItem(const char * item);
+  virtual void       SelectItem(PIMessage msg);
+  virtual void       ClearSelItem(const char * item);
+  virtual void       ClearSelItem(PIMessage msg);
+
+
+protected:
+  PIPPList* mPIPPList;
+};
+
+typedef PIListMac        PIList;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pilistx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistx.cc	(revision 108)
@@ -0,0 +1,383 @@
+#include<stdio.h>
+
+#include "pilistx.h"
+#include "picontainerx.h"
+
+#include <Xm/Xm.h>
+#include <Xm/List.h>
+
+
+/************* PIListX ************/
+
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
+
+// Fonction prive (CallBack)
+static void list_action(Widget w, XtPointer *usd, XmListCallbackStruct *isel);
+
+/* Nouvelle-Fonction */
+void  list_action(Widget /*w*/, XtPointer *usd, XmListCallbackStruct *isel)
+{
+PIListX *pil;
+
+pil = (PIListX *)usd ;
+//  printf("list_action/Debug: reason=%d itemPos= %d \n", 
+//          isel->reason, isel->item_position);
+pil->ToggleSel(isel->item_position-1, true);
+return;
+}
+
+
+#define NBITEMB  20
+#define NBISELB  5
+
+
+/* --Methode-- */
+PIListX::PIListX(PIContainerGen* par, char* nom,
+                 int sx, int sy, int px, int py)
+: PIListGen(par, nom, sx, sy, px, py)
+{
+
+mNItem = mNItemMax = 0;
+mMess = NULL;  mSel = NULL;
+mNbSel = mNSelMax = 0;
+mSelNum = NULL;
+ 
+Arg  warg[3];
+int n = 0;
+XtSetArg(warg[n], XmNlistSizePolicy, XmCONSTANT);  n++;
+XtSetArg(warg[n], XmNscrollBarDisplayPolicy, XmAS_NEEDED);  n++;
+mlist = XmCreateScrolledList(((PIWdgX *)par)->XtWdg(), nom, warg, n);
+XtManageChild(mlist);
+XtWdg() = XtParent(mlist);
+SetSize(sx, sy);
+SetPos(px, py);
+wmis = k_wmi_normal ;
+stmng = 0;
+
+//XtAddCallback(mlist, XmNdefaultActionCallback,
+//              list_action, (XtPointer)this);
+XtAddCallback(mlist, XmNmultipleSelectionCallback,
+              (XtCallbackProc)list_action, (XtPointer)this);
+XtAddCallback(mlist, XmNsingleSelectionCallback,
+              (XtCallbackProc)list_action, (XtPointer)this);
+
+SetMultipleSelect(false);
+Manage();
+}
+
+/* --Methode-- */
+PIListX::~PIListX()
+{
+
+if (mNItemMax > 0)  
+  {
+    //  XtFree((char *)mItems);
+  delete[] mMess;
+  delete[] mSel;
+  }  
+if (mNSelMax > 0)  delete[] mSelNum;
+}
+
+
+/* --Methode-- */
+void PIListX::AppendItem(const char * item, PIMessage msg)
+{
+
+if (mNItem >= mNItemMax)
+  {
+  PIMessage *mso;
+  bool *slo;
+  int i;
+
+  mso = mMess;
+  slo = mSel;
+  mNItemMax += NBITEMB;
+  mMess = new PIMessage[mNItemMax];
+  mSel = new bool[mNItemMax];
+  for(i=0; i<mNItem; i++)   
+    {  mMess[i] = mso[i];  mSel[i] = slo[i]; }
+
+  delete[] mso;
+  delete[] slo;
+  }
+
+mMess[mNItem] = msg;
+mSel[mNItem] = false;
+mNItem++;
+
+XmString xms = XmStringCreate(const_cast<char *>(item), XmSTRING_DEFAULT_CHARSET);
+XmListAddItem(mlist, xms, 0);
+XmStringFree(xms);
+return;
+}
+
+/* --Methode-- */
+void PIListX::DeleteItem(const char * item)
+{
+int n;
+if ((n=GetNumItem(item)) < 0)  return;
+DelItem(n);
+return;
+}
+
+/* --Methode-- */
+void PIListX::DeleteItem(PIMessage msg)
+{
+int n;
+if ((n=GetNumItemMsg(msg)) < 0)  return;
+DelItem(n);
+return;
+}
+
+
+/* --Methode-- */
+void PIListX::SetMultipleSelect(bool ms)
+{
+Arg  warg[2];
+
+mMultSel = ms;
+if (ms)
+  XtSetArg(warg[0], XmNselectionPolicy, XmMULTIPLE_SELECT);  
+else
+  XtSetArg(warg[0], XmNselectionPolicy, XmSINGLE_SELECT);  
+
+XtSetValues(mlist, warg, 1);
+}
+
+/* --Methode-- */
+int PIListX::GetNbSelection()
+{
+return(mNbSel);
+}
+
+/* --Methode-- */
+PIMessage PIListX::GetSelection(int num)
+{
+if ( (num < 0) || (num >= mNbSel) ) return(0); 
+return(ItemMsg(mSelNum[num]));
+}
+
+/* --Methode-- */
+string PIListX::GetSelectionStr(int num)
+{
+if ( (num < 0) || (num >= mNbSel) ) return(""); 
+string s(ItemStr(mSelNum[num]));
+return(s);
+}
+
+/* --Methode-- */
+void PIListX::SelectItem(const char * item)
+{
+int n;
+if ((n=GetNumItem(item)) < 0)  return;
+if ((!mMultSel) && (mNbSel > 0))
+  if  (mSelNum[0] != n)  ClrSItem(mSelNum[0], false, true);  
+SelItem(n, false, true);
+return;
+}
+
+/* --Methode-- */
+void PIListX::SelectItem(PIMessage msg)
+{
+int n;
+if ((n=GetNumItemMsg(msg)) < 0)  return;
+if ((!mMultSel) && (mNbSel > 0))
+  if  (mSelNum[0] != n)  ClrSItem(mSelNum[0], false, true);  
+SelItem(n, false, true);
+return;
+}
+
+
+/* --Methode-- */
+void PIListX::ClearSelItem(const char * item)
+{
+int n;
+if ((n=GetNumItem(item)) < 0)  return;
+ClrSItem(n, false, true);
+return;
+}
+
+/* --Methode-- */
+void PIListX::ClearSelItem(PIMessage msg)
+{
+int n;
+if ((n=GetNumItemMsg(msg)) < 0)  return;
+ClrSItem(n, false, true);
+return;
+}
+
+
+/* --Methode-- */
+void PIListX::ToggleSel(int n, bool smg)
+{
+if ( (n < 0) || (n >= mNItem))  return;
+if (mSel[n])  ClrSItem(n,smg); 
+else
+  {
+  if ((!mMultSel) && (mNbSel > 0))  ClrSItem(mSelNum[0], smg);
+  SelItem(n, smg);
+  }
+}
+
+
+/* --Methode-- */
+PIMessage PIListX::ItemMsg(int n)
+{
+if ( (n < 0) || (n >= mNItem))  return(0);
+else return(mMess[n]);
+}
+
+/* --Methode-- */
+char * PIListX::ItemStr(int n)
+{
+Arg  warg[2];
+XmString *xmst=NULL;
+
+if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
+mSItem[0] = '\0';
+XtSetArg(warg[0], XmNitems, &xmst);  
+XtGetValues(mlist, warg, 1);
+CStrFrXmStr(xmst[n], mSItem, 320);
+return(mSItem);
+}
+
+/* --Methode-- */
+int PIListX::GetNumItem(const char *it)
+{
+for(int i=0; i<mNItem; i++)
+  if (strcmp(ItemStr(i), it) == 0)  return(i);
+return(-1);
+}
+
+/* --Methode-- */
+int PIListX::GetNumItemMsg(PIMessage msg)
+{
+for(int i=0; i<mNItem; i++)
+  if (mMess[i] == msg)   return(i);  
+return(-1);
+}
+
+
+
+/* --Methode-- */
+void PIListX::DelItem(int n)
+{
+int i;
+
+if ((n < 0) || (n > mNItem))  return;
+
+ClrSItem(n);
+for(i=n; i<mNItem-1; i++)
+  { mMess[i] = mMess[i+1];  mSel[i] = mSel[i+1]; }
+mNItem--;
+
+if (mNItem < (mNItemMax-NBITEMB-1))
+  {
+    //  XmString *ito;
+  PIMessage *mso;
+  bool *slo;
+
+  //  ito = mItems;
+  mso = mMess;
+  slo = mSel;
+  mNItemMax -= NBITEMB;
+  mMess = new PIMessage[mNItemMax];
+  mSel = new bool[mNItemMax];
+  //  mItems = (XmString *) XtMalloc(sizeof(XmString)*mNItemMax);
+  for(i=0; i<mNItem; i++)   
+    { // mItems[i] = ito[i];
+    mMess[i] = mso[i];  mSel[i] = slo[i]; }
+
+  //  XtFree((char *)mItems);
+  delete[] mso;
+  delete[] slo;
+  }
+
+XmListDeletePos(mlist, n+1);
+return;
+}
+
+
+/* --Methode-- */
+bool PIListX::SelItem(int n, bool smg, bool cxw)
+{
+int i;
+
+if ((n < 0) || (n > mNItem))  return(false);
+if (mSel[n])  return(false);
+
+mSel[n] = true;
+if (mNbSel >= mNSelMax)
+  {
+  int * osel;
+  osel = mSelNum;
+  mNSelMax += NBISELB;
+  mSelNum = new int[mNSelMax];
+  for(i=0; i<mNbSel; i++)  mSelNum[i] = osel[i];
+  if (osel)  delete[] osel;
+  }
+
+mSelNum[mNbSel] = n; 
+mNbSel++;
+if (smg)  
+  Send(mMess[n], PIMsg_Select); 
+if (cxw)
+  XmListSelectPos(mlist, n+1, FALSE);
+return(true);
+}
+
+
+
+
+/* --Methode-- */
+bool PIListX::ClrSItem(int n, bool smg, bool cxw)
+{
+int i;
+if ((n < 0) || (n > mNItem))  return(false);
+if (!mSel[n])  return(false);
+mSel[n] = false;
+
+mNbSel --;
+if (smg)  
+  Send(mMess[n], PIMsg_ClearSel); 
+if (cxw)
+  XmListDeselectPos(mlist, n+1);
+
+if (mSelNum) delete[] mSelNum;
+if (mNbSel <= 0)
+  { mNSelMax = mNbSel = 0;  mSelNum = NULL; }
+else
+  {
+  mNSelMax = (mNbSel+NBISELB)/NBISELB;
+  mSelNum = new int[mNSelMax];
+  mNbSel =  0;
+  for(i=0; i<mNItem; i++)
+    if (mSel[i]) { mSelNum[mNbSel] = i; mNbSel++; }
+  }
+
+return(true);
+} 
+
+
+/* --Methode-- 
+    A Supprimer .....
+void PIListX::ChangeSel()
+{
+XmString *xmst;
+int n;
+
+n=0;
+XtSetArg(warg[n], XmNselectedItems, &xmst);  n++;
+XtGetValues(mlist, warg, n);
+if (xmst)  XtFree(xmst);
+xmst =  (XmString *) XtMalloc(sizeof(XmString)*mNbSel);
+for(i=0; i<mNbSel; i++)
+  xmst[i] = mItems[mSelNum[i]];
+n=0;
+XtSetArg(warg[n], XmNselectedItems, xmst);  n++;
+XtSetArg(warg[n], XmNselectedItemCount, mNbSel);  n++;
+XtSetValues(mlist, warg, n);
+return;
+}
+   .....  */
Index: /branches/EA_Juin98/SophyaPI/PI/pilistx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pilistx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pilistx.h	(revision 108)
@@ -0,0 +1,52 @@
+#ifndef PILISTX_H_SEEN
+#define PILISTX_H_SEEN
+
+#include "pilistgen.h"
+
+class PIListX : public PIListGen {
+public:
+	             PIListX(PIContainerGen* par, char* nom,
+                             int sx=100, int sy=100, int px=0, int py=0);
+	             ~PIListX();
+				   
+  virtual void	     AppendItem(const char * item, PIMessage msg);
+  virtual void       DeleteItem(const char *item);
+  virtual void       DeleteItem(PIMessage msg);
+
+  virtual void       SetMultipleSelect(bool ms=false);
+
+  virtual int        GetNbSelection();
+  virtual PIMessage  GetSelection(int num=0);
+  virtual string     GetSelectionStr(int num=0);
+
+  virtual void       SelectItem(const char * item);
+  virtual void       SelectItem(PIMessage msg);
+  virtual void       ClearSelItem(const char * item);
+  virtual void       ClearSelItem(PIMessage msg);
+
+// Mis en public pour Callback Xt
+  virtual void       ToggleSel(int n, bool smg=false);
+
+protected:
+  PIMessage          ItemMsg(int n);
+  char *             ItemStr(int n);
+  int                GetNumItem(const char * nom);
+  int                GetNumItemMsg(PIMessage msg);
+  void               DelItem(int n);
+  bool               SelItem(int n, bool smg=false, bool cxw=false);
+  bool               ClrSItem(int n, bool smg=false, bool cxw=false);
+
+int mNItem, mNItemMax;
+PIMessage * mMess;
+bool * mSel;
+int mNbSel, mNSelMax;
+int * mSelNum;
+bool mMultSel;
+char mSItem[320];
+
+SysDWdg mlist;
+};
+
+typedef PIListX        PIList;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimak
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimak	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimak	(revision 108)
@@ -0,0 +1,143 @@
+CC := gcc
+CXX := g++
+# General setup GNU Makefile for EROS. To be included in all makefiles.  
+# Define  makefile variables according to CPU
+# MACHEROSD = `uname | sed 's/-//'`   i.e. { AIX HPUX OSF1 ULTRIX }
+# 
+# Makefile variables set are:
+# - Path to Exec, Include, Libs, Objs directories (from EROSBASEREP env. var.)
+#     i.e. variables LIB, OBJ, EXE, INC 
+#---------------------------------------------------------------------------
+
+# define MACHEROS from uname
+MACHEROS := $(shell echo `uname`)
+# define the -D option
+MACHEROSD := $(shell echo `uname | sed 's/-//'`)
+
+#-
+#-     Optimization option different for HP...
+ifeq (${MACHEROS},HP-UX)
+  O := +O
+else
+  O := -O
+endif
+#-
+#-   Define Makefile paths
+#-  
+ PP  := ${EROSBASEREP}/${MACHEROS}/
+ LIB := ${PP}/Libs/
+ SLB := ${PP}/ShLibs/
+ OBJ := ${PP}/Objs/
+ EXE := ${PP}/Exec/
+ INC := ${EROSBASEREP}/Include/
+ CCI := ${INC}/CInc/
+ CXI := ${INC}/CxxInc/
+#--
+
+#-
+#-    Define default compilation flags
+#--
+ifeq (${MACHEROS},HP-UX)                                    
+  CFLAGS   :=  -Aa
+  FFLAGS   :=  -Aa -I${INC} -D${MACHEROSD}  
+  CPPFLAGS :=  -I${INC} -D${MACHEROSD} \
+               -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE
+else
+  FFLAGS   :=  -I${INC} -D${MACHEROSD}  
+  CPPFLAGS :=  -I${INC} -D${MACHEROSD}
+endif
+AR       := ar
+ARFLAGS  := -rcs
+
+ifeq ($(CC), gcc)
+CFLAGS       := -g -O -Wall -Wpointer-arith \
+                -Wmissing-prototypes -Wsynth -I$(INC)
+//CXXFLAGS     := $(CFLAGS) -fno-implicit-templates -I$(CXI)
+CXXFLAGS     := $(CFLAGS) -I$(CXI)
+endif
+
+#- redefine implicit rule. Les .o sont dans $(OBJ).
+$(OBJ)%.o:%.c
+	$(COMPILE.c) -o $@ $<
+
+$(OBJ)%.o:%.cc
+	$(COMPILE.cc) -o $@ $<
+
+$(OBJ)%.o:%.f
+	$(COMPILE.f) -o $@ $< 
+
+#OSF1
+#LDFC est f77
+#LDFCFLAGS est rien
+
+#parfois
+#LDFC est cc
+#LDFCFLAGS est -ltruc
+
+#------------------------------------------------- End of Makefile.h ------- 
+all : piapp piapp_nosh
+
+piapp : $(EXE)piapp $(SLB)piup.so 
+ 
+piapp_nosh : $(EXE)piapp_nosh
+ 
+
+$(EXE)piapp  : $(OBJ)pidemo.o $(SLB)libPI.so $(SLB)libOuIm.so \
+               $(SLB)liberosc.so $(SLB)libStarReco.so 
+	cc -call_shared -o $(EXE)piapp $(OBJ)pidemo.o \
+              -L$(SLB) -lPI -lOuIm -lerosc -lStarReco \
+              -lgcxx -lXm -lXt -lX11 -lm  
+
+$(EXE)piapp_nosh  : $(OBJ)pidemo_nosh.o $(LIB)libPI.a $(LIB)libStarReco.a  \
+               $(LIB)libOutils.a $(LIB)libImages.a $(LIB)libmath.a $(LIB)libdiv.a 
+	g++ -o $(EXE)piapp_nosh $(OBJ)pidemo_nosh.o \
+              -L$(LIB) -lPI -lStarReco -lImages -lOutils -lmath -ldiv \
+              -lXm -lXt -lX11 -lm 
+ 
+$(SLB)piup.so : $(OBJ)piup_def.o \
+                $(SLB)libOuIm.so $(SLB)liberosc.so 
+	ld -shared -o $(SLB)piup.so -all $(OBJ)piup_def.o \
+        -none -L$(SLB) -lOuIm -lerosc -lgcxx -lm -lc
+
+$(OBJ)pidemo_nosh.o: pidemo.cc pidemo.h
+	g++ -g -O -c -Wall -Wpointer-arith \
+            -Wmissing-prototypes -Wsynth -I$(INC) -I$(CXI) \
+            -D C_NO_SHLIBS -o $(OBJ)pidemo_nosh.o pidemo.cc
+
+$(OBJ)pidemo.o: ./pidemo.cc \
+ $(INC)perrors.h \
+ $(INC)exceptions.h \
+ $(INC)defs.h \
+ $(INC)fitsimage.h \
+ $(INC)cimage.h \
+ $(INC)rzimage.h \
+ $(INC)rzvect.h \
+ $(INC)machine.h \
+ $(INC)datatypes.h \
+ $(INC)fitsheader.h \
+ $(INC)fitskeys.h pidemo.h \
+ pisysdep.h piapplx.h piapplgen.h pimsghandler.h picontainerx.h \
+ picontainergen.h piwdgx.h piwdggen.h pimenubarx.h pimenubargen.h \
+ pimenux.h pimenugen.h piwindowx.h piwindowgen.h pioptmenux.h \
+ pioptmenugen.h pistdwdgx.h pistdwdggen.h pifilechox.h pifilechogen.h \
+ piimage.h $(INC)lut.h \
+ pipixmapx.h pipixmapgen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
+ picmapgen.h pihisto.h piscdrawwdg.h \
+ $(INC)histos.h \
+ $(INC)peida.h \
+ $(INC)utils.h pidrawwin.h \
+ $(INC)piup.h
+$(OBJ)piup_def.o: piup_def.cc  piup.h \
+ $(INC)perrors.h \
+ $(INC)exceptions.h \
+ $(INC)defs.h \
+ $(INC)fitsimage.h \
+ $(INC)cimage.h \
+ $(INC)rzimage.h \
+ $(INC)rzvect.h \
+ $(INC)machine.h \
+ $(INC)datatypes.h \
+ $(INC)fitsheader.h \
+ $(INC)fitskeys.h \
+ $(INC)utils.h $(INC)peida.h 
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubargen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubargen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubargen.cc	(revision 108)
@@ -0,0 +1,14 @@
+#include "pimenubargen.h"
+
+#include PIAPP_H
+
+PIMenubarGen::PIMenubarGen(PIApplicationGen* par, char* nom)
+: PIWdg(NULL, nom)
+{
+SetMsgParent(par);
+}
+
+PIMenubarGen::~PIMenubarGen()
+{}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubargen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubargen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubargen.h	(revision 108)
@@ -0,0 +1,24 @@
+#ifndef PIMBARGEN_H_SEEN
+#define PIMBARGEN_H_SEEN
+
+#include "pisysdep.h"
+#include PIMENU_H
+
+class PIApplicationGen;
+
+class PIMenubarGen : public PIWdg {
+public:
+  enum {ClassId = 2600};
+
+	            PIMenubarGen(PIApplicationGen* par, char* nom);
+	            ~PIMenubarGen();
+				   
+  virtual void      AppendMenu(PIPDMenu *pdm)=0;
+  virtual void      RemoveMenu(PIPDMenu *pdm)=0;
+  virtual void      SetSensitivity(PIPDMenu *pdm, bool sens=true)=0;
+  virtual bool      IsSensitive(PIPDMenu *pdm)=0;
+
+  virtual long      kind() {return ClassId; }
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.cc	(revision 108)
@@ -0,0 +1,18 @@
+#include "pimenubarmac.h"
+#include "pippmenubar.h"
+#include <LMenuBar.h>
+
+PIMenubarMac::PIMenubarMac(PIApplicationGen* par, char* nom)
+:PIMenubarGen(par, nom)
+{
+	new PIPPMenuBar();
+}
+
+PIMenubarMac::~PIMenubarMac()
+{}
+
+void
+PIMenubarMac::AppendMenu(PIPDMenu *pdm)
+{
+  LMenuBar::GetCurrentMenuBar()->InstallMenu(pdm->macMenu, InstallMenu_AtEnd);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubarmac.h	(revision 108)
@@ -0,0 +1,16 @@
+#ifndef PIMBARMAC_H_SEEN
+#define PIMBARMAC_H_SEEN
+
+#include "pimenubargen.h"
+
+class PIMenubarMac : public PIMenubarGen {
+ public:
+	            PIMenubarMac(PIApplicationGen* par, char* nom);
+	           ~PIMenubarMac();
+ virtual void	AppendMenu(PIPDMenu *pdm);
+
+};
+
+typedef PIMenubarMac   PIMenubar;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubarx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubarx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubarx.cc	(revision 108)
@@ -0,0 +1,105 @@
+#include<stdio.h>
+
+#include "pimenubarx.h"
+#include PIAPP_H
+
+#include <Xm/Xm.h>
+#include <Xm/RowColumn.h>
+#include <Xm/PushB.h>
+#include <Xm/ToggleB.h>
+#include <Xm/CascadeB.h>
+
+/************* PIMenubarX ************/
+
+#define NBITEMB  10
+
+/* --Methode-- */
+PIMenubarX::PIMenubarX(PIApplicationGen* par, char* nom)
+: PIMenubarGen(par, nom)
+{
+mNItem = 0;  mNItemMax = NBITEMB; 
+mMbb = new _pimbxit_[mNItemMax];
+
+XtWdg() = XmCreateMenuBar( ((PIApplicationX *)par)->MBCont()->XtWdg(), 
+                            nom, NULL, 0); 
+
+wmis = k_wmi_normal ;
+stmng = 0;
+
+SetPos(0,0);
+SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
+
+Manage();
+}
+
+
+/* --Methode-- */
+PIMenubarX::~PIMenubarX()
+{
+for(int i=0; i<mNItem; i++)
+  XtDestroyWidget(mMbb[i].itb);
+delete[] mMbb ;
+}
+
+/* --Methode-- */
+void PIMenubarX::AppendMenu(PIPDMenu *pdm)
+{
+_pimbxit_ *buto;
+Arg  wargs[2];
+
+if (mNItem >= mNItemMax)
+  {
+  buto = mMbb;
+  mNItemMax += NBITEMB;
+  mMbb = new _pimbxit_[mNItemMax];
+  for(int i=0; i<mNItem; i++)   mMbb[i] = buto[i];
+  delete[] buto;
+  }
+XtSetArg(wargs[0], XmNsubMenuId, pdm->XtWdg());
+mMbb[mNItem].itb = XtCreateManagedWidget(pdm->Nom().c_str(), xmCascadeButtonWidgetClass, 
+                                         this->XtWdg(), wargs, 1) ;
+mMbb[mNItem].pdm = pdm;
+mNItem++;
+
+pdm->SetMsgParent(this);
+return;
+}
+
+/* --Methode-- */
+void PIMenubarX::RemoveMenu(PIPDMenu *pdm)
+{
+int i,j;
+for(i=0; i<mNItem; i++) 
+  if ( mMbb[i].pdm == pdm ) { 
+    XtDestroyWidget(mMbb[i].itb);
+    for(j=i; j<mNItem-1; j++) mMbb[j] = mMbb[j+1]; 
+    mNItem--;  break;  
+    }
+return;
+}
+
+/* --Methode-- */
+void PIMenubarX::SetSensitivity(PIPDMenu *pdm, bool sens)
+{
+int i;
+for(i=0; i<mNItem; i++) 
+  if ( mMbb[i].pdm == pdm ) { 
+    if (sens) XtSetSensitive(mMbb[i].itb, TRUE);
+    else XtSetSensitive(mMbb[i].itb, FALSE);
+    break;  
+    }
+return;
+}
+
+/* --Methode-- */
+bool PIMenubarX::IsSensitive(PIPDMenu *pdm)
+{
+int i;
+for(i=0; i<mNItem; i++) 
+  if ( mMbb[i].pdm == pdm ) { 
+    if (XtIsSensitive(mMbb[i].itb) == TRUE)  return(true);
+    else return(false);
+    break; 
+    }
+return(false);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pimenubarx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenubarx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenubarx.h	(revision 108)
@@ -0,0 +1,32 @@
+#ifndef PIMBARX_H_SEEN
+#define PIMBARX_H_SEEN
+
+#include "pimenubargen.h"
+
+struct _pimbxit_ 
+{
+SysDWdg itb;
+PIPDMenu *pdm;
+};
+
+class PIMenubarX : public PIMenubarGen {
+ public:
+	            PIMenubarX(PIApplicationGen* par, char* nom);
+	            ~PIMenubarX();
+
+  virtual void	    AppendMenu(PIPDMenu *pdm);
+  virtual void      RemoveMenu(PIPDMenu *pdm);
+  virtual void      SetSensitivity(PIPDMenu *pdm, bool sens=true);
+  virtual bool      IsSensitive(PIPDMenu *pdm);
+
+ protected:
+
+int mNItem, mNItemMax;
+_pimbxit_ *mMbb;
+};
+
+
+typedef PIMenubarX     PIMenubar;
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimenugen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenugen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenugen.cc	(revision 108)
@@ -0,0 +1,11 @@
+#include "pimenugen.h"
+
+PIMenuGen::PIMenuGen(PIMsgHandler* par, char* nom, PIMenuType pdpu)
+: PIWdg(NULL, nom) , mMTyp(pdpu)
+{
+SetMsgParent(par);
+}
+
+PIMenuGen::~PIMenuGen()
+{}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimenugen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenugen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenugen.h	(revision 108)
@@ -0,0 +1,53 @@
+#ifndef PIMENUGEN_H_SEEN
+#define PIMENUGEN_H_SEEN
+
+#include "pisysdep.h"
+#include PIWDG_H
+
+enum PIMenuType { k_PopupMenu = 1, k_PulldownMenu = 2 };
+
+
+class PIMenuGen : public PIWdg {
+public:
+  enum {ClassId = 2500};
+
+	          PIMenuGen(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+	          ~PIMenuGen();
+				   
+  virtual void	  AppendItem(char* nom, PIMessage msg, char* sc=NULL)=0;
+  virtual void	  AppendCheckItem(char* nom, PIMessage msg, char* sc=NULL)=0;
+  virtual void	  AppendPDMenu(PIMenuGen *pdm, char* sc=NULL)=0;
+
+  virtual void    DeleteItem(char *nom)=0;
+  virtual void    DeleteItemMsg(PIMessage msg)=0;
+  virtual void    DeleteItemNum(int n)=0;
+
+  virtual void    SetSensitivity(char *nom, bool sens=true)=0; 
+  virtual void    SetSensitivityMsg(PIMessage msg, bool sens=true)=0; 
+  virtual void    SetSensitivityNum(int n, bool sens=true)=0;
+
+  virtual bool    IsSensitive(char *nom)=0;
+  virtual bool    IsSensitiveMsg(PIMessage msg)=0;
+  virtual bool    IsSensitiveNum(int n)=0;
+
+  virtual void    SetState(char *nom, bool st=false)=0; 
+  virtual void    SetStateMsg(PIMessage msg, bool st=false)=0; 
+  virtual void    SetStateNum(int n, bool st=false)=0;
+ 
+  virtual bool    GetState(char *nom)=0; 
+  virtual bool    GetStateMsg(PIMessage msg)=0; 
+  virtual bool    GetStateNum(int n)=0; 
+
+  virtual void    Show()=0;
+  virtual void    Show(PIWdg *w, int px, int py)=0;
+  virtual void    Hide()=0;
+
+  virtual long    kind() {return ClassId; }
+  virtual PIMenuType MType() { return  mMTyp; }
+
+protected:
+  PIMenuType mMTyp;
+}; 
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimenumac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenumac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenumac.cc	(revision 108)
@@ -0,0 +1,210 @@
+#include <LString.h>
+#include "pimenumac.h"
+#include <algorithm>
+
+int PIMenuMac::lastId = 1024;
+list<PIMenuMac*> PIMenuMac::sMenus;
+
+PIMenuMac::PIMenuMac(PIMsgHandler *par, char *nom, PIMenuType pdpu) 
+: PIMenuGen(par, nom, pdpu)
+{
+   macMenu = new LMenu(lastId, LStr255(nom));
+   mMenuId = lastId;
+   sMenus.push_back(this);
+   lastId++;
+}
+
+
+PIMenuMac::~PIMenuMac()
+{
+  LMenuBar::GetCurrentMenuBar()->RemoveMenu(macMenu);
+  sMenus.remove(this);
+  delete macMenu;
+}
+
+int
+PIMenuMac::FindItemByMsg(PIMessage msg)
+{
+  if (mMsgs.size() == 0) return -1;
+  int i = find(mMsgs.begin(), mMsgs.end(), msg) - mMsgs.begin();
+  return (i>=mMsgs.size()) ? -1 : i;
+}
+
+int
+PIMenuMac::FindItemByName(string const& s)
+{
+  int n = ::CountMItems(GetMacMenuHandle());
+  for (int i=0; i<n; i++)
+    if (GetMenuItemText(i) == s)
+      return i;
+  return -1;
+}
+
+
+void
+PIMenuMac::AppendItem(char* nom, PIMessage msg, char* sc)  // sc = short-cut , raccourci clavier
+{
+  LStr255 titre(nom);
+  if (titre.BeginsWith("-",1))
+    titre.Insert(" ", 1, 0);
+  if (sc) {
+    titre.Append('/');
+    titre.Append(*sc);
+  }
+  macMenu->InsertCommand(titre, -2000, 1000); // ou cmd_UseMenuItem ???
+  mMsgs.push_back(msg);
+}
+
+void
+PIMenuMac::CheckItemNum(int n, bool st)
+{
+  if (n<0 || n >= mMsgs.size()) return; // $CHECK$ exception ?
+  ::CheckItem(macMenu->GetMacMenuH(), n, st);
+}
+
+void
+PIMenuMac::CheckItemMsg(PIMessage msg, bool st)
+{
+  int i = FindItemByMsg(msg);
+  if (i>=0)
+    CheckItemNum(i, st);
+}
+
+void
+PIMenuMac::CheckItem(char* nom, bool st)
+{
+  int i = FindItemByName(nom);
+  if (i>=0)
+    CheckItemNum(i, st);
+}
+
+void
+PIMenuMac::DeleteItemNum(int n)
+{
+  if (n<0 || n >= mMsgs.size()) return; // $CHECK$ exception ?
+  macMenu->RemoveItem(n+1);
+  mMsgs.erase(mMsgs.begin()+n);
+}
+
+void
+PIMenuMac::DeleteItemMsg(PIMessage msg)
+{
+  int i = FindItemByMsg(msg);
+  if (i>=0)
+    DeleteItemNum(i);
+}
+
+void
+PIMenuMac::DeleteItem(char* nom)
+{
+  int i = FindItemByName(nom);
+  if (i>=0)
+    DeleteItemNum(i);
+}
+
+
+
+void
+PIMenuMac::ItemSelected(int item)
+{
+  if (item<0 || item >= mMsgs.size()) return; // $CHECK$ exception ?
+  Send(mMsgs[item], PIMsg_Click, (void*) GetMenuItemText(item).c_str());
+}
+
+
+void
+PIMenuMac::Show()
+{}
+
+void
+PIMenuMac::Show(PIWdg *w, int px, int py)
+{}
+
+void
+PIMenuMac::Hide()
+{}
+
+PIMenuMac*
+PIMenuMac::findMenu(int id)
+{
+  list<PIMenuMac*>::iterator i = sMenus.begin();
+  
+  while (i != sMenus.end()) {
+    if ((*i)->MenuId()==id) return *i;
+    i++;
+  }
+  
+  return NULL;
+}
+
+MenuHandle
+PIMenuMac::GetMacMenuHandle()
+{
+  return macMenu->GetMacMenuH();
+}
+
+ResIDT
+PIMenuMac::GetMacMenuID()
+{
+  return macMenu->GetMenuID();
+}
+
+
+string
+PIMenuMac::GetMenuItemText(int item)
+{
+  if (item<0 || item >= mMsgs.size()) return ""; // $CHECK$ exception ?
+  MenuHandle h = GetMacMenuHandle();
+  Str255 txt;
+  ::GetMenuItemText(h, item+1, txt);
+  p2cstr(txt);
+  return (char*) txt;
+}
+
+PIMenuMac::GetMenuItemMsg(int item)
+{
+  if (item<0 || item >= mMsgs.size()) return -1; // $CHECK$ exception ?
+  return mMsgs[item];
+}
+
+
+
+/* --Methode-- */
+PIPUMenuMac::PIPUMenuMac(PIMsgHandler* par, char* nom)
+: PIMenuMac(par, nom, k_PopupMenu)
+{
+}
+
+/* --Methode-- */
+PIPUMenuMac::~PIPUMenuMac()
+{
+}
+
+void
+PIPUMenuMac::Show()
+{
+  Point pt;
+  ::GetMouse(&pt);
+  ::LocalToGlobal(&pt);
+  int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),pt.v,pt.h,1);
+  ItemSelected(item);
+}
+
+void
+PIPUMenuMac::Show(PIWdg *w, int px, int py)
+{
+  int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),py,px,1);
+  ItemSelected(item);
+}
+
+/* --Methode-- */
+PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom)
+: PIMenuMac(par, nom, k_PulldownMenu)
+{
+}
+
+/* --Methode-- */
+PIPDMenuMac::~PIPDMenuMac()
+{
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimenumac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenumac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenumac.h	(revision 108)
@@ -0,0 +1,79 @@
+#ifndef PIMENUMAC_H_SEEN
+#define PIMENUMAC_H_SEEN
+
+#include "pimenugen.h"
+#include <LMenu.h>
+#include <vector>
+#include <list>
+
+// Menu general
+class PIMenuMac : public PIMenuGen {
+public:
+					PIMenuMac(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+				   ~PIMenuMac();
+				   
+    virtual void    AppendItem(char* nom, PIMessage msg, char* sc=NULL);
+
+    virtual void    DeleteItem(char *nom);
+    virtual void    DeleteItemMsg(PIMessage msg);
+    virtual void    DeleteItemNum(int n);
+
+    virtual void    CheckItem(char *nom, bool st=false); 
+    virtual void    CheckItemMsg(PIMessage msg, bool st=false); 
+    virtual void    CheckItemNum(int n, bool st=false); 
+	
+    virtual void    Show();
+    virtual void    Show(PIWdg *w, int px, int py);
+
+    virtual void    Hide();
+    
+    int             MenuId() {return mMenuId;}
+    void            ItemSelected(int item);
+    
+	string          GetMenuItemText(int item);
+	int             GetMenuItemMsg(int item);
+	int             FindItemByMsg(PIMessage msg);
+	int             FindItemByName(string const& nom);
+	
+protected:
+	static PIMenuMac* findMenu(int id);
+	LMenu*          macMenu;
+	int             mMenuId;
+	vector<PIMessage>    mMsgs;
+	static int      lastId;
+	static list<PIMenuMac*> sMenus;
+	
+	friend class    PIMenubarMac;
+	friend class    PIOptMenuMac;
+	friend class    PIPPOptMenu;
+	friend class    PIPPMenuBar;
+	MenuHandle      GetMacMenuHandle();
+	ResIDT          GetMacMenuID();
+	
+   
+};
+
+// Menu popup
+class PIPUMenuMac : public PIMenuMac
+{
+public:
+               PIPUMenuMac(PIMsgHandler* par, char* nom);
+               ~PIPUMenuMac();
+virtual void   Show();
+virtual void   Show(PIWdg *w, int px, int py);
+};
+
+// Menu pull-down
+class PIPDMenuMac : public PIMenuMac
+{
+public:
+               PIPDMenuMac(PIMsgHandler* par, char* nom);
+               ~PIPDMenuMac();
+};
+
+
+typedef PIMenuMac      PIMenu;
+typedef PIPUMenuMac    PIPUMenu;
+typedef PIPDMenuMac    PIPDMenu;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimenux.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenux.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenux.cc	(revision 108)
@@ -0,0 +1,496 @@
+#include<stdio.h>
+#include<iostream.h>
+
+#include "pimenux.h"
+
+#include <Xm/Xm.h>
+#include <Xm/RowColumn.h>
+#include <Xm/PushB.h>
+#include <Xm/ToggleB.h>
+#include <Xm/CascadeB.h>
+
+/************* PIMenuX ************/
+
+// Quand on cree les menus comme fils du Top-Widget, ca rentre en 
+// conflit avec certaains Window-Manager ...
+// La fonction suivante permet de bypasser ce probleme- Le createur d'application
+// X doit donc appeler la fonction ci-dessous pour initialiser menuXTopWdg
+//                                               Reza 4/11/97
+static SysDWdg menuXTopWdg = NULL;
+void SetTopWdgForMenuX(SysDWdg mtw) {
+  menuXTopWdg = mtw;
+}
+
+// Pour ces sal... de XmString  (ds piwdgx.cc)
+int CStrFrXmStr(XmString xms, char* buff, int nmx);
+
+
+// Fonction prive (CallBack)
+static void menu_action(Widget w, XtPointer usd, XtPointer calld);
+static void menu_toggle_action(Widget w, XtPointer usd, XmToggleButtonCallbackStruct* calld);
+
+/* Nouvelle-Fonction */
+void  menu_action(Widget /*w*/, XtPointer usd, XtPointer /*calld*/)
+{
+PIMenuX *pim;
+_pimxit_ *cusd;
+
+cusd = ( _pimxit_ *)usd ;
+pim = (PIMenuX *) (cusd->pmen);
+// pim->Hide();
+pim->Send(cusd->msg, PIMsg_Click );
+#ifdef DEBUG_PIMenuX
+printf("%%%Debug_menu_action: Msg= %d  %lx\n", (int)cusd->msg, (long)pim);
+#endif
+return;
+}
+
+// Variable globale pour Toggle Item's  Send(..., ..., data); 
+static bool toggmenbut = false;
+
+/* Nouvelle-Fonction */
+void  menu_toggle_action(Widget /*w*/, XtPointer usd, XmToggleButtonCallbackStruct* calld)
+{
+PIMenuX *pim;
+_pimxit_ *cusd;
+
+cusd = ( _pimxit_ *)usd ;
+pim = (PIMenuX *) (cusd->pmen);
+if (calld->set == True)  cusd->togstate = toggmenbut = true;
+else  cusd->togstate = toggmenbut = false;
+pim->Send(cusd->msg, PIMsg_DataChanged, (void *)(&toggmenbut));
+return;
+}
+
+
+
+#define NBITEMB  10
+
+/* --Methode-- */
+PIMenuX::PIMenuX(PIMsgHandler *par, char *nom, PIMenuType pdpu) 
+: PIMenuGen(par, nom, pdpu)
+{
+mNItem = 0;  mNItemMax = NBITEMB; 
+mBut = new _pimxit_[mNItemMax];
+
+SysDWdg tw= menuXTopWdg;
+if (tw == NULL) tw = PIXtTopWdg();
+
+if (pdpu == k_PopupMenu)
+  XtWdg() = XmCreatePopupMenu( tw, nom, NULL, 0); 
+else 
+  XtWdg() = XmCreatePulldownMenu( tw, nom, NULL, 0); 
+
+wmis = k_wmi_normal ;
+stmng = 0;
+}
+
+/* --Methode-- */
+PIMenuX::~PIMenuX()
+{
+for(int i=0; i<mNItem; i++)
+  XtDestroyWidget(mBut[i].itb);
+delete[] mBut ;
+}
+
+
+/* --Methode-- */
+void PIMenuX::AppendItem(char* nom, PIMessage msg, char* sc)
+{
+AddItem(nom, msg, 0, sc, NULL);
+}
+
+/* --Methode-- */
+void PIMenuX::AppendCheckItem(char* nom, PIMessage msg, char* sc)
+{
+AddItem(nom, msg, 1, sc, NULL);
+}
+
+/* --Methode-- */
+void PIMenuX::AppendPDMenu(PIMenuGen *pdm, char* sc)
+{
+if (pdm->MType() !=  k_PulldownMenu) {
+  cerr << "PIMenuX::AppendPDMenu()/Erreur: PullDownMenu PIPDMenu seulement ... " << endl;
+  return;
+  }
+AddItem(NULL, pdm->Msg(), 2, sc, (PIMenuX*)pdm);
+}
+
+/* --Methode-- */
+void PIMenuX::DeleteItem(char *nom)
+{
+DeleteItemNum(GetNumItem(nom));
+}
+
+/* --Methode-- */
+void PIMenuX::DeleteItemMsg(PIMessage msg)
+{
+DeleteItemNum(GetNumItemMsg(msg));
+}
+
+/* --Methode-- */
+void PIMenuX::SetSensitivity(char *nom, bool sens)
+{
+SetSensitivityNum(GetNumItem(nom), sens);
+}
+
+/* --Methode-- */
+void PIMenuX::SetSensitivityMsg(PIMessage msg, bool sens)
+{
+SetSensitivityNum(GetNumItemMsg(msg), sens);
+}
+
+/* --Methode-- */
+bool PIMenuX::IsSensitive(char *nom)
+{
+return(IsSensitiveNum(GetNumItem(nom)) );
+}
+
+/* --Methode-- */
+bool PIMenuX::IsSensitiveMsg(PIMessage msg)
+{
+return(IsSensitiveNum(GetNumItemMsg(msg)) ); 
+}
+
+/* --Methode-- */
+bool PIMenuX::IsSensitiveNum(int n)
+{
+if ((n < 0) || (n >= mNItem))  return(false);
+if (XtIsSensitive(mBut[n].itb) == TRUE)  return(true);
+else return(false);
+}
+
+/* --Methode-- */
+void PIMenuX::SetSensitivityNum(int n, bool sens)
+{
+if ((n < 0) || (n >= mNItem))  return;
+if (sens) XtSetSensitive(mBut[n].itb, TRUE);
+else XtSetSensitive(mBut[n].itb, FALSE);
+}
+
+/* --Methode-- */
+void PIMenuX::DeleteItemNum(int n)
+{
+if ((n < 0) || (n >= mNItem))  return;
+XtDestroyWidget(mBut[n].itb);
+for(int i=n; i<mNItem-1; i++)
+  {
+  String cbckn;
+  XtCallbackProc cbproc;
+  if (mBut[i+1].toggpdm < 2) {
+    if (mBut[i+1].toggpdm == 1)    // ToggleItem 
+      { cbckn = XmNvalueChangedCallback;  cbproc = (XtCallbackProc)menu_toggle_action; }
+    else { cbckn = XmNactivateCallback;  cbproc = menu_action; }
+
+    XtRemoveCallback(mBut[i+1].itb, cbckn, cbproc, (XtPointer)(mBut+i+1));
+    mBut[i] = mBut[i+1];
+    XtAddCallback(mBut[i].itb, cbckn, cbproc, (XtPointer)(mBut+i));
+    }
+  else mBut[i] = mBut[i+1]; 
+  }
+mNItem--;
+}
+
+
+/* --Methode-- */
+void PIMenuX::SetState(char *nom, bool st)
+{
+SetStateNum(GetNumItem(nom), st);
+}
+
+/* --Methode-- */
+void PIMenuX::SetStateMsg(PIMessage msg, bool st)
+{
+SetStateNum(GetNumItemMsg(msg), st);
+}
+
+/* --Methode-- */
+void PIMenuX::SetStateNum(int n, bool st)
+{
+if ((n < 0) || (n >= mNItem))  return;
+if (mBut[n].toggpdm != 1 ) return;  // Pas un toggle-item
+Arg warg[2];
+if (st) XtSetArg(warg[0],XmNset, True);
+else XtSetArg(warg[0],XmNset, False);
+XtSetValues(mBut[n].itb, warg, 1);
+mBut[n].togstate = st;
+return;
+}
+
+/* --Methode-- */
+bool PIMenuX::GetState(char *nom)
+{
+return( GetStateNum(GetNumItem(nom)) );
+}
+
+/* --Methode-- */
+bool PIMenuX::GetStateMsg(PIMessage msg)
+{
+return( GetStateNum(GetNumItemMsg(msg)) );
+}
+
+/* --Methode-- */
+bool PIMenuX::GetStateNum(int n) 
+{
+if ((n < 0) || (n >= mNItem))  return(false);
+if (mBut[n].toggpdm != 1 ) return(false); 
+return(mBut[n].togstate); 
+}
+
+
+/* --Methode-- */
+void PIMenuX::Show()
+{
+Manage();
+}
+
+/* --Methode-- */
+void PIMenuX::Show(PIWdg* /*w*/, int /*px*/, int /*py*/)
+{
+Manage();
+}
+
+
+/* --Methode-- */
+void PIMenuX::Hide()
+{
+// UnManage();
+}
+
+
+
+/* --Methode-- */
+char* PIMenuX::ItemName(int n)
+{
+if ( (n < 0) || (n >= mNItem))  { mSItem[0] = '\0'; return(mSItem); }
+else return (ItemNameWdg(mBut[n].itb));
+}
+
+
+/* --Methode-- */
+char* PIMenuX::ItemNameWdg(SysDWdg itw)
+{
+XmString xmstr;
+Arg warg[2];
+
+XtSetArg(warg[0], XmNlabelString, &xmstr);
+XtGetValues(itw, warg, 1);
+if (xmstr)
+  {
+  CStrFrXmStr(xmstr, mSItem, 96);
+  XmStringFree(xmstr);
+  }
+else mSItem[0] = '\0';
+
+return(mSItem);
+}
+
+
+/* --Methode-- */
+PIMessage PIMenuX::ItemMsg(int n)
+{
+if ( (n < 0) || (n >= mNItem))  return(0);
+else return(mBut[n].msg);
+}
+
+
+
+/* --Methode-- */
+int PIMenuX::GetNumItem(char *nom)
+{
+
+for(int i=0; i<mNItem; i++)
+  if (strcmp(ItemName(i),nom) == 0)  return(i);
+return(-1);
+}
+
+/* --Methode-- */
+int PIMenuX::GetNumItemMsg(PIMessage msg)
+{
+for(int i=0; i<mNItem; i++)
+  if (mBut[i].msg == msg)   return(i);  
+return(-1);
+}
+
+/* --Methode-- */
+SysDWdg PIMenuX::GetItemWdg(int n)
+{
+if ((n<0) || (n>=mNItem))  return(NULL);
+else return(mBut[n].itb);
+}
+
+
+/* --Methode-- */
+void PIMenuX::AddItem(const char* nom, PIMessage msg, int tog, char* sc, PIMenuX *pdm)
+{
+_pimxit_ *buto;
+SysDWdgClass wdgcl;
+String cbckn;
+XtCallbackProc cbproc;
+Arg  warg[2];
+int n=0;
+
+
+if (mNItem >= mNItemMax)  {
+  buto = mBut;
+  mNItemMax += NBITEMB;
+  mBut = new _pimxit_[mNItemMax];
+  for(int i=0; i<mNItem; i++)    {
+    if (buto[i].toggpdm < 2) {  // Pas de Cascade Menu
+      if (buto[i].toggpdm == 1)  // ToggleItem
+        { cbckn = XmNvalueChangedCallback;  cbproc = (XtCallbackProc)menu_toggle_action; }
+      else { cbckn = XmNactivateCallback;  cbproc = menu_action; }
+      XtRemoveCallback(buto[i].itb, cbckn, cbproc, (XtPointer)(buto+i));
+      mBut[i] = buto[i];
+      XtAddCallback(mBut[i].itb, cbckn, cbproc, (XtPointer)(mBut+i));
+      }
+    else mBut[i] = buto[i]; 
+    }
+  delete[] buto;
+  }
+
+if (tog < 2) {  // Pas de Cascade Menu
+  if (tog == 1) {   // Toggle-Item 
+    cbckn = XmNvalueChangedCallback;  cbproc = (XtCallbackProc)menu_toggle_action;
+    wdgcl = xmToggleButtonWidgetClass;  
+    XtSetArg(warg[0],XmNset, False); n = 1; }
+  else {
+    cbckn = XmNactivateCallback;  cbproc = menu_action;
+    wdgcl = xmPushButtonWidgetClass;  n = 0; }
+
+  mBut[mNItem].itb = XtCreateManagedWidget(nom, wdgcl, this->XtWdg(), warg, n) ; 
+  XtAddCallback(mBut[mNItem].itb, cbckn, cbproc, (XtPointer)(mBut+mNItem));
+  }
+else {    // Creation Cascade-Menu
+  XtSetArg(warg[0], XmNsubMenuId, pdm->XtWdg());
+  mBut[mNItem].itb = XtCreateManagedWidget(pdm->Nom().c_str(), xmCascadeButtonWidgetClass, 
+                                           XtWdg(), warg, 1) ;
+  pdm->SetMsgParent(this);
+  }
+
+if (sc)  // Raccourci clavier 
+  {
+  char acc[16];
+  XmString xmstr;
+
+  sprintf(acc,"Ctrl/%c", sc[0]);
+  xmstr = XmStringLtoRCreate(acc, XmSTRING_DEFAULT_CHARSET);
+  XtSetArg(warg[n], XmNacceleratorText, xmstr); n++;
+  sprintf(acc,"Ctrl<Key>%c", sc[0]);
+  XtSetArg(warg[n], XmNaccelerator, acc); n++;
+  XtSetValues(mBut[mNItem].itb, warg, n);  
+  XmStringFree(xmstr);
+  }
+
+#ifdef DEBUG_PIMenuX
+printf("DBG>> %d (%d) %lx \n", mNItem, mNItemMax, (long)(mBut+mNItem));
+#endif
+mBut[mNItem].pmen = this;
+mBut[mNItem].msg = msg;
+mBut[mNItem].toggpdm = tog;
+mBut[mNItem].togstate = false;
+mNItem++;
+return;
+}
+
+
+
+/* --Methode-- 
+void PIMenuX::Check()
+{
+printf("#Debug_CHECK: %d %d %d %d \n",XSize(), YSize(), XPos(), YPos() );  
+for(int i=0; i<mNItem; i++)
+  printf("##Debug_CHECK: %d %d %ld %lx %lx %lx \n", i, (int)mBut[i].toggpdm, 
+         (long) mBut[i].msg, (long) mBut[i].itb, 
+         (long) mBut[i].pmen, long (mBut+i));
+return;
+}
+*/
+
+
+
+/* --Methode-- */
+PIPUMenuX::PIPUMenuX(PIMsgHandler* par, char* nom)
+: PIMenuX(par, nom, k_PopupMenu)
+{
+}
+
+/* --Methode-- */
+PIPUMenuX::~PIPUMenuX()
+{
+}
+
+void PIPUMenuX::Show()
+{
+// XEvent  mevt;
+XButtonEvent evt;
+
+// XPeekEvent(PIXDisplay(), &mevt);
+// evt = mevt.xbutton; 
+evt.type = ButtonPress;
+evt.display = PIXDisplay();
+evt.window = XtWindow(PIXtTopWdg());
+evt.root = DefaultRootWindow(evt.display);
+evt.serial = PIXGetLastEventSerial(); 
+evt.time = PIXGetLastEventTime();
+evt.send_event = False;
+evt.same_screen = XQueryPointer(evt.display, evt.window, &(evt.root), 
+                    &(evt.subwindow), &(evt.x_root), &(evt.y_root), 
+                    &(evt.x), &(evt.y), &(evt.state));
+ 
+#ifdef DEBUG_PIMenuX
+printf("XXDbg_Show : %d %d %d - %d %d \n", (int)evt.same_screen, 
+       (int)evt.x_root, (int)evt.y_root, (int)evt.x, (int)evt.y);
+#endif
+
+if (evt.same_screen) XmMenuPosition(XtWdg(), &evt);
+Manage();     
+}
+
+/* --Methode-- */
+void PIPUMenuX::Show(PIWdg *w, int px, int py)
+{
+// This method should only be used by a button press ...
+int xr, yr;
+Window cw, sw, rw;
+SysDWdg xtw;
+Display *dsp;
+XButtonEvent evt;
+
+xtw =  w->XtWdg();
+dsp = XtDisplay(xtw);
+sw = XtWindow(xtw);
+rw = DefaultRootWindow(dsp);
+XTranslateCoordinates(dsp, sw, rw, px, py, &xr, &yr, &cw);
+
+evt.type = ButtonPress;
+evt.display = dsp;
+evt.window = sw;
+evt.root = rw;
+evt.x_root = xr;
+evt.y_root = yr; 
+evt.x = px;
+evt.y = py;
+evt.serial = PIXGetLastEventSerial(); 
+evt.time = PIXGetLastEventTime();
+evt.send_event = False;
+evt.same_screen = True;
+XmMenuPosition(XtWdg(), &evt);
+// SetPos(xr, yr);
+Manage();
+return;    
+}
+
+
+/* --Methode-- */
+PIPDMenuX::PIPDMenuX(PIMsgHandler* par, char* nom)
+: PIMenuX(par, nom, k_PulldownMenu)
+{
+}
+
+/* --Methode-- */
+PIPDMenuX::~PIPDMenuX()
+{
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimenux.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimenux.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimenux.h	(revision 108)
@@ -0,0 +1,98 @@
+#ifndef PIMENUX_H_SEEN
+#define PIMENUX_H_SEEN
+
+#include "pimenugen.h"
+
+
+class PIMenuX ;
+
+struct _pimxit_ 
+{
+SysDWdg itb;
+PIMenuX *pmen;
+PIMessage msg;
+int toggpdm;      // 0= Normal Item, 1, Toggle Item,  2= PDMenu
+bool togstate;    // true , false pour toggle items  
+};
+
+
+
+class PIMenuX : public PIMenuGen {
+public:
+	          PIMenuX(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+	          ~PIMenuX();
+				   
+  virtual void	  AppendItem(char* nom, PIMessage msg, char* sc=NULL);
+  virtual void	  AppendCheckItem(char* nom, PIMessage msg, char* sc=NULL);
+  virtual void	  AppendPDMenu(PIMenuGen *pdm, char* sc=NULL);
+
+  virtual void    DeleteItem(char *nom);
+  virtual void    DeleteItemMsg(PIMessage msg);
+  virtual void    DeleteItemNum(int n);
+
+  virtual void    SetSensitivity(char *nom, bool sens=true); 
+  virtual void    SetSensitivityMsg(PIMessage msg, bool sens=true); 
+  virtual void    SetSensitivityNum(int n, bool sens=true);
+
+  virtual bool    IsSensitive(char *nom);
+  virtual bool    IsSensitiveMsg(PIMessage msg);
+  virtual bool    IsSensitiveNum(int n);
+
+  virtual void    SetState(char *nom, bool st=false); 
+  virtual void    SetStateMsg(PIMessage msg, bool st=false); 
+  virtual void    SetStateNum(int n, bool st=false);
+ 
+  virtual bool    GetState(char *nom); 
+  virtual bool    GetStateMsg(PIMessage msg); 
+  virtual bool    GetStateNum(int n); 
+
+  virtual void    Show();
+  virtual void    Show(PIWdg *w, int px, int py);
+  virtual void    Hide();
+
+// Pour usage prive et par OptionMenu, ...
+  PIMessage       ItemMsg(int n);
+  int             GetNumItem(char *nom);
+  int             GetNumItemMsg(PIMessage msg);
+  SysDWdg         GetItemWdg(int n);
+  char*           ItemName(int n);
+  char*           ItemNameWdg(SysDWdg itw);
+
+protected:
+        void      AddItem(const char* nom, PIMessage msg, int tog, char* sc, PIMenuX *pdm);
+
+int mNItem, mNItemMax;
+_pimxit_  * mBut;
+char mSItem[96];
+};
+
+class PIPUMenuX : public PIMenuX
+{
+public:
+                 PIPUMenuX(PIMsgHandler* par, char* nom);
+                 ~PIPUMenuX();
+
+  virtual void   Show();
+  virtual void   Show(PIWdg *w, int px, int py);
+
+protected:
+     
+};
+
+class PIPDMenuX : public PIMenuX
+{
+public:
+                 PIPDMenuX(PIMsgHandler* par, char* nom);
+                 ~PIPDMenuX();
+
+protected:
+     
+};
+
+typedef PIMenuX        PIMenu;
+typedef PIPUMenuX      PIPUMenu;
+typedef PIPDMenuX      PIPDMenu;
+
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimgadapter.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimgadapter.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimgadapter.h	(revision 108)
@@ -0,0 +1,36 @@
+#ifndef PIMGADAPTER_SEEN
+#define PIMGADAPTER_SEEN
+
+#include "cimage.h"
+#include "parradapter.h"
+
+class RzImageAdapter : public P2DArrayAdapter {
+public:
+                  RzImageAdapter(RzImage* rzi, bool ad=false) :
+                    P2DArrayAdapter(rzi->XSize(), rzi->YSize())
+                    { aDel = ad; mImg = rzi; }
+
+  virtual 	  ~RzImageAdapter() { if (aDel) delete mImg; }
+  virtual float   Value(int ix, int iy) { return mImg->FValue(ix, iy); }
+
+protected :
+  bool aDel;
+  RzImage* mImg;
+};
+
+template <class T> 
+class ImageAdapter : public P2DArrayAdapter {
+public:
+                  ImageAdapter(Image<T>* img, bool ad=false) :
+                    P2DArrayAdapter(img->XSize(), img->YSize())
+                    { aDel = ad; mImg = img; }
+
+  virtual 	  ~ImageAdapter() { if (aDel) delete mImg; }
+  virtual float   Value(int ix, int iy) { return((*mImg)(ix, iy)); }
+
+protected :
+  bool aDel;
+  Image<T>* mImg;
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimsghandler.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimsghandler.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimsghandler.cc	(revision 108)
@@ -0,0 +1,97 @@
+//  Classe de gestionnaire de message pour programme graphique interactive
+//
+//                  E.Aubourg , R. Ansari  01-06/96
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "pimsghandler.h"
+
+//++
+// Class	PIMsgHandler
+// Lib		PI
+// include	pimsghandler.h
+//
+//   	Classe de gestionnaire de message de Peida Interactive (PI)
+//	Les message ("PIMessage") sont des entiers non signés
+//	("unsigned long"). 
+//	Chaque PIMsgHandler se trouve dans une organisation 
+//	hiérarchique où il dépend d'un
+//	PIMsgHandler père à qui il reporte les messages, et peut
+//	avoir lui-même un ou plusieurs PIMsgHandler qui sont sous sa 
+//	dépendance. Un message ("PIMessage") est constitué de deux 
+//	parties, une partie à la disposition de l'utilisateur ("UserMsg()")
+//	et une partie sous contrôle du code PI ("ModMsg()"), 
+//	qui peut spécifie si nécéssaire la raison de déclenchement 
+//	d'envoi du message. 
+//--
+
+//++
+// Titre	Constructeur
+//--
+//++
+// PIMsgHandler(PIMsgHandler* par=NULL)
+//	Création d'un PIMsgHandler dépendant hiérarchiquement du parent "par"
+//--
+
+PIMsgHandler::PIMsgHandler(PIMsgHandler* par)
+: msgParent(par)
+{}
+
+PIMsgHandler::~PIMsgHandler()
+{}
+
+
+//++
+// Titre	Traitement des messages
+//--
+
+//++
+// PIMessage  UserMsg(PIMessage msg)
+//	Décode et renvoie la partie utilisateur d'un PIMessage
+// PIMessage  ModMsg(PIMessage msg)
+//	Décode et renvoie la partie *modifier* d'un PIMessage
+// PIMessage  BuildMsg(PIMessage um, PIMsgMod mm) 
+//	Code les deux parties (user "um", modifier "mm") d'un message
+//	dans un PIMessage.
+// void  SetMsgParent(PIMsgHandler* par)
+//	Modifie l'organisation hiérarchique, en assignant un nouveau père.
+// void	 Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL)
+//	Cette méthode virtuelle est appelée quand un message "msg"
+//	est reçue par l'objet gestionnaire. "sender" est l'expéditeur
+//	du message, et "data" est un argument optionnel supplémentaire.
+//	La signification et contenu de "data" dépend de l'expéditeur
+//	et du contexte. Par défaut, la méthode "Process(...)" renvoie
+//	le message au PIMsgHandler père, sans altérer l'identité
+//	de l'expéditeur. (méthode "ReSend(...)"). C'est une méthode 
+//	non public (protected) destinée être redéfinie par les classes
+//	héritières.
+// void  Send(PIMessage msg, PIMsgMod mm=0, void* data=NULL)
+//	Envoie le message "msg" avec le modifier "mm", et l'argument 
+//	optionnel "data" au parent, déclenchant ainsi l'execution
+//	de la méthode "Process(...)" du père.
+//--
+
+void
+PIMsgHandler::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+	ReSend(msg, sender, data);
+}
+
+void
+PIMsgHandler::Send(PIMessage msg, PIMsgMod mm,  void* data)
+{
+//	Process(msg, this, data);  $CHECK$  Reza 12/06/96
+// Send par defaut appelle le process du parent $CHECK$
+if (msgParent)
+  msgParent->Process(BuildMsg(msg, mm), this, data);
+
+}
+
+void
+PIMsgHandler::ReSend(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+  if (msgParent)
+    msgParent->Process(msg, sender, data);
+}
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pimsghandler.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimsghandler.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimsghandler.h	(revision 108)
@@ -0,0 +1,63 @@
+#ifndef PIMSGHANDLER_H_SEEN
+#define PIMSGHANDLER_H_SEEN
+
+/* Classe de gestion de messages */
+
+#include <stdlib.h>
+
+enum {
+ // Les messages reserves systeme (PI)   les 8 premiers bits
+ // Messages user, les bits restants
+	PIMsg_Active        = 1,
+        PIMsg_Close         = 2,
+        PIMsg_Resize        = 3,
+        PIMsg_ResizeRequest = 4,
+
+	PIMsg_Click         = 21,
+        PIMsg_Press         = 22,
+        PIMsg_Release       = 23,
+        PIMsg_Drag          = 24,
+        PIMsg_Drop          = 25,
+        PIMsg_Copy          = 26,
+        PIMsg_Paste         = 27,
+        PIMsg_Cut           = 28,
+
+	PIMsg_OK            = 21,
+	PIMsg_Cancel        = 22,
+	PIMsg_Help          = 23,
+
+	PIMsg_DataChanged   = 31,
+        PIMsg_Select        = 32,
+        PIMsg_ClearSel      = 33
+
+};
+
+
+// Definition de type pour les messages - Il est peu probable que le typedef change ...
+//                                      Reza 17/10/96
+typedef unsigned long PIMessage;
+typedef unsigned char PIMsgMod;
+
+class PIMsgHandler {
+public:
+			     PIMsgHandler(PIMsgHandler* par=NULL);
+	virtual 	     ~PIMsgHandler();
+	
+	virtual void	     SetMsgParent(PIMsgHandler* par) {msgParent = par;}
+
+	virtual void         Send(PIMessage msg, PIMsgMod mm=0, void* data=NULL);
+
+        inline  PIMessage    UserMsg(PIMessage msg) { return (msg >> 8); }
+        inline  PIMessage    ModMsg(PIMessage msg) { return (msg & 0xFF); }
+	inline  PIMessage    BuildMsg(PIMessage um, PIMsgMod mm) 
+                        	  { return ((um << 8) | mm); }
+
+protected:
+	virtual void	ReSend(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+	virtual void	Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+private:
+	PIMsgHandler*     msgParent;
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pimsgmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pimsgmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pimsgmac.h	(revision 108)
@@ -0,0 +1,8 @@
+#include <PP_Types.h>
+
+const MessageT msg_Btn1    msg_Click;
+const MessageT msg_Btn2    10001;
+const MessageT msg_Btn3    10002;
+const MessageT msg_Move1   10003;
+const MessageT msg_Move2   10004;
+const MessageT msg_Move3   10005;
Index: /branches/EA_Juin98/SophyaPI/PI/pintuple.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pintuple.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pintuple.cc	(revision 108)
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include "pintuple.h"
+
+ 
+/* --Methode-- */
+PINTuple::PINTuple(NTuple* nt, bool ad)
+: PIDrawer()
+{
+  mNT = nt;
+  mAdDO = ad; 
+  SelectXY(NULL, NULL);
+  SelectErrBar();
+}
+
+PINTuple::~PINTuple()
+{
+  if (mAdDO && mNT)  delete mNT;
+}
+
+/* --Methode-- */
+void  PINTuple::SelectXY(char* px, char* py)
+{
+if (mNT == NULL)  xK = yK = -1;
+if (px == NULL) xK = -1;
+else xK = mNT->IndexNom(px);
+if (py == NULL) yK = -1;
+else yK = mNT->IndexNom(py);
+}
+
+/* --Methode-- */
+void  PINTuple::SelectErrBar(char* erbx, char* erby)
+{
+if (mNT == NULL)  xebK = yebK = -1;
+if (erbx == NULL) xebK = -1;
+else xebK = mNT->IndexNom(erbx);
+if (erby == NULL) yebK = -1;
+else yebK = mNT->IndexNom(erby);
+}
+
+
+/* --Methode-- */
+void PINTuple::UpdateSize()
+{
+  if (!mNT) return;
+  if (mNT->NEntry() <= 0)  return;
+  if ( (xK < 0) || (yK < 0) )   return;
+
+  // Commencer par trouver nos limites
+  float dx, dy;
+  float xmin, xmax, ymin, ymax;
+  xmin = ymin = 9.e19;
+  xmax = ymax = -9.e19;
+  mNT->GetMinMax(xK, xmin, xmax);
+  mNT->GetMinMax(yK, ymin, ymax);
+    
+  dx = 0.02*(xmax-xmin);
+  dy = 0.02*(ymax-ymin);
+  
+  SetLimits(xmin-dx, xmax+dx, ymin-dy, ymax+dy);
+  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+}
+
+
+/* --Methode-- */
+void PINTuple::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
+{
+float xp,yp,xer,yer;
+char buff[128];
+int nok;
+
+if (!mNT) return;
+if ( (xK < 0) || (yK < 0) )  return;
+
+nok = 0;  
+for (int i=0; i<mNT->NEntry(); i++) {
+  xp = mNT->GetVal(i, xK);
+  yp = mNT->GetVal(i, yK);
+  if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
+  nok++;
+  g->DrawMarker(xp, yp); 
+  if ( xebK >= 0 ) {
+    xer = mNT->GetVal(i, xebK);
+    g->DrawLine(xp-xer, yp, xp+xer, yp);
+  }
+  if ( yebK >= 0 ) {
+    yer = mNT->GetVal(i, yebK);
+    g->DrawLine(xp, yp-yer, xp, yp+yer);
+  }
+}
+
+/*
+sprintf(buff, "NTuple:  NEntry= %d  NDisp= %d", (int)mNT->NEntry(), nok);
+g->BaseGraphic()->DrawString(15,15,buff);
+*/
+return;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pintuple.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pintuple.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pintuple.h	(revision 108)
@@ -0,0 +1,31 @@
+#ifndef PINTUPLE_H
+#define PINTUPLE_H
+
+#include "ntuple.h"
+#include "piscdrawwdg.h"
+
+class PINTuple : public PIDrawer {
+public:
+                     PINTuple(NTuple* nt, bool ad);
+  virtual           ~PINTuple();
+  
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+  virtual void       UpdateSize();
+  
+          void       SelectXY(char* px, char* py);
+          void       SelectErrBar(char* erbx=NULL, char* erby=NULL);
+
+       
+protected:
+  NTuple* mNT;
+  bool mAdDO;
+  int xK, yK;          // Index du nom de variable en X/Y ds le ntuple
+  int xebK, yebK;      // Index du nom de variable en ErrBarX/Y ds le ntuple
+
+};
+
+#endif
+
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.cc	(revision 108)
@@ -0,0 +1,13 @@
+#include "pioptmenugen.h"
+
+
+PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm, 
+                         int sx, int sy, int px, int py)
+: PIContainer(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !
+{
+}
+
+PIOptMenuGen::~PIOptMenuGen()
+{}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenugen.h	(revision 108)
@@ -0,0 +1,28 @@
+#ifndef PIOPTMENGEN_H_SEEN
+#define PIOPTMENGEN_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include PICONT_H
+#include PIMENU_H
+
+class PIOptMenuGen : public PIContainer {
+public:
+  enum {ClassId = 1100};
+
+	             PIOptMenuGen(PIContainerGen* par, PIPUMenu *pdm,
+                                  int sx=10, int sy=10, int px=0, int py=0);
+	             ~PIOptMenuGen();
+				   
+  virtual long       kind() {return ClassId; }
+
+  virtual string     GetValueStr() = 0;    // Option choisie
+  virtual PIMessage  GetValue() = 0;       // Message correspondant a l'option choisie
+  virtual void       SetValueStr(string & s) = 0;
+  virtual void       SetValue(PIMessage msg) = 0;
+
+protected:
+
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.cc	(revision 108)
@@ -0,0 +1,90 @@
+#include "pioptmenumac.h"
+#include "pippoptmenu.h"
+
+/* --Methode-- */
+PIOptMenuMac::PIOptMenuMac(PIContainerGen* par, PIPUMenu *pdm,
+                     int sx, int sy, int px, int py)
+: PIOptMenuGen(par, pdm, sx, sy, px, py), mPUMenu(pdm)
+{
+  delete mPane;
+  //LStr255 titre(Nom().c_str());
+  LStr255 titre("");
+  
+  StTextState textState;
+  ::TextFont(systemFont);
+  ::TextSize(12);
+  ::TextFace(0);
+  int titleWidth = ::StringWidth(titre);
+  
+  //mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
+  mPane = new PIPPOptMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
+  //macMenu = ((LStdPopupMenu*)mPane)->GetMacMenuH();
+  
+  // On va changer la resource de menu au passage...
+//  InsertMenu(pdm->GetMacMenuHandle(), hierMenu);
+//  PopupPrivateDataHandle	dataH =
+////		(PopupPrivateDataHandle) (**((LStdPopupMenu*)mPane)->GetMacControl()).contrlData;
+//  (**dataH).mHandle = pdm->GetMacMenuHandle();
+//  (**dataH).mID = pdm->GetMacMenuID();
+  
+  ((PIPPOptMenu*)mPane)->SetMenu(pdm);
+  ((LStdPopupMenu*)mPane)->AddListener(this);
+  
+  Manage();
+}
+
+/* --Methode-- */
+PIOptMenuMac::~PIOptMenuMac()
+{
+}
+
+/* --Methode-- */
+void PIOptMenuMac::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+Select((char *)data, UserMsg(msg));  //  Reza 17/10/96 $CHECK$ ???
+ReSend(msg, sender, data);
+}
+
+void
+PIOptMenuMac::ListenToMessage(MessageT /*inMessage*/, void *)
+{
+//  if (inMessage == msg_Click)
+    mPUMenu->ItemSelected(((LStdPopupMenu*)mPane)->GetValue()-1);
+}
+
+void
+PIOptMenuMac::Select(char *txt, PIMessage msg)
+{ // Ca doit faire quoi ????
+mStext = txt;  mSmsg = msg;
+}
+
+/* --Methode-- */
+void PIOptMenuMac::SetValueStr(string & s)
+{
+int n;
+n=mPUMenu->FindItemByName((char *)s.c_str());
+if (n < 0)  return;  
+
+((LStdPopupMenu*)mPane)->SetValue(n+1);
+mStext = s;
+mSmsg  = mPUMenu->GetMenuItemMsg(n);
+
+return;
+}
+
+/* --Methode-- */
+void PIOptMenuMac::SetValue(PIMessage msg)
+{
+int n;
+n=mPUMenu->FindItemByMsg(msg);
+if (n < 0)  return;
+  
+StopListening();
+((LStdPopupMenu*)mPane)->SetValue(n+1);
+StartListening();
+mStext = mPUMenu->GetMenuItemText(n);
+mSmsg  = msg;
+
+return;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenumac.h	(revision 108)
@@ -0,0 +1,33 @@
+#ifndef PIOPTMENMAC_H_SEEN
+#define PIOPTMENMAC_H_SEEN
+
+#include "pioptmenugen.h"
+
+class PIOptMenuMac : public PIOptMenuGen {
+public:
+	                PIOptMenuMac(PIContainerGen* par, PIPUMenu *pdm,  
+                               int sx=10, int sy=10, int px=0, int py=0);
+	               ~PIOptMenuMac();
+
+  virtual void      Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+				   
+  virtual void	    ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual string    GetValueStr() { return(mStext); }
+  virtual PIMessage GetValue()    { return(mSmsg); } 
+  virtual void      SetValueStr(string & s);
+  virtual void      SetValue(PIMessage msg);
+  
+  inline void       Select(char *txt, PIMessage msg); // public ou protege ???
+
+
+protected:
+  string    mStext;
+  PIMessage mSmsg;
+  //MenuHandle macMenu;
+  PIPUMenu* mPUMenu;
+};
+
+
+typedef PIOptMenuMac  PIOptMenu ;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenux.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenux.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenux.cc	(revision 108)
@@ -0,0 +1,87 @@
+#include<stdio.h>
+
+#include "pisysdep.h"
+#include "pioptmenux.h"
+#include PICONT_H
+#include PISTDWDG_H
+
+#include <Xm/Xm.h>
+#include <Xm/RowColumn.h>
+
+/************* PIOptionMenuX ************/
+
+
+/* --Methode-- */
+PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPUMenu *pum,
+                     int sx, int sy, int px, int py)
+: PIOptMenuGen(par, pum, sx-2, sy-2, px, py)
+{
+sx -= 2;
+sy -= 2;
+SetBorderWidth(1); 
+mAB = new PIButton(this, "?", 0, sy-2, sy-2, 1, 1);
+mAB->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_free, PIBK_fixed);
+mAB->ActivatePress(true);
+mLab = new PILabel(this, "OptLabel", sx-sy-1, sy, sy+1, 0);
+mLab->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+mMen = pum;
+SetValue(mMen->ItemMsg(0));
+Manage();
+}
+
+
+/* --Methode-- */
+PIOptMenuX::~PIOptMenuX()
+{
+delete mAB;
+delete mLab;
+}
+
+/* --Methode-- */
+void PIOptMenuX::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+// printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender);
+if ((sender == mAB) && (ModMsg(msg) == PIMsg_Press))  
+  {  mMen->SetMsgParent(this);    mMen->Show(this, 0, YSize()); }
+else if (sender == mMen)
+  {
+  mAB->ReleaseButton();
+  SetValue(UserMsg(msg));
+  ReSend(msg, this, data);
+  }
+return;
+}
+
+
+/* --Methode-- */
+void PIOptMenuX::SetValueStr(string & s)
+{
+int n;
+Arg warg[2];
+n=mMen->GetNumItem((char *)s.c_str());
+if (n < 0)  return;  
+
+XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
+XtSetValues(XtWdg(), warg, 1);
+mStext = s;
+mSmsg  = mMen->ItemMsg(n);
+mLab->SetLabel(mStext);
+return;
+}
+
+/* --Methode-- */
+void PIOptMenuX::SetValue(PIMessage msg)
+{
+int n;
+Arg warg[2];
+n=mMen->GetNumItemMsg(msg);
+if (n < 0)  return;
+  
+XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
+XtSetValues(XtWdg(), warg, 1);
+mStext = mMen->ItemName(n);
+mSmsg  = msg;
+mLab->SetLabel(mStext);
+return;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pioptmenux.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pioptmenux.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pioptmenux.h	(revision 108)
@@ -0,0 +1,35 @@
+#ifndef PIOPTMENX_H_SEEN
+#define PIOPTMENX_H_SEEN
+
+#include "pisysdep.h"
+#include "pioptmenugen.h"
+#include PISTDWDG_H
+
+class PIOptMenuX : public PIOptMenuGen {
+public:
+	            PIOptMenuX(PIContainerGen* par, PIPUMenu *pum,  
+                               int sx=10, int sy=10, int px=0, int py=0);
+	            ~PIOptMenuX();
+
+  virtual void      Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+				   
+  virtual string    GetValueStr() { return(mStext); }
+  virtual PIMessage GetValue()    { return(mSmsg); } 
+  virtual void      SetValueStr(string & s);
+  virtual void      SetValue(PIMessage msg);
+  
+  
+
+protected:
+  PIButton *mAB;
+  PILabel  *mLab;
+  PIPUMenu *mMen;
+  string   mStext;
+  PIMessage mSmsg;
+
+};
+
+
+typedef PIOptMenuX  PIOptMenu ;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piperiodgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piperiodgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piperiodgen.h	(revision 108)
@@ -0,0 +1,26 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIPERIODGEN_H
+#define PIPERIODGEN_H
+
+#include <list.h>
+
+class PIPeriodGen;
+typedef list<PIPeriodGen*> PIPeriodList;
+
+class PIPeriodGen {
+public:
+  PIPeriodGen(int dT) : dt(dT) {} // dt en secondes
+  virtual ~PIPeriodGen() {}
+
+  virtual void DoPeriodic()=0;
+
+  virtual void Start()=0;
+  virtual void Stop()=0;
+
+protected:
+  int dt;
+};
+
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piperiodx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piperiodx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piperiodx.cc	(revision 108)
@@ -0,0 +1,52 @@
+#include "piwdgx.h"
+#include "piperiodx.h"
+
+/* Nouvelle-Fonction */
+static void xttimer_action(XtPointer usd, XtIntervalId * /*tid*/)
+{
+PIPeriodX * pip;
+XtIntervalId id;
+pip = (PIPeriodX *)usd;
+pip->DoPeriodic();
+int szx, szy;
+XtAppContext * appctx = PIXtAppCtx(szx, szy);
+id = XtAppAddTimeOut(*appctx, pip->Interval()*1000, xttimer_action, pip);
+pip->SetTimerId(id);
+return;
+}
+
+
+/* --Methode-- */
+PIPeriodX::PIPeriodX(int dt, UsPeriodicAction act, void * usp)
+: Periodic(dt, act, usp)
+{
+}
+
+/* --Methode-- */
+PIPeriodX::~PIPeriodX()
+{
+if (mFgact) Stop();
+}
+
+/* --Methode-- */
+void PIPeriodX::Start(int dt)
+{
+if (mFgact) return;
+if (dt > 0)  mDt = dt;
+
+int szx,szy;
+XtAppContext * appctx = PIXtAppCtx(szx, szy);
+mTId = XtAppAddTimeOut(*appctx, mDt*1000, xttimer_action, this);
+mFgact = true;
+return;
+}
+
+void
+PIPeriodX::Stop()
+{
+if(mFgact)
+  XtRemoveTimeOut(mTId);
+mFgact = false;
+return;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/piperiodx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piperiodx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piperiodx.h	(revision 108)
@@ -0,0 +1,24 @@
+// This may look like C code, but it is really -*- C++ -*-
+#ifndef PIPERIODX_H
+#define PIPERIODX_H
+
+#include <X11/Intrinsic.h>
+#include "periodic.h"
+
+class PIPeriodX : public Periodic {
+public:
+  PIPeriodX(int dt, UsPeriodicAction act=NULL, void * usp=NULL);
+  ~PIPeriodX();
+
+  virtual void Start(int dt=-1);
+  virtual void Stop();
+
+  inline void SetTimerId(XtIntervalId id) {mTId=id; }
+
+protected:
+XtIntervalId mTId;
+};
+
+typedef PIPeriodX PIPeriodic;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.cc	(revision 108)
@@ -0,0 +1,139 @@
+/* Fonctions interface XWindow pour affichage d'images */
+/*                  Reza   05/95                       */
+
+/*                  LAL (Orsay) / IN2P3-CNRS           */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "pipixmapgen.h"
+
+// Methodes de la classe PIPixMap  :
+
+/* --Methode-- */
+PIPixmapGen::PIPixmapGen(PIContainerGen  *par, char *nom,
+                     int sx, int sy, int px, int py) :
+PIBaseWdg(par, nom, sx, sy, px, py)
+{
+pixmap = NULL;
+nx = ny = 0;
+ofx = ofy = 0;
+mPpos[0] = mPpos[0] = 0;
+cmap = new PIColorMap(CMAP_GREY32);
+mEn = 0;
+ActivateButton(1);
+}
+
+
+/* --Methode-- */
+PIPixmapGen::~PIPixmapGen()
+{
+delete cmap;
+}
+
+/* --Methode-- */
+void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy)
+{
+pixmap = pix; 
+if (pixmap)
+  {
+  if (sx < 0)  sx = 0;
+  if (sy < 0)  sy = 0;
+  if (ox < 0)  ox = 0;
+  if (oy < 0)  oy = 0;
+  nx = sx; ny = sy;
+  ofx = ox;  ofy = oy;
+  }
+else { ofx = ofy = nx = ny = 0; }
+if (refr) Refresh();   
+}
+
+
+/* --Methode-- */
+void PIPixmapGen::SetColMap(CMapId cmapid, bool refr)
+{
+if (!cmap || (cmap->Type() != cmapid) || (cmapid == CMAP_OTHER) ) {  
+  if (cmap) delete cmap;
+  cmap = new PIColorMap(cmapid);
+}
+if (refr)  Refresh();  
+}
+
+
+/* --Methode-- */
+void  PIPixmapGen::But1Press(int x, int y)
+{
+mPpos[0] = x;  mPpos[1] = y;  
+if (Msg())  Send(Msg(), PIMsg_Click, mPpos);
+return;
+}
+
+
+/* --Methode-- */
+int PIPixmapGen::ElAdd(int typ, int x, int y, int dx, int dy, char* s)
+{
+DrwEl dre;
+mEn++;
+dre.eid = mEn;  dre.etyp = typ;
+dre.ex = x;   dre.ey = y;
+dre.edx = dx;  dre.edy = dy;
+if (s)  dre.es = s;
+mElist.push_back(dre);
+return(mEn);
+}
+
+/* --Methode-- */
+void  PIPixmapGen::ElDel(int id)
+{
+DrwElList::iterator it;
+for (it = mElist.begin(); it != mElist.end(); it++)
+  if ( (*it).eid == id) { mElist.erase(it);   break; }
+return;
+}
+
+/* --Methode-- */
+void  PIPixmapGen::ElDelAll()
+{
+mElist.erase(mElist.begin(), mElist.end());
+return;
+}
+
+/* --Methode-- */
+void  PIPixmapGen::DrawElements(PIGraphicGen* g)
+{
+char* txt;
+DrwElList::iterator it;
+for (it = mElist.begin(); it != mElist.end(); it++)
+  {
+  switch ( (*it).etyp )
+    {
+    case PIDEL_Line :
+      g->DrawLine((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_Text :
+      txt = (char*) ((*it).es.c_str());
+      g->DrawString((*it).ex, (*it).ey, txt ); 
+      break;
+    case PIDEL_Rect :
+      g->DrawBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_FRect :
+      g->DrawFBox((*it).ex, (*it).ey, (*it).edx, (*it).edy ); 
+      break;
+    case PIDEL_Circ :
+      g->DrawCircle((*it).ex, (*it).ey, (*it).edx ); 
+      break;
+    case PIDEL_FCirc :
+      g->DrawFCircle((*it).ex, (*it).ey, (*it).edx ); 
+      break;
+    default :
+      break;
+    }
+  }
+return;
+}
+
+
+// Fin des methodes de la classe 
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapgen.h	(revision 108)
@@ -0,0 +1,87 @@
+/* Fonctions interface XWindow pour affichage d'images */
+
+#ifndef PIPIXMAP_H_SEEN
+#define PIPIXMAP_H_SEEN
+
+#include "pisysdep.h"
+
+#include PIBWDG_H
+#include PICMAP_H
+
+#include <list>
+
+class PIPixmapGen : public PIBaseWdg
+{
+public:
+  enum {ClassId = 5100};
+
+  enum { PIDEL_Line = 1, PIDEL_Text = 2,
+         PIDEL_Rect = 3, PIDEL_FRect = 4, 
+         PIDEL_Circ = 5, PIDEL_FCirc = 6 } ; 
+
+                PIPixmapGen(PIContainerGen *par, char *nom,
+                         int sx=10, int sy=10, int px=0, int py=0);
+  virtual       ~PIPixmapGen();
+
+  virtual long  kind() {return ClassId; }
+
+  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, 
+                          bool refr=true, int ox=0, int oy=0);
+  void          SetColMap(CMapId cmapid, bool refr=true);
+  inline CMapId GetColMapId() { return ((CMapId)cmap->Type()); }; 
+  inline int    NbCol() { return(cmap->NCol()); };
+
+  virtual void  But1Press(int x, int y);
+  inline  int   XPPos() { return mPpos[0]; }
+  inline  int   YPPos() { return mPpos[1]; }
+
+  inline int    ElAddLine(int x1, int y1, int x2, int y2)
+    { return( ElAdd(PIDEL_Line, x1, y1, x2, y2, NULL) ); }  
+  inline int    ElAddText(int x, int y, char* s)
+    { return( ElAdd(PIDEL_Text, x, y, 0, 0, s) ); }  
+  inline int    ElAddRect(int x, int y, int dx, int dy)
+    { return( ElAdd(PIDEL_Rect, x, y, dx, dy, NULL) ); }  
+  inline int    ElAddFRect(int x, int y, int dx, int dy)
+    { return( ElAdd(PIDEL_FRect, x, y, dx, dy, NULL) ); }  
+  inline int    ElAddCirc(int x, int y, int r)
+    { return( ElAdd(PIDEL_Circ, x, y, r, r, NULL) ); }  
+  inline int    ElAddFCirc(int x, int y, int r)
+    { return( ElAdd(PIDEL_FCirc, x, y, r, r, NULL) ); }  
+
+  void          ElDel(int id);
+  void          ElDelAll();
+
+protected:
+  int           ElAdd(int typ, int x, int y, int dx, int dy, char* s);
+  virtual void  DrawElements(PIGraphicGen* g);
+
+  unsigned char *pixmap;
+  int nx, ny;
+  int ofx, ofy;
+  PIColorMap* cmap;
+
+#ifdef __DECCXX
+public:
+#endif
+  struct DrwEl{
+    int eid, etyp;
+    int ex,ey;
+    int edx,edy;
+    string es;
+  };
+#ifdef __DECCXX
+protected:
+#endif
+  typedef list<DrwEl> DrwElList;
+
+  DrwElList mElist;
+  int mEn;
+  int mPpos[2];
+};  
+  
+
+
+
+#endif   /* PIPIXMAP_H_SEEN */
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.cc	(revision 108)
@@ -0,0 +1,102 @@
+#include "pipixmapmac.h"
+
+PIPixmapMac::PIPixmapMac(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIPixmapGen(par,nom,sx,sy,px,py), mGWorld(NULL)
+{}
+
+
+PIPixmapMac::~PIPixmapMac()
+{}
+
+
+/* --Methode-- */
+void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr)
+{
+  if (nx != sx || ny != sy)
+    if (mGWorld) {
+      DisposeGWorld(mGWorld);
+      mGWorld = NULL;
+    }
+  PIPixmapGen::SetPixmap(pix, sx, sy, refr);
+}
+
+void
+PIPixmapMac::Resize()
+{
+  Refresh();
+}
+
+void
+PIPixmapMac::Refresh()
+{
+	PIPixmapGen::Refresh();
+}
+
+void
+PIPixmapMac::DrawOff()
+{
+  if (mGWorld) {
+    DisposeGWorld(mGWorld);
+    mGWorld = NULL;
+  }
+  
+  if (!cmap) return;
+  if (!pixmap) return;
+  if (nx == 0 || ny == 0) return;
+  
+  Rect	frame;
+  SetRect(&frame, 0, 0, XSize(), YSize());
+
+  
+  ThrowIfOSErr_(NewGWorld(&mGWorld, 8, &frame, cmap->mCTab, nil, 0));
+
+    // Lock down Pixels that we are drawing to so that memory will not
+	// move
+	::LockPixels (mGWorld->portPixMap);
+
+ 	// Draw
+	PixMapHandle	pMap;
+	unsigned char	*pixP;
+	
+	pMap = GetGWorldPixMap(mGWorld);
+	for (int y=frame.top; y<frame.bottom; y++) {
+		pixP = (unsigned char *) GetPixBaseAddr(pMap) + y * ((**pMap).rowBytes & 0x7FFF);
+		for(int x = frame.left ; x < frame.right ; x++)
+			pixP[x] = (x<nx && y<ny) ? pixmap[x + y*nx]+2 : 0;
+	}
+			
+	// Now unlock Pixels.
+	::UnlockPixels (mGWorld->portPixMap);
+	
+	mPane->FocusDraw();
+//	SetPalette(mPane->GetMacPort(),cmap->mPalette, true);
+//	PIPixmapGen::Refresh();
+}
+
+void
+PIPixmapMac::Draw(PIGraphic* g,int,int,int,int)
+{
+  Draw(g);
+}
+
+void
+PIPixmapMac::Draw(PIGraphic* g)
+{
+  DrawOff();
+  if (!mGWorld) return;
+  mPane->FocusDraw();
+  Rect	paneFrame;
+  mPane-> CalcLocalFrameRect(paneFrame);
+  Rect	offsFrame;
+  SetRect(&offsFrame, 0, 0, paneFrame.right-paneFrame.left, paneFrame.bottom-paneFrame.top);
+  ::LockPixels (mGWorld->portPixMap);
+  ::ForeColor (blackColor);
+  ::BackColor (whiteColor);
+  ::CopyBits((BitMap *) (*(GetGWorldPixMap(mGWorld))),
+				&mPane->GetMacPort()->portBits,
+				&offsFrame, &paneFrame, srcCopy, nil);
+  ::UnlockPixels (mGWorld->portPixMap);
+  DisposeGWorld(mGWorld);
+  mGWorld = 0;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapmac.h	(revision 108)
@@ -0,0 +1,26 @@
+#ifndef PIPIXMAPMAC_H_SEEN
+#define PIPIXMAPMAC_H_SEEN
+
+#include "pipixmapgen.h"
+
+class PIPixmapMac : public PIPixmapGen {
+
+public:
+                PIPixmapMac(PIContainerGen *par, char *nom,
+                         int sx=10, int sy=10, int px=0, int py=0);
+  virtual      ~PIPixmapMac();
+
+  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
+  virtual void  Draw(PIGraphic* g);
+  virtual void  Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+  virtual void	Refresh();
+  virtual void	DrawOff();
+  virtual void  Resize();
+protected:
+  GWorldPtr 	mGWorld;
+};
+
+typedef PIPixmapMac PIPixmap;
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapx.cc	(revision 108)
@@ -0,0 +1,178 @@
+#include <stdio.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#include "pipixmapx.h"
+#include "psfile.h"
+
+static  GC    mygc;
+
+/* --Methode-- */
+PIPixmapX::PIPixmapX(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIPixmapGen(par,nom,sx,sy,px,py) 
+{
+Init();
+AllocXImg();
+}
+
+
+/* --Methode-- */
+PIPixmapX::~PIPixmapX()
+{
+delete[] myximg->data;
+XFree(myximg); 
+}
+
+/* --Methode-- */
+void PIPixmapX::Refresh()
+{
+int i,j;
+unsigned char *pp;
+
+if (pixmap)
+  {
+  for(j=0; j<ny; j++)
+    {
+    pp = pixmap+j*nx;
+    for(i=0; i<nx; i++)
+      { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
+    }
+  }
+
+for(j=ny; j<YSize(); j++)
+  for(i=nx; i<XSize(); i++)
+     XPutPixel(myximg, i, j, 0 );
+
+PIBaseWdgX::Refresh();
+}
+
+
+/* --Methode-- */
+void PIPixmapX::Resize()
+{
+delete[] myximg->data;
+XFree(myximg); 
+AllocXImg();
+if (Msg())  Send(Msg(), PIMsg_Resize, mPpos);
+}
+
+/* --Methode-- */
+void PIPixmapX::Draw(PIGraphicGen* g)
+{
+if (!pixmap)  return;
+if (!g) return; 
+if (g->kind() == PI_PSFileGraphics ) {
+    g->DrawPixmap(0, 0, pixmap, nx, ny, cmap);
+  /*  Il faut faire quelque chose Sinon ??! */ 
+    DrawElements(g);
+  }
+else  Draw(g, 0, 0, XSize(), YSize());
+}
+
+/* --Methode-- */
+void PIPixmapX::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+{
+int mx, my, ox, oy;
+Window xw;
+Display * mdsp;
+if (!g) return; 
+if (g->kind() == PI_PSFileGraphics ) return;
+if ((myximg == NULL) || (cmap == NULL)) return;
+
+xw = XtWindow(XtWdg());
+mdsp = PIXDisplay();
+
+if (x0 < 0)  x0 = 0;
+if (y0 < 0)  y0 = 0;
+mx = nx+ofx;   my = ny+ofy;
+if (dx > (XSize()-x0)) dx = XSize()-x0;
+if (dy > (YSize()-y0)) dy = YSize()-y0;
+if ((dx <= 0) || (dy <= 0))  return;
+
+if ( (mx < x0 ) || (my < y0) )
+  { XClearArea(mdsp, xw, x0, y0, dx, dy, False);  return; }
+
+ox = oy = 0;  
+
+if (ofx > x0)
+  { XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False);   
+  dx -= (ofx-x0);  x0 = ofx;  ox = 0; }
+else  ox = x0-ofx;
+if (ofy > y0)
+  { XClearArea(mdsp, xw, x0, y0, dx, ofy-y0, False);  
+  dy -= (ofy-y0);  y0 = ofy;  oy = 0; }
+else  oy = y0-ofy;
+ 
+if (mx < (x0+dx))
+  { XClearArea(mdsp, xw, mx, y0, x0+dx-mx, dy, False);  dx = mx-x0; }
+if (my < (y0+dy))
+  { XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False);  dy = my-y0; }
+ 
+XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy);
+DrawElements(g);
+XFlush(mdsp);
+return;
+ 
+}
+
+static bool fgxpxm = false;
+
+
+/* --Methode-- */
+void PIPixmapX::Init()
+{
+XGCValues       values;
+XtGCMask        mask;
+Display *mdsp;
+int scr;
+
+if (fgxpxm)  return; 
+fgxpxm = true;
+
+mdsp = XtDisplay(XtWdg());
+scr = XDefaultScreen(mdsp);
+
+mask = GCFunction | GCPlaneMask;
+// mask = GCForeground | GCBackground;
+values.function = GXcopy;
+values.plane_mask = ~0;
+// values.foreground = WhitePixel(mdsp, scr);
+// values.background = BlackPixel(mdsp, scr);
+mygc = XtGetGC(XtWdg(), mask, &values);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIPixmapX::AllocXImg()
+{
+Window xw;
+Display * mdsp;
+int scr;
+int depth;
+int pad;
+int i,j;
+
+xw = XtWindow(XtWdg());
+mdsp = PIXDisplay();
+scr = PIXScreen();
+
+depth = DefaultDepth(mdsp,scr);
+pad = (depth > 8) ? 32 : 8;
+myximg = XCreateImage (mdsp,DefaultVisual(mdsp,scr),
+           depth,ZPixmap,0,NULL, XSize(), YSize(), pad,0);
+if (myximg == NULL)  return;
+myximg->data = new char [YSize()*myximg->bytes_per_line];
+if (myximg->data == NULL)  
+  { XFree(myximg); myximg = NULL;  return; } 
+
+for(j=0; j<YSize(); j++)
+  for(i=0; i<XSize(); i++)
+    XPutPixel(myximg, i, j, 0 );
+
+return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pipixmapx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipixmapx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipixmapx.h	(revision 108)
@@ -0,0 +1,28 @@
+#ifndef PIPIXMAPX_H_SEEN
+#define PIPIXMAPX_H_SEEN
+
+#include "pipixmapgen.h"
+
+class PIPixmapX : public PIPixmapGen {
+
+public:
+                PIPixmapX(PIContainerGen *par, char *nom,
+                         int sx=10, int sy=10, int px=0, int py=0);
+  virtual      ~PIPixmapX();
+
+  virtual void  Refresh();
+  virtual void  Resize();
+  virtual void  Draw(PIGraphicGen* g);
+  virtual void  Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
+
+
+protected:
+  void          Init();
+  void          AllocXImg();
+  XImage * myximg;  
+};
+
+typedef PIPixmapX PIPixmap;
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pippapplmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippapplmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippapplmac.cc	(revision 108)
@@ -0,0 +1,41 @@
+#include "pippapplmac.h"
+#include "piupdattachment.h"
+#include "pippmenubar.h"
+#include "pippwindowmac.h"
+#include <LClipboard.h>
+
+PIPPApplMac::PIPPApplMac()
+:LApplication()
+{
+  RegisterClass_(PIPPWindowMac);
+  AddAttachment(new LClipboard);
+}
+
+
+PIPPApplMac::~PIPPApplMac()
+{}
+
+void
+PIPPApplMac::AdjustCursor(const EventRecord &inMacEvent)
+{
+  PIUpdAttachment::hit = false;
+  LApplication::AdjustCursor(inMacEvent);
+  if (!PIUpdAttachment::hit) {
+    if (PIUpdAttachment::lastCursPane)
+       PIUpdAttachment::lastCursPane->myWdg->Leave();
+    PIUpdAttachment::lastCursPane = NULL;
+  }   
+}
+
+void
+PIPPApplMac::MakeMenuBar()
+{
+	//new PIPPMenuBar();
+}
+
+
+
+// $CHECK$
+// Gerer AllowSubRemoval, qui envoie un evenement a l'application PI.
+// Eventuellement avoir des fenetres qui se cachent lors d'un close et d'autres
+// qui se detruisent ??
Index: /branches/EA_Juin98/SophyaPI/PI/pippapplmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippapplmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippapplmac.h	(revision 108)
@@ -0,0 +1,11 @@
+#include <LApplication.h>
+
+class PIPPApplMac : public LApplication {
+public:
+						PIPPApplMac();
+	virtual				~PIPPApplMac();
+
+	void MakeMenuBar();
+	virtual void			AdjustCursor	(const EventRecord &inMacEvent);
+};
+
Index: /branches/EA_Juin98/SophyaPI/PI/pipplist.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipplist.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipplist.cc	(revision 108)
@@ -0,0 +1,198 @@
+#include "pipplist.h"
+#include <LTableMonoGeometry.h>
+#include <LTableSingleSelector.h>
+#include <LTableMultiSelector.h>
+#include <LTableArrayStorage.h>
+#include <LComparator.h>
+
+class CellMsgComparator : public LComparator {
+public:
+	virtual Int32		Compare(
+								const void*			inItemOne,
+								const void* 		inItemTwo,
+								Uint32				/*inSizeOne*/,
+								Uint32				/*inSizeTwo*/) const
+	{return ((PIPPListCell*)inItemOne)->msg == ((PIPPListCell*)inItemTwo)->msg;}
+};
+
+static CellMsgComparator cellMsgComparator;
+
+class CellStrComparator : public LComparator {
+public:
+	virtual Int32		Compare(
+								const void*			inItemOne,
+								const void* 		inItemTwo,
+								Uint32				/*inSizeOne*/,
+								Uint32				/*inSizeTwo*/) const
+	{return ((PIPPListCell*)inItemOne)->str == ((PIPPListCell*)inItemTwo)->str;}
+};
+
+static CellStrComparator cellStrComparator;
+
+
+PIPPList::PIPPList(PIMsgHandler* h)
+: mHndl(h)
+{
+  InitPPList();
+}
+
+PIPPList::PIPPList(
+    const SPaneInfo& inPaneInfo,
+    const SViewInfo& inViewInfo,
+    PIMsgHandler* h)
+: LTableView(inPaneInfo, inViewInfo), mHndl(h)
+{
+  InitPPList();
+}
+
+void PIPPList::InitPPList()
+{
+  SetTableGeometry(new LTableMonoGeometry(this, 10, 16));
+  SetTableSelector(tss=new LTableSingleSelector(this)); 
+  mArray = new LArray(sizeof(PIPPListCell)),
+  SetTableStorage(new LTableArrayStorage(this, mArray));
+  tms = new LTableMultiSelector(this);
+  LTableView::InsertCols(1, 0, nil, 0, Refresh_No);
+}
+
+PIPPList::~PIPPList()
+{
+  SetTableSelector(nil);
+  delete tss;
+  delete tms;
+}
+
+
+void PIPPList::AppendItem(string const& str, PIMessage msg)
+{
+  PIPPListCell cell;
+  cell.str=str;
+  cell.msg=msg;
+  InsertRows(1, -1, &cell, sizeof(cell), Refresh_Yes);
+}
+
+STableCell PIPPList::FindStr(string const& str)
+{
+  PIPPListCell cell;
+  cell.str = str;
+  cell.msg = 0;
+  mArray->SetComparator(&cellStrComparator);
+  STableCell tcell;
+  FindCellData(tcell, &cell, sizeof(cell));
+  return tcell;
+}
+
+STableCell PIPPList::FindMsg(PIMessage msg)
+{
+  PIPPListCell cell;
+  cell.str = "";
+  cell.msg = msg;
+  mArray->SetComparator(&cellMsgComparator);
+  STableCell tcell;
+  FindCellData(tcell, &cell, sizeof(cell));
+  return tcell;
+}
+
+void PIPPList::DeleteItem(string const& str)
+{
+  STableCell tcell = FindStr(str);
+  RemoveRows(1, tcell.row, Refresh_Yes);
+}
+
+void PIPPList::DeleteItem(PIMessage msg)
+{
+  STableCell tcell = FindMsg(msg);
+  RemoveRows(1, tcell.row, Refresh_Yes);
+}
+
+
+void PIPPList::SetMultipleSelect(bool ms);
+  
+int PIPPList::GetNbSel()
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+  }
+  return n; 
+}
+
+PIMessage PIPPList::GetSelMsg(int i)
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+    if (n == i) {
+       PIPPListCell ppcell;
+       UInt32 sz = sizeof(ppcell);
+       GetCellData(cell, &ppcell, sz);
+       return ppcell.msg;
+    }
+  }
+  return 0; 
+}
+
+string PIPPList::GetSelStr(int i)
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+    if (n == i) {
+       PIPPListCell ppcell;
+       UInt32 sz = sizeof(ppcell);
+       GetCellData(cell, &ppcell, sz);
+       return ppcell.str;
+    }
+  }
+  return ""; 
+}
+void PIPPList::SelectItem(string const& str)
+{
+  STableCell cell = FindStr(str);
+  SelectCell(cell);
+}
+
+void PIPPList::SelectItem(PIMessage msg)
+{
+  STableCell cell = FindMsg(msg);
+  SelectCell(cell);
+}
+
+void PIPPList::ClearSelItem(string const& str)
+{
+  STableCell cell = FindStr(str);
+  UnselectCell(cell);
+}
+
+void PIPPList::ClearSelItem(PIMessage msg)
+{
+  STableCell cell = FindMsg(msg);
+  UnselectCell(cell);
+}
+
+void PIPPList::SetMultipleSelect(bool ms)
+{
+  if (ms)
+    SetTableSelector(tms);
+  else
+    SetTableSelector(tss); 
+}
+
+void
+PIPPList::ClickCell(
+	const STableCell&		inCell,
+	const SMouseDownEvent&	inMouseDown)
+{
+  if (GetClickCount() == 2) {
+	
+  }
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pipplist.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pipplist.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pipplist.h	(revision 108)
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <string>
+#include <LTableView.h>
+#include "pimsghandler.h"
+
+class LArray;
+
+struct PIPPListCell {
+   string 	   str;
+   PIMessage   msg;
+};
+
+class PIPPList : public LTableView {
+public:
+
+  PIPPList(PIMsgHandler* hndl);
+  PIPPList(
+    const SPaneInfo& inPaneInfo,
+    const SViewInfo& inViewInfo,
+    PIMsgHandler* hndl);
+  virtual ~PIPPList();
+
+  void       AppendItem(string const& str, PIMessage msg);
+  void       DeleteItem(string const& str);
+  void       DeleteItem(PIMessage msg);  
+
+  void       SetMultipleSelect(bool ms);
+  
+  int        GetNbSel();
+  PIMessage  GetSelMsg(int i);
+  string     GetSelStr(int i);
+  
+  void       SelectItem(string const& str);
+  void       SelectItem(PIMessage msg);
+  void       ClearSelItem(string const& str);
+  void       ClearSelItem(PIMessage msg);
+  
+protected:
+  LTableSelector* tss;
+  LTableSelector* tms;
+  LArray*         mArray;
+  PIMsgHandler*   mHndl;
+
+  virtual void    ClickCell(
+                       const STableCell        &inCell,
+                       const SMouseDownEvent   &inMouseDown);
+
+  void InitPPList();
+  STableCell  FindMsg(PIMessage msg);
+  STableCell  FindStr(string const& str);
+};
Index: /branches/EA_Juin98/SophyaPI/PI/pippmenubar.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippmenubar.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippmenubar.cc	(revision 108)
@@ -0,0 +1,44 @@
+#include "pippmenubar.h"
+
+PIPPMenuBar::PIPPMenuBar()
+: LMenuBar(MBAR_Initial)
+{
+
+}
+
+PIPPMenuBar::~PIPPMenuBar()
+{}
+
+CommandT
+PIPPMenuBar::MenuCommandSelection(
+	const EventRecord	&inMouseEvent,
+	Int32				&outMenuChoice) const
+{
+	outMenuChoice = ::MenuSelect(inMouseEvent.where);
+	
+	int menuId = HiWord(outMenuChoice);
+	int menuItem = LoWord(outMenuChoice)-1; // Dans PI les menu items commencent a 0
+	
+	PIMenuMac* menu = PIMenuMac::findMenu(menuId);
+	if (menu)
+	  menu->ItemSelected(menuItem);
+	
+	return cmd_Nothing;
+}
+
+CommandT
+PIPPMenuBar::FindKeyCommand(
+	const EventRecord	&inKeyEvent,
+	Int32				&outMenuChoice) const
+{
+	char	theChar = inKeyEvent.message & charCodeMask;
+	outMenuChoice = ::MenuKey(theChar);
+	int menuId = HiWord(outMenuChoice);
+	int menuItem = LoWord(outMenuChoice)-1; // Dans PI les menu items commencent a 0
+	
+	PIMenuMac* menu = PIMenuMac::findMenu(menuId);
+	if (menu)
+	  menu->ItemSelected(menuItem);
+	
+	return cmd_Nothing;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pippmenubar.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippmenubar.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippmenubar.h	(revision 108)
@@ -0,0 +1,21 @@
+#ifndef PIPPMENUBAR_H_SEEN
+#define PIPPMENUBAR_H_SEEN
+
+#include <LMenuBar.h>
+#include "pimenumac.h"
+
+class PIPPMenuBar : public LMenuBar {
+public:
+                           PIPPMenuBar();
+                          ~PIPPMenuBar();
+
+	virtual CommandT	   MenuCommandSelection(const EventRecord &inMouseEvent,
+								Int32 &outMenuChoice) const;
+
+	virtual CommandT	FindKeyCommand(
+								const EventRecord	&inKeyEvent,
+								Int32				&outMenuChoice) const;
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.cc	(revision 108)
@@ -0,0 +1,67 @@
+#include "pippoptmenu.h"
+
+PIPPOptMenu::PIPPOptMenu(
+	const SPaneInfo	&inPaneInfo,
+	MessageT		inValueMessage,
+	Int16			inTitleOptions,
+	ResIDT			inMENUid,
+	Int16			inTitleWidth,
+	Int16			inPopupVariation,
+	ResIDT			inTextTraitsID,
+	Str255			inTitle,
+	OSType			inResTypeMENU,
+	Int16			inInitialMenuItem)
+		: LStdPopupMenu(inPaneInfo, inValueMessage, inTitleOptions,
+				inMENUid, inTitleWidth, inPopupVariation, inTextTraitsID,
+				inTitle, inResTypeMENU, inInitialMenuItem)
+{
+}
+
+
+
+PIPPOptMenu::PIPPOptMenu(
+	const SPaneInfo	&inPaneInfo,
+	MessageT		inValueMessage,
+	Int32			inMaxValue,
+	ResIDT			inTextTraitsID,
+	ControlHandle	inMacControlH)
+		: LStdPopupMenu(inPaneInfo, inValueMessage, inMaxValue,
+						inTextTraitsID, inMacControlH)
+{
+}
+
+
+
+PIPPOptMenu::PIPPOptMenu(
+	LStream	*inStream)
+		: LStdPopupMenu(inStream)
+{	
+}
+
+void
+PIPPOptMenu::HotSpotResult(
+	Int16	inHotSpot)
+{
+		BroadcastMessage(msg_ThumbDragged, (void*) this);
+}
+
+void
+PIPPOptMenu::SetMenu(PIPUMenu* pdm)
+{
+  // On va changer la resource de menu au passage...
+  InsertMenu(pdm->GetMacMenuHandle(), hierMenu);
+  PopupPrivateDataHandle	dataH =
+		(PopupPrivateDataHandle) (**GetMacControl()).contrlData;
+  (**dataH).mHandle = pdm->GetMacMenuHandle();
+  (**dataH).mID = pdm->GetMacMenuID();
+  
+  //InitStdPopupMenu(1);
+  
+  mValue = 1;
+  mMinValue = 1;
+  mMaxValue = ::CountMItems(pdm->GetMacMenuHandle());
+
+  ::SetControlValue(mMacControlH, mValue);
+  ::SetControlMinimum(mMacControlH, mMinValue);
+  ::SetControlMaximum(mMacControlH, mMaxValue);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippoptmenu.h	(revision 108)
@@ -0,0 +1,36 @@
+#include "LStdControl.h"
+#include "pisysdep.h"
+#include PIMENU_H
+
+// Redefinir HotSpotResult pour envoyer un message au PIOptMenuMac (qui est un listener)
+// qui va envoyer une action.
+
+class PIPPOptMenu : public LStdPopupMenu {
+public:
+	enum { class_ID = 'PPop' };
+					PIPPOptMenu(
+							const SPaneInfo		&inPaneInfo,
+							MessageT			inValueMessage,
+							Int16				inTitleOptions,
+							ResIDT				inMENUid,
+							Int16				inTitleWidth,
+							Int16				inPopupVariation,
+							ResIDT				inTextTraitsID,
+							Str255				inTitle,
+							OSType				inResTypeMENU,
+							Int16				inInitialMenuItem);
+					PIPPOptMenu(
+							const SPaneInfo		&inPaneInfo,
+							MessageT			inValueMessage,
+							Int32				inMaxValue,
+							ResIDT				inTextTraitsID,
+							ControlHandle		inMacControlH);
+					PIPPOptMenu(
+							LStream				*inStream);
+							
+					void SetMenu(PIPUMenu* pdm);
+protected:
+	virtual void		HotSpotResult(
+								Int16			inHotSpot);
+
+};
Index: /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.cc	(revision 108)
@@ -0,0 +1,116 @@
+#include "pippviewadapter.h"
+#include "piupdattachment.h"
+
+
+PIPPViewAdapter::PIPPViewAdapter()	
+:LView()
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+
+PIPPViewAdapter::PIPPViewAdapter(	
+	const PIPPViewAdapter& inOriginal)
+:LView(inOriginal)
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+PIPPViewAdapter::PIPPViewAdapter(
+	const SPaneInfo		&inPaneInfo,
+	const SViewInfo		&inViewInfo)
+:LView(inPaneInfo, inViewInfo)
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+
+void PIPPViewAdapter::SetBinding(PIBindingKind left, PIBindingKind top, 
+                                  PIBindingKind right, PIBindingKind bottom)
+{
+  piBindings.left = left;
+  piBindings.right = right;
+  piBindings.top = top;
+  piBindings.bottom = bottom;
+}
+
+void PIPPViewAdapter::AdaptToSuperFrameSize(
+	Int32				inSurrWidthDelta,
+	Int32				inSurrHeightDelta,
+	Boolean				inRefresh)
+{
+  SDimension16 parSize;
+  GetSuperView()->GetFrameSize(parSize);
+  
+  SDimension16 oldParSize = parSize;
+  oldParSize.width -= inSurrWidthDelta;
+  oldParSize.height -= inSurrHeightDelta;
+  
+  SPoint32 myLoc;
+  GetFrameLocation(myLoc);
+  SPoint32	superImageLoc = {0, 0};
+	
+  if (mSuperView != nil) {
+    mSuperView->GetImageLocation(superImageLoc);
+  }
+  myLoc.h -= superImageLoc.h;
+  myLoc.v -= superImageLoc.v;
+  
+  SDimension16 mySize;
+  GetFrameSize(mySize);
+    
+  SPoint32 myXLoc = myLoc;
+  myXLoc.h += mySize.width;
+  myXLoc.v += mySize.height;
+  
+  if (piBindings.left == PIBK_elastic) {
+     myLoc.h = parSize.width * ((float)myLoc.h / (float)oldParSize.width);
+  }
+ 
+  if (piBindings.top == PIBK_elastic) {
+     myLoc.v = parSize.height * ((float)myLoc.v / (float)oldParSize.height);
+  }
+  
+  if (piBindings.right == PIBK_fixed) {
+     myXLoc.h += inSurrWidthDelta;
+  } else
+  if (piBindings.right == PIBK_elastic) {
+     myXLoc.h = parSize.width * ((float)myXLoc.h / (float)oldParSize.width);
+  }  
+ 
+  if (piBindings.bottom == PIBK_fixed) {
+     myXLoc.v += inSurrHeightDelta;
+  } else
+  if (piBindings.bottom == PIBK_elastic) {
+     myXLoc.v = parSize.height * ((float)myXLoc.v / (float)oldParSize.height);
+  }
+  
+  
+  if (piBindings.left == PIBK_free) {
+    myLoc.h = myXLoc.h - mySize.width;
+  }   
+  if (piBindings.top == PIBK_free) {
+    myLoc.v = myXLoc.v - mySize.height;
+  }   
+  if (piBindings.right == PIBK_free) {
+    myXLoc.h = myLoc.h + mySize.width;
+  }   
+  if (piBindings.bottom == PIBK_free) {
+    myXLoc.v = myLoc.v + mySize.height;
+  }
+  
+  mySize.width = myXLoc.h - myLoc.h;
+  mySize.height = myXLoc.v - myLoc.v;
+  
+  ResizeFrameTo(mySize.width, mySize.height, inRefresh);
+  ResizeFrameTo(mySize.width, mySize.height, inRefresh);
+  PlaceInSuperImageAt(myLoc.h, myLoc.v, inRefresh);
+}
+
+void
+PIPPViewAdapter::ResizeFrameBy(
+	Int16		inWidthDelta,
+	Int16		inHeightDelta,
+	Boolean		inRefresh)
+{
+  LView::ResizeFrameBy(inWidthDelta,inHeightDelta,inRefresh);
+  ExecuteAttachments(msg_Resize, NULL);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippviewadapter.h	(revision 108)
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <LView.h>
+#include "piwdggen.h"
+
+class PIPPViewAdapter : public LView {
+public:
+						PIPPViewAdapter();
+						PIPPViewAdapter(	
+								const PIPPViewAdapter	&inOriginal);
+						PIPPViewAdapter(
+								const SPaneInfo		&inPaneInfo,
+								const SViewInfo		&inViewInfo);
+
+	virtual void        SetBinding(PIBindingKind left, PIBindingKind top, 
+                                   PIBindingKind right, PIBindingKind bottom);
+	virtual void		AdaptToSuperFrameSize(
+								Int32				inSurrWidthDelta,
+								Int32				inSurrHeightDelta,
+								Boolean				inRefresh);
+	virtual void		ResizeFrameBy(
+								Int16				inWidthDelta,
+								Int16				inHeightDelta,
+								Boolean				inRefresh);
+								
+protected:
+	Rect				piBindings;
+};
Index: /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.cc	(revision 108)
@@ -0,0 +1,107 @@
+#include "pippwindowmac.h"
+
+
+// ---------------------------------------------------------------------------
+//		¥ PIPPWindowMac
+// ---------------------------------------------------------------------------
+//	Default Constructor
+
+PIPPWindowMac::PIPPWindowMac()
+{
+  myPIWindow = NULL;
+}
+
+
+// ---------------------------------------------------------------------------
+//		¥ PIPPWindowMac(SWindowInfo&)
+// ---------------------------------------------------------------------------
+//	Construct Window from the data in a struct
+
+PIPPWindowMac::PIPPWindowMac(
+	const SWindowInfo	&inWindowInfo)
+:LWindow(inWindowInfo)
+{
+  myPIWindow = NULL;
+}
+
+
+// ---------------------------------------------------------------------------
+//		¥ PIPPWindowMac(ResIDT, Uint32, LCommander*)
+// ---------------------------------------------------------------------------
+//	Construct a Window from a WIND Resource with the specified attributes
+//	and SuperCommander
+
+PIPPWindowMac::PIPPWindowMac(
+	ResIDT		inWINDid,
+	Uint32		inAttributes,
+	LCommander	*inSuperCommander)
+:LWindow(inWINDid, inAttributes, inSuperCommander)
+{
+  myPIWindow = NULL;
+}
+
+
+// ---------------------------------------------------------------------------
+//		¥ PIPPWindowMac
+// ---------------------------------------------------------------------------
+//	Construct a Window from input parameters
+
+PIPPWindowMac::PIPPWindowMac(
+	LCommander		*inSuperCommander,
+	const Rect		&inGlobalBounds,
+	ConstStringPtr	inTitle,
+	Int16			inProcID,
+	Uint32			inAttributes,
+	WindowPtr		inBehind,
+	void			*inStorage)
+:LWindow(inSuperCommander, inGlobalBounds, inTitle,
+inProcID, inAttributes, inBehind, inStorage)
+{
+  myPIWindow = NULL;
+}
+
+
+// ---------------------------------------------------------------------------
+//		¥ PIPPWindowMac(LStream*)
+// ---------------------------------------------------------------------------
+//	Construct Window from the data in a stream
+
+PIPPWindowMac::PIPPWindowMac(
+	LStream	*inStream)
+:LWindow(inStream)
+{
+  myPIWindow = NULL;
+}
+
+
+// ---------------------------------------------------------------------------
+//		¥ ~PIPPWindowMac
+// ---------------------------------------------------------------------------
+//	Destructor
+
+PIPPWindowMac::~PIPPWindowMac()
+{
+}
+
+void
+PIPPWindowMac::AttemptClose()
+{
+  myPIWindow->Process(myPIWindow->BuildMsg(myPIWindow->Msg(),PIMsg_Close), myPIWindow, NULL) ;
+}
+
+
+const MessageT	msg_Resize			= 817;
+const MessageT	msg_Move			= 818;
+
+void PIPPWindowMac::DoSetPosition(Point inPosition)
+{
+    ExecuteAttachments(msg_Move, NULL);
+    LWindow::DoSetPosition(inPosition);
+}
+
+void PIPPWindowMac::DoSetBounds(const Rect &inBounds)
+{
+    ExecuteAttachments(msg_Resize, NULL);
+    LWindow::DoSetBounds(inBounds);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pippwindowmac.h	(revision 108)
@@ -0,0 +1,37 @@
+#include <LWindow.h>
+#include "piwindowmac.h"
+
+class PIPPWindowMac : public LWindow {
+public:
+	enum { class_ID = 'pwin' };
+	
+						PIPPWindowMac();
+						PIPPWindowMac(
+								const SWindowInfo	&inWindowInfo);
+						PIPPWindowMac(
+								ResIDT				inWINDid,
+								Uint32				inAttributes,
+								LCommander			*inSuperCommander);
+								
+						PIPPWindowMac(
+								LCommander			*inSuperCommander,
+								const Rect			&inGlobalBounds,
+								ConstStringPtr		inTitle,
+								Int16				inProcID,
+								Uint32				inAttributes,
+								WindowPtr			inBehind,
+								void				*inStorage = nil);
+								
+						PIPPWindowMac(
+								LStream				*inStream);
+	virtual				~PIPPWindowMac();
+
+	virtual void		DoSetPosition(
+								Point				inPosition);
+	virtual void		DoSetBounds(
+								const Rect			&inBounds);
+								
+	virtual void		AttemptClose();
+								
+	PIWindow* myPIWindow;
+};
Index: /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.cc	(revision 108)
@@ -0,0 +1,353 @@
+#include "generalfit.h"
+#include "piscdrawwdg.h"
+
+PIScDrawWdg::PIScDrawWdg(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+:PIBaseWdg(par, nom, sx, sy, px, py)
+{
+  mBDrw = new PIDrawer;
+  SetLimits(-1.,1.,-1.,1.,kAxeDirLtoR,kAxeDirDownUp);
+  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);  
+  FreeLimits();
+  xEndDrag = yEndDrag = xBegDrag = yBegDrag = 0;
+  SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true);
+
+  mTrlb = mTxw = NULL;
+  mTrW = NULL;
+  SetTextWin(NULL);
+  ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
+  ActivateMove(1);      //    "         "         "        "
+  ActivateButton(2);
+  ActivateMove(2);
+
+}
+
+PIScDrawWdg::~PIScDrawWdg()
+{
+  delete mBDrw;
+  if (mTrW)  delete mTrW;
+}
+
+
+void
+PIScDrawWdg::SetLimits(float xmin, float xmax, float ymin, float ymax,
+                       int axrl, int ayud, bool tmp)
+{
+  if (xmax <= xmin || ymax <= ymin)
+    return; // $CHECK$ exception ?
+  mBDrw->SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
+  SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
+  mPPos[0] = 0.5*(XMin()+XMax());
+  mPPos[1] = 0.5*(YMin()+YMax());
+  if (!tmp) {
+    xMinS = xmin;
+    xMaxS = xmax;
+    yMinS = ymin;
+    yMaxS = ymax;
+  }
+}
+
+void
+PIScDrawWdg::Resize()
+{
+  //  SetSpan();
+  //  Refresh();  $CHECK$ Faut-il appeler ? Reza 08/02/98
+}
+
+PIGraphicUC*
+PIScDrawWdg::SetSpan(PIGraphicGen* g)
+{
+  int x0, y0, dx, dy;
+  x0 = (int)(XSize()*0.12);
+  y0 = (int)(YSize()*0.12);
+  dx = (int)(XSize()*0.76+0.5);
+  dy = (int)(YSize()*0.76+0.5);
+  return(mBDrw->SetDrwWdg(this, x0, y0, dx, dy, g));
+}
+
+void
+PIScDrawWdg::DrawAxes(PIGraphicUC* g, int flags)
+{
+  mBDrw->DrawAxes(g, flags);
+}
+
+
+void
+PIScDrawWdg::SetAxesFlags(int flags)
+{
+  mBDrw->SetAxesFlags(flags);
+}
+  
+
+int 
+PIScDrawWdg::AddScDrawer(PIDrawer* d, bool ad)
+{
+  return(AddDrawer(d, true, ad));
+}
+
+
+void
+PIScDrawWdg::SetTextWin(PILabel * tw, bool trw, int tx, int ty)
+{
+mTxw = tw;
+if (trw)
+  {
+  if (mTrW)  mTrW->SetSize(tx, ty);
+  else
+    {
+    mTrW = new PIWindow(this, "Point", PIWK_transient, tx, ty, 0, 0);
+    mTrW->SetAutoDelChilds(true);
+    mTrlb = new PILabel(mTrW, "PointCoord", tx, ty, 0, 0);
+    mTrlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
+    }
+  }
+else
+  if (mTrW) { delete mTrW; mTrW = NULL;  mTrlb = NULL; }
+
+return;
+}
+
+void
+PIScDrawWdg::Draw(PIGraphic* g)
+{
+  EraseWindow();
+  if (! LimitsFixed() ) {  //  On met a jour les limites a partir du premier Drawer
+    PIDrawer* drw = GetDrawer(0);
+    if (drw != NULL)   {    
+      drw->UpdateSize();
+      SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
+      }
+    else SetLimits(0., 1., 0., 1.);
+    }
+  PIGraphicUC* guc = SetSpan(g);
+  DrawAxes(guc);
+  DrawSelf(guc, -9.e19, -9.e19, 9.e19, 9.e19);
+}
+
+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(0);
+    if (drw != NULL)   {    
+      drw->UpdateSize();
+      SetLimits(drw->XMin(), drw->XMax(), drw->YMin(), drw->YMax());
+      }
+    else SetLimits(0., 1., 0., 1.);
+    }
+  float xmin,xmax,ymin,ymax;
+  PIGraphicUC* guc = SetSpan(g);
+  guc->GrC2UC(x0, y0, xmin, ymin);
+  guc->GrC2UC(x0+dx, y0+dy, xmax, ymax);
+  if (xmin > xmax) swap(xmin,xmax);
+  if (ymin > ymax) swap(ymin,ymax);
+  DrawAxes(guc);
+  DrawSelf(guc, xmin, ymin, xmax, ymax);
+}
+
+
+void
+PIScDrawWdg::DrawSelf(PIGraphicUC*, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
+{
+return;
+}
+
+
+// Gestion affichage coordonnees du point 
+
+
+string   PIScDrawWdg::GetClickText(float x, float y) 
+// Donne le texte a afficher pour position x,y  
+{
+  char buff[128];
+  sprintf(buff, "X= %g  Y= %g",  x, y);
+  return((string)buff);
+}
+
+void
+PIScDrawWdg::But1Press(int x, int y)
+{
+  if (UpdateText(x, y))
+     {
+     if (mTrW)
+       { 
+       int tpx, tpy;
+       GetScreenPos(tpx, tpy);       
+       tpy -= (mTrW->YSize()+5);
+       if (tpy < 0)  tpy = 0;
+       mTrW->SetPos(tpx, tpy);
+       mTrW->Show();
+       }
+     SelPointerShape(PI_CrossPointer);
+     }
+  Send(Msg(), PIMsg_Active);
+
+}
+
+void
+PIScDrawWdg::Ptr1Move(int x, int y)
+{
+  UpdateText(x, y);
+}
+
+void
+PIScDrawWdg::But1Release(int x, int y)
+{
+  if (UpdateText(x, y)) 
+    SelPointerShape(PI_ArrowPointer);
+  if (mTrW)  mTrW->Hide();
+}
+
+bool
+PIScDrawWdg::UpdateText(int xp, int yp)
+{
+
+  float dx, dy;
+  mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy); 
+  mPPos[0] = dx;  mPPos[1] = dy; 
+  if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
+  
+  string ctxt =  GetClickText(dx, dy);
+
+  if (mTxw)
+    mTxw->SetLabel(ctxt);
+  if (mTrlb)
+    mTrlb->SetLabel(ctxt);
+  return(true);
+
+}
+
+// Gestion du zoom
+void
+PIScDrawWdg::But2Press(int x, int y)
+{
+  xEndDrag = xBegDrag = x;
+  yEndDrag = yBegDrag = y;
+  cForCol = mWGrC->GetForeground();
+  cGOmod  = mWGrC->GetGOMode();
+  cPointer = GetPointerShape();
+  cLatt = mWGrC->GetLineAtt();
+  SelPointerShape(PI_CrossPointer);
+  mWGrC->SelForeground(PI_Magenta);
+  mWGrC->SelGOMode(PI_GOXOR);
+  mWGrC->SelLine(PI_ThinLine);
+  Send(Msg(), PIMsg_Active);
+}
+
+void
+PIScDrawWdg::But2Release(int /*x*/, int /*y*/)
+{
+
+  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
+
+  mWGrC->SelForeground(cForCol);
+  mWGrC->SelGOMode(cGOmod);
+  SelPointerShape(cPointer); 
+  mWGrC->SelLine(cLatt); 
+  
+  if (xBegDrag == xEndDrag || yBegDrag == yEndDrag)
+    SetLimits(xMinS, xMaxS, yMinS, yMaxS, kAxeDirSame, kAxeDirSame );
+  else {
+    float xl,yl,xh,yh;
+    mBDrw->GetGraphicUC()->GrC2UC(xBegDrag, yBegDrag, xl, yl);
+    mBDrw->GetGraphicUC()->GrC2UC(xEndDrag, yEndDrag, xh, yh);
+    if (xl > xh) swap(xl, xh);
+    if (yl > yh) swap(yl, yh);
+    SetLimits(xl,xh,yl,yh, kAxeDirSame, kAxeDirSame, true);
+  }
+  
+  Refresh();
+}
+
+void
+PIScDrawWdg::Ptr2Move(int x, int y)
+{
+  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
+  xEndDrag = x;
+  yEndDrag = y;
+  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
+}
+
+
+//================================================================
+// 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: /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piscdrawwdg.h	(revision 108)
@@ -0,0 +1,114 @@
+#ifndef PISCDRAWWDG_H
+#define PISCDRAWWDG_H
+
+#include <vector>
+
+#include "pisysdep.h"
+#include PIBWDG_H
+#include PISTDWDG_H
+#include PIWIN_H
+#include "pidrawer.h"
+
+
+
+
+class PIScDrawWdg : public PIBaseWdg {
+public:
+  enum {ClassId = 5300};
+
+                     PIScDrawWdg(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PIScDrawWdg();
+
+  virtual long       kind() {return ClassId; }
+
+  virtual void       Resize();
+  
+  virtual void       Draw(PIGraphic* g);
+  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+  virtual void       DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+  
+  void               SetLimits(float xmin, float xmax, float ymin, float ymax, 
+                               int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false);
+
+  void               SetAxesFlags(int flags=kAxesDflt);
+  void               DrawAxes(PIGraphicUC* g, int flags = -1);
+
+  int                AddScDrawer(PIDrawer*, bool ad=false);   // Ajoute un Drawer en auto 
+
+  PIDrawer*          BaseDrawer() { return mBDrw; };
+
+  float XMin() const {return mBDrw->XMin();}
+  float XMax() const {return mBDrw->XMax();}
+  float YMin() const {return mBDrw->YMin();}
+  float YMax() const {return mBDrw->YMax();}
+  float XPPos() const { return mPPos[0]; }
+  float YPPos() const { return mPPos[1]; }
+  int    LimitsFixed() const {return mBDrw->LimitsFixed();}
+  void   FreeLimits() { mBDrw->FreeLimits(); }
+    
+
+  virtual string     GetClickText(float x, float y); // Donne le texte a afficher pour position x,y
+
+  void               SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30);
+
+  virtual void       But1Press(int x, int y);
+  virtual void       But1Release(int x, int y);
+  virtual void       Ptr1Move(int x, int y);
+
+  virtual void       But2Press(int x, int y);
+  virtual void       But2Release(int x, int y);
+  virtual void       Ptr2Move(int x, int y);
+  
+protected:
+       PIGraphicUC*  SetSpan(PIGraphicGen* g);
+
+  float xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
+  float mPPos[2];               // Position click souris X,Y
+
+  PIDrawer* mBDrw;
+  
+  int xBegDrag, yBegDrag;
+  int xEndDrag, yEndDrag;
+  PIColors cForCol;
+  PIGOMode cGOmod;  
+  PIPointer cPointer;
+  PILineAtt cLatt;
+  PILabel * mTxw;  
+  PILabel * mTrlb;
+  PIWindow * mTrW;
+
+
+private:
+  bool  UpdateText(int xp, int yp);
+};
+
+
+
+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: /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.cc	(revision 108)
@@ -0,0 +1,133 @@
+#include "pistdwdggen.h"
+
+/************* PILabelGen ************/
+
+//++
+// Class	PILabel
+// Lib		PI
+// include	pistdwdggen.h
+//
+//	Composant graphique simple permettant d'afficher une étiquette (texte).
+//	"PILabelGen" définit l'interface (classe virtuelle pure). Les objets 
+//	instanciés doivent être de la classe "PILabel" déclaré dans le fichier
+//	entête "PISTDWDG_H".
+//--
+//++
+// Links	Parents
+// PIWdg
+//--
+
+//++
+// Titre	Constructeur, méthodes
+//--
+//++
+// PILabel(PIContainerGen* par, char* nom, int sx=10, int sy=10, int px=0, int py=0)
+//	Création d'un objet PILabel ayant un contenu (étiquette) identique à "nom".
+// SetLabel(string const& lab)
+//	Modifie l'étiquette affichée par l'objet 
+//--
+
+
+
+
+PILabelGen::PILabelGen(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{}
+
+PILabelGen::~PILabelGen()
+{}
+
+/************* PIButtonGen ************/
+//++
+// Class	PIButton
+// Lib		PI
+// include	pistdwdggen.h
+//
+//	Composant graphique de type bouton .
+//	"PIButtonGen" définit l'interface (classe virtuelle pure). Les objets 
+//	instanciés doivent être de la classe "PIButton" déclaré dans le fichier
+//	entête "PISTDWDG_H". Lors de l'activation, le message de l'objet complété
+//	par le modifier "PIMsg_Click" est envoyé ("Send()"). Le champ "data" 
+//	contient le pointeur "NULL".
+//--
+//++
+// Links	Parents
+// PIWdg
+//--
+
+//++
+// Titre	Constructeur, méthodes
+//--
+//++
+// PIButton(PIContainerGen* par, char* nom, PIMessage msg = PIMsg_Click, int sx=10, int sy=10, int px=0, int py=0)
+//	Création d'un objet PIButton avec une étiquette identique à "nom".
+// SetLabel(string const& lab)
+//	Modifie l'étiquette affichée par l'objet bouton.
+//--
+
+
+
+PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py, PIBtnSign bsgn)
+: PIWdg(par, nom, sx, sy, px, py)
+{
+SetMsg(msg);
+mSgn = bsgn;
+}
+
+PIButtonGen::~PIButtonGen()
+{}
+
+
+
+/************* PITextGen ************/
+
+PITextGen::PITextGen(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{}
+
+PITextGen::~PITextGen()
+{}
+
+
+
+
+/************* PICheckBoxGen ************/
+
+PICheckBoxGen::PICheckBoxGen(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{
+SetMsg(msg);
+}
+
+PICheckBoxGen::~PICheckBoxGen()
+{}
+
+
+/************* PIScaleGen ************/
+
+PIScaleGen::PIScaleGen(PIContainerGen *par, char *nom, PIMessage msg, 
+                       bool /*horiz*/, int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) 
+{
+SetMsg(msg);
+}
+
+PIScaleGen::~PIScaleGen()
+{}
+
+/************* PIScrollBarGen ************/
+
+PIScrollBarGen::PIScrollBarGen(PIContainerGen *par, char *nom, PIMessage msg, 
+                       bool /*horiz*/, int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) 
+{
+SetMsg(msg);
+}
+
+PIScrollBarGen::~PIScrollBarGen()
+{}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdggen.h	(revision 108)
@@ -0,0 +1,125 @@
+#ifndef PISTDWDGGEN_H_SEEN
+#define PISTDWDGGEN_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include PIWDG_H
+
+class PILabelGen : public PIWdg {
+public:
+  enum {ClassId = 1001};
+
+                     PILabelGen(PIContainerGen* par, char* nom,
+                                 int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PILabelGen();
+
+  virtual long       kind() {return ClassId; }
+};
+
+//  Les differents types de boutons avec un signe dessus ... 
+enum PIBtnSign {  PIBtn_Label=0, PIBtn_ArrowUp=1, PIBtn_ArrowDown=2,  
+                                 PIBtn_ArrowLeft=3, PIBtn_ArrowRight=4 };
+
+class PIButtonGen : public PIWdg
+{
+public:
+  enum {ClassId = 1010};
+
+                     PIButtonGen(PIContainerGen* par, char* nom, 
+                                 PIMessage msg = PIMsg_Click,
+                                 int sx=10, int sy=10, int px=0, int py=0,
+                                 PIBtnSign bsgn = PIBtn_Label);
+  virtual            ~PIButtonGen();
+
+  virtual long       kind() {return ClassId; }
+  virtual void       ActivatePress(bool acp=false)=0;
+
+protected:
+  PIBtnSign mSgn;
+};
+
+
+class PITextGen : public PIWdg
+{
+public:
+
+  enum {ClassId = 1020};
+
+  		     PITextGen(PIContainerGen* par, char* nom,
+         		       int sx=10, int sy=10, int px=0, int py=0);
+  virtual	     ~PITextGen();
+  virtual void       SetText(string const&) = 0;
+  virtual string     GetText() const = 0;
+
+  virtual void       SetMutiLineMode(bool mlm=false) = 0;
+  virtual void       SetTextEditable(bool te=true) = 0;
+
+  virtual long       kind() {return ClassId; }
+};
+
+
+
+class PICheckBoxGen : public PIWdg
+{
+public:
+
+  enum {ClassId = 1030};
+
+                     PICheckBoxGen(PIContainerGen* par, char* nom, 
+                                  PIMessage msg = PIMsg_Click,
+                                  int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PICheckBoxGen()=0;
+  virtual void       SetState(bool st=false)=0;
+  virtual bool       GetState()=0;
+  
+  virtual long       kind() {return ClassId; }
+
+protected:
+
+};
+
+
+class PIScaleGen : public PIWdg
+{
+public:
+  enum {ClassId = 1040};
+
+                     PIScaleGen(PIContainerGen* par, char* nom, 
+                                PIMessage msg = PIMsg_DataChanged, bool horiz=true,
+                                int sx=100, int sy=10, int px=0, int py=0);
+  virtual            ~PIScaleGen();
+
+  virtual void       SetMinMax(int min, int max) = 0;
+  virtual void       SetValue(int val) = 0;
+  virtual int        GetValue() = 0; 
+
+  virtual long       kind() {return ClassId; }
+
+protected:
+
+};
+
+class PIScrollBarGen : public PIWdg
+{
+public:
+  enum {ClassId = 1050};
+
+                     PIScrollBarGen(PIContainerGen* par, char* nom, 
+                                    PIMessage msg=PIMsg_DataChanged, bool vert=true,
+                                    int sx=10, int sy=100, int px=0, int py=0);
+  virtual            ~PIScrollBarGen();
+
+  virtual void       ActivateDrag(bool acd=false) = 0;
+  virtual void       SetMinMax(int min, int max) = 0;
+  virtual void       SetValue(int val) = 0;
+  virtual int        GetValue() = 0; 
+  virtual void       SetSlSize(int sz) = 0;
+  virtual int        GetSlSize() = 0;
+
+  virtual long       kind() {return ClassId; }
+
+protected:
+
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.cc	(revision 108)
@@ -0,0 +1,310 @@
+#include "pistdwdgmac.h"
+#include <LString.h>
+#include <PP_Messages.h>
+
+/************* PILabelMac ************/
+#include <LCaption.h>
+
+PILabelMac::PILabelMac(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PILabelGen(par, nom, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LCaption(mPaneInfo, titre, 130);
+}
+
+PILabelMac::~PILabelMac()
+{}
+
+
+/************* PIButtonMac ************/
+#include <LStdControl.h>
+
+PIButtonMac::PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py, PIBtnSign bsgn)
+: PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdButton(mPaneInfo, msg_Click, 130, titre);
+  ((LStdButton*)mPane)->AddListener(this);
+}
+
+PIButtonMac::~PIButtonMac()
+{}
+
+void
+PIButtonMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_Click)
+    Send(myMsg, PIMsg_Press);
+}
+
+
+/************* PITextMac ************/
+#include <LEditField.h>
+
+PITextMac::PITextMac(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PITextGen(par, nom, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LEditField(mPaneInfo, titre, 130, 255, true, true, NULL, LCommander::GetTopCommander());
+}
+
+PITextMac::~PITextMac()
+{}
+
+void
+PITextMac::SetText(string const& s)
+{
+  SetLabel(s);
+}
+
+string
+PITextMac::GetText() const
+{
+  Str255 desc;
+  mPane->GetDescriptor(desc);
+  p2cstr(desc);
+  return (char*) desc;
+}
+
+/* --Methode-- */
+void PITextMac::SetMutiLineMode(bool /*mlm*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PITextMac::SetTextEditable(bool te)
+{
+if (te)
+  { mPane->Enable(); }
+else
+  { mPane->Disable(); }
+return;
+}
+
+/************* PIScaleMac ************/
+static ControlActionUPP	sSBarAction = nil;
+
+
+PIScaleMac::PIScaleMac(PIContainerGen* par, char* nom, PIMessage msg,
+                       bool horiz, int sx, int sy, int px, int py)
+: PIScaleGen(par, nom, msg, horiz, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10,
+						  scrollBarProc, 130, titre, (Int32) this);
+  ((LStdControl*)mPane)->AddListener(this);
+  
+  if (sSBarAction == nil) {	// Allocate UPP if necessary
+	sSBarAction = NewControlActionProc((ProcPtr) SBarAction);
+  }
+  ((LStdControl*)mPane)->SetActionProc(sSBarAction);
+}
+
+PIScaleMac::~PIScaleMac()
+{}
+
+void
+PIScaleMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_ThumbDragged)
+    Send(myMsg, PIMsg_DataChanged);
+}
+
+void
+PIScaleMac::SetMinMax(int min, int max)
+{
+  ((LStdControl*)mPane)->SetMinValue(min);
+  ((LStdControl*)mPane)->SetMaxValue(max);
+}
+
+void
+PIScaleMac::SetValue(int val)
+{
+  StopListening();
+  ((LStdControl*)mPane)->SetValue(val);
+  StartListening();
+}
+
+int
+PIScaleMac::GetValue()
+{
+  return ((LStdControl*)mPane)->GetValue();
+}
+
+pascal void
+PIScaleMac::SBarAction(
+	ControlHandle	inMacControl,
+	Int16			inPart)
+{
+	PIScaleMac		*theScroller =
+							(PIScaleMac *) GetControlReference(inMacControl);
+	theScroller->HandleScroll(inPart);
+}
+
+void
+PIScaleMac::HandleScroll(
+	const Int16		inPart)
+{
+    int delta;
+	switch (inPart) {				// Determine how much to scroll
+	
+		case kControlUpButtonPart:	// Scroll left one unit
+			delta = -1;
+			break;
+			
+		case kControlDownButtonPart:	// Scroll right one unit
+			delta = 1;
+			break;
+			
+		case kControlPageUpPart:		// Scroll left by Frame width
+										//   less one unit of overlap
+			delta = -10;
+			break;
+			
+		case kControlPageDownPart:		// Scroll right by Frame width
+										//   less one unit of overlap
+			delta = 10;
+			break;
+	}
+	
+	if (delta != 0) {
+	    SetValue(GetValue()+delta);
+	}
+}
+
+/************* PIScrollBarMac ************/
+static ControlActionUPP	sSBarAction2 = nil;
+
+
+PIScrollBarMac::PIScrollBarMac(PIContainerGen* par, char* nom, PIMessage msg,
+                       bool vert, int sx, int sy, int px, int py)
+: PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10,
+						  scrollBarProc, 130, titre, (Int32) this);
+  ((LStdControl*)mPane)->AddListener(this);
+  
+  if (sSBarAction2 == nil) {	// Allocate UPP if necessary
+	sSBarAction2 = NewControlActionProc((ProcPtr) SBarAction);
+  }
+  ((LStdControl*)mPane)->SetActionProc(sSBarAction2);
+}
+
+PIScrollBarMac::~PIScrollBarMac()
+{}
+
+void
+PIScrollBarMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_ThumbDragged)
+    Send(myMsg, PIMsg_DataChanged);
+}
+
+void
+PIScrollBarMac::SetMinMax(int min, int max)
+{
+  ((LStdControl*)mPane)->SetMinValue(min);
+  ((LStdControl*)mPane)->SetMaxValue(max);
+}
+
+void
+PIScrollBarMac::SetValue(int val)
+{
+  StopListening();
+  ((LStdControl*)mPane)->SetValue(val);
+  StartListening();
+}
+
+int
+PIScrollBarMac::GetValue()
+{
+  return ((LStdControl*)mPane)->GetValue();
+}
+
+pascal void
+PIScrollBarMac::SBarAction(
+	ControlHandle	inMacControl,
+	Int16			inPart)
+{
+	PIScrollBarMac		*theScroller =
+							(PIScrollBarMac *) GetControlReference(inMacControl);
+	theScroller->HandleScroll(inPart);
+}
+
+void
+PIScrollBarMac::HandleScroll(
+	const Int16		inPart)
+{
+    int delta;
+	switch (inPart) {				// Determine how much to scroll
+	
+		case kControlUpButtonPart:	// Scroll left one unit
+			delta = -1;
+			break;
+			
+		case kControlDownButtonPart:	// Scroll right one unit
+			delta = 1;
+			break;
+			
+		case kControlPageUpPart:		// Scroll left by Frame width
+										//   less one unit of overlap
+			delta = -10;
+			break;
+			
+		case kControlPageDownPart:		// Scroll right by Frame width
+										//   less one unit of overlap
+			delta = 10;
+			break;
+	}
+	
+	if (delta != 0) {
+	    SetValue(GetValue()+delta);
+	}
+}
+
+/************* PICheckBoxMac ************/
+#include <LStdControl.h>
+
+PICheckBoxMac::PICheckBoxMac(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py)
+: PICheckBoxGen(par, nom, msg, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdCheckBox(mPaneInfo, msg_Click, 0, 130, titre);
+  ((LStdCheckBox*)mPane)->AddListener(this);
+}
+
+PICheckBoxMac::~PICheckBoxMac()
+{}
+
+void
+PICheckBoxMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_Click)
+    Send(myMsg, PIMsg_DataChanged);
+}
+
+void
+PICheckBoxMac::SetState(bool st)
+{
+  StopListening();
+  ((LStdCheckBox*)mPane)->SetValue(st ? 1 : 0);
+  StartListening();
+}
+ 
+bool
+PICheckBoxMac::GetState()
+{
+  return ((LStdCheckBox*)mPane)->GetValue();
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdgmac.h	(revision 108)
@@ -0,0 +1,103 @@
+#ifndef PISTDWDGMAC_H_SEEN
+#define PISTDWDGMAC_H_SEEN
+
+#include "pistdwdggen.h"
+
+
+class PILabelMac : public PILabelGen
+{
+public:
+                     PILabelMac(PIContainerGen *par, char *nom,
+                                 int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PILabelMac();
+};
+
+class PIButtonMac : public PIButtonGen
+{
+public:
+                     PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg = PIMsg_Click,
+                                 int sx=10, int sy=10, int px=0, int py=0,
+                                 PIBtnSign bsgn = PIBtn_Label);
+  virtual           ~PIButtonMac();
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void       ActivatePress(bool=false) {}
+};
+
+class PITextMac : public PITextGen
+{
+public:
+                     PITextMac(PIContainerGen *par, char *nom,
+                               int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PITextMac();
+
+  virtual void       SetMutiLineMode(bool mlm=false);
+  virtual void       SetTextEditable(bool te=true);
+
+  virtual void       SetText(string const&);
+  virtual string     GetText() const;
+};
+
+class PIScaleMac : public PIScaleGen
+{
+public:
+                     PIScaleMac(PIContainerGen* par, char* nom, 
+                                PIMessage msg=PIMsg_DataChanged, bool horiz=true,
+                                int sx=100, int sy=10, int px=0, int py=0);
+                    ~PIScaleMac();
+
+  virtual void       SetMinMax(int min, int max);
+  virtual void       SetValue(int val);
+  virtual int        GetValue(); 
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void	     HandleScroll(const Int16 inPart);
+  
+protected:
+  static pascal void SBarAction(ControlHandle inMacControl,
+								Int16 inPart);
+};
+
+class PIScrollBarMac : public PIScrollBarGen
+{
+public:
+                     PIScrollBarMac(PIContainerGen* par, char* nom, 
+                                PIMessage msg=PIMsg_DataChanged, bool vert=true,
+                                int sx=100, int sy=10, int px=0, int py=0);
+                    ~PIScrollBarMac();
+
+  virtual void       ActivateDrag(bool /*acd*/=false) {};
+  virtual void       SetMinMax(int min, int max);
+  virtual void       SetValue(int val);
+  virtual int        GetValue(); 
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void	     HandleScroll(const Int16 inPart);
+  virtual void       SetSlSize(int sz) {msz = sz;}
+  virtual int        GetSlSize() {return msz;}
+protected:
+  static pascal void SBarAction(ControlHandle inMacControl,
+								Int16 inPart);
+  int msz;
+};
+
+
+class PICheckBoxMac : public PICheckBoxGen
+{
+public:
+                     PICheckBoxMac(PIContainerGen* par, char* nom, 
+                                   PIMessage msg = PIMsg_Click,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PICheckBoxMac();
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void       SetState(bool st=false);
+  virtual bool       GetState();
+};
+
+
+ 
+typedef PILabelMac   PILabel;
+typedef PIButtonMac  PIButton;
+typedef PITextMac    PIText;
+typedef PIScaleMac   PIScale;
+typedef PIScrollBarMac PIScrollBar;
+typedef PICheckBoxMac PICheckBox;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.cc	(revision 108)
@@ -0,0 +1,595 @@
+#include<stdlib.h>
+#include<string.h>
+
+#include "pisysdep.h"
+#include PISTDWDG_H
+
+// ------- Pb de gestion du focus-keyboard  Motif-PIBaseWdg -------
+// ** Note du 26/02/98 - Reza 
+// Je desactive pour le moment XmNnavigationType et XmNtraversalOn
+// afin d'ameliorer la gestion du focus-keyboard entre Widget Motif
+// et objet Peida - Cela semble avoir un effet secondaire - 
+// Il faut que la souris reste dans le widget Text pour taper dedans
+// ** Note du 30/04/98 - Reza
+// J'ai modifie le mecanisme de gestion des evenements pour PIBaseWdg
+// en passant par un EventHandler - Le probleme de gestion du 
+// focus-keyboard n'a pour autant pas ete resolu
+// Je reactive XmNtraversalOn pour les PIText - Le probleme 
+// d'attribution du focus-keyboard au PIBaseWdg reste si on 
+// met PIText et un PIBaseWdg ds un meme conteneur
+
+
+/************* PILabelX ************/
+#include <Xm/Label.h>
+
+
+/* --Methode-- */
+PILabelX::PILabelX(PIContainerGen *par, char *nom,
+                   int sx, int sy, int px, int py)
+: PILabelGen(par, nom, sx, sy, px, py)
+{
+Arg warg[3];
+int n = 0;
+CreateXtWdg(nom, xmLabelWidgetClass, NULL, sx, sy, px, py);
+SetBorderWidth(0);
+XtSetArg(warg[n], XmNrecomputeSize, FALSE); n++;
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+XtSetValues(XtWdg(), warg, n);
+Manage();
+}
+
+/* --Methode-- */
+PILabelX::~PILabelX()
+{}
+
+
+/************* PIButtonX ************/
+#include <Xm/PushB.h>
+#include <Xm/ArrowB.h>
+
+// Fonctions privees (CallBack)
+static void button_action(Widget w, XtPointer *usd, XtPointer *calld);
+static void button_press(Widget w, XtPointer *usd, XmAnyCallbackStruct *calld);
+
+/* Nouvelle-Fonction */
+void  button_action(Widget , XtPointer *usd, XtPointer *)
+{
+PIButtonX *pib;
+pib = (PIButtonX *) usd ;
+pib->Send(pib->Msg(),PIMsg_Click,NULL);
+return;
+}
+
+/* Nouvelle-Fonction */
+void  button_press(Widget, XtPointer *usd, XmAnyCallbackStruct *calld)
+{
+PIButtonX *pib;
+pib = (PIButtonX *) usd ;
+pib->Send(pib->Msg(),PIMsg_Press,NULL);
+pib->myevt = *(calld->event);
+pib->myevt.type = pib->myevt.xbutton.type = ButtonRelease;
+pib->myevt.xbutton.serial += 10;
+
+return;
+}
+
+
+/* --Methode-- */
+PIButtonX::PIButtonX(PIContainerGen *par, char *nom, PIMessage msg, 
+                     int sx, int sy, int px, int py, PIBtnSign bsgn)
+: PIButtonGen(par, nom, msg, sx, sy, px, py, bsgn)
+{
+
+Arg  warg[6];
+int n = 0;
+
+XtSetArg(warg[n],XmNhighlightThickness, 0);  n++;
+XtSetArg(warg[n], XmNrecomputeSize, FALSE);  n++;
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+
+if (bsgn == PIBtn_Label)
+  CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
+else
+  {
+  CreateXtWdg(nom, xmArrowButtonWidgetClass, NULL, sx, sy, px, py);
+  switch (bsgn)
+    {
+    case PIBtn_ArrowUp :
+      XtSetArg(warg[n], XmNarrowDirection, XmARROW_UP);  n++;
+      break;
+    case PIBtn_ArrowDown :
+      XtSetArg(warg[n], XmNarrowDirection, XmARROW_DOWN);  n++;
+      break;
+    case PIBtn_ArrowLeft :
+      XtSetArg(warg[n], XmNarrowDirection, XmARROW_LEFT);  n++;
+      break;
+    case PIBtn_ArrowRight :
+      XtSetArg(warg[n], XmNarrowDirection, XmARROW_RIGHT);  n++;
+      break;
+    }
+  }
+
+XtSetValues(XtWdg(), warg, n);
+XtAddCallback(XtWdg(), XmNactivateCallback, 
+              (XtCallbackProc)button_action, (XtPointer)this);
+
+mAcP = false;
+SetBorderWidth(0);
+Manage();
+}
+
+/* --Methode-- */
+PIButtonX::~PIButtonX()
+{}
+
+/* --Methode-- */
+void PIButtonX::ActivatePress(bool acp)
+{
+if (mAcP == acp)  return; 
+    
+if (mAcP)
+  XtRemoveCallback(XtWdg(), XmNarmCallback, 
+                   (XtCallbackProc)button_press, (XtPointer)this);
+else 
+  XtAddCallback(XtWdg(), XmNarmCallback, 
+                (XtCallbackProc)button_press, (XtPointer)this);
+mAcP = acp;
+return;
+}       
+
+/* --Methode-- */
+void PIButtonX::ReleaseButton()
+{
+XPutBackEvent(myevt.xbutton.display, &myevt);
+return;
+}
+
+
+/************* PITextX ************/
+#include <Xm/Text.h>
+
+/* --Methode-- */
+PITextX::PITextX(PIContainerGen *par, char *nom,
+                 int sx, int sy, int px, int py)
+: PITextGen(par, nom, sx, sy, px, py)
+{
+Arg warg[3];
+int n = 0;
+CreateXtWdg(nom, xmTextWidgetClass, NULL, sx, sy, px, py);
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+// XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+XtSetValues(XtWdg(), warg, n);
+SetMutiLineMode(false);
+SetTextEditable(true);
+Manage();
+}
+
+/* --Methode-- */
+PITextX::~PITextX()
+{}
+
+/* --Methode-- */
+void PITextX::SetText(string const& s)
+{
+XmTextSetString(XtWdg(), (char *)s.c_str());
+return;
+}
+
+/* --Methode-- */
+string PITextX::GetText() const
+{
+char *txtb;
+txtb = XmTextGetString(XtWdg());
+string s(txtb);
+XtFree(txtb);
+return(s);
+}
+
+/* --Methode-- */
+void PITextX::SetMutiLineMode(bool mlm)
+{
+Arg  warg[2];
+int n = 0;
+
+if (mlm)
+  { XtSetArg(warg[n],XmNeditMode, XmMULTI_LINE_EDIT);  n++; }
+else
+  { XtSetArg(warg[n],XmNeditMode, XmSINGLE_LINE_EDIT);  n++; }
+
+XtSetValues(XtWdg(), warg, n);
+return;
+}
+
+/* --Methode-- */
+void PITextX::SetTextEditable(bool te)
+{
+Arg  warg[2];
+int n = 0;
+
+if (te)
+  { XtSetArg(warg[n],XmNeditable, TRUE);  n++; }
+else
+  { XtSetArg(warg[n],XmNeditable, FALSE);  n++; }
+
+XtSetValues(XtWdg(), warg, n);
+return;
+}
+
+// Fonction privee (CallBack)
+static void text_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+void  text_action(Widget, XtPointer *usd, XtPointer *)
+{
+PIText *pit;
+
+pit = (PIText *) usd ;
+pit->Send(pit->Msg(), PIMsg_DataChanged, NULL);
+}
+
+
+/* --Methode-- */
+void PITextX::SetMsg(PIMessage msg)
+{
+
+if (Msg() && !msg)
+  XtRemoveCallback(XtWdg(), XmNactivateCallback, 
+                   (XtCallbackProc)text_action, (XtPointer)this);
+if (!Msg() && msg)
+  XtAddCallback(XtWdg(), XmNactivateCallback, 
+                (XtCallbackProc)text_action, (XtPointer)this);
+
+PIWdg::SetMsg(msg);
+}
+
+
+/************* PICheckBoxX ************/
+#include <Xm/ToggleB.h>
+
+// Fonction prive (CallBack)
+static void toggb_action(Widget w, XtPointer *usd, XmToggleButtonCallbackStruct* calld);
+
+//  Variable globale d'etat de checkbox pour Send(...)
+static bool toggb_state = false;
+
+/* Nouvelle-Fonction */
+void  toggb_action(Widget , XtPointer *usd, XmToggleButtonCallbackStruct* calld)
+{
+PICheckBoxX *picb;
+picb = (PICheckBoxX *) usd ;
+if (calld->set == True)   picb->mSt = true;
+else picb->mSt = false;
+toggb_state = picb->mSt;
+picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)(&toggb_state));
+return;
+}
+
+/* --Methode-- */
+PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py)
+: PICheckBoxGen(par, nom, msg, sx, sy, px, py)
+{
+CreateXtWdg(nom, xmToggleButtonWidgetClass, NULL, sx, sy, px, py);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback,
+             (XtCallbackProc) toggb_action, (XtPointer)this);
+Arg warg[4];
+int n = 0;
+XtSetArg(warg[n],XmNhighlightThickness, 0); n++;
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+XtSetValues(XtWdg(), warg, n);
+SetState(false);
+Manage();
+}
+
+
+/* --Methode-- */
+PICheckBoxX::~PICheckBoxX()
+{}
+
+
+/* --Methode-- */
+void PICheckBoxX::SetState(bool st)
+{
+Arg warg[2];
+mSt = st;
+if (st) XtSetArg(warg[0],XmNset, True);
+else XtSetArg(warg[0],XmNset, False);
+XtSetValues(XtWdg(), warg, 1);
+return;
+}
+
+/* --Methode-- */
+bool PICheckBoxX::GetState()
+{
+return(mSt);
+}
+
+
+/************* PIScaleX ************/
+#include <Xm/Scale.h>
+
+// Fonction prive (CallBack)
+static void scale_action(Widget w, XtPointer *usd, 
+                         XmScaleCallbackStruct *calld);
+// Variable globale pour contenir valeur de Scale a l'appel de Send;
+static int scale_value=0;
+ 
+void  scale_action(Widget, XtPointer *usd, 
+                         XmScaleCallbackStruct *calld)
+{
+PIScale *pis;
+
+pis = (PIScale *) usd ;
+pis->CBSetVal(calld->value);
+scale_value = calld->value;
+pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)(&scale_value));
+return;
+}
+
+/* --Methode-- */
+PIScaleX::PIScaleX(PIContainerGen *par, char *nom, PIMessage msg,
+                   bool horiz, int sx, int sy, int px, int py)
+: PIScaleGen(par, nom, msg, horiz, sx, sy, px, py)
+{
+int n=0;
+Arg warg[8];
+CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py);
+XtSetArg(warg[n], XmNshowValue, TRUE); n++;
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+if (horiz)
+  {
+  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
+  }
+else
+  { 
+  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_TOP); n++;
+  }
+XtSetArg(warg[n], XmNscaleWidth, sx); n++;
+XtSetArg(warg[n], XmNscaleHeight, sy); n++;
+XtSetArg(warg[n], XmNstringDirection, XmSTRING_DIRECTION_R_TO_L); n++;
+
+XtSetValues(XtWdg(), warg, n);
+SetMinMax(1, 10);
+SetValue(1);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback, 
+             (XtCallbackProc) scale_action, (XtPointer)this);
+Manage();
+}
+
+/* --Methode-- */
+PIScaleX::~PIScaleX()
+{}
+
+/* --Methode-- */
+void PIScaleX::SetMinMax(int min, int max)
+{
+if (min >= max)  max = min+10;
+if (mVal < min)  mVal = min;
+if (mVal > max)  mVal = max;
+int n=0;
+Arg warg[3];
+XtSetArg(warg[n], XmNminimum, min); n++;
+XtSetArg(warg[n], XmNmaximum, max); n++;
+XtSetArg(warg[n], XmNvalue, mVal); n++;
+XtSetValues(XtWdg(), warg, n);
+mMin = min;   mMax = max;
+return;
+}
+
+
+/* --Methode-- */
+void PIScaleX::SetValue(int val)
+{
+int n=0;
+if (val < mMin)  val = mMin;
+if (val > mMax)  val = mMax;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, val); n++;
+XtSetValues(this->sdw, warg, n);
+return;
+}
+
+/* --Methode-- */
+int  PIScaleX::GetValue()
+{
+int val;
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, &val); n++;
+XtGetValues(this->sdw, warg, n);
+mVal = val;
+return(mVal);
+}
+
+/* --Methode-- */
+void  PIScaleX::CBSetVal(int val)
+{
+mVal = val;
+return;
+}
+
+
+
+/************* PIScrollBarX ************/
+
+#include <Xm/ScrollBar.h>
+
+// Fonction prive (CallBack)
+static void scrollbar_action(Widget w, XtPointer *usd, 
+                             XmScrollBarCallbackStruct *calld);
+static void scrollbar_drag(Widget w, XtPointer *usd, 
+                           XmScrollBarCallbackStruct *calld);
+// Variable globale pour contenir valeur de Scale a l'appel de Send;
+static int scroll_value=0;
+
+void  scrollbar_action(Widget, XtPointer *usd, 
+                       XmScrollBarCallbackStruct *calld)
+{
+PIScrollBar *pis;
+
+pis = (PIScrollBar *) usd ;
+pis->CBSetVal(calld->value);
+scroll_value = calld->value;
+pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)(&scroll_value));
+return;
+}
+
+void  scrollbar_drag(Widget, XtPointer *usd, 
+                       XmScrollBarCallbackStruct *calld)
+{
+PIScrollBar *pis;
+
+pis = (PIScrollBar *) usd ;
+pis->CBSetVal(calld->value);
+scroll_value = calld->value;
+pis->Send(pis->Msg(), PIMsg_Drag, (void *)(&scroll_value));
+return;
+}
+
+/* --Methode-- */
+PIScrollBarX::PIScrollBarX(PIContainerGen *par, char *nom, PIMessage msg,
+                           bool vert, int sx, int sy, int px, int py)
+: PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py)
+{
+int n=0;
+Arg warg[6];
+
+CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py);
+XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
+XtSetArg(warg[n],XmNtraversalOn,FALSE);  n++;
+if (vert)
+  {
+  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++;
+  }
+else
+  { 
+  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
+  }
+XtSetValues(XtWdg(), warg, n);
+mAcD = false;
+mVal = -1;
+mMin = mMax = 0;
+mSz = 0;
+SetMinMax(0, 100);
+SetSlSize(10);
+SetValue(0);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback, 
+             (XtCallbackProc) scrollbar_action, (XtPointer)this);
+Manage();
+}
+
+/* --Methode-- */
+PIScrollBarX::~PIScrollBarX()
+{}
+
+
+/* --Methode-- */
+void PIScrollBarX::ActivateDrag(bool acd)
+{
+if (mAcD == acd)  return; 
+    
+if (mAcD)
+  XtRemoveCallback(XtWdg(), XmNdragCallback, 
+                   (XtCallbackProc)scrollbar_drag, (XtPointer)this);
+else 
+  XtAddCallback(XtWdg(), XmNdragCallback, 
+                (XtCallbackProc)scrollbar_drag, (XtPointer)this);
+mAcD = acd;
+return;
+}       
+
+/* --Methode-- */
+void PIScrollBarX::SetMinMax(int min, int max)
+{
+if (min >= max)  max = min+100;
+if (mVal < min)  mVal = min;
+if (mVal > max-mSz)  mVal = max-mSz;
+int n=0;
+Arg warg[3];
+XtSetArg(warg[n], XmNminimum, min); n++;
+XtSetArg(warg[n], XmNmaximum, max); n++;
+XtSetArg(warg[n], XmNvalue, mVal); n++;
+XtSetValues(XtWdg(), warg, n);
+mMin = min;   mMax = max;
+return;
+}
+
+
+/* --Methode-- */
+void PIScrollBarX::SetValue(int val)
+{
+int n=0;
+if (val < mMin)  val = mMin;
+if (val > mMax-mSz)  val = mMax-mSz;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, val); n++;
+XtSetValues(this->sdw, warg, n);
+mVal = val;
+return;
+}
+
+/* --Methode-- */
+int  PIScrollBarX::GetValue()
+{
+int val;
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, &val); n++;
+XtGetValues(this->sdw, warg, n);
+mVal = val;
+return(mVal);
+}
+
+/* --Methode-- */
+void PIScrollBarX::SetSlSize(int sz)
+{
+int n=0;
+Arg warg[4];
+int szl;
+
+szl = mMax-mMin;
+if (sz > szl)  sz = szl;
+szl /= 100;
+if (szl < 1)  szl = 1;
+if (sz < szl)  sz = szl;
+szl = sz/10;
+if (szl < 1)  szl = 1;
+XtSetArg(warg[n], XmNsliderSize, sz); n++;
+XtSetArg(warg[n], XmNpageIncrement, sz); n++;
+XtSetArg(warg[n], XmNincrement, szl); n++;
+if (mVal > mMax-sz) { 
+  mVal = mMax-sz;
+  XtSetArg(warg[n], XmNvalue, mVal); n++;
+  }
+XtSetValues(this->sdw, warg, n);
+mSz = sz;
+return;
+}
+
+/* --Methode-- */
+int  PIScrollBarX::GetSlSize()
+{
+int sz;
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNsliderSize, &sz); n++;
+XtGetValues(this->sdw, warg, n);
+mSz = sz;
+return(mSz);
+}
+
+
+/* --Methode-- */
+void  PIScrollBarX::CBSetVal(int val)
+{
+mVal = val;
+return;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistdwdgx.h	(revision 108)
@@ -0,0 +1,118 @@
+#ifndef PISTDWDGX_H_SEEN
+#define PISTDWDGX_H_SEEN
+
+#include "pistdwdggen.h"
+
+
+class PILabelX : public PILabelGen
+{
+public:
+                     PILabelX(PIContainerGen *par, char *nom,
+                                 int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PILabelX();
+  
+};
+
+class PIButtonX : public PIButtonGen
+{
+public:
+                     PIButtonX(PIContainerGen *par, char *nom, 
+                               PIMessage msg = PIMsg_Click,
+                               int sx=10, int sy=10, int px=0, int py=0,
+                               PIBtnSign bsgn = PIBtn_Label);
+  virtual            ~PIButtonX();
+
+  virtual void       ActivatePress(bool acp=false);
+
+  void               ReleaseButton();   // Fonction a utiliser avec attention
+
+  XEvent myevt;   // Attention - Pour usage interne 
+
+protected :
+  bool mAcP;
+};
+
+
+class PITextX : public PITextGen
+{
+public:
+                     PITextX(PIContainerGen *par, char *nom, 
+                                  int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PITextX();
+  virtual void       SetText(string const&);
+  virtual string     GetText() const;
+
+  virtual void       SetMutiLineMode(bool mlm=false);
+  virtual void       SetTextEditable(bool te=true);
+
+  virtual void       SetMsg(PIMessage msg=0);
+};
+
+
+class PICheckBoxX : public PICheckBoxGen
+{
+public:
+                     PICheckBoxX(PIContainerGen *par, char *nom, 
+                                 PIMessage msg=PIMsg_Click,
+                                 int sx=10, int sy=10, int px=0, int py=0);
+  virtual            ~PICheckBoxX();
+
+  virtual void       SetState(bool st=false);
+  virtual bool       GetState();
+
+  bool mSt;          // Etat du bouton, en public a cause du Callback
+};
+
+
+
+class PIScaleX : public PIScaleGen
+{
+public:
+                     PIScaleX(PIContainerGen* par, char* nom, 
+                              PIMessage msg=PIMsg_DataChanged, bool horiz=true,
+                              int sx=100, int sy=10, int px=0, int py=0);
+  virtual            ~PIScaleX();
+
+  virtual void       SetMinMax(int min, int max);
+  virtual void       SetValue(int val);
+  virtual int        GetValue(); 
+
+  virtual void       CBSetVal(int val);   // A ne pas utiliser (pour Callback Xt)
+protected: 
+  int mVal, mMin, mMax;
+};
+
+
+
+class PIScrollBarX : public PIScrollBarGen
+{
+public:
+                     PIScrollBarX(PIContainerGen* par, char* nom, 
+                                  PIMessage msg = PIMsg_DataChanged, bool vert=true,
+                                  int sx=10, int sy=100, int px=0, int py=0);
+                     ~PIScrollBarX();
+
+  virtual void       ActivateDrag(bool acd=false);
+  virtual void       SetMinMax(int min, int max);
+  virtual void       SetValue(int val);
+  virtual int        GetValue(); 
+  virtual void       SetSlSize(int sz);
+  virtual int        GetSlSize();
+
+  virtual void       CBSetVal(int val);   // A ne pas utiliser (pour Callback Xt)
+
+protected: 
+  int mVal, mMin, mMax, mSz;
+  bool mAcD;
+};
+
+
+typedef PILabelX       PILabel;
+typedef PIButtonX      PIButton;
+typedef PITextX        PIText;
+typedef PICheckBoxX    PICheckBox;
+typedef PIScaleX       PIScale;
+typedef PIScrollBarX   PIScrollBar;
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pistlist.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistlist.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistlist.cc	(revision 108)
@@ -0,0 +1,117 @@
+#include <stdio.h>
+#include "pistlist.h"
+
+ 
+/* --Methode-- */
+PIStarList::PIStarList(StarList* stl, bool ad, int ayud)
+: PIDrawer(), mStL(stl)
+{
+  mAdDO = ad;   
+  mAYdir = ayud;  
+  if (stl == NULL) return;
+  SetFluxLimits(1., -1.);
+  SetXYLimits(1., -1., 1., -1.);
+}
+
+PIStarList::~PIStarList()
+{
+  if (mAdDO && mStL)  delete mStL;
+}
+
+/* --Methode-- */
+void  PIStarList::SetFluxLimits(float fmin, float fmax, int nl, int msz0, bool refr)
+{
+  if (!mStL)  return;  
+  if (fmin < fmax)  { mFmin = fmin;  mFmax = fmax; }
+  else mStL->CalcFluxLimits(mFmin, mFmax);
+  if (mFmin < 1.e-10)  mFmin = 1.e-10;
+  if (mFmax < mFmin)  mFmax = 1.5*mFmin;
+  mDLgF = log10((double)mFmax/(double)mFmin);
+  mF0 = mFmin;
+  if (nl < 1)  nl = 1;
+  if (nl > 20)  nl = 20;
+  mNLev = nl;  
+  if (msz0 < 0)  msz0 = 0;
+  if (msz0 > 10)  msz0 = 10; 
+  mMSz0 = msz0;
+  if (refr)  Refresh();
+  return;
+}
+
+/* --Methode-- */
+void  PIStarList::SetXYLimits(float xmin, float xmax, float ymin, float ymax, bool dfv, bool refr)
+{
+  if (!mStL)  return;  
+  if ((xmin < xmax) && (ymin < ymax)) {
+    mXMin = xmin; mXMax = xmax; mYMin = ymin; mYMax = ymax; 
+    }
+  else {
+    double x1, x2, y1, y2;
+    mStL->CalcXYLimits(x1, x2, y1, y2);
+    mXMin = (float)x1; mXMax = (float)x2; mYMin = (float)y1; mYMax = (float)y2; 
+    }
+  mDspFV = dfv;
+  if (refr)  Refresh();
+  return;    
+}  
+
+
+/* --Methode-- */
+void PIStarList::UpdateSize()
+{
+  if (!mStL) return;
+
+  // Commencer par trouver nos limites
+  float dx, dy;
+  
+  dx = 0.02*(mXMax-mXMin);
+  dy = 0.02*(mYMax-mYMin);
+  
+  SetLimits(mXMin-dx, mXMax+dx, mYMin-dy, mYMax+dy, kAxeDirLtoR, mAYdir); 
+  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+}
+
+
+/* --Methode-- */
+void PIStarList::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
+{
+BStar *sti;
+float xp,yp,flx;
+int sz;
+char buff[128];
+int nok, nl2;
+
+if (!mStL) return;
+
+g->SelFont();
+nok = 0;  nl2 = mNLev*2-1;
+for (int i=0; i<mStL->NbStars(); i++) {
+  sti = mStL->Star(i);
+  if ( !(sti->Nice(BStar::flagOK)) )  continue;
+  flx = sti->Flux();
+  if ( (flx < mFmin) || (flx > mFmax) )  continue;
+  xp = sti->PosX();   yp = sti->PosY();
+  if ( (xp < mXMin) || (xp > mXMax) || (yp < mYMin) || (yp > mYMax) )  continue;
+  if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) )  continue;
+  nok++;
+  sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + mMSz0;
+  if (sz < 2)  g->SelMarker(sz, PI_DotMarker);
+  else g->SelMarker(sz, PI_FCircleMarker);
+  g->DrawMarker((double)xp,(double)yp ); 
+  if (mDspFV) {  
+    sprintf(buff," F=%g", flx);
+    float dx,dy;
+    g->DGrC2UC(sz, 4, dx, dy);
+    g->DrawString(xp+dx, yp-dy, buff);
+    } 
+  }
+
+/*
+sprintf(buff, "StarList:  NbStars= %d  NDisp= %d", (int)mStL->NbStars(), nok);
+g->BaseGraphic()->DrawString(15,15,buff);
+sprintf(buff, "FMin= %g  FMax= %g Nl= %d Sz0= %d", mFmin, mFmax, mNLev, mMSz0);
+g->BaseGraphic()->DrawString(15,30,buff);
+*/
+
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/pistlist.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pistlist.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pistlist.h	(revision 108)
@@ -0,0 +1,41 @@
+#ifndef PISTLIST_H
+#define PISTLIST_H
+
+#include "stlist.h"
+#include "pidrawer.h"
+
+class PIStarList : public PIDrawer {
+public:
+                     PIStarList(StarList* stl, bool ad, int ayud=kAxeDirUpDown);
+  virtual           ~PIStarList();
+  
+  virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
+  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);              
+
+  inline StarList*   StList()  { return(mStL); }  
+  inline float       XMin()    { return(mXMin); }       
+  inline float       XMax()    { return(mXMax); }       
+  inline float       YMin()    { return(mYMin); }       
+  inline float       YMax()    { return(mYMax); }       
+  inline float       FluxMin() { return(mFmin); }       
+  inline float       FluxMax() { return(mFmax); }
+       
+protected:
+  StarList* mStL;
+  bool mAdDO;
+  float mFmin, mFmax;
+  int mNLev, mMSz0;
+  double mF0, mDLgF;
+  float mXMin, mXMax;
+  float mYMin, mYMax;
+  bool mDspFV;
+  int  mAYdir;
+
+};
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pisysdep.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pisysdep.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pisysdep.h	(revision 108)
@@ -0,0 +1,50 @@
+#ifndef PISYSDEP_SEEN
+#define PISYSDEP_SEEN
+
+#ifdef __MWERKS__         // Macintosh
+
+  #define PIWDG_H  "piwdgmac.h"
+  #define PICONT_H "picontainermac.h"
+  #define PIWIN_H  "piwindowmac.h"
+  #define PISTDWDG_H "pistdwdgmac.h"
+  #define PIMENU_H "pimenumac.h"
+  #define PIMENUBAR_H "pimenubarmac.h"
+  #define PIOPTMENU_H "pioptmenumac.h"
+  #define PIFILECHO_H "pifilechomac.h"
+  #define PILIST_H "pilistmac.h"
+
+  #define PIAPP_H "piapplmac.h"
+  
+  #define PIBWDG_H "pibwdgmac.h"
+  #define PIGRAPHIC_H "pigraphmac.h"
+
+  #define PICMAPNTV_H "picmapmac.h"
+  #define PICMAP_H "picmap.h"
+  #define PIPIXMAP_H "pipixmapmac.h"
+
+
+#else                  // XWindow
+  #define PIWDG_H  "piwdgx.h"
+  #define PICONT_H "picontainerx.h"
+  #define PIWIN_H  "piwindowx.h"
+  #define PISTDWDG_H "pistdwdgx.h"
+  #define PIMENU_H "pimenux.h"
+  #define PIMENUBAR_H "pimenubarx.h"
+  #define PIOPTMENU_H "pioptmenux.h"
+  #define PIFILECHO_H "pifilechox.h"
+  #define PILIST_H "pilistx.h"
+
+  #define PIAPP_H "piapplx.h"
+
+  #define PIBWDG_H "pibwdgx.h"
+  #define PIGRAPHIC_H "pigraphx.h"
+
+  #define PICMAPNTV_H "picmapx.h"
+  #define PICMAP_H "picmap.h"
+  #define PIPIXMAP_H "pipixmapx.h"
+
+  #define PIPERIODIC_H "piperiodicx.h"
+
+#endif
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/pitestapp.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pitestapp.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pitestapp.cc	(revision 108)
@@ -0,0 +1,473 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+/*  Ceci est un programme test des differents composants de PI : PEIDA Interactif */
+/*                 Reza ,  96-98                                                  */
+
+ 
+#include "pisysdep.h"
+
+#include PIAPP_H
+#include PIWIN_H 
+#include PIMENU_H 
+#include PIOPTMENU_H 
+#include PISTDWDG_H 
+#include PIBWDG_H 
+#include PIPIXMAP_H 
+#include PIFILECHO_H 
+#include PILIST_H
+
+#include "ex_dessin.h"
+#include "sc_sample.h"
+#include "piimage.h"
+#include "pimgadapter.h"
+
+
+#include "fitsimage.h"
+
+
+int SysBeep(int n)
+{
+for(int i=0; i<n; i++)  putchar('\007');
+return(0);
+}
+
+class PITestApp : public PIApplication {
+public:
+	PITestApp(int sx, int sy);
+	~PITestApp();
+
+	virtual void	Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+//    PIMenubar * menb;
+    PIPDMenu  *m[5];
+    PIPDMenu  *mc[2];
+    PICheckBox * ckb;
+    PIText * text;
+    PIButton * bouton;
+    PIButton * bouton2, * bouton3, * bouton4, *bouton5;
+    PIButton * bouton11, * bouton12, * bouton13,* bouton14 ,* bouton15 ;
+    PILabel * label;
+    PIScale * scl;
+    PIPUMenu  * menu;
+    PIPUMenu * pum[2];
+    PIOptMenu * opt, * opt2, *opt3;
+    PIPixmap * zoom;
+    PILabel  * labimg;
+    ScSample * scs;
+    bool stnewmen[2];
+
+};
+
+
+/*
+PITestWindow::PITestWindow(PIMsgHandler *par)
+: PIWindow(par, "Peida", PIWK_normal, 200, 200, 50, 50),
+  text(this, "TEXTE", 100, 30, 20,10),
+  label(this, "Label", 100, 20, 20,60),
+  bouton(this, "OK", 66, 40, 20, 20, 100),
+  bouton2(this, "Image", 133, 40, 20, 80, 100),
+  bouton3(this, "Menu", 555, 40, 20, 140, 100),
+  scl(this, "Scale", 88, 5, 45, 100, 20, 10, 130)
+{
+  menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
+  menu->AppendItem("DoIt-1", 4401);
+  menu->AppendItem("DoIt-2", 4402);
+  menu->AppendItem("DoIt-25", 4425);
+  menu->AppendItem("DoIt-26", 4426);
+  menu->AppendItem("Check-33", 4433);
+  menu->AppendItem("Check-33", 4433);
+
+  label.SetBorderWidth(3);
+  FinishCreate();
+}
+
+*/
+
+PITestApp::PITestApp(int sx, int sy)
+: PIApplication(550, 450)
+{
+char ans[128];
+//   menb = new PIMenubar(this, "MyMenubar");
+   m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
+   m[0]->AppendItem("Open", 10101);
+   m[0]->AppendItem("Close", 10102);
+   m[0]->AppendItem("New", 10103);
+   m[0]->AppendItem("ScBar", 10105);
+   m[0]->AppendItem("Quit", 10104);
+   m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Edit");
+   m[1]->AppendItem("Copier", 10201);
+   m[1]->AppendItem("Coller", 10202);
+   m[1]->AppendItem("Couper", 10203);
+   m[1]->AppendCheckItem("Check It", 10205);
+   mc[0] = new PIPDMenu(m[1], "Cascade");
+   mc[0]->AppendItem("EdeCas-1", 10221);
+   mc[0]->AppendItem("EdeCas-2", 10222);
+   mc[0]->AppendItem("EdeCas-3", 10223);
+   m[1]->AppendPDMenu(mc[0]);
+
+   m[2] = new PIPDMenu((PIMsgHandler *)Menubar(),"Operation");
+   m[2]->AppendItem("AddItem", 10301);
+   m[2]->AppendItem("DelItemName", 10302);
+   m[2]->AppendItem("DelItemMsg", 10303);
+
+   m[3] = new PIPDMenu((PIMsgHandler *)Menubar(),"Special");
+   m[3]->AppendItem("Spec-Opt1", 10401);
+   m[3]->AppendItem("Spec-Opt2", 10402);
+   m[3]->AppendItem("Spec-Cascade", 10403);
+   mc[1] = new PIPDMenu(m[3], "Spec-Cascade");
+   mc[1]->AppendItem("Spec-Cas-1", 10441);
+   mc[1]->AppendItem("Spec-Cas-2", 10442);
+   mc[1]->AppendItem("Spec-Cas-3", 10443);
+   m[3]->AppendPDMenu(mc[1]);
+   m[3]->AppendCheckItem("Checkable", 10414);
+
+   m[4] = new PIPDMenu((PIMsgHandler *)Menubar(),"AddMenu2");
+   m[4]->AppendItem("option-A", 10501);
+   m[4]->AppendItem("option-B", 10502);
+   m[4]->AppendItem("option-C", 10503);
+
+   AppendMenu(m[0]);
+   AppendMenu(m[1]);   
+   AppendMenu(m[2]);
+
+  ckb = new PICheckBox(this->MainWin(), "CheckBox", 166, 60, 20, 10, 10);
+  text = new PIText(this->MainWin(), "TEXTE", 100, 30, 20,40);
+  text->SetMsg(7440);
+  label  = new PILabel(this->MainWin(), "Label", 140, 20, 20,80);
+  label->SetBorderWidth(1);
+  bouton = new PIButton(this->MainWin(), "OK", 33, 40, 25, 20, 120);
+  bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120);
+  bouton3 = new PIButton(this->MainWin(), "ExDess",  233, 40, 25, 140, 120);
+  bouton4 = new PIButton(this->MainWin(), "Dialog", 333, 40, 25, 200, 120);
+  bouton5 = new PIButton(this->MainWin(), "ScDraw", 433, 40, 25, 260, 120);
+  scl = new PIScale(this->MainWin(), "Scale", 88, true, 100, 20, 10, 150);
+  scl->SetMinMax(5, 45);
+  zoom = new PIPixmap(this->MainWin(), "Zoom", 100,100,5,195);
+  labimg = new PILabel(this->MainWin(), "PixelValue", 250, 20, 10, 320);
+
+  int psx, psy;
+  PrefCompSz(psx, psy);
+  cout << " Creation bouton 11 -14 avec Sx,Sy= " << psx << " , " << psy << endl;
+
+  bouton11 = new PIButton(this->MainWin(), "AddMen-1", 1133, psx*1.5, psy, 20, 360);
+  bouton11 = new PIButton(this->MainWin(), "AddMen-2", 1233, psx*1.5, psy, 40+psx*1.5, 360);
+  stnewmen[0] = stnewmen[1] = false;
+  bouton13 = new PIButton(this->MainWin(), "Ready/Bloc", 1333, psx*1.5, psy, 60+psx*3, 360);
+  bouton14 = new PIButton(this->MainWin(), "TS-ExBWdg", 1433, psx*1.5, psy, 80+psx*4.5, 360);
+  bouton15 = new PIButton(this->MainWin(), "TS-MenuIt", 1533, psx*1.5, psy, 100+psx*6, 360);
+
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Creation PIPUMenu DoIt-1... \n");   gets(ans);
+  menu = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 1 ... \n");   gets(ans);
+
+  menu->AppendItem("DoIt-1", 4401);
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Apres Creation PIPUMenu -AppendItem() 2 ... \n");   gets(ans);
+
+  menu->AppendItem("DoIt-2", 4402);
+  menu->AppendItem("DoIt-25", 4425);
+  menu->AppendItem("DoIt-26", 4426);
+  menu->AppendItem("Check-33", 4433);
+  menu->AppendItem("Check-33", 4433);
+
+//  XSync(PIXDisplay(), FALSE);
+//  printf("Creation PIPUMenu Copier ... \n");   gets(ans);
+  pum[1] = new PIPUMenu((PIMsgHandler *)this->MainWin(),"Edit");
+  pum[1]->AppendItem("Copier", 80201);
+  pum[1]->AppendItem("Coller", 80202);
+  pum[1]->AppendItem("Couper", 80203);
+  pum[1]->AppendItem("Undo", 80204);
+  pum[1]->AppendItem("Select-All", 80205);
+
+  pum[0] = new PIPUMenu((PIMsgHandler *)this->MainWin(), "myMenu");
+  pum[0]->AppendItem("Linear", 5601);
+  pum[0]->AppendItem("Log.", 5602);
+  pum[0]->AppendItem("Sqrt", 5603);
+  pum[0]->AppendItem("Expon", 5604);
+  pum[0]->AppendItem("Polyn", 5605);
+
+
+  opt = new PIOptMenu(this->MainWin(), pum[0], 90, 25, 110, 150);
+  string ops = "Sqrt";
+  opt->SetValueStr(ops);
+  opt2 = new PIOptMenu(this->MainWin(), pum[1], 90, 25, 150, 200);
+
+  opt3 = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 110, 250);
+  ops = "Linear";
+  opt3->SetValueStr(ops);
+  
+}
+
+PITestApp::~PITestApp()
+{
+  delete ckb;
+  delete text;
+  delete label;
+  delete bouton;
+  delete bouton2;
+  delete bouton3;
+  delete bouton4;
+  delete bouton5;
+  delete bouton11;
+  delete bouton12;
+  delete bouton13;
+  delete bouton14;
+  delete bouton15;
+  delete scl;
+  delete menu;
+  delete m[0]; delete m[1]; delete m[2]; delete m[3]; delete m[4];
+  delete mc[0]; delete mc[1];
+  delete opt;
+  delete opt2;
+  delete opt3;
+  delete pum[0];  delete pum[1]; 
+  delete zoom;
+  delete labimg;
+
+}
+
+static int nimg = 0;
+static PIImage *pimg[5];
+static RzImage *img[5];
+static PIWindow *imgw[5];
+static PIImage *cur=NULL;
+static ScSample *scs1, *scs2, *scs3;
+static PIScrollBar *scb, *scb2;
+static ExBWdg *exb1, *exb2;
+
+static PIWindow * wp3, *wp2, *wp4, *wp5, *wp6;
+static PIPixmap * pxm;
+static unsigned char  pixels[25000];
+static PIFileChooser *pfc;
+static bool  fgpxm = false;
+static bool  fgt = false;
+static bool  fgt2 = false;
+
+static PIListX * pil;
+
+void
+PITestApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+  static int x = 0;
+  static numsg=8800;
+
+//   SysBeep(1);
+  char truc[256];
+  sprintf(truc,"< %ld - %d (%d)>",msg,x++, (int)((PIWdgGen *)sender)->kind());
+  this->label->SetLabel(truc);
+  sprintf(truc,"[%d] Msg= %ld (%d-%d) Kind=(%d)  Data= (%ld - %lx)",x, msg, (int)UserMsg(msg),
+         (int)ModMsg(msg), (int)((PIWdgGen *)sender)->kind(), (long)data, (long)data);
+  puts(truc);
+
+  if (ModMsg(msg) == PIMsg_Active) 
+    {  printf("Process: Setting active ImageWindow (%lx) \n", (long)sender); 
+    cur = (PIImage *)sender; return;}
+
+  if (ModMsg(msg) == PIMsg_Close)
+    {
+    printf("Close Message received (Sender= %lx)\n", (long)sender);
+    return;
+    }
+
+  msg = UserMsg(msg);
+  if (msg == 33) ckb->SetState(true);
+    
+  if (msg == 133)
+    {
+    if (!fgpxm)  { wp3->Show();  fgpxm = true; }
+    for (int i=0; i<25000; i++)  pixels[i] = rand()%32;
+    if ((x % 3) == 0)  pxm->SetColMap(CMAP_GREY32);
+    if ((x % 3) == 1)  pxm->SetColMap(CMAP_COLRJ32);
+    if ((x % 3) == 2)  pxm->SetColMap(CMAP_COLBR32);
+//    pxm->Refresh();
+    if (cur)
+      {
+//      printf("Process: Setting ColMap for (%lx) \n", (long)cur);
+      if ((x % 3) == 0)  cur->SetColMap(CMAP_GREY32);
+      if ((x % 3) == 1)  cur->SetColMap(CMAP_COLRJ32);
+      if ((x % 3) == 2)  cur->SetColMap(CMAP_COLBR32);
+      }
+    }
+  if (msg == 233)
+    {
+    if (fgt) { wp2->Hide();  fgt = false; }
+    else { wp2->Show();  fgt = true; }
+    }
+
+  if (msg == 333)  wp4->Show();
+  if ( (msg == 6001) || (msg == 6002) )  wp4->Hide();
+
+  if (msg == 433)
+    {
+    if (fgt2) { wp5->Hide();  wp6->Hide(); fgt2 = false; }
+    else { wp5->Show();  wp6->Show(); fgt2 = true; }
+    }
+
+  if ( (msg == 1133) || (msg == 1233) )  {  // On ajoute ou on enleve un  menu du menu-bar
+    int idxmen = (msg-1133)/100;
+    cout << " Add/Remove Menu idxmen= " << idxmen << " Bool= " 
+         << Menubar()->IsSensitive(m[idxmen+3])  << " ( " << stnewmen[idxmen] << ")" << endl;
+    if ( Menubar()->IsSensitive(m[idxmen+3]) ) 
+      { Menubar()->RemoveMenu(m[idxmen+3]); stnewmen[idxmen] = false; }
+    else  { Menubar()->AppendMenu(m[idxmen+3]); stnewmen[idxmen] = true; }
+  }
+
+  if (msg == 1333) {  // Changement de sensibilite de Menu-Bar (par SetBusy())
+    cout << " SetSens() Menubar,  State= " <<  GetState()  << endl;
+    if (GetState() != kReadyState)  SetReady();
+    else  SetBlocked();
+  }
+
+  if (msg == 1533) {  // Changement de sensibilite de  Cascade
+    cout << " ChangeSensitivity()  Cascade Bool= " <<  m[1]->IsSensitive("Cascade")  << endl;
+    if (m[1]->IsSensitive("Cascade") )  m[1]->SetSensitivity("Cascade", false); 
+    else  m[1]->SetSensitivity("Cascade", true); 
+  }
+
+  if (msg == 1433) {  // Changement de sensibilite de 
+    
+  }
+//  if (msg == 555)   (this->menu)->Show(); 
+
+  if (msg == 10105)  scb->SetSlSize(atoi(((char *)text->GetText().c_str())));
+  if (msg == 10104)  Stop();
+  if (msg == 10101)  { pfc->AcceptNewFile(false); pfc->Show(); }
+  if (msg == 10103)  { pfc->AcceptNewFile(true); pfc->Show(); }
+
+  if ((msg == 10205) || (msg == 166))  { // CheckItem Menu  or checkbox
+    cout << "PITestApp::Process CheckItem/Box Menu (" << msg 
+         << ") State=" <<  *((bool *)data) << endl; 
+  }
+
+  if (msg == 10301)  
+   { 
+   numsg++;    
+   string nit;
+   nit = text->GetText();
+   m[1]->AppendItem((char *)nit.c_str(), numsg); 
+   opt2->SetValue(numsg);
+   }
+
+  if (msg == 10302)  { m[1]->DeleteItem((char *)text->GetText().c_str()); }
+  if (msg == 10303)  
+    {
+    string nit;
+    nit = text->GetText();
+    long ml =  atol(nit.c_str());
+    m[1]->DeleteItemMsg(ml);
+    opt2->SetValue(10201);
+    }
+
+
+  if (msg > 9000) printf("PITestApp::MenubarReturn: %d --> %lx \n", msg, (long)data);
+  if (msg == 5000)  
+    { 
+    if (data) 
+      { 
+      printf("PITestApp::Process(5000) : %s \n", (char *)data); 
+      if (nimg < 5)  img[nimg] = RzReadFits((char *)data);
+      if (img[nimg])
+        {
+        imgw[nimg] = new PIWindow(this, "WindImage", 
+                                  PIWK_normal, 400, 400, 500, 500);
+        pimg[nimg] = new PIImage(imgw[nimg], "MyImage", 400, 400, 0, 0);
+        pimg[nimg]->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed );
+        pimg[nimg]->SetZoomWin(zoom);
+        pimg[nimg]->SetTextWin(labimg);
+        pimg[nimg]->SetImage(new RzImageAdapter(img[nimg], true) );
+        pimg[nimg]->Apply();
+        imgw[nimg]->Show();
+        nimg++;
+        }
+    }
+    else printf("PITestApp::Process(5000) (data=NULL) \n");  }
+
+  if ((msg / 100) == 56) 
+    printf("PITestApp::Process(%d) : %lx \n", (int)msg, (long)data); 
+
+  if (msg == 8811) printf("PITestApp::Process(8811) ScrollBar( %d ) \n", *( (int*)data) );
+
+}
+
+int main(int narg, char *arg[])
+{
+  int mii;
+
+  PITestApp * app;
+  app = new PITestApp(350, 350);
+
+  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  400, 200, 250, 250);
+  exb1 = new ExBWdg(wp2, "BWdg", 150, 150, 10, 40);
+  exb1->SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_fixed);
+  exb2 = new ExBWdg(wp2, "BWdg2", 180, 180, 200, 10);
+  exb2->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+
+  wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  200, 200, 350, 350);
+  PIButton bt1(wp4, "OK", 6001, 60, 30, 20, 160);
+  PIButton bt2(wp4, "Cancel", 6002, 60, 30, 100, 160);
+  bt1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  bt2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  PILabel  lb1(wp4, "Editable", 40, 30, 10, 10);
+    lb1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  PIText  tx1(wp4, "A00", 100, 30, 60, 10);  
+    tx1.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  tx1.SetText("Hello");
+  tx1.SetTextEditable(false);
+  //  PILabel  lb2(wp4, "", 30, 20, 10, 40);
+  PIText  tx2(wp4, "A11", 180, 100, 15, 50);
+  tx2.SetMutiLineMode(true);
+  tx2.SetText(" Bonjour, \n Comment ca va ? \n A demain. ");
+    tx2.SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+
+  wp3 = new PIWindow(app, "Window-3", PIWK_normal, 200, 200, 350, 350);
+  pxm = new PIPixmap(wp3, "myPixmap", 150, 150, 10, 10);
+  pxm->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed );
+  pxm->SetPixmap(pixels, 150, 150);
+
+  wp5 = new PIWindow(app, "Window-5", PIWK_normal,  420, 450, 200, 200);
+  scs1 = new ScSample(wp5, "ScSample", 200, 200, 0, 0);
+  scs1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  scs2 = new ScSample(wp5, "ScSample", 160, 160, 220, 20);
+  printf("DBG-WP5 (A) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+//  scs2->SetBinding(PIBK_elastic,PIBK_fixed,PIBK_fixed,PIBK_elastic);
+  scs2->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  printf("DBG-WP5 (B) , SCS2, SzC %d %d , Sz %d %d Pos %d %d \n", wp5->XSize(),
+         wp5->YSize(), scs2->XSize(), scs2->YSize(),scs2->XPos(), scs2->YPos() ); 
+
+  scb = new PIScrollBar(wp5, "ScBar", 8811, true, 15, 420, 405, 0);
+  scb->SetBinding(PIBK_free,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  scb->ActivateDrag(true);
+  scb2 = new PIScrollBar(wp5, "ScBar", 8821, false, 420, 15, 0, 425);
+  scb2->SetBinding(PIBK_fixed,PIBK_free,PIBK_fixed,PIBK_fixed);
+
+  scs3 = new ScSample(wp5, "ScSample", 200, 200, 100, 220);
+  scs3->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  /*  
+  exb1 = new ExBWdg(wp5, "ExB1", 200, 200, 100, 220);
+  exb1->SetBinding(PIBK_elastic,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+  */
+  //  wp4 = new PIWindow(app, "Open...", PIWK_dialog, 300, 300, 400, 400);
+
+  pfc = new PIFileChooser(app,"FileChooser", 5000); 
+  pfc->SetPath("/exp/eros/ImagRed/");
+
+  wp6 = new PIWindow(app, "Window-List", PIWK_normal,  200, 250, 300, 400);
+  pil = new PIListX(wp6, "MyList", 200, 250, 0, 0);
+  pil->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed,PIBK_fixed);
+  for(mii=1; mii<narg; mii++)
+    {
+    printf("AppendItem[%d] - %s (%ld) \n", mii, arg[mii],  3330+mii);  
+     pil->AppendItem(arg[mii], 3330+mii);  
+    puts("Append-OK");
+    }
+  pil->SetMultipleSelect(true);
+  pil->SelectItem("user.cc");
+//  Int32 ioNumber = 100;
+  app->Run();
+  delete app;
+  exit(0);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/pitestapp.xx
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pitestapp.xx	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pitestapp.xx	(revision 108)
@@ -0,0 +1,247 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "pisysdep.h"
+
+#include PIAPP_H
+#include PIWIN_H 
+#include PIMENU_H 
+#include PIOPTMENU_H 
+// #include PIMENUBAR_H 
+#include PISTDWDG_H 
+#include PIBWDG_H 
+
+#include PIPIXMAP_H 
+
+#include PIFILECHO_H 
+
+#include "ex_dessin.h"
+
+
+int SysBeep(int n)
+{
+for(int i=0; i<n; i++)  putchar('\007');
+return(0);
+}
+/*
+class PITestWindow : public PIWindow {
+public:
+	PITestWindow(PIMsgHandler *par);
+	~PITestWindow() {}
+
+    PIText text;
+    PIButton bouton;
+    PIButton bouton2, bouton3;
+    PILabel label;
+    PIScale scl;
+    PIPUMenu  * menu;
+
+};
+*/
+
+class PITestApp : public PIApplication {
+public:
+	PITestApp(int sx, int sy);
+	~PITestApp();
+
+	virtual void	Process(long msg, PIMsgHandler* sender, void* data=NULL);
+
+//    PIMenubar * menb;
+    PIPDMenu  *m[3];
+    PICheckBox * ckb;
+    PIText * text;
+    PIButton * bouton;
+    PIButton * bouton2, * bouton3, * bouton4;
+    PILabel * label;
+    PIScale * scl;
+    PIPUMenu  * menu;
+    PIPDMenu * pdm;
+    PIOptMenu * opt;
+
+};
+
+
+/*
+PITestWindow::PITestWindow(PIMsgHandler *par)
+: PIWindow(par, "Peida", PIWK_normal, 200, 200, 50, 50),
+  text(this, "TEXTE", 100, 30, 20,10),
+  label(this, "Label", 100, 20, 20,60),
+  bouton(this, "OK", 66, 40, 20, 20, 100),
+  bouton2(this, "Image", 133, 40, 20, 80, 100),
+  bouton3(this, "Menu", 555, 40, 20, 140, 100),
+  scl(this, "Scale", 88, 5, 45, 100, 20, 10, 130)
+{
+  menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
+  menu->AppendItem("DoIt-1", 4401);
+  menu->AppendItem("DoIt-2", 4402);
+  menu->AppendItem("DoIt-25", 4425);
+  menu->AppendItem("DoIt-26", 4426);
+  menu->AppendItem("Check-33", 4433);
+  menu->AppendItem("Check-33", 4433);
+
+  label.SetBorderWidth(3);
+  FinishCreate();
+}
+
+*/
+
+PITestApp::PITestApp(int sx, int sy)
+: PIApplication(sx, sy)
+{
+//   menb = new PIMenubar(this, "MyMenubar");
+   m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
+   m[0]->AppendItem("Open", 10101);
+   m[0]->AppendItem("Close", 10102);
+   m[0]->AppendItem("New", 10103);
+   m[0]->AppendItem("Quit", 10104);
+   m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Edit");
+   m[1]->AppendItem("Copier", 10201);
+   m[1]->AppendItem("Coller", 10202);
+   m[1]->AppendItem("Couper", 10203);
+   m[2] = new PIPDMenu((PIMsgHandler *)Menubar(),"Operation");
+   m[2]->AppendItem("AddItem", 10301);
+   m[2]->AppendItem("DelItemName", 10302);
+   m[2]->AppendItem("DelItemMsg", 10303);
+
+   AppendMenu(m[0]);
+   AppendMenu(m[1]);   
+   AppendMenu(m[2]);
+
+  ckb = new PICheckBox(this->MainWin(), "CheckBox", 166, 60, 20, 10, 10);
+  text = new PIText(this->MainWin(), "TEXTE", 100, 30, 20,40);
+  label  = new PILabel(this->MainWin(), "Label", 140, 20, 20,80);
+  bouton = new PIButton(this->MainWin(), "OK", 66, 40, 25, 20, 120);
+  bouton2 = new PIButton(this->MainWin(), "Image", 133, 40, 25, 80, 120);
+  bouton3 = new PIButton(this->MainWin(), "Test", 233, 40, 25, 140, 120);
+  bouton4 = new PIButton(this->MainWin(), "Menu", 555, 40, 25, 200, 120);
+  scl = new PIScale(this->MainWin(), "Scale", 88, 5, 45, 100, 20, 10, 150);
+
+  menu = new PIPUMenu((PIMsgHandler *)this, "myMenu");
+  menu->AppendItem("DoIt-1", 4401);
+  menu->AppendItem("DoIt-2", 4402);
+  menu->AppendItem("DoIt-25", 4425);
+  menu->AppendItem("DoIt-26", 4426);
+  menu->AppendItem("Check-33", 4433);
+  menu->AppendItem("Check-33", 4433);
+
+  pdm = new PIPDMenu((PIMsgHandler *)this, "myMenu");
+  pdm->AppendItem("Linear", 5601);
+  pdm->AppendItem("Log.", 5602);
+  pdm->AppendItem("Sqrt", 5603);
+  pdm->AppendItem("Expon", 5604);
+  pdm->AppendItem("Polyn", 5605);
+
+  opt = new PIOptMenu(this->MainWin(), pdm, 80, 20, 110, 150);
+
+  printf("Debug_PITestApp::PITestApp() MenBarSizeX,Y= %d %d \n", 
+         Menubar()->XSize(), Menubar()->YSize());
+
+}
+
+PITestApp::~PITestApp()
+{
+  delete ckb;
+  delete text;
+  delete label;
+  delete bouton;
+  delete bouton2;
+  delete bouton3;
+  delete bouton4;
+  delete scl;
+  delete menu;
+  delete m[0]; delete m[1]; delete m[2];
+//  delete menb;
+
+}
+
+static PIWindow * wp3, *wp2, *wp4;
+static PIPixmap * pxm;
+static unsigned char  pixels[25000];
+static PIFileChooser *pfc;
+static bool  fgpxm = false;
+static bool  fgt = false;
+
+void
+PITestApp::Process(long msg, PIMsgHandler* sender, void* data)
+{
+  static int x = 0;
+  static numsg=8800;
+
+//   SysBeep(1);
+  char truc[100];
+  sprintf(truc,"< %ld - %d (%d)>",msg,x++, ((PIWdgGen *)sender)->kind());
+  this->label->SetLabel(truc);
+  if (msg == 133)
+    {
+    if (!fgpxm)  { wp3->Show();  fgpxm = true; }
+    for (int i=0; i<25000; i++)  pixels[i] = random()%32;
+    if ((x % 3) == 0)  pxm->SetColMap(CMAP_GREY32);
+    if ((x % 3) == 1)  pxm->SetColMap(CMAP_COLRJ32);
+    if ((x % 3) == 2)  pxm->SetColMap(CMAP_COLBR32);
+    pxm->Refresh();
+    }
+  if (msg == 233)
+    {
+    if (fgt) { wp2->Hide();  fgt = false; }
+    else { wp2->Show();  fgt = true; }
+    }
+//  if (msg == 555)   (this->menu)->Show(); 
+
+  if (msg == 10104)  Stop();
+  if (msg == 10101)  { pfc->AcceptNewFile(false); pfc->Show(); }
+  if (msg == 10103)  { pfc->AcceptNewFile(true); pfc->Show(); }
+
+  if (msg == 10301)  
+   { numsg++;    m[1]->AppendItem(text->GetText().c_str(), numsg); }
+  if (msg == 10302)  { m[1]->DeleteItem(text->GetText().c_str()); }
+  if (msg == 10303)  { m[1]->DeleteItemMsg(atol(text->GetText().c_str())); }
+
+  if (msg == 555)  wp4->Show();
+  if ( (msg == 6001) || (msg == 6002) )  wp4->Hide();
+
+  if ((msg > 8000) && data) printf("PITestApp::MenubarReturn: %s \n", data);
+  if (msg == 5000)  
+    { if (data) printf("PITestApp::Process(5000) : %s \n", (char *)data); 
+    else printf("PITestApp::Process(5000) (data=NULL) \n");  }
+  if (msg == 66) ckb->SetState(true);
+  if ((msg / 100) == 56) printf("PITestApp::Process(%d) : %s \n", (int)msg, (char *)data); 
+
+}
+
+int main()
+{
+  PITestApp * app;
+  app = new PITestApp(300, 200);
+
+  wp2 = new PIWindow(app, "Window-2", PIWK_normal,  150, 150, 250, 250);
+  ExBWdg bw(wp2, "BWdg", 150, 150, 0, 0);
+//  bw.SetBinding(false, true, true, false);
+//  bw.ActivateButton(1);
+//  bw.ActivatePtrCross();
+//  bw.ActivateKeyboard();
+
+  wp4 = new PIWindow(app, "Window-4", PIWK_dialog,  120, 120, 350, 350);
+  PIButton bt1(wp4, "OK", 6001, 40, 20, 10, 80);
+  PIButton bt2(wp4, "Cancel", 6002, 40, 20, 60, 80);
+  PILabel  lb1(wp4, "Mat_00", 30, 20, 10, 10);
+  PIText  tx1(wp4, "A00", 50, 20, 50, 10);  
+  PILabel  lb2(wp4, "Mat_11", 30, 20, 10, 40);
+  PIText  tx2(wp4, "A11", 50, 20, 50, 40);  
+
+  wp3 = new PIWindow(app, "Window-3", PIWK_normal, 200, 200, 350, 350);
+  pxm = new PIPixmap(wp3, "myPixmap", 150, 150, 10, 10);
+  
+  pxm->SetBinding(true, true, true, true);
+  pxm->SetPixmap(pixels, 150, 150);
+
+  //  wp4 = new PIWindow(app, "Open...", PIWK_dialog, 300, 300, 400, 400);
+
+  pfc = new PIFileChooser(app,"FileChooser", 5000); 
+  pfc->SetPath("/users/eros/ansari/Images++");
+
+
+//  Int32 ioNumber = 100;
+  app->Run();
+  delete app;
+  exit(0);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piup.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piup.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piup.cc	(revision 108)
@@ -0,0 +1,61 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctimer.h"
+#include "imageop.h"
+
+#include "piup.h"
+
+RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("**** PIUserProc_1 Pave[%d*%d] en (%d,%d) %s %s  Filtrage passe-bas 3*3 \n",
+       dx, dy, xp, yp, arg1, arg2);
+ImageR4 filt(3,3);
+ImageR4 * out;
+
+// Definition du filtre passe-bas
+int i,j;
+for(i=0; i<3; i++)
+  for(j=0; j<3; j++)  filt(i,j) = 0.1;
+filt(1,1) = 0.2;
+
+filt.PrintImage();
+out = new ImageR4(myimg.XSize(), myimg.YSize());
+TIMEF ;
+FilterImage(&myimg, out, &filt); 
+return((RzImage*)out);
+}
+ 
+RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("**** PIUserProc_2 Pave[%d*%d] en (%d,%d) %s %s  Ombre 3*3 \n",
+       dx, dy, xp, yp, arg1, arg2);
+printf(" PIUserProc_2(%d %d %s %s)  Ombre 3*3 \n", xp, yp, arg1, arg2);
+ImageR4 filt(3,3);
+ImageR4 * out;
+
+// Definition du filtre ombre
+int i,j;
+filt(0,0) = filt(1,1) = filt(2,2) = 0.;
+filt(0,1) = filt(1,2) = -1.;
+filt(1,0) = filt(2,1) = 1.;
+filt(0,2) = -2.;
+filt(2,0) = 2.;
+filt.PrintImage();
+out = new ImageR4(myimg.XSize(), myimg.YSize());
+TIMEF ;
+FilterImage(&myimg, out, &filt); 
+return((RzImage*)out);
+}
+
+ 
+RzImage * PIUserProc_3(ImageR4& , int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("PIUserProc_3 Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n", 
+       dx, dy, xp, yp, arg1, arg2);
+return(NULL);
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piup.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piup.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piup.h	(revision 108)
@@ -0,0 +1,10 @@
+#include "cimage.h"
+extern "C" {
+RzImage * PIUserProc_1(ImageR4& myimg, int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2);
+RzImage * PIUserProc_2(ImageR4& myimg, int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2);
+RzImage * PIUserProc_3(ImageR4& myimg, int xp, int yp, int dx, int dy, 
+                       char * arg1, char * arg2);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/piup_def.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piup_def.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piup_def.cc	(revision 108)
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctimer.h"
+#include "imageop.h"
+
+#include "piup.h"
+
+RzImage * PIUserProc_1(ImageR4 & , int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("PIUserProc_1/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n", 
+       dx, dy, xp, yp, arg1, arg2);
+return(NULL);
+}
+ 
+RzImage * PIUserProc_2(ImageR4 & , int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("PIUserProc_2/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n", 
+       dx, dy, xp, yp, arg1, arg2);
+return(NULL);
+}
+ 
+RzImage * PIUserProc_3(ImageR4 & , int xp, int yp, int dx, int dy,
+                       char * arg1, char * arg2)
+{
+printf("PIUserProc_3/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n", 
+       dx, dy, xp, yp, arg1, arg2);
+return(NULL);
+}
+ 
Index: /branches/EA_Juin98/SophyaPI/PI/piupdattachment.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piupdattachment.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piupdattachment.cc	(revision 108)
@@ -0,0 +1,104 @@
+#include "piupdattachment.h"
+//const MessageT	msg_MouseUp			= 819;
+
+PIUpdAttachment* PIUpdAttachment::lastCursPane = NULL;
+bool PIUpdAttachment::hit = false;
+int PIUpdAttachment::down = 0;
+
+PIUpdAttachment::PIUpdAttachment(PIBaseWdgMac* wdg)
+: LAttachment(), myWdg(wdg)
+{
+  myGraphic = (PIGraphicMac*) wdg->WindowGraphic();
+}
+
+PIUpdAttachment::~PIUpdAttachment()
+{
+  if (lastCursPane == this) lastCursPane = NULL;
+  delete myGraphic;
+}
+
+void PIUpdAttachment::ExecuteSelf(MessageT msg, void* data)
+{
+  if (myWdg)
+    switch(msg) {
+      case msg_DrawOrPrint:
+        myWdg->Draw(myGraphic);
+ 		break;
+      case msg_Resize:
+        myWdg->Resize();
+ 		break;
+      case msg_Move:
+//        myWdg->Move();
+        break;
+//      case cmd_Close: {
+//        delete myWdg;
+//        break;
+//      }
+      case msg_Click: {
+        SMouseDownEvent* evt = (SMouseDownEvent*) data;
+        EventModifiers mod = evt->macEvent.modifiers;
+        if ((mod & cmdKey) && (mod & optionKey))
+          { myWdg->But3Press(evt->whereLocal.h,evt->whereLocal.v); down = 3;}
+        else if (mod & cmdKey)
+          { myWdg->But2Press(evt->whereLocal.h,evt->whereLocal.v); down = 2;}
+        else
+          { myWdg->But1Press(evt->whereLocal.h,evt->whereLocal.v); down = 1;}
+ 		break;
+ 		}
+ 	  case msg_KeyPress: {
+ 	    EventRecord* evt = (EventRecord*) data;
+ 	    PIKeyModifier kmod = PIKM_Blank;
+ 	    if (evt->modifiers & shiftKey)
+ 	      kmod = (PIKeyModifier) (kmod | PIKM_Shift);
+ 	      //kmod |= PIKM_Shift;  // Ca devrait passer !!!
+ 	    if (evt->modifiers & optionKey)
+ 	      kmod = (PIKeyModifier) (kmod | PIKM_Alt);
+ 	    if (evt->modifiers & controlKey)
+ 	      kmod = (PIKeyModifier) (kmod | PIKM_Cntl);
+ 	    myWdg->Keyboard(evt->message & charCodeMask, kmod);
+ 	    break;
+ 	    }
+ 	  case msg_AdjustCursor: {
+ 	    EventRecord* evt = (EventRecord*) data;
+ 	    if (lastCursPane != this) {
+ 	      if (lastCursPane)
+ 	        lastCursPane->myWdg->Leave();
+ 	      myWdg->Enter();
+ 	      lastCursPane = this;
+ 	    }
+ 	    hit = true;
+ 	    SetExecuteHost(!myWdg->AdjustCursor());
+ 	    // Est-ce un move, i.e. le bouton est-il toujours appuye depuis le dernier MouseDown ?
+ 	    if (::StillDown() && down) {
+ 	      Point pt = evt->where;
+ 	      myWdg->mPane->GlobalToPortPoint(pt);
+ 	      myWdg->mPane->PortToLocalPoint(pt);
+ 	      if (lastPt.h != pt.h || lastPt.v != pt.v) {
+ 	        lastPt = pt;
+            EventModifiers mod = evt->modifiers;
+            if ((mod & cmdKey) && (mod & optionKey))
+              myWdg->Ptr3Move(pt.h,pt.v);
+            else if (mod & cmdKey)
+              myWdg->Ptr2Move(pt.h,pt.v);
+            else
+              myWdg->Ptr1Move(pt.h,pt.v);
+          }
+ 	    } else if (down) {  // A changer le jour ou les attachements recoivent les mouseup.
+ 	      Point pt = evt->where;
+ 	      myWdg->mPane->GlobalToPortPoint(pt);
+ 	      myWdg->mPane->PortToLocalPoint(pt);
+          EventModifiers mod = evt->modifiers;
+          //if ((mod & cmdKey) && (mod & optionKey))
+          if (down == 3)
+            myWdg->But3Release(pt.h,pt.v);
+          //else if (mod & cmdKey)
+          else if (down == 2)
+            myWdg->But2Release(pt.h,pt.v);
+          else
+            myWdg->But1Release(pt.h,pt.v);
+ 	      down = 0;
+        }
+ 	    break;
+ 	    }
+    }
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piupdattachment.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piupdattachment.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piupdattachment.h	(revision 108)
@@ -0,0 +1,28 @@
+
+#include <LAttachment.h>
+
+#include "pibwdgmac.h"
+
+const MessageT	msg_Resize			= 817;
+const MessageT	msg_Move			= 818;
+
+class PIUpdAttachment : public LAttachment {
+public:
+  PIUpdAttachment(PIBaseWdgMac* wdg);
+  ~PIUpdAttachment();
+  
+protected:
+ virtual void	ExecuteSelf(
+							MessageT		inMessage,
+							void			*ioParam);
+
+ PIBaseWdgMac* myWdg;
+ PIGraphicMac* myGraphic;
+ 
+ friend class PIPPApplMac;
+ static PIUpdAttachment* lastCursPane;
+ static bool hit;
+ static int down;
+ Point lastPt;
+};
+
Index: /branches/EA_Juin98/SophyaPI/PI/piusmak
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piusmak	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piusmak	(revision 108)
@@ -0,0 +1,33 @@
+CC := gcc
+CXX := g++
+include  $(EROSBASEREP)/Include/MakefileUser.h
+
+%.o:%.cc
+	$(COMPILE.cc) -o $@ $<
+LIBF =  $(SLB)libpeida.so $(SLB)liberosc.so
+LIBS = -L$(SLB) -lpeida -lerosc  
+
+#------------------------------------------------- End of Makefile.h ------- 
+all : piup.so
+
+clean:
+	rm -f user.o user.so piup.so
+
+piup.so : user.so
+	cp -p user.so piup.so
+
+ 
+user.so : user.o $(LIBF)
+	ld -shared -o user.so -all user.o \
+        -none $(LIBS) -lgcxx -lm -lc
+
+user.o: user.cc  $(INC)piup.h \
+ $(INC)perrors.h \
+ $(INC)exceptions.h \
+ $(INC)defs.h \
+ $(INC)cimage.h \
+ $(INC)rzimage.h \
+ $(INC)rzvect.h \
+ $(INC)machine.h \
+ $(INC)datatypes.h \
+ $(INC)utils.h $(INC)peida.h 
Index: /branches/EA_Juin98/SophyaPI/PI/piwdggen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdggen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdggen.cc	(revision 108)
@@ -0,0 +1,234 @@
+//  Classe de base pour les objets correspondant a une fenetre 
+//  dans les programmes graphiques interactives
+//
+//                  E.Aubourg , R. Ansari  96 - 98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "piwdggen.h"
+#include "picontainergen.h"
+
+#include "psfile.h"
+
+//++
+// Class	PIWdg
+// Lib		PI
+// include	piwdggen.h
+//
+//   	Classe de base pour tout objets correspondant à une fenêtre
+//	à l'écran, ayant donc une représentation graphique et 
+//	pouvant jouer un rôle dans la hiérarchie des objets interactif. 
+//	*PIWdg* hérite de *PIMsgHandler*, avec une hiérarchie correspondant
+//	par défaut à celles des PIWdg. La classe "PIWdg" est une des 
+//	classes de PI qui ont une implementation dépendante du systeme utilisé
+//	(Mac, XWindow, ...). La classe "PIWdgGen" est la classe qui
+//	définit l'interface, et ne doit pas être instanciée directement
+//	(Méthodes virtuelles pures). Les objets instanciés sont de la 
+//	classes "PIWdg" et le fichier entête correspondant est "PIWDG_H"
+//	défini dans "pisysdep.h"
+//--
+//++
+// Links	Parents
+// PIMsgHandler
+//--
+
+//++
+// Titre	Constructeur
+//--
+//++
+// PIWdg(PIContainerGen *par, char *nom, int sx=10, int sy=10, int px=0, int py=0)
+//	Création d'un objet contenu dans l'objet *PIContainer* "par", de
+//	taille "sx,sy", se trouvant à la position "px,py" avec le nom "nom"
+// long kind()
+//	Renvoie le type de la classe de l'objet ("=PIWdgGen::ClassId") pour cette classe
+//	de base. Doit être redéfinie par les classes dérivées.
+//--  
+
+
+//++
+// Titre	Taille, position
+//--
+//++
+// void  PSPrint(PSFile *psf, int ofx=0, int ofy=0)
+//	Méthode virtuelle qui doit être redéfinie pour chacune des classes filles.
+//	produit une représentation graphique de l'objet en Postscript.
+// SetSize(int sx, int sy)
+//	Modifie la taille de l'objet.
+// SetPos(int px, int py)
+//	Modifie la position de l'objet.
+// int  XSize()  YSize()
+//	Renvoient la taille (X,Y) de l'objet.
+// int  XPos()  YPos()
+//	Renvoient la position (X,Y) de l'objet.
+// void  GetScreenPos(int & spx, int & spy)
+//	Renvoie la position de l'objet sur l'écran.
+// void  SetBinding(PIBindingKind left, PIBindingKind top, PIBindingKind right, PIBindingKind bottom)
+//	Permet de contrôler le comportement de l'objet en cas de changement de taille 
+//	du conteneur parent. La position de chaque bord peut être sans contrainte ("PIBK_free")
+//	attachée à une distance fixe par rapport au bord opposé du conteneur ("PIBK_fixed"), 
+//	ou à une position proportionnelle à la taille du conteneur parent. ("PIBK_elastic") 
+//--
+
+//++
+// Titre	Etat de l'objet
+//	L'objet peut se trouver dans l'état actif ou inactif. Cet état est contrôlé par les 
+//	méthodes "Manage(), UnManage()". L'objet ne se trouve effectivement dans l'état 
+//	actif que si son conteneur parent est lui même actif.
+//	L'objet peut aussi être affichés, mais insensible aux actions utilisateur
+//	(clavier, souris, ...). Cette sensibilité est controlée par les 
+//	méthodes  "SetSensitive(), SetUnSensitive()".
+//--
+//++
+// void  Manage()  UnManage()
+//	Change l'état de l'objet (actif, inactif)
+// bool  IfManaged()  IfVisible()
+//	indique si l'objet est actif , visible	
+// void  SetSensitive() SetUnSensitive()
+//	Rend l'objet sensible/ insensible aux actions utilisateurs (clavier, souris, ...)
+//	L'état visuel de l'objet peut être modifié en conséquence.
+// bool  IfSensitive() 
+//	indique si l'objet est répond aux sollicitations utilisateur.
+//--
+
+//++
+// Titre	Méthodes
+//--
+
+//++
+// void SetMsg(PIMessage msg = 0)
+//	Modifie la valeur du message associé à l'objet.
+// PIMessage  Msg()
+//	Renvoie le message associé à l'objet.
+// string  Nom()
+//	Renvoie le nom associé à l'objet.
+// PIWdg*  Parent()
+//	Renvoie le conteneur parent de l'objet.
+// void  SetUserData( void * p, int fg = 0)
+//	Associe un pointeur de données à la disposition de l'utilisateur 
+//	("void* p") à l'objet, ainsi qu'une valeur ("int fg")
+// void* UserData()
+//	Renvoie le pointeur de données user de l'objet. (NULL par défaut)
+// int  UserFlag()
+//	Renvoie la valeur "int" user de l'objet.
+//--
+
+//++
+// Titre	Gestion du copier/coller
+//	L'ensemble des méthodes de gestion de copier/coller sont décrites ici. Les méthodes
+//	"SelectionLost()", "ProvideSelection()", et "PasteSelection()" doivent être 
+//	redéfinies par les classes héritières de *PIWdg* implémentant la fonctionalité
+//	copier/coller. Le mécanisme copier/coller entre objets d'une même application,
+//	ainsi qu'entre différentes applications. Dans les opérations de copier/coller,
+//	il existe un PIWdg ou une application source des données et un PIWdg ou 
+//	une application destinatire.
+//--
+
+//++
+// bool  ClaimSelection(int typ=PICP_string)
+//	Cette méthode doit être appelée par l'objet "PIWdg" source quand celui-ci veut 
+//	s'approprier la zone d'échange de données (Selection) pour le copier/coller. "typ" indique 
+//	le type de données que peut fournir l'objet. Le type "PICP_string" (suite de caractères)
+//	est le seul type supporté actuellement. La valeur de retour est "true" si 
+//	la zone d'échange est attribué a l'objet. Cette méthode ne doit en principe pas 
+//	être redéfinie par les classes héritières de *PIWdg*.
+// void  SelectionLost()
+//	Cette méthode est appelée quand l'objet "PIWdg" source qui possede la zone d'échange 
+//	(Selection) perd celle-ci, suite par exemple à la demande d'un autre objet. Cette méthode 
+//	doit être redéfinies par les classes qui implémentent la fonctionalité et ne doit 
+//	doit pas être appelée directement.
+// int  RequestSelection(int typ=PICP_string)
+//	Cette méthode doit être appelée par l'objet "PIWdg" destinatire quand celui-ci souhaite 
+//	obtenir les données de la zone d'échange (Selection). "typ" indique les types de données 
+//	acceptables par l'objet. La valeur de retour indique le type qui sera fourni
+//	(à l'appel de "PasteSelection()"). Cette méthode ne doit en principe pas 
+//	être redéfinie par les classes héritières de *PIWdg*.
+// void* ProvideSelection(int& typ, int& len)  
+//	Cette méthode est appelée quand l'objet "PIWdg" source, qui possede la zone d'échange 
+//	(Selection) doit  fournir les données correspondantes à la sélection. Renvoie le pointeur 
+//	de la zone mémoire correspondante, sa longueur ("len") et le type ("typ") des données.
+//	cette zone mémoire appartient à l'objet, et ne doit être modifié tant que 
+//	la méthode "SelectionTransferEnd()" n'a été appelé.
+// void  SelectionTransferEnd()
+//	Cette méthode est appelé une fois que l'objet ou l'application destinataire 
+//	des données de sélection a fini de traiter l'opération de copie. l'objet PIWdg 
+//	source peut alors détruire ou modifier les données correspondantes à l'échange.
+// void  PasteSelection(int typ, void *pdata, int l)
+//	Cette méthode est appelée après l'appel à "RequestSelection()" pour l'objet 
+//	destinataire. "typ" indique le type des données dans "pdata", et "l" la longeur. 
+//	La zone mémoire "pdata" n'appartient pas à l'objet destinataire et ne doit pas 
+//	être modifié par celui-ci. Une copie doit être effectué si cesCette méthode  données devaient
+//	être utilisées après la sortie de "PasteSelection()".
+//--
+
+/* --Methode-- */
+PIWdgGen::PIWdgGen(PIContainerGen *par, char*, int, int, int, int)
+: PIMsgHandler(par)
+{
+parent = par;
+SetMsg(0);
+SetUserData(NULL, 0);
+if (par)  par->ChildAdd(this);   //  On previent le container parent  
+return;
+}
+
+
+/* --Methode-- */
+PIWdgGen::~PIWdgGen()
+{
+if (parent)  parent->ChildDel(this);   //  On previent le container parent 
+}
+
+/* --Methode-- */
+void PIWdgGen::SetMsg(PIMessage msg)
+{
+myMsg = msg;
+}
+
+/* --Methode-- */
+void PIWdgGen::GetScreenPos(int & spx, int & spy)
+/*  Renvoie la position de la fenetre par rapport a l'ecran */
+{
+PIWdgGen * wc;
+spx = 0;  spy = 0;
+wc = this;
+
+while (wc) 
+  { spx += wc->XPos();  
+  spy += wc->YPos();  wc = wc->Parent();
+  }
+return;
+}
+
+/* --Methode-- */
+void PIWdgGen::PSPrint(PSFile *psf, int ofx, int ofy)
+{
+char str[256];
+
+if (!psf) return;
+psf->NewBloc((float)ofx+XPos(), (float)ofy+YPos(), (float)XSize(), (float)YSize(),
+             (float)XSize(), (float)YSize());
+psf->DrawBox(0., 0., (float)XSize(), (float)YSize());
+sprintf(str,"PIWdgGen::PSPrint() Kind=%ld Name= %s", kind(), Nom().c_str());
+psf->DrawString(12., 12., str, PI_Black, PI_RomanFont, 10);
+psf->EndBloc();
+
+return;
+}
+
+/* --Methode-- 
+string PIWdgGen::kindstr()
+{
+char b[5];
+string s;
+
+b[0] = (char) (kind()&0x000000FF);
+b[1] = (char) ((kind()&0x0000FF00) / 0x100);
+b[2] = (char) ((kind()&0x00FF0000) / 0x10000);
+b[3] = (char) ((kind()&0xFF000000) / 0x1000000);
+b[4] = '\0';
+s = b;
+return(s);
+}
+*/
Index: /branches/EA_Juin98/SophyaPI/PI/piwdggen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdggen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdggen.h	(revision 108)
@@ -0,0 +1,100 @@
+/* Classe pour enrobage generique des widgets Xt, Mac, etc  */
+/*                                    Reza 10/95            */
+
+#ifndef PIWDG_H_SEEN
+#define PIWDG_H_SEEN
+
+#include <string>
+
+#include "pimsghandler.h"
+
+void PIBeep();
+
+// Les differents types d accrochage aux containers  
+
+enum PIBindingKind {    
+  PIBK_free = 0,
+  PIBK_fixed = 1,
+  PIBK_elastic = 2
+};
+
+enum PICopyPasteKind {    // Pour gerer les types d objets echange en copier/coller
+  PICP_string = 1
+};
+
+class PSFile;
+class PIContainerGen;
+class PIWdgGen : public PIMsgHandler
+{
+public:
+  enum {ClassId = 100};
+
+                         PIWdgGen(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual               ~PIWdgGen();
+  virtual void		 FinishCreate()=0; // apres avoir installe les sous-vues
+
+  virtual long           kind() {return ClassId; }
+//  string               kindstr();
+
+  inline PIWdgGen*       Parent() { return( (PIWdgGen*)parent ); }
+
+  inline void         	 SetUserData( void * p, int fg = 0) {pdata=p; flag=fg; }
+  inline void*       	 UserData() { return (pdata); };
+  inline void const* 	 UserData() const { return (pdata); };
+  inline int         	 UserFlag() { return(flag); };
+
+
+  virtual void           SetMsg(PIMessage msg = 0);
+  inline  PIMessage      Msg() { return (myMsg); }
+
+  virtual void           SetSize(int sx, int sy)=0;
+  virtual void           SetPos(int px, int py)=0;
+  virtual void           SetBorderWidth(int bw)=0;
+  virtual void           SetLabel(string const&) {}
+  virtual void           SetBinding(PIBindingKind left, PIBindingKind top, 
+                                    PIBindingKind right, PIBindingKind bottom)=0;
+
+  virtual int            XSize()=0;
+  virtual int            YSize()=0;
+  virtual int            XPos()=0;
+  virtual int            YPos()=0;
+
+  virtual string         Nom()=0;
+  virtual void           GetScreenPos(int & spx, int & spy);
+
+// Pour activer, desactiver un composant graphique (PIWdg)
+  virtual void           Manage()=0;
+  virtual void           UnManage()=0;
+  virtual bool           IfManaged()=0;
+  virtual bool           IsVisible()=0;
+
+//  Pour rendre un composant graphique (PIWdg) sensible/insensible 
+//  aux actions utilisateur (souris, clavier, ...)
+  virtual void           SetSensitive()=0;
+  virtual void           SetUnSensitive()=0;
+  virtual bool           IfSensitive()=0;
+
+  virtual void           PSPrint(PSFile *psf, int ofx=0, int ofy=0);
+
+//  Gestion de copier-coller
+  virtual bool           ClaimSelection(unsigned int typ=PICP_string)                     = 0;
+  virtual void           SelectionLost()                                                  = 0;
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string)                   = 0;
+  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len)           = 0;
+  virtual void           SelectionTransferEnd()                                           = 0;
+  virtual void           PasteSelection(unsigned int typ, void *pdata, unsigned int l)    = 0;
+
+protected:
+  PIContainerGen        *parent;
+  PIMessage              myMsg;
+
+private:
+  int flag;
+  void * pdata;
+};
+
+
+  
+
+#endif/* PIWDG_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgmac.cc	(revision 108)
@@ -0,0 +1,251 @@
+#include "piwdgmac.h"
+#include "pisysdep.h"
+
+#include PICONT_H
+
+#include <LView.h>
+#include <LString.h>
+
+void PIBeep()
+{
+  ::SysBeep(1);
+}
+
+
+PIWdgMac::PIWdgMac(PIContainerGen *par, char *nom,
+                   int sx, int sy, int px, int py)
+:PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
+{
+  mAdapterPaneInfo.paneID    = 0;
+  mAdapterPaneInfo.width     = sx;
+  mAdapterPaneInfo.height    = sy;
+  mAdapterPaneInfo.visible   = true;
+  mAdapterPaneInfo.enabled   = true;
+  mAdapterPaneInfo.bindings.left =
+    mAdapterPaneInfo.bindings.top =
+    mAdapterPaneInfo.bindings.right =
+    mAdapterPaneInfo.bindings.bottom = false;
+  mAdapterPaneInfo.left      = px;
+  mAdapterPaneInfo.top       = py;
+  mAdapterPaneInfo.userCon   = 0;
+  mAdapterPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
+
+  mAdapterViewInfo.imageSize.width = sx;
+  mAdapterViewInfo.imageSize.height = sy;
+  mAdapterViewInfo.scrollPos.h = 
+    mAdapterViewInfo.scrollPos.v = 
+    mAdapterViewInfo.scrollUnit.h = 
+    mAdapterViewInfo.scrollUnit.v = 0;
+  mAdapterViewInfo.reconcileOverhang = 0;
+
+  mAdapter = new PIPPViewAdapter(mAdapterPaneInfo, mAdapterViewInfo);
+
+  mPaneInfo.paneID    = 'PIWD';
+  mPaneInfo.width     = sx;
+  mPaneInfo.height    = sy;
+  mPaneInfo.visible   = true;
+  mPaneInfo.enabled   = true;
+  mPaneInfo.bindings.left =
+    mPaneInfo.bindings.top =
+    mPaneInfo.bindings.right =
+    mPaneInfo.bindings.bottom = true;
+  mPaneInfo.left      = 0;
+  mPaneInfo.top       = 0;
+  mPaneInfo.userCon   = 'PIWD';
+  mPaneInfo.superView = mAdapter;
+
+  mViewInfo.imageSize.width = sx;
+  mViewInfo.imageSize.height = sy;
+  mViewInfo.scrollPos.h = 
+    mViewInfo.scrollPos.v = 
+    mViewInfo.scrollUnit.h = 
+    mViewInfo.scrollUnit.v = 0;
+  mViewInfo.reconcileOverhang = 0;
+  
+  mPane = new LView(mPaneInfo, mViewInfo);
+  ((LView*)mAdapter)->CalcPortOrigin();
+  ((LView*)mPane)->CalcPortOrigin();
+}
+
+
+PIWdgMac::~PIWdgMac()
+{
+  delete mPane;
+  delete mAdapter;
+}
+
+void
+PIWdgMac::FinishCreate()
+{
+  mPane->FinishCreate();
+}
+
+void
+PIWdgMac::ListenToMessage(MessageT /*inMessage*/, void */*ioParam*/)
+{
+
+}
+
+void
+PIWdgMac::SetLabel(string const& lab)
+{
+  LStr255 titre(lab.c_str());
+  mPane->SetDescriptor(titre);
+}
+
+void
+PIWdgMac::SetSize(int sx, int sy)
+{
+  if (mAdapter)
+   mAdapter->ResizeFrameTo(sx, sy, true);
+  else
+   mPane->ResizeFrameTo(sx, sy, true);
+}
+
+void
+PIWdgMac::SetPos(int px, int py)
+{
+  if (mAdapter)
+   mAdapter->MoveBy(px-XPos(), py-YPos(), false);
+  else
+   mPane->MoveBy(px-XPos(), py-YPos(), false);
+}
+
+void
+PIWdgMac::SetBinding(PIBindingKind left, PIBindingKind top, 
+                     PIBindingKind right, PIBindingKind bottom)
+{
+  if (mAdapter)  
+    mAdapter->SetBinding(left, top, right, bottom);
+  //else
+  //  mPane->SetBinding(left, top, right, bottom);
+}
+
+int
+PIWdgMac::XSize()
+{ 
+  SDimension16 outSize;
+  mPane->GetFrameSize(outSize);
+  return outSize.width;
+}
+
+int
+PIWdgMac::YSize()
+{ 
+  SDimension16 outSize;
+  mPane->GetFrameSize(outSize);
+  return outSize.height;
+}
+
+int
+PIWdgMac::XPos()
+{
+  SPoint32 p;
+  mPane->GetFrameLocation(p);
+  return p.h;
+}
+
+int
+PIWdgMac::YPos()
+{
+  SPoint32 p;
+  mPane->GetFrameLocation(p);
+  return p.v;
+}
+
+
+bool 
+PIWdgMac::IsVisible()    // $CHECK$  REZA a verifier  01/12/97
+{
+if (mPane->IsVisible())  return(true);
+else return(false);
+}
+
+
+// Gestion de Copier/Coller
+#include <LClipboard.h>
+/* --Methode-- */
+// COPY
+bool PIWdgMac::ClaimSelection(unsigned int)
+{
+  int l;
+  char* txt = SelectionString(l);
+  LClipboard::GetClipboard()->SetData('TEXT',txt,l,true);
+  delete[] txt;
+  return (true);
+}
+
+/* --Methode-- */
+void PIWdgMac::SelectionLost()
+{
+}
+
+/* --Methode-- */
+// PASTE
+unsigned int PIWdgMac::RequestSelection(unsigned int)
+{
+  Handle h = NewHandle(0);
+  Int32 l = LClipboard::GetClipboard()->GetData('TEXT', h);
+  if (l) {
+    CopyFromSelection(*h, l);
+  }
+  return 1;
+}
+
+/* --Methode-- */
+void PIWdgMac::CopyFromSelection(char * sv, int l)
+{
+char* buff = new char[l+2];
+strncpy(buff, sv, l);
+buff[l] = '\0';
+printf("PIWdgMac::RequestSelection() L=%d [%s] \n", l, buff);
+delete buff;
+return;
+}
+
+/* --Methode-- */
+void PIWdgMac::PasteSelection(unsigned int, void *buff, unsigned int l)
+{
+  CopyFromSelection((char*) buff, l);
+}
+
+/* --Methode-- */
+char* PIWdgMac::SelectionString(int& len)
+{
+char *rs = new char[60];
+strcpy(rs, "Test-of-PIWdgMac::SelectionString()");
+len = strlen(rs);
+return(rs);
+}
+
+
+/* --Methode-- */
+void* PIWdgMac::ProvideSelection(unsigned int&, unsigned int& len)
+{
+  return SelectionString(len);
+}
+
+/* --Methode-- */
+void PIWdgMac::SelectionTransferEnd()
+{
+}
+
+/* --Methode-- */
+void PIWdgMac::Manage()
+{
+  if (mAdapter) mAdapter->Show();
+  mPane->Show();
+}
+
+/* --Methode-- */
+void PIWdgMac::UnManage()
+{
+  mPane->Hide();
+  if (mAdapter) mAdapter->Hide();
+}
+
+/* --Methode-- */
+bool PIWdgMac::IfManaged()
+{
+  return(mPane->IsVisible());
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgmac.h	(revision 108)
@@ -0,0 +1,64 @@
+#ifndef PIWDG_MAC_SEEN
+#define PIWDG_MAC_SEEN
+
+#include "piwdggen.h"
+#include "pippviewadapter.h"
+#include <LPane.h>
+#include <LListener.h>
+
+class PIWdgMac : public PIWdgGen, public LListener {
+public:
+  
+                         PIWdgMac(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual                ~PIWdgMac();
+  virtual void			 FinishCreate(); // apres avoir installe les sous-vues
+                                       
+  virtual void	         ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void           SetLabel(string const&);
+
+  virtual void           SetSize(int sx, int sy);
+  virtual void           SetPos(int px, int py);
+  virtual void           SetBorderWidth(int /*bw*/) {}
+  virtual void           SetBinding(PIBindingKind left, PIBindingKind top, 
+                                    PIBindingKind right, PIBindingKind bottom);
+  virtual int            XSize();
+  virtual int            YSize();
+  virtual int            XPos();
+  virtual int            YPos();
+  virtual string         Nom()  { return mNom; }
+
+  virtual void           Manage();
+  virtual void           UnManage();
+  virtual bool           IfManaged();
+  virtual bool           IsVisible();
+  
+//  Gestion de copier-coller
+// $$CHECK$$ Pourquoi les noms ont-ils change ???
+// En plus, pour des trucs tout aussi obscurs...
+// Et c'est quoi, typ, qui en plus n'est pas utilise sous X ???
+  virtual bool           ClaimSelection(unsigned int typ=PICP_string);
+  virtual void           SelectionLost();
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string);
+  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void           PasteSelection(unsigned int typ, void *, unsigned int l);
+  virtual void           CopyFromSelection(char *, int l);
+  virtual char*          SelectionString(int& len);
+  virtual void           SelectionTransferEnd();
+
+protected:
+  LPane*				 mPane;
+  PIPPViewAdapter*       mAdapter;
+  SPaneInfo				 mAdapterPaneInfo;
+  SViewInfo				 mAdapterViewInfo;
+  SPaneInfo				 mPaneInfo;
+  SViewInfo				 mViewInfo;
+  string                 mNom;
+  
+  friend class PIGraphicMac;
+};
+
+typedef PIWdgMac PIWdg;
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgx.cc	(revision 108)
@@ -0,0 +1,711 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Shell.h>
+#include <X11/Core.h>
+#include <X11/CoreP.h>
+
+#include <Xm/Xm.h>       // A cause des container XmForm 
+#include <Xm/Form.h>     // Idem 
+
+#include "piwdgx.h"
+#include "picontainerx.h"
+
+
+// #define DEBUG_PIWdgX
+
+// Quelques variables statiques globales, Connection Display, Top Widget Xt, AppContext Xt ...
+// et leurs fonctions d'acces 
+static SysDWdg  top = NULL;
+static Display * dpy = NULL;
+// static char appname[64];
+static char appclass[64];
+static XtAppContext appctx;
+static int appSzX = 10;
+static int appSzY = 10;
+static XFontStruct * stdfnt = NULL;
+
+/* Nouvelle-Fonction */
+XtAppContext* PIXtAppCtx(int& szx, int& szy)
+{
+szx = appSzX;  szy = appSzY;
+return(&appctx);
+}
+
+/* Nouvelle-Fonction */
+SysDWdg   PIXtTopWdg()
+{
+return (top);
+}
+
+/* Nouvelle-Fonction */
+Display * PIXDisplay()
+{
+return(dpy);
+}
+
+/* Nouvelle-Fonction */
+void PIBeep()
+{
+XBell(dpy, 0);
+return;
+}
+
+/* Nouvelle-Fonction */
+int CStrFrXmStr(XmString xms, char* buff, int nmx)
+/*  Pour recuperer le contenu d'un string Motif  */
+{
+int n,l,m;
+XmStringContext cntx;
+char *txs;
+XmStringDirection dir;
+XmStringCharSet cset;
+Boolean sep;
+
+if (nmx < 2)  return(0);
+n = 0;  m = nmx-1;  buff[0] = buff[m] = '\0';
+XmStringInitContext (&cntx, xms);
+while (m > 0)
+  {
+  if (XmStringGetNextSegment( cntx, &txs, &cset, &dir, &sep) )
+    {
+    l = strlen(txs);
+    if (m < l)  txs[m] = '\0';
+    strcpy(buff+n, txs);
+    n += l;   m -= l;
+    if (sep)  m = -2;
+    XtFree(txs);
+    }
+  else m = -1;
+  }
+
+return(n);
+} 
+
+
+/* --Methode-- */
+PIWdgX::PIWdgX(int narg, char *arg[])
+:PIWdgGen(NULL, "PITopLevel")  
+{
+if (top == NULL)  InitXt(narg, arg);
+sdw = top;
+wmis =  k_wmi_appshell;
+stmng = false;
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::PIWdgX(int , char * [])  this=%lx  top=%lx \n", (long)this, (long)sdw);
+#endif
+}
+
+
+
+/* --Methode-- */
+PIWdgX::PIWdgX(PIContainerGen *par, char *nom, 
+               int sx, int sy, int px, int py)
+:PIWdgGen(par, nom, sx, sy, px, py) 
+{
+sdw = NULL;
+wmis = k_wmi_unknown;
+}
+
+/* --Methode-- */
+int PIWdgX::CreateXtWdg(char *nom, SysDWdgClass wdgcl, SysDWdg pwdg,
+                        int sx, int sy, int px, int py)
+{
+Arg  wargs[5];
+int n=0;
+
+if (pwdg == NULL)
+  {
+  if (parent == NULL)
+    {
+    if (top == NULL)  InitXt();
+    pwdg = top;
+    }
+  // else pwdg = ((PIContainerX *)parent)->sdw;
+  else pwdg = ((PIWdgX *)parent)->sdw;
+  }
+
+n=0;
+if ((sx >= 0) && (sy >= 0))
+  {
+  XtSetArg(wargs[n],XtNwidth,sx);  n++;
+  XtSetArg(wargs[n],XtNheight,sy);  n++;
+  }
+XtSetArg(wargs[n],XtNx,px);  n++;
+XtSetArg(wargs[n],XtNy,py);  n++;
+
+if (wdgcl == NULL)  wdgcl = coreWidgetClass;
+
+if ( (wdgcl == topLevelShellWidgetClass) || 
+     (wdgcl == transientShellWidgetClass) ||
+     (wdgcl == overrideShellWidgetClass) )
+  {
+  sdw = XtCreatePopupShell(nom, wdgcl, pwdg, wargs, n);
+  }
+else
+  {
+  sdw = XtCreateWidget(nom, wdgcl, pwdg, wargs, n);
+  }
+
+if (wdgcl == topLevelShellWidgetClass)  wmis = k_wmi_toplevel;
+else if (wdgcl == transientShellWidgetClass)  wmis = k_wmi_transient;
+else if (wdgcl == overrideShellWidgetClass)  wmis = k_wmi_override;
+else wmis = k_wmi_normal ;
+
+stmng = false;
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::CreateXtWdg(%s) this=%lx sdw=%lx pere=%lx wmis=%d\n", nom, 
+       (long)this, (long)sdw, (long)pwdg, wmis);
+#endif
+
+SetBinding(PIBK_free, PIBK_free, PIBK_free, PIBK_free);
+return(0);
+}
+
+
+/* --Methode-- */
+PIWdgX::~PIWdgX()
+{
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::~PIWdgX()  %lx %lx \n", (long)this, (long)sdw);
+#endif
+if (!sdw)  XtDestroyWidget(sdw);
+}
+
+
+/* --Methode-- */
+void PIWdgX::FinishCreate()
+{
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::FinishCreate() ne fait rien ! \n");
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIWdgX::Manage()
+{
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::Manage  this=%lx  sdw=%lx \n", (long)this, (long)sdw);
+#endif
+if (!sdw)  return;
+if (wmis != k_wmi_appshell)  XtManageChild(sdw);
+else if (!XtIsRealized(sdw))  XtRealizeWidget(sdw);  
+stmng = true;
+return;
+}
+
+/* --Methode-- */
+void PIWdgX::UnManage()
+{
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::UnManage  this=%lx sdw=%lx \n", (long)this, (long)sdw);
+#endif
+if (!sdw)  return;
+if (wmis != k_wmi_appshell) 
+  XtUnmanageChild(sdw);
+stmng = false;
+return;
+}
+
+/* --Methode-- */
+bool PIWdgX::IfManaged()
+{
+return(stmng);
+}
+
+/* --Methode-- */
+bool PIWdgX::IsVisible()
+{
+if ( (XtIsRealized(XtWdg())) &&  
+   ( (this->XtWdg())->core.visible) )  return(true);
+else return(false);       
+}
+
+/* --Methode-- */
+void PIWdgX::SetSensitive()
+{
+XtSetSensitive(XtWdg(), TRUE);
+}
+
+/* --Methode-- */
+void PIWdgX::SetUnSensitive()
+{
+XtSetSensitive(XtWdg(), FALSE);
+}
+
+/* --Methode-- */
+bool PIWdgX::IfSensitive()
+{
+if (XtIsSensitive(XtWdg()) == TRUE)  return(true);
+else return(false);
+}
+
+/* --Methode-- */
+void PIWdgX::SetSize(int sx, int sy)
+{
+#ifdef DEBUG_PIWdgX
+printf("Debug_PIWdgX::SetSize  this=%lx  sdw=%lx \n", (long)this, (long)sdw);
+#endif
+
+if (!sdw)  return;
+/*
+Arg  wargs[2];
+XtSetArg(wargs[0],XtNwidth,sx); 
+XtSetArg(wargs[1],XtNheight,sy); 
+XtSetValues(this->sdw, wargs, 2);
+*/
+XtResizeWidget(sdw, sx, sy, BorderWidth());
+
+return;
+} 
+
+/* --Methode-- */
+void PIWdgX::SetPos(int px, int py)
+{
+if (!sdw)  return;
+/*
+Arg  wargs[2];
+XtSetArg(wargs[0],XtNx,px);  
+XtSetArg(wargs[1],XtNy,py);  
+XtSetValues(this->sdw, wargs, 2);
+*/
+XtMoveWidget(sdw, px, py);
+
+return;
+} 
+
+/* --Methode-- */
+void PIWdgX::SetBinding(PIBindingKind left, PIBindingKind top, 
+                        PIBindingKind right, PIBindingKind bottom)
+{
+Arg  wargs[9];
+int n=0;
+if (!sdw)  return;
+if (!parent)  return;
+
+int fbase = 1000 ;  // Valeur de XmNfractionBase des XmForm ds PIContainerX
+int frpos = 0;
+float frac;
+
+n = 0;
+XtSetArg(wargs[n],XmNfractionBase, fbase);  n++;
+XtSetValues(parent->XtWdg(), wargs, n);
+
+// printf(" DEBUG_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
+// parent->YSize(), XSize(), YSize(), XPos(), YPos());
+switch (left)
+  {
+  case PIBK_free : 
+    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE);  n++;
+    break;
+  case PIBK_fixed :
+    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM);  n++;
+    XtSetArg(wargs[n],XmNleftOffset, XPos() );  n++;
+    break;
+  case PIBK_elastic :
+    XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_POSITION);  n++;
+    frac = (float)(XPos())/(float)parent->XSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNleftPosition, frpos );  n++;
+    break;
+  }
+
+switch (top)
+  {
+  case PIBK_free : 
+    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE);  n++;
+    break;
+  case PIBK_fixed :
+    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM);  n++;
+    XtSetArg(wargs[n],XmNtopOffset, YPos() );  n++;
+    break;
+  case PIBK_elastic :
+    XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_POSITION);  n++;
+    frac = (float)(YPos())/(float)parent->YSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNtopPosition, frpos );  n++;
+    break;
+  }
+  
+switch (right) 
+  {
+  case PIBK_free : 
+    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE);  n++;
+    break;
+  case PIBK_fixed :
+    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM);  n++;
+    XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) );  n++;
+    break;
+  case PIBK_elastic :
+    XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_POSITION);  n++;
+    frac = (float)(XPos()+XSize())/(float)parent->XSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNrightPosition, frpos );  n++;
+    break;
+  }
+
+switch (bottom) 
+  {
+  case PIBK_free : 
+    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE);  n++;
+    break;
+  case PIBK_fixed :
+    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM);  n++;
+    XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) );  n++;
+    break;
+  case PIBK_elastic :
+    XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_POSITION);  n++;
+    frac = (float)(YPos()+YSize())/(float)parent->YSize() ;
+    frpos = frac*fbase;
+    XtSetArg(wargs[n],XmNbottomPosition, frpos );  n++;
+    break;
+  }
+
+XtSetValues(this->sdw, wargs, n);
+
+// printf(" Out_SetBinding: C-Sz= %d %d - Sz=%d %d , Pos= %d %d \n",  parent->XSize(),
+// parent->YSize(), XSize(), YSize(), XPos(), YPos());
+
+return;
+}
+
+
+/* --Methode-- */
+void PIWdgX::SetBorderWidth(int bw)
+{
+if (!sdw)  return;
+
+Arg  wargs[2];
+int n=0;
+
+XtSetArg(wargs[n],XtNborderWidth,bw);  n++;
+XtSetValues(this->sdw, wargs, n);
+return;
+}
+
+/* --Methode-- */
+void PIWdgX::SetLabel(string const& lab)
+{
+XmString xmstr;
+xmstr = XmStringLtoRCreate((char *)lab.c_str(), XmSTRING_DEFAULT_CHARSET);
+int n=0;
+Arg warg[2];
+
+XtSetArg(warg[n], XmNlabelString, xmstr); n++;
+XtSetValues(XtWdg(), warg, n);
+XmStringFree(xmstr);
+return;
+}
+
+
+
+/* --Methode-- */
+int PIWdgX::XSize()
+{
+if (!sdw)  return(-1);
+else return((int)this->sdw->core.width);
+}
+
+/* --Methode-- */
+int PIWdgX::YSize()
+{
+if (!sdw)  return(-1);
+else return((int)this->sdw->core.height);
+}
+
+/* --Methode-- */
+int PIWdgX::XPos()
+{
+if (!sdw)  return(-1);
+else return((int)this->sdw->core.x);
+}
+
+/* --Methode-- */
+int PIWdgX::YPos()
+{
+if (!sdw)  return(-1);
+else return((int)this->sdw->core.y);
+}
+
+
+/* --Methode-- */
+int PIWdgX::BorderWidth()
+{
+if (!sdw)  return(-1);
+Arg  wargs[2];
+int bw;
+XtSetArg(wargs[0],XtNborderWidth, &bw);  
+XtGetValues(this->sdw, wargs, 1);
+return(bw);
+}
+
+/* --Methode-- */
+string PIWdgX::Nom()
+{
+return(XtName(this->sdw));
+}
+
+/* --Methode-- */
+void PIWdgX::GetScreenPos(int & spx, int & spy)
+{
+PIWdgX * wc;
+Display *mdsp;
+Window w, rw, pw, *cw;
+unsigned int ncw;
+Status st;
+int x,y;
+unsigned int bw, l, h, d;
+
+spx = 0;  spy = 0;
+wc = this;
+
+while (wc)
+  { spx += wc->XPos();
+  spy += wc->YPos();  wc = (PIWdgX *)wc->Parent();
+  }
+
+mdsp = XtDisplay(XtWdg());
+w = XtWindow(XtWdg());
+ncw = 0;
+st = XQueryTree(mdsp, w, &rw, &pw, &cw, &ncw);
+if (st) 
+  { XFree(cw);
+  if (pw == rw)  return; }
+
+while (st && (pw != rw))  
+  {
+  w = pw;
+  st = XQueryTree(mdsp, w, &rw, &pw, &cw, &ncw); 
+  if (st)   XFree(cw);
+  XGetGeometry(mdsp, w, &rw, &x, &y, &l, &h, &bw, &d);  
+  spy += y;  spx += x;
+  }  
+return;
+}
+
+
+// Ressources X si non definis 
+static String fallback_res[22] = {
+"PeidaInt*default*background:                 LightGrey" ,
+"PeidaInt*background:                         LightGrey" ,
+"PeidaInt*bottomShadowColor:                  Black" ,
+"PeidaInt*default*bottomShadowColor:          Black" , 
+"PeidaInt*Foreground:                         Black",
+"PeidaInt*default*Foreground:                 Black",
+"PeidaInt*topShadowColor:                     White",
+"PeidaInt*default*topShadowColor:             White",
+"PeidaInt*borderColor:                        Black",
+"PeidaInt*XmLabel.borderWidth:                0",
+"PeidaInt*XmScrollBar*background:             LightGrey",
+"PeidaInt*XmDrawingArea*background:           Black",
+"PeidaInt*XmPushButton*borderWidth:           0",
+"PeidaInt*XmText*shadowThickness:             2",
+"PeidaInt*XmText*highlightThickness:          0",
+"PeidaInt*XmText*marginHeigt:                 0",
+"PeidaInt*XmText*marginWidth:                 3",
+// "PeidaInt*DefMenubar*XtNwidth:                250",
+// "PeidaInt*DefMenubar*XtNheight:               30",
+"PeidaInt*fontList:           -*-courier-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1",
+"PeidaInt*default*fontList:   -*-courier-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1"
+"PeidaInt*fontFamilyName:                     *-courier",   // Pas de blanc apres le nom de font
+"PeidaInt*XmToggleButton*selectColor:         Red",
+""
+};
+
+
+/* --Methode-- */
+int PIWdgX::InitXt(int narg, char *arg[])
+{
+if (top != NULL)  return(0);
+// Initialisation ...  
+int n;
+char *pc = "PIWdgX";
+char **ppc;
+if (narg > 0)  { n = narg, ppc = arg; }
+else { ppc = &pc; n = 1; }
+//  strncpy(appname, ppc[0], 63); appname[63] = '\0';
+strncpy(appclass,"PeidaInt",63);  appclass[63] = '\0';     
+//  top = XtAppInitialize(&appctx, appclass, NULL, 0, &n, ppc);
+top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, fallback_res, NULL);
+dpy = XtDisplay(top);
+
+// On va recuperer la fonte par defaut des composantes Motif
+XtResource res[] = {
+  { "fontList", "FontList", XtRString, sizeof(String),
+    0, XtRString, "-*-courier-bold-*-*-*-*-*-*-*-*-*-*-*" }
+};
+
+String fntname;
+XtGetApplicationResources(top, &fntname, res, XtNumber(res), NULL, 0);
+// scr = XDefaultScreen(dpy);
+int count;
+char **list;
+char buff[256];
+strcpy(buff, fntname);
+list = XListFonts(dpy, buff, 15, &count);
+XFreeFontNames(list);
+if (count < 1)  strcpy(buff,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*" );
+stdfnt = XLoadQueryFont(dpy, buff);
+
+// On calcule la taille de la chaine CANCEL (6 caracteres)
+char a[2];
+XCharStruct  ovr;
+int hd, fa, fd, len;  // direction, font-ascent, font-descent len("CANCEL")
+XTextExtents(stdfnt, a, 0, &hd, &fa, &fd, &ovr);
+len = XTextWidth(stdfnt, "CANCEL", 6);
+appSzY = (float)(fa+fd)*1.4+10;  // pour les shadow
+appSzX = (float)len*1.5;
+// Taille multiple de 5 pixels 
+if ( (appSzX % 5) != 0 )   appSzX = 5*(appSzX/5 + 1);
+if ( (appSzY % 5) != 0 )   appSzY = 5*(appSzY/5 + 1);
+if(appSzY < 10) appSzY = 10;
+if(appSzX < 30) appSzX = 30;
+
+// printf("PIWdgX::InitXt(Font=%s- %d %d , %d ) SzX,Y= %d %d \n", buff, fa,fd,len,appSzX, appSzY);
+return(0);
+}
+
+/* .................................................................*/
+/* ................... Gestion de Copier/Coller ....................*/
+/* .................................................................*/
+
+// Les Call-Backs Xt
+
+static Boolean forXt_ConvertSelection(Widget w, Atom* sel, Atom *targ, Atom* typ,
+                                   XtPointer* value, unsigned long* len, int* format);
+
+static void forXt_LoseSelection(Widget w, Atom* sel);
+static void forXt_DoneSelection(Widget w, Atom* sel, Atom *targ);
+static void forXt_SelectionValue(Widget w, XtPointer usd, Atom* sel, Atom* typ, 
+                                 XtPointer value, unsigned long* len, int* format );
+
+static PIWdgX* curselwdg = NULL;    // Le PIWdg qui possede la selection
+static unsigned int curseltype = PICP_string; // Type de selcetion qu'il peut fournir
+static unsigned int reqseltype = PICP_string; // Type de selection demande
+static unsigned int provseltype = PICP_string; // Type de selection fourni
+
+/* Nouvelle-Fonction */
+Boolean forXt_ConvertSelection(Widget w, Atom* sel, Atom *targ, Atom* typ,
+                                   XtPointer* value, unsigned long* len, int* format)
+{
+if (*targ != XA_STRING)  return(FALSE);
+if (!curselwdg)  return(FALSE);
+unsigned int ll = 0;
+unsigned int styp = reqseltype;
+*value = curselwdg->ProvideSelection(styp, ll);
+*len=ll;
+*typ = XA_STRING;
+*format = 8;
+provseltype = (styp != 0) ? styp : PICP_string;
+return(TRUE);
+}
+
+/* Nouvelle-Fonction */
+void forXt_LoseSelection(Widget w, Atom* sel)
+{
+if (curselwdg)  curselwdg->SelectionLost();
+curselwdg = NULL; curseltype = PICP_string; 
+}
+
+/* Nouvelle-Fonction */
+void forXt_DoneSelection(Widget w, Atom* sel, Atom *targ)
+{
+if (curselwdg)  curselwdg->SelectionTransferEnd();
+}
+
+/* Nouvelle-Fonction */
+void forXt_SelectionValue(Widget w, XtPointer usd, Atom* sel, Atom* typ, 
+                                 XtPointer value, unsigned long* len, int* format )
+{
+if ( (value != NULL) && (*len > 0) ) 
+  ((PIWdgX*)usd)->PasteSelection(provseltype, (void*)value, (*len)) ;
+}
+
+
+
+// Gestion de Copier/Coller
+/* --Methode-- */
+bool PIWdgX::ClaimSelection(unsigned int typ)
+// Pour prendre possession du buffer copier/coller
+{
+if (XtOwnSelection(XtWdg(), XA_PRIMARY, PIXGetLastEventTime(), forXt_ConvertSelection, 
+                   forXt_LoseSelection, forXt_DoneSelection) ) {
+#ifdef DEBUG_PIWdgX
+  printf("PIWdgX::ClaimSelection(%d) - OK  (Wdg= %lx)\n", typ, (unsigned long)this);
+#endif
+  curselwdg = this;
+  curseltype = (typ != 0) ? typ : PICP_string;
+  return (true);
+}
+else {
+#ifdef DEBUG_PIWdgX
+  printf("PIWdgX::ClaimSelection() - Probleme (Wdg= %lx)\n", (unsigned long)this);
+#endif
+  curselwdg = NULL;
+  curseltype = PICP_string;
+  return (false);
+}
+}
+
+/* --Methode-- */
+void PIWdgX::SelectionLost()
+// Appele quand le PIWdg perd la possession du buffer copier/coller
+{
+return;
+}
+
+/* --Methode-- */
+unsigned int PIWdgX::RequestSelection(unsigned int typ)
+{
+// Pour demander le contenu du buffer de copier/coller
+#ifdef DEBUG_PIWdgX
+printf("PIWdgX::RequestSelection(%d) (Wdg= %lx - %lx) \n", typ,  
+        (unsigned long)this, (unsigned long)curselwdg);
+#endif
+reqseltype = (typ != 0) ? typ : PICP_string;
+XtGetSelectionValue(XtWdg(), XA_PRIMARY, XA_STRING, forXt_SelectionValue, 
+                    (XtPointer)this, PIXGetLastEventTime());
+return(reqseltype);
+}
+
+static char* rs = NULL;
+
+/* --Methode-- */
+void* PIWdgX::ProvideSelection(unsigned int& typ, unsigned int& len)
+// Le widget doit fournier une l zone memoire contenant la selection
+// en un type donne
+// Renvoie le pointeur de cette zone, sa taille et son typ
+{
+rs = new char[128];
+sprintf(rs, "Test-of-PIWdgX::ProvideSelection(%d)- %lx", typ,(long)rs);
+len = strlen(rs);
+return(rs);
+}
+
+/* --Methode-- */
+void PIWdgX::SelectionTransferEnd()
+{
+delete[] rs;
+}
+
+
+/* --Methode-- */
+void PIWdgX::PasteSelection(unsigned int typ, void *buff, unsigned int l)
+{
+// Methode appele apres que le widget ait fait RequestSelection
+// Le typ de donnees fourni ainsi que les donnees et leur taille 
+// sont en argument 
+#ifdef DEBUG_PIWdgX
+char* mbuff = new char[l+1];
+strncpy(mbuff, (char *)buff, l);
+mbuff[l] = '\0';
+printf("PIWdgX::PasteSelection(%d, %lx, %d) [%s] \n", typ, (long)buff, l, mbuff);
+delete[] mbuff;
+#endif
+return;
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgx.h	(revision 108)
@@ -0,0 +1,96 @@
+/* Classe pour enrobage generique des widgets Xt, Mac, etc  */
+/*                                    Reza 10/95            */
+
+#ifndef PIWDG_X_SEEN
+#define PIWDG_X_SEEN
+
+#include <X11/Xlib.h>
+#include <X11/Intrinsic.h>
+
+#include "piwdggen.h"
+
+typedef Widget SysDWdg;
+typedef WidgetClass SysDWdgClass;
+
+
+enum WmIntState { k_wmi_unknown=0,
+                  k_wmi_normal=1, k_wmi_toplevel=2, 
+                  k_wmi_transient=3, k_wmi_override=4,
+                  k_wmi_appshell=5 };
+
+class PIWdgX : public PIWdgGen 
+{
+public:
+// Les methodes ...
+  PIWdgX(int narg=0, char *arg[]=NULL);
+  PIWdgX(PIContainerGen *par, char *nom, 
+         int sx=10, int sy=10, int px=0, int py=0);
+
+  virtual ~PIWdgX();
+
+  int CreateXtWdg(char *nom, SysDWdgClass wdgcl=NULL, SysDWdg pwdg=NULL,
+                  int sx=10, int sy=10, int px=0, int py=0 );
+
+  virtual void	 FinishCreate(); // apres avoir installe les sous-vues
+
+  virtual void   SetSize(int sx, int sy);
+  virtual void   SetPos(int px, int py);
+  virtual void   SetBorderWidth(int bw);
+  virtual void   SetLabel(string const & lab);
+  virtual void   SetBinding(PIBindingKind left, PIBindingKind top, 
+                            PIBindingKind right, PIBindingKind bottom);
+
+  virtual int    XSize();
+  virtual int    YSize();
+  virtual int    XPos();
+  virtual int    YPos();
+  virtual int    BorderWidth();
+
+  virtual string Nom();  
+  virtual void   GetScreenPos(int & spx, int & spy);
+
+  virtual void   Manage();
+  virtual void   UnManage();
+  virtual bool   IfManaged();
+  virtual bool   IsVisible();
+
+  virtual void           SetSensitive();
+  virtual void           SetUnSensitive();
+  virtual bool           IfSensitive();
+
+//  Gestion de copier-coller
+  virtual bool           ClaimSelection(unsigned int typ=PICP_string);
+  virtual void           SelectionLost();
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string);
+  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void           SelectionTransferEnd();
+  virtual void           PasteSelection(unsigned int typ, void *, unsigned int l);
+
+  inline SysDWdg XtWdg() const {return(sdw); }; 
+  inline SysDWdg& XtWdg() {return(sdw); }; 
+
+protected:
+  int InitXt(int narg=0, char *arg[]=NULL); 
+
+
+  SysDWdg sdw;
+  WmIntState wmis;
+  bool stmng;
+  
+};
+
+typedef PIWdgX PIWdg;
+
+
+// Utile pour avoir acces au Display et Screen X ...
+SysDWdg   PIXtTopWdg();
+XtAppContext* PIXtAppCtx(int& szx, int& szy);
+Display * PIXDisplay();
+#define  PIXScreen()  DefaultScreen(PIXDisplay()) 
+Time PIXGetLastEventTime();
+unsigned long PIXGetLastEventSerial();
+
+#endif/* PIWDGX_SEEN */
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgxt.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgxt.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgxt.cc	(revision 108)
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "piwdggen.h"
+#include "picontainergen.h"
+
+
+/* --Methode-- */
+PIWdgGen::PIWdgGen(PIContainerGen *par, char*, int, int, int, int)
+: PIMsgHandler(par)
+{
+parent = par;
+return;
+}
+
+
+/* --Methode-- */
+PIWdgGen::~PIWdgGen()
+{
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/piwdgxt.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwdgxt.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwdgxt.h	(revision 108)
@@ -0,0 +1,34 @@
+/* Classe pour enrobage generique des widgets Xt, Mac, etc  */
+/*                                    Reza 10/95            */
+
+#ifndef PIWDG_XT_H_SEEN
+#define PIWDG_XT_H_SEEN
+
+#include <string>
+#include "piwdggen.h"
+
+class PIWdgXt : public PIWdgGen
+{
+public:
+                         PIWdgGen(PIContainerGen *par, char *nom,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual               ~PIWdgGen();
+  virtual void		 FinishCreate()=0; // apres avoir installe les sous-vues
+
+
+  virtual void           SetSize(int sx, int sy)=0;
+  virtual void           SetPos(int px, int py)=0;
+  virtual void           SetLabel(string const&) {}
+
+  virtual int            XSize();
+  virtual int            YSize();
+  virtual int            XPos();
+  virtual int            YPos();
+
+  
+};
+
+
+  
+
+#endif/* PIWDG_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowgen.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowgen.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowgen.cc	(revision 108)
@@ -0,0 +1,106 @@
+//  Classe de base pour les fenêtre de premier niveau
+//  dans les programmes graphiques interactives
+//
+//                  E.Aubourg , R. Ansari  96 - 98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "piwindowgen.h"
+#include "psfile.h"
+
+//++
+// Class	PIWindow
+// Lib		PI
+// include	piwindowgen.h
+//
+//	Classe de conteneur (dérivant de *PIContainer") spécialisée pour 
+//	la création des fenêtres de premier niveau, gérée par l'application
+//	"WindowManager". La classe "PIWindow" a  implementation dépendante 
+//	du systeme utilisé (Mac, XWindow, ...). La classe "PIWindowGen" est 
+//	la classe qui définit l'interface, et ne pas doit être instanciée 
+//	directement (Méthodes virtuelles pures). Les objets instanciés sont 
+//	de la classes "PIWindow" et le fichier entête correspondant est 
+//	"PIWIN_H" défini dans "pisysdep.h"
+//--
+//++
+// Links	Parents
+// PIContainer
+//--
+//++
+// Titre	Constructeur
+//--
+//++
+// PIWindowGen(PIMsgHandler* par, char *nom, PIWindowKind k=PIWK_normal, int sx=10, int sy=10, int px=0, int py=0)
+//	Création d'une fenêtre de haut niveau. La variable "PIWindowKind k"  contrôle
+//	le comportement de l'objet vis à vis de l'application WindowManager. Le comportement
+//	exacte, ainsi que l'apparence graphique dépend de la plateforme et du WindowManager
+//	utilisés. "par" est le l'objet "PIMsgHandler" dont dépend la fenêtre, en général un objet
+//	de la classe "PIApplication". "nom" désigne le nom, "sx,sy" la taille et 
+//	"px,py" la position de l'objet.
+//	- "PIWK_normal" : fenêtre ordinaire
+//	- "PIWK_floating" : fenêtre qui reste en avant plan 
+//	- "PIWK_dialog" : fenêtre de dialogue 
+//	- "PIWK_transient" : fenêtre apparaissant an avant plan, sans barre de contrôle 
+// long kind()
+//	Renvoie le type de la classe de l'objet ("=PIWindowGen::ClassId") pour cette classe.
+//--
+
+//++
+// Titre	Méthodes
+//--
+//++
+// void  AutoHideOnClose(bool ahc=true)
+//	Contrôle le comportement par défaut de l'objet quand la fenêtre est fermée
+//	à travers le WindowManager. si "ahc=true", "Hide()" est appelé. 
+//	Le message de l'objet avec le qualificatif "PIMsg_Closë est transmis
+//	au "PIMsgHandler" parent.
+// void  PSPrint(PSFile *psf, int ofx=0, int ofy=0)
+//	Définit une nouvelle page et appelle la méthode "PSPrint()" pour tous les
+//	objets "PIWdg" contenus dans la fenêtre.
+//--
+
+
+/* --Methode-- */
+PIWindowGen::PIWindowGen(PIMsgHandler *par, char *nom, PIWindowKind k, 
+                         int sx, int sy, int px, int py)
+: PIContainer(NULL, nom, sx, sy, px, py), mWtyp(k)
+{
+  SetMsgParent(par);
+  AutoHideOnClose();
+}
+
+
+/* --Methode-- */
+PIWindowGen::~PIWindowGen()
+{}
+
+/* --Methode-- */
+void PIWindowGen::PSPrint(PSFile *psf, int ofx, int ofy)
+{
+if (!psf) return;
+//int ori;
+//ori = (XSize() > YSize()) ? LANDSCAPE : PORTRAIT ;
+psf->NewPage((float)XSize(), (float)YSize(),PI_Auto);
+PIContainerGen::PSPrint(psf, ofx, ofy);
+}
+
+
+/* --Methode-- */
+void PIWindowGen::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+/*  On intercepte le message Active, et Close avant de les renvoyer */
+/*  avec un message ActiveWdg de la part de la fenetre              */
+{
+if (ModMsg(msg) == PIMsg_ResizeRequest) { 
+  // On change la taille de la fenetre - data est un pointeur sur entier
+  // data[0] represente l'increment (positif ou negatif) en X, data[1] en Y
+  int* nsz = (int*) data;
+  SetSize(XSize()+nsz[0], YSize()+nsz[1]);
+  return;
+  }
+else if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 
+  Hide();   // Action par defaut en cas de MsgClose.
+else if (ModMsg(msg) == PIMsg_Active)
+  Send(Msg(),PIMsg_Active);
+
+ReSend(msg, sender, data);
+return;  
+}
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowgen.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowgen.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowgen.h	(revision 108)
@@ -0,0 +1,36 @@
+#ifndef PIWINDOWGEN_H_SEEN
+#define PIWINDOWGEN_H_SEEN
+
+#include "pisysdep.h"
+
+#include PICONT_H
+
+enum PIWindowKind {
+  PIWK_normal = 0,
+  PIWK_dialog = 1,
+  PIWK_transient = 2,
+  PIWK_floating = 3
+};
+
+class PIWindowGen : public PIContainer {
+public:
+  enum {ClassId = 1550};
+		    PIWindowGen(PIMsgHandler* par, char *nom, PIWindowKind k=PIWK_normal,
+                                int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PIWindowGen();
+
+  virtual long      kind() {return ClassId; }
+
+  virtual void      PSPrint(PSFile *psf, int ofx=0, int ofy=0);
+
+  inline  void      AutoHideOnClose(bool ahc=true) { mAHC = ahc; }
+
+  virtual void      Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+  
+protected:  
+  PIWindowKind	       mWtyp;
+  bool                 mAHC;
+};
+
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowmac.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowmac.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowmac.cc	(revision 108)
@@ -0,0 +1,91 @@
+#include "piwindowmac.h"
+#include "pippwindowmac.h"
+
+PIWindowMac::PIWindowMac(PIMsgHandler *par, char *nom, PIWindowKind k, int sx, int sy, int px, int py)
+: PIWindowGen(par, nom, k, sx, sy, px, py), finalized(false)
+{
+	delete mPane;
+	delete mAdapter;
+	mAdapter = NULL;
+	mWindowInfo.WINDid = 1000+k;
+	mWindowInfo.attributes = windAttr_EraseOnUpdate |
+	                         windAttr_Targetable |
+	                         windAttr_Enabled;
+	switch (k) {
+	 case PIWK_normal:
+	  mWindowInfo.attributes |= windAttr_Regular | 
+	                            windAttr_TitleBar |
+	                            windAttr_SizeBox |
+	                            windAttr_CloseBox |
+	                            windAttr_Resizable;
+	  mWindowInfo.layer = windLayer_Regular;
+	  break;
+	 case PIWK_dialog:
+	  mWindowInfo.attributes |= windAttr_Modal;
+	  mWindowInfo.layer = windLayer_Modal;
+	  break;
+	 case PIWK_floating:
+	  mWindowInfo.attributes |= windAttr_Floating |
+	                            windAttr_HideOnSuspend;
+	  mWindowInfo.layer = windLayer_Floating;
+	  break;
+	}
+	mWindowInfo.minimumWidth = 30;
+	mWindowInfo.minimumHeight = 30;
+	mWindowInfo.maximumWidth = 32000;
+	mWindowInfo.maximumHeight = 32000;
+	mWindowInfo.standardSize.width = sx;
+	mWindowInfo.standardSize.height = sy;
+	mWindowInfo.userCon = 0;
+	
+	//mPane = new LWindow(mWindowInfo);
+	mPane = LWindow::CreateWindow(1000+k,LCommander::GetTopCommander());
+    ((PIPPWindowMac*)mPane)->myPIWindow = this; 
+	Rect r = {py, px, py+sy, px+sx};
+    ((LWindow*) mPane)->DoSetBounds(r);
+    SetLabel(nom);
+    //((LWindow*) mPane)->SetSuperCommander(LCommander::GetTopCommander());
+}
+
+
+PIWindowMac::~PIWindowMac()
+{}
+
+
+void PIWindowMac::Show()
+{
+  if (!finalized) {
+    FinishCreate();
+    finalized = true;
+  }
+  PIWindowGen::Show();
+}
+
+void
+PIWindowMac::SetSize(int sx, int sy)
+{
+   ((LWindow*) mPane)->ResizeWindowTo(sx, sy);
+}
+
+void
+PIWindowMac::SetPos(int px, int py)
+{
+   ((LWindow*) mPane)->MoveWindowBy(px-XPos(), py-YPos());
+}
+
+int
+PIWindowMac::XPos()
+{
+	Rect	theBounds;
+	((LWindow*) mPane)->GetGlobalBounds(theBounds);
+    return theBounds.left;
+}
+
+int
+PIWindowMac::YPos()
+{
+	Rect	theBounds;
+	((LWindow*) mPane)->GetGlobalBounds(theBounds);
+    return theBounds.top;
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowmac.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowmac.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowmac.h	(revision 108)
@@ -0,0 +1,26 @@
+#ifndef PIWINDOWMAC_H_SEEN
+#define PIWINDOWMAC_H_SEEN
+
+#include "piwindowgen.h"
+#include "pisysdep.h"
+#include <LWindow.h>
+
+class PIWindowMac : public PIWindowGen {
+public:
+                         PIWindowMac(PIMsgHandler *par, char *nom, PIWindowKind k=PIWK_normal,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual                ~PIWindowMac();
+  virtual void           Show();
+  virtual void           SetSize(int sx, int sy);
+  virtual void           SetPos(int px, int py);
+  virtual int            XPos();
+  virtual int            YPos();
+
+protected:
+  SWindowInfo			  mWindowInfo;
+  Boolean				  finalized;
+};
+
+typedef PIWindowMac PIWindow;
+
+#endif
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowx.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowx.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowx.cc	(revision 108)
@@ -0,0 +1,167 @@
+#include <stdio.h>
+
+#include "piwindowx.h"
+
+#include <X11/Xlib.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Shell.h>
+#include <Xm/Form.h>
+
+/* Fonctions (Callback et action) pour traiter le message Close de WM  */
+
+/* Nouvelle-Fonction */
+static void popdwn_cb(Widget /*w*/, XtPointer *usd,  XtPointer * )
+{
+PIWindowX * dw = (PIWindowX *) usd;
+dw->Process(dw->BuildMsg(dw->Msg(),PIMsg_Close), dw, NULL) ;
+}
+
+
+/* Nouvelle-Fonction */
+static int fgactl = 0;
+
+static void CloseWindow (Widget w, XEvent*, String*,Cardinal*)
+{
+XtCallCallbacks(w,  XtNpopdownCallback, NULL);
+}
+
+
+
+/* --Methode-- */
+PIWindowX::PIWindowX(PIMsgHandler *par, char *nom, PIWindowKind k, 
+                     int sx, int sy, int px, int py)
+: PIWindowGen(par, nom, k, -1, -1, 0, 0)
+{
+XtTranslations trans;
+
+pwm = new PIWdgX(NULL, nom, sx, sy, px, py);
+
+switch (k)
+  {
+  case PIWK_normal :
+  case PIWK_floating :
+    pwm->CreateXtWdg(nom, topLevelShellWidgetClass, NULL, sx, sy, px, py);
+    break;
+  case PIWK_dialog :
+    pwm->CreateXtWdg(nom, transientShellWidgetClass, NULL, sx, sy, px, py);
+    break;
+  case PIWK_transient :
+    pwm->CreateXtWdg(nom, overrideShellWidgetClass, NULL, sx, sy, px, py);
+    break;
+  }
+
+
+/*  Il faut "attraper" l'action close, genere par le window-manager       */
+/*  2 actions sont necessaires, installation d'une action (CloseWindow()) */
+/*  et j'utilise ensuite un callback ds CloseWindow()                     */
+/*  Il faut aussi desactiver l'action de destruction du widget par defaut */
+/*  (XtSetArg(warg, XmNdeleteResponse, ...                                */
+/*  Attention, voir la fonction Show(), pour l'appel a XSetWMProptocols() */
+/*  Pour une fenetre donnee, on peut recuperer les Map, UnMap, Destroy,   */
+/*  etc... il faut appeler XtAddEventHandler( w, Mask, ...)               */
+/*    Mask =  StructureNotifyMask | SubstructureNotifyMask                */
+
+
+
+if ((k == PIWK_normal) || (k == PIWK_floating) || (k == PIWK_dialog))
+  { 
+  if (k == PIWK_dialog)  AutoHideOnClose(false);
+  /* XtAddEventHandler(pwm->XtWdg(), StructureNotifyMask | SubstructureNotifyMask, 
+                  FALSE, wmaction_evthandler, this);*/
+
+  XtAddCallback(pwm->XtWdg(), XtNpopdownCallback,
+                (XtCallbackProc)popdwn_cb, (XtPointer)this);
+
+  if (fgactl == 0) 
+    { 
+    XtActionsRec desact = {"CloseWindow" ,CloseWindow};
+    int szx, szy;
+    XtAppContext * appctx = PIXtAppCtx(szx, szy);
+    XtAppAddActions(*appctx, &desact, 1);  fgactl = 1; 
+    }
+
+  trans = XtParseTranslationTable("<Message>WM_PROTOCOLS:CloseWindow()");
+  XtOverrideTranslations(pwm->XtWdg() , trans);
+  Arg warg[2];
+  XtSetArg(warg[0], XmNdeleteResponse, XmDO_NOTHING);
+  XtSetValues(pwm->XtWdg(), warg, 1);
+  }
+
+CreateXtWdg(nom, xmFormWidgetClass, pwm->XtWdg(), sx, sy, 0, 0);
+}
+
+/* --Methode-- */
+PIWindowX::~PIWindowX()
+{
+delete pwm;
+}
+
+/* --Methode-- */
+void PIWindowX::SetBinding(PIBindingKind /*left*/, PIBindingKind /*top*/, 
+                           PIBindingKind /*right*/, PIBindingKind /*bottom*/)
+{
+// On ne doit rien faire pour les fenetres 
+return;
+}
+
+/* --Methode-- */
+void PIWindowX::SetSize(int sx, int sy)
+{
+pwm->SetSize(sx, sy);
+return;
+}
+
+/* --Methode-- */
+void PIWindowX::SetPos(int px, int py)
+{
+pwm->SetPos(px, py);
+return;
+}
+
+
+/* --Methode-- */
+void PIWindowX::Show()
+{
+int fgr = 0;
+Display *mdsp;
+
+mdsp = XtDisplay(pwm->XtWdg());
+
+PIContainerGen::Show();
+// Manage();  $CHECK$ Ca ne doit plus etre necessaire Reza 9/7/97
+if (!XtIsRealized(pwm->XtWdg()))  fgr = 1;
+pwm->Manage();
+if (fgr) 
+  {
+  Atom wmd;
+  if ((mWtyp == PIWK_normal) || (mWtyp == PIWK_floating) || (mWtyp == PIWK_dialog))
+    { 
+    wmd = XInternAtom(mdsp, "WM_DELETE_WINDOW",False);
+    XSetWMProtocols(mdsp, XtWindow(pwm->XtWdg()), &wmd, 1);
+    }
+  else 
+    XSetTransientForHint(mdsp, XtWindow(PIXtTopWdg()), XtWindow(pwm->XtWdg()));
+  //  Pour faire les actions sur les fenetres X, sinon fenetre pas cree 
+  int k;
+  for(k=0; k<mNCh; k++)  mChilds[k]->FinishCreate();
+  }
+
+// XRaiseWindow est necessaire, sinon la fenetre passe des fois derriere ...
+if (mWtyp == PIWK_transient)  
+  XRaiseWindow(mdsp, XtWindow(pwm->XtWdg()));
+ 
+return;
+}
+
+/* --Methode-- */
+void PIWindowX::Hide()
+{
+PIWindowGen::Hide();
+// UnManage();  $CHECK$ Ca ne doit plus etre necessaire Reza 9/7/97
+pwm->UnManage();
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/piwindowx.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/piwindowx.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/piwindowx.h	(revision 108)
@@ -0,0 +1,29 @@
+#ifndef PIWINDOWX_H_SEEN
+#define PIWINDOWX_H_SEEN
+
+#include "piwindowgen.h"
+#include "pisysdep.h"
+
+
+class PIWindowX : public PIWindowGen {
+public:
+                         PIWindowX(PIMsgHandler *par, char *nom, PIWindowKind k=PIWK_normal,
+                                   int sx=10, int sy=10, int px=0, int py=0);
+  virtual                ~PIWindowX();
+  
+  virtual void           SetBinding(PIBindingKind left, PIBindingKind top, 
+                                    PIBindingKind right, PIBindingKind bottom);
+  virtual void           SetSize(int sx, int sy);
+  virtual void           SetPos(int px, int py);  
+
+  virtual void           Show();
+  virtual void           Hide();
+
+protected:
+  PIWdgX   *pwm;
+
+};
+
+typedef PIWindowX PIWindow;
+
+#endif   /* PIWINDOWX_H_SEEN  */
Index: /branches/EA_Juin98/SophyaPI/PI/pixtbase.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pixtbase.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pixtbase.cc	(revision 108)
@@ -0,0 +1,317 @@
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+
+#include <X11/IntrinsicP.h>
+#include <X11/CoreP.h>
+
+#include <X11/keysym.h>
+
+#include "pixtbaseP.h"
+#include "pixtbase.h"
+
+// #define DEBUG_PIXTB
+
+ 
+//  ------- Pb de gestion du focus-keyboard  Motif-PIBaseWdg -------
+// ** Note 30/04/98  Reza
+// Il y un probleme d'attribution du focus-keyboard entre Widget Motif et
+// PIBaseWdg (Widget PIXtBase) les Attributs XmNnavigationType et XmNtraversalOn
+// ont ete desactives pour les StdWdgX - Le probleme n'a pas pu etre resolu
+// meme en attribuant les attributs  XmNnavigationType XmNtraversalOn 
+// (et XmNsensitive) a PIXtBase, ni en utilisant 
+// XSetInputFocus(XtDisplay (wdgp), XtWindow(wdgp), RevertToParent, evt->xbutton.time)
+// Solution pour le moment :
+//  XmNnavigationType =XmNONE et XmNtraversalOn=FALSE pour les PIStdWdgX 
+// sauf pour PIText ou XmNtraversalOn=TRUE
+
+
+/*  Construction du widget Xt PIXtBase   */
+
+static void     init_class_pixtbase(void);
+
+static void     init_pixtbase    (Widget, Widget, ArgList, Cardinal*);
+static void     destroy_pixtbase (Widget);
+static void     resize_pixtbase  (Widget);
+static void     expose_pixtbase  (Widget, XEvent*, Region);
+
+
+// Si on ne veut pas utiliser XtInheritAcceptFocus
+// static Boolean  acceptfocus_pixtbase   (Widget, Time* ); 
+
+
+static XtResource resources[] ={
+  {PIXNobject ,"Object", XtRPointer, sizeof(XtRPointer),
+   XtOffset(PIXtBaseWidget,  pixtbase.objet), XtRImmediate, (XtPointer)0},
+};
+
+
+PIXtBaseClassRec  piXtBaseClassRec = {
+/* Core Class Part */
+{
+
+(WidgetClass) &coreClassRec,    /* pointer to superclass ClassRec   */
+"PIXtBase",         		/* widget resource class name       */
+sizeof(PIXtBaseRec),	        /* size in bytes of widget record   */
+init_class_pixtbase,            /* class_initialize                 */
+NULL, 			        /* dynamic initialization           */
+FALSE,       		        /* has class been initialized?      */
+init_pixtbase,                  /* initialize                       */
+NULL,			        /* notify that initialize called    */
+XtInheritRealize,               /* XCreateWindow for widget         */
+// actions,     		/* widget semantics name to proc map*/
+// XtNumber(actions),           /* number of entries in actions     */
+NULL,                           /* widget semantics name to proc map*/
+0,                              /* number of entries in actions     */
+resources,                      /* resources             */
+XtNumber(resources),            /* resources             */
+NULLQUARK,		        /* resource class quarkified        */
+TRUE,			        /* compress MotionNotify for widget */
+TRUE,			        /* compress Expose events for widget*/
+TRUE,			        /* compress enter and leave events  */
+TRUE,			        /* select for VisibilityNotify      */
+destroy_pixtbase,	        /* free data for subclass pointers  */
+resize_pixtbase,                /* geom manager changed widget size */
+expose_pixtbase,       	        /* rediplay window                  */
+NULL,		                /* set subclass resource values     */
+NULL,			        /* notify that set_values called    */
+XtInheritSetValuesAlmost,       /* set_values got "Almost" geo reply*/
+NULL,		                /* notify that get_values called    */
+XtInheritAcceptFocus,           /* assign input focus to widget     */
+// acceptfocus_pixtbase,           /* assign input focus to widget     */
+XtVersion,	                /* version of intrinsics used       */
+NULL,		                /* list of callback offsets         */
+// translations,	        /* state machine                    */
+NULL,                           /* state machine                    */
+XtInheritQueryGeometry,         /* return preferred geometry        */
+XtInheritDisplayAccelerator,    /* display your accelerator         */
+NULL		                /* pointer to extension record      */
+}
+/* PIXtBase */
+,{   NULL }
+
+};
+
+WidgetClass piXtBaseWidgetClass = (WidgetClass) &piXtBaseClassRec;
+
+
+static Time last_time_xevt = 0;
+static unsigned long last_serial_xevt = 0;
+
+Time PIXGetLastEventTime() { return(last_time_xevt); }
+unsigned long PIXGetLastEventSerial() { return(last_serial_xevt); }
+
+/* Nouvelle-Fonction */
+static void init_class_pixtbase()
+{
+#ifdef DEBUG_PIXTB
+puts("Debug_init_class_pixtbase() ");
+#endif
+return;
+}
+
+/* Nouvelle-Fonction */
+static void init_pixtbase (Widget request, Widget wdg,
+                          ArgList /*args*/, Cardinal* /*narg*/)
+{
+PIXtBaseWidget wdgp;
+wdgp = (PIXtBaseWidget)wdg;
+
+if(request->core.width<=0)  wdgp->core.width  = 10;
+if(request->core.height<=0) wdgp->core.height = 10;
+// get_GCs (wdgp);
+#ifdef DEBUG_PIXTB
+printf("Debug_init_pixtbase: Wdg=%lx Object= %lx  narg=%d \n", 
+(long)wdgp, (long)(wdgp->pixtbase.objet), (int)(*narg));
+#endif
+return;
+}
+
+/* Nouvelle-Fonction */
+static void destroy_pixtbase (Widget /*wdgp*/)
+{
+#ifdef DEBUG_PIXTB
+printf("Debug_destroy_pixtbase: Wdg= %lx Object= %lx \n", (long)wdgp, 
+(long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
+#endif
+// free_GCs((PIXtBaseWidget)wdgp);
+//    $CHECK$ Reza  21/11/97
+// J'ai l'impression que cette fonction n'est pas appellee au moment 
+// de destruction du Widget - Par contre la fonction leave est appelee
+// si l'action correspondante a ete enregistree ?!
+}
+
+
+/* Nouvelle-Fonction */
+static void resize_pixtbase (Widget wdgp)
+{
+#ifdef DEBUG_PIXTB
+printf("Debug_resize_pixtbase: Wdg=%lx Object= %lx \n", (long)wdgp, 
+(long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
+#endif
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Resize();
+return;
+}
+
+/* Nouvelle-Fonction */
+static void expose_pixtbase (Widget  wdgp, XEvent* /*event*/, Region region)
+{
+#ifdef DEBUG_PIXTB
+printf("Debug_expose_pixtbase: Wdg=%lx Object= %lx \n", (long)wdgp, 
+(long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
+#endif
+if (!(wdgp->core.visible))  return;
+if ( ((PIXtBaseWidget)wdgp)->pixtbase.objet ) 
+  {
+  XRectangle  xrec;
+  int x0, y0, dx, dy;
+  XClipBox(region, &xrec);
+  x0 = xrec.x;  y0 = xrec.y;
+  dx = xrec.width;  dy = xrec.height;
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->eXposeProcess(x0, y0, dx, dy);
+  }
+return;
+}
+
+/* Nouvelle-Fonction 
+static Boolean  acceptfocus_pixtbase   (Widget wdgp , Time* )
+{
+// printf("acceptfocus_pixtbase() %lx %x \n",  ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask, ShiftMask );
+if (  ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & ShiftMask  )  return TRUE;
+else return FALSE;
+}
+*/
+
+/* -------- Fonction de traitement des evenements --------- */
+/* Nouvelle-Fonction */
+void event_handler_pixtbase (Widget wdgp, XtPointer /*closure*/, 
+                             XEvent* evt, Boolean* cont)
+{
+
+*cont = FALSE ; 
+switch (evt->type) {
+  case EnterNotify : 
+#ifdef DEBUG_PIXTB
+    printf("Debug_enter_pixtbase: Wdg=%lx Object= %lx \n", (long)wdgp, 
+           (long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
+#endif
+    last_time_xevt = evt->xcrossing.time;
+    last_serial_xevt = evt->xcrossing.serial;
+//    if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+    (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Enter();
+  break;
+
+  case LeaveNotify : 
+#ifdef DEBUG_PIXTB
+    printf("Debug_leave_pixtbase: Wdg=%lx Object= %lx \n", (long)wdgp, 
+           (long)(((PIXtBaseWidget)wdgp)->pixtbase.objet) );
+#endif
+    last_time_xevt = evt->xcrossing.time;
+    last_serial_xevt = evt->xcrossing.serial;
+//    if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+       (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Leave();
+  break;
+
+  case ButtonPress :
+    last_time_xevt = evt->xbutton.time;
+    last_serial_xevt = evt->xbutton.serial;
+    if ( (evt->xbutton.button == 1) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button1Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Press(evt->xbutton.x, evt->xbutton.y);
+    else  if ( (evt->xbutton.button == 2) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button2Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But2Press(evt->xbutton.x, evt->xbutton.y);
+    else  if ( (evt->xbutton.button == 3)  && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button3Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But3Press(evt->xbutton.x, evt->xbutton.y);
+  break;
+
+  case ButtonRelease :
+    last_time_xevt = evt->xbutton.time;
+    last_serial_xevt = evt->xbutton.serial;
+    if ( (evt->xbutton.button == 1) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button1Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Release(evt->xbutton.x, evt->xbutton.y);
+    else  if ( (evt->xbutton.button == 2) && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button2Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But2Release(evt->xbutton.x, evt->xbutton.y);
+    else  if ( (evt->xbutton.button == 3)  && ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & Button3Mask) )
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But3Release(evt->xbutton.x, evt->xbutton.y);
+  break;
+
+  case MotionNotify :
+    {
+    int xw, yw, xr, yr;
+    unsigned int key_but;
+    Window rw, cw;
+    if ( evt->xmotion.is_hint == NotifyHint ) { 
+      if (!XQueryPointer( XtDisplay(wdgp), evt->xmotion.window, &rw, &cw,
+                  &xr, &yr, &xw, &yw, &key_but) ) break ;
+      }
+    else { key_but =  evt->xmotion.state ; xw = evt->xmotion.x;  yw = evt->xmotion.y; }
+    if  ( !(key_but & ( Button1Mask | Button2Mask | Button3Mask ) ) ) break;
+      last_time_xevt = evt->xmotion.time;
+      last_serial_xevt = evt->xmotion.serial;
+      if  (key_but & Button1Mask ) 
+        (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr1Move(xw, yw);
+      else  if (key_but & Button2Mask ) 
+        (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr2Move(xw, yw);
+      else  if (key_but & Button3Mask ) 
+        (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr3Move(xw, yw);
+    }
+  break;
+
+  case KeyPress :
+    {
+    XComposeStatus cs;
+    KeySym key;
+    char buf[10];
+    int i,nc,rkey;
+    PIKeyModifier kmod;
+  
+    kmod = PIKM_Blank;
+    nc = XLookupString(&(evt->xkey), buf, 10, &key, &cs);
+
+    if  (evt->xkey.state & ShiftMask)   
+      kmod = (PIKeyModifier) (kmod | PIKM_Shift);
+    if  (evt->xkey.state & ControlMask) 
+      kmod = (PIKeyModifier) (kmod | PIKM_Cntl);
+    if  (evt->xkey.state & Mod1Mask)    
+      kmod = (PIKeyModifier) (kmod | PIKM_Alt);
+    switch (key) {
+      case XK_Return :
+        rkey = PIK_Return;
+      break;
+      case XK_KP_Enter :
+        rkey = PIK_Enter;
+      break;
+      case XK_Up :
+        rkey = PIK_Up;
+      break;
+      case XK_Down :
+        rkey = PIK_Down;
+      break;
+      case XK_Left :
+        rkey = PIK_Left;
+      break;
+      case XK_Right :
+        rkey = PIK_Right;
+      break;
+      case XK_Prior :
+        rkey = PIK_Previous;
+      break;
+      case XK_Next :
+        rkey = PIK_Next;
+      break;
+      default :
+        rkey = 0;
+      break;
+    }
+    if (rkey > 0)  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard(rkey, kmod);
+    else for(i=0; i<nc; i++)  
+      (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard((int)(buf[i]), kmod);
+  }
+  break;
+}
+
+return;
+}
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/pixtbase.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pixtbase.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pixtbase.h	(revision 108)
@@ -0,0 +1,19 @@
+/* Widget Xt pour construction Widget C++  Interface Public  */
+/*                                    Reza 10/95             */
+
+#ifndef PIXTBASE_H_SEEN
+#define PIXTBASE_H_SEEN
+
+#include <X11/Intrinsic.h>
+ 
+typedef struct _PIXtBaseClassRec * PIXtBaseWidgetClass;
+typedef struct _PIXtBaseRec      * PIXtBaseWidget;
+
+#define PIXNobject      "mypiobject"
+
+extern WidgetClass piXtBaseWidgetClass;
+
+void event_handler_pixtbase (Widget wdgp, XtPointer closure, 
+                             XEvent* evt, Boolean* cont);
+
+#endif /* PIXTBASE_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/pixtbaseP.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/pixtbaseP.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/pixtbaseP.h	(revision 108)
@@ -0,0 +1,41 @@
+/* Widget Xt pour affichage d'image   Declaration privee  */
+/*                                      Reza 10/95        */
+
+
+#ifndef PIXTBASEP_H_SEEN
+#define PIXTBASEP_H_SEEN
+
+#include "pibwdgx.h"
+
+typedef struct
+{
+   void * mumble;   /* No new procedures */
+} PIXtBaseClassPart;
+
+
+typedef struct _RzXBaseClassRec
+{
+CoreClassPart		core_class;
+PIXtBaseClassPart	pixtbase_class;
+} PIXtBaseClassRec;
+
+typedef struct
+{
+PIBaseWdgX  * objet; 
+unsigned long myeventmask;
+} PIXtBasePart;
+
+
+typedef struct _PIXtBaseRec
+{
+CorePart		core;
+PIXtBasePart		pixtbase;
+} PIXtBaseRec;
+
+extern PIXtBaseClassRec piXtBaseClassRec;
+
+
+#endif /* PIXTBASEP_H_SEEN */
+
+
+
Index: /branches/EA_Juin98/SophyaPI/PI/psfile.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/psfile.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/psfile.cc	(revision 108)
@@ -0,0 +1,927 @@
+/*
+ *   PSFile.cc
+ *   
+ *   19/06/96
+ *
+ *   Modification le 01/03/96
+ *    - fusion psfile.cc - psdict.cc
+ *
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "psfile.h"
+
+/* En cm */
+#define  MIN_SIZE_IN_PAGE  2.
+
+/*
+ *  Dictionnaire PIDict
+ *
+ *  Contient les fonctions suivantes : 
+ *
+ *
+ */
+#define PIDICT_PAR   \
+  \
+  PI_Landscape, PI_Portrait,\
+  \
+  PI_Black, PI_White, PI_Grey, PI_Red, PI_Blue,\
+  PI_Green, PI_Yellow, PI_Magenta, PI_NotDefColor,\
+  \
+  PI_RomanFont, PI_BoldFont, PI_ItalicFont, PI_NotDefFontAtt,\
+  PI_SmallSizeFont, PI_NormalSizeFont, PI_BigSizeFont, PI_NotDefFontSize, \
+  \
+  PI_NormalLine, PI_ThinLine, PI_ThickLine, PI_NotDefLineAtt
+
+#define PIDICT       "\
+/$PIDict 50 dict def\n\
+$PIDict begin $PIDict /mtrx matrix put /Landscape %d def /Portrait %d def\n\
+%% Couleurs et fontes courantes\n\
+/C%-2d  {0.0   0.0   0.0   setrgbcolor} bind def %% PI_Black\n\
+/C%-2d  {0.996 0.996 0.996 setrgbcolor} bind def %% PI_White\n\
+/C%-2d  {0.824 0.824 0.824 setrgbcolor} bind def %% PI_Grey\n\
+/C%-2d  {0.996 0.0   0.0   setrgbcolor} bind def %% PI_Red\n\
+/C%-2d  {0.0   0.0   0.996 setrgbcolor} bind def %% PI_Blue\n\
+/C%-2d  {0.0   0.996 0.0   setrgbcolor} bind def %% PI_Green\n\
+/C%-2d  {0.996 0.996 0.0   setrgbcolor} bind def %% PI_Yellow\n\
+/C%-2d  {0.996 0.0   0.996 setrgbcolor} bind def %% PI_Magenta\n\
+/C%-2d  {}                              bind def %% PI_NotDefColor\n\
+/F%-2d  {/Times-Roman   findfont} bind def       %% PI_RomanFont\n\
+/F%-2d  {/Times-Bold    findfont} bind def       %% PI_BoldFont\n\
+/F%-2d  {/Times-Italic  findfont} bind def       %% PI_ItalicFont\n\
+/F%-2d  {}\
+                        bind def       %% PI_NotDefFontAtt\n\
+/FS {scalefont setfont} bind def\n\
+%%/FS%-2d {8  scalefont setfont} bind def          %% PI_SmallSizeFont\n\
+%%/FS%-2d {12 scalefont setfont} bind def          %% PI_NormalSizeFont\n\
+%%/FS%-2d {16 scalefont setfont} bind def          %% PI_BigSizeFont\n\
+/FS%-2d {}                     bind def          %% PI_NotDefFontSize\n\
+/L%-2d  {1    slw} bind def                      %% PI_NormalLine\n\
+/L%-2d  {0.5  slw} bind def                      %% PI_ThinLine\n\
+/L%-2d  {3    slw} bind def                      %% PI_ThickLine\n\
+/L%-2d  {}         bind def                      %% PI_NotDefLineAtt\n\
+\
+%% Conversion\n\
+/cm   {28.3 mul}   bind def  %% cm --> points\n\
+/Ux   {$Cvrtx mul} bind def  %% Unites utilisateur /x --> points\n\
+/Uy   {$Cvrty mul} bind def  %% Unites utilisateur /y --> points\n\
+\
+%% Pages et Blocs\n\
+/newref  {%% Dx Dy Tx Ty X0 Y0 newref\n\
+translate 3 -1 roll cm div 28.3 mul /$Cvrty exch def\n\
+exch cm div 28.3 mul /$Cvrtx exch def} bind def\n\
+/NewPage {%% Dx Dy orientation NewPage\n\
+/$PageEnteredState save def 1 -1 scale Portrait eq {w cm h cm 0 h cm neg\n\
+newref} { -90 rotate h cm w cm 0 0 newref} ifelse} bind def\n\
+/EndPage { %% EndPage\n\
+$PageEnteredState restore} bind def\n\
+/NewBloc { %% Dx Dy Tx Ty X0 Y0 NewBloc\n\
+/$BlocEnteredState save def newref} bind def\n\
+/EndBloc { %% EndBloc\n\
+$BlocEnteredState restore} bind def\n\
+\
+%% Trace\n\
+/n  {newpath} bind def    /c  {closepath} bind def\n\
+/gs {gsave}  bind def     /gr {grestore} bind def\n\
+/m  {moveto} bind def     /l  {lineto} bind def\n\
+/s  {stroke} bind def     /f  {fill}   bind def\n\
+/sc {scale}  bind def     /S  {gs 1 -1 sc show gr} bind def \n\
+/slw {setlinewidth} bind def\n\
+/ff {findfont} bind def   /sf {setfont} bind def /scf {scalefont} bind def\n\
+/rl {rlineto} bind def    /tr {translate} bind def\n\
+%% Tx Ty X0 Y0 box\n\
+/box {tr 0 3 1 roll neg exch 0 0 3 index neg 0 0 m rl rl rl c} bind def\n\
+%% R X0 Y0 circle\n\
+/circle {tr dup 0 m 0 0 3 -1 roll 0 380 arc} bind def\n\
+%% DrawEllipse pompee sur transfig\n\
+/ellipse {/endangle exch def /startangle exch def /yrad exch def\n\
+/xrad exch def /y exch def /x exch def /savematrix mtrx currentmatrix def\n\
+x y tr xrad yrad sc 0 0 1 startangle endangle arc\n\
+closepath savematrix setmatrix } def\n\
+\
+%% Gestion des images\n\
+%% ColorImage, pompee sur xv (qui les avait pompees sur xgrab)\n\
+/colorimage where   %% do we know about 'colorimage'?\n\
+  { pop }           %% yes: pop off the 'dict' returned\n\
+  {                 %% no:  define one\n\
+    /colortogray {  %% define an RGB->I function\n\
+      /rgbdata exch store    %% call input 'rgbdata'\n\
+      rgbdata length 3 idiv\n\
+      /npixls exch store\n\
+      /rgbindx 0 store\n\
+      0 1 npixls 1 sub {\n\
+        grays exch\n\
+        rgbdata rgbindx       get 20 mul    %% Red\n\
+        rgbdata rgbindx 1 add get 32 mul    %% Green\n\
+        rgbdata rgbindx 2 add get 12 mul    %% Blue\n\
+        add add 64 idiv      %% I = .5G + .31R + .18B\n\
+        put\n\
+        /rgbindx rgbindx 3 add store\n\
+      } for\n\
+      grays 0 npixls getinterval\n\
+    } bind def\n\
+    /mergeprocs { %% def\n\
+      dup length 3 -1 roll dup length dup 5 1 roll 3 -1 roll add\n\
+      array cvx dup 3 -1 roll 0 exch putinterval dup 4 2 roll\n\
+      putinterval } bind def\n\
+    /colorimage {\n\
+      pop pop     %% remove 'false 3' operands\n\
+      {colortogray} mergeprocs image} bind def\n\
+  } ifelse          %% end of 'false' case\n\
+\
+%% GetRGB\n\
+/GetRGB { %% ImageStr --> RGBStr\n\
+  /ImageData exch store\n\
+  %% Pour chaque element de ImageData,\n\
+  %% On va chercher les valeurs RGB correspondantes\n\
+  0 1 Taille 1 sub {\n\
+    /i      exch store  %% On met a jour l'indice de parcours\n\
+    ImageData i get     %% Recupere la Indice e val dans la chaine ImData\n\
+    ColorMap exch get   %% On recupere la valeur RGB Correspondante\n\
+    aload pop           %% On met tout ca dans la pile\n\
+    %% Maintenant, on va mettre tout ca dans la chaine RGBStr\n\
+    RGBStr i 3 mul 2 add 3 -1 roll put\n\
+    RGBStr i 3 mul 1 add 3 -1 roll put\n\
+    RGBStr i 3 mul       3 -1 roll put\n\
+    } for\n\
+  RGBStr 0 Taille 3 mul getinterval %% On renvoie la chaine RGB\n\
+} bind def\n\
+end\n\
+"
+
+
+
+/* 
+ *  Les PIMarkers sont definis et geres commes des fontes
+ *
+ *
+ */
+#define PIMARKERS_PAR  PI_DotMarker, PI_PlusMarker, PI_CrossMarker,\
+  PI_CircleMarker, PI_FCircleMarker, PI_BoxMarker, PI_FBoxMarker,\
+  PI_TriangleMarker, PI_FTriangleMarker, PI_StarMarker, PI_FStarMarker
+
+#define PIMARKERS  "\
+%% Definition de la fonte $PIMarkers\n\
+/$PIMarkers 26 dict def\n\
+$PIMarkers begin\n\
+/FontType 3 def\n\
+/FontMatrix [0.001 0 0 0.001 -0.375 -0.375] def\n\
+/FontBBox   [0 0 1000 1000] def\n\
+/Encoding 256 array def\n\
+0 1 255 {Encoding exch /.notdef put} for\n\
+Encoding  %d /PIDot       put %% PI_DotMarker\n\
+Encoding  %d /PIPlus      put %% PI_PlusMarker\n\
+Encoding  %d /PICross     put %% PI_CrossMarker\n\
+Encoding  %d /PICircle    put %% PI_CircleMarker\n\
+Encoding  %d /PIFCircle   put %% PI_FCircleMarker\n\
+Encoding  %d /PIBox       put %% PI_BoxMarker\n\
+Encoding  %d /PIFBox      put %% PI_FBoxMarker\n\
+Encoding  %d /PITriangle  put %% PI_TriangleMarker\n\
+Encoding  %d /PIFTriangle put %% PI_FTriangleMarker\n\
+Encoding  %d /PIStar      put %% PI_StarMarker\n\
+Encoding  %d /PIFStar     put %% PI_FStarMarker\n\
+/CharProcs 26 dict def\n\
+$PIDict begin\n\
+CharProcs begin\n\
+/.notdef     {} def\n\
+/PIDot       {100 375 375 circle f} bind def\n\
+/PIPlus      {0 375 m 750 375 l 375 0 m 375 750 l s} bind def\n\
+/PICross     {0 0 m 750 750 l 750 0 m 0 750 l s} bind def\n\
+/PICircle    {375 375 375 circle s} bind def\n\
+/PIFCircle   {375 375 375 circle f} bind def\n\
+/PIBox       {0 0 m 750 0 l 750 750 l 0 750 l c s} bind def\n\
+/PIFBox      {0 0 m 750 0 l 750 750 l 0 750 l c f} bind def\n\
+/PITriangle  {0 750 m 375 0 l 750 750 l c s} bind def\n\
+/PIFTriangle {0 750 m 375 0 l 750 750 l c f} bind def\n\
+/PIStar      {} def\n\
+/PIFStar     {} def\n\
+end %%$PIDict\n\
+end %%$CharProcs\n\
+/BuildChar {\n\
+1000 0      %% Largeur \n\
+0 0 750 750 %% Bounding Box\n\
+setcachedevice \n\
+exch begin\n\
+Encoding exch get\n\
+CharProcs exch get\n\
+end exec} def\n\
+end\n\
+/PIMarkers $PIMarkers definefont pop\n\
+save\n\
+"
+
+/* Dimensions des divers formats */
+  struct PaperSize {
+      float width ;
+      float height ;
+  };
+struct PaperSize PaperSizeTable[] = {
+    { 0.0,  0.0},    /* PI_NotDefFormat */
+    {21.0, 29.7},    /* PI_A4 */
+    {29.7, 42.0},    /* PI_A3 */
+    {14.8, 21.0}     /* PI_A5 ? */
+} ;
+
+
+float cm2pt(float x);
+
+
+/* Fonction WriteHeader */
+#define END_PROLOG_PAR  PAGE_WIDTH, PAGE_HEIGHT
+#define END_PROLOG  "/NewFile { %%%% w h NewFile (--> h et w en cm <--)\n\
+$PIDict begin /PIMarkers ff 14 scf sf /h exch def /w exch def \n\
+/$PIEnteredState save def} bind def\n\
+/EndFile {$PIEnteredState restore end} bind def\n\
+%%%%EndProlog\n\n\
+"
+
+#define HEADER     "\
+%%%%Title: %s\n\
+%%%%Creator: PSFile\n\
+%%%%CreationDate: %s\
+%%%%Pages: (atend)\n\
+%%%%EndComments\n\n\
+"
+
+
+/* 
+ *   PostScript encapsule...
+ * 
+ *   Attention la bounding Box ne sera specifiee 
+ *     qu'au premier NewPage() --> definie dans 
+ *     le champ "Trailer" 
+ *
+ */
+PSFile::PSFile(const char * FileName, float sc) 
+    : mPSFileName(FileName==NULL? "unnamed.eps" : const_cast<char *>(FileName)),
+      Tw (-1.), Th(-1.),         /* Non specifies pour du eps  */
+      WMargin (-1), HMargin(-1), /* Non specifiees en eps  */ 
+      isEPS(1),
+      scale(sc),                 /* Defaut : 1. */
+      mPaperSize(PI_NotDefPaperSize), /* Non specifiee en eps */
+      PageCounter(0),            /* Fichier vide */
+      FileEmpty(1),              /* Fichier vide */
+      currentPage(NULL),
+      currentBloc(NULL),
+      mDrawColor(PI_Black),
+      mFillColor(PI_Black),
+      mFontAtt(PI_RomanFont),
+      mFontSize(PI_NormalSizeFont),
+      mLineAtt(PI_NormalLine),
+      mMarker(PI_DotMarker)
+{
+    char*  date = new (char[64] ) ; 
+    time_t timer ; 
+
+    /* Ouverture du fichier en mode w+ */
+    if ( (mPSFile = fopen(FileName, "w+")) == NULL){
+	  perror (FileName);
+	  return;
+    }
+
+    /* Ecriture du Header  */
+    fprintf(mPSFile, "%%!PS-Adobe-2.0 EPSF-2.0\n");
+    fprintf(mPSFile, "%%%%BoundingBox: ");
+    /* 
+     * Les dimensions de la BB seront notees ici lors du 
+     * premier appel a NewPage
+     *
+     * C'est laid... si qqn a une meilleure idee...
+     */
+    boundingBox = ftell(mPSFile) ; 
+    fprintf(mPSFile, "                       \n");
+
+    time(&timer) ; 
+    date = ctime(&timer) ; 
+    fprintf(mPSFile, HEADER, mPSFileName, date) ; /* titre, date etc... */
+    fprintf(mPSFile, PIDICT, PIDICT_PAR) ;        /* Dictionnaire */
+    fprintf(mPSFile, PIMARKERS, PIMARKERS_PAR) ;  /* Fonte "PIMARKERS" */
+    //    fprintf(mPSFile, END_PROLOG) ;
+    /* Aucun format n'est specifie ici ... */
+    fprintf(mPSFile, "$PIDict begin /PIMarkers ff 14 scf sf\n") ;
+    fprintf(mPSFile, "/FState save def\n%%%%EndProlog\n\n") ;
+}
+
+
+
+/*
+ *  PostScript simple...
+ *
+ *
+ */
+PSFile::PSFile(const char *FileName,
+	       PIOrientation orientation,
+	       PIPaperSize   paperSize,
+	       float marginX, float marginY)
+ :  mPSFileName (FileName == NULL ? "unnamed.ps" : const_cast<char *>(FileName)),
+
+    Tw(PaperSizeTable[paperSize].width),  /* Format papier utilise */
+    Th(PaperSizeTable[paperSize].height), /*                       */
+    WMargin(marginX),
+    HMargin(marginY),
+    isEPS(0),
+    scale(0.),
+    PageCounter(0),  /* Fichier vide */
+    FileEmpty(1),    /*              */
+    currentPage(NULL),
+    currentBloc(NULL),
+    mDrawColor(PI_Black),
+    mFillColor(PI_Black),
+    mFontAtt(PI_RomanFont),
+    mFontSize(PI_NormalSizeFont),
+    mLineAtt(PI_NormalLine),
+    mMarker(PI_DotMarker) 
+{
+    char * date = new(char[64]) ; 
+    time_t timer ; 
+
+    /* Ouverture du fichier, en mode w+ (tout est ecrase) */
+    if ( (mPSFile = fopen(FileName, "w+")) == NULL){
+	  perror (FileName);
+	  return;
+    }
+
+    /* Format et orientation */
+
+    /* Ecriture du Header  */
+    fprintf(mPSFile, "%%!PS-Adobe-2.0\n") ;
+    time(&timer) ; 
+    date = ctime(&timer) ; 
+    fprintf(mPSFile, HEADER, mPSFileName, date) ; /* titre, date etc... */
+    fprintf(mPSFile, PIDICT, PIDICT_PAR) ;        /* Dictionnaire */
+    fprintf(mPSFile, PIMARKERS, PIMARKERS_PAR) ;  /* Fonte "PIMARKERS" */
+    fprintf(mPSFile, "$PIDict begin /PIMarkers ff 14 scf sf\n") ;
+    fprintf(mPSFile, "/FState save def\n%%%%EndProlog\n\n") ;
+}
+
+
+/* 
+ * Destructeur
+ *
+ */
+PSFile::~PSFile () {
+
+    /* On ferme tout ce qui ne l'est pas */
+    if (currentBloc) PSFile::EndBloc();
+    if (currentPage) PSFile::EndPage();
+
+    /* Si le fichier est vide, on le detruit */
+    if (FileEmpty) remove(mPSFileName);
+
+    /* On ecrit le "Trailer" et on ferme */
+    else {
+	/* On restore l'etat initial */
+	fprintf(mPSFile,"FState restore\n") ;
+	fprintf(mPSFile, "%%%%Trailer\n%%%%Pages: %d\n%%%%EOF\n", 
+		PageCounter) ;
+	fclose (mPSFile);
+    }
+}
+
+
+int   PSFile::IsEPS(){
+
+    return(isEPS);
+}
+
+
+char* PSFile::GetFileName() {
+
+    return(mPSFileName);
+}
+
+PIColors PSFile::GetDrawColor() {
+
+    return(mDrawColor);
+}
+
+PIColors PSFile::GetFillColor() {
+
+    return(mFillColor);
+}
+
+PIFontAtt PSFile::GetFontAtt() {
+
+    return(mFontAtt);
+}
+
+PIFontSize PSFile::GetFontSize() {
+
+    return(mFontSize);
+}
+
+PILineAtt PSFile::GetLineAtt() {
+
+    return(mLineAtt);
+}
+
+PIMarker PSFile::GetMarker() {
+
+    return(mMarker);
+}
+
+void  PSFile::NewPage(float Dx, float Dy, PIOrientation orientation) {
+
+float  tw, th; /* largeur & hauteur corrigees des marges */
+
+    /* On ferme ce qui doit l'etre ... */
+    if (currentPage) PSFile::EndPage();
+
+    currentPage = new (Page) ; 
+
+    /* Initialisations */
+    currentPage->num = ++PageCounter;
+    currentPage->BlocCounter = 0;
+    currentPage->Dx = Dx;
+    currentPage->Dy = Dy;
+    currentPage->orientation = orientation ;
+
+    /* Position du debut AVANT D'ECRIRE! */
+    currentPage->begin  = ftell(mPSFile);
+
+    /* On ecrit dans le fichier */
+    fprintf(mPSFile, "%%%%Page: %d %d\n", PageCounter, PageCounter) ;
+    fprintf(mPSFile, "/PState save def 1 -1 scale\n");
+
+    /* 
+     *  Si eps : Portrait || Auto == on laisse tel que
+     *           Landscape == on tourne de -90 degres
+     */
+    if(isEPS) {
+	if( (orientation == PI_Portrait) || (orientation == PI_Auto) )
+	    fprintf(mPSFile,
+		    "%.2f %.2f %.2f %.2f %.2f %.2f newref\n",
+		    Dx, Dy, Dx*scale, Dy*scale, 0., -Dy*scale);
+	else
+	    if(orientation==PI_Landscape)
+		fprintf(mPSFile, 
+			"-90 rotate %.2f %.2f %.2f %.2f %.2f %.2f newref\n",
+			Dx, Dy, Dx*scale, Dy*scale, 0., 0.);
+	    else
+		fprintf(stderr, "Orientation Error ; Page : %d\n",
+			currentPage->num) ; 
+    /* 
+     * On specifie la bb 
+     * (Si non encore fait par un appel precedent a NewPage() ) 
+     */
+	if(boundingBox) {
+	    currentPage->tmp = ftell(mPSFile) ;
+	    fseek(mPSFile,boundingBox,SEEK_SET) ;
+	    if( (orientation == PI_Portrait) || (orientation == PI_Auto) )
+		fprintf(mPSFile, "%d %d %d %d", 0, 0, 
+			(int)(Dx*scale), (int)(Dy*scale) ) ; 
+	    else
+		fprintf(mPSFile, "%d %d %d %d", 0, 0, 
+			(int)(Dy*scale), (int)(Dx*scale) ) ;
+	    fseek(mPSFile,currentPage->tmp,SEEK_SET) ;
+	    boundingBox = 0 ; 
+	} /* BB */
+    } /* EPS */
+    /*
+     * Si ps : 
+     *   - soustraction marges --> rectangle utile.
+     *   - Si PI_Auto : On fait au mieux pour minimiser le 
+     *      redimensionnement...
+     *   - Si PI_Portrait, on ne fait rien, sauf 
+     *      peut-etre un redimensionnement pour rentrer dans les marges
+     *   - Si PI_Landscape, on tourne de -90 degres.
+     */
+    else {
+	/* Eviter image reduite a un point...ou moins... */
+	if((tw = Tw - 2*WMargin) < (Tw/10)) {
+	    WMargin = (0.45)*Tw ;
+	    tw = Tw/10;
+	}
+	if((th = Th - 2*HMargin)< (Th/10)) {
+	    HMargin = (0.45)*Th ;
+	    th = Th/10;
+	}
+	/* Portrait ou Landscape ? */
+	if(orientation == PI_Auto) 
+	    if( ((tw < th) && (Dx < Dy)) ||
+		((tw > th) && (Dx > Dy) )) 
+		currentPage->orientation = PI_Portrait ;
+	    else 
+		currentPage->orientation = PI_Landscape ;
+
+	if(currentPage->orientation == PI_Portrait) {
+	    if( (tw/Dx) < (th/Dy) ) 
+		scale = tw/Dx ;
+	    else 
+		scale = th/Dy;
+	    fprintf(mPSFile, 
+		    "%.2f %.2f %.2f cm %.2f cm %.2f cm %.2f cm newref\n",
+		    Dx, Dy, 
+		    Dx*scale, Dy*scale, 
+		    0.5*(Tw-tw), -0.5*(Th+th)) ;
+	}
+	if(currentPage->orientation == PI_Landscape) {
+	    /* Idem avec X<->Y */
+	    if( (th/Dx) < (th/Dy) ) 
+		scale = th/Dx;
+	    else
+		scale = tw/Dy ;
+	    fprintf(mPSFile,
+	       "-90 rotate %.2f %.2f %.2f cm %.2f cm %.2f cm %.2f cm newref\n",
+	       Dx, Dy,
+	       Dx*scale, Dy*scale, 
+	       0.5*(Th-th), 0.5*(Tw-tw));
+	}
+    } /* End if .ps */
+currentPage->tmp = ftell(mPSFile);
+}
+
+
+
+void  PSFile::EndPage() {
+
+    /* Si rien a fermer, on s'en va */
+    if ( ! currentPage ) return;
+
+    /* Si un bloc non ferme, on appelle EndBloc */
+    if ( currentBloc ) PSFile::EndBloc();
+    
+    /* Si la page est vide, on la detruit */
+    if (currentPage->tmp == ftell(mPSFile)) {
+	fseek(mPSFile, currentPage->begin, SEEK_SET);
+	delete(currentPage) ;
+	PageCounter--;
+    }
+    /* Sinon, fin page + empilage */
+    else {
+	//	it = mPageList.end(); it--;
+	fprintf(mPSFile,"PState restore  showpage\n");
+	fprintf(mPSFile,"%%>EndPage %d\n\n\n", currentPage->num);
+	currentPage->end = ftell(mPSFile);
+	mPageList.push_back(*currentPage); /* Pourquoi PageList ? */
+	FileEmpty = 0;
+    }
+    currentPage = NULL;
+}
+
+
+void  PSFile::NewBloc(float x0, float y0, float Tx, float Ty,
+			      float Dx, float Dy){
+
+    /* Si pas de page, on s'en va */
+    if ( ! currentPage ) return;
+
+    /* On ferme le bloc precedent (Pas de Bloc-gigognes ! ) */
+    if (currentBloc) PSFile::EndBloc();
+
+    currentBloc = new (Bloc) ; 
+    /* On remplit currentBloc */
+    currentBloc->num = ++(currentPage->BlocCounter);
+    currentBloc->X0 = x0;
+    currentBloc->Y0 = y0;
+    currentBloc->Tx = Tx;
+    currentBloc->Ty = Ty;
+    currentBloc->Dx = Dx;
+    currentBloc->Dy = Dy;
+    currentBloc->begin = ftell(mPSFile);
+
+    /* On met a jour le fichier */
+    fprintf(mPSFile, "%%>BeginBloc %d\n", currentBloc->num);
+    fprintf(mPSFile, "%.2f %.2f %.2f Ux %.2f Uy %.2f Ux %.2f Uy NewBloc\n",
+	    currentBloc->Dx, currentBloc->Dy,
+	    currentBloc->Tx, currentBloc->Ty,
+	    currentBloc->X0, currentBloc->Y0);
+    currentBloc->tmp = ftell(mPSFile) ;
+}
+
+
+void  PSFile::EndBloc() {
+
+    /* On verifie qu'un bloc ouvert existe bien */
+    if ( ! currentBloc ) return;
+
+    /* Si le bloc est vide, on le detruit */
+    if (currentBloc->tmp == ftell(mPSFile)) {
+	fseek(mPSFile, currentBloc->begin, SEEK_SET) ; 
+	currentPage->BlocCounter-- ; 
+    }
+    /* Sinon, Ok met a jour le fichier */
+    else { 
+	fprintf(mPSFile, "EndBloc\n"); 
+	fprintf(mPSFile, "%%>EndBloc %d\n", currentBloc->num); 
+	currentBloc->end = ftell(mPSFile) ; 
+	currentPage->mBlocList.push_back(*currentBloc) ; 
+	//	PageEmpty = 0; 
+    } 
+    /* Flags */
+    currentBloc = NULL ; 
+}
+
+
+void  PSFile::DrawString  (float x,  float y, char *s, 
+			   PIColors DrawColor, 
+			   PIFontAtt FontAtt, 
+			   int FontSize) {
+    int change = 0;
+
+    /* Couleurs */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor) ; 
+    }
+    /* Choix des fontes */
+    if ( (FontAtt != PI_NotDefFontAtt) || (FontAtt != mFontAtt) ) {
+	mFontAtt = FontAtt;
+	change = 1;}
+    if ( (FontSize != PI_NotDefFontSize) || (FontSize != mFontSize) ) {
+	mFontSize = (PIFontSize) FontSize;  // $CHECK$ EA ajoute le cast un peu au pif
+	change = 1;}
+    if (change)
+	fprintf(mPSFile, "F%d %d FS ", mFontAtt, FontSize) ; 
+
+    fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) S gr\n", x, y, s) ; 
+}
+
+
+void  PSFile::DrawLine    (float x1, float y1, float x2, float y2, 
+		   PIColors DrawColor,
+		   PILineAtt LineAtt) {
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* Couleurs */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor);
+    }
+
+    /* Dessin */
+    fprintf(mPSFile, "n %.2f Ux %.2f Uy m %.2f Ux %.2f Uy l s\n",
+	    x1, y1, x2, y2) ;
+}
+
+
+
+void  PSFile::DrawBox(float x0, float y0, float Tx, float Ty, 
+		      PIColors  DrawColor,
+		      PILineAtt LineAtt) {
+
+    /* Changement couleurs ? */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor) ; 
+    }
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* On dessine */
+    fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy box s gr\n",
+	    Tx, Ty, x0, y0) ; 
+}
+
+
+void  PSFile::DrawFBox(float x0, float y0, float Tx, float Ty, 
+		   PIColors DrawColor,
+		   PIColors FillColor, 
+		   PILineAtt LineAtt) {
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* Dessin du fond */
+    if ( (FillColor != PI_NotDefColor) || (FillColor != mFillColor) )
+	mFillColor = FillColor;
+    fprintf(mPSFile, "C%d ", mFillColor) ; 
+    fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy box f gr\n",
+	    Tx, Ty, x0, y0) ; 
+    
+    /* Dessin du contour (s'il y a lieu) */
+    if ( (DrawColor != PI_NotDefColor) && (FillColor != DrawColor) )
+	mDrawColor = DrawColor;
+    fprintf(mPSFile, "C%d ", mDrawColor) ; 
+    fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy box s gr\n",
+	    Tx, Ty, x0, y0) ;
+}
+
+
+void  PSFile::DrawCircle  (float x0, float y0, float r, 
+			   PIColors DrawColor,
+			   PILineAtt LineAtt) {
+
+    /* Couleurs */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor); 
+    }
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt); 
+    }
+
+    /* Dessin */
+    fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy 0 360 ellipse s gr\n",
+	    x0, y0, r, r) ;
+}
+
+
+void  PSFile::DrawFCircle (float x0, float y0, float r,
+		   PIColors DrawColor,
+		   PIColors FillColor, 
+		   PILineAtt LineAtt) {
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* Dessin du fond */
+    if ( (FillColor != PI_NotDefColor) || (FillColor != mFillColor) ){
+	mFillColor = FillColor;
+	fprintf(mPSFile, "C%d ", mFillColor) ;
+    }
+    fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy \
+                      0 360 ellipse f gr\n",
+	    x0, y0, r, r);
+    fprintf(mPSFile, "C%d ", mDrawColor) ;
+
+    /* Dessin du contour (s'il y a lieu) */
+    if ( (DrawColor != PI_NotDefColor) && (FillColor != DrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor); 
+	fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy 0 360 ellipse s gr\n",
+		x0, y0, r, r) ;
+    }
+}
+
+
+void  PSFile::DrawPolygon (float *x, float *y, int n,
+		   PIColors DrawColor, 
+		   PILineAtt LineAtt) {
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* Couleur */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor) ;
+    }
+    
+    /* On dessine ; ici*/
+    fprintf(mPSFile, "%.2f Ux %.2f Uy m\n", x[0], y[0]);
+    for(int i = 0; i<n; i++) 
+	fprintf(mPSFile, "%.2f Ux %.2f Uy %.2f Ux %.2f Uy l\n",
+		x[i+1], y[i+1], x[i], y[i]);
+    fprintf(mPSFile, "c s\n");
+}
+
+
+void  PSFile::DrawFPolygon(float *x, float *y, int n,
+		   PIColors DrawColor,
+		   PIColors FillColor,
+		   PILineAtt LineAtt) {
+
+    /* Line Att */
+    if ( (LineAtt != PI_NotDefLineAtt) || (LineAtt != mLineAtt) ) {
+        mLineAtt = LineAtt;
+	fprintf(mPSFile, "%d slw ", mLineAtt) ; 
+    }
+
+    /* Dessin du fond... */
+    if ( (FillColor != PI_NotDefColor) || (FillColor != mFillColor) ) 
+	mFillColor = FillColor;
+    fprintf(mPSFile, "C%d ", mFillColor) ;
+    fprintf(mPSFile, "%.2f Ux %.2f Uy m\n", x[0], y[0]);
+    int i;
+    for(i = 0; i<n; i++) 
+	fprintf(mPSFile, "%.2f Ux %.2f Uy %.2f Ux %.2f Uy l\n",
+		x[i+1], y[i+1], x[i], y[i]);
+    fprintf(mPSFile, "c f\n");
+
+    /* ...puis du contour (s'il y a lieu) */
+    if ( (DrawColor != PI_NotDefColor) && (DrawColor != FillColor) )
+	mDrawColor = DrawColor;
+    fprintf(mPSFile, "C%d ", mDrawColor) ;
+    fprintf(mPSFile, "%.2f Ux %.2f Uy m\n", x[0], y[0]);
+    for(i = 0; i<n; i++) 
+	fprintf(mPSFile, "%.2f Ux %.2f Uy %.2f Ux %.2f Uy l\n",
+		x[i+1], y[i+1], x[i], y[i]);
+    fprintf(mPSFile, "c s\n");
+}
+
+
+
+void  PSFile::DrawMarker  (float x0, float y0,
+			   PIMarker MrkType,   
+			   PIColors DrawColor,
+			   int MarkerSize) {
+    /* Couleurs */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor) ; 
+    }
+
+    /* Marker */
+    if (MrkType != PI_NotDefMarker)
+	mMarker = MrkType;
+
+    if(MarkerSize != mMarkerSize) {
+	mMarkerSize = MarkerSize ;
+	fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ; 
+    }
+    /* Dessin */
+    fprintf(mPSFile, "%.2f Ux %.2f Uy m (\\%#o) show\n", x0, y0, mMarker) ;
+
+}
+
+/*
+ * Pas d'options pour specifier la taille des Markers ?
+ *
+ */
+void  PSFile::DrawMarkers (float *x0, float *y0, int n,
+			   PIMarker MrkType,
+			   PIColors DrawColor,
+			   int MarkerSize) {
+    /* Couleurs */
+    if ( (DrawColor != PI_NotDefColor) || (DrawColor != mDrawColor) ) {
+	mDrawColor = DrawColor;
+	fprintf(mPSFile, "C%d ", mDrawColor) ; 
+    }    
+
+    /* Marker */
+    if (MrkType != PI_NotDefMarker)
+	mMarker = MrkType;
+
+    if(MarkerSize != mMarkerSize) {
+	mMarkerSize = MarkerSize ;
+	fprintf(mPSFile, "/PIMarkers ff %d scf sf\n", mMarkerSize) ; 
+    }
+    /* Dessin */
+    for(int i = 0; i<n; i++)
+	fprintf(mPSFile, "%.2f Ux %.2f Uy m (\\%#o) show\n", x0[i], y0[i], mMarker) ; 
+}
+
+void PSFile::Image(float x0, float y0, float Tx, float Ty,
+		   int Nx, int Ny,
+		   unsigned char *Pict, 
+		   PIColorMap *mMap) {
+
+    int i, j;
+
+    /* Buffers PostScript */
+    fprintf(mPSFile, "/Taille %d def\n", Nx);
+    fprintf(mPSFile, "/ImStr Taille string def\n");
+    fprintf(mPSFile, "/RGBStr Taille 3  mul string def\n");
+
+    /* Ecriture ColorMap */
+    fprintf(mPSFile, "/ColorMap %02d array def\n", mMap->NCol() );
+    for(i = 0; i < mMap->NCol(); i++) {
+	fprintf(mPSFile, "ColorMap %d [16#%02X 16#%02X 16#%02X] put\n",
+		i,
+		(int)(mMap->GetColor(i).red/256),
+		(int)(mMap->GetColor(i).green/256),
+		(int)(mMap->GetColor(i).blue/256));
+    }
+    /* Emplacement de l'image */
+    fprintf(mPSFile, "gs %.2f  %.2f  tr %.2f Ux %.2f Uy sc\n", x0, y0, Tx, Ty);
+    /* Nbr pix-X, Nbr pix-Y bits/pixels */
+    fprintf(mPSFile, "%d %d 8\n", Nx, Ny);
+    /* Matrice de passage */
+    fprintf(mPSFile, "[%d 0 0 %d 0 0]", Nx, Ny);
+    /* Fonction colorimage */
+    fprintf(mPSFile, "{currentfile ImStr readhexstring pop GetRGB}\
+false 3 colorimage\n\n");
+    /* Data */
+    for(i = 0; i < Ny; i++) {
+	for(j = 0; j<Nx-1; j++ )
+	    fprintf(mPSFile, "%02X", Pict[i*Nx+j]);
+    fprintf(mPSFile, "%02X\n", Pict[i*Nx+j]);
+    }
+    /* Un petit grestore ...*/
+    fprintf(mPSFile, "gr\n");
+}
+
+/* 
+ *  Conversion
+ *
+ */
+
+float cm2pt(float x) {
+    return (x*28.35);
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/psfile.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/psfile.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/psfile.h	(revision 108)
@@ -0,0 +1,203 @@
+#ifndef PSFILE_H_SEEN
+#define PSFILE_H_SEEN
+
+/*
+ *  PSFile.h
+ * 
+ *  14/06/96, 19/06/96
+ *
+ *  Gestion des fichier .ps et .eps
+ *
+ *     - L'unite de mesure est lUnite Courante (UC)
+ *        Au depart, 1UC == 1cm 
+ *     - Les reperes sont orientes a la maniere XWindow
+ * 
+ *  17/02/97 : modification des constructeurs(1-->eps,2-->ps)
+ *             ajout du type enum orientation
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "defs.h"
+#ifdef __mac__
+#include <stat.h>
+#endif
+#include "pisysdep.h"
+
+
+#include "pigraphgen.h"      // Types enumeres repris de Peida:PIFontSize...
+#include PICMAP_H
+
+#include <list>
+
+enum PIPaperSize { PI_A4 = 1, PI_A3 = 2, PI_A5 = 3, PI_NotDefPaperSize = 0};
+
+enum PIOrientation { PI_Landscape = 0, PI_Portrait = 1, PI_Auto = 2 } ;
+
+
+/*
+ *#define PAGE_WIDTH   21.0    == 595 points 
+ *#define PAGE_HEIGHT  29.7    == 842 points 
+ *#define PORTRAIT  1
+ *#define LANDSCAPE 0
+ */
+
+
+
+/* Valable pour une page, ou un bloc */
+/*typedef struct {
+ *  float X0;          Coordonnes sommet NO  
+ *  float Y0;           en unites courantes  
+ *  float Tx;          Format                
+ *  float Ty;           en unites courantes  
+ *  float Dx;          Coord sommet SE       
+ *  float Dy;           en unites courantes  
+ *  int orientation;   LANDSCAPE OU PORTRAIT 
+ *} Format;
+ */
+
+/*
+ *typedef struct{
+ *    char *Name;
+ *    int  Tx;     En 1/72e de pouce  !! 
+ *    int  Ty;     unite naturelle de ps 
+ *} PIMedia;
+ */
+
+
+
+class PSFile{
+
+public:
+    /* Production fichier eps */
+    PSFile (const char * FileName, float sc = 1.0);
+    /* Production fichier ps  */
+    PSFile (const char * FileName, PIOrientation orientation, 
+	    PIPaperSize paperSize= PI_A4, 
+	    float marginX = 1.0, float marginY = 1.0 ) ;
+
+    virtual      ~PSFile();
+
+    virtual int     IsEPS();
+    virtual char*   GetFileName();
+
+
+    /*    virtual Format* GetFormat(); */
+    /* Attributs graphiques */
+    virtual PIColors    GetDrawColor();
+    virtual PIColors    GetFillColor();
+    virtual PIFontAtt   GetFontAtt();
+    virtual PIFontSize  GetFontSize();
+    virtual PILineAtt   GetLineAtt();
+    virtual PIMarker    GetMarker();
+
+    virtual void  NewPage(float Dx, float Dy, PIOrientation orientation);
+    virtual void  EndPage();
+    virtual void  NewBloc(float x0, float y0, float Tx, float Ty,
+			  float Dx, float Dy);
+    virtual void  EndBloc();
+
+    /* Trace */
+    virtual void  DrawString  (float x,  float y, char *s, 
+			       PIColors DrawColor  = PI_NotDefColor, 
+			       PIFontAtt FontAtt   = PI_NotDefFontAtt, 
+			       int FontSize        = 8);
+    virtual void  DrawLine    (float x1, float y1, float x2, float y2, 
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawBox     (float x0, float y0, float Tx, float Ty, 
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawFBox    (float x0, float y0, float Tx, float Ty, 
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PIColors FillColor  = PI_NotDefColor, 
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawCircle  (float x0, float y0, float r, 
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawFCircle (float x0, float y0, float r,
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PIColors FillColor  = PI_NotDefColor, 
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawPolygon (float *x, float *y, int n,
+			       PIColors DrawColor  = PI_NotDefColor, 
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawFPolygon(float *x, float *y, int n,
+			       PIColors DrawColor  = PI_NotDefColor,
+			       PIColors FillColor  = PI_NotDefColor,
+			       PILineAtt LineAtt   = PI_NotDefLineAtt);
+    virtual void  DrawMarker  (float x0, float y0, 
+			       PIMarker MrkType    = PI_NotDefMarker, 
+			       PIColors DrawColor  = PI_NotDefColor,
+			       int MarkerSize=14);
+    virtual void  DrawMarkers (float *x0, float *y0, int n,
+			       PIMarker MrkType    = PI_NotDefMarker,
+			       PIColors DrawColor  = PI_NotDefColor,
+			       int MarkerSize=14); 
+
+    virtual void  Image(float x0, float y0, float Tx, float Ty,
+			int Nx, int Ny,
+			unsigned char *pict,
+			PIColorMap *mColorMap);
+
+#ifndef __DECCXX
+private:
+#endif
+
+
+    /* Blocs */
+    typedef struct {
+	int    num;
+	char*  label;
+	float  X0, Y0;            /* coordonnees sommet NO */
+	float  Tx, Ty;            /* Format */
+	float  Dx, Dy;            /* Repere utilisateur */
+	long  begin,end,tmp;   /* offsets dans le fichier */
+    } Bloc ;
+    typedef list<Bloc> BlocList;  /* STL */
+
+
+    /* Pages */
+    typedef struct {
+	int num;
+	int BlocCounter;
+	float Dx,Dy;              /* Sommet SE (unites utilisateur) */ 
+	PIOrientation orientation;
+	long  begin, end, tmp;    /* Offsets dans le fichier */
+	BlocList mBlocList;       /* Page == Liste de blocs  */
+    } Page ;
+    typedef list<Page> PageList;  /* STL */
+
+#ifdef __DECCXX
+private:
+#endif
+
+    /* Fichier ps/eps */
+    FILE *   mPSFile;
+    char *   mPSFileName;
+    float    Tw,Th ;              /* Format, en cm */
+    float    WMargin,HMargin ;    /* Marges minimales */
+    int      isEPS;               /* Vrai si PostScript Encapsule */
+    long     boundingBox;         /* Endroit ou est specifiee la bb */
+    float    scale;               /* boundingbox = Dx*scale ; Dy*scale */
+    PIPaperSize mPaperSize ; 
+    int      PageCounter;         /* nbr pages */
+    int      FileEmpty;
+    Page*    currentPage;        /* Avant empilage */
+    Bloc*    currentBloc;        /* Avant empilage */
+    PageList mPageList;          /* Fichier == Liste de pages */
+
+
+    /* Attributs graphiques, initialises par constructeur */
+    enum PIColors    mDrawColor;  /* Couleur de trace courante */
+    enum PIColors    mFillColor;  /* Couleur de remplissage courante */
+    enum PIFontAtt   mFontAtt; 
+    enum PIFontSize  mFontSize; 
+    enum PILineAtt   mLineAtt;    /* Epaisseur d une ligne */
+    enum PIMarker    mMarker;     /* Marker courant */
+    int              mMarkerSize; /* Taille (en points) du marker courant */
+} ;
+
+
+#endif/* PSFILE_H_SEEN */
Index: /branches/EA_Juin98/SophyaPI/PI/sc_sample.cc
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/sc_sample.cc	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/sc_sample.cc	(revision 108)
@@ -0,0 +1,46 @@
+#include "sc_sample.h"
+
+static double f(double x) {return x*x;}
+
+ScSample::ScSample(PIContainerGen *par, char *nom,
+                  int sx, int sy, int px, int py)
+:PIScDrawWdg(par, nom, sx, sy, px, py)
+
+{
+PIFuncDrawer * mfd;
+mfd = new PIFuncDrawer(f);
+  SetLimits(-3,3,-4,4);
+AddScDrawer(mfd);
+SetAxesFlags(kAxesDflt);
+}
+
+ScSample::~ScSample()
+{
+DeleteDrawers();
+}
+
+
+void
+ScSample::DrawSelf(PIGraphicUC* g)
+{
+PIGrCoord x[5] = {-2, -1., 1., 1.7, 2.2};
+PIGrCoord y[5] = {-2.5, -2.0, -1.5, -2., -2.5};
+
+int i;
+g->SelForeground(PI_Green);
+g->SelMarkerSz(0.3, PI_BoxMarker);
+g->DrawMarkers(x, y, 5);
+g->SelForeground(PI_Magenta);
+g->SelMarkerSz(0.3, PI_FCircleMarker);
+for(i=0; i<5; i++)
+   y[i] = (float)(y[i]) + 1.;
+g->DrawMarkers(x, y, 5);
+g->SelForeground(PI_Black);
+
+g->DrawLine(-4, -4, 4, 4);
+g->DrawLine(-2, -5, 5, 2);
+g->DrawLine(-5, -4, -2, -2);
+g->DrawLine(1, -10, 1, 10);
+return;  
+}
+
Index: /branches/EA_Juin98/SophyaPI/PI/sc_sample.h
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/sc_sample.h	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/sc_sample.h	(revision 108)
@@ -0,0 +1,14 @@
+#include "pisysdep.h"
+
+#include "piscdrawwdg.h"
+
+class ScSample : public PIScDrawWdg {
+public:
+  ScSample(PIContainerGen *par, char *nom,
+           int sx=10, int sy=10, int px=0, int py=0);
+  ~ScSample();
+
+  
+  virtual void DrawSelf(PIGraphicUC* g);
+
+};
Index: /branches/EA_Juin98/SophyaPI/PI/so_locations
===================================================================
--- /branches/EA_Juin98/SophyaPI/PI/so_locations	(revision 108)
+++ /branches/EA_Juin98/SophyaPI/PI/so_locations	(revision 108)
@@ -0,0 +1,12 @@
+piup.so \
+		:st = .text 0x000003ffbfff0000, 0x0000000000010000:\
+		:st = .data 0x000003ffffff0000, 0x0000000000010000:\
+
+piup_def.so \
+		:st = .text 0x000003ffbffe0000, 0x0000000000010000:\
+		:st = .data 0x000003fffffe0000, 0x0000000000010000:\
+
+user.so \
+		:st = .text 0x000003ffbffd0000, 0x0000000000010000:\
+		:st = .data 0x000003fffffd0000, 0x0000000000010000:\
+
