Index: /trunk/SophyaPI/PI/Makefile
===================================================================
--- /trunk/SophyaPI/PI/Makefile	(revision 3518)
+++ /trunk/SophyaPI/PI/Makefile	(revision 3519)
@@ -4,267 +4,298 @@
  
 clean:
-	 rm -f $(SOPHYAOBJP)lut.o $(SOPHYAOBJP)parradapter.o $(SOPHYAOBJP)pi3ddrw.o $(SOPHYAOBJP)pi3dwdg.o $(SOPHYAOBJP)piapplgen.o $(SOPHYAOBJP)piapplx.o $(SOPHYAOBJP)piaxes.o $(SOPHYAOBJP)piaxestools.o $(SOPHYAOBJP)pibargraph.o $(SOPHYAOBJP)pibwdggen.o $(SOPHYAOBJP)pibwdgx.o $(SOPHYAOBJP)picmap.o $(SOPHYAOBJP)picmapgen.o $(SOPHYAOBJP)picmapview.o $(SOPHYAOBJP)picmapx.o $(SOPHYAOBJP)picons.o $(SOPHYAOBJP)picontainergen.o $(SOPHYAOBJP)picontainerx.o $(SOPHYAOBJP)pidrawer.o $(SOPHYAOBJP)pidrawwin.o $(SOPHYAOBJP)pidrwtools.o $(SOPHYAOBJP)pieldrw.o $(SOPHYAOBJP)pierrdisp.o $(SOPHYAOBJP)pievthandler.o $(SOPHYAOBJP)pifilechogen.o $(SOPHYAOBJP)pifilechox.o $(SOPHYAOBJP)pifontgen.o $(SOPHYAOBJP)pifontx.o $(SOPHYAOBJP)pigraph3d.o $(SOPHYAOBJP)pigraphgen.o $(SOPHYAOBJP)pigraphps.o $(SOPHYAOBJP)pigraphuc.o $(SOPHYAOBJP)pigraphx.o $(SOPHYAOBJP)pigratt.o $(SOPHYAOBJP)pigrcoord.o $(SOPHYAOBJP)piimage.o $(SOPHYAOBJP)piimgtools.o $(SOPHYAOBJP)pilineatt.o $(SOPHYAOBJP)pilistgen.o $(SOPHYAOBJP)pilistx.o $(SOPHYAOBJP)pimenubargen.o $(SOPHYAOBJP)pimenubarx.o $(SOPHYAOBJP)pimenugen.o $(SOPHYAOBJP)pimenux.o $(SOPHYAOBJP)pimsghandler.o $(SOPHYAOBJP)pioptmenugen.o $(SOPHYAOBJP)pioptmenux.o $(SOPHYAOBJP)piperiodx.o $(SOPHYAOBJP)pipixmapgen.o $(SOPHYAOBJP)pipixmapx.o $(SOPHYAOBJP)pipplist.o $(SOPHYAOBJP)pippmenubar.o $(SOPHYAOBJP)pippoptmenu.o $(SOPHYAOBJP)pippviewadapter.o $(SOPHYAOBJP)piscdrawwdg.o $(SOPHYAOBJP)pistdwdggen.o $(SOPHYAOBJP)pistdwdgx.o $(SOPHYAOBJP)pistzwin.o $(SOPHYAOBJP)pisurfdr.o $(SOPHYAOBJP)pitherm.o $(SOPHYAOBJP)pitxtdrw.o $(SOPHYAOBJP)piup.o $(SOPHYAOBJP)piup_def.o $(SOPHYAOBJP)piupdattachment.o $(SOPHYAOBJP)piwdggen.o $(SOPHYAOBJP)piwdgx.o $(SOPHYAOBJP)piwindowgen.o $(SOPHYAOBJP)piwindowx.o $(SOPHYAOBJP)pixtbase.o $(SOPHYAOBJP)piyfxdrw.o $(SOPHYAOBJP)psfile.o $(SOPHYAOBJP)xdispim.o
+	 rm -f $(SOPHYAOBJP)lut.o $(SOPHYAOBJP)parradapter.o $(SOPHYAOBJP)pi3ddrw.o $(SOPHYAOBJP)pi3dwdg.o $(SOPHYAOBJP)piapplgen.o $(SOPHYAOBJP)piapplx.o $(SOPHYAOBJP)piaxes.o $(SOPHYAOBJP)piaxestools.o $(SOPHYAOBJP)pibargraph.o $(SOPHYAOBJP)pibwdggen.o $(SOPHYAOBJP)pibwdgx.o $(SOPHYAOBJP)picmap.o $(SOPHYAOBJP)picmapgen.o $(SOPHYAOBJP)picmapview.o $(SOPHYAOBJP)picmapx.o $(SOPHYAOBJP)picons.o $(SOPHYAOBJP)picontainergen.o $(SOPHYAOBJP)picontainerx.o $(SOPHYAOBJP)pidrawer.o $(SOPHYAOBJP)pidrawwin.o $(SOPHYAOBJP)pidrwtools.o $(SOPHYAOBJP)pieldrw.o $(SOPHYAOBJP)pierrdisp.o $(SOPHYAOBJP)pievthandler.o $(SOPHYAOBJP)pifilechogen.o $(SOPHYAOBJP)pifilechox.o $(SOPHYAOBJP)pifontgen.o $(SOPHYAOBJP)pifontx.o $(SOPHYAOBJP)pigraph3d.o $(SOPHYAOBJP)pigraphgen.o $(SOPHYAOBJP)pigraphps.o $(SOPHYAOBJP)pigraphuc.o $(SOPHYAOBJP)pigraphx.o $(SOPHYAOBJP)pigratt.o $(SOPHYAOBJP)pigrcoord.o $(SOPHYAOBJP)piimage.o $(SOPHYAOBJP)piimgtools.o $(SOPHYAOBJP)pilineatt.o $(SOPHYAOBJP)pilistgen.o $(SOPHYAOBJP)pilistx.o $(SOPHYAOBJP)pimenubargen.o $(SOPHYAOBJP)pimenubarx.o $(SOPHYAOBJP)pimenugen.o $(SOPHYAOBJP)pimenux.o $(SOPHYAOBJP)pimsghandler.o $(SOPHYAOBJP)pioptmenugen.o $(SOPHYAOBJP)pioptmenux.o $(SOPHYAOBJP)piperiodx.o $(SOPHYAOBJP)pipixmapgen.o $(SOPHYAOBJP)pipixmapx.o $(SOPHYAOBJP)pipixutils.o $(SOPHYAOBJP)pipplist.o $(SOPHYAOBJP)pippmenubar.o $(SOPHYAOBJP)pippoptmenu.o $(SOPHYAOBJP)pippviewadapter.o $(SOPHYAOBJP)piscdrawwdg.o $(SOPHYAOBJP)pistdwdggen.o $(SOPHYAOBJP)pistdwdgx.o $(SOPHYAOBJP)pistzwin.o $(SOPHYAOBJP)pisurfdr.o $(SOPHYAOBJP)pitherm.o $(SOPHYAOBJP)pitxtdrw.o $(SOPHYAOBJP)piup.o $(SOPHYAOBJP)piup_def.o $(SOPHYAOBJP)piupdattachment.o $(SOPHYAOBJP)piwdggen.o $(SOPHYAOBJP)piwdgx.o $(SOPHYAOBJP)piwindowgen.o $(SOPHYAOBJP)piwindowx.o $(SOPHYAOBJP)pixtbase.o $(SOPHYAOBJP)piyfxdrw.o $(SOPHYAOBJP)psfile.o $(SOPHYAOBJP)xdispim.o
 	rm -f $(SOPHYALIBP)libPI.a
  
-$(SOPHYALIBP)libPI.a : $(SOPHYAOBJP)lut.o $(SOPHYAOBJP)parradapter.o $(SOPHYAOBJP)pi3ddrw.o $(SOPHYAOBJP)pi3dwdg.o $(SOPHYAOBJP)piapplgen.o $(SOPHYAOBJP)piapplx.o $(SOPHYAOBJP)piaxes.o $(SOPHYAOBJP)piaxestools.o $(SOPHYAOBJP)pibargraph.o $(SOPHYAOBJP)pibwdggen.o $(SOPHYAOBJP)pibwdgx.o $(SOPHYAOBJP)picmap.o $(SOPHYAOBJP)picmapgen.o $(SOPHYAOBJP)picmapview.o $(SOPHYAOBJP)picmapx.o $(SOPHYAOBJP)picons.o $(SOPHYAOBJP)picontainergen.o $(SOPHYAOBJP)picontainerx.o $(SOPHYAOBJP)pidrawer.o $(SOPHYAOBJP)pidrawwin.o $(SOPHYAOBJP)pidrwtools.o $(SOPHYAOBJP)pieldrw.o $(SOPHYAOBJP)pievthandler.o $(SOPHYAOBJP)pifilechogen.o $(SOPHYAOBJP)pifilechox.o $(SOPHYAOBJP)pifontgen.o $(SOPHYAOBJP)pifontx.o $(SOPHYAOBJP)pigraph3d.o $(SOPHYAOBJP)pigraphgen.o $(SOPHYAOBJP)pigraphps.o $(SOPHYAOBJP)pigraphuc.o $(SOPHYAOBJP)pigraphx.o $(SOPHYAOBJP)pigratt.o $(SOPHYAOBJP)pigrcoord.o $(SOPHYAOBJP)piimage.o $(SOPHYAOBJP)piimgtools.o $(SOPHYAOBJP)pilineatt.o $(SOPHYAOBJP)pilistgen.o $(SOPHYAOBJP)pilistx.o $(SOPHYAOBJP)pimenubargen.o $(SOPHYAOBJP)pimenubarx.o $(SOPHYAOBJP)pimenugen.o $(SOPHYAOBJP)pimenux.o $(SOPHYAOBJP)pimsghandler.o $(SOPHYAOBJP)pioptmenugen.o $(SOPHYAOBJP)pioptmenux.o $(SOPHYAOBJP)piperiodx.o $(SOPHYAOBJP)pipixmapgen.o $(SOPHYAOBJP)pipixmapx.o $(SOPHYAOBJP)piscdrawwdg.o $(SOPHYAOBJP)pistdwdggen.o $(SOPHYAOBJP)pistdwdgx.o $(SOPHYAOBJP)pistzwin.o $(SOPHYAOBJP)pisurfdr.o $(SOPHYAOBJP)pitherm.o $(SOPHYAOBJP)pitxtdrw.o $(SOPHYAOBJP)piwdggen.o $(SOPHYAOBJP)piwdgx.o $(SOPHYAOBJP)piwindowgen.o $(SOPHYAOBJP)piwindowx.o $(SOPHYAOBJP)pixtbase.o $(SOPHYAOBJP)piyfxdrw.o $(SOPHYAOBJP)psfile.o
+$(SOPHYALIBP)libPI.a : $(SOPHYAOBJP)lut.o $(SOPHYAOBJP)parradapter.o $(SOPHYAOBJP)pi3ddrw.o $(SOPHYAOBJP)pi3dwdg.o $(SOPHYAOBJP)piapplgen.o $(SOPHYAOBJP)piapplx.o $(SOPHYAOBJP)piaxes.o $(SOPHYAOBJP)piaxestools.o $(SOPHYAOBJP)pibargraph.o $(SOPHYAOBJP)pibwdggen.o $(SOPHYAOBJP)pibwdgx.o $(SOPHYAOBJP)picmap.o $(SOPHYAOBJP)picmapgen.o $(SOPHYAOBJP)picmapview.o $(SOPHYAOBJP)picmapx.o $(SOPHYAOBJP)picons.o $(SOPHYAOBJP)picontainergen.o $(SOPHYAOBJP)picontainerx.o $(SOPHYAOBJP)pidrawer.o $(SOPHYAOBJP)pidrawwin.o $(SOPHYAOBJP)pidrwtools.o $(SOPHYAOBJP)pieldrw.o $(SOPHYAOBJP)pievthandler.o $(SOPHYAOBJP)pifilechogen.o $(SOPHYAOBJP)pifilechox.o $(SOPHYAOBJP)pifontgen.o $(SOPHYAOBJP)pifontx.o $(SOPHYAOBJP)pigraph3d.o $(SOPHYAOBJP)pigraphgen.o $(SOPHYAOBJP)pigraphps.o $(SOPHYAOBJP)pigraphuc.o $(SOPHYAOBJP)pigraphx.o $(SOPHYAOBJP)pigratt.o $(SOPHYAOBJP)pigrcoord.o $(SOPHYAOBJP)piimage.o $(SOPHYAOBJP)piimgtools.o $(SOPHYAOBJP)pilineatt.o $(SOPHYAOBJP)pilistgen.o $(SOPHYAOBJP)pilistx.o $(SOPHYAOBJP)pimenubargen.o $(SOPHYAOBJP)pimenubarx.o $(SOPHYAOBJP)pimenugen.o $(SOPHYAOBJP)pimenux.o $(SOPHYAOBJP)pimsghandler.o $(SOPHYAOBJP)pioptmenugen.o $(SOPHYAOBJP)pioptmenux.o $(SOPHYAOBJP)piperiodx.o $(SOPHYAOBJP)pipixmapgen.o $(SOPHYAOBJP)pipixmapx.o $(SOPHYAOBJP)pipixutils.o $(SOPHYAOBJP)piscdrawwdg.o $(SOPHYAOBJP)pistdwdggen.o $(SOPHYAOBJP)pistdwdgx.o $(SOPHYAOBJP)pistzwin.o $(SOPHYAOBJP)pisurfdr.o $(SOPHYAOBJP)pitherm.o $(SOPHYAOBJP)pitxtdrw.o $(SOPHYAOBJP)piwdggen.o $(SOPHYAOBJP)piwdgx.o $(SOPHYAOBJP)piwindowgen.o $(SOPHYAOBJP)piwindowx.o $(SOPHYAOBJP)pixtbase.o $(SOPHYAOBJP)piyfxdrw.o $(SOPHYAOBJP)psfile.o
 	$(AR) $(ARFLAGS) $@ $? 
 	touch $(SOPHYAINCP)/SophyaConfInfo/libPI.objlist
  
 $(SOPHYAOBJP)lut.o: lut.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h lut.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h lut.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  lut.cc
  
-$(SOPHYAOBJP)parradapter.o: parradapter.cc \
-  $(SOPHYAINCP)sopnamsp.h parradapter.h \
-  $(SOPHYAINCP)machdefs.h lut.h
+$(SOPHYAOBJP)parradapter.o: parradapter.cc $(SOPHYAINCP)sopnamsp.h \
+  $(SOPHYAINCP)nbtri.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h parradapter.h lut.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  parradapter.cc
  
