Index: trunk/SophyaPI/PI/Makefile
===================================================================
--- trunk/SophyaPI/PI/Makefile	(revision 2)
+++ trunk/SophyaPI/PI/Makefile	(revision 2)
@@ -0,0 +1,157 @@
+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, Obj 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: $(LIB)libPI.a $(SLB)libPI.so
+$(LIB)libPI.a : $(OBJ)ex_dessin.o $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwdgxt.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
+	ar -rs $@ $?
+ 
+$(SLB)libPI.so : $(LIB)libPI.a
+	ld -S -shared -o $(SLB)libPI.so -all -L$(LIB) $(LIB)libPI.a 2>/dev/null
+$(OBJ)ex_dessin.o: ex_dessin.cc ex_dessin.h pisysdep.h pibwdgx.h pibwdggen.h \
+ piwdgx.h piwdggen.h pimsghandler.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
+$(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
+$(OBJ)pibwdggen.o: pibwdggen.cc pibwdggen.h pisysdep.h piwdgx.h piwdggen.h \
+ pimsghandler.h
+$(OBJ)pibwdgx.o: pibwdgx.cc pibwdgx.h pisysdep.h pibwdggen.h piwdgx.h \
+ piwdggen.h pimsghandler.h pixtbaseP.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)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)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)piimage.o: piimage.cc piimage.h $(INC)cimage.h \
+ $(INC)rzimage.h \
+ $(INC)rzvect.h \
+ $(INC)machine.h $(INC)defs.h \
+ $(INC)exceptions.h \
+ $(INC)perrors.h \
+ $(INC)datatypes.h $(INC)lut.h \
+ pisysdep.h pipixmapx.h pipixmapgen.h pibwdgx.h pibwdggen.h piwdgx.h \
+ piwdggen.h pimsghandler.h picmap.h picmapx.h picmapgen.h pistdwdgx.h \
+ pistdwdggen.h $(INC)imageop.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
+$(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
+$(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)pioptmenugen.o: pioptmenugen.cc pioptmenugen.h pisysdep.h piwdgx.h \
+ piwdggen.h pimsghandler.h pimenux.h pimenugen.h
+$(OBJ)pioptmenux.o: pioptmenux.cc pisysdep.h pioptmenux.h pioptmenugen.h \
+ piwdgx.h piwdggen.h pimsghandler.h pimenux.h pimenugen.h \
+ picontainerx.h picontainergen.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
+$(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
+$(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)piwdggen.o: piwdggen.cc piwdggen.h pimsghandler.h picontainergen.h \
+ pisysdep.h piwdgx.h
+$(OBJ)piwdgx.o: piwdgx.cc piwdgx.h piwdggen.h pimsghandler.h picontainerx.h \
+ pisysdep.h picontainergen.h
+$(OBJ)piwdgxt.o: piwdgxt.cc piwdggen.h pimsghandler.h picontainergen.h \
+ pisysdep.h piwdgx.h
+$(OBJ)piwindowgen.o: piwindowgen.cc piwindowgen.h pisysdep.h picontainerx.h \
+ picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)piwindowx.o: piwindowx.cc piwindowx.h piwindowgen.h pisysdep.h \
+ picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h
+$(OBJ)pixtbase.o: pixtbase.cc pixtbaseP.h pibwdgx.h pisysdep.h pibwdggen.h \
+ piwdgx.h piwdggen.h pimsghandler.h pixtbase.h
Index: trunk/SophyaPI/PI/ex_dessin.cc
===================================================================
--- trunk/SophyaPI/PI/ex_dessin.cc	(revision 2)
+++ trunk/SophyaPI/PI/ex_dessin.cc	(revision 2)
@@ -0,0 +1,139 @@
+#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)
+
+{
+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()
+{
+SelLine(PI_NormalLine);
+DrawBox(10,10, XSize()-20, YSize()-20);
+
+SelLine(PI_ThinLine);
+DrawFBox(20, 20, 20, 20);
+DrawCircle(30, 30, 15);
+
+SelForeground(PI_Red);
+DrawFCircle(70, 30, 15);
+
+SelForeground(PI_Yellow);
+DrawFBox(10, 60, 100, 15);
+
+SelForeground(PI_Black);
+DrawString(20, 90, str);
+
+SelLine(PI_ThinLine);
+DrawLine(10, 120, 40, 120);
+SelLine(PI_NormalLine);
+DrawLine(40, 120, 70, 120);
+SelLine(PI_ThickLine);
+DrawLine(70, 120, 100, 120);
+
+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};
+if (++mfnt > 2)  mfnt = 0;
+
+SelFont(PI_NormalSizeFont, att[mfnt]);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But2Release(int x, int y)
+{
+Refresh();
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But3Press(int x, int y)
+{
+SelPointerShape(PI_HandPointer);
+SelForeground(PI_Blue);
+DrawFBox(0, 0, 8, 8);
+return;
+}
+
+/* --Methode-- */
+void ExBWdg::But3Release(int x, int y)
+{
+SelForeground(PI_White);
+DrawFBox(0, 0, 8, 8);
+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';
+
+SelFont(PI_BigSizeFont, PI_BoldFont);
+DrawString(20, 75, buf);
+
+return;
+}
+
+
Index: trunk/SophyaPI/PI/ex_dessin.h
===================================================================
--- trunk/SophyaPI/PI/ex_dessin.h	(revision 2)
+++ trunk/SophyaPI/PI/ex_dessin.h	(revision 2)
@@ -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();
+
+  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;
+  int nc;
+  char str[21];
+};
+
+
+#endif 
Index: trunk/SophyaPI/PI/pi.rsc
===================================================================
--- trunk/SophyaPI/PI/pi.rsc	(revision 2)
+++ trunk/SophyaPI/PI/pi.rsc	(revision 2)
@@ -0,0 +1,34 @@
+PeidaInt*activeBackground:                   LightBlue
+PeidaInt*default*activeBackground:           LightBlue
+PeidaInt*activeBottomShadowColor:            Black
+PeidaInt*default*activeBottomShadowColor:    Black
+PeidaInt*activeForeground:                   LightBlue
+PeidaInt*default*activeForeground:           LightBlue
+PeidaInt*default*highlightColor:             LightBlue
+PeidaInt*activeTopShadowColor:               White
+PeidaInt*default*activeTopShadowColor:       White
+PeidaInt*background:                         Grey
+PeidaInt*default*background:                 Grey
+PeidaInt*bottomShadowColor:                  Black
+PeidaInt*default*bottomShadowColor:          Black
+PeidaInt*Foreground:                         Yellow
+PeidaInt*default*Foreground:                 Yellow
+PeidaInt*topShadowColor:                     White
+PeidaInt*default*topShadowColor:             White
+PeidaInt*borderColor:                        Yellow
+
+PeidaInt*XmLabel.borderWidth:                1
+PeidaInt*XmScrollBar*background:             LightBlue
+PeidaInt*XmDrawingArea*background:           Black
+PeidaInt*XmPushButton*borderWidth:           0
+
+PeidaInt*XmText*XmNshadowThickness:          0
+PeidaInt*XmText*XmNhighlightThickness:          0
+
+
+PeidaInt*fontList:           -*-helvetica-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1
+PeidaInt*default*fontList:    -*-helvetica-bold-r-normal-*-12-*-*-*-*-*-ISO8859-1
+PidaInt*fontList:           -*-*-Bold-*-*-*-12-*-*-*-*-*-*-*
+PidaInt*default*fontList:   -*-*-Bold-*-*-*-12-*-*-*-*-*-*-*
+
+PeidaInt*XmToggleButton*selectColor:                  Red
Index: trunk/SophyaPI/PI/piapplgen.cc
===================================================================
--- trunk/SophyaPI/PI/piapplgen.cc	(revision 2)
+++ trunk/SophyaPI/PI/piapplgen.cc	(revision 2)
@@ -0,0 +1,16 @@
+#include "piapplgen.h"
+
+PIApplicationGen::PIApplicationGen()
+:topcont(NULL), menubar(NULL)
+{}
+
+PIApplicationGen::~PIApplicationGen()
+{}
+
+
+void PIApplicationGen::AppendMenu(PIPDMenu *pdm)
+{
+if (menubar)
+  menubar->AppendMenu(pdm);
+return;
+}
Index: trunk/SophyaPI/PI/piapplgen.h
===================================================================
--- trunk/SophyaPI/PI/piapplgen.h	(revision 2)
+++ trunk/SophyaPI/PI/piapplgen.h	(revision 2)
@@ -0,0 +1,26 @@
+#ifndef PIAPPLGEN_H_SEEN
+#define PIAPPLGEN_H_SEEN
+
+#include "pimsghandler.h"
+#include "pisysdep.h"
+#include PICONT_H
+#include PIMENUBAR_H
+
+class PIApplicationGen : public PIMsgHandler {
+public:
+				  PIApplicationGen();
+	virtual		          ~PIApplicationGen();
+	
+	virtual void              Run()=0;
+	virtual void              Stop()=0;
+
+	virtual PIContainer*      MainWin() {return topcont;}
+        virtual PIMenubar*        Menubar() {return menubar;}
+
+        virtual void              AppendMenu(PIPDMenu *pdm);
+protected:
+    PIContainer               *topcont;
+    PIMenubar                 *menubar;
+};
+
+#endif
Index: trunk/SophyaPI/PI/piapplmac.cc
===================================================================
--- trunk/SophyaPI/PI/piapplmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/piapplmac.cc	(revision 2)
@@ -0,0 +1,80 @@
+
+#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 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.
+
+	macAppli = new PIPPApplMac;
+	macAppli->AddAttachment(new PISIOUXAttachment);
+	new PIPPMenuBar();
+	
+    menubar = new PIMenubar(this, "DefMenubar");
+    topcont = new PIWindowMac(this, "TopLevel", PIWindowKind(2), sx, sy, 10, 45);
+}
+
+PIApplicationMac::~PIApplicationMac()
+{
+	delete macAppli;
+}
+
+void
+PIApplicationMac::Run()
+{
+    topcont->Show();
+	macAppli->Run();
+}
+
+void
+PIApplicationMac::Stop()
+{
+	macAppli->DoQuit();
+}
+
Index: trunk/SophyaPI/PI/piapplmac.h
===================================================================
--- trunk/SophyaPI/PI/piapplmac.h	(revision 2)
+++ trunk/SophyaPI/PI/piapplmac.h	(revision 2)
@@ -0,0 +1,21 @@
+#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();
+	
+//protected:
+	LApplication* macAppli;
+};
+
+typedef PIApplicationMac PIApplication;
+
+#endif
Index: trunk/SophyaPI/PI/piapplx.cc
===================================================================
--- trunk/SophyaPI/PI/piapplx.cc	(revision 2)
+++ trunk/SophyaPI/PI/piapplx.cc	(revision 2)
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include "piapplx.h"
+#include "picontainerx.h"
+
+
+#define DEBUG_APPLX
+
+/* --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);
+menubar = new PIMenubar(this, "DefMenubar");
+Menubar()->SetBinding(true, false, true, false);
+sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
+syt = ( sy > 0 ) ? sy : 0;
+syt += Menubar()->YSize();
+MBCont()->SetSize(sxt, syt);
+if ( (sx > 0) && (sy > 0) )
+  {
+  topcont = new PIContainerX(MBCont(), "TopLevelCont", 
+                             sx, sy, 0, Menubar()->YSize());
+  topcont->SetBinding(true, false, true, true);
+  topcont->Show();
+  }
+else topcont = MBCont();
+
+MBCont()->Show();
+topwdg->Manage();
+}
+
+/* --Methode-- */
+PIApplicationX::~PIApplicationX()
+{
+#ifdef DEBUG_APPLX
+puts("PIApplicationX::~PIApplicationX()_info : App delete");
+#endif
+topwdg->Unmanage();
+delete topcont;
+delete topwdg;
+exit(0);
+}
+
+/* --Methode-- */
+void PIApplicationX::Run()
+{
+XEvent evt;
+#ifdef DEBUG_APPLX
+puts("PIApplicationX::Run()_info : App Run ");
+#endif
+
+topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
+
+while (mStop)
+  {
+  XtNextEvent(&evt);
+  XtDispatchEvent(&evt);
+  }
+return;
+}
Index: trunk/SophyaPI/PI/piapplx.h
===================================================================
--- trunk/SophyaPI/PI/piapplx.h	(revision 2)
+++ trunk/SophyaPI/PI/piapplx.h	(revision 2)
@@ -0,0 +1,27 @@
+#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=0, int sy=0, 
+                                 int narg=0, char *arg[]=NULL);
+
+  virtual	  ~PIApplicationX();
+	
+  virtual void    Run();
+  virtual void    Stop() { mStop = false; }
+
+  PIContainer*    MBCont() { return intcont; }
+protected:
+  PIWdg * topwdg;
+  PIContainer * intcont;
+  bool mStop;
+};
+
+typedef PIApplicationX PIApplication;
+
+#endif
Index: trunk/SophyaPI/PI/pibwdggen.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdggen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pibwdggen.cc	(revision 2)
@@ -0,0 +1,115 @@
+#include <stdio.h>
+
+#include "pibwdggen.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)
+{
+}
+
+
+/* --Methode-- */
+PIBaseWdgGen::~PIBaseWdgGen()
+{
+}
+
+ 
+
+
+/* --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)
+{
+#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;
+}
+
Index: trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- trunk/SophyaPI/PI/pibwdggen.h	(revision 2)
+++ trunk/SophyaPI/PI/pibwdggen.h	(revision 2)
@@ -0,0 +1,78 @@
+#ifndef PIBWDGGEN_H_SEEN
+#define PIBWDGGEN_H_SEEN
+
+#include "pisysdep.h"
+#include PIWDG_H
+
+#include "pibwdggen.h"
+
+enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 
+
+enum PIColors { PI_Black = 0, PI_White = 1, 
+                PI_Red = 2, PI_Blue = 3, PI_Green = 4,  
+                PI_Yellow = 5 } ; 
+enum PIFontSize {PI_SmallSizeFont = 1, PI_NormalSizeFont = 2, PI_BigSizeFont = 3 };
+enum PIFontAtt {PI_RomanFont = 1, PI_BoldFont = 2, PI_ItalicFont = 4 };
+enum PILineAtt { PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 };
+
+enum PIPointer { PI_ArrowPointer = 1, PI_CrossPointer = 2, PI_HandPointer = 3 };
+
+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;
+
+//  Trace graphiques
+  virtual void       EraseWindow()             = 0;
+  virtual void       DrawString(int x, int y, char* s, int pos = 0)        = 0;
+  virtual void       DrawLine(int x1, int y1, int x2, int y2)              = 0;  
+  virtual void       DrawBox(int x0, int y0, int dx, int dy)               = 0;
+  virtual void       DrawFBox(int x0, int y0, int dx, int dy)              = 0;
+  virtual void       DrawCircle(int x0, int y0, int r)                     = 0;
+  virtual void       DrawFCircle(int x0, int y0, int r)                    = 0;
+
+  virtual void       SelForeground(PIColors col=PI_Black)                  = 0;
+  virtual void       SelBackground(PIColors col=PI_White)                  = 0;
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont)                   = 0;
+  virtual void       SelLine(PILineAtt att=PI_NormalLine)                  = 0;
+  virtual void       SelPointerShape(PIPointer ptr)                        = 0;
+
+
+  virtual void       Refresh()         = 0;
+  
+// Traitement des evenements   
+  virtual void       Resize()          = 0;
+  virtual void       Draw()            = 0;
+  virtual void       Draw(int x0, int y0, int dx, int dy) = 0;
+
+  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);
+};
+
+
+#endif /* PIBWDGGEN_H_SEEN */
Index: trunk/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdgmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pibwdgmac.cc	(revision 2)
@@ -0,0 +1,304 @@
+#include <stdio.h>
+
+#include <LString.h>
+#include "pibwdgmac.h"
+#include "piupdattachment.h"
+
+// 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)
+{
+    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()
+{
+  if (mPane->FocusDraw()) {
+     GrafPtr p = mPane->GetMacPort();
+     if (p) EraseRgn(p->visRgn);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawString(int x, int y, char* s, int /*pos*/)
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y,x};
+    mPane->LocalToPortPoint(pt);
+    ::MoveTo(pt.h, pt.v);
+    LStr255 ps = s;
+    ::DrawString(ps);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawLine(int x1, int y1, int x2, int y2)
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y1,x1};
+    mPane->LocalToPortPoint(pt);
+    ::MoveTo(pt.h, pt.v);
+	SetPt(&pt,x2,y2);
+    mPane->LocalToPortPoint(pt);
+    ::LineTo(pt.h, pt.v);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawBox(int x0, int y0, int dx, int dy)
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y0,x0};
+    mPane->LocalToPortPoint(pt);
+    Rect r = {pt.v, pt.h, pt.v+dy, pt.h+dx};
+    ::FrameRect(&r);
+  }
+}
+
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawFBox(int x0, int y0, int dx, int dy)
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y0,x0};
+    mPane->LocalToPortPoint(pt);
+    Rect r = {pt.v, pt.h, pt.v+dy, pt.h+dx};
+    ::PaintRect(&r);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawCircle(int x0, int y0, int r) 
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y0,x0};
+    mPane->LocalToPortPoint(pt);
+    Rect rr = {pt.v-r, pt.h-r, pt.v+r, pt.h+r};
+    ::FrameOval(&rr);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::DrawFCircle(int x0, int y0, int r) 
+{
+  if (mPane->FocusDraw()) {
+    Point pt = {y0,x0};
+    mPane->LocalToPortPoint(pt);
+    Rect rr = {pt.v-r, pt.h-r, pt.v+r, pt.h+r};
+    ::PaintOval(&rr);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::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);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::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;
+    }
+    ::BackColor(color);
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::SelFont(PIFontSize sz,PIFontAtt att)
+{
+  if (mPane->FocusDraw()) {
+    switch(sz) {
+      case PI_SmallSizeFont:
+        ::TextSize(9);
+        break;
+      case PI_NormalSizeFont:
+        ::TextSize(12);
+        break;
+      case PI_BigSizeFont:
+        ::TextSize(14);
+        break;
+    }
+    switch(att) {
+      case PI_RomanFont:
+        ::TextFace(0);
+        break;
+      case PI_BoldFont:
+        ::TextFace(bold);
+        break;
+      case PI_ItalicFont:
+        ::TextFace(italic);
+        break;
+    }
+  }
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::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;
+    }
+  }
+}
+
+/* --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;
+    }
+  }
+}
+
+/* --Methode-- */
+bool PIBaseWdgMac::AdjustCursor()
+{
+  if (cursor) {
+    ::SetCursor(cursor);
+    return true;
+  }
+  return false;
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::Refresh()
+{
+if (mPane->IsVisible())
+  Draw();
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::Resize()
+{
+#ifdef DEBUG_RZXB
+printf ("Debug_PIBaseWdgMac::ReSize %ld %ld NewSize= %d %d\n", 
+         (long)(this), (long)(this->sdw), 
+         (int)this->sdw->core.width, (int)this->sdw->core.height);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::Draw(int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
+{
+this->Draw();
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgMac::Draw()
+{
+#ifdef DEBUG_RZXB
+this->PIEraseWindow();
+this->PIDrawFBox(10,10, XSize()*2/3, YSize()*2/3);
+#endif
+return;
+}
+
+
Index: trunk/SophyaPI/PI/pibwdgmac.h
===================================================================
--- trunk/SophyaPI/PI/pibwdgmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pibwdgmac.h	(revision 2)
@@ -0,0 +1,57 @@
+/* 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();
+
+//  Trace graphiques
+  virtual void       EraseWindow();
+  virtual void       DrawString(int x, int y, char* s, int pos = 0);
+  virtual void       DrawLine(int x1, int y1, int x2, int y2);
+  virtual void       DrawBox(int x0, int y0, int dx, int dy);
+  virtual void       DrawFBox(int x0, int y0, int dx, int dy);
+  virtual void       DrawCircle(int x0, int y0, int r);
+  virtual void       DrawFCircle(int x0, int y0, int r);
+  
+  virtual void       SelForeground(PIColors col=PI_White);
+  virtual void       SelBackground(PIColors col=PI_Black);
+  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                             PIFontAtt att=PI_RomanFont);
+  virtual void       SelLine(PILineAtt att=PI_NormalLine);
+  virtual void       SelPointerShape(PIPointer ptr);
+
+  virtual void       Refresh();
+
+  virtual void       Resize();
+  virtual void       Draw();
+  virtual void       Draw(int x0, int y0, int dx, int dy);
+
+
+protected:
+  friend class       PIUpdAttachment;
+  virtual bool       AdjustCursor();
+  CursPtr            cursor;
+};
+
+typedef PIBaseWdgMac PIBaseWdg;
+
+#endif /* RZXBASE_H_SEEN */
Index: trunk/SophyaPI/PI/pibwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdgx.cc	(revision 2)
+++ trunk/SophyaPI/PI/pibwdgx.cc	(revision 2)
@@ -0,0 +1,461 @@
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/cursorfont.h>
+
+#include <X11/IntrinsicP.h>
+#include <X11/CoreP.h>
+
+#include "pibwdgx.h"
+
+#include "pixtbaseP.h"
+#include "pixtbase.h"
+
+
+/*  Variables globales pour modifier les GC  */
+static Font fnt[3][3];
+#define NMAXCOL  10
+static unsigned long colpix[NMAXCOL];
+#define NMAXCURS 5 
+static Cursor curs[NMAXCURS];
+
+
+// #define DEBUG_PIBWDGX     Flag pour impression de debug etc ...
+
+
+/* --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, colpix[PI_White]);  
+XtSetArg(wargs[2],XtNborderWidth, (Dimension)0);  
+XtSetValues(XtWdg(), wargs, 3);
+
+mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL);
+
+SelForeground(PI_Black);
+SelBackground(PI_White);
+SelLine();
+SelFont();
+SelPointerShape(PI_ArrowPointer);
+
+Manage();
+}
+
+
+/* --Methode-- */
+PIBaseWdgX::~PIBaseWdgX()
+{
+}
+
+ 
+
+/* --Methode-- */
+void PIBaseWdgX::ActivatePtrCross()
+{
+XtTranslations trans;
+trans = XtParseTranslationTable
+        ("<Enter>: enter_pixtbase() \n <Leave>: leave_pixtbase()");
+XtAugmentTranslations(XtWdg(), trans);
+//XtFree((char *)trans);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateButton(int bid)
+{
+XtTranslations trans;
+char strans[256];
+if ((bid<1) || (bid > 3))  return;
+sprintf(strans,"<Btn%dDown>: bud%d_pixtbase() \n <Btn%dUp>: buu%d_pixtbase()",
+        bid, bid, bid, bid);
+trans = XtParseTranslationTable(strans);
+
+XtAugmentTranslations(XtWdg(), trans);
+// XtFree((char *)trans);
+#ifdef DEBUG_PIBWDGX
+printf("PIBaseWdgX::ActivateButton \n%s \n", strans);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateMove(int bid)
+{
+XtTranslations trans;
+char strans[256];
+if ((bid<1) || (bid > 3))  return;
+sprintf(strans,"<Btn%dMotion>: mov%d_pixtbase()", bid, bid);
+//sprintf(strans,"Button%d <PtrMoved>: mov%d_pixtbase()", bid, bid);
+trans = XtParseTranslationTable(strans);
+
+XtAugmentTranslations(XtWdg(), trans);
+// XtFree((char *)trans);
+#ifdef DEBUG_PIBWDGX
+printf("PIBaseWdgX::ActivateMove \n%s \n", strans);
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::ActivateKeyboard()
+{
+XtTranslations trans;
+trans = XtParseTranslationTable("<Key>: keyb_pixtbase()");
+XtAugmentTranslations(XtWdg(), trans);
+// XtFree((char *)trans);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::EraseWindow()
+{
+XClearWindow   (XtDisplay(XtWdg()),XtWindow(XtWdg()) );
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawString(int x, int y, char* s, int pos)
+{
+XDrawImageString (XtDisplay (XtWdg()),XtWindow(XtWdg()), 
+                  DefGC(), x, y, s, strlen(s));
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawLine(int x1, int y1, int x2, int y2)
+{
+XDrawLine(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(), x1, y1, x2, y2);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawBox(int x0, int y0, int dx, int dy)
+{
+XDrawRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 
+               DefGC(), x0, y0, dx, dy);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawFBox(int x0, int y0, int dx, int dy)
+{
+XFillRectangle(XtDisplay (XtWdg()), XtWindow(XtWdg()), 
+               DefGC(), x0, y0, dx, dy);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawCircle(int x0, int y0, int r)
+{
+XDrawArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(),
+         x0-r, y0-r, 2*r, 2*r, 0, 360*64);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::DrawFCircle(int x0, int y0, int r)
+{
+XFillArc(XtDisplay (XtWdg()), XtWindow(XtWdg()), DefGC(),
+         x0-r, y0-r, 2*r, 2*r, 0, 360*64);
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::SelForeground(PIColors col)
+{
+if ( (col < 0) || (col >= NMAXCOL))  return;
+XSetForeground(XtDisplay(XtWdg()), DefGC(), colpix[col]); 
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::SelBackground(PIColors col)
+{
+if ( (col < 0) || (col >= NMAXCOL))  return;
+XSetBackground(XtDisplay(XtWdg()), DefGC(), colpix[col]); 
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::SelFont(PIFontSize sz, PIFontAtt att)
+{
+int i,j;
+switch (sz)
+  {
+  case PI_SmallSizeFont:
+    i = 0;
+    break;
+  case PI_NormalSizeFont:
+    i = 1;
+    break;
+  case PI_BigSizeFont:
+    i = 2;
+    break;
+  default:
+    i=0;
+    break;
+  }
+
+j = 0;
+if (att & PI_RomanFont) j = 0;
+if (att & PI_BoldFont) j = 1;
+if (att & PI_ItalicFont) j = 2;
+
+XSetFont(XtDisplay(XtWdg()), DefGC(), fnt[i][j]);
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::SelLine(PILineAtt att)
+{
+unsigned int lt;
+
+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(XtWdg()), DefGC(), lt, LineSolid, CapNotLast, JoinMiter);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::SelPointerShape(PIPointer ptr)  
+{
+if ( (ptr < 0) || (ptr >= NMAXCURS))  return;
+if ( XtIsRealized(XtWdg()) )
+  XDefineCursor(XtDisplay (XtWdg()), XtWindow(XtWdg()), curs[ptr]);
+return;
+}
+
+
+
+/* --Methode-- */
+void PIBaseWdgX::Refresh()
+{
+if ( (XtIsRealized(this->XtWdg())) &&  
+   (((PIXtBaseWidget)(this->XtWdg()))->core.visible) )        
+  { this->Draw(); }
+
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::Resize()
+{
+#ifdef DEBUG_PIBWDGX
+printf ("PIBaseWdgX::ReSize %ld %ld NewSize= %d %d\n", 
+         (long)(this), (long)(this->XtWdg()), 
+         (int)this->XtWdg()->core.width, (int)this->XtWdg()->core.height);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::Draw(int x0, int y0, int dx, int dy)
+{
+this->Draw();
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::Draw()
+{
+#ifdef DEBUG_PIBWDGX
+this->EraseWindow();
+this->DrawFBox(10,10, XSize()*2/3, YSize()*2/3);
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::Enter()
+{
+#ifdef DEBUG_PIBWDGX
+puts("PIBaseWdgX::Enter() enter notify ");
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::Leave()
+{
+#ifdef DEBUG_PIBWDGX
+puts("PIBaseWdgX::Leave() leave notify ");
+#endif
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::But1Press(int x, int y)
+{
+#ifdef DEBUG_PIBWDGX
+printf ("PIBaseWdgX::But1Press PosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::But1Release(int x, int y)
+{
+#ifdef DEBUG_PIBWDGX
+printf ("PIBaseWdgX::ButReleasePosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::But2Press(int x, int y)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::But2Release(int x, int y)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::But3Press(int x, int y)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::But3Release(int x, int y)
+{
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::Ptr1Move(int x, int y)
+{
+#ifdef DEBUG_PIBWDGX
+printf ("PIBaseWdgX::Ptr1Move PosX,Y= %d %d \n", x, y);
+#endif
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::Ptr2Move(int x, int y)
+{
+return;
+}
+
+
+/* --Methode-- */
+void PIBaseWdgX::Ptr3Move(int x, int y)
+{
+return;
+}
+
+/* --Methode-- */
+void PIBaseWdgX::Keyboard(int key, PIKeyModifier kmod)
+{
+
+#ifdef DEBUG_PIBWDGX
+printf("PIBaseWdgX::Keyboard: Key= %d (%c)  Mod= %d \n", key, (char)key, (int)kmod); 
+XSync(XtDisplay(this->XtWdg()), 0);
+#endif
+return;
+}
+
+
+static bool fgbwdg = false ;
+
+/* --Methode-- */
+void PIBaseWdgX::Init()
+{
+char buff[200];
+int i,j;
+int fsz[3]={10,12,14};
+
+if (fgbwdg)  return;
+fgbwdg = true;
+
+Display *mdsp;
+int scr;
+XColor exact,mycol;
+Colormap  cmap;
+Status rc;
+
+mdsp = PIXDisplay();
+scr = XDefaultScreen(mdsp);
+
+/* Allocation des fonts */
+for (i=0; i<3; i++)
+  {
+  sprintf(buff,"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
+  fnt[i][0] = XLoadFont(mdsp, buff);
+  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
+  sprintf(buff,"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
+  fnt[i][1] = XLoadFont(mdsp, buff);
+  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
+  sprintf(buff,"-*-helvetica-medium-o-normal-*-%d-*-*-*-*-*-ISO8859-1", fsz[i]);
+  fnt[i][2] = XLoadFont(mdsp, buff);
+  if (fnt[i][0] == 0)  printf("PIBaseWdgX::Init: Pb font %s \n", buff);
+  }
+
+for(i=0; i<3; i++)
+  for(j=0; j<3; j++)
+    if (fnt[i][0] == 0) XLoadFont(mdsp, "fixed");
+
+ 
+/*  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, "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;
+
+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);
+
+return;
+}
Index: trunk/SophyaPI/PI/pibwdgx.h
===================================================================
--- trunk/SophyaPI/PI/pibwdgx.h	(revision 2)
+++ trunk/SophyaPI/PI/pibwdgx.h	(revision 2)
@@ -0,0 +1,73 @@
+#ifndef PIBWDGX_H_SEEN
+#define PIBWDGX_H_SEEN
+
+#include "pisysdep.h"
+#include "pibwdggen.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();
+
+
+//  Activation des evenements   
+  virtual void   ActivatePtrCross();
+  virtual void   ActivateButton(int bid);
+  virtual void   ActivateMove(int bid);
+  virtual void   ActivateKeyboard();
+
+//  Trace graphiques
+  virtual void   EraseWindow();
+  virtual void   DrawString(int x, int y, char* s, int pos = 0);
+  virtual void   DrawLine(int x1, int y1, int x2, int y2);
+  virtual void   DrawBox(int x0, int y0, int dx, int dy);
+  virtual void   DrawFBox(int x0, int y0, int dx, int dy);
+  virtual void   DrawCircle(int x0, int y0, int r);
+  virtual void   DrawFCircle(int x0, int y0, int r);
+
+  virtual void   SelForeground(PIColors col=PI_Black);
+  virtual void   SelBackground(PIColors col=PI_White);
+  virtual void   SelFont(PIFontSize sz=PI_NormalSizeFont, 
+                         PIFontAtt att=PI_RomanFont);
+  virtual void   SelLine(PILineAtt att=PI_NormalLine);
+  virtual void   SelPointerShape(PIPointer ptr);
+  
+
+  virtual void   Refresh();
+
+// Traitement des evenements   
+
+  virtual void   Resize();
+  virtual void   Draw();
+  virtual void   Draw(int x0, int y0, int dx, int dy);
+
+  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);
+
+  inline  GC     DefGC() { return mDefGC; }
+
+protected:
+  void           Init();
+
+  GC mDefGC;
+};
+
+typedef PIBaseWdgX PIBaseWdg;
+
+#endif /* PIBWDGX_H_SEEN */
Index: trunk/SophyaPI/PI/picmap.cc
===================================================================
--- trunk/SophyaPI/PI/picmap.cc	(revision 2)
+++ trunk/SophyaPI/PI/picmap.cc	(revision 2)
@@ -0,0 +1,52 @@
+#include "picmap.h"
+
+PIColorMap::PIColorMap(CMapId id)
+: PIColorMapNative(id)
+{
+   if (!*maps) { // Il faut allouer les trois maps de depart
+     maps[0] = new PIColorMap(CMAP_GREY32, 0);
+     maps[1] = new PIColorMap(CMAP_GREYINV32, 0);
+     maps[2] = new PIColorMap(CMAP_COLRJ32, 0);
+   }
+   
+   switch (id) {
+     case CMAP_GREY32 : 
+       CopyFrom(maps[0]);
+       break;
+     case CMAP_GREYINV32 : 
+       CopyFrom(maps[1]);
+       break;
+     case CMAP_COLRJ32 : 
+       CopyFrom(maps[2]);
+       break;
+     default:
+       if (!maps[3] || maps[3]->Type() != id) {
+         if (maps[3])
+           {
+           maps[3]->FreeColors();
+           delete maps[3];
+	   }
+         maps[3] = new PIColorMap(id, 0);
+       }
+       CopyFrom(maps[3]);
+   }
+}
+
+
+PIColorMap::PIColorMap(string const& nom, int nCol)
+: PIColorMapNative(nom, nCol)
+{
+  MakeColMap();
+}
+
+PIColorMap::PIColorMap(CMapId id, int i)      // Fait une veritable allocation
+: PIColorMapNative(id,i)
+{
+  MakeColMap();
+}
+
+PIColorMap::~PIColorMap()
+{
+  if (mType == CMAP_OTHER)
+    FreeColors();
+}
Index: trunk/SophyaPI/PI/picmap.h
===================================================================
--- trunk/SophyaPI/PI/picmap.h	(revision 2)
+++ trunk/SophyaPI/PI/picmap.h	(revision 2)
@@ -0,0 +1,13 @@
+#include "pisysdep.h"
+#include PICMAPNTV_H
+
+
+class PIColorMap : public PIColorMapNative {
+public:
+  PIColorMap(CMapId);
+  PIColorMap(string const& nom, int nCol); 
+  virtual ~PIColorMap();
+protected:
+  PIColorMap(CMapId id, int i);     // Fait une veritable allocation
+};
+
Index: trunk/SophyaPI/PI/picmapgen.cc
===================================================================
--- trunk/SophyaPI/PI/picmapgen.cc	(revision 2)
+++ trunk/SophyaPI/PI/picmapgen.cc	(revision 2)
@@ -0,0 +1,168 @@
+#include "picmapgen.h"
+#include <list.h>
+#include <algo.h>
+#include "pisysdep.h"
+#include PICMAPNTV_H
+#include PICMAP_H
+
+
+
+PIColorMapGen* PIColorMapGen::maps[4] = {NULL,NULL,NULL,NULL};
+
+int PIColorMapGen::nCols[6] = {32,32,32,32,32,16};
+char* PIColorMapGen::noms[6] = {"Grey32","InvGrey32","ColRJ32","ColBR32","ColRV32","Col16"};
+
+PIColorMapGen::PIColorMapGen(CMapId)
+{
+}
+
+void PIColorMapGen::CopyFromGen(PIColorMapGen* m)
+{
+  mNom = m->mNom;
+  mNCol = m->mNCol;
+  mType = m->mType;
+}
+
+
+PIColorMapGen::PIColorMapGen(string const& nom, int nCol)
+{
+  mNom = nom;
+  mNCol = nCol;
+  mType = CMAP_OTHER;
+}
+
+PIColorMapGen::PIColorMapGen(CMapId id, int)
+{
+  if (id < CMAP_GREY32 && id > CMAP_COL16)
+     id = CMAP_GREY32; // BEUARK
+  mNom = noms[id - 1];
+  mNCol = nCols[id - 1];
+  mType = id;
+}
+
+
+PIColorMapGen::~PIColorMapGen()
+{
+}
+
+/*  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 PIColorMapGen::MakeColMap()
+{
+  PIColor mycol;
+  
+  switch (mType)
+  {
+  case CMAP_GREY32 :
+    for(int i=0; i<mNCol; i++)
+      {
+      mycol.red = mycol.green = mycol.blue = 3535+(i*62000/32);
+      AllocColor(mycol, i);
+      }
+    break;
+
+  case CMAP_GREYINV32 :
+    for(int i=0; i<mNCol; i++)
+      {
+      mycol.red = mycol.green = mycol.blue = 65535-(i*62000/32);
+      AllocColor(mycol, i);
+      }
+    break;
+
+  case CMAP_COL16 :
+    for(int i=0; i<mNCol; i++)
+      {
+      mycol.red = (int)(R_RGB1[i]*65535.);
+      mycol.green = (int)(G_RGB1[i]*65535.);
+      mycol.blue =(int)(B_RGB1[i]*65535.) ;
+      AllocColor(mycol, i);
+      }
+    break;
+
+  case CMAP_COLRJ32 :
+    for(int i=0; i<mNCol; 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; }
+
+      AllocColor(mycol, i);
+      }
+    break;
+
+  case CMAP_COLBR32 :
+    for(int i=0; i<mNCol; i++)
+      {
+      if (i < 5) 
+        { mycol.green = mycol.red = 0;  
+          mycol.blue = 5535+i*15000; }
+      else if (i < 10)
+        { mycol.blue = 65535;
+          mycol.green = 5535+(i-5)*9000;
+          mycol.red = 0;  }
+      else if (i < 15)
+        { mycol.blue = 60000-(i-10)*15000;
+          mycol.green = 41535+(i-10)*6000;
+          mycol.red = 0;  }
+      else if (i < 21)
+        { mycol.blue = 0;
+          mycol.green = 65535;
+          mycol.red = 5535+(i-15)*12000;  }
+      else if (i < 27)
+        { mycol.blue = 0;
+          mycol.green = 60000-(i-21)*12000;
+          mycol.red = 65535-(i-21)*2000;  }
+      else 
+        { mycol.blue = 0;
+          mycol.green = 0;
+          mycol.red = 57535+(i-27)*2000; }
+
+      AllocColor(mycol, i);
+      }
+    break;
+
+  case CMAP_COLRV32 :
+    for(int i=0; i<mNCol; 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; }
+
+      AllocColor(mycol, i);
+      }
+    break;
+
+  default :
+    for(int i=0; i<mNCol; i++)
+      {
+         mycol.green = mycol.red = mycol.blue = 0;
+         AllocColor(mycol, i);
+      }
+    break;
+  }
+}
+
+
Index: trunk/SophyaPI/PI/picmapgen.h
===================================================================
--- trunk/SophyaPI/PI/picmapgen.h	(revision 2)
+++ trunk/SophyaPI/PI/picmapgen.h	(revision 2)
@@ -0,0 +1,58 @@
+#ifndef PICMAPBASE_H_SEEN
+#define PICMAPBASE_H_SEEN
+
+#include "pisysdep.h"
+#include <string>
+#include <string.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_COL16       = 6     // 16 Couleurs Arcenciel
+ };
+ 
+
+ 
+struct PIColor {
+  unsigned short red;
+  unsigned short green;
+  unsigned short blue;
+};
+
+class PIColorMapGen {
+public:
+  PIColorMapGen(CMapId);
+  PIColorMapGen(string const& nom, int nCol);  // CMapId : CMAP_OTHER automatiquement
+  virtual ~PIColorMapGen();
+
+  CMapId Type() const       {return mType;}
+  int NCol() const          {return mNCol;}
+  string const& Nom() const {return mNom;}
+
+  virtual void AllocColor(PIColor const& col, int index)=0;
+  virtual void FreeColors()=0;     // Desalloue les couleurs
+protected:
+  PIColorMapGen(CMapId, int);      // Fait une veritable allocation
+  virtual void MakeColMap();       // Alloue la table de couleurs en appelant AllocColor
+  void CopyFromGen(PIColorMapGen*);
+  virtual void CopyFrom(PIColorMapGen*)=0;
+  
+  static int nCols[6];
+  static char* noms[6];
+  
+  static PIColorMapGen* maps[4];
+
+  int    mNCol;
+  CMapId mType;
+  string mNom;
+  
+};
+
+
+#endif
Index: trunk/SophyaPI/PI/picmapmac.cc
===================================================================
--- trunk/SophyaPI/PI/picmapmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/picmapmac.cc	(revision 2)
@@ -0,0 +1,80 @@
+#include "picmapmac.h"
+#include <UDebugging.h>
+
+PIColorMapMac::PIColorMapMac(CMapId id)
+: PIColorMapGen(id), mPalette(NULL), mCTab(NULL)
+{
+}
+
+PIColorMapMac::PIColorMapMac(CMapId id, int i)       // Fait une veritable allocation
+: PIColorMapGen(id,i)
+{
+    int n = nCols[id-1];
+	mCTab = (CTabHandle) ::NewHandle(sizeof(long) + 
+				sizeof(short) + sizeof(short) + 
+				256L*sizeof(ColorSpec));
+	(**mCTab).ctFlags = 0;
+	(**mCTab).ctSeed = GetCTSeed();
+	(**mCTab).ctSize = n+2;
+    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;
+}
+
+
+PIColorMapMac::PIColorMapMac(string const& nom, int nCol)
+: PIColorMapGen(nom, nCol)
+{
+	mCTab = (CTabHandle) ::NewHandle(sizeof(long) + 
+				sizeof(short) + sizeof(short) + 
+				256L*sizeof(ColorSpec));
+	(**mCTab).ctFlags = 0;
+	(**mCTab).ctSeed = GetCTSeed();
+	(**mCTab).ctSize = nCol+2;
+    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;
+}
+
+void PIColorMapMac::AllocColor(PIColor const& col, int index)
+{
+  ColorSpec& sp = (**mCTab).ctTable[index+2];
+  sp.rgb.red   = col.red;
+  sp.rgb.green = col.green;
+  sp.rgb.blue  = col.blue;
+  sp.value     = index+2;
+}
+
+void PIColorMapMac::MakeColMap()
+{
+  PIColorMapGen::MakeColMap();
+  mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
+}
+
+void PIColorMapMac::FreeColors()
+{
+  Assert_(mPalette);
+  DisposePalette(mPalette);
+  DisposeCTable(mCTab);
+}
+
+void PIColorMapMac::CopyFrom(PIColorMapGen* x)
+{
+  CopyFromGen(x);
+  PIColorMapMac* y = (PIColorMapMac*) x;
+  mPalette = y->mPalette;
+  mCTab = y->mCTab;
+  Assert_(mPalette);
+}
Index: trunk/SophyaPI/PI/picmapmac.h
===================================================================
--- trunk/SophyaPI/PI/picmapmac.h	(revision 2)
+++ trunk/SophyaPI/PI/picmapmac.h	(revision 2)
@@ -0,0 +1,27 @@
+#ifndef PICMAPMAC_H_SEEN
+#define PICMAPMAC_H_SEEN
+
+#include "picmapgen.h"
+#include <Palettes.h>
+
+
+class PIColorMapMac : public PIColorMapGen {
+public:
+  friend class PIColorMapGen;
+  friend class PIPixmapMac;
+  PIColorMapMac(CMapId);
+  PIColorMapMac(string const& nom, int nCol); 
+  virtual void AllocColor(PIColor const& col, int index);
+  virtual void FreeColors();
+  virtual void MakeColMap();
+protected:
+  PIColorMapMac(CMapId id, int i);      // Fait une veritable allocation
+  void CopyFrom(PIColorMapGen*);
+  
+  CTabHandle    mCTab;
+  PaletteHandle mPalette;
+};
+
+typedef PIColorMapMac PIColorMapNative;
+
+#endif
Index: trunk/SophyaPI/PI/picmapx.cc
===================================================================
--- trunk/SophyaPI/PI/picmapx.cc	(revision 2)
+++ trunk/SophyaPI/PI/picmapx.cc	(revision 2)
@@ -0,0 +1,117 @@
+#include <stdio.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#include "piwdgx.h"
+#include "picmapx.h"
+
+/* --Methode-- */
+PIColorMapX::PIColorMapX(CMapId id)
+: PIColorMapGen(id) 
+{
+int n = nCols[id-1];
+mColors = new PIXColor[n];
+for(int i=0; i<n; i++)  mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
+
+// printf("PIColorMapX::PIColorMapX(CMapId) %d %d \n", mNCol, Type());
+return;
+}
+
+/* --Methode-- */
+PIColorMapX::PIColorMapX(CMapId id, int i)       // Fait une veritable allocation
+: PIColorMapGen(id,i)
+{
+
+int n = nCols[id-1];
+mColors = new PIXColor[n];
+for(int i=0; i<n; i++)  mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
+// printf("PIColorMapX::PIColorMapX(CMapId, int) %d %d \n", mNCol, Type());
+
+return;
+}
+
+
+/* --Methode-- */
+PIColorMapX::PIColorMapX(string const& nom, int nCol)
+: PIColorMapGen(nom, nCol)
+{
+
+int n = nCol;
+mColors = new PIXColor[n];
+for(int i=0; i<n; i++)  mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
+// printf("PIColorMapX::PIColorMapX(nom, nCol) %d %d \n", mNCol, Type());
+
+return;
+
+}
+
+/* --Methode-- */
+PIColorMapX::~PIColorMapX()
+{
+delete[] mColors;
+}
+
+static  Colormap  defxcmap;
+static  xinicmap = 0;
+
+/* --Methode-- */
+void PIColorMapX::AllocColor(PIColor const& col, int index)
+{
+XColor myxcol;
+
+if (!xinicmap)  
+  {
+  defxcmap = XDefaultColormap (PIXDisplay(), PIXScreen());
+  xinicmap = 1;
+  }
+
+if ( (index < 0) || (index > mNCol) )  return;
+myxcol.red = col.red; 
+myxcol.blue = col.blue;
+myxcol.green = col.green;
+
+if ( XAllocColor(PIXDisplay(), defxcmap, &myxcol) )
+  {
+  mColors[index] = myxcol.pixel;
+//  printf("PIColorMapX::AllocColor()  RGB= %d %d %d \n",
+//         (int) col.red, (int) col.blue, (int) col.green);
+  }
+else  
+  printf("PIColorMapX::AllocColor() Error: Pb Allocation RGB= %d %d %d \n",
+         (int) col.red, (int) col.blue, (int) col.green);
+return;
+}
+
+/* --Methode-- 
+void PIColorMapX::MakeColMap()
+{
+}
+*/
+
+/* --Methode-- */
+void PIColorMapX::FreeColors()
+{
+if (!xinicmap)  
+  {
+  defxcmap = XDefaultColormap (PIXDisplay(), PIXScreen());
+  xinicmap = 1;
+  }
+
+XFreeColors(PIXDisplay(), defxcmap, mColors,  mNCol, 0);
+
+for (int i=0; i<mNCol; i++)  
+  mColors[i] = BlackPixel(PIXDisplay(), PIXScreen());
+
+printf("PIColorMapX::FreeColors()  Type= %d mNCol= %d \n",
+       Type(), NCol());
+
+}
+
+/* --Methode-- */
+void PIColorMapX::CopyFrom(PIColorMapGen* x)
+{
+  CopyFromGen(x);
+  for (int i=0; i<mNCol; i++)  mColors[i] = ((PIColorMapX *)x)->mColors[i];
+}
Index: trunk/SophyaPI/PI/picmapx.h
===================================================================
--- trunk/SophyaPI/PI/picmapx.h	(revision 2)
+++ trunk/SophyaPI/PI/picmapx.h	(revision 2)
@@ -0,0 +1,32 @@
+#ifndef PICMAPX_H_SEEN
+#define PICMAPX_H_SEEN
+
+#include "picmapgen.h"
+
+typedef   unsigned long PIXColor ;
+
+
+class PIColorMapX : public PIColorMapGen {
+public:
+  friend class PIColorMapGen;
+  friend class PIPixmapX;
+
+  PIColorMapX(CMapId);
+  PIColorMapX(string const& nom, int nCol); 
+
+  inline PIXColor  Color(int index) 
+    { return ((index < mNCol) ? mColors[index] : 0); } ;
+
+  virtual void AllocColor(PIColor const& col, int index);
+  virtual void FreeColors();
+//  virtual void MakeColMap();
+protected:
+  PIColorMapX(CMapId id, int i);      // Fait une veritable allocation
+  void CopyFrom(PIColorMapGen*);
+  
+  PIXColor  * mColors;     // La table des couleurs ... 
+};
+
+typedef PIColorMapX PIColorMapNative;
+
+#endif
Index: trunk/SophyaPI/PI/picontainergen.cc
===================================================================
--- trunk/SophyaPI/PI/picontainergen.cc	(revision 2)
+++ trunk/SophyaPI/PI/picontainergen.cc	(revision 2)
@@ -0,0 +1,39 @@
+#include "picontainergen.h"
+
+/* --Methode-- */
+PIContainerGen::PIContainerGen(PIContainerGen *par, char *nom, 
+                               int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) , stvis(0) 
+{}
+
+
+/* --Methode-- */
+PIContainerGen::~PIContainerGen()
+{}
+
+/* --Methode-- */
+void PIContainerGen::Show()
+{
+stvis = 1;
+return;
+}
+
+/* --Methode-- */
+void PIContainerGen::NewChild(PIWdgGen* /*child*/)
+{
+return;
+}
+
+/* --Methode-- */
+void PIContainerGen::Hide()
+{
+stvis = 0;
+return;
+}
+
+/* --Methode-- */
+int PIContainerGen::Visible()
+{
+return(stvis);
+}
+
Index: trunk/SophyaPI/PI/picontainergen.h
===================================================================
--- trunk/SophyaPI/PI/picontainergen.h	(revision 2)
+++ trunk/SophyaPI/PI/picontainergen.h	(revision 2)
@@ -0,0 +1,30 @@
+#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 void         NewChild(PIWdgGen * child);
+
+  virtual void         Show();
+  virtual void         Hide();
+  virtual int          Visible();
+
+  virtual long         kind() {return ClassId; }
+
+protected:
+  int                  stvis;
+};
+
+#endif
Index: trunk/SophyaPI/PI/picontainermac.cc
===================================================================
--- trunk/SophyaPI/PI/picontainermac.cc	(revision 2)
+++ trunk/SophyaPI/PI/picontainermac.cc	(revision 2)
@@ -0,0 +1,37 @@
+#include "picontainermac.h"
+
+PIContainerMac::PIContainerMac(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIContainerGen(par, nom, sx, sy, px, py)
+{
+  delete mPane;
+  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);
+}
+
+PIContainerMac::~PIContainerMac()
+{}
+
+/* --Methode-- */
+void PIContainerMac::Show()
+{
+  PIContainerGen::Show();
+  mPane->Show();
+  //((LWindow*)mPane)->Select();
+}
+
+/* --Methode-- */
+void PIContainerMac::Hide()
+{
+  PIContainerGen::Hide();
+  mPane->Hide();
+}
+
+
Index: trunk/SophyaPI/PI/picontainermac.h
===================================================================
--- trunk/SophyaPI/PI/picontainermac.h	(revision 2)
+++ trunk/SophyaPI/PI/picontainermac.h	(revision 2)
@@ -0,0 +1,24 @@
+#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();
+  
+  virtual void           Show();
+  virtual void           Hide();
+
+protected:
+  SViewInfo				 mViewInfo;
+
+};
+
+typedef PIContainerMac PIContainer;
+
+#endif
Index: trunk/SophyaPI/PI/picontainerx.cc
===================================================================
--- trunk/SophyaPI/PI/picontainerx.cc	(revision 2)
+++ trunk/SophyaPI/PI/picontainerx.cc	(revision 2)
@@ -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();
+}
+
+/* --Methode-- */
+void PIContainerX::Hide()
+{
+PIContainerGen::Hide();
+Unmanage();
+}
+
Index: trunk/SophyaPI/PI/picontainerx.h
===================================================================
--- trunk/SophyaPI/PI/picontainerx.h	(revision 2)
+++ trunk/SophyaPI/PI/picontainerx.h	(revision 2)
@@ -0,0 +1,27 @@
+#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();
+
+  virtual void           Show();
+  virtual void           Hide();
+
+};
+
+typedef PIContainerX PIContainer;
+
+#endif  /* PICONTAINERX_SEEN */
Index: trunk/SophyaPI/PI/pifilechogen.cc
===================================================================
--- trunk/SophyaPI/PI/pifilechogen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pifilechogen.cc	(revision 2)
@@ -0,0 +1,27 @@
+#include "pifilechogen.h"
+
+
+/************* PIFileChooserGen ************/
+
+PIFileChooserGen::PIFileChooserGen(PIMsgHandler* par, char* nom, long msg)
+: PIWdg(NULL, nom)
+{
+SetMsg(msg);
+SetMsgParent(par);
+}
+
+PIFileChooserGen::~PIFileChooserGen()
+{}
+
+void PIFileChooserGen::Show()
+{
+return;
+}
+
+
+void PIFileChooserGen::AcceptNewFile(bool)
+{
+return;
+}
+
+
Index: trunk/SophyaPI/PI/pifilechogen.h
===================================================================
--- trunk/SophyaPI/PI/pifilechogen.h	(revision 2)
+++ trunk/SophyaPI/PI/pifilechogen.h	(revision 2)
@@ -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, long 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: trunk/SophyaPI/PI/pifilechomac.cc
===================================================================
--- trunk/SophyaPI/PI/pifilechomac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pifilechomac.cc	(revision 2)
@@ -0,0 +1,117 @@
+#include "pifilechomac.h"
+
+string PathNameFromDirID(long dirID, short vRefNum);
+
+
+string PIGetFileName(string dir)
+{
+  StandardFileReply reply;
+  
+  
+  string fName;
+  int i = dir.rfind('/');
+  if (i == 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;
+}
+
+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;
+}
+
+
+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);
+			fullPathName = '/' + ((char*)directoryName + fullPathName);
+	} while (block.ioDrDirID != 2);
+	return fullPathName;
+}
+
+
+PIFileChooserMac::PIFileChooserMac(PIMsgHandler* par, char* nom, long 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(), NULL);
+  else
+    Send(Msg(), (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: trunk/SophyaPI/PI/pifilechomac.h
===================================================================
--- trunk/SophyaPI/PI/pifilechomac.h	(revision 2)
+++ trunk/SophyaPI/PI/pifilechomac.h	(revision 2)
@@ -0,0 +1,31 @@
+#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, long 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 ;
+
+#endif
+
Index: trunk/SophyaPI/PI/pifilechox.cc
===================================================================
--- trunk/SophyaPI/PI/pifilechox.cc	(revision 2)
+++ trunk/SophyaPI/PI/pifilechox.cc	(revision 2)
@@ -0,0 +1,161 @@
+#include<stdio.h>
+#include<string.h>
+
+#include "pisysdep.h"
+
+#include "pifilechox.h"
+
+
+/************* PIFileChooserX ************/
+#include <X11/Shell.h>
+#include <Xm/FileSB.h>
+
+// Fonction prive (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, XtPointer *calld)
+{
+PIFileChooserX *pif;
+pif = (PIFileChooserX *) usd ;
+pif->mSt = 1;
+pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str()));
+pif->MWin()->Unmanage();
+return;
+}
+
+/* Nouvelle-Fonction */
+void  filesel_cancelact(Widget w, XtPointer *usd, XtPointer *calld)
+{
+PIFileChooserX *pif;
+pif = (PIFileChooserX *) usd ;
+pif->mSt = 0;
+pif->Send(pif->Msg(), NULL);
+pif->MWin()->Unmanage();
+return;
+}
+
+#define PIFC_SzX  350
+#define PIFC_SzY  300
+
+/* --Methode-- */
+PIFileChooserX::PIFileChooserX(PIMsgHandler* par, char* nom, long 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;
+
+CreateXtWdg(nom, xmFileSelectionBoxWidgetClass, mWin->XtWdg(), PIFC_SzX, PIFC_SzY, 0, 0);
+XtAddCallback(XtWdg(), XmNokCallback, 
+              filesel_okact, (XtPointer)this);
+XtAddCallback(XtWdg(), XmNcancelCallback, 
+              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()
+{
+}
+
+/* --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)
+  {
+  char *buff;
+  XmString xmstr;
+  Arg warg[2];
+
+  XtSetArg(warg[0], XmNtextString, &xmstr);
+  XtGetValues(XtWdg(), warg, 1);
+  XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff); 
+  string s(buff);
+  XmStringFree(xmstr);
+  return(s);
+  }
+else
+  {
+  string s("");
+  return(s);
+  }
+}
+
+/* --Methode-- */
+string PIFileChooserX::GetPath()
+{
+printf("PIFileChooserX::GetPath() not implemented ! \n");
+string s("");
+return(s);
+}
+
Index: trunk/SophyaPI/PI/pifilechox.h
===================================================================
--- trunk/SophyaPI/PI/pifilechox.h	(revision 2)
+++ trunk/SophyaPI/PI/pifilechox.h	(revision 2)
@@ -0,0 +1,37 @@
+#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, long 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; }
+
+  int mSt;
+
+protected:
+  PIWdg * mWin;
+  SysDWdg  fnw, fnl;
+};
+
+typedef PIFileChooserX     PIFileChooser ;
+
+#endif
+
Index: trunk/SophyaPI/PI/pigfname.h
===================================================================
--- trunk/SophyaPI/PI/pigfname.h	(revision 2)
+++ trunk/SophyaPI/PI/pigfname.h	(revision 2)
@@ -0,0 +1,11 @@
+#ifndef PIGFNAME_H_SEEN
+#define PIGFNAME_H_SEEN
+
+#include <string>
+
+string PIGetFileName(string = "");
+string PIGetExistingFileName(string = "");
+
+
+#endif
+
Index: trunk/SophyaPI/PI/piimage.cc
===================================================================
--- trunk/SophyaPI/PI/piimage.cc	(revision 2)
+++ trunk/SophyaPI/PI/piimage.cc	(revision 2)
@@ -0,0 +1,373 @@
+// 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.h>
+
+#include "piimage.h"
+
+#include "imageop.h"
+
+
+/* --Methode-- */
+PIImage::PIImage(PIContainerGen *par, char *nom, RzImage *pim,
+   int sx, int sy, int px, int py) :
+  PIPixmap(par, nom, sx, sy, px, py)
+{
+
+img = NULL;
+zow = NULL; 
+txw = NULL;
+zpixm = pixm = NULL;
+xszpxm = xspxm = 0;
+yszpxm = yspxm = 0;
+lut = NULL; 
+offx = offy = 0;
+xpav = ypav = 0;
+zoom = 1;
+
+SetColMap(CMAP_COLRJ32);
+SetImage(pim);
+
+ActivateButton(1);
+ActivateButton(2);
+//ActivateMove(1);
+
+}
+
+/* --Methode-- */
+PIImage::~PIImage()
+{
+if (pixm) delete pixm;
+if (zpixm) delete zpixm;
+if (lut) delete lut;
+}
+
+/* --Methode-- */
+void PIImage::SetImage(RzImage *pim)
+{
+int xwsz, ywsz;
+
+img = pim;
+if (img)
+  {
+  SetSize(img->XSize(), img->YSize());
+  xwsz = XSize();  ywsz = YSize();
+  if (xwsz > img->XSize()) xwsz = img->XSize();
+  if (ywsz > img->YSize()) ywsz = img->YSize();
+  xpav = xwsz/2; 
+  ypav = ywsz/2;
+  if (img->minPix>img->maxPix) img->CheckDyn();
+  SetLut(img->minPix, img->maxPix, kLutType_Lin, 2);
+  }
+//printf("Debug_SetImage: %ld %ld \n", (long)img, (long)lut);
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetZoomWin(PIPixmap * zw) 
+{
+zow = zw;
+if (zow)  zow->SetColMap(GetColMapId());
+}
+
+
+
+/* --Methode-- */
+void PIImage::SetLut(float min, float max, int typlut, int lauto)
+{
+if (lut) delete(lut);
+if (lauto)
+  {
+  float fracnul, fracsat;
+  float fnd, sigfnd;
+
+  int npix = img->XSize()*img->YSize();
+  int vitesse=npix/20000;
+  vitesse = (vitesse < 1) ? 1 : ((vitesse > 10) ? 10 : vitesse );
+  int nbsig = lauto;  
+  float fracmax = 0.95;
+  float minpix = min;  
+  float maxpix = max;  
+
+  RzFondSig2Ciel(img, vitesse, fracmax, nbsig, 500, &minpix, &maxpix, 
+                 &fnd, &sigfnd, &min, &max, &fracnul, &fracsat);
+  }
+
+lut = new LUT(min, max, NbCol(), typlut);
+
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetLut(LUT *clut)
+{
+LUT * olut = lut;
+lut = new LUT(clut->Min(), clut->Max(), NbCol(), clut->Type());
+if (olut) delete olut;
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::SetZoom(int zm)
+{
+if ((zm == 0) || (zm == -1) )  zoom = 1;
+else if (zm > 10)  zoom = 10;
+else if (zm < -10) zoom = -10;
+else zoom = zm;
+return;
+}
+/* --Methode-- */
+void PIImage::SelectColor(CMapId cmap)
+{
+SetColMap(cmap);
+if (zow)  zow->SetColMap(cmap);
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::Apply()
+{
+ComputePixmap();
+Refresh();
+if (zow == NULL)  return;
+ComputeZoomPixmap();
+zow->Refresh();
+return;
+}
+
+/* --Methode-- */
+void PIImage::Resize()
+{
+printf("PIImage::Resize\n");
+ComputePixmap();
+return;
+}
+
+/* --Methode-- */
+void PIImage::But1Press(int x, int y)
+{
+int xp, yp;
+
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+xpav = xp;  ypav = yp; 
+if (zow)
+  {
+  ComputeZoomPixmap();
+  zow->Refresh();
+  }
+if (txw)
+  {
+  char buff[256];
+  sprintf(buff,"Image %s : X= %d , Y= %d  PixVal= %g ", 
+          img->name, xpav, ypav, img->FValue(xpav, ypav));
+  txw->SetLabel(buff);
+  }
+return;
+}
+
+
+/* --Methode-- */
+void PIImage::But2Press(int x, int y)
+{
+int xp, yp;
+int xwsz, ywsz;
+
+if (img == NULL)  return;
+if ( PosW2Img(x, y, &xp, &yp) )  return;
+xpav = xp;  ypav = yp; 
+
+xwsz = XSize();
+ywsz = YSize();
+if (zoom > 0)
+  {
+  offx = xpav-(xwsz/2/zoom);
+  offy = ypav-(ywsz/2/zoom);
+  }
+else 
+  {
+  offx = xpav+(xwsz*zoom/2);
+  offy = ypav+(ywsz*zoom/2);
+  }
+if (offx < 0)  offx = 0;
+if (offy < 0)  offy = 0;
+if (offx >= img->XSize())  offx = img->XSize();
+if (offy >= img->YSize())  offy = img->YSize();
+
+ComputePixmap();
+Refresh();
+if (zow)
+  {
+  ComputeZoomPixmap();
+  zow->Refresh();
+  }
+return;
+}
+
+/* --Methode-- */
+unsigned char *  PIImage::ComputePixmap(int ofx, int ofy, int zm, 
+                           int xwsz, int ywsz, unsigned char * opix, 
+                           int * oxsp, int * oysp)
+{
+unsigned char *pix, *pp, ucp;
+int zmm;
+int npx, npy, nppx, nppy, nszp, oszp;
+int i,j,k,l;
+float vpx;
+
+
+if ( (img == NULL) || (lut == NULL) ) 
+  { printf("PIImage::ComputePixmap:Pb img ou lut %ld %ld \n", 
+            (long)img, (long)lut);
+  *oxsp = *oysp = 0; return(NULL); }
+
+npx = img->XSize()-ofx;
+npy = img->YSize()-ofy;
+
+if ((zm == 0) || (zm == -1))  zm = 1;
+
+if (zm >= 1)
+  {
+  if ((npx*zm) > xwsz)  npx = xwsz/zm; 
+  if ((npy*zm) > ywsz)  npy = ywsz/zm;
+  nppx = npx*zm;   nppy = npy*zm;
+  }
+if (zm < -1)
+  {
+  zmm = -zm;
+  if ((npx/zmm) > xwsz)  npx = xwsz*zmm; 
+  if ((npy/zmm) > ywsz)  npy = ywsz*zmm; 
+  nppx = npx/zmm;   nppy = npy/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 (zm == 1)    // Pas de zoom  
+  {
+  for(j=ofy; j<ofy+npy; j++)
+    for(i=ofx; i<ofx+npx; i++) 
+      { *pp = (unsigned char) lut->Apply(img->FValue(i,j));  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 += img->FValue(i+k, j+l);
+      *pp = (unsigned char) lut->Apply(vpx/fv); 
+      pp++;
+      }
+  }
+else      // Agrandissement
+  {
+  for(j=ofy; j<ofy+npy; j++)
+    for(i=ofx; i<ofx+npx; i++)
+      {
+      ucp = (unsigned char) lut->Apply(img->FValue(i,j));
+      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);
+}
+
+/* --Methode-- */
+void PIImage::ComputePixmap()
+{
+unsigned int xwsz, ywsz;
+
+if (img == NULL)  return;
+xwsz = this->XSize();
+ywsz = this->YSize();
+
+pixm = ComputePixmap(offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm);
+SetPixmap(pixm, xspxm, yspxm); 
+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);
+  }
+
+zpixm = ComputePixmap(ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);
+zow->SetPixmap(zpixm, xszpxm, yszpxm); 
+zow->SetUserData((void *)this, 0);
+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);
+}
+
+
+
Index: trunk/SophyaPI/PI/piimage.h
===================================================================
--- trunk/SophyaPI/PI/piimage.h	(revision 2)
+++ trunk/SophyaPI/PI/piimage.h	(revision 2)
@@ -0,0 +1,75 @@
+// 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 "cimage.h"
+#include "lut.h"
+
+#include "pisysdep.h"
+
+#include PIPIXMAP_H
+#include PISTDWDG_H
+
+class PIImage : public PIPixmap
+{
+
+private:
+  RzImage * img;
+
+  unsigned char * pixm;
+  int xspxm, yspxm;
+
+  LUT * lut;
+  int offx, offy;
+
+  int zoom;
+  PIPixmap * zow;
+  unsigned char * zpixm;
+  int xszpxm, yszpxm;
+
+  PILabel * txw;
+  int xpav, ypav;
+
+public:
+//  Les methodes 
+
+  PIImage(PIContainerGen *par, char *nom=NULL, RzImage *pim=NULL,
+           int sx=0, int sy=0, int px=0, int py=0);
+  ~PIImage();
+
+  void SetImage(RzImage *pim);
+  void SetZoomWin(PIPixmap * zw);
+  inline void SetTextWin(PILabel * tw) { txw = tw; };
+
+  void SetLut(float min, float max, 
+             int typlut=kLutType_Lin, int lauto=0);
+  void SetLut(LUT *clut);
+  void SetZoom(int zm);
+  void SelectColor(CMapId cmap);
+
+  void Apply();
+  void Resize();
+
+//  void Ptr1Move(int x, int y);
+  void But1Press(int x, int y);
+  void But1Release(int x, int y);
+  void But2Press(int x, int y);
+
+  inline int GetXPave() { return(xpav); } ;
+  inline int GetYPave() { return(ypav); } ;
+
+private:
+      
+  unsigned char *  ComputePixmap(int ofx, int ofy, int zm, 
+                       int xwsz, int ywsz, unsigned char * opix, 
+                       int * oxszp, int * oyszp);
+  void ComputePixmap();
+  void ComputeZoomPixmap();
+
+  int PosW2Img(int xiw, int yiw, int * xp, int * yp);
+};
+
+#endif
Index: trunk/SophyaPI/PI/pimenubargen.cc
===================================================================
--- trunk/SophyaPI/PI/pimenubargen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenubargen.cc	(revision 2)
@@ -0,0 +1,14 @@
+#include "pimenubargen.h"
+
+#include PIAPP_H
+
+PIMenubarGen::PIMenubarGen(PIApplicationGen* par, char* nom)
+: PIWdg(NULL, nom)
+{
+SetMsgParent(par);
+}
+
+PIMenubarGen::~PIMenubarGen()
+{}
+
+
Index: trunk/SophyaPI/PI/pimenubargen.h
===================================================================
--- trunk/SophyaPI/PI/pimenubargen.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenubargen.h	(revision 2)
@@ -0,0 +1,21 @@
+#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 long      kind() {return ClassId; }
+};
+
+#endif
Index: trunk/SophyaPI/PI/pimenubarmac.cc
===================================================================
--- trunk/SophyaPI/PI/pimenubarmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenubarmac.cc	(revision 2)
@@ -0,0 +1,15 @@
+#include "pimenubarmac.h"
+#include <LMenuBar.h>
+
+PIMenubarMac::PIMenubarMac(PIApplicationGen* par, char* nom)
+:PIMenubarGen(par, nom)
+{}
+
+PIMenubarMac::~PIMenubarMac()
+{}
+
+void
+PIMenubarMac::AppendMenu(PIPDMenu *pdm)
+{
+  LMenuBar::GetCurrentMenuBar()->InstallMenu(pdm->macMenu, 0);
+}
Index: trunk/SophyaPI/PI/pimenubarmac.h
===================================================================
--- trunk/SophyaPI/PI/pimenubarmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenubarmac.h	(revision 2)
@@ -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: trunk/SophyaPI/PI/pimenubarx.cc
===================================================================
--- trunk/SophyaPI/PI/pimenubarx.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenubarx.cc	(revision 2)
@@ -0,0 +1,67 @@
+#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(true, true, true, false);
+
+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;
+}
+
Index: trunk/SophyaPI/PI/pimenubarx.h
===================================================================
--- trunk/SophyaPI/PI/pimenubarx.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenubarx.h	(revision 2)
@@ -0,0 +1,28 @@
+#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);
+
+ protected:
+
+int mNItem, mNItemMax;
+_pimbxit_ *mMbb;
+};
+
+
+typedef PIMenubarX     PIMenubar;
+
+
+#endif
Index: trunk/SophyaPI/PI/pimenugen.cc
===================================================================
--- trunk/SophyaPI/PI/pimenugen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenugen.cc	(revision 2)
@@ -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: trunk/SophyaPI/PI/pimenugen.h
===================================================================
--- trunk/SophyaPI/PI/pimenugen.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenugen.h	(revision 2)
@@ -0,0 +1,36 @@
+#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, long msg)=0;
+
+  virtual void    DeleteItem(char *nom)=0;
+  virtual void    DeleteItemMsg(long msg)=0;
+  virtual void    DeleteItemNum(int n)=0;
+
+  virtual void    CheckItem(char *nom, bool st=false)=0; 
+  virtual void    CheckItemMsg(long msg, bool st=false)=0; 
+  virtual void    CheckItemNum(int n, bool st=false)=0; 
+
+  virtual void    Show()=0;
+  virtual void    Hide()=0;
+
+  virtual long    kind() {return ClassId; }
+
+protected:
+  PIMenuType mMTyp;
+}; 
+
+
+#endif
Index: trunk/SophyaPI/PI/pimenumac.cc
===================================================================
--- trunk/SophyaPI/PI/pimenumac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenumac.cc	(revision 2)
@@ -0,0 +1,182 @@
+#include <LString.h>
+#include "pimenumac.h"
+#include <algo.h>
+
+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(long msg)
+{
+  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, long msg)
+{
+  LStr255 titre(nom);
+  
+  macMenu->InsertCommand(titre, -2000, 1000); // ou cmd_UseMenuItem ???
+  mMsgs.push_back(msg);
+}
+
+void
+PIMenuMac::CheckItemNum(int n, bool st)
+{
+  ::CheckItem(macMenu->GetMacMenuH(), n, st);
+}
+
+void
+PIMenuMac::CheckItemMsg(long 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)
+{
+  macMenu->RemoveItem(n+1);
+  mMsgs.erase(mMsgs.begin()+n);
+}
+
+void
+PIMenuMac::DeleteItemMsg(long 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)
+{
+  Send(mMsgs[item], (void*) GetMenuItemText(item).c_str());
+}
+
+
+void
+PIMenuMac::Show()
+{}
+
+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)
+{
+  MenuHandle h = GetMacMenuHandle();
+  Str255 txt;
+  ::GetMenuItemText(h, item+1, txt);
+  p2cstr(txt);
+  return (char*) txt;
+}
+
+
+/* --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);
+}
+
+/* --Methode-- */
+PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom)
+: PIMenuMac(par, nom, k_PulldownMenu)
+{
+}
+
+/* --Methode-- */
+PIPDMenuMac::~PIPDMenuMac()
+{
+}
+
Index: trunk/SophyaPI/PI/pimenumac.h
===================================================================
--- trunk/SophyaPI/PI/pimenumac.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenumac.h	(revision 2)
@@ -0,0 +1,72 @@
+#ifndef PIMENUMAC_H_SEEN
+#define PIMENUMAC_H_SEEN
+
+#include "pimenugen.h"
+#include <LMenu.h>
+#include <vector.h>
+#include <list.h>
+
+// Menu general
+class PIMenuMac : public PIMenuGen {
+public:
+					PIMenuMac(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+				   ~PIMenuMac();
+				   
+	virtual void	AppendItem(char* nom, long msg);
+
+    virtual void    DeleteItem(char *nom);
+    virtual void    DeleteItemMsg(long msg);
+    virtual void    DeleteItemNum(int n);
+
+    virtual void    CheckItem(char *nom, bool st=false); 
+    virtual void    CheckItemMsg(long msg, bool st=false); 
+    virtual void    CheckItemNum(int n, bool st=false); 
+	
+    virtual void    Show();
+    virtual void    Hide();
+    
+    int             MenuId() {return mMenuId;}
+    void            ItemSelected(int item);
+    
+	static PIMenuMac* findMenu(int id);
+	MenuHandle      GetMacMenuHandle();
+	ResIDT          GetMacMenuID();
+	string          GetMenuItemText(int item);
+	
+protected:
+	LMenu*          macMenu;
+	int             mMenuId;
+	vector<long>    mMsgs;
+	static int      lastId;
+	static list<PIMenuMac*> sMenus;
+	
+	friend class    PIMenubarMac;
+	
+	int             FindItemByMsg(long msg);
+	int             FindItemByName(string const& nom);
+   
+};
+
+// Menu popup
+class PIPUMenuMac : public PIMenuMac
+{
+public:
+               PIPUMenuMac(PIMsgHandler* par, char* nom);
+               ~PIPUMenuMac();
+virtual void   Show();
+};
+
+// 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: trunk/SophyaPI/PI/pimenux.cc
===================================================================
--- trunk/SophyaPI/PI/pimenux.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimenux.cc	(revision 2)
@@ -0,0 +1,307 @@
+#include<stdio.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 ************/
+
+
+// Fonction prive (CallBack)
+static void menub_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+/* Nouvelle-Fonction */
+void  menub_action(Widget w, XtPointer *usd, XtPointer *calld)
+{
+PIMenuX *pim;
+_pimxit_ *cusd;
+
+cusd = ( _pimxit_ *)usd ;
+pim = (PIMenuX *) (cusd->pmen);
+
+// pim->Unmanage();
+pim->Send(cusd->msg, pim->ItemName(cusd->itb).c_str());
+#ifdef DEBUG_PIMenuX
+printf("%%%Debug_menub_action: Msg= %d  \n", (int)cusd->msg);
+#endif
+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];
+
+if (pdpu == k_PopupMenu)
+  XtWdg() = XmCreatePopupMenu( PIXtTopWdg(), nom, NULL, 0); 
+else 
+  XtWdg() = XmCreatePulldownMenu( PIXtTopWdg(), 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::Show()
+{
+Manage();
+}
+
+/* --Methode-- */
+void PIMenuX::Hide()
+{
+Unmanage();
+}
+
+
+
+/* --Methode-- */
+void PIMenuX::AppendItem(char* nom, long msg)
+{
+AddItem(nom, msg, false);
+}
+
+/* --Methode-- */
+void PIMenuX::DeleteItem(char *nom)
+{
+string s(nom);
+
+for(int i=0; i<mNItem; i++)
+  if (ItemName(mBut[i].itb) == s)  
+    { DeleteItemNum(i);  break; }
+
+return;
+}
+
+/* --Methode-- */
+void PIMenuX::DeleteItemMsg(long msg)
+{
+for(int i=0; i<mNItem; i++)
+  if (mBut[i].msg == msg)  
+    { DeleteItemNum(i);  break; }
+
+return;
+}
+
+
+/* --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;
+  if (mBut[i+1].togg)  cbckn = XmNvalueChangedCallback;
+  else cbckn = XmNactivateCallback;
+  XtRemoveCallback(mBut[i+1].itb, cbckn, 
+                   menub_action, (XtPointer)(mBut+i+1));
+  mBut[i] = mBut[i+1];
+  XtAddCallback(mBut[i].itb, cbckn, 
+                menub_action, (XtPointer)(mBut+i));
+  }
+mNItem--;
+}
+
+
+/* --Methode-- */
+void PIMenuX::CheckItem(char *nom, bool st)
+{
+string s(nom);
+
+for(int i=0; i<mNItem; i++)
+  if (ItemName(mBut[i].itb) == s)  
+    { CheckItemNum(i, st);  break; }
+
+return;
+}
+
+/* --Methode-- */
+void PIMenuX::CheckItemMsg(long msg, bool st)
+{
+for(int i=0; i<mNItem; i++)
+  if (mBut[i].msg == msg)  
+    { CheckItemNum(i, st);  break; }
+
+return;
+}
+
+/* --Methode-- */
+void PIMenuX::CheckItemNum(int n, bool st)
+{
+printf("PIMenuX::CheckItemNum(%d,bool) Error/ Not yet implemented \n", n);
+return;
+}
+
+
+/* --Methode-- */
+void PIMenuX::AddItem(char* nom, long msg, bool tog)
+{
+_pimxit_ *buto;
+SysDWdgClass wdgcl;
+String cbckn;
+
+
+if (mNItem >= mNItemMax)
+  {
+  buto = mBut;
+  mNItemMax += NBITEMB;
+  mBut = new _pimxit_[mNItemMax];
+  for(int i=0; i<mNItem; i++)   
+    {
+    if (buto[i].togg)  cbckn = XmNvalueChangedCallback;
+    else cbckn = XmNactivateCallback;
+    XtRemoveCallback(buto[i].itb, cbckn, 
+                     menub_action, (XtPointer)(buto+i));
+    mBut[i] = buto[i];
+    XtAddCallback(mBut[i].itb, cbckn, 
+                  menub_action, (XtPointer)(mBut+i));
+    }
+
+  delete[] buto;
+  }
+
+if (tog)
+  {
+  cbckn = XmNvalueChangedCallback;
+  wdgcl = xmToggleButtonWidgetClass;
+  }
+else 
+  {
+  cbckn = XmNactivateCallback;
+  wdgcl = xmPushButtonWidgetClass;
+  }
+
+mBut[mNItem].itb = XtCreateManagedWidget(nom, wdgcl, this->XtWdg(), NULL, 0) ; 
+XtAddCallback(mBut[mNItem].itb, cbckn, 
+              menub_action, (XtPointer)(mBut+mNItem));
+#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].togg = tog;
+mNItem++;
+return;
+}
+
+
+/* --Methode-- */
+string PIMenuX::ItemName(SysDWdg itb)
+{
+string s;
+char *buff;
+XmString xmstr;
+Arg warg[2];
+
+
+XtSetArg(warg[0], XmNlabelString, &xmstr);
+XtGetValues(itb, warg, 1);
+if (xmstr)
+  {
+  XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &buff);
+  s=buff;
+  XmStringFree(xmstr);
+  }
+else s = "";
+
+return(s);
+}
+
+/* --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].togg, 
+         (long) mBut[i].msg, (long) mBut[i].itb, 
+         (long) mBut[i].pmen, long (mBut+i));
+return;
+}
+
+/* --Methode-- A virer 
+void PIMenuX::AppendCheckItem(char* nom, long msg)
+{
+AddItem(nom, msg, true);
+}
+*/
+
+/* --Methode--   A virer 
+void PIMenuX::SetItem(int n, bool st) 
+{
+if ((n < 0) || (n >= mNItem))  return;
+if (mBut[n].togg)  // C'est un toggle Bouton !
+  {
+  Arg  wargs[2];
+  int n=0;
+  if (st)  XtSetArg(wargs[n],XmNset,TRUE);  
+  else XtSetArg(wargs[n],XmNset,FALSE);  
+  n++;
+  XtSetValues(mBut[n].itb, wargs, n);  
+  }
+return;
+}
+*/
+
+
+/* --Methode-- */
+PIPUMenuX::PIPUMenuX(PIMsgHandler* par, char* nom)
+: PIMenuX(par, nom, k_PopupMenu)
+{
+}
+
+/* --Methode-- */
+PIPUMenuX::~PIPUMenuX()
+{
+}
+
+void PIPUMenuX::Show()
+{
+XButtonEvent evt;
+
+evt.type = ButtonPress;
+evt.serial = 55998877;
+evt.send_event = False;
+evt.display = PIXDisplay();
+evt.window = XtWindow(PIXtTopWdg());
+evt.root = DefaultRootWindow(evt.display);
+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-- */
+PIPDMenuX::PIPDMenuX(PIMsgHandler* par, char* nom)
+: PIMenuX(par, nom, k_PulldownMenu)
+{
+}
+
+/* --Methode-- */
+PIPDMenuX::~PIPDMenuX()
+{
+}
+
Index: trunk/SophyaPI/PI/pimenux.h
===================================================================
--- trunk/SophyaPI/PI/pimenux.h	(revision 2)
+++ trunk/SophyaPI/PI/pimenux.h	(revision 2)
@@ -0,0 +1,76 @@
+#ifndef PIMENUX_H_SEEN
+#define PIMENUX_H_SEEN
+
+#include "pimenugen.h"
+
+
+class PIMenuX ;
+
+struct _pimxit_ 
+{
+SysDWdg itb;
+PIMenuX *pmen;
+long msg;
+bool togg;
+};
+
+
+
+class PIMenuX : public PIMenuGen {
+public:
+	          PIMenuX(PIMsgHandler* par, char* nom, PIMenuType pdpu);
+	          ~PIMenuX();
+				   
+  virtual void	  AppendItem(char* nom, long msg);
+
+  virtual void    DeleteItem(char *nom);
+  virtual void    DeleteItemMsg(long msg);
+  virtual void    DeleteItemNum(int n);
+
+  virtual void    CheckItem(char *nom, bool st=false); 
+  virtual void    CheckItemMsg(long msg, bool st=false); 
+  virtual void    CheckItemNum(int n, bool st=false); 
+
+  virtual void    Show();
+  virtual void    Hide();
+
+  string          ItemName(SysDWdg itb);
+
+protected:
+        void      AddItem(char* nom, long msg, bool tog);
+        void      Check();
+
+int mNItem, mNItemMax;
+_pimxit_  * mBut;
+
+};
+
+class PIPUMenuX : public PIMenuX
+{
+public:
+               PIPUMenuX(PIMsgHandler* par, char* nom);
+               ~PIPUMenuX();
+
+virtual void   Show();
+
+protected:
+     
+};
+
+class PIPDMenuX : public PIMenuX
+{
+public:
+               PIPDMenuX(PIMsgHandler* par, char* nom);
+               ~PIPDMenuX();
+
+protected:
+     
+};
+
+typedef PIMenuX        PIMenu;
+typedef PIPUMenuX      PIPUMenu;
+typedef PIPDMenuX      PIPDMenu;
+
+
+
+#endif
Index: trunk/SophyaPI/PI/pimsghandler.cc
===================================================================
--- trunk/SophyaPI/PI/pimsghandler.cc	(revision 2)
+++ trunk/SophyaPI/PI/pimsghandler.cc	(revision 2)
@@ -0,0 +1,28 @@
+
+#include "pimsghandler.h"
+
+PIMsgHandler::PIMsgHandler(PIMsgHandler* par)
+: msgParent(par)
+{}
+
+PIMsgHandler::~PIMsgHandler()
+{}
+
+void
+PIMsgHandler::Process(long msg, PIMsgHandler* sender, void* data)
+{
+	ReSend(msg, sender, data);
+}
+
+void
+PIMsgHandler::Send(long msg, void* data)
+{
+	Process(msg, this, data);
+}
+
+void
+PIMsgHandler::ReSend(long msg, PIMsgHandler* sender, void* data)
+{
+  if (msgParent)
+    msgParent->Process(msg, sender, data);
+}
Index: trunk/SophyaPI/PI/pimsghandler.h
===================================================================
--- trunk/SophyaPI/PI/pimsghandler.h	(revision 2)
+++ trunk/SophyaPI/PI/pimsghandler.h	(revision 2)
@@ -0,0 +1,42 @@
+/* Classe de gestion de messages */
+
+#include <stdlib.h>
+
+#ifndef PIMSGHANDLER_H_SEEN
+#define PIMSGHANDLER_H_SEEN
+
+enum {
+ // Les flags
+ 
+ 	PIMsg_FgBtn    = 0x00010000,
+ 	PIMsg_FgText   = 0x00020000,
+ 	PIMsg_FgScale  = 0x00040000,
+ 	PIMsg_FgMenu   = 0x00080000,
+ 
+ // Les messages
+	PIMsg_OK          = 1,
+	PIMsg_Cancel      = 2,
+	PIMsg_Help        = 3,
+	PIMsg_DataChanged = 4,
+	PIMsg_Click       = 5
+};
+
+class PIMsgHandler {
+public:
+					PIMsgHandler(PIMsgHandler* par=NULL);
+	virtual 	   ~PIMsgHandler();
+	
+	virtual void	SetMsgParent(PIMsgHandler* par) {msgParent = par;}
+
+	virtual void    Send(long msg, void* data=NULL);
+	
+	
+protected:
+	virtual void	ReSend(long msg, PIMsgHandler* sender, void* data=NULL);
+	virtual void	Process(long msg, PIMsgHandler* sender, void* data=NULL);
+
+private:
+	PIMsgHandler*     msgParent;
+};
+
+#endif
Index: trunk/SophyaPI/PI/pimsgmac.h
===================================================================
--- trunk/SophyaPI/PI/pimsgmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pimsgmac.h	(revision 2)
@@ -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: trunk/SophyaPI/PI/pioptmenugen.cc
===================================================================
--- trunk/SophyaPI/PI/pioptmenugen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenugen.cc	(revision 2)
@@ -0,0 +1,13 @@
+#include "pioptmenugen.h"
+
+
+PIOptMenuGen::PIOptMenuGen(PIContainerGen* par, PIPDMenu *pdm, 
+                         int sx, int sy, int px, int py)
+: PIWdg(par, (char*) pdm->Nom().c_str(), sx, sy, px, py) // Attention au const !
+{
+}
+
+PIOptMenuGen::~PIOptMenuGen()
+{}
+
+
Index: trunk/SophyaPI/PI/pioptmenugen.h
===================================================================
--- trunk/SophyaPI/PI/pioptmenugen.h	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenugen.h	(revision 2)
@@ -0,0 +1,26 @@
+#ifndef PIOPTMENGEN_H_SEEN
+#define PIOPTMENGEN_H_SEEN
+
+#include <string>
+#include "pisysdep.h"
+#include PIWDG_H
+#include PIMENU_H
+
+class PIOptMenuGen : public PIWdg {
+public:
+  enum {ClassId = 1100};
+
+	             PIOptMenuGen(PIContainerGen* par, PIPDMenu *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 long       GetValue() = 0;       // Message correspondant a l'option choisie
+
+protected:
+
+};
+
+#endif
Index: trunk/SophyaPI/PI/pioptmenumac.cc
===================================================================
--- trunk/SophyaPI/PI/pioptmenumac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenumac.cc	(revision 2)
@@ -0,0 +1,53 @@
+#include "pioptmenumac.h"
+
+/* --Methode-- */
+PIOptMenuMac::PIOptMenuMac(PIContainerGen* par, PIPDMenu *pdm,
+                     int sx, int sy, int px, int py)
+: PIOptMenuGen(par, pdm, sx, sy, px, py), mPDMenu(pdm)
+{
+  delete mPane;
+  LStr255 titre(Nom().c_str());
+  
+  StTextState textState;
+  ::TextFont(systemFont);
+  ::TextSize(12);
+  ::TextFace(0);
+  int titleWidth = ::StringWidth(titre);
+  
+  mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 0, 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();
+  
+  ((LStdPopupMenu*)mPane)->AddListener(this);
+}
+
+/* --Methode-- */
+PIOptMenuMac::~PIOptMenuMac()
+{
+}
+
+/* --Methode-- */
+void PIOptMenuMac::Process(long msg, PIMsgHandler* sender, void* data)
+{
+Select((char *)data, msg);
+ReSend(msg, sender, data);
+}
+
+void
+PIOptMenuMac::ListenToMessage(MessageT inMessage, void *)
+{
+//  if (inMessage == msg_Click)
+    mPDMenu->ItemSelected(((LStdPopupMenu*)mPane)->GetValue()-1);
+}
+
+void
+PIOptMenuMac::Select(char *txt, long msg)
+{ // Ca doit faire quoi ????
+mStext = txt;  mSmsg = msg;
+}
Index: trunk/SophyaPI/PI/pioptmenumac.h
===================================================================
--- trunk/SophyaPI/PI/pioptmenumac.h	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenumac.h	(revision 2)
@@ -0,0 +1,31 @@
+#ifndef PIOPTMENMAC_H_SEEN
+#define PIOPTMENMAC_H_SEEN
+
+#include "pioptmenugen.h"
+
+class PIOptMenuMac : public PIOptMenuGen {
+public:
+	                PIOptMenuMac(PIContainerGen* par, PIPDMenu *pdm,  
+                               int sx=10, int sy=10, int px=0, int py=0);
+	               ~PIOptMenuMac();
+
+  virtual void      Process(long msg, PIMsgHandler* sender, void* data=NULL);
+				   
+  virtual void	    ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual string    GetValueStr() { return(mStext); }
+  virtual long      GetValue()    { return(mSmsg); } 
+  
+  inline void       Select(char *txt, long msg); // public ou protege ???
+
+
+protected:
+  string    mStext;
+  long      mSmsg;
+  //MenuHandle macMenu;
+  PIPDMenu* mPDMenu;
+};
+
+
+typedef PIOptMenuMac  PIOptMenu ;
+
+#endif
Index: trunk/SophyaPI/PI/pioptmenux.cc
===================================================================
--- trunk/SophyaPI/PI/pioptmenux.cc	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenux.cc	(revision 2)
@@ -0,0 +1,56 @@
+#include<stdio.h>
+
+#include "pisysdep.h"
+#include "pioptmenux.h"
+#include PICONT_H
+
+#include <Xm/Xm.h>
+#include <Xm/RowColumn.h>
+
+/************* PIOptionMenuX ************/
+
+
+/* --Methode-- */
+PIOptMenuX::PIOptMenuX(PIContainerGen* par, PIPDMenu *pdm,
+                     int sx, int sy, int px, int py)
+: PIOptMenuGen(par, pdm, sx, sy, px, py)
+{
+SysDWdg cb;
+
+XmString xmstr;
+xmstr = XmStringLtoRCreate(pdm->Nom().c_str(), XmSTRING_DEFAULT_CHARSET);
+
+Arg  warg[2];
+XtSetArg(warg[0], XmNsubMenuId, pdm->XtWdg());
+XtSetArg(warg[1],XmNlabelString, xmstr);
+
+XtWdg() = XmCreateOptionMenu( par->XtWdg(), pdm->Nom().c_str(), warg, 2); 
+wmis == k_wmi_normal ;
+stmng = 0;
+
+cb = XmOptionButtonGadget (XtWdg());
+XtSetArg(warg[0],XmNhighlightThickness, 0);
+XtSetValues(cb, warg, 1);
+
+SetPos(px,py);
+if ((sx > 0) && (sy > 0))  SetSize(sx, sy);
+// SetLabel(pdm->Nom());
+
+pdm->SetMsgParent(this);
+Manage();
+}
+
+
+/* --Methode-- */
+PIOptMenuX::~PIOptMenuX()
+{
+}
+
+/* --Methode-- */
+void PIOptMenuX::Process(long msg, PIMsgHandler* sender, void* data)
+{
+printf("PIOptMenuX::Process Msg= %d \n", (int)msg);
+Select((char *)data, msg);
+ReSend(msg, sender, data);
+}
+
Index: trunk/SophyaPI/PI/pioptmenux.h
===================================================================
--- trunk/SophyaPI/PI/pioptmenux.h	(revision 2)
+++ trunk/SophyaPI/PI/pioptmenux.h	(revision 2)
@@ -0,0 +1,29 @@
+#ifndef PIOPTMENX_H_SEEN
+#define PIOPTMENX_H_SEEN
+
+#include "pioptmenugen.h"
+
+class PIOptMenuX : public PIOptMenuGen {
+public:
+	            PIOptMenuX(PIContainerGen* par, PIPDMenu *pdm,  
+                               int sx=10, int sy=10, int px=0, int py=0);
+	            ~PIOptMenuX();
+
+  virtual void      Process(long msg, PIMsgHandler* sender, void* data=NULL);
+				   
+  virtual string    GetValueStr() { return(mStext); }
+  virtual long      GetValue()    { return(mSmsg); } 
+  
+  inline void       Select(char *txt, long msg) { mStext = txt;  mSmsg = msg; }
+
+
+protected:
+  string   mStext;
+  long     mSmsg;
+
+};
+
+
+typedef PIOptMenuX  PIOptMenu ;
+
+#endif
Index: trunk/SophyaPI/PI/pipixmapgen.cc
===================================================================
--- trunk/SophyaPI/PI/pipixmapgen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapgen.cc	(revision 2)
@@ -0,0 +1,50 @@
+/* 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;
+cmap = new PIColorMap(CMAP_GREY32);
+}
+
+
+/* --Methode-- */
+PIPixmapGen::~PIPixmapGen()
+{
+delete cmap;
+}
+
+/* --Methode-- */
+void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy)
+{
+pixmap = pix; nx = sx; ny = sy;
+Refresh();
+}
+
+
+/* --Methode-- */
+void PIPixmapGen::SetColMap(CMapId cmapid)
+{
+  if (cmap) delete cmap;
+  cmap = new PIColorMap(cmapid);
+  Refresh();
+}
+
+
+
+// Fin des methodes de la classe 
+
+
Index: trunk/SophyaPI/PI/pipixmapgen.h
===================================================================
--- trunk/SophyaPI/PI/pipixmapgen.h	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapgen.h	(revision 2)
@@ -0,0 +1,38 @@
+/* Fonctions interface XWindow pour affichage d'images */
+
+#ifndef PIPIXMAP_H_SEEN
+#define PIPIXMAP_H_SEEN
+
+#include "pisysdep.h"
+
+#include PIBWDG_H
+#include PICMAP_H
+
+class PIPixmapGen : public PIBaseWdg
+{
+public:
+  enum {ClassId = 5100};
+
+                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);
+  void          SetColMap(CMapId cmapid);
+  inline CMapId GetColMapId() { return (cmap->Type()); }; 
+  inline int    NbCol() { return(cmap->NCol()); };
+
+protected:
+  unsigned char *pixmap;
+  int nx, ny;
+  PIColorMap* cmap;
+};  
+  
+
+
+
+#endif   /* PIPIXMAP_H_SEEN */
+
+
Index: trunk/SophyaPI/PI/pipixmapmac.cc
===================================================================
--- trunk/SophyaPI/PI/pipixmapmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapmac.cc	(revision 2)
@@ -0,0 +1,89 @@
+#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)
+{
+  if (nx != sx || ny != sy)
+    if (mGWorld) {
+      DisposeGWorld(mGWorld);
+      mGWorld = NULL;
+    }
+  PIPixmapGen::SetPixmap(pix, sx, sy);
+}
+
+void
+PIPixmapMac::Resize()
+{
+  Refresh();
+}
+
+void
+PIPixmapMac::Refresh()
+{
+  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()
+{
+  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);
+
+
+}
Index: trunk/SophyaPI/PI/pipixmapmac.h
===================================================================
--- trunk/SophyaPI/PI/pipixmapmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapmac.h	(revision 2)
@@ -0,0 +1,24 @@
+#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);
+  virtual void  Draw();
+  virtual void	Refresh();
+  virtual void  Resize();
+protected:
+  GWorldPtr 	mGWorld;
+};
+
+typedef PIPixmapMac PIPixmap;
+
+
+#endif
Index: trunk/SophyaPI/PI/pipixmapx.cc
===================================================================
--- trunk/SophyaPI/PI/pipixmapx.cc	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapx.cc	(revision 2)
@@ -0,0 +1,107 @@
+#include <stdio.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#include "pipixmapx.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();
+}
+
+
+/* --Methode-- */
+PIPixmapX::~PIPixmapX()
+{}
+
+
+
+/* --Methode-- */
+void PIPixmapX::Draw()
+{
+// EraseWindow();
+Draw(0,0,XSize(),YSize());
+}
+
+/* --Methode-- */
+void PIPixmapX::Draw(int x0, int y0, int dx, int dy)
+{
+int depth;
+XImage * ximg;
+Window xw;
+Display * mdsp;
+int scr;
+
+int i,j;
+unsigned char *pp;
+
+
+if ((pixmap == NULL) || (cmap == NULL)) return;
+
+xw = XtWindow(XtWdg());
+mdsp = PIXDisplay();
+scr = PIXScreen();
+
+if (x0 < 0)  x0 = 0;
+if (y0 < 0)  y0 = 0;
+
+if (dx > (nx-x0)) dx = nx-x0;
+if (dy > (ny-y0)) dy = ny-y0;
+if ((dx <= 0) || (dy <= 0))  return;
+
+depth = DefaultDepth(mdsp,scr);
+ximg = XCreateImage (mdsp,DefaultVisual(mdsp,scr),
+       depth,ZPixmap,0,NULL,dx,dy,8,0);
+if (ximg == NULL)  return;
+ximg->data = new char [dy*ximg->bytes_per_line];
+if (ximg->data == NULL)  { XFree(ximg); return; }
+
+for(j=0; j<dy; j++)
+  {
+  pp = pixmap+(j+y0)*nx+x0;
+  for(i=0; i<dx; i++)
+    { XPutPixel(ximg, i, j, cmap->Color(*pp) );  pp++; }
+  }
+XPutImage(mdsp, xw, mygc, ximg, 0,0, x0, y0, nx, ny);
+XSync(mdsp, 0);
+
+delete ximg->data;
+XFree(ximg);
+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;
+}
Index: trunk/SophyaPI/PI/pipixmapx.h
===================================================================
--- trunk/SophyaPI/PI/pipixmapx.h	(revision 2)
+++ trunk/SophyaPI/PI/pipixmapx.h	(revision 2)
@@ -0,0 +1,24 @@
+#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  Draw();
+  virtual void  Draw(int x0, int y0, int dx, int dy);
+
+
+protected:
+  void          Init();
+};
+
+typedef PIPixmapX PIPixmap;
+
+
+#endif
Index: trunk/SophyaPI/PI/pippapplmac.cc
===================================================================
--- trunk/SophyaPI/PI/pippapplmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pippapplmac.cc	(revision 2)
@@ -0,0 +1,22 @@
+#include "pippapplmac.h"
+#include "piupdattachment.h"
+
+PIPPApplMac::PIPPApplMac()
+:LApplication()
+{}
+
+
+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;
+  }   
+}
Index: trunk/SophyaPI/PI/pippapplmac.h
===================================================================
--- trunk/SophyaPI/PI/pippapplmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pippapplmac.h	(revision 2)
@@ -0,0 +1,10 @@
+#include <LApplication.h>
+
+class PIPPApplMac : public LApplication {
+public:
+						PIPPApplMac();
+	virtual				~PIPPApplMac();
+
+	virtual void			AdjustCursor	(const EventRecord &inMacEvent);
+};
+
Index: trunk/SophyaPI/PI/pistdwdggen.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdggen.cc	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdggen.cc	(revision 2)
@@ -0,0 +1,64 @@
+#include "pistdwdggen.h"
+
+
+/************* PILabelGen ************/
+
+PILabelGen::PILabelGen(PIContainerGen *par, char *nom,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{}
+
+PILabelGen::~PILabelGen()
+{}
+
+/************* PIButtonGen ************/
+
+PIButtonGen::PIButtonGen(PIContainerGen *par, char *nom, long msg,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{
+SetMsg(msg);
+}
+
+PIButtonGen::~PIButtonGen()
+{}
+
+ 
+/************* PIScaleGen ************/
+
+PIScaleGen::PIScaleGen(PIContainerGen *par, char *nom, long msg, 
+                       int /*min*/, int /*max*/, int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py) 
+{
+SetMsg(msg);
+}
+
+PIScaleGen::~PIScaleGen()
+{}
+
+/************* 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, long msg,
+                         int sx, int sy, int px, int py)
+: PIWdg(par, nom, sx, sy, px, py)
+{
+SetMsg(msg);
+}
+
+PICheckBoxGen::~PICheckBoxGen()
+{}
+
+
Index: trunk/SophyaPI/PI/pistdwdggen.h
===================================================================
--- trunk/SophyaPI/PI/pistdwdggen.h	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdggen.h	(revision 2)
@@ -0,0 +1,91 @@
+#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; }
+};
+
+class PIButtonGen : public PIWdg
+{
+public:
+  enum {ClassId = 1002};
+
+                     PIButtonGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click,
+                                  int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PIButtonGen();
+
+  virtual long       kind() {return ClassId; }
+  
+protected:
+
+};
+
+class PITextGen : public PIWdg
+{
+public:
+
+  enum {ClassId = 1003};
+
+  		     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 long       kind() {return ClassId; }
+};
+
+
+class PIScaleGen : public PIWdg
+{
+public:
+  enum {ClassId = 1004};
+
+                     PIScaleGen(PIContainerGen* par, char* nom, long msg = PIMsg_Click,
+                     int min=0, int max=10, int sx=100, int sy=10, int px=0, int py=0);
+  ~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 PICheckBoxGen : public PIWdg
+{
+public:
+
+  enum {ClassId = 1005};
+
+                     PICheckBoxGen(PIContainerGen* par, char* nom, 
+                                   long 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:
+
+};
+
+
+
+#endif
Index: trunk/SophyaPI/PI/pistdwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 2)
@@ -0,0 +1,198 @@
+#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, 0);
+}
+
+PILabelMac::~PILabelMac()
+{}
+
+
+/************* PIButtonMac ************/
+#include <LStdControl.h>
+
+PIButtonMac::PIButtonMac(PIContainerGen *par, char *nom, long msg,
+                         int sx, int sy, int px, int py)
+: PIButtonGen(par, nom, msg, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdButton(mPaneInfo, msg_Click, 0, titre);
+  ((LStdButton*)mPane)->AddListener(this);
+}
+
+PIButtonMac::~PIButtonMac()
+{}
+
+void
+PIButtonMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_Click)
+    Send(myMsg);
+}
+
+
+/************* 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, 0, 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;
+}
+
+/************* PIScaleMac ************/
+static ControlActionUPP	sSBarAction = nil;
+
+
+PIScaleMac::PIScaleMac(PIContainerGen* par, char* nom, long msg,
+                       int min, int max, int sx, int sy, int px, int py)
+: PIScaleGen(par, nom, msg, min, max, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdControl(mPaneInfo, msg_Click, min, min, max,
+						  scrollBarProc, 0, 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);
+}
+
+void
+PIScaleMac::SetMinMax(int min, int max)
+{
+  ((LStdControl*)mPane)->SetMinValue(min);
+  ((LStdControl*)mPane)->SetMaxValue(max);
+}
+
+void
+PIScaleMac::SetValue(int val)
+{
+  ((LStdControl*)mPane)->SetValue(val);
+}
+
+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);
+	}
+}
+
+/************* PICheckBoxMac ************/
+#include <LStdControl.h>
+
+PICheckBoxMac::PICheckBoxMac(PIContainerGen *par, char *nom, long 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, 0, titre);
+  ((LStdCheckBox*)mPane)->AddListener(this);
+}
+
+PICheckBoxMac::~PICheckBoxMac()
+{}
+
+void
+PICheckBoxMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_Click)
+    Send(myMsg);
+}
+
+void
+PICheckBoxMac::SetState(bool st)
+{
+  ((LStdCheckBox*)mPane)->SetValue(st ? 1 : 0);
+}
+ 
+bool
+PICheckBoxMac::GetState()
+{
+  return ((LStdCheckBox*)mPane)->GetValue();
+}
Index: trunk/SophyaPI/PI/pistdwdgmac.h
===================================================================
--- trunk/SophyaPI/PI/pistdwdgmac.h	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdgmac.h	(revision 2)
@@ -0,0 +1,72 @@
+#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, long msg = PIMsg_Click,
+                                  int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PIButtonMac();
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+};
+
+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       SetText(string const&);
+  virtual string     GetText() const;
+};
+
+class PIScaleMac : public PIScaleGen
+{
+public:
+                     PIScaleMac(PIContainerGen* par, char* nom, long msg=PIMsg_Click,
+                                int min=0, int max=10, 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 PICheckBoxMac : public PICheckBoxGen
+{
+public:
+                     PICheckBoxMac(PIContainerGen* par, char* nom, 
+                                   long 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 PICheckBoxMac PICheckBox;
+
+#endif
Index: trunk/SophyaPI/PI/pistdwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdgx.cc	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdgx.cc	(revision 2)
@@ -0,0 +1,219 @@
+#include<stdlib.h>
+#include<string.h>
+
+#include "pisysdep.h"
+#include PISTDWDG_H
+
+/************* 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)
+{
+CreateXtWdg(nom, xmLabelWidgetClass, NULL, sx, sy, px, py);
+SetBorderWidth(0);
+Manage();
+}
+
+/* --Methode-- */
+PILabelX::~PILabelX()
+{}
+
+
+/************* PIButtonX ************/
+#include <Xm/PushB.h>
+
+// Fonction prive (CallBack)
+static void button_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+/* Nouvelle-Fonction */
+void  button_action(Widget w, XtPointer *usd, XtPointer *calld)
+{
+PIButtonX *pib;
+pib = (PIButtonX *) usd ;
+pib->Send(pib->Msg());
+return;
+}
+
+/* --Methode-- */
+PIButtonX::PIButtonX(PIContainerGen *par, char *nom, long msg,
+                         int sx, int sy, int px, int py)
+: PIButtonGen(par, nom, msg, sx, sy, px, py)
+{
+CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
+XtAddCallback(XtWdg(), XmNactivateCallback, 
+              button_action, (XtPointer)this);
+Manage();
+}
+
+/* --Methode-- */
+PIButtonX::~PIButtonX()
+{}
+
+
+
+/************* 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)
+{
+CreateXtWdg(nom, xmTextWidgetClass, NULL, sx, sy, px, py);
+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);
+}
+
+
+/************* PIScaleX ************/
+#include <Xm/Scale.h>
+
+// Fonction prive (CallBack)
+static void scale_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+void  scale_action(Widget w, XtPointer *usd, XtPointer *calld)
+{
+PIScale *pis;
+
+pis = (PIScale *) usd ;
+pis->Send(pis->Msg(), (void *)pis->GetValue());
+
+return;
+}
+
+/* --Methode-- */
+PIScaleX::PIScaleX(PIContainerGen *par, char *nom, long msg,
+                   int min, int max, int sx, int sy, int px, int py)
+: PIScaleGen(par, nom, msg, min, max, sx, sy, px, py)
+{
+int n=0;
+Arg warg[6];
+CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py);
+XtSetArg(warg[n], XmNshowValue, TRUE); n++;
+XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
+XtSetArg(warg[n], XmNscaleWidth, sx); n++;
+XtSetArg(warg[n], XmNscaleHeight, sy); n++;
+XtSetArg(warg[n], XmNstringDirection, XmSTRING_DIRECTION_R_TO_L); n++;
+XtSetArg(warg[n], XmRProcessingDirection, XmMAX_ON_RIGHT); n++;
+XtSetValues(XtWdg(), warg, n);
+SetMinMax(min, max);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback, 
+              scale_action, (XtPointer)this);
+Manage();
+}
+
+/* --Methode-- */
+PIScaleX::~PIScaleX()
+{}
+
+/* --Methode-- */
+void PIScaleX::SetMinMax(int min, int max)
+{
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNminimum, min); n++;
+XtSetArg(warg[n], XmNmaximum, max); n++;
+XtSetValues(XtWdg(), warg, n);
+return;
+}
+
+
+/* --Methode-- */
+void PIScaleX::SetValue(int val)
+{
+int n=0;
+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);
+return(val);
+}
+
+
+/************* PICheckBoxX ************/
+#include <Xm/ToggleB.h>
+
+// Fonction prive (CallBack)
+static void toggb_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+/* Nouvelle-Fonction */
+void  toggb_action(Widget w, XtPointer *usd, XtPointer *calld)
+{
+PICheckBoxX *picb;
+picb = (PICheckBoxX *) usd ;
+picb->Send(picb->Msg(), (void *)picb->GetState());
+return;
+}
+
+/* --Methode-- */
+PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, long 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,
+              toggb_action, (XtPointer)this);
+Arg warg[2];
+XtSetArg(warg[0],XmNhighlightThickness, 0);
+XtSetValues(XtWdg(), warg, 1);
+Manage();
+}
+
+
+/* --Methode-- */
+PICheckBoxX::~PICheckBoxX()
+{}
+
+
+/* --Methode-- */
+void PICheckBoxX::SetState(bool st)
+{
+Arg warg[2];
+XtSetArg(warg[0],XmNset, st);
+XtSetValues(XtWdg(), warg, 1);
+return;
+}
+
+/* --Methode-- */
+bool PICheckBoxX::GetState()
+{
+int val;
+Arg warg[2];
+XtSetArg(warg[0], XmNset, &val); 
+XtGetValues(XtWdg(), warg, 1);
+return ((bool)val);
+}
Index: trunk/SophyaPI/PI/pistdwdgx.h
===================================================================
--- trunk/SophyaPI/PI/pistdwdgx.h	(revision 2)
+++ trunk/SophyaPI/PI/pistdwdgx.h	(revision 2)
@@ -0,0 +1,70 @@
+#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, long msg=PIMsg_Click,
+                               int sx=10, int sy=10, int px=0, int py=0);
+  virtual           ~PIButtonX();
+
+};
+
+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;
+};
+
+class PIScaleX : public PIScaleGen
+{
+public:
+  PIScaleX(PIContainerGen* par, char* nom, long msg=PIMsg_Click,
+         int min=0, int max=10, int sx=100, int sy=10, int px=0, int py=0);
+  ~PIScaleX();
+
+  virtual void SetMinMax(int min, int max);
+  virtual void SetValue(int val);
+  virtual int GetValue(); 
+
+protected: 
+};
+
+
+class PICheckBoxX : public PICheckBoxGen
+{
+public:
+                     PICheckBoxX(PIContainerGen *par, char *nom, 
+                                 long 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();
+};
+
+
+typedef PILabelX       PILabel;
+typedef PIButtonX      PIButton;
+typedef PITextX        PIText;
+typedef PIScaleX       PIScale;
+typedef PICheckBoxX    PICheckBox;
+
+
+#endif
Index: trunk/SophyaPI/PI/pisysdep.h
===================================================================
--- trunk/SophyaPI/PI/pisysdep.h	(revision 2)
+++ trunk/SophyaPI/PI/pisysdep.h	(revision 2)
@@ -0,0 +1,44 @@
+#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 PIAPP_H "piapplmac.h"
+  
+  #define PIBWDG_H "pibwdgmac.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 PIAPP_H "piapplx.h"
+
+  #define PIBWDG_H "pibwdgx.h"
+
+  #define PICMAPNTV_H "picmapx.h"
+  #define PICMAP_H "picmap.h"
+  #define PIPIXMAP_H "pipixmapx.h"
+
+#endif
+
+#endif
Index: trunk/SophyaPI/PI/pitestapp.xx
===================================================================
--- trunk/SophyaPI/PI/pitestapp.xx	(revision 2)
+++ trunk/SophyaPI/PI/pitestapp.xx	(revision 2)
@@ -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: trunk/SophyaPI/PI/piupdattachment.cc
===================================================================
--- trunk/SophyaPI/PI/piupdattachment.cc	(revision 2)
+++ trunk/SophyaPI/PI/piupdattachment.cc	(revision 2)
@@ -0,0 +1,96 @@
+#include "piupdattachment.h"
+const MessageT	msg_Resize			= 817;
+const MessageT	msg_Move			= 818;
+//const MessageT	msg_MouseUp			= 819;
+
+PIUpdAttachment* PIUpdAttachment::lastCursPane = NULL;
+bool PIUpdAttachment::hit = false;
+bool PIUpdAttachment::down = false;
+
+PIUpdAttachment::PIUpdAttachment(PIBaseWdgMac* wdg)
+: LAttachment(), myWdg(wdg)
+{
+
+}
+
+void PIUpdAttachment::ExecuteSelf(MessageT msg, void* data)
+{
+  if (myWdg)
+    switch(msg) {
+      case msg_DrawOrPrint:
+        myWdg->Draw();
+ 		break;
+      case msg_Resize:
+        myWdg->Resize();
+ 		break;
+      case msg_Move:
+//        myWdg->Move();
+        break;
+      case msg_Click: {
+        down = true;
+        SMouseDownEvent* evt = (SMouseDownEvent*) data;
+        EventModifiers mod = evt->macEvent.modifiers;
+        if ((mod & cmdKey) && (mod & optionKey))
+          myWdg->But3Press(evt->whereLocal.h,evt->whereLocal.v);
+        else if (mod & cmdKey)
+          myWdg->But2Press(evt->whereLocal.h,evt->whereLocal.v);
+        else
+          myWdg->But1Press(evt->whereLocal.h,evt->whereLocal.v);
+ 		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 = true;
+ 	      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.
+ 	      down = false;
+ 	      Point pt = evt->where;
+ 	      myWdg->mPane->GlobalToPortPoint(pt);
+ 	      myWdg->mPane->PortToLocalPoint(pt);
+          EventModifiers mod = evt->modifiers;
+          if ((mod & cmdKey) && (mod & optionKey))
+            myWdg->But3Release(pt.h,pt.v);
+          else if (mod & cmdKey)
+            myWdg->But2Release(pt.h,pt.v);
+          else
+            myWdg->But1Release(pt.h,pt.v);
+        }
+ 	    break;
+ 	    }
+    }
+}
Index: trunk/SophyaPI/PI/piupdattachment.h
===================================================================
--- trunk/SophyaPI/PI/piupdattachment.h	(revision 2)
+++ trunk/SophyaPI/PI/piupdattachment.h	(revision 2)
@@ -0,0 +1,22 @@
+
+#include <LAttachment.h>
+
+#include "pibwdgmac.h"
+
+class PIUpdAttachment : public LAttachment {
+public:
+  PIUpdAttachment(PIBaseWdgMac* wdg);
+  
+protected:
+ virtual void	ExecuteSelf(
+							MessageT		inMessage,
+							void			*ioParam);
+
+ PIBaseWdgMac* myWdg;
+ 
+ friend class PIPPApplMac;
+ static PIUpdAttachment* lastCursPane;
+ static bool hit;
+ static bool down;
+ Point lastPt;
+};
Index: trunk/SophyaPI/PI/piwdggen.cc
===================================================================
--- trunk/SophyaPI/PI/piwdggen.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwdggen.cc	(revision 2)
@@ -0,0 +1,39 @@
+#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;
+SetMsg(0);
+if (par)  par->NewChild(this);
+return;
+}
+
+
+/* --Methode-- */
+PIWdgGen::~PIWdgGen()
+{
+}
+
+
+/* --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: trunk/SophyaPI/PI/piwdggen.h
===================================================================
--- trunk/SophyaPI/PI/piwdggen.h	(revision 2)
+++ trunk/SophyaPI/PI/piwdggen.h	(revision 2)
@@ -0,0 +1,59 @@
+/* Classe pour enrobage generique des widgets Xt, Mac, etc  */
+/*                                    Reza 10/95            */
+
+#ifndef PIWDG_H_SEEN
+#define PIWDG_H_SEEN
+
+#include <bool.h>
+#include <string>
+
+#include "pimsghandler.h"
+
+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 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); };
+
+  inline void            SetMsg(long msg = 0) { myMsg = msg; }
+  inline long            Msg() { return(myMsg); }
+
+  virtual void           SetSize(int sx, int sy)=0;
+  virtual void           SetPos(int px, int py)=0;
+  virtual void           SetLabel(string const&) {}
+  virtual void           SetBinding(bool left, bool top, bool right, bool bottom)=0;
+
+  virtual int            XSize()=0;
+  virtual int            YSize()=0;
+  virtual int            XPos()=0;
+  virtual int            YPos()=0;
+
+  virtual string         Nom()=0;
+
+protected:
+  PIContainerGen        *parent;
+  long                  myMsg;
+
+private:
+  int flag;
+  void * pdata;
+};
+
+
+  
+
+#endif/* PIWDG_H_SEEN */
Index: trunk/SophyaPI/PI/piwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/piwdgmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwdgmac.cc	(revision 2)
@@ -0,0 +1,112 @@
+#include "piwdgmac.h"
+#include "pisysdep.h"
+
+#include PICONT_H
+
+#include <LView.h>
+#include <LString.h>
+
+
+
+
+PIWdgMac::PIWdgMac(PIContainerGen *par, char *nom,
+                   int sx, int sy, int px, int py)
+:PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
+{
+	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 = false;
+	mPaneInfo.left      = px;
+	mPaneInfo.top       = py;
+	mPaneInfo.userCon   = 'PIWD';
+	mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
+
+    mPane = new LPane(mPaneInfo);
+}
+
+
+PIWdgMac::~PIWdgMac()
+{
+  delete mPane;
+}
+
+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)
+{
+   mPane->ResizeFrameTo(sx, sy, true);
+}
+
+void
+PIWdgMac::SetPos(int px, int py)
+{
+   mPane->MoveBy(px-XPos(), py-YPos(), false);
+}
+
+void
+PIWdgMac::SetBinding(bool left, bool top, bool right, bool bottom)
+{
+  SBooleanRect r;
+  r.left    = left;
+  r.top     = top;
+  r.right   = right;
+  r.bottom  = bottom;
+  mPane->SetFrameBinding(r);
+}
+
+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;
+}
+
Index: trunk/SophyaPI/PI/piwdgmac.h
===================================================================
--- trunk/SophyaPI/PI/piwdgmac.h	(revision 2)
+++ trunk/SophyaPI/PI/piwdgmac.h	(revision 2)
@@ -0,0 +1,36 @@
+#ifndef PIWDG_MAC_SEEN
+#define PIWDG_MAC_SEEN
+
+#include "piwdggen.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           SetBinding(bool left, bool top, bool right, bool bottom);
+  virtual int            XSize();
+  virtual int            YSize();
+  virtual int            XPos();
+  virtual int            YPos();
+  virtual string         Nom()  { return mNom; }
+protected:
+  LPane*				 mPane;
+  SPaneInfo				 mPaneInfo;
+  string                 mNom;
+};
+
+typedef PIWdgMac PIWdg;
+
+
+#endif
Index: trunk/SophyaPI/PI/piwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/piwdgx.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwdgx.cc	(revision 2)
@@ -0,0 +1,360 @@
+#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
+
+static SysDWdg  top = NULL;
+static Display * dpy = NULL;
+static char appname[64];
+static char appclass[64];
+/* Nouvelle-Fonction */
+SysDWdg   PIXtTopWdg()
+{
+return (top);
+}
+
+/* Nouvelle-Fonction */
+Display * PIXDisplay()
+{
+return(dpy);
+}
+
+
+/* --Methode-- */
+PIWdgX::PIWdgX(int narg, char *arg[])
+:PIWdgGen(NULL, "PITopLevel"), mNom("PITopLevel")
+{
+if (top == NULL)  InitXt(narg, arg);
+sdw = top;
+wmis =  k_wmi_appshell;
+stmng = 0;
+#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), mNom(nom)
+{
+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;
+  }
+
+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 = 0;
+#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(false, false, false, false);
+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 = 1;
+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 = 0;
+return;
+}
+
+/* --Methode-- */
+int PIWdgX::IfManaged()
+{
+return(stmng);
+}
+
+
+/* --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];
+int n=0;
+XtSetArg(wargs[n],XtNwidth,sx);  n++;
+XtSetArg(wargs[n],XtNheight,sy);  n++;
+XtSetValues(this->sdw, wargs, n);
+
+return;
+} 
+
+/* --Methode-- */
+void PIWdgX::SetPos(int px, int py)
+{
+if (!sdw)  return;
+
+Arg  wargs[2];
+int n=0;
+
+XtSetArg(wargs[n],XtNx,px);  n++;
+XtSetArg(wargs[n],XtNy,py);  n++;
+
+XtSetValues(this->sdw, wargs, n);
+return;
+} 
+
+/* --Methode-- */
+void PIWdgX::SetBinding(bool left, bool top, bool right, bool bottom)
+{
+Arg  wargs[3];
+int n=0;
+if (!sdw)  return;
+if (!parent)  return;
+
+if (left) 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_FORM);  n++;
+  XtSetArg(wargs[n],XmNleftOffset, XPos() );  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+else 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE);  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }  
+
+if (top)
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_FORM);  n++;
+  XtSetArg(wargs[n],XmNtopOffset, YPos() );  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+else 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNtopAttachment, XmATTACH_NONE);  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+  
+if (right) 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM);  n++;
+  XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) );  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+else 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNleftAttachment, XmATTACH_NONE);  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }  
+
+if (right) 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_FORM);  n++;
+  XtSetArg(wargs[n],XmNrightOffset, parent->XSize()-(XSize()+XPos()) );  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+else 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNrightAttachment, XmATTACH_NONE);  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }  
+
+if (bottom) 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_FORM);  n++;
+  XtSetArg(wargs[n],XmNbottomOffset, parent->YSize()-(YSize()+YPos()) );  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }
+else 
+  {
+  n = 0;
+  XtSetArg(wargs[n],XmNbottomAttachment, XmATTACH_NONE);  n++;
+  XtSetValues(this->sdw, wargs, n);
+  }  
+
+return;
+}
+
+
+/* --Methode-- */
+void PIWdgX::SetBorderWidth(int bw)
+{
+if (!sdw)  return;
+
+Arg  wargs[2];
+int n=0;
+if (!sdw)  return;
+
+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::InitXt(int narg, char *arg[])
+{
+if (top == NULL)   // 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 = XtInitialize(appname, appclass, NULL, 0, &n, ppc);
+  dpy = XtDisplay(top);
+  }
+return(0);
+}
Index: trunk/SophyaPI/PI/piwdgx.h
===================================================================
--- trunk/SophyaPI/PI/piwdgx.h	(revision 2)
+++ trunk/SophyaPI/PI/piwdgx.h	(revision 2)
@@ -0,0 +1,81 @@
+/* Classe pour enrobage generique des widgets Xt, Mac, etc  */
+/*                                    Reza 10/95            */
+
+#ifndef PIWDG_X_SEEN
+#define PIWDG_X_SEEN
+
+#include <string>
+
+#include <X11/Xlib.h>
+#include <X11/Intrinsic.h>
+
+#include "piwdggen.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   SetBinding(bool left, bool top, bool right, bool bottom);
+  virtual void   SetBorderWidth(int bw);
+  virtual void   SetLabel(string const & lab);
+
+  virtual int    XSize();
+  virtual int    YSize();
+  virtual int    XPos();
+  virtual int    YPos();
+
+  virtual string Nom()  { return mNom; }
+
+  void Manage();
+  void Unmanage();
+  int  IfManaged();
+
+  inline SysDWdg XtWdg() const {return(sdw); }; 
+  inline SysDWdg& XtWdg() {return(sdw); }; 
+
+protected:
+  int InitXt(int narg=0, char *arg[]=NULL); 
+
+
+  SysDWdg sdw;
+  WmIntState wmis;
+  int stmng;
+  string mNom;
+  
+};
+
+typedef PIWdgX PIWdg;
+
+
+// Utile pour avoir acces au Display et Screen X ...
+SysDWdg   PIXtTopWdg();
+Display * PIXDisplay();
+#define  PIXScreen()  DefaultScreen(PIXDisplay()) 
+
+#endif/* PIWDGX_SEEN */
+
+
+
Index: trunk/SophyaPI/PI/piwdgxt.cc
===================================================================
--- trunk/SophyaPI/PI/piwdgxt.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwdgxt.cc	(revision 2)
@@ -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: trunk/SophyaPI/PI/piwdgxt.h
===================================================================
--- trunk/SophyaPI/PI/piwdgxt.h	(revision 2)
+++ trunk/SophyaPI/PI/piwdgxt.h	(revision 2)
@@ -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: trunk/SophyaPI/PI/piwindowgen.cc
===================================================================
--- trunk/SophyaPI/PI/piwindowgen.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwindowgen.cc	(revision 2)
@@ -0,0 +1,15 @@
+#include "piwindowgen.h"
+
+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);
+}
+
+
+PIWindowGen::~PIWindowGen()
+{}
+
+
+
Index: trunk/SophyaPI/PI/piwindowgen.h
===================================================================
--- trunk/SophyaPI/PI/piwindowgen.h	(revision 2)
+++ trunk/SophyaPI/PI/piwindowgen.h	(revision 2)
@@ -0,0 +1,28 @@
+#ifndef PIWINDOWGEN_H_SEEN
+#define PIWINDOWGEN_H_SEEN
+
+#include "pisysdep.h"
+
+#include PICONT_H
+
+enum PIWindowKind {
+  PIWK_normal = 0,
+  PIWK_dialog = 1,
+  PIWK_floating = 2
+};
+
+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; }
+  
+protected:
+  PIWindowKind	       mWtyp;
+};
+
+
+#endif
Index: trunk/SophyaPI/PI/piwindowmac.cc
===================================================================
--- trunk/SophyaPI/PI/piwindowmac.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwindowmac.cc	(revision 2)
@@ -0,0 +1,56 @@
+#include "piwindowmac.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;
+	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_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);
+	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();
+}
Index: trunk/SophyaPI/PI/piwindowmac.h
===================================================================
--- trunk/SophyaPI/PI/piwindowmac.h	(revision 2)
+++ trunk/SophyaPI/PI/piwindowmac.h	(revision 2)
@@ -0,0 +1,22 @@
+#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();
+
+protected:
+  SWindowInfo			  mWindowInfo;
+  Boolean				  finalized;
+};
+
+typedef PIWindowMac PIWindow;
+
+#endif
Index: trunk/SophyaPI/PI/piwindowx.cc
===================================================================
--- trunk/SophyaPI/PI/piwindowx.cc	(revision 2)
+++ trunk/SophyaPI/PI/piwindowx.cc	(revision 2)
@@ -0,0 +1,56 @@
+#include <stdio.h>
+
+#include "piwindowx.h"
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Shell.h>
+#include <Xm/Form.h>
+// #include <Xm/BulletinB.h>
+
+/* --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)
+{
+pwm = new PIWdgX(NULL, nom, sx, sy, px, py);
+
+if (k == PIWK_normal )
+  pwm->CreateXtWdg(nom, topLevelShellWidgetClass, NULL, sx, sy, px, py);
+else 
+  pwm->CreateXtWdg(nom, transientShellWidgetClass, NULL, sx, sy, px, py);
+//  pwm->CreateXtWdg(nom, overrideShellWidgetClass, NULL, sx, sy, px, py);
+
+CreateXtWdg(nom, xmFormWidgetClass, pwm->XtWdg(), sx, sy, 0, 0);
+}
+
+/* --Methode-- */
+PIWindowX::~PIWindowX()
+{
+delete pwm;
+}
+/* --Methode-- */
+void PIWindowX::SetBinding(bool left, bool top, bool right, bool bottom)
+{
+// On ne doit rien faire pour les fenetres 
+return;
+}
+
+/* --Methode-- */
+void PIWindowX::Show()
+{
+PIContainerGen::Show();
+Manage();
+pwm->Manage();
+}
+
+/* --Methode-- */
+void PIWindowX::Hide()
+{
+PIWindowGen::Hide();
+Unmanage();
+pwm->Unmanage();
+}
+
+
Index: trunk/SophyaPI/PI/piwindowx.h
===================================================================
--- trunk/SophyaPI/PI/piwindowx.h	(revision 2)
+++ trunk/SophyaPI/PI/piwindowx.h	(revision 2)
@@ -0,0 +1,26 @@
+#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(bool left, bool top, bool right, bool bottom);
+
+  virtual void  Show();
+  virtual void  Hide();
+
+protected:
+  PIWdgX   *pwm;
+
+};
+
+typedef PIWindowX PIWindow;
+
+#endif   /* PIWINDOWX_H_SEEN  */
Index: trunk/SophyaPI/PI/pixtbase.cc
===================================================================
--- trunk/SophyaPI/PI/pixtbase.cc	(revision 2)
+++ trunk/SophyaPI/PI/pixtbase.cc	(revision 2)
@@ -0,0 +1,376 @@
+#include <stdio.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+
+#include <X11/IntrinsicP.h>
+#include <X11/CoreP.h>
+
+#include "pixtbaseP.h"
+#include "pixtbase.h"
+
+
+/*  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);
+
+
+static void     leave_pixtbase   (Widget, XEvent*, String* ,Cardinal*);
+static void     enter_pixtbase   (Widget, XEvent*, String* ,Cardinal*);
+static void     buu1_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     bud1_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     buu2_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     bud2_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     buu3_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     bud3_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     mov1_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     mov2_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     mov3_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+static void     keyb_pixtbase    (Widget, XEvent*, String* ,Cardinal*);
+
+
+static XtResource resources[] ={
+  {PIXNobject ,"Object", XtRPointer, sizeof(XtRPointer),
+   XtOffset(PIXtBaseWidget,  pixtbase.objet), XtRImmediate, (XtPointer)0},
+};
+
+/*
+static char translations[] =  "\
+                      <BtnDown>: bud1_pixtbase(None)\n\
+             Button1 <PtrMoved>: mov1_pixtbase(None)\n\
+                        <BtnUp>: buu1_pixtbase(None)\n\
+                          <Key>: keyb_pixtbase(None)";
+*/
+
+static XtActionsRec actions[] = 
+{
+  { "leave_pixtbase" , (XtActionProc)leave_pixtbase} ,
+  { "enter_pixtbase" , (XtActionProc)enter_pixtbase} ,
+  { "buu1_pixtbase" , (XtActionProc)buu1_pixtbase} ,
+  { "bud1_pixtbase" , (XtActionProc)bud1_pixtbase} ,
+  { "buu2_pixtbase" , (XtActionProc)buu2_pixtbase} ,
+  { "bud2_pixtbase" , (XtActionProc)bud2_pixtbase} ,
+  { "buu3_pixtbase" , (XtActionProc)buu3_pixtbase} ,
+  { "bud3_pixtbase" , (XtActionProc)bud3_pixtbase} ,
+  { "mov1_pixtbase" , (XtActionProc)mov1_pixtbase} ,
+  { "mov2_pixtbase" , (XtActionProc)mov2_pixtbase} ,
+  { "mov3_pixtbase" , (XtActionProc)mov3_pixtbase} ,
+  { "keyb_pixtbase" , (XtActionProc)keyb_pixtbase} ,
+};
+
+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     */
+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     */
+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;
+
+
+/* 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: Object= %ld  narg=%d \n", 
+(long)(wdgp->pixtbase.objet), (int)(*narg));
+#endif
+return;
+}
+
+/* Nouvelle-Fonction */
+static void destroy_pixtbase (Widget wdgp)
+{
+#ifdef DEBUG_PIXTB
+puts("Debug_destroy_pixtbase");
+#endif
+// free_GCs((PIXtBaseWidget)wdgp);
+}
+
+
+/* Nouvelle-Fonction */
+static void resize_pixtbase (Widget wdgp)
+{
+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 %ld\n",(long)((PIXtBaseWidget)wdgp)->pixtbase.objet);
+#endif
+
+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)->Draw(x0, y0, dx, dy);
+  }
+return;
+}
+
+/* Nouvelle-Fonction */
+static void enter_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+   (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Enter();
+return;
+}
+
+/* Nouvelle-Fonction */
+static void leave_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+   (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Leave();
+return;
+}
+
+/* Nouvelle-Fonction */
+static void bud1_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Press(x,y);
+  }
+return;
+}
+
+/* Nouvelle-Fonction */
+static void buu1_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But1Release(x,y);
+  }
+return;
+}
+/* Nouvelle-Fonction */
+static void bud2_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But2Press(x,y);
+}
+return;
+}
+
+/* Nouvelle-Fonction */
+static void buu2_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet)
+  { 
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But2Release(x,y);
+  }
+return;
+}
+
+
+/* Nouvelle-Fonction */
+static void bud3_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But3Press(x,y);
+}
+return;
+}
+
+/* Nouvelle-Fonction */
+static void buu3_pixtbase (Widget wdgp, XEvent* evt, 
+                       String* args, Cardinal* narg)
+
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet) 
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->But3Release(x,y);
+}
+return;
+}
+
+/* Nouvelle-Fonction */
+static void mov1_pixtbase (Widget wdgp, XEvent* evt, 
+                         String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet)  
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr1Move(x,y);
+  }
+return;
+}
+
+/* Nouvelle-Fonction */
+static void mov2_pixtbase (Widget wdgp, XEvent* evt, 
+                         String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet)  
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr2Move(x,y);
+  }
+return;
+}
+
+/* Nouvelle-Fonction */
+static void mov3_pixtbase (Widget wdgp, XEvent* evt, 
+                         String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet)  
+  {
+  int x,y;
+  x = evt->xbutton.x;
+  y = evt->xbutton.y;  
+  (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Ptr3Move(x,y);
+  }
+return;
+}
+
+/* Nouvelle-Fonction */
+static void keyb_pixtbase (Widget wdgp, XEvent* evt, 
+                          String* args, Cardinal* narg)
+{
+if (((PIXtBaseWidget)wdgp)->pixtbase.objet)  
+  {
+  XComposeStatus cs;
+  KeySym key;
+  char buf[10];
+  int i,nc;
+  PIKeyModifier kmod;
+  
+  kmod = PIKM_Blank;
+
+  nc = XLookupString(&(evt->xkey), buf, 10, &key, &cs);
+  if (nc <= 0)  return;
+  if  (evt->xkey.state & ShiftMask)   kmod |= PIKM_Shift;
+  if  (evt->xkey.state & ControlMask) kmod |= PIKM_Cntl;
+  if  (evt->xkey.state & Mod2Mask)    kmod |= PIKM_Alt;
+  for(i=0; i<nc; i++)  
+    (((PIXtBaseWidget)wdgp)->pixtbase.objet)->Keyboard((int)(buf[i]), kmod);
+  }
+return;
+}
+
+
+/* Nouvelle-Fonction 
+static void get_GCs (PIXtBaseWidget wdgp)
+{
+
+XGCValues       values;
+XtGCMask        mask;
+Display *dpy;
+
+dpy = XtDisplay(wdgp);
+
+mask              = GCForeground | GCBackground ;
+values.foreground = WhitePixel(dpy, XDefaultScreen(dpy));
+values.background = BlackPixel(dpy, XDefaultScreen(dpy));
+wdgp->pixtbase.defgc      = XtGetGC((Widget) wdgp, mask, &values);
+return;
+}
+*/
+
+/* Nouvelle-Fonction 
+static void free_GCs (PIXtBaseWidget wdgp)
+{
+XtReleaseGC ((Widget) wdgp, wdgp->pixtbase.defgc);
+}
+
+*/
+
Index: trunk/SophyaPI/PI/pixtbase.h
===================================================================
--- trunk/SophyaPI/PI/pixtbase.h	(revision 2)
+++ trunk/SophyaPI/PI/pixtbase.h	(revision 2)
@@ -0,0 +1,16 @@
+/* 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      "object"
+
+extern WidgetClass piXtBaseWidgetClass;
+
+#endif /* PIXTBASE_H_SEEN */
Index: trunk/SophyaPI/PI/pixtbaseP.h
===================================================================
--- trunk/SophyaPI/PI/pixtbaseP.h	(revision 2)
+++ trunk/SophyaPI/PI/pixtbaseP.h	(revision 2)
@@ -0,0 +1,40 @@
+/* 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; 
+} PIXtBasePart;
+
+
+typedef struct _PIXtBaseRec
+{
+CorePart		core;
+PIXtBasePart		pixtbase;
+} PIXtBaseRec;
+
+extern PIXtBaseClassRec piXtBaseClassRec;
+
+
+#endif /* PIXTBASEP_H_SEEN */
+
+
+
Index: trunk/SophyaPI/PI/so_locations
===================================================================
--- trunk/SophyaPI/PI/so_locations	(revision 2)
+++ trunk/SophyaPI/PI/so_locations	(revision 2)
@@ -0,0 +1,8 @@
+libPeidaInter.so \
+		:st = .text 0x000003ffbffe0000, 0x0000000000020000:\
+		:st = .data 0x000003ffffff0000, 0x0000000000010000:\
+
+libPI.so \
+		:st = .text 0x000003ffbffc0000, 0x0000000000020000:\
+		:st = .data 0x000003fffffe0000, 0x0000000000010000:\
+