-$(SOPHYAOBJP)pi3ddrw.o: pi3ddrw.cc $(SOPHYAINCP)sopnamsp.h \
-  pi3ddrw.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigratt.h piaxes.h pieldrw.h pigraph3d.h
+$(SOPHYAOBJP)pi3ddrw.o: pi3ddrw.cc $(SOPHYAINCP)sopnamsp.h pi3ddrw.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pidrawer.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigratt.h piaxes.h \
+  pieldrw.h pigraph3d.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pi3ddrw.cc
  
-$(SOPHYAOBJP)pi3dwdg.o: pi3dwdg.cc $(SOPHYAINCP)sopnamsp.h \
-  pi3dwdg.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pi3ddrw.h pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
-  picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigratt.h piaxes.h pieldrw.h pigraph3d.h \
-  pibwdgx.h pigraphps.h pidrwtools.h pistdwdgx.h pistdwdggen.h pimenux.h \
-  pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \
-  picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
-  pimenubargen.h picons.h
+$(SOPHYAOBJP)pi3dwdg.o: pi3dwdg.cc $(SOPHYAINCP)sopnamsp.h pi3dwdg.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pi3ddrw.h pidrawer.h pibwdggen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
+  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
+  pilineatt.h pipixutils.h pigraphuc.h pievthandler.h psfile.h pigratt.h \
+  piaxes.h pieldrw.h pigraph3d.h pibwdgx.h pigraphps.h pidrwtools.h \
+  pistdwdgx.h pistdwdggen.h pimenux.h pimenugen.h pioptmenux.h \
+  pioptmenugen.h piwindowx.h piwindowgen.h picontainerx.h \
+  picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
+  piconsenum.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pi3dwdg.cc
  
 $(SOPHYAOBJP)piapplgen.o: piapplgen.cc $(SOPHYAINCP)sopnamsp.h \
-  piapplgen.h pimsghandler.h \
-  $(SOPHYAINCP)machdefs.h pisysdep.h \
-  picontainerx.h picontainergen.h piwdgx.h piwdggen.h picolist.h \
-  pimenubarx.h pimenubargen.h pimenux.h pimenugen.h picons.h pistdwdgx.h \
+  piapplgen.h pimsghandler.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pisysdep.h picontainerx.h \
+  picontainergen.h piwdgx.h piwdggen.h picolist.h pimenubarx.h \
+  pimenubargen.h pimenux.h pimenugen.h piconsenum.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piapplgen.cc
+ 
+$(SOPHYAOBJP)piapplx.o: piapplx.cc /sw/include/Xm/Xm.h /sw/include/Xm/XmStrDefs.h \
+  /sw/include/Xm/VirtKeys.h /sw/include/Xm/Transfer.h \
+  /sw/include/Xm/DragDrop.h /sw/include/Xm/DragC.h \
+  /sw/include/Xm/Display.h /sw/include/Xm/DropSMgr.h \
+  /sw/include/Xm/DragIcon.h /sw/include/Xm/DropTrans.h \
+  /sw/include/Xm/DragOverS.h /sw/include/Xm/Primitive.h \
+  /sw/include/Xm/Manager.h /sw/include/Xm/Gadget.h \
+  /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h \
+  $(SOPHYAINCP)sopnamsp.h piapplx.h piapplgen.h \
+  pimsghandler.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pisysdep.h picontainerx.h \
+  picontainergen.h piwdgx.h piwdggen.h picolist.h pimenubarx.h \
+  pimenubargen.h pimenux.h pimenugen.h piconsenum.h picons.h pistdwdgx.h \
   pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
   pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
-  pigraphuc.h pievthandler.h psfile.h pigraphps.h
-	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piapplgen.cc
- 
-$(SOPHYAOBJP)piapplx.o: piapplx.cc $(SOPHYAINCP)sopnamsp.h \
-  piapplx.h piapplgen.h pimsghandler.h \
-  $(SOPHYAINCP)machdefs.h pisysdep.h \
-  picontainerx.h picontainergen.h piwdgx.h piwdggen.h picolist.h \
-  pimenubarx.h pimenubargen.h pimenux.h pimenugen.h picons.h pistdwdgx.h \
-  pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
-  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
-  pigraphuc.h pievthandler.h psfile.h pigraphps.h
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piapplx.cc
  
 $(SOPHYAOBJP)piaxes.o: piaxes.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h piaxes.h pigraphuc.h \
-  pisysdep.h pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigratt.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piaxes.h pigraphuc.h pisysdep.h \
+  pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
+  picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigratt.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piaxes.cc
  
-$(SOPHYAOBJP)piaxestools.o: piaxestools.cc \
-  $(SOPHYAINCP)sopnamsp.h piaxes.h pigraphuc.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pigraphgen.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
-  picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigratt.h \
+$(SOPHYAOBJP)piaxestools.o: piaxestools.cc $(SOPHYAINCP)sopnamsp.h \
+  piaxes.h pigraphuc.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pigraphgen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h pigratt.h \
   piaxestools.h pistdwdgx.h pistdwdggen.h pioptmenux.h pioptmenugen.h \
   pimenux.h pimenugen.h piwindowx.h piwindowgen.h picontainerx.h \
   picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
-  picons.h pibwdgx.h pibwdggen.h pigraphx.h pievthandler.h psfile.h \
-  pigraphps.h piscdrawwdg.h pidrawer.h pieldrw.h
+  piconsenum.h piscdrawwdg.h pibwdgx.h pibwdggen.h pigraphx.h \
+  pievthandler.h psfile.h pigraphps.h pidrawer.h pieldrw.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piaxestools.cc
  
-$(SOPHYAOBJP)pibargraph.o: pibargraph.cc \
-  $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pibargraph.h pisysdep.h \
+$(SOPHYAOBJP)pibargraph.o: pibargraph.cc $(SOPHYAINCP)sopnamsp.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibargraph.h pisysdep.h \
   pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
   picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigratt.h piaxes.h
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h \
+  pievthandler.h psfile.h pigratt.h piaxes.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pibargraph.cc
  
 $(SOPHYAOBJP)pibwdggen.o: pibwdggen.cc $(SOPHYAINCP)sopnamsp.h \
   pibwdggen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pidrawer.h pigratt.h \
-  piaxes.h pigraphps.h pidrwtools.h pistdwdgx.h pistdwdggen.h pimenux.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
+  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pipixutils.h \
+  pigraphuc.h pievthandler.h psfile.h pidrawer.h pigratt.h piaxes.h \
+  pigraphps.h pidrwtools.h pistdwdgx.h pistdwdggen.h pimenux.h \
   pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \
   picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
-  pimenubargen.h picons.h pibwdgx.h
+  pimenubargen.h piconsenum.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pibwdggen.cc
  
-$(SOPHYAOBJP)pibwdgx.o: pibwdgx.cc $(SOPHYAINCP)sopnamsp.h \
-  pixtbaseP.h pibwdgx.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pibwdggen.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
-  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+$(SOPHYAOBJP)pibwdgx.o: pibwdgx.cc $(SOPHYAINCP)sopnamsp.h pixtbaseP.h \
+  pibwdgx.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibwdggen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
+  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pipixutils.h \
   pigraphuc.h pievthandler.h psfile.h pigraphps.h pixtbase.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pibwdgx.cc
  
-$(SOPHYAOBJP)picmap.o: picmap.cc $(SOPHYAINCP)sopnamsp.h \
-  picmap.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  picmapx.h picmapgen.h
+$(SOPHYAOBJP)picmap.o: picmap.cc $(SOPHYAINCP)sopnamsp.h picmap.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h picmapx.h picmapgen.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picmap.cc
  
 $(SOPHYAOBJP)picmapgen.o: picmapgen.cc $(SOPHYAINCP)sopnamsp.h \
   picmapgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  picmapx.h picmap.h
+  $(SOPHYAINCP)osx_values.h picmapx.h picmap.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picmapgen.cc
  
-$(SOPHYAOBJP)picmapview.o: picmapview.cc \
-  $(SOPHYAINCP)sopnamsp.h picmapview.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pibwdgx.h pibwdggen.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)picmapview.o: picmapview.cc $(SOPHYAINCP)sopnamsp.h \
+  picmapview.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibwdgx.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picmapview.cc
  
-$(SOPHYAOBJP)picmapx.o: picmapx.cc $(SOPHYAINCP)sopnamsp.h \
-  piwdgx.h piwdggen.h $(SOPHYAINCP)machdefs.h \
-  pimsghandler.h picolist.h picmapx.h picmapgen.h pisysdep.h
+$(SOPHYAOBJP)picmapx.o: picmapx.cc $(SOPHYAINCP)sopnamsp.h piwdgx.h \
+  piwdggen.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimsghandler.h picolist.h \
+  picmapx.h picmapgen.h pisysdep.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picmapx.cc
  
-$(SOPHYAOBJP)picons.o: picons.cc $(SOPHYAINCP)sopnamsp.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pimenux.h \
-  pimenugen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picons.h \
-  pistdwdgx.h pistdwdggen.h picontainerx.h picontainergen.h pibwdgx.h \
-  pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)picons.o: picons.cc $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimenux.h pimenugen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picons.h pistdwdgx.h pistdwdggen.h \
+  picontainerx.h picontainergen.h pibwdgx.h pibwdggen.h picmap.h \
+  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h pievthandler.h \
+  psfile.h pigraphps.h piconsenum.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picons.cc
  
-$(SOPHYAOBJP)picontainergen.o: picontainergen.cc \
-  $(SOPHYAINCP)sopnamsp.h picontainergen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)picontainergen.o: picontainergen.cc $(SOPHYAINCP)sopnamsp.h \
+  picontainergen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picontainergen.cc
  
-$(SOPHYAOBJP)picontainerx.o: picontainerx.cc \
-  $(SOPHYAINCP)sopnamsp.h picontainerx.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h \
-  picontainergen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)picontainerx.o: picontainerx.cc $(SOPHYAINCP)sopnamsp.h \
+  picontainerx.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h picontainergen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h /sw/include/Xm/Form.h \
+  /sw/include/Xm/BulletinB.h /sw/include/Xm/Xm.h \
+  /sw/include/Xm/XmStrDefs.h /sw/include/Xm/VirtKeys.h \
+  /sw/include/Xm/Transfer.h /sw/include/Xm/DragDrop.h \
+  /sw/include/Xm/DragC.h /sw/include/Xm/Display.h \
+  /sw/include/Xm/DropSMgr.h /sw/include/Xm/DragIcon.h \
+  /sw/include/Xm/DropTrans.h /sw/include/Xm/DragOverS.h \
+  /sw/include/Xm/Primitive.h /sw/include/Xm/Manager.h \
+  /sw/include/Xm/Gadget.h /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  picontainerx.cc
  
 $(SOPHYAOBJP)pidrawer.o: pidrawer.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pidrawer.h pibwdggen.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pidrawer.h pibwdggen.h \
   pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
   picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
-  pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h pigratt.h \
-  piaxes.h pidrwtools.h pistdwdgx.h pistdwdggen.h pimenux.h pimenugen.h \
+  pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h pievthandler.h \
+  psfile.h pigratt.h piaxes.h pidrwtools.h pistdwdgx.h pistdwdggen.h \
+  pimenux.h pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h \
+  piwindowgen.h picontainerx.h picontainergen.h piapplx.h piapplgen.h \
+  pimenubarx.h pimenubargen.h piconsenum.h ucckprot.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pidrawer.cc
+ 
+$(SOPHYAOBJP)pidrawwin.o: pidrawwin.cc $(SOPHYAINCP)sopnamsp.h \
+  pidrawwin.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwindowx.h piwindowgen.h \
+  picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
+  picolist.h piscdrawwdg.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
+  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
+  pilineatt.h pipixutils.h pigraphuc.h pievthandler.h psfile.h \
+  pigraphps.h pistdwdgx.h pistdwdggen.h pidrawer.h pigratt.h piaxes.h \
+  pieldrw.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pidrawwin.cc
+ 
+$(SOPHYAOBJP)pidrwtools.o: pidrwtools.cc $(SOPHYAINCP)sopnamsp.h \
+  pidrwtools.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pistdwdgx.h pistdwdggen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h pimenux.h pimenugen.h \
   pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h picontainerx.h \
   picontainergen.h piapplx.h piapplgen.h pimenubarx.h pimenubargen.h \
-  picons.h pibwdgx.h pigraphps.h ucckprot.h
-	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pidrawer.cc
- 
-$(SOPHYAOBJP)pidrawwin.o: pidrawwin.cc $(SOPHYAINCP)sopnamsp.h \
-  pidrawwin.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwindowx.h piwindowgen.h picontainerx.h picontainergen.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h piscdrawwdg.h pibwdgx.h \
-  pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigraphps.h pistdwdgx.h pistdwdggen.h \
-  pidrawer.h pigratt.h piaxes.h pieldrw.h
-	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pidrawwin.cc
- 
-$(SOPHYAOBJP)pidrwtools.o: pidrwtools.cc \
-  $(SOPHYAINCP)sopnamsp.h pidrwtools.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pistdwdgx.h \
-  pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h pimenux.h \
-  pimenugen.h pioptmenux.h pioptmenugen.h piwindowx.h piwindowgen.h \
-  picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
-  pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h \
-  piscdrawwdg.h pidrawer.h pigratt.h piaxes.h pieldrw.h pi3dwdg.h \
-  pi3ddrw.h pigraph3d.h
+  piconsenum.h pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h \
+  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pipixutils.h \
+  pigraphuc.h pievthandler.h psfile.h piscdrawwdg.h pibwdgx.h pigraphps.h \
+  pidrawer.h pigratt.h piaxes.h pieldrw.h pi3dwdg.h pi3ddrw.h pigraph3d.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pidrwtools.cc
  
 $(SOPHYAOBJP)pieldrw.o: pieldrw.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pieldrw.h pidrawer.h \
-  pibwdggen.h pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigratt.h piaxes.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pieldrw.h pidrawer.h pibwdggen.h \
+  pisysdep.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
+  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h pievthandler.h \
+  psfile.h pigratt.h piaxes.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pieldrw.cc
  
-$(SOPHYAOBJP)pievthandler.o: pievthandler.cc \
-  $(SOPHYAINCP)sopnamsp.h pievthandler.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pimsghandler.h piwdgx.h piwdggen.h picolist.h pigraphx.h pigraphgen.h \
-  picmap.h picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h
+$(SOPHYAOBJP)pievthandler.o: pievthandler.cc $(SOPHYAINCP)sopnamsp.h \
+  pievthandler.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimsghandler.h piwdgx.h \
+  piwdggen.h picolist.h pigraphx.h pigraphgen.h picmap.h picmapx.h \
+  picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pievthandler.cc
  
-$(SOPHYAOBJP)pifilechogen.o: pifilechogen.cc \
-  $(SOPHYAINCP)sopnamsp.h pifilechogen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)pifilechogen.o: pifilechogen.cc $(SOPHYAINCP)sopnamsp.h \
+  pifilechogen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pifilechogen.cc
  
-$(SOPHYAOBJP)pifilechox.o: pifilechox.cc \
-  $(SOPHYAINCP)sopnamsp.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h piapplx.h piapplgen.h \
+$(SOPHYAOBJP)pifilechox.o: pifilechox.cc $(SOPHYAINCP)sopnamsp.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piapplx.h piapplgen.h \
   pimsghandler.h picontainerx.h picontainergen.h piwdgx.h piwdggen.h \
-  picolist.h pimenubarx.h pimenubargen.h pimenux.h pimenugen.h picons.h \
-  pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h \
-  pifilechox.h pifilechogen.h piwindowx.h piwindowgen.h
+  picolist.h pimenubarx.h pimenubargen.h pimenux.h pimenugen.h \
+  piconsenum.h pifilechox.h pifilechogen.h piwindowx.h piwindowgen.h \
+  /sw/include/Xm/FileSB.h /sw/include/Xm/Xm.h /sw/include/Xm/XmStrDefs.h \
+  /sw/include/Xm/VirtKeys.h /sw/include/Xm/Transfer.h \
+  /sw/include/Xm/DragDrop.h /sw/include/Xm/DragC.h \
+  /sw/include/Xm/Display.h /sw/include/Xm/DropSMgr.h \
+  /sw/include/Xm/DragIcon.h /sw/include/Xm/DropTrans.h \
+  /sw/include/Xm/DragOverS.h /sw/include/Xm/Primitive.h \
+  /sw/include/Xm/Manager.h /sw/include/Xm/Gadget.h \
+  /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pifilechox.cc
  
 $(SOPHYAOBJP)pifontgen.o: pifontgen.cc $(SOPHYAINCP)sopnamsp.h \
   pigraphgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
-  picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pifontgen.cc
  
-$(SOPHYAOBJP)pifontx.o: pifontx.cc $(SOPHYAINCP)sopnamsp.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pifontx.h \
-  pifontgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)pifontx.o: pifontx.cc $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pifontx.h pifontgen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pifontx.cc
  
 $(SOPHYAOBJP)pigraph3d.o: pigraph3d.cc $(SOPHYAINCP)sopnamsp.h \
   pigraph3d.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pigraphuc.h pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h
+  $(SOPHYAINCP)osx_values.h pigraphuc.h pigraphgen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
+  picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraph3d.cc
  
-$(SOPHYAOBJP)pigraphgen.o: pigraphgen.cc \
-  $(SOPHYAINCP)sopnamsp.h pigraphgen.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h piwdgx.h piwdggen.h \
+$(SOPHYAOBJP)pigraphgen.o: pigraphgen.cc $(SOPHYAINCP)sopnamsp.h \
+  pigraphgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
   pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h ucckprot.h
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h ucckprot.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraphgen.cc
  
 $(SOPHYAOBJP)pigraphps.o: pigraphps.cc $(SOPHYAINCP)sopnamsp.h \
   pigraphps.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pigraphgen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h psfile.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraphps.cc
+ 
+$(SOPHYAOBJP)pigraphuc.o: pigraphuc.cc $(SOPHYAINCP)sopnamsp.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pigraphuc.h pisysdep.h \
   pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
   picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
-  psfile.h
-	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraphps.cc
- 
-$(SOPHYAOBJP)pigraphuc.o: pigraphuc.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pigraphuc.h pisysdep.h \
-  pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
-  picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
-  ucckprot.h
+  pipixutils.h ucckprot.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraphuc.cc
  
-$(SOPHYAOBJP)pigraphx.o: pigraphx.cc $(SOPHYAINCP)sopnamsp.h \
-  pigraphx.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
-  picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h
+$(SOPHYAOBJP)pigraphx.o: pigraphx.cc $(SOPHYAINCP)sopnamsp.h pigraphx.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pigraphgen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigraphx.cc
  
-$(SOPHYAOBJP)pigratt.o: pigratt.cc $(SOPHYAINCP)sopnamsp.h \
-  pigratt.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
-  picmapx.h picmapgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+$(SOPHYAOBJP)pigratt.o: pigratt.cc $(SOPHYAINCP)sopnamsp.h pigratt.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pigraphgen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h \
   $(SOPHYAINCP)strutilxx.h \
   $(SOPHYAINCP)machdefs.h
@@ -272,163 +303,210 @@
  
 $(SOPHYAOBJP)pigrcoord.o: pigrcoord.cc $(SOPHYAINCP)sopnamsp.h \
-  pigrcoord.h pisysdep.h $(SOPHYAINCP)machdefs.h
+  pigrcoord.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pigrcoord.cc
  
-$(SOPHYAOBJP)piimage.o: piimage.cc $(SOPHYAINCP)sopnamsp.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h piimage.h \
-  parradapter.h lut.h pieldrw.h pidrawer.h pibwdggen.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+$(SOPHYAOBJP)piimage.o: piimage.cc $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piimage.h parradapter.h lut.h \
+  pipixutils.h pieldrw.h pidrawer.h pibwdggen.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
+  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
+  pievthandler.h psfile.h pigratt.h piaxes.h pipixmapx.h pipixmapgen.h \
+  pibwdgx.h pigraphps.h pistdwdgx.h pistdwdggen.h piwindowx.h \
+  piwindowgen.h picontainerx.h picontainergen.h picmapview.h piimgtools.h \
+  pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h piapplx.h piapplgen.h \
+  pimenubarx.h pimenubargen.h piconsenum.h pidrwtools.h piscdrawwdg.h \
+  piyfxdrw.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piimage.cc
+ 
+$(SOPHYAOBJP)piimgtools.o: piimgtools.cc $(SOPHYAINCP)sopnamsp.h \
+  piimgtools.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pistdwdgx.h pistdwdggen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h pioptmenux.h \
+  pioptmenugen.h pimenux.h pimenugen.h piwindowx.h piwindowgen.h \
+  picontainerx.h picontainergen.h piapplx.h piapplgen.h pimenubarx.h \
+  pimenubargen.h piconsenum.h piimage.h parradapter.h lut.h pipixutils.h \
+  pieldrw.h pidrawer.h pibwdggen.h picmap.h picmapx.h picmapgen.h \
   pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
   pigraphuc.h pievthandler.h psfile.h pigratt.h piaxes.h pipixmapx.h \
-  pipixmapgen.h pibwdgx.h pigraphps.h pistdwdgx.h pistdwdggen.h \
-  piwindowx.h piwindowgen.h picontainerx.h picontainergen.h picmapview.h \
-  piimgtools.h pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h \
-  piapplx.h piapplgen.h pimenubarx.h pimenubargen.h picons.h pidrwtools.h \
-  piscdrawwdg.h piyfxdrw.h
-	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piimage.cc
- 
-$(SOPHYAOBJP)piimgtools.o: piimgtools.cc \
-  $(SOPHYAINCP)sopnamsp.h piimgtools.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pistdwdgx.h \
-  pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  pioptmenux.h pioptmenugen.h pimenux.h pimenugen.h piwindowx.h \
-  piwindowgen.h picontainerx.h picontainergen.h piapplx.h piapplgen.h \
-  pimenubarx.h pimenubargen.h picons.h pibwdgx.h pibwdggen.h picmap.h \
-  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
-  pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h \
-  piimage.h parradapter.h lut.h pieldrw.h pidrawer.h pigratt.h piaxes.h \
-  pipixmapx.h pipixmapgen.h picmapview.h
+  pipixmapgen.h pibwdgx.h pigraphps.h picmapview.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piimgtools.cc
  
 $(SOPHYAOBJP)pilineatt.o: pilineatt.cc $(SOPHYAINCP)sopnamsp.h \
-  pilineatt.h pisysdep.h $(SOPHYAINCP)machdefs.h
+  pilineatt.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pilineatt.cc
  
 $(SOPHYAOBJP)pilistgen.o: pilistgen.cc $(SOPHYAINCP)sopnamsp.h \
   pilistgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pilistgen.cc
  
-$(SOPHYAOBJP)pilistx.o: pilistx.cc $(SOPHYAINCP)sopnamsp.h \
-  pilistx.h pilistgen.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h piwdgx.h piwdggen.h \
-  pimsghandler.h picolist.h picontainerx.h picontainergen.h
+$(SOPHYAOBJP)pilistx.o: pilistx.cc $(SOPHYAINCP)sopnamsp.h pilistx.h \
+  pilistgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h picontainerx.h picontainergen.h \
+  /sw/include/Xm/Xm.h /sw/include/Xm/XmStrDefs.h \
+  /sw/include/Xm/VirtKeys.h /sw/include/Xm/Transfer.h \
+  /sw/include/Xm/DragDrop.h /sw/include/Xm/DragC.h \
+  /sw/include/Xm/Display.h /sw/include/Xm/DropSMgr.h \
+  /sw/include/Xm/DragIcon.h /sw/include/Xm/DropTrans.h \
+  /sw/include/Xm/DragOverS.h /sw/include/Xm/Primitive.h \
+  /sw/include/Xm/Manager.h /sw/include/Xm/Gadget.h \
+  /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h /sw/include/Xm/List.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pilistx.cc
  
-$(SOPHYAOBJP)pimenubargen.o: pimenubargen.cc \
-  $(SOPHYAINCP)sopnamsp.h pimenubargen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pimenux.h \
-  pimenugen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h piapplx.h \
-  piapplgen.h picontainerx.h picontainergen.h pimenubarx.h picons.h \
-  pistdwdgx.h pistdwdggen.h pibwdgx.h pibwdggen.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)pimenubargen.o: pimenubargen.cc $(SOPHYAINCP)sopnamsp.h \
+  pimenubargen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimenux.h pimenugen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h piapplx.h piapplgen.h \
+  picontainerx.h picontainergen.h pimenubarx.h piconsenum.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pimenubargen.cc
  
-$(SOPHYAOBJP)pimenubarx.o: pimenubarx.cc \
-  $(SOPHYAINCP)sopnamsp.h pimenubarx.h \
-  pimenubargen.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pimenux.h pimenugen.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h piapplx.h piapplgen.h \
-  picontainerx.h picontainergen.h picons.h pistdwdgx.h pistdwdggen.h \
-  pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h \
-  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)pimenubarx.o: pimenubarx.cc $(SOPHYAINCP)sopnamsp.h \
+  pimenubarx.h pimenubargen.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimenux.h pimenugen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h piapplx.h piapplgen.h \
+  picontainerx.h picontainergen.h piconsenum.h /sw/include/Xm/Xm.h \
+  /sw/include/Xm/XmStrDefs.h /sw/include/Xm/VirtKeys.h \
+  /sw/include/Xm/Transfer.h /sw/include/Xm/DragDrop.h \
+  /sw/include/Xm/DragC.h /sw/include/Xm/Display.h \
+  /sw/include/Xm/DropSMgr.h /sw/include/Xm/DragIcon.h \
+  /sw/include/Xm/DropTrans.h /sw/include/Xm/DragOverS.h \
+  /sw/include/Xm/Primitive.h /sw/include/Xm/Manager.h \
+  /sw/include/Xm/Gadget.h /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h \
+  /sw/include/Xm/RowColumn.h /sw/include/Xm/PushB.h \
+  /sw/include/Xm/ToggleB.h /sw/include/Xm/CascadeB.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pimenubarx.cc
  
 $(SOPHYAOBJP)pimenugen.o: pimenugen.cc $(SOPHYAINCP)sopnamsp.h \
   pimenugen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pimenugen.cc
  
-$(SOPHYAOBJP)pimenux.o: pimenux.cc $(SOPHYAINCP)sopnamsp.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pimenubarx.h \
-  pimenubargen.h pimenux.h pimenugen.h piwdgx.h piwdggen.h pimsghandler.h \
-  picolist.h
+$(SOPHYAOBJP)pimenux.o: pimenux.cc $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimenubarx.h pimenubargen.h \
+  pimenux.h pimenugen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
+  /sw/include/Xm/Xm.h /sw/include/Xm/XmStrDefs.h \
+  /sw/include/Xm/VirtKeys.h /sw/include/Xm/Transfer.h \
+  /sw/include/Xm/DragDrop.h /sw/include/Xm/DragC.h \
+  /sw/include/Xm/Display.h /sw/include/Xm/DropSMgr.h \
+  /sw/include/Xm/DragIcon.h /sw/include/Xm/DropTrans.h \
+  /sw/include/Xm/DragOverS.h /sw/include/Xm/Primitive.h \
+  /sw/include/Xm/Manager.h /sw/include/Xm/Gadget.h \
+  /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h \
+  /sw/include/Xm/RowColumn.h /sw/include/Xm/PushB.h \
+  /sw/include/Xm/ToggleB.h /sw/include/Xm/CascadeB.h \
+  /sw/include/Xm/Separator.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pimenux.cc
  
-$(SOPHYAOBJP)pimsghandler.o: pimsghandler.cc \
-  $(SOPHYAINCP)sopnamsp.h pimsghandler.h \
-  $(SOPHYAINCP)machdefs.h
+$(SOPHYAOBJP)pimsghandler.o: pimsghandler.cc $(SOPHYAINCP)sopnamsp.h \
+  pimsghandler.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pimsghandler.cc
  
-$(SOPHYAOBJP)pioptmenugen.o: pioptmenugen.cc \
-  $(SOPHYAINCP)sopnamsp.h pioptmenugen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pimenux.h \
-  pimenugen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)pioptmenugen.o: pioptmenugen.cc $(SOPHYAINCP)sopnamsp.h \
+  pioptmenugen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimenux.h pimenugen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pioptmenugen.cc
  
-$(SOPHYAOBJP)pioptmenux.o: pioptmenux.cc \
-  $(SOPHYAINCP)sopnamsp.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pioptmenux.h \
-  pioptmenugen.h pimenux.h pimenugen.h piwdgx.h piwdggen.h pimsghandler.h \
-  picolist.h pistdwdgx.h pistdwdggen.h piapplx.h piapplgen.h \
-  picontainerx.h picontainergen.h pimenubarx.h pimenubargen.h picons.h \
-  pibwdgx.h pibwdggen.h picmap.h picmapx.h picmapgen.h pigraphx.h \
-  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)pioptmenux.o: pioptmenux.cc /sw/include/Xm/Xm.h \
+  /sw/include/Xm/XmStrDefs.h /sw/include/Xm/VirtKeys.h \
+  /sw/include/Xm/Transfer.h /sw/include/Xm/DragDrop.h \
+  /sw/include/Xm/DragC.h /sw/include/Xm/Display.h \
+  /sw/include/Xm/DropSMgr.h /sw/include/Xm/DragIcon.h \
+  /sw/include/Xm/DropTrans.h /sw/include/Xm/DragOverS.h \
+  /sw/include/Xm/Primitive.h /sw/include/Xm/Manager.h \
+  /sw/include/Xm/Gadget.h /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h \
+  /sw/include/Xm/PushB.h $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pioptmenux.h pioptmenugen.h \
+  pimenux.h pimenugen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
+  pistdwdgx.h pistdwdggen.h piapplx.h piapplgen.h picontainerx.h \
+  picontainergen.h pimenubarx.h pimenubargen.h piconsenum.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pioptmenux.cc
  
-$(SOPHYAOBJP)piperiodx.o: piperiodx.cc $(SOPHYAINCP)sopnamsp.h \
-  piwdgx.h piwdggen.h $(SOPHYAINCP)machdefs.h \
-  pimsghandler.h picolist.h piperiodx.h \
-  $(SOPHYAINCP)periodic.h \
+$(SOPHYAOBJP)piperiodx.o: piperiodx.cc $(SOPHYAINCP)sopnamsp.h piwdgx.h \
+  piwdggen.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimsghandler.h picolist.h \
+  piperiodx.h $(SOPHYAINCP)periodic.h \
   $(SOPHYAINCP)machdefs.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piperiodx.cc
  
-$(SOPHYAOBJP)pipixmapgen.o: pipixmapgen.cc \
-  $(SOPHYAINCP)sopnamsp.h pipixmapgen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pibwdgx.h \
-  pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
-  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
-  pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
+$(SOPHYAOBJP)pipixmapgen.o: pipixmapgen.cc $(SOPHYAINCP)sopnamsp.h \
+  pipixmapgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibwdgx.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pipixmapgen.cc
  
 $(SOPHYAOBJP)pipixmapx.o: pipixmapx.cc $(SOPHYAINCP)sopnamsp.h \
   pipixmapx.h pipixmapgen.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h pibwdgx.h pibwdggen.h \
-  piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h \
-  picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h \
-  pilineatt.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibwdgx.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pipixmapx.cc
  
-$(SOPHYAOBJP)piscdrawwdg.o: piscdrawwdg.cc \
-  $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h piscdrawwdg.h \
-  pisysdep.h pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
-  picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
+$(SOPHYAOBJP)pipixutils.o: pipixutils.cc pipixutils.h
+	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pipixutils.cc
+ 
+$(SOPHYAOBJP)piscdrawwdg.o: piscdrawwdg.cc $(SOPHYAINCP)sopnamsp.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piscdrawwdg.h pisysdep.h \
+  pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
+  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
+  pifontgen.h pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h \
   pievthandler.h psfile.h pigraphps.h pistdwdgx.h pistdwdggen.h \
   piwindowx.h piwindowgen.h picontainerx.h picontainergen.h pidrawer.h \
   pigratt.h piaxes.h pieldrw.h pidrwtools.h pimenux.h pimenugen.h \
   pioptmenux.h pioptmenugen.h piapplx.h piapplgen.h pimenubarx.h \
-  pimenubargen.h picons.h piaxestools.h
+  pimenubargen.h piconsenum.h piaxestools.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piscdrawwdg.cc
  
-$(SOPHYAOBJP)pistdwdggen.o: pistdwdggen.cc \
-  $(SOPHYAINCP)sopnamsp.h pistdwdggen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h
+$(SOPHYAOBJP)pistdwdggen.o: pistdwdggen.cc $(SOPHYAINCP)sopnamsp.h \
+  pistdwdggen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwdgx.h piwdggen.h \
+  pimsghandler.h picolist.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pistdwdggen.cc
  
-$(SOPHYAOBJP)pistdwdgx.o: pistdwdgx.cc $(SOPHYAINCP)sopnamsp.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h pistdwdgx.h \
-  pistdwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picontainerx.h picontainergen.h
+$(SOPHYAOBJP)pistdwdgx.o: pistdwdgx.cc $(SOPHYAINCP)sopnamsp.h pisysdep.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pistdwdgx.h pistdwdggen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h picontainerx.h \
+  picontainergen.h /sw/include/Xm/Label.h /sw/include/Xm/Xm.h \
+  /sw/include/Xm/XmStrDefs.h /sw/include/Xm/VirtKeys.h \
+  /sw/include/Xm/Transfer.h /sw/include/Xm/DragDrop.h \
+  /sw/include/Xm/DragC.h /sw/include/Xm/Display.h \
+  /sw/include/Xm/DropSMgr.h /sw/include/Xm/DragIcon.h \
+  /sw/include/Xm/DropTrans.h /sw/include/Xm/DragOverS.h \
+  /sw/include/Xm/Primitive.h /sw/include/Xm/Manager.h \
+  /sw/include/Xm/Gadget.h /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h \
+  /sw/include/Xm/PushB.h /sw/include/Xm/ArrowB.h /sw/include/Xm/Text.h \
+  /sw/include/Xm/ToggleB.h /sw/include/Xm/Scale.h \
+  /sw/include/Xm/ScrollBar.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pistdwdgx.cc
  
-$(SOPHYAOBJP)pistzwin.o: pistzwin.cc $(SOPHYAINCP)sopnamsp.h \
-  pistzwin.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  piwindowx.h piwindowgen.h picontainerx.h picontainergen.h piwdgx.h \
-  piwdggen.h pimsghandler.h picolist.h piperiodx.h \
-  $(SOPHYAINCP)periodic.h \
-  $(SOPHYAINCP)machdefs.h psfile.h pifontgen.h \
-  pigraphgen.h picmap.h picmapx.h picmapgen.h pifontx.h pigrcoord.h \
-  pilineatt.h
+$(SOPHYAOBJP)pistzwin.o: pistzwin.cc $(SOPHYAINCP)sopnamsp.h pistzwin.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piwindowx.h piwindowgen.h \
+  picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
+  picolist.h piperiodx.h $(SOPHYAINCP)periodic.h \
+  $(SOPHYAINCP)machdefs.h psfile.h pifontgen.h pigraphgen.h \
+  picmap.h picmapx.h picmapgen.h pifontx.h pigrcoord.h pilineatt.h \
+  pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pistzwin.cc
  
-$(SOPHYAOBJP)pisurfdr.o: pisurfdr.cc $(SOPHYAINCP)sopnamsp.h \
-  pisurfdr.h parradapter.h \
-  $(SOPHYAINCP)machdefs.h lut.h pi3ddrw.h \
+$(SOPHYAOBJP)pisurfdr.o: pisurfdr.cc $(SOPHYAINCP)sopnamsp.h pisurfdr.h \
+  parradapter.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h lut.h pipixutils.h pi3ddrw.h \
   pisysdep.h pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h \
   picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h \
@@ -437,70 +515,93 @@
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pisurfdr.cc
  
-$(SOPHYAOBJP)pitherm.o: pitherm.cc $(SOPHYAINCP)sopnamsp.h \
-  pitherm.h pisysdep.h $(SOPHYAINCP)machdefs.h \
-  pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigraphps.h
+$(SOPHYAOBJP)pitherm.o: pitherm.cc $(SOPHYAINCP)sopnamsp.h pitherm.h \
+  pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pibwdgx.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pipixutils.h pigraphuc.h pievthandler.h psfile.h pigraphps.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pitherm.cc
  
 $(SOPHYAOBJP)pitxtdrw.o: pitxtdrw.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pitxtdrw.h pisysdep.h \
-  pidrawer.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigratt.h piaxes.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pitxtdrw.h pisysdep.h pidrawer.h \
+  pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
+  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h pievthandler.h \
+  psfile.h pigratt.h piaxes.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pitxtdrw.cc
  
-$(SOPHYAOBJP)piwdggen.o: piwdggen.cc $(SOPHYAINCP)sopnamsp.h \
-  piwdggen.h $(SOPHYAINCP)machdefs.h \
-  pimsghandler.h picolist.h picontainergen.h pisysdep.h piwdgx.h \
-  pievthandler.h pigraphx.h pigraphgen.h picmap.h picmapx.h picmapgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h psfile.h
+$(SOPHYAOBJP)piwdggen.o: piwdggen.cc $(SOPHYAINCP)sopnamsp.h piwdggen.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pimsghandler.h picolist.h \
+  picontainergen.h pisysdep.h piwdgx.h pievthandler.h pigraphx.h \
+  pigraphgen.h picmap.h picmapx.h picmapgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h psfile.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piwdggen.cc
  
-$(SOPHYAOBJP)piwdgx.o: piwdgx.cc $(SOPHYAINCP)sopnamsp.h \
+$(SOPHYAOBJP)piwdgx.o: piwdgx.cc /sw/include/Xm/Xm.h /sw/include/Xm/XmStrDefs.h \
+  /sw/include/Xm/VirtKeys.h /sw/include/Xm/Transfer.h \
+  /sw/include/Xm/DragDrop.h /sw/include/Xm/DragC.h \
+  /sw/include/Xm/Display.h /sw/include/Xm/DropSMgr.h \
+  /sw/include/Xm/DragIcon.h /sw/include/Xm/DropTrans.h \
+  /sw/include/Xm/DragOverS.h /sw/include/Xm/Primitive.h \
+  /sw/include/Xm/Manager.h /sw/include/Xm/Gadget.h \
+  /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h /sw/include/Xm/Form.h \
+  /sw/include/Xm/BulletinB.h $(SOPHYAINCP)sopnamsp.h \
   piwdgx.h piwdggen.h $(SOPHYAINCP)machdefs.h \
-  pimsghandler.h picolist.h picontainerx.h pisysdep.h picontainergen.h \
-  pievthandler.h pigraphx.h pigraphgen.h picmap.h picmapx.h picmapgen.h \
-  pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  $(SOPHYAINCP)osx_values.h pimsghandler.h picolist.h \
+  picontainerx.h pisysdep.h picontainergen.h pievthandler.h pigraphx.h \
+  pigraphgen.h picmap.h picmapx.h picmapgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h \
   $(SOPHYAINCP)pexceptions.h \
   $(SOPHYAINCP)machdefs.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piwdgx.cc
  
-$(SOPHYAOBJP)piwindowgen.o: piwindowgen.cc \
-  $(SOPHYAINCP)sopnamsp.h piwindowgen.h \
-  pisysdep.h $(SOPHYAINCP)machdefs.h \
-  picontainerx.h picontainergen.h piwdgx.h piwdggen.h pimsghandler.h \
-  picolist.h psfile.h pifontgen.h pigraphgen.h picmap.h picmapx.h \
-  picmapgen.h pifontx.h pigrcoord.h pilineatt.h
+$(SOPHYAOBJP)piwindowgen.o: piwindowgen.cc $(SOPHYAINCP)sopnamsp.h \
+  piwindowgen.h pisysdep.h $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h picontainerx.h picontainergen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h psfile.h pifontgen.h \
+  pigraphgen.h picmap.h picmapx.h picmapgen.h pifontx.h pigrcoord.h \
+  pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piwindowgen.cc
  
 $(SOPHYAOBJP)piwindowx.o: piwindowx.cc $(SOPHYAINCP)sopnamsp.h \
   piwindowx.h piwindowgen.h pisysdep.h \
-  $(SOPHYAINCP)machdefs.h picontainerx.h \
-  picontainergen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h picontainerx.h picontainergen.h \
+  piwdgx.h piwdggen.h pimsghandler.h picolist.h /sw/include/Xm/Form.h \
+  /sw/include/Xm/BulletinB.h /sw/include/Xm/Xm.h \
+  /sw/include/Xm/XmStrDefs.h /sw/include/Xm/VirtKeys.h \
+  /sw/include/Xm/Transfer.h /sw/include/Xm/DragDrop.h \
+  /sw/include/Xm/DragC.h /sw/include/Xm/Display.h \
+  /sw/include/Xm/DropSMgr.h /sw/include/Xm/DragIcon.h \
+  /sw/include/Xm/DropTrans.h /sw/include/Xm/DragOverS.h \
+  /sw/include/Xm/Primitive.h /sw/include/Xm/Manager.h \
+  /sw/include/Xm/Gadget.h /sw/include/Xm/VendorS.h /sw/include/Xm/XmIm.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piwindowx.cc
  
 $(SOPHYAOBJP)pixtbase.o: pixtbase.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h pixtbaseP.h pibwdgx.h \
-  pisysdep.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h \
-  pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h pievthandler.h psfile.h \
-  pigraphps.h pixtbase.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pixtbaseP.h pibwdgx.h pisysdep.h \
+  pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
+  picmapx.h picmapgen.h pigraphx.h pigraphgen.h pifontx.h pifontgen.h \
+  pigrcoord.h pilineatt.h pipixutils.h pigraphuc.h pievthandler.h \
+  psfile.h pigraphps.h pixtbase.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  pixtbase.cc
  
 $(SOPHYAOBJP)piyfxdrw.o: piyfxdrw.cc $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h piyfxdrw.h pisysdep.h \
-  parradapter.h lut.h pidrawer.h pibwdggen.h piwdgx.h piwdggen.h \
-  pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h pigraphx.h \
-  pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h pigraphuc.h \
-  pievthandler.h psfile.h pigratt.h piaxes.h
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h piyfxdrw.h pisysdep.h \
+  parradapter.h lut.h pipixutils.h pidrawer.h pibwdggen.h piwdgx.h \
+  piwdggen.h pimsghandler.h picolist.h picmap.h picmapx.h picmapgen.h \
+  pigraphx.h pigraphgen.h pifontx.h pifontgen.h pigrcoord.h pilineatt.h \
+  pigraphuc.h pievthandler.h psfile.h pigratt.h piaxes.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  piyfxdrw.cc
  
-$(SOPHYAOBJP)psfile.o: psfile.cc $(SOPHYAINCP)sopnamsp.h \
-  psfile.h $(SOPHYAINCP)machdefs.h pisysdep.h \
-  pifontgen.h pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h \
-  picmap.h picmapx.h picmapgen.h pifontx.h pigrcoord.h pilineatt.h
+$(SOPHYAOBJP)psfile.o: psfile.cc $(SOPHYAINCP)sopnamsp.h psfile.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)osx_values.h pisysdep.h pifontgen.h \
+  pigraphgen.h piwdgx.h piwdggen.h pimsghandler.h picolist.h picmap.h \
+  picmapx.h picmapgen.h pifontx.h pigrcoord.h pilineatt.h pipixutils.h
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  psfile.cc
  
Index: /trunk/SophyaPI/PI/lut.cc
===================================================================
--- /trunk/SophyaPI/PI/lut.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/lut.cc	(revision 3519)
@@ -15,10 +15,7 @@
 /* --Methode-- */
 
-LUT::LUT(double min, double max, unsigned short ncol, int typ, int ntable) 
+LUT::LUT(double min, double max, unsigned short ncol, int typ) 
 {
-int nlev;
-
-bornes=NULL;
-nlev = ncol-2;
+int nlev = ncol-2;
 if (nlev < 1)  nlev = 1;
 bornes = new double[nlev+1];
@@ -39,12 +36,25 @@
 delete[] table;
 }
+/* --Methode-- */
+void LUT::SetNCol(unsigned short ncol)
+{
+if (ncol == NCol())  return;
+double min = Min();
+double max = Max();
+if (bornes) delete[] bornes;
+int nlev = ncol-2;
+if (nlev < 1)  nlev = 1;
+bornes = new double[nlev+1];
+nLevel = nlev;
+SetLut(min, max, Type());
+}
 
 /* --Methode-- */
-void LUT::SetLut(double min, double max, int typ, int ntable)
+void LUT::SetLut(double min, double max, int typ)
 {
 
 if(  (typ != kLutType_Lin)  && (typ != kLutType_Log)
-  && (typ != kLutType_Sqrt) && (typ != kLutType_Square)
-  )  typ = kLutType_Lin;
+  && (typ != kLutType_Sqrt) && (typ != kLutType_Square)  
+  && (typ != kLutType_RGB) )  typ = kLutType_Lin;
 type = typ;
 if (max <= min)  max = min+1.;
@@ -57,4 +67,5 @@
     {
     case kLutType_Lin :
+    case kLutType_RGB :
       dx = (max-min)/(double)nLevel;
       for(i=0; i<nLevel; i++)
@@ -84,5 +95,6 @@
   }
 else  bornes[0] = 0.5*(min+max);
-ComputeTable((ntable > nLevel) ? ntable : tablenbin);
+// ComputeTable((ntable > nLevel) ? ntable : tablenbin);
+ComputeTable(0);
 return; 
 }
@@ -110,4 +122,26 @@
 
 /* --Methode-- */
+unsigned short LUT::ApplyRGB(double x)
+{
+  long lv = x+0.3;
+  double r = (lv%256);
+  lv /= 256;
+  double g = (lv%256);
+  lv /= 256;
+  double b = (lv%256);
+  int qqq = 1;
+  int quantum = 1;
+  for(quantum=2; quantum<=42; quantum++) {
+  	qqq = quantum*quantum*quantum;
+  	if (qqq > NCol())  break;
+  }
+  quantum--;
+  int ir = AppFast(r)*quantum/(NCol());
+  int ig = AppFast(g)*quantum/(NCol());
+  int ib = AppFast(b)*quantum/(NCol());
+  return ((unsigned short)((ib*quantum+ig)*quantum+ir));
+}
+
+/* --Methode-- */
 void LUT::ComputeTable(int nt)
 {
@@ -115,4 +149,5 @@
 else if (nt < (nLevel+2))  nt = (nLevel+2);
 tablenbin = nt;
+if (table) delete[] table;
 table = new unsigned short [nt-2];
 tablebinwidth = (Max()-Min())/(nt-2);
Index: /trunk/SophyaPI/PI/lut.h
===================================================================
--- /trunk/SophyaPI/PI/lut.h	(revision 3518)
+++ /trunk/SophyaPI/PI/lut.h	(revision 3519)
@@ -13,5 +13,5 @@
 
 // Type de lut possibles 
-enum {kLutType_Lin=1, kLutType_Log=2, kLutType_Sqrt=3, kLutType_Square=4};
+enum {kLutType_Lin=1, kLutType_Log=2, kLutType_Sqrt=3, kLutType_Square=4, kLutType_RGB=11 };
 
 class LUT 
@@ -19,16 +19,18 @@
 public:
   
-  LUT(double min, double max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable=0);
+  LUT(double min, double max, unsigned short ncol=16, int typ=kLutType_Lin);
   ~LUT();
-  void SetLut(double min, double max, int typ=kLutType_Lin, int ntable=0);
+  void SetNCol(unsigned short ncol);
+  void SetLut(double min, double max, int typ=kLutType_Lin);
   void Print();
   unsigned short Apply(double x);
+  unsigned short ApplyRGB(double x);
+
   inline unsigned short ApplyFast(double x)
     { 
-    if (x < Min())  return(0);
-    if (x >= Max() )  return(nLevel+1);  
-    int k = (int)((x-Min())/tablebinwidth);
-    return(table[k]); 
+    if (type == kLutType_RGB) return ApplyRGB(x); 
+    else return AppFast(x);	
     } 
+
 
   inline double Min() { return(bornes[0]); };
@@ -37,7 +39,15 @@
   inline int NCol() { return(nLevel+2); };
 
+
 protected:
   void ComputeTable(int nt);
-
+  inline unsigned short AppFast(double x)
+    {
+    if (x < Min())  return(0);
+    if (x >= Max() )  return(nLevel+1);  
+    int k = (int)((x-Min())/tablebinwidth);
+    return(table[k]); 
+    } 
+  	  
   int type;
   int nLevel;
Index: /trunk/SophyaPI/PI/objlist.list
===================================================================
--- /trunk/SophyaPI/PI/objlist.list	(revision 3518)
+++ /trunk/SophyaPI/PI/objlist.list	(revision 3519)
@@ -1,2 +1,3 @@
+copy_pipixmapx.o
 lut.o
 parradapter.o
@@ -48,4 +49,5 @@
 pipixmapgen.o
 pipixmapx.o
+pipixutils.o
 piscdrawwdg.o
 pistdwdggen.o
Index: /trunk/SophyaPI/PI/parradapter.cc
===================================================================
--- /trunk/SophyaPI/PI/parradapter.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/parradapter.cc	(revision 3519)
@@ -174,4 +174,19 @@
 
 /* --Methode-- */
+double  P2DArrayAdapter::MeanVal(int ix1, int ix2, int jy1, int jy2)
+{
+int ec;
+if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
+if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }    
+// On calcule la somme des pixels dans la zone
+double ss = 0.;
+for(int j=jy1; j<=jy2; j++) 
+  for(int i=ix1; i<=ix2; i++)  ss += Value(i,j);
+
+ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
+return ss;  
+}   
+
+/* --Methode-- */
 void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y)
 {
@@ -433,13 +448,11 @@
 
 /* --Methode-- */
-unsigned char * P2DArrayAdapter::ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
-                int xwsz, int ywsz, unsigned char * opix, int * oxsp, int * oysp)
+void P2DArrayAdapter::ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
+                                    int xwsz, int ywsz, PIPixColIdx & pixc)
 {
 // TIMEF ; 
-unsigned char *pix, *pp, ucp;
 int zmm=1;
-int npx, npy, nppx, nppy, nszp, oszp;
+int npx, npy, nppx, nppy;
 int i,j,k,l;
-double vpx;
 
 /*
@@ -448,6 +461,7 @@
 */
 
-if ( (XSize() <= 0) || (YSize() <= 0) || (lut == NULL) || (ofx < 0) || (ofy < 0) ) 
-  { *oxsp = *oysp = 0; return(NULL); }
+if ( (XSize() <= 0) || (YSize() <= 0) || (lut == NULL) || (ofx < 0) || (ofy < 0) ) {
+  pixc.DeAlloc();  return; 
+}
 
 npx = XSize()-ofx;
@@ -471,21 +485,18 @@
   }
 
-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); */
+if (lut->NCol() <= 256) {  // On fait un pixmap de type Byte/pixel 
 /*
-printf("Debug_ComputePixmap %d %d %d (%d-%d %d-%d)\n", 
-      ofx, ofy, zm, npx,nppx, npy,nppy);
-*/
-
-pp = pix;
+printf("Debug_ComputePixmap- pixc.AllocateByte() type=%d - %d %d %d - %d %d %d - %d %d %d \n",
+  lut->Type(), 
+  lut->ApplyFast(0.), lut->ApplyFast(1.), lut->ApplyFast(2.), 
+  lut->ApplyRGB(0.), lut->ApplyRGB(1.), lut->ApplyRGB(2.), 
+  lut->Apply(0.), lut->Apply(1.), lut->Apply(2.));
+*/  
+unsigned char *pp, ucp;
+pixc.AllocateByte(nppx, nppy);
+pp = pixc.BytePointer();
 if (eXY) { // Echange Axe X,Y 
   if (zm == 1)  {  // Pas de zoom  
@@ -497,14 +508,10 @@
     }
   else if (zm < -1) {       // Compression 
-    double fv = (double)(zmm*zmm); 
     for(j=ofy; j<ofy+npy; j+=zmm)
-      for(i=ofx; i<ofx+npx; i+=zmm) {
-        vpx = 0;
-        for(l=0; l<zmm; l++)
-          for(k=0; k<zmm; k++)
-            vpx += this->Value( (j+l)*sgnX+offX, (i+k)*sgnY+offY);
-        *pp = (unsigned char) lut->ApplyFast(vpx/fv); 
+      for(i=ofx; i<ofx+npx; i+=zmm) { 
+        *pp = lut->ApplyFast( MeanVal(j*sgnX+offX, (j+zmm-1)*sgnX+offX, 
+                                      i*sgnY+offY, (i+zmm-1)*sgnY+offY) );
         pp++;
-        }
+      }
     }
   else  {      // Agrandissement
@@ -513,5 +520,5 @@
         ucp = (unsigned char) lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY));
         for(l=0; l<zm; l++)  {
-          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          pp = pixc.BytePointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
           for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
 	  }
@@ -528,14 +535,10 @@
     }
   else if (zm < -1) {       // Compression 
-    double fv = (double)(zmm*zmm); 
     for(j=ofy; j<ofy+npy; j+=zmm)
       for(i=ofx; i<ofx+npx; i+=zmm) {
-        vpx = 0;
-        for(l=0; l<zmm; l++)
-          for(k=0; k<zmm; k++)
-            vpx += this->Value( (i+k)*sgnX+offX, (j+l)*sgnY+offY);
-        *pp = (unsigned char) lut->ApplyFast(vpx/fv); 
+        *pp = lut->ApplyFast( MeanVal(i*sgnX+offX, (i+zmm-1)*sgnX+offX, 
+                                      j*sgnY+offY, (j+zmm-1)*sgnY+offY) );
         pp++;
-        }
+      }
     }
   else  {      // Agrandissement
@@ -544,5 +547,5 @@
         ucp = (unsigned char) lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY));
         for(l=0; l<zm; l++)  {
-          pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          pp = pixc.BytePointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
           for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
 	  }
@@ -550,5 +553,67 @@
     }
   }
-return(pix);
+}  //  ---- Fin pixmap de type Byte
+else {  // On fait un pixmap de type short/pixel 
+// printf("Debug_ComputePixmap- pixc.AllocateShort() \n");
+unsigned short *pp, ucp;
+pixc.AllocateShort(nppx, nppy);
+pp = pixc.ShortPointer();
+if (eXY) { // Echange Axe X,Y 
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->ApplyFast( 
+                this->Value(j*sgnX+offX, i*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) { 
+        *pp = lut->ApplyFast( MeanVal(j*sgnX+offX, (j+zmm-1)*sgnX+offX, 
+                                      i*sgnY+offY, (i+zmm-1)*sgnY+offY) );
+        pp++;
+      }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pixc.ShortPointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }     // Fin du cas avec echange d'axe X/Y 
+else {
+  if (zm == 1)  {  // Pas de zoom  
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++) 
+        { *pp = (unsigned char) lut->ApplyFast( 
+                this->Value(i*sgnX+offX, j*sgnY+offY));  
+           pp++; }
+    }
+  else if (zm < -1) {       // Compression 
+    for(j=ofy; j<ofy+npy; j+=zmm)
+      for(i=ofx; i<ofx+npx; i+=zmm) {
+        *pp = lut->ApplyFast( MeanVal(i*sgnX+offX, (i+zmm-1)*sgnX+offX, 
+                                      j*sgnY+offY, (j+zmm-1)*sgnY+offY) );
+        pp++;
+      }
+    }
+  else  {      // Agrandissement
+    for(j=ofy; j<ofy+npy; j++)
+      for(i=ofx; i<ofx+npx; i++)  {
+        ucp = (unsigned char) lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY));
+        for(l=0; l<zm; l++)  {
+          pp = pixc.ShortPointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);
+          for(k=0; k<zm; k++)  { *pp = ucp; pp++; }  
+	  }
+        }
+    }
+  }
+}  //  ---- Fin pixmap de type Byte
+
+return;
 }
 
Index: /trunk/SophyaPI/PI/parradapter.h
===================================================================
--- /trunk/SophyaPI/PI/parradapter.h	(revision 3518)
+++ /trunk/SophyaPI/PI/parradapter.h	(revision 3519)
@@ -9,4 +9,5 @@
 #include "machdefs.h"
 #include "lut.h"
+#include "pipixutils.h"
 
 #include <string> 
@@ -54,5 +55,7 @@
   virtual void    DefineXYCoordinates(double x0, double y0, double dx, double dy);
 // Doit etre defini par les classes derivees
-  virtual double  Value(int ix, int iy) = 0;   
+  virtual double  Value(int ix, int iy) = 0;
+// Peut etre redefini pour les classes derivees, pour une optimisation par exemple     
+  virtual double  MeanVal(int ix1, int ix2, int jy1, int jy2);   
 
   virtual void    XYfromxy(int ix, int iy, double& x, double& y);
@@ -89,7 +92,6 @@
 
 //    Calcul pixmap avec un LUT
-  virtual unsigned char * ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
-                           int xwsz, int ywsz, unsigned char * opix, 
-                           int * oxsp, int * oysp);
+  virtual void ComputePixmap(LUT* lut, int ofx, int ofy, int zm, 
+                             int xwsz, int ywsz, PIPixColIdx & pixc);
 
 //   Methode de decodage des options - Implementation par defaut ne fait rien
@@ -109,4 +111,6 @@
 };
 
+//  Adaptateur de tableau 1D pour pointeur de type T *
+
 template <class T> 
 class P1DAdapter : public P1DArrayAdapter {
@@ -126,4 +130,5 @@
 
 
+//  Adaptateur de tableau 2D pour pointeur de type T *
 template <class T> 
 class P2DAdapter : public P2DArrayAdapter {
@@ -134,7 +139,19 @@
 
   virtual 	  ~P2DAdapter() { if ( (aDel) && (mData) ) delete[] mData; }
-  virtual double   Value(int ix, int iy) 
+  virtual double  Value(int ix, int iy) 
                     {  if ( (ix < 0)  || (iy < 0) || (ix >= sX) || (iy >= sY) ) return(0.); 
                     return(mData[ix+iy*sX]); }
+  virtual double  MeanVal(int ix1, int ix2, int jy1, int jy2)  
+    {
+    int ec;
+    if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
+    if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }    
+    double ss = 0.;
+    for(int j=jy1; j<=jy2; j++) 
+      for(int i=ix1; i<=ix2; i++)  ss += (double)(mData[i+j*sX]);
+    ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
+    return ss;  
+    }   
+
 protected :
   bool aDel;
@@ -142,4 +159,42 @@
 };
 
+//  Adaptateur de tableau 2D pour tableau RGB 
+
+class P2DPixRGBAdapter : public P2DArrayAdapter {
+public :
+          P2DPixRGBAdapter(PIPixRGBArray * rgbp, bool ad=false) :
+             P2DArrayAdapter(rgbp->XSize(), rgbp->YSize() )
+                { aDel = ad; mPix = rgbp; }
+  virtual ~P2DPixRGBAdapter() { if ( (aDel) && (mPix) ) delete mPix; }
+
+  virtual double  Value(int ix, int iy) 
+    {  
+    if ( (ix < 0)  || (iy < 0) || (ix >= sX) || (iy >= sY) ) return(0.); 
+    PIPixRGB rgb = (*mPix)(ix, iy);
+    return ( ((double)rgb.blue*256.+(double)rgb.green)*256.+(double)rgb.red );
+    }
+  virtual double  MeanVal(int ix1, int ix2, int jy1, int jy2)  
+    {
+    int ec;
+    if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
+    if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }    
+    int r = 0;
+    int g = 0;
+    int b = 0;
+    for(int j=jy1; j<=jy2; j++) 
+      for(int i=ix1; i<=ix2; i++)  {
+      	PIPixRGB rgb = (*mPix)(i, j);
+      	r += rgb.red;  g += rgb.green;   b += rgb.blue; 
+      }
+    int n = (jy2-jy1+1)*(ix2-ix1+1);   
+    r /= n; g /= n; b /= n;
+    return ( ((double)b*256.+(double)g)*256.+(double)r );  
+    }   
+                    
+protected :
+  bool aDel;
+  PIPixRGBArray* mPix;
+};
+
 
 
Index: /trunk/SophyaPI/PI/picmap.cc
===================================================================
--- /trunk/SophyaPI/PI/picmap.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/picmap.cc	(revision 3519)
@@ -24,9 +24,10 @@
 //--
 
-#define  MXMAPIDS   30
+#define  MXMAPIDS   33
 static   int    MapNCols[MXMAPIDS] = {
   256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
   256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 
-  256, 256, 256, 256, 256, 256, 256, 256, 256, 256  };
+  256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
+  216, 512, 4096  };
 
 // Tables de couleurs :
@@ -37,4 +38,7 @@
 // 1 Standard PI 64 couleurs differentes
 // 1 Standard PI 16 couleurs
+// 1 Standard PI , 216 couleurs RGB (6x6x6)
+// 1 Standard PI , 512 couleurs RGB (8x8x8)
+// 1 Standard PI , 4096 couleurs RGB (16x16x16)
 
 static   const char*  MapNoms[MXMAPIDS]  = {
@@ -47,5 +51,5 @@
                       "MIDAS_Stairs9","MIDAS_StairCase","MIDAS_Color",
                       "MIDAS_ManyCol","MIDAS_Idl14","MIDAS_Idl15",
-                      "MultiCol16","MultiCol64"};
+ 		      "MultiCol16","MultiCol64","RGB216CM","RGB512CM","RGB4096CM"};
 
 static   CMapId MapIds[MXMAPIDS] = { 
@@ -58,5 +62,5 @@
                       CMAP_MIDAS_Stairs9, CMAP_MIDAS_StairCase, CMAP_MIDAS_Color, 
                       CMAP_MIDAS_ManyCol, CMAP_MIDAS_Idl14, CMAP_MIDAS_Idl15, 
-                      CMAP_COL16, CMAP_COL64 } ;
+                      CMAP_COL16, CMAP_COL64, CMAP_RGB216, CMAP_RGB512, CMAP_RGB4096, } ;
 
 static   int mColTNums[8192];   // Max 8192 tables differentes pour le moment  
@@ -70,5 +74,6 @@
                                   NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL, 
-                                  NULL, NULL, NULL, NULL, NULL };
+                                  NULL, NULL, NULL, NULL, NULL,
+                                  NULL, NULL, NULL,  };
 
 int  PIColorMap::NumberStandardColorMaps()
@@ -122,6 +127,10 @@
 //|	CMAP_COL64      :  64 Couleurs arcenciel 
 //|	CMAP_OTHER      :  Table non standard 
+//|	CMAP_RGB216     :  216 couleurs, 6x6x6 couleurs en composantes RGB
+//|	CMAP_RGB512     :  512 couleurs, 8x8x8 couleurs en composantes RGB
+//|	CMAP_RGB4096    :  4096 couleurs, 16x16x16 couleurs en composantes RGB
+
 //	Toutes les tables de couleurs standard possèdent 256 cellules de couleurs,
-//	contenant 16 ou 32 ou 128 couleurs distinctes.
+//	contenant 16 ou 32 ou 128 (ou 216) couleurs distinctes, sauf CMAP_RGB512 et CMAP_RGB4096.
 //
 // PIColorMap(string const& nom, int nCol)
@@ -563,4 +572,42 @@
       }
       break;
+
+    case CMAP_RGB216 :
+      i = 0;
+      for(int kb=0; kb<6; kb++) {
+        mycol.blue = (unsigned short)(kb*65535/5);
+        for(int jg=0; jg<6; jg++) { 
+          mycol.green = (unsigned short)(jg*65535/5);
+          for(int ir=0; ir<6; ir++) {
+            mycol.red = (unsigned short)(ir*65535/5);
+            AllocColor(mycol, i);   i++;
+          }
+        }            
+      }
+      mycol.blue = mycol.green =  mycol.red = 65535;
+      for(i=216; i<256; i++)
+        AllocColor(mycol, i);
+      break;
+
+    case CMAP_RGB512 :
+    case CMAP_RGB4096 :
+      {
+      int nlev = 8;
+      if ( mType == CMAP_RGB4096)  nlev = 16;
+      int drgb = 65535/(nlev-1);
+      i = 0;
+      for(int kb=0; kb<8; kb++) {
+        mycol.blue = (unsigned short)(kb*drgb);
+        for(int jg=0; jg<8; jg++) { 
+          mycol.green = (unsigned short)(jg*drgb);
+          for(int ir=0; ir<8; ir++) {
+            mycol.red = (unsigned short)(ir*drgb);
+            AllocColor(mycol, i);   i++;
+          }
+        }            
+      }
+      }
+      break;
+
 //----------------------------------------------------------
 //----------------------------------------------------------
Index: /trunk/SophyaPI/PI/picmap.h
===================================================================
--- /trunk/SophyaPI/PI/picmap.h	(revision 3518)
+++ /trunk/SophyaPI/PI/picmap.h	(revision 3519)
@@ -47,6 +47,10 @@
 
  //  Table simple a 16/64 couleurs 
- CMAP_COL16       = 998,        // 16 Couleurs arcenciel
- CMAP_COL64       = 999         // 64 Couleurs differentes
+ CMAP_COL16       = 991,        // 16 Couleurs arcenciel
+ CMAP_COL64       = 992,         // 64 Couleurs differentes
+ // Table de couleurs RGB 6x6x6=216 couleurs
+ CMAP_RGB216      = 993,        // 216 couleurs avec toutes les nuances RGB
+ CMAP_RGB512      = 994,        // 512 couleurs avec toutes les nuances RGB
+ CMAP_RGB4096     = 995         // 4096 couleurs avec toutes les nuances RGB
  };
 
Index: /trunk/SophyaPI/PI/pigraphgen.h
===================================================================
--- /trunk/SophyaPI/PI/pigraphgen.h	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphgen.h	(revision 3519)
@@ -17,4 +17,5 @@
 
 #include "pilineatt.h"  // Class PILineAtt
+#include "pipixutils.h"  // classes utilitaires pour pixels/RGB ...
 
 
@@ -118,6 +119,6 @@
 				     bool fgline=true);
 
-  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                                int sx, int sy, PIColorMap* cmap)              = 0;
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pix, 
+                                PIColorMap* cmap)                              = 0;
 
 // Modifications attributs graphiques
Index: /trunk/SophyaPI/PI/pigraphps.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphps.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphps.cc	(revision 3519)
@@ -324,11 +324,16 @@
 
 /* --Methode-- */
-void PIGraphicPS::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                            int sx, int sy, PIColorMap* cmap)
-{
+void PIGraphicPS::DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pixc, PIColorMap* cmap) 
+{
+int sx = pixc.XSize();
+int sy = pixc.YSize();
 if ( (sx < 1) || (sy < 1) )  return;
-if ((pix == NULL) || (cmap == NULL)) return;
-if(mPSOut) 
-  mPSOut->Image((double)x, (double)y, (double)sx, (double)sy, sx, sy, pix, cmap);
+if (cmap == NULL) return;
+if(mPSOut) {
+  if (pixc.BytePointer()) 
+    mPSOut->Image((double)x, (double)y, (double)sx, (double)sy, sx, sy, pixc.BytePointer(), cmap);
+  else if (pixc.ShortPointer()) 
+    mPSOut->Image((double)x, (double)y, (double)sx, (double)sy, sx, sy, pixc.ShortPointer(), cmap);
+}
 return;
 }
Index: /trunk/SophyaPI/PI/pigraphps.h
===================================================================
--- /trunk/SophyaPI/PI/pigraphps.h	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphps.h	(revision 3519)
@@ -38,6 +38,5 @@
   virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
   virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
-  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                                int sx, int sy, PIColorMap* cmap);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pix,  PIColorMap* cmap);
 
 // Modifications attributs graphiques
Index: /trunk/SophyaPI/PI/pigraphuc.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphuc.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphuc.cc	(revision 3519)
@@ -729,13 +729,12 @@
 
 /* --Methode-- */
-void PIGraphicUC::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix,
-                        int sx, int sy, PIColorMap* cmap)
-{
-  if (!mGrC) return;
-  if ( (sx < 1) || (sy < 1) )  return;
-  if ((pix == NULL) || (cmap == NULL)) return; 
+void PIGraphicUC::DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pix, PIColorMap* cmap)
+{
+  if (!mGrC) return;
+  if ( (pix.XSize() < 1) || (pix.YSize() < 1) )  return;
+  if (cmap == NULL) return; 
   double xf,yf;
   UC2GrC(x, y, xf, yf);
-  mGrC->DrawPixmap(xf, yf, pix, sx, sy, cmap);
+  mGrC->DrawPixmap(xf, yf, pix, cmap);
 }
 
Index: /trunk/SophyaPI/PI/pigraphuc.h
===================================================================
--- /trunk/SophyaPI/PI/pigraphuc.h	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphuc.h	(revision 3519)
@@ -78,6 +78,5 @@
 				     bool fgline=true);
 
-  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                                int sx, int sy, PIColorMap* cmap);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pix, PIColorMap* cmap);
 
 // Modifications attributs graphiques
Index: /trunk/SophyaPI/PI/pigraphx.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphx.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphx.cc	(revision 3519)
@@ -384,6 +384,5 @@
 
 /* --Methode-- */
-void PIGraphicX::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                            int sx, int sy, PIColorMap* cmap)
+void PIGraphicX::DrawPixmap(PIGrCoord x, PIGrCoord y, PIPixColIdx & pixc, PIColorMap* cmap) 
 {
 Window xw;
@@ -395,6 +394,7 @@
 XImage * ximg;
 
-if ( (sx < 1) || (sy < 1) )  return;
-if ((pix == NULL) || (cmap == NULL)) return; 
+int sx = pixc.XSize();
+int sy = pixc.YSize();
+if ((sx==0) || (sx==0) || (cmap == NULL)) return; 
 
   
@@ -406,5 +406,5 @@
 pad = (depth > 8) ? 32 : 8;
 ximg = XCreateImage (mdsp,DefaultVisual(mdsp,scr),
-                     depth,ZPixmap,0,NULL, sx, sy, pad,0);
+                     depth,ZPixmap,0,NULL, sx,sy, pad,0);
 if (ximg == NULL)  return;
 ximg->data = new char [sy*ximg->bytes_per_line];
@@ -412,7 +412,20 @@
   { XFree(ximg); return; }
 
-for(j=0; j<sy; j++)
-  for(i=0; i<sx; i++)
-    { XPutPixel(ximg, i, j, cmap->Color(*pix) );  pix++; }
+if (pixc.BytePointer()) {
+  unsigned char * pix = pixc.BytePointer();
+  for(j=0; j<sy; j++)
+    for(i=0; i<sx; i++)
+      { XPutPixel(ximg, i, j, cmap->Color(*pix) );  pix++; }
+}
+else if (pixc.ShortPointer()) {
+  unsigned short * pix = pixc.ShortPointer();
+  for(j=0; j<sy; j++)
+    for(i=0; i<sx; i++)
+      { XPutPixel(ximg, i, j, cmap->Color(*pix) );  pix++; }
+}
+else {
+  for(j=0; j<sy; j++)
+    for(i=0; i<sx; i++)  XPutPixel(ximg, i, j, 0 );  
+}
 
 XPutImage(mdsp, xw, DefGC(), ximg, 0, 0, (int)x, (int)y, sx, sy);
Index: /trunk/SophyaPI/PI/pigraphx.h
===================================================================
--- /trunk/SophyaPI/PI/pigraphx.h	(revision 3518)
+++ /trunk/SophyaPI/PI/pigraphx.h	(revision 3519)
@@ -38,6 +38,5 @@
   virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
   virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
-  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 
-                                int sx, int sy, PIColorMap* cmap);
+  virtual void       DrawPixmap(PIGrCoord x, PIGrCoord y,  PIPixColIdx & pix,  PIColorMap* cmap);
 
 // Modifications attributs graphiques
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 3519)
@@ -128,7 +128,4 @@
 cutscw = NULL; 
 
-gpixm = zpixm = pixm = NULL;
-xsgpxm = xszpxm = xspxm = 0;
-ysgpxm = yszpxm = yspxm = 0;
 lut = NULL; 
 offx = offy = 0;
@@ -174,15 +171,12 @@
 PIImage::~PIImage()
 {
-if (pixm) delete pixm;
-if (zpixm) delete zpixm;
 if (zow) 
   {
-  zow->SetPixmap(NULL,0,0);
+  zow->SetPixmap(NULL);
   zow->EraseWindow();
   }
-if (gpixm) delete gpixm;
 if (gvw) 
   {
-  gvw->SetPixmap(NULL,0,0);
+  gvw->SetPixmap(NULL);
   gvw->EraseWindow();
   gvw->SetMsg(0); gvw->SetMsgParent(NULL); 
@@ -256,7 +250,5 @@
 xszpav = yszpav = 1;
 img = pim;
-if (gpixm) delete gpixm;
-gpixm = NULL;
-xsgpxm = ysgpxm = 0;
+gpixm.DeAlloc();
 zmgv = 1;
 
@@ -641,4 +633,5 @@
       else if (opts.substr(4,4) == "sqrt")  typlut=kLutType_Sqrt;
       else if (opts.substr(4,6) == "square")  typlut=kLutType_Square;
+      else if (opts.substr(4,6) == "rgb")  typlut=kLutType_RGB;
       SetLut(AutoLut_No, min, max, typlut, 0, false);
       continue;
@@ -672,5 +665,7 @@
   }
   // Set color map if requested
-  if(fgcmapid || revcmapid) SetColMapId(cmapid,revcmapid,false);
+  if(fgcmapid || revcmapid) 
+    SetColMapId(cmapid,revcmapid,false);  
+
   // Configure axes if requested 
   if (confaxes) ChangeAxesConfiguration(invx, invy, exchxy, false);
@@ -691,4 +686,5 @@
       SetLut(t_al, min_al, max_al, Lut()->Type(), ns_al, false);
   }
+
   return(ndec+ndec2);
 }
@@ -728,4 +724,5 @@
      (cmapid == CMAP_GREY128) || (cmapid == CMAP_GREYINV128))  mdrw->GetGraphicAtt().SetColAtt(PI_Red);
 else mdrw->GetGraphicAtt().SetColAtt(PI_Turquoise);
+if (lut) lut->SetNCol(cmp->NCol());
 PIPixmap::SetColMap(cmp, refr);
 if (refr) { xcurs =  ycurs = -1; }
@@ -742,5 +739,7 @@
      (cmapid == CMAP_GREY128) || (cmapid == CMAP_GREYINV128))  mdrw->GetGraphicAtt().SetColAtt(PI_Red);
 else mdrw->GetGraphicAtt().SetColAtt(PI_Turquoise);
-PIPixmap::SetColMapId(cmapid, revidx, refr);
+PIPixmap::SetColMapId(cmapid, revidx, false);
+if (lut) lut->SetNCol(GetColMap()->NCol());
+if (refr) Refresh();
 if (zow)  zow->SetColMapId(cmapid, revidx, refr);
 if (gvw)  gvw->SetColMapId(cmapid, revidx, refr);
@@ -1111,14 +1110,14 @@
 ywsz = YSize();
 
-pixm = img->ComputePixmap(lut, offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm);
+img->ComputePixmap(lut, offx, offy, zoom, xwsz, ywsz, pixm);
 int xw1, yw1, xw2, yw2;
-xw1 = (xwsz-xspxm)/2;
+xw1 = (xwsz-pixm.XSize())/2;
 if (xw1 < 0) xw1 = 0;
-yw1 = (ywsz-yspxm)/2;
+yw1 = (ywsz-pixm.YSize())/2;
 if (yw1 < 0) yw1 = 0;
-xw2 = xspxm+xw1;
-yw2 = yspxm+yw1;
+xw2 = pixm.XSize()+xw1;
+yw2 = pixm.YSize()+yw1;
 SetDefaultDrawRectangle(xw1, yw1, xw2, yw2, false);
-// printf("--DBG-- ComputePixmap() %d %d $ %d %d :: %d %d , %d %d \n", xwsz, ywsz, xspxm, yspxm, xw1, yw1, xw2, yw2);
+// printf("--DBG-- ComputePixmap() %d %d $ %d %d :: %d %d , %d %d \n", xwsz, ywsz, pixm.XSize(), pixm.YSize(), xw1, yw1, xw2, yw2);
 int x1,y1, x2,y2;
 ofx = xw1;  ofy = yw1;
@@ -1131,5 +1130,5 @@
 // printf("--DBG2-- ComputePixmap() %g %g  %g %g  \n", fx1, fx2, fy1, fy2);
 xcurs = ycurs = -1;
-SetPixmap(pixm, xspxm, yspxm, true, xw1, yw1); 
+SetPixmap(&pixm, true, xw1, yw1); 
 // Refresh();
 return; 
@@ -1174,7 +1173,7 @@
 if (lofy < 0)  lofy = 0;
 
-zpixm = img->ComputePixmap(lut, lofx, lofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);
+img->ComputePixmap(lut, lofx, lofy, zm, xwsz, ywsz, zpixm);
 zow->SetColMap(cmap, false);
-zow->SetPixmap(zpixm, xszpxm, yszpxm); 
+zow->SetPixmap(&zpixm); 
 zow->SetUserData((void *)this, 0);
 // zow->Refresh();
@@ -1203,6 +1202,6 @@
 zmgv = zmx;
 if (zmx > 1)  zmx = -zmx;
-gpixm = img->ComputePixmap(lut, 0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm);
-// printf("DEBUG-ComputeGloVPixmap()  %d-%d , (%d,%d) , %d-%d \n", xwsz, ywsz, zmx, zmy, xsgpxm, ysgpxm);
+img->ComputePixmap(lut, 0, 0, zmx, xwsz, ywsz, gpixm);
+// printf("DEBUG-ComputeGloVPixmap()  %d-%d , (%d,%d) , %d-%d \n", xwsz, ywsz, zmx, zmy, gpixm.XSize(), gpixm.YSize());
 return;
 }
@@ -1215,10 +1214,10 @@
 
 int xw1, yw1, xw2, yw2;
-xw1 = (gvw->XSize()-xsgpxm)/2;
+xw1 = (gvw->XSize()-gpixm.XSize())/2;
 if (xw1 < 0) xw1 = 0;
-yw1 = (gvw->YSize()-ysgpxm)/2;
+yw1 = (gvw->YSize()-gpixm.YSize())/2;
 if (yw1 < 0) yw1 = 0;
-xw2 = xsgpxm+xw1;
-yw2 = ysgpxm+yw1;
+xw2 = gpixm.XSize()+xw1;
+yw2 = gpixm.YSize()+yw1;
 
 if (zoom > 0) zm = zmgv*zoom;
@@ -1242,5 +1241,5 @@
 gvw->AddDrawer(gvdrw, xw1, yw1, xw2, yw2, false); 
 gvw->SetColMap(cmap, false);
-gvw->SetPixmap(gpixm, xsgpxm, ysgpxm, true, xw1, yw1); 
+gvw->SetPixmap(&gpixm, true, xw1, yw1); 
 gvw->SetUserData((void *)this, 0);
 gvw->SetMsg(Msg()+626);
Index: /trunk/SophyaPI/PI/piimage.h
===================================================================
--- /trunk/SophyaPI/PI/piimage.h	(revision 3518)
+++ /trunk/SophyaPI/PI/piimage.h	(revision 3519)
@@ -154,6 +154,5 @@
   bool winovis;   // $CHECK$ Reza A enlever si possible 17/6/96
 // Tableau des pixels principal  
-  unsigned char * pixm;
-  int xspxm, yspxm;
+  PIPixColIdx pixm;
   LUT * lut;
   AutoLutType t_al;   // Si AutoLut et le type lors du dernier appel a SetLut()
@@ -164,11 +163,9 @@
   int zoom;
   PIPixmap * zow;
-  unsigned char * zpixm;
-  int xszpxm, yszpxm;
-// Fenetre pour l'image entiere  
+  PIPixColIdx zpixm;
+// Fenetre pour vue globale de l'image   
   int zmgv;
   PIPixmap * gvw;
-  unsigned char * gpixm;
-  int xsgpxm, ysgpxm;
+  PIPixColIdx gpixm;
   PIElDrawer* gvdrw;
 // Fenetre d'affichage du ColMap
Index: /trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/piimgtools.cc	(revision 3519)
@@ -102,4 +102,5 @@
 mOpt[0]->AppendItem("Sqrt", 1102);
 mOpt[0]->AppendItem("Square", 1103);
+mOpt[0]->AppendItem("RGB", 1104);
 mOpt[0]->SetValue(1100);
 mOpt[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
@@ -190,11 +191,11 @@
 mOptzc[0]->AppendPDMenu(mCasc[1]);
 //  Apres les tables importees de MIDAS
-nsct4 = PIColorMap::NumberStandardColorMaps()-2; // Les reste jusqu'a l'avant derniere
+nsct4 = PIColorMap::NumberStandardColorMaps()-5; // Les reste jusqu'a l'avant derniere
 for(kcc=nsct3; kcc<nsct4; kcc++) 
   mCasc[2]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
 mOptzc[0]->AppendPDMenu(mCasc[2]);
-// Les tables qui restent ( Col16 , ... )
+// Les tables qui restent ( RGB218, Col16 , ... )
 for(kcc=nsct4; kcc<PIColorMap::NumberStandardColorMaps(); kcc++) 
-mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
+  mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
 // On ajoute un CheckItem pour inverser les index de table de couleur
 mOptzc[0]->Menu()->AppendSeparator();
@@ -373,4 +374,5 @@
   else if( (mpii->Lut())->Type() == kLutType_Sqrt )   mOpt[0]->SetValue(1102);
   else if( (mpii->Lut())->Type() == kLutType_Square ) mOpt[0]->SetValue(1103);
+  else if( (mpii->Lut())->Type() == kLutType_RGB )    mOpt[0]->SetValue(1104);
   else                                                mOpt[0]->SetValue(1100);
 }
@@ -388,5 +390,5 @@
 double min, max, del;
 int lauto, typ;
-int typlut[4] = {kLutType_Lin, kLutType_Log, kLutType_Sqrt, kLutType_Square} ; 
+int typlut[5] = {kLutType_Lin, kLutType_Log, kLutType_Sqrt, kLutType_Square, kLutType_RGB } ; 
 AutoLutType alts[13] = { AutoLut_No, 
 			 AutoLut_MeanSigma, AutoLut_MeanSigma, AutoLut_MeanSigma,
Index: /trunk/SophyaPI/PI/pipixmapgen.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/pipixmapgen.cc	(revision 3519)
@@ -8,4 +8,5 @@
 #include "sopnamsp.h"
 #include "pipixmapgen.h"
+
 
 // --------- Methodes de la classe PIPixMap  ----------
@@ -43,7 +44,6 @@
 // long  kind() 
 //	Retourne le type ("=PIPixmap::ClassId")
-// void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true, int ox=0, int oy=0)
-//	Associe un tableau d'index "pix" de taille "sx * sy".
-//	(ox,oy)" définissent  l'offset d'affichage.
+// void  SetPixmap(PIPixColIdx *pixidx, int sx, int sy, bool refr=true, int ox=0, int oy=0)
+//	Associe un tableau d'index de couleur "pixidx". (ox,oy)" définissent  l'offset d'affichage.
 //	Si "refr=true", la méthode "Refresh()" est appelée.
 //--
@@ -87,5 +87,5 @@
 {
 pixmap = NULL;
-nx = ny = 0;
+fgownpmap = false;
 ofx = ofy = 0;
 mPpos[0] = mPpos[0] = 0;
@@ -99,21 +99,41 @@
 {
 delete cmap;
+if (fgownpmap && pixmap) delete pixmap;
 }
 
 /* --Methode-- */
-void PIPixmapGen::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy)
+void PIPixmapGen::SetPixmap(PIPixColIdx *pixidx, bool refr, int ox, int oy)
 {
-pixmap = pix; 
-if (pixmap)
-  {
-  if (sx < 0)  sx = 0;
-  if (sy < 0)  sy = 0;
-  if (ox < 0)  ox = 0;
-  if (oy < 0)  oy = 0;
-  nx = sx; ny = sy;
-  ofx = ox;  ofy = oy;
+if (fgownpmap && pixmap) delete pixmap;
+fgownpmap = false;
+pixmap = pixidx; 
+if (ox < 0)  ox = 0;
+if (oy < 0)  oy = 0;
+ofx = ox;  ofy = oy;
+if (refr) Refresh();   
+}
+
+/* --Methode-- */
+void PIPixmapGen::SetRGBArray(PIPixRGBArray *rgba, CMapId cmapid, bool refr, int ox, int oy)
+{
+if (rgba == NULL) return;
+int quantum = 8;
+if (cmapid == CMAP_RGB216)  quantum = 6;
+else if (cmapid == CMAP_RGB4096) quantum = 16;
+else cmapid = CMAP_RGB512;
+SetColMapId(cmapid, false);
+PIPixColIdx * pixc = new PIPixColIdx;
+pixc->AllocateByte(rgba->XSize(), rgba->YSize());
+for(int j=0; j<rgba->YSize(); j++) 
+  for(int i=0; i<rgba->XSize(); i++) {
+  	PIPixRGB vv = (*rgba)(i,j);
+  	int r = (int)vv.red*quantum/256;
+  	int g = (int)vv.green*quantum/256;
+  	int b = (int)vv.blue*quantum/256;
+    pixc->GetShort(i,j) = (unsigned short)((b*quantum+g)*quantum+r);
   }
-else { ofx = ofy = nx = ny = 0; }
-if (refr) Refresh();   
+SetPixmap(pixc, refr, ox, oy);
+fgownpmap = true;
+return;  
 }
 
Index: /trunk/SophyaPI/PI/pipixmapgen.h
===================================================================
--- /trunk/SophyaPI/PI/pipixmapgen.h	(revision 3518)
+++ /trunk/SophyaPI/PI/pipixmapgen.h	(revision 3519)
@@ -9,5 +9,8 @@
 #include PICMAP_H
 
+#include "pipixutils.h"
+
 #include <list>
+
 
 class PIPixmapGen : public PIBaseWdg
@@ -22,6 +25,7 @@
   virtual long  kind() {return ClassId; }
 
-  virtual void  SetPixmap(unsigned char *pix, int sx, int sy, 
-                          bool refr=true, int ox=0, int oy=0);
+  virtual void  SetPixmap(PIPixColIdx *pixidx, bool refr=true, int ox=0, int oy=0);
+  virtual void  SetRGBArray(PIPixRGBArray *rgba, CMapId cmapid=CMAP_RGB512, 
+                            bool refr=true, int ox=0, int oy=0);
 
   virtual void  SetColMap(PIColorMap* cmp, bool refr=true);
@@ -39,7 +43,7 @@
 
 protected:
-  unsigned char *pixmap;
-  int nx, ny;
-  int ofx, ofy;
+  PIPixColIdx *pixmap;   // Pointeur d'objet PIPixCoIdx, tableau d'index de couleurs, peut etre NULL
+  bool fgownpmap;  // si true -> possede le pixmap et doit le deleter si besoin
+  int ofx, ofy;       // Offset d'affichage 
   PIColorMap* cmap;
 
Index: /trunk/SophyaPI/PI/pipixmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapx.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/pipixmapx.cc	(revision 3519)
@@ -7,4 +7,6 @@
 #include "sopnamsp.h"
 #include "pipixmapx.h"
+#include <iostream>
+using namespace std;
 
 static  GC    mygc;
@@ -31,20 +33,37 @@
 {
 int i,j;
-unsigned char *pp;
-
-if (pixmap)
-  {
-  for(j=0; j<ny; j++)
-    {
-    pp = pixmap+j*nx;
-    for(i=0; i<nx; i++)
-      { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
+int nx = 0;
+int ny = 0;
+if (pixmap!=NULL) {
+  nx = pixmap->XSize();
+  if (nx > XSize())  nx = XSize();
+  ny = pixmap->YSize();
+  if (ny > YSize())  ny = YSize();
+  if (pixmap->BytePointer()!=NULL) {
+    unsigned char *pp = pixmap->BytePointer();
+    for(j=0; j<ny; j++) {
+      pp = pixmap->BytePointer()+j*pixmap->XSize();
+      for(i=0; i<nx; i++)
+        { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
+      }
+  }
+  else if (pixmap->ShortPointer()!=NULL) {
+    unsigned short *pp = pixmap->ShortPointer();
+    for(j=0; j<ny; j++) {
+      pp = pixmap->ShortPointer()+j*pixmap->XSize();
+      for(i=0; i<nx; i++)  
+        { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
     }
   }
-
+}
+/* ----- On peut laisser le reste - ce n'est pas utilise dans le Draw
+// On remplit le restant 
+for(j=0; j<YSize(); j++)
+  for(i=nx; i<XSize(); i++)
+       XPutPixel(myximg, i, j, 0 );
 for(j=ny; j<YSize(); j++)
-  for(i=nx; i<XSize(); i++)
+  for(i=0; i<XSize(); i++)
      XPutPixel(myximg, i, j, 0 );
-
+------- */
 PIBaseWdgX::Refresh();
 }
@@ -66,5 +85,5 @@
 if (!g) return; 
 if (g->kind() == PI_PSFileGraphics ) {
-    g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
+    g->DrawPixmap(ofx, ofy, pixmap, cmap);
     //  Il faut faire quelque chose Sinon ??! 
   }
@@ -78,19 +97,26 @@
 
 if (!g) return; 
-if ((myximg == NULL) || (cmap == NULL)) return;
 
 if (g->kind() == PI_PSFileGraphics ) {
-  if (pixmap) g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
+  g->DrawPixmap(ofx, ofy, (*pixmap), cmap);
   return;
   }
+  
 
 Window xw = XtWindow(XtWdg());
 Display * mdsp = PIXDisplay();
 
+if ((myximg == NULL) || (cmap == NULL) || (pixmap == NULL) ||
+    (pixmap->XSize()<=0) || (pixmap->YSize()<=0) ) {
+  XClearArea(mdsp, xw, x0, y0, dx, dy, False);  return; 
+}
+
 int mx, my, ox, oy;
 
 if (x0 < 0)  x0 = 0;
 if (y0 < 0)  y0 = 0;
-mx = nx+ofx;   my = ny+ofy;
+
+mx = pixmap->XSize()+ofx;   my = pixmap->YSize()+ofy;
+
 if (dx > (XSize()-x0)) dx = XSize()-x0;
 if (dy > (YSize()-y0)) dy = YSize()-y0;
@@ -101,5 +127,4 @@
 
 ox = oy = 0;  
-
 if (ofx > x0)
   { XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False);   
@@ -115,5 +140,26 @@
 if (my < (y0+dy))
   { XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False);  dy = my-y0; }
+
+/*
+if (ofx > x0)
+  XClearArea(mdsp, xw, x0, y0, ofx-x0, dy, False);   
+if (ofy > y0)
+  XClearArea(mdsp, xw, x0, y0, dx, ofy-y0, False);  
  
+if (mx < (x0+dx))
+  XClearArea(mdsp, xw, mx, y0, x0+dx-mx, dy, False); 
+if (my < (y0+dy))
+  XClearArea(mdsp, xw, x0, my, dx, y0+dy-my, False);  
+
+if (ofx > x0)
+  { dx -= (ofx-x0);  x0 = ofx;  ox = 0; }
+else  ox = x0-ofx;
+if (ofy > y0)
+  { dy -= (ofy-y0);  y0 = ofy;  oy = 0; }
+else  oy = y0-ofy;
+if (mx < (x0+dx))  dx = mx-x0;
+if (my < (y0+dy))  dy = my-y0;
+*/
+  
 XPutImage(mdsp, xw, mygc, myximg, ox, oy, x0, y0, dx, dy);
 XFlush(mdsp);
Index: /trunk/SophyaPI/PI/pipixutils.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixutils.cc	(revision 3519)
+++ /trunk/SophyaPI/PI/pipixutils.cc	(revision 3519)
@@ -0,0 +1,108 @@
+// Module PI : Peida Interactive     PIPixmap
+// Classes utilitaires pour representation de pixels et couleurs RGB pour PI
+//                             R. Ansari  09/2008
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+using namespace std;
+
+#include "pipixutils.h"
+
+//++
+// Class	PIPixColIdx
+// Lib		PI
+// include	pipixmapgen.h
+//
+//   	Classe auxiliaire de gestion d'index de couleurs pour les pixmap,
+//	organise en interne en byte ou short.
+//--
+
+PIPixColIdx::PIPixColIdx()
+{
+  pix8 = NULL;
+  pix16 = NULL;
+  sx_ = sy_ = 0;
+}
+
+PIPixColIdx::~PIPixColIdx()
+{
+  if (pix8)  delete[] pix8;
+  if (pix16)  delete[] pix16;
+}
+
+void PIPixColIdx::AllocateByte(int sx, int sy)
+{
+  size_t osz = sx_*sy_;
+  if (sx<=0)  sx=sy=0;
+  else if (sy<=0)  sx=sy=0;
+  sx_ = sx; sy_ = sy; 
+  if (pix16)  delete[] pix16;
+  pix16 = NULL;
+  size_t nsz = sx_*sy_;
+  if (pix8) {
+    if (osz == nsz) return;
+    delete[] pix8;   pix8 = NULL;
+  }
+  if ((nsz > 0)&&(pix8==NULL)) {
+    pix8 = new unsigned char[nsz];
+  }
+}
+
+void PIPixColIdx::AllocateShort(int sx, int sy)
+{
+  size_t osz = sx_*sy_;
+  if (sx<=0)  sx=sy=0;
+  else if (sy<=0)  sx=sy=0;
+  sx_ = sx; sy_ = sy; 
+  if (pix8)  delete[] pix8;
+  pix8 = NULL;
+  size_t nsz = sx_*sy_;
+  if (pix16) {
+    if (osz == nsz) return;
+    delete[] pix16;   pix16 = NULL;
+  }
+  if ((nsz > 0)&&(pix16==NULL)) 
+    pix16 = new unsigned short[nsz];
+}
+
+
+//++
+// Class	PIPixRGBArray
+// Lib		PI
+// include	pipixmapgen.h
+//
+//   	Classe auxiliaire de gestion tableau representant des pixels RGB,
+//	chaque composante codee en 8 bits (unsigned char)
+//--
+
+PIPixRGBArray::PIPixRGBArray(int sx, int sy)
+{
+  if (sx < 0) sx = 0;
+  if (sy < 0) sy = 0;
+  sx_ = sx;  sy_ = sy;	
+  size_t sz = sx_*sy_;
+  if (sz>0) rgbpix_ = new PIPixRGB[sz];
+  else rgbpix_ = NULL;  
+}
+
+PIPixRGBArray::PIPixRGBArray(const char * filename)
+{
+  sx_ = sy_ = 0;
+  rgbpix_ = NULL; 
+  // lecture fichier a faire 	
+}
+
+PIPixRGBArray::~PIPixRGBArray()
+{
+  if (rgbpix_) delete[] rgbpix_;	
+}
+
+void PIPixRGBArray::SaveToFile(const char * filename)
+{
+  // ECRIRE fichier A FAIRE
+  return;	
+}
+
+
Index: /trunk/SophyaPI/PI/pipixutils.h
===================================================================
--- /trunk/SophyaPI/PI/pipixutils.h	(revision 3519)
+++ /trunk/SophyaPI/PI/pipixutils.h	(revision 3519)
@@ -0,0 +1,82 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Classes utilitaires pour representation de pixels et couleurs RGB pour PI
+//                             R. Ansari  09/2008
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#ifndef PIPIXUTILS_H_SEEN
+#define PIPIXUTILS_H_SEEN
+
+// =======  Classes utilitaires pour PIPixmap / PIImage =====
+// 
+// Definition d'un tableau pour gerer des index de couleurs en 8 bits / 16 bits
+// 
+class PIPixColIdx 
+{
+public:
+  PIPixColIdx();
+  ~PIPixColIdx();
+  inline int XSize() { return sx_; }
+  inline int YSize() { return sy_; }
+
+  void AllocateByte(int sx, int sy);
+  void AllocateShort(int sx, int sy);
+  inline void DeAlloc() { AllocateByte(0,0); }
+
+  inline unsigned char GetByte(int i, int j) const 
+    { return pix8[j*sx_+i]; }
+  inline unsigned char & GetByte(int i, int j)  
+    { return pix8[j*sx_+i]; }
+
+  inline unsigned short GetShort(int i, int j) const 
+    { return pix16[j*sx_+i]; }
+  inline unsigned short & GetShort(int i, int j)  
+    { return pix16[j*sx_+i]; }
+    
+  inline unsigned char* BytePointer() { return pix8; }
+  inline unsigned short* ShortPointer() { return pix16; }
+
+protected:
+  unsigned char * pix8;
+  unsigned short * pix16;
+  int sx_, sy_;
+};
+
+
+// 
+// Definition de pixel et tableau de pixel RGB de 8 bits (byte)
+// 
+
+// Cette structure DOIT avoir la taille d'un entier de 4 bytes
+struct PIPixRGB {
+  unsigned char red;
+  unsigned char green;
+  unsigned char blue;
+  unsigned char alpha;  // non utilise pour le moment 	
+};
+ 
+class PIPixRGBArray
+{
+public:	
+  PIPixRGBArray(int sx, int sy);
+  PIPixRGBArray(const char * filename);
+  ~PIPixRGBArray();
+  
+  inline int XSize() { return sx_; }
+  inline int YSize() { return sy_; }
+
+  inline PIPixRGB operator()(int i, int j) const
+    { return rgbpix_[j*sx_+i]; }
+  inline PIPixRGB& operator()(int i, int j) 
+    { return rgbpix_[j*sx_+i]; }
+ 
+  void SaveToFile(const char * filename);
+    
+protected:
+  PIPixRGB * rgbpix_;  
+  int sx_, sy_;  
+};
+
+
+#endif   /* PIPIXUTILS_H_SEEN */
+
+
Index: /trunk/SophyaPI/PI/psfile.cc
===================================================================
--- /trunk/SophyaPI/PI/psfile.cc	(revision 3518)
+++ /trunk/SophyaPI/PI/psfile.cc	(revision 3519)
@@ -1367,6 +1367,46 @@
     for(i = 0; i < Ny; i++) {
 	for(j = 0; j<Nx-1; j++ )
-	    fprintf(mPSFile, "%02X", Pict[i*Nx+j]);
-    fprintf(mPSFile, "%02X\n", Pict[i*Nx+j]);
+	    fprintf(mPSFile, "%02X", (int)Pict[i*Nx+j]);
+    fprintf(mPSFile, "%02X\n", (int)Pict[i*Nx+j]);
+    }
+    /* Un petit grestore ...*/
+    fprintf(mPSFile, "gr\n");
+}
+
+void PSFile::Image(double x0, double y0, double Tx, double Ty,
+		   int Nx, int Ny,
+		   unsigned short *Pict, 
+		   PIColorMap *mMap) {
+
+    int i, j;
+
+    /* Buffers PostScript */
+    fprintf(mPSFile, "/Taille %d def\n", Nx);
+    fprintf(mPSFile, "/ImStr Taille string def\n");
+    fprintf(mPSFile, "/RGBStr Taille 3  mul string def\n");
+
+    /* Ecriture ColorMap */
+    fprintf(mPSFile, "/ColorMap %05d array def\n", mMap->NCol() );
+    for(i = 0; i < mMap->NCol(); i++) {
+	fprintf(mPSFile, "ColorMap %d [16#%02X 16#%02X 16#%02X] put\n",
+		i,
+		(int)(mMap->GetColor(i).red/256),
+		(int)(mMap->GetColor(i).green/256),
+		(int)(mMap->GetColor(i).blue/256));
+    }
+    /* Emplacement de l'image */
+    fprintf(mPSFile, "gs %.2f Ux %.2f Uy tr %.2f Ux %.2f Uy sc\n", x0, y0, Tx, Ty);
+    /* Nbr pix-X, Nbr pix-Y bits/pixels */
+    fprintf(mPSFile, "%d %d 16\n", Nx, Ny);
+    /* Matrice de passage */
+    fprintf(mPSFile, "[%d 0 0 %d 0 0]", Nx, Ny);
+    /* Fonction colorimage */
+    fprintf(mPSFile, "{currentfile ImStr readhexstring pop GetRGB}\
+false 3 colorimage\n\n");
+    /* Data */
+    for(i = 0; i < Ny; i++) {
+	for(j = 0; j<Nx-1; j++ )
+	    fprintf(mPSFile, "%04X", (int)Pict[i*Nx+j]);
+    fprintf(mPSFile, "%04X\n", (int)Pict[i*Nx+j]);
     }
     /* Un petit grestore ...*/
Index: /trunk/SophyaPI/PI/psfile.h
===================================================================
--- /trunk/SophyaPI/PI/psfile.h	(revision 3518)
+++ /trunk/SophyaPI/PI/psfile.h	(revision 3519)
@@ -165,4 +165,8 @@
 			unsigned char *pict,
 			PIColorMap *mColorMap);
+    virtual void  Image(double x0, double y0, double Tx, double Ty,
+			int Nx, int Ny,
+			unsigned short *pict,
+			PIColorMap *mColorMap);
 
 // Declarations en public - sinon certains compilateurs cxx , aCC, xlC ont des problemes
