Index: /trunk/SophyaPI/PI/piapplmac.cc
===================================================================
--- /trunk/SophyaPI/PI/piapplmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/piapplmac.cc	(revision 64)
@@ -11,4 +11,16 @@
 #include <SIOUX.h>
 #include <LAttachment.h>
+
+class PIInit {
+public:
+  PIInit() {
+    SIOUXSettings.initializeTB = false;
+    SIOUXSettings.standalone = false;
+    SIOUXSettings.setupmenus = false;
+    SIOUXSettings.showstatusline = true;
+  }
+};
+
+PIInit piInit;
 
 class PISIOUXAttachment : public LAttachment {
@@ -52,4 +64,8 @@
 	new LGrowZone(20000);			// Install a GrowZone function to catch
 									//    low memory situations.
+									
+		// Register functions to create core PowerPlant classes
+	
+	RegisterAllPPClasses();
 
 	macAppli = new PIPPApplMac;
@@ -57,5 +73,5 @@
 	
     menubar = new PIMenubar(this, "DefMenubar");
-    topcont = new PIWindowMac(this, "TopLevel", PIWindowKind(2), sx, sy, 10, 45);
+    topcont = new PIWindowMac(this, "TopLevel", PIWK_floating, sx, sy, 10, 45);
 }
 
Index: /trunk/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pibwdgmac.cc	(revision 64)
@@ -69,4 +69,22 @@
 }
 
+/* --Methode-- */
+void PIBaseWdgMac::DrawOpaqueString(int x, int y, char* s, int /*pos*/)
+{
+  if (mPane->FocusDraw()) {
+    LocalToMacPortPoint(x, y, x, y);
+    ::MoveTo(x, y);
+    LStr255 ps = s;
+    ::TextFont(applFont);
+	Rect box;
+	box.left = x;
+	box.bottom = y;
+	int iWidth = TextWidth(s,0,strlen(s));
+	box.right = box.left + iWidth;
+	int z;
+	box.top = box.bottom + GetFontHeight(z,z);
+    ::TETextBox(s,strlen(s),&box,teForceLeft);
+  }
+}
 
 /* --Methode-- */
@@ -518,2 +536,46 @@
 
 
+
+void PIBaseWdgMac::DrawPixmap(int x, int y, unsigned char *pix, 
+                            int sx, int sy, PIColorMap* cmap)
+{
+  Rect	frame;
+  SetRect(&frame, 0, 0, sx, sy);
+  Rect dstFrame;
+  SetRect(&dstFrame, x, y, sx, sy);
+  GWorldPtr gWorld;
+  ThrowIfOSErr_(NewGWorld(&gWorld, 8, &frame, cmap->GetCTab(), nil, 0));
+  PixMapHandle pmh = GetGWorldPixMap(gWorld);
+  ::LockPixels (pmh);
+  Ptr pmap = GetPixBaseAddr(pmh);
+  memcpy(pmap, pix, sx*sy);
+  ::ForeColor (blackColor);
+  ::BackColor (whiteColor);
+  ::CopyBits((BitMap *) (*pmh),
+				&mPane->GetMacPort()->portBits,
+				&frame, &dstFrame, srcCopy, nil);
+  ::UnlockPixels (pmh);
+  DisposeGWorld(gWorld);
+}
+
+void PIBaseWdgMac::SetClipRectangle(int x0, int y0, int dx, int dy)
+{  // $CHECK$
+}
+
+void PIBaseWdgMac::ClearClipRectangle()
+{ // $CHECK$
+}
+
+/* --Methode-- */
+int PIBaseWdgMac::GetFontHeight(int& asc, int& desc)   
+{
+  if (mPane->FocusDraw()) {
+    FontInfo info;
+    GetFontInfo(&info);
+    asc = info.ascent;
+    desc = info.descent;
+    return (asc + desc);
+  } else {
+    return 0;
+  }
+}
Index: /trunk/SophyaPI/PI/pibwdgmac.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdgmac.h	(revision 63)
+++ /trunk/SophyaPI/PI/pibwdgmac.h	(revision 64)
@@ -37,4 +37,7 @@
   virtual void       DrawMarker(int x0, int y0);
   virtual void       DrawMarkers(int *x, int *y, int n);
+  
+  virtual void       DrawPixmap(int x, int y, unsigned char *pix, 
+                            int sx, int sy, PIColorMap* cmap);
 
   virtual int        CalcStringWidth(char const* s);  
@@ -50,4 +53,7 @@
   virtual void       SelMarker(int msz, PIMarker mrk=PI_DotMarker);
 
+// Selection de zone de trace (clip)
+  virtual void       SetClipRectangle(int x0, int y0, int dx, int dy);
+  virtual void       ClearClipRectangle();
 
 // Acces aux attributs graphiques 
@@ -61,4 +67,5 @@
   virtual PIMarker   GetMarker();
   virtual int        GetMarkerSize();
+  virtual int        GetFontHeight(int& asc, int& desc);
 
 
Index: /trunk/SophyaPI/PI/picmapgen.h
===================================================================
--- /trunk/SophyaPI/PI/picmapgen.h	(revision 63)
+++ /trunk/SophyaPI/PI/picmapgen.h	(revision 64)
@@ -28,5 +28,5 @@
   virtual void FreeColors()=0;     // Desalloue les couleurs
 
-  virtual int   TotNbColors()=0;    // Donne le nombre total de couleurs disponibles
+  virtual long   TotNbColors()=0;   // Donne le nombre total de couleurs disponibles
   virtual int   NbAllocColors()=0;  // Nb de couleurs deja allouees 
 protected:
Index: /trunk/SophyaPI/PI/picmapmac.cc
===================================================================
--- /trunk/SophyaPI/PI/picmapmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/picmapmac.cc	(revision 64)
@@ -2,19 +2,22 @@
 #include <UDebugging.h>
 
-PIColorMapMac::PIColorMapMac(CMapId id)
-: PIColorMapGen(id), mPalette(NULL), mCTab(NULL)
+static int NTotAllocCol;
+
+
+PIColorMapMac::PIColorMapMac()
+: PIColorMapGen(), mPalette(NULL), mCTab(NULL)
 {
 }
 
-PIColorMapMac::PIColorMapMac(CMapId id, int i)       // Fait une veritable allocation
-: PIColorMapGen(id,i)
+PIColorMapMac::PIColorMapMac(int id, int nc, string const& nom) 
+: PIColorMapGen(id, nc, nom)
 {
-    int n = nCols[id-1];
+    int n = nc+2;
 	mCTab = (CTabHandle) ::NewHandle(sizeof(long) + 
 				sizeof(short) + sizeof(short) + 
-				256L*sizeof(ColorSpec));
+				n*sizeof(ColorSpec));
 	(**mCTab).ctFlags = 0;
 	(**mCTab).ctSeed = GetCTSeed();
-	(**mCTab).ctSize = n+2;
+	(**mCTab).ctSize = n;
     ColorSpec* sp = (**mCTab).ctTable;
     sp[0].rgb.red   = 0;
@@ -26,25 +29,17 @@
     sp[1].rgb.blue  = 65535;
     sp[1].value     = 1;
+    for (int i=2; i<n; i++) {
+      sp[i].rgb.red   = 0;
+      sp[i].rgb.green = 0;
+      sp[i].rgb.blue  = 0;
+      sp[i].value     = i;
+    }
+  mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
 }
 
-
-PIColorMapMac::PIColorMapMac(string const& nom, int nCol)
-: PIColorMapGen(nom, nCol)
+PIColorMapMac::~PIColorMapMac()
 {
-	mCTab = (CTabHandle) ::NewHandle(sizeof(long) + 
-				sizeof(short) + sizeof(short) + 
-				256L*sizeof(ColorSpec));
-	(**mCTab).ctFlags = 0;
-	(**mCTab).ctSeed = GetCTSeed();
-	(**mCTab).ctSize = nCol+2;
-    ColorSpec* sp = (**mCTab).ctTable;
-    sp[0].rgb.red   = 0;
-    sp[0].rgb.green = 0;
-    sp[0].rgb.blue  = 0;
-    sp[0].value     = 0;
-    sp[1].rgb.red   = 65535;
-    sp[1].rgb.green = 65535;
-    sp[1].rgb.blue  = 65535;
-    sp[1].value     = 1;
+  DisposePalette(mPalette);
+  DisposeHandle((Handle)mCTab);
 }
 
@@ -58,8 +53,10 @@
   return(picr);
 
-ColorSpec& sp = (**mCTab).ctTable[n+2];
-picr.red   = sp.rgb.red;
-picr.green = sp.rgb.green;
-picr.blue  = sp.rgb.blue;
+RGBColor qdCol;
+GetEntryColor(mPalette,n+2,&qdCol);
+
+picr.red   = qdCol.red;
+picr.green = qdCol.green;
+picr.blue  = qdCol.blue;
 
 return(picr);
@@ -69,16 +66,26 @@
 bool PIColorMapMac::AllocColor(PIColor const& col, int index)
 {
-  ColorSpec& sp = (**mCTab).ctTable[index+2];
-  sp.rgb.red   = col.red;
-  sp.rgb.green = col.green;
-  sp.rgb.blue  = col.blue;
-  sp.value     = index+2;
+  if (!mPalette) return false;
+  if ((index < 0) || (index > mNCol))  return(false);
+  
+  RGBColor srcRGB;
+  srcRGB.red   = col.red;
+  srcRGB.green = col.green;
+  srcRGB.blue  = col.blue;
+  
+  SetEntryColor(mPalette,index+2,&srcRGB);
+  ((**mCTab).ctTable)[index+2].rgb = srcRGB;
+  NTotAllocCol++;
   return true;    //  $CHECK$  retourne true si OK - Reza 01/12/97
 }
 
-void PIColorMapMac::MakeColMap()
+long PIColorMapMac::TotNbColors()
 {
-  PIColorMapGen::MakeColMap();
-  mPalette = NewPalette(mNCol,mCTab,pmTolerant,0);
+   PixMapHandle pmh = ((CGrafPort*)qd.thePort)->portPixMap;
+   int depth = (**pmh).cmpSize * (**pmh).cmpCount;
+   long nbcol = 1;
+   for (int i=0; i<depth; i++)
+     nbcol *= 2;
+   return nbcol;
 }
 
@@ -90,4 +97,10 @@
 }
 
+int PIColorMapMac::NbAllocColors()
+{
+return(NTotAllocCol);
+}
+
+
 void PIColorMapMac::CopyFrom(PIColorMapGen* x)
 {
Index: /trunk/SophyaPI/PI/picmapmac.h
===================================================================
--- /trunk/SophyaPI/PI/picmapmac.h	(revision 63)
+++ /trunk/SophyaPI/PI/picmapmac.h	(revision 64)
@@ -8,20 +8,24 @@
 class PIColorMapMac : public PIColorMapGen {
 public:
-  friend class PIColorMapGen;
-  friend class PIPixmapMac;
-  PIColorMapMac(CMapId);
-  PIColorMapMac(string const& nom, int nCol); 
+  PIColorMapMac();
+  PIColorMapMac(int id, int nc, string const& nom);  
+  ~PIColorMapMac();
+  
   virtual PIColor GetColor(int n);
   virtual bool AllocColor(PIColor const& col, int index);   // $CHECK$  Reza 01/12/97(Modif)
   virtual void FreeColors();
-  virtual void MakeColMap();
-  virtual int  TotNbColor();         // A faire   $CHECK$  Reza 01/12/97
-  virtual int  NbAllocColors();      // A faire       "    "     "
+
+  virtual long  TotNbColors();
+  virtual int   NbAllocColors();
+  
+  CTabHandle    GetCTab() {return mCTab;}
 protected:
-  PIColorMapMac(CMapId id, int i);      // Fait une veritable allocation
   void CopyFrom(PIColorMapGen*);
   
   CTabHandle    mCTab;
   PaletteHandle mPalette;
+
+  friend class PIColorMapGen;
+  friend class PIPixmapMac;
 };
 
Index: /trunk/SophyaPI/PI/picmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/picmapx.cc	(revision 63)
+++ /trunk/SophyaPI/PI/picmapx.cc	(revision 64)
@@ -135,5 +135,5 @@
 
 /* --Methode-- */
-int PIColorMapX::TotNbColors()
+long PIColorMapX::TotNbColors()
 {
 if (NTotColors > 0)  return(NTotColors);
Index: /trunk/SophyaPI/PI/picmapx.h
===================================================================
--- /trunk/SophyaPI/PI/picmapx.h	(revision 63)
+++ /trunk/SophyaPI/PI/picmapx.h	(revision 64)
@@ -20,5 +20,5 @@
   virtual void FreeColors();
 
-  virtual int  TotNbColors();
+  virtual long TotNbColors();
   virtual int  NbAllocColors();
 
Index: /trunk/SophyaPI/PI/picontainermac.cc
===================================================================
--- /trunk/SophyaPI/PI/picontainermac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/picontainermac.cc	(revision 64)
@@ -5,4 +5,6 @@
 : PIContainerGen(par, nom, sx, sy, px, py)
 {
+  // Par dfaut, un container est invisible.
+  UnManage();
 }
 
@@ -10,18 +12,2 @@
 {}
 
-/* --Methode-- */
-void PIContainerMac::Show()
-{
-  PIContainerGen::Show();
-  mPane->Show();
-  //((LWindow*)mPane)->Select();
-}
-
-/* --Methode-- */
-void PIContainerMac::Hide()
-{
-  PIContainerGen::Hide();
-  mPane->Hide();
-}
-
-
Index: /trunk/SophyaPI/PI/picontainermac.h
===================================================================
--- /trunk/SophyaPI/PI/picontainermac.h	(revision 63)
+++ /trunk/SophyaPI/PI/picontainermac.h	(revision 64)
@@ -12,7 +12,4 @@
   virtual                ~PIContainerMac();
   
-  virtual void           Show();
-  virtual void           Hide();
-
 protected:
 
Index: /trunk/SophyaPI/PI/pifilechomac.cc
===================================================================
--- /trunk/SophyaPI/PI/pifilechomac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pifilechomac.cc	(revision 64)
@@ -3,4 +3,6 @@
 string PathNameFromDirID(long dirID, short vRefNum);
 
+string PIGetFileName(string dir);
+string PIGetExistingFileName(string dir);
 
 string PIGetFileName(string dir)
@@ -11,5 +13,5 @@
   string fName;
   int i = dir.rfind(':');
-  if (i == NPOS)
+  if (i == string::npos)
     fName = dir;
   else if (i == dir.length())
@@ -104,7 +106,7 @@
 
 void
-PIFileChooserMac::SetPath(string const& path) {}
+PIFileChooserMac::SetPath(string const& /*path*/) {}
 void
-PIFileChooserMac::SetFileName(string const& fname) {}
+PIFileChooserMac::SetFileName(string const& /*fname*/) {}
 
 string
Index: /trunk/SophyaPI/PI/pilistmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pilistmac.cc	(revision 64)
+++ /trunk/SophyaPI/PI/pilistmac.cc	(revision 64)
@@ -0,0 +1,92 @@
+#include<stdio.h>
+
+#include "pilistmac.h"
+
+
+
+
+/* --Methode-- */
+PIListMac::PIListMac(PIContainerGen* par, char* nom,
+                 int sx, int sy, int px, int py)
+: PIListGen(par, nom, sx, sy, px, py)
+{
+  delete mPane;
+  mPane = mPIPPList = new PIPPList(mPaneInfo, mViewInfo, this);
+  Manage();
+}
+
+/* --Methode-- */
+PIListMac::~PIListMac()
+{
+}
+
+
+/* --Methode-- */
+void PIListMac::AppendItem(const char * item, PIMessage msg)
+{
+  mPIPPList->AppendItem(item, msg);
+}
+
+/* --Methode-- */
+void PIListMac::DeleteItem(const char * item)
+{
+  mPIPPList->DeleteItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::DeleteItem(PIMessage msg)
+{
+  mPIPPList->DeleteItem(msg);
+}
+
+
+/* --Methode-- */
+void PIListMac::SetMultipleSelect(bool ms)
+{
+  mPIPPList->SetMultipleSelect(ms);
+}
+
+/* --Methode-- */
+int PIListMac::GetNbSelection()
+{
+  return mPIPPList->GetNbSel();
+}
+
+/* --Methode-- */
+PIMessage PIListMac::GetSelection(int num)
+{
+  return mPIPPList->GetSelMsg(num);
+}
+
+/* --Methode-- */
+string PIListMac::GetSelectionStr(int num)
+{
+  return mPIPPList->GetSelStr(num);
+}
+
+/* --Methode-- */
+void PIListMac::SelectItem(const char * item)
+{
+  mPIPPList->SelectItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::SelectItem(PIMessage msg)
+{
+  mPIPPList->SelectItem(msg);
+}
+
+
+/* --Methode-- */
+void PIListMac::ClearSelItem(const char * item)
+{
+  mPIPPList->ClearSelItem(item);
+}
+
+/* --Methode-- */
+void PIListMac::ClearSelItem(PIMessage msg)
+{
+  mPIPPList->ClearSelItem(msg);
+}
+
+
Index: /trunk/SophyaPI/PI/pilistmac.h
===================================================================
--- /trunk/SophyaPI/PI/pilistmac.h	(revision 64)
+++ /trunk/SophyaPI/PI/pilistmac.h	(revision 64)
@@ -0,0 +1,35 @@
+#ifndef PILISTMAC_H_SEEN
+#define PILISTMAC_H_SEEN
+
+#include "pilistgen.h"
+#include "pipplist.h"
+
+class PIListMac : public PIListGen {
+public:
+	             PIListMac(PIContainerGen* par, char* nom,
+                             int sx=100, int sy=100, int px=0, int py=0);
+	             ~PIListMac();
+				   
+  virtual void	     AppendItem(const char * item, PIMessage msg);
+  virtual void       DeleteItem(const char *item);
+  virtual void       DeleteItem(PIMessage msg);
+
+  virtual void       SetMultipleSelect(bool ms=false);
+
+  virtual int        GetNbSelection();
+  virtual PIMessage  GetSelection(int num=0);
+  virtual string     GetSelectionStr(int num=0);
+
+  virtual void       SelectItem(const char * item);
+  virtual void       SelectItem(PIMessage msg);
+  virtual void       ClearSelItem(const char * item);
+  virtual void       ClearSelItem(PIMessage msg);
+
+
+protected:
+  PIPPList* mPIPPList;
+};
+
+typedef PIListMac        PIList;
+
+#endif
Index: /trunk/SophyaPI/PI/pimenubarmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pimenubarmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pimenubarmac.cc	(revision 64)
@@ -4,5 +4,6 @@
 PIMenubarMac::PIMenubarMac(PIApplicationGen* par, char* nom)
 :PIMenubarGen(par, nom)
-{}
+{
+}
 
 PIMenubarMac::~PIMenubarMac()
Index: /trunk/SophyaPI/PI/pioptmenumac.cc
===================================================================
--- /trunk/SophyaPI/PI/pioptmenumac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pioptmenumac.cc	(revision 64)
@@ -7,5 +7,6 @@
 {
   delete mPane;
-  LStr255 titre(Nom().c_str());
+  //LStr255 titre(Nom().c_str());
+  LStr255 titre("");
   
   StTextState textState;
@@ -15,5 +16,5 @@
   int titleWidth = ::StringWidth(titre);
   
-  mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 0, titre, 0, 1);
+  mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);
   //macMenu = ((LStdPopupMenu*)mPane)->GetMacMenuH();
   
@@ -26,4 +27,5 @@
   
   ((LStdPopupMenu*)mPane)->AddListener(this);
+  Manage();
 }
 
@@ -74,5 +76,7 @@
 if (n < 0)  return;
   
+StopListening();
 ((LStdPopupMenu*)mPane)->SetValue(n+1);
+StartListening();
 mStext = mPUMenu->GetMenuItemText(n);
 mSmsg  = msg;
Index: /trunk/SophyaPI/PI/pipixmapmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pipixmapmac.cc	(revision 64)
@@ -30,4 +30,10 @@
 void
 PIPixmapMac::Refresh()
+{
+	PIPixmapGen::Refresh();
+}
+
+void
+PIPixmapMac::DrawOff()
 {
   if (mGWorld) {
@@ -65,6 +71,12 @@
 	
 	mPane->FocusDraw();
-	SetPalette(mPane->GetMacPort(),cmap->mPalette, true);
-	PIPixmapGen::Refresh();
+//	SetPalette(mPane->GetMacPort(),cmap->mPalette, true);
+//	PIPixmapGen::Refresh();
+}
+
+void
+PIPixmapMac::Draw(int,int,int,int)
+{
+  Draw();
 }
 
@@ -72,4 +84,5 @@
 PIPixmapMac::Draw()
 {
+  DrawOff();
   if (!mGWorld) return;
   mPane->FocusDraw();
@@ -85,5 +98,5 @@
 				&offsFrame, &paneFrame, srcCopy, nil);
   ::UnlockPixels (mGWorld->portPixMap);
-
-
+  DisposeGWorld(mGWorld);
+  mGWorld = 0;
 }
Index: /trunk/SophyaPI/PI/pipixmapmac.h
===================================================================
--- /trunk/SophyaPI/PI/pipixmapmac.h	(revision 63)
+++ /trunk/SophyaPI/PI/pipixmapmac.h	(revision 64)
@@ -13,5 +13,7 @@
   virtual void  SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true);
   virtual void  Draw();
+  virtual void  Draw(int x0, int y0, int dx, int dy);
   virtual void	Refresh();
+  virtual void	DrawOff();
   virtual void  Resize();
 protected:
Index: /trunk/SophyaPI/PI/pippapplmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pippapplmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pippapplmac.cc	(revision 64)
@@ -2,8 +2,11 @@
 #include "piupdattachment.h"
 #include "pippmenubar.h"
+#include <LClipboard.h>
 
 PIPPApplMac::PIPPApplMac()
 :LApplication()
-{}
+{
+  AddAttachment(new LClipboard);
+}
 
 
Index: /trunk/SophyaPI/PI/pipplist.cc
===================================================================
--- /trunk/SophyaPI/PI/pipplist.cc	(revision 64)
+++ /trunk/SophyaPI/PI/pipplist.cc	(revision 64)
@@ -0,0 +1,198 @@
+#include "pipplist.h"
+#include <LTableMonoGeometry.h>
+#include <LTableSingleSelector.h>
+#include <LTableMultiSelector.h>
+#include <LTableArrayStorage.h>
+#include <LComparator.h>
+
+class CellMsgComparator : public LComparator {
+public:
+	virtual Int32		Compare(
+								const void*			inItemOne,
+								const void* 		inItemTwo,
+								Uint32				/*inSizeOne*/,
+								Uint32				/*inSizeTwo*/) const
+	{return ((PIPPListCell*)inItemOne)->msg == ((PIPPListCell*)inItemTwo)->msg;}
+};
+
+static CellMsgComparator cellMsgComparator;
+
+class CellStrComparator : public LComparator {
+public:
+	virtual Int32		Compare(
+								const void*			inItemOne,
+								const void* 		inItemTwo,
+								Uint32				/*inSizeOne*/,
+								Uint32				/*inSizeTwo*/) const
+	{return ((PIPPListCell*)inItemOne)->str == ((PIPPListCell*)inItemTwo)->str;}
+};
+
+static CellStrComparator cellStrComparator;
+
+
+PIPPList::PIPPList(PIMsgHandler* h)
+: mHndl(h)
+{
+  InitPPList();
+}
+
+PIPPList::PIPPList(
+    const SPaneInfo& inPaneInfo,
+    const SViewInfo& inViewInfo,
+    PIMsgHandler* h)
+: LTableView(inPaneInfo, inViewInfo), mHndl(h)
+{
+  InitPPList();
+}
+
+void PIPPList::InitPPList()
+{
+  SetTableGeometry(new LTableMonoGeometry(this, 10, 16));
+  SetTableSelector(tss=new LTableSingleSelector(this)); 
+  mArray = new LArray(sizeof(PIPPListCell)),
+  SetTableStorage(new LTableArrayStorage(this, mArray));
+  tms = new LTableMultiSelector(this);
+  LTableView::InsertCols(1, 0, nil, 0, Refresh_No);
+}
+
+PIPPList::~PIPPList()
+{
+  SetTableSelector(nil);
+  delete tss;
+  delete tms;
+}
+
+
+void PIPPList::AppendItem(string const& str, PIMessage msg)
+{
+  PIPPListCell cell;
+  cell.str=str;
+  cell.msg=msg;
+  InsertRows(1, -1, &cell, sizeof(cell), Refresh_Yes);
+}
+
+STableCell PIPPList::FindStr(string const& str)
+{
+  PIPPListCell cell;
+  cell.str = str;
+  cell.msg = 0;
+  mArray->SetComparator(&cellStrComparator);
+  STableCell tcell;
+  FindCellData(tcell, &cell, sizeof(cell));
+  return tcell;
+}
+
+STableCell PIPPList::FindMsg(PIMessage msg)
+{
+  PIPPListCell cell;
+  cell.str = "";
+  cell.msg = msg;
+  mArray->SetComparator(&cellMsgComparator);
+  STableCell tcell;
+  FindCellData(tcell, &cell, sizeof(cell));
+  return tcell;
+}
+
+void PIPPList::DeleteItem(string const& str)
+{
+  STableCell tcell = FindStr(str);
+  RemoveRows(1, tcell.row, Refresh_Yes);
+}
+
+void PIPPList::DeleteItem(PIMessage msg)
+{
+  STableCell tcell = FindMsg(msg);
+  RemoveRows(1, tcell.row, Refresh_Yes);
+}
+
+
+void PIPPList::SetMultipleSelect(bool ms);
+  
+int PIPPList::GetNbSel()
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+  }
+  return n; 
+}
+
+PIMessage PIPPList::GetSelMsg(int i)
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+    if (n == i) {
+       PIPPListCell ppcell;
+       UInt32 sz = sizeof(ppcell);
+       GetCellData(cell, &ppcell, sz);
+       return ppcell.msg;
+    }
+  }
+  return 0; 
+}
+
+string PIPPList::GetSelStr(int i)
+{
+  int n = 0;
+  for (TableIndexT j=1; j<=mRows; j++) {
+    STableCell cell;
+    cell.row = j;
+    cell.col = 1;
+    if (CellIsSelected(cell)) n++;
+    if (n == i) {
+       PIPPListCell ppcell;
+       UInt32 sz = sizeof(ppcell);
+       GetCellData(cell, &ppcell, sz);
+       return ppcell.str;
+    }
+  }
+  return ""; 
+}
+void PIPPList::SelectItem(string const& str)
+{
+  STableCell cell = FindStr(str);
+  SelectCell(cell);
+}
+
+void PIPPList::SelectItem(PIMessage msg)
+{
+  STableCell cell = FindMsg(msg);
+  SelectCell(cell);
+}
+
+void PIPPList::ClearSelItem(string const& str)
+{
+  STableCell cell = FindStr(str);
+  UnselectCell(cell);
+}
+
+void PIPPList::ClearSelItem(PIMessage msg)
+{
+  STableCell cell = FindMsg(msg);
+  UnselectCell(cell);
+}
+
+void PIPPList::SetMultipleSelect(bool ms)
+{
+  if (ms)
+    SetTableSelector(tms);
+  else
+    SetTableSelector(tss); 
+}
+
+void
+PIPPList::ClickCell(
+	const STableCell&		inCell,
+	const SMouseDownEvent&	inMouseDown)
+{
+  if (GetClickCount() == 2) {
+	
+  }
+}
Index: /trunk/SophyaPI/PI/pipplist.h
===================================================================
--- /trunk/SophyaPI/PI/pipplist.h	(revision 64)
+++ /trunk/SophyaPI/PI/pipplist.h	(revision 64)
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <string>
+#include <LTableView.h>
+#include "pimsghandler.h"
+
+class LArray;
+
+struct PIPPListCell {
+   string 	   str;
+   PIMessage   msg;
+};
+
+class PIPPList : public LTableView {
+public:
+
+  PIPPList(PIMsgHandler* hndl);
+  PIPPList(
+    const SPaneInfo& inPaneInfo,
+    const SViewInfo& inViewInfo,
+    PIMsgHandler* hndl);
+  virtual ~PIPPList();
+
+  void       AppendItem(string const& str, PIMessage msg);
+  void       DeleteItem(string const& str);
+  void       DeleteItem(PIMessage msg);  
+
+  void       SetMultipleSelect(bool ms);
+  
+  int        GetNbSel();
+  PIMessage  GetSelMsg(int i);
+  string     GetSelStr(int i);
+  
+  void       SelectItem(string const& str);
+  void       SelectItem(PIMessage msg);
+  void       ClearSelItem(string const& str);
+  void       ClearSelItem(PIMessage msg);
+  
+protected:
+  LTableSelector* tss;
+  LTableSelector* tms;
+  LArray*         mArray;
+  PIMsgHandler*   mHndl;
+
+  virtual void    ClickCell(
+                       const STableCell        &inCell,
+                       const SMouseDownEvent   &inMouseDown);
+
+  void InitPPList();
+  STableCell  FindMsg(PIMessage msg);
+  STableCell  FindStr(string const& str);
+};
Index: /trunk/SophyaPI/PI/pippviewadapter.cc
===================================================================
--- /trunk/SophyaPI/PI/pippviewadapter.cc	(revision 64)
+++ /trunk/SophyaPI/PI/pippviewadapter.cc	(revision 64)
@@ -0,0 +1,105 @@
+#include "pippviewadapter.h"
+
+
+PIPPViewAdapter::PIPPViewAdapter()	
+:LView()
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+
+PIPPViewAdapter::PIPPViewAdapter(	
+	const PIPPViewAdapter& inOriginal)
+:LView(inOriginal)
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+PIPPViewAdapter::PIPPViewAdapter(
+	const SPaneInfo		&inPaneInfo,
+	const SViewInfo		&inViewInfo)
+:LView(inPaneInfo, inViewInfo)
+{
+	::SetRect(&piBindings, 0, 0, 0, 0);
+}
+
+void PIPPViewAdapter::SetBinding(PIBindingKind left, PIBindingKind top, 
+                                  PIBindingKind right, PIBindingKind bottom)
+{
+  piBindings.left = left;
+  piBindings.right = right;
+  piBindings.top = top;
+  piBindings.bottom = bottom;
+}
+
+void PIPPViewAdapter::AdaptToSuperFrameSize(
+	Int32				inSurrWidthDelta,
+	Int32				inSurrHeightDelta,
+	Boolean				inRefresh)
+{
+  SDimension16 parSize;
+  GetSuperView()->GetFrameSize(parSize);
+  
+  SDimension16 oldParSize = parSize;
+  oldParSize.width -= inSurrWidthDelta;
+  oldParSize.height -= inSurrHeightDelta;
+  
+  SPoint32 myLoc;
+  GetFrameLocation(myLoc);
+  SPoint32	superImageLoc = {0, 0};
+	
+  if (mSuperView != nil) {
+    mSuperView->GetImageLocation(superImageLoc);
+  }
+  myLoc.h -= superImageLoc.h;
+  myLoc.v -= superImageLoc.v;
+  
+  SDimension16 mySize;
+  GetFrameSize(mySize);
+    
+  SPoint32 myXLoc = myLoc;
+  myXLoc.h += mySize.width;
+  myXLoc.v += mySize.height;
+  
+  if (piBindings.left == PIBK_elastic) {
+     myLoc.h = parSize.width * ((float)myLoc.h / (float)oldParSize.width);
+  }
+ 
+  if (piBindings.top == PIBK_elastic) {
+     myLoc.v = parSize.height * ((float)myLoc.v / (float)oldParSize.height);
+  }
+  
+  if (piBindings.right == PIBK_fixed) {
+     myXLoc.h += inSurrWidthDelta;
+  } else
+  if (piBindings.right == PIBK_elastic) {
+     myXLoc.h = parSize.width * ((float)myXLoc.h / (float)oldParSize.width);
+  }  
+ 
+  if (piBindings.bottom == PIBK_fixed) {
+     myXLoc.v += inSurrHeightDelta;
+  } else
+  if (piBindings.bottom == PIBK_elastic) {
+     myXLoc.v = parSize.height * ((float)myXLoc.v / (float)oldParSize.height);
+  }
+  
+  
+  if (piBindings.left == PIBK_free) {
+    myLoc.h = myXLoc.h - mySize.width;
+  }   
+  if (piBindings.top == PIBK_free) {
+    myLoc.v = myXLoc.v - mySize.height;
+  }   
+  if (piBindings.right == PIBK_free) {
+    myXLoc.h = myLoc.h + mySize.width;
+  }   
+  if (piBindings.bottom == PIBK_free) {
+    myXLoc.v = myLoc.v + mySize.height;
+  }
+  
+  mySize.width = myXLoc.h - myLoc.h;
+  mySize.height = myXLoc.v - myLoc.v;
+  
+  ResizeFrameTo(mySize.width, mySize.height, inRefresh);
+  ResizeFrameTo(mySize.width, mySize.height, inRefresh);
+  PlaceInSuperImageAt(myLoc.h, myLoc.v, inRefresh);
+}
+
Index: /trunk/SophyaPI/PI/pippviewadapter.h
===================================================================
--- /trunk/SophyaPI/PI/pippviewadapter.h	(revision 64)
+++ /trunk/SophyaPI/PI/pippviewadapter.h	(revision 64)
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <LView.h>
+#include "piwdggen.h"
+
+class PIPPViewAdapter : public LView {
+public:
+						PIPPViewAdapter();
+						PIPPViewAdapter(	
+								const PIPPViewAdapter	&inOriginal);
+						PIPPViewAdapter(
+								const SPaneInfo		&inPaneInfo,
+								const SViewInfo		&inViewInfo);
+
+	virtual void        SetBinding(PIBindingKind left, PIBindingKind top, 
+                                   PIBindingKind right, PIBindingKind bottom);
+	virtual void		AdaptToSuperFrameSize(
+								Int32				inSurrWidthDelta,
+								Int32				inSurrHeightDelta,
+								Boolean				inRefresh);
+								
+protected:
+	Rect				piBindings;
+};
Index: /trunk/SophyaPI/PI/pistdwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 64)
@@ -12,5 +12,5 @@
   delete mPane;
   LStr255 titre(nom);
-  mPane = new LCaption(mPaneInfo, titre, 0);
+  mPane = new LCaption(mPaneInfo, titre, 130);
 }
 
@@ -28,5 +28,5 @@
   delete mPane;
   LStr255 titre(nom);
-  mPane = new LStdButton(mPaneInfo, msg_Click, 0, titre);
+  mPane = new LStdButton(mPaneInfo, msg_Click, 130, titre);
   ((LStdButton*)mPane)->AddListener(this);
 }
@@ -52,5 +52,5 @@
   delete mPane;
   LStr255 titre(nom);
-  mPane = new LEditField(mPaneInfo, titre, 0, 255, true, true, NULL, LCommander::GetTopCommander());
+  mPane = new LEditField(mPaneInfo, titre, 130, 255, true, true, NULL, LCommander::GetTopCommander());
 }
 
@@ -100,5 +100,5 @@
   LStr255 titre(nom);
   mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10,
-						  scrollBarProc, 0, titre, (Int32) this);
+						  scrollBarProc, 130, titre, (Int32) this);
   ((LStdControl*)mPane)->AddListener(this);
   
@@ -129,5 +129,7 @@
 PIScaleMac::SetValue(int val)
 {
+  StopListening();
   ((LStdControl*)mPane)->SetValue(val);
+  StartListening();
 }
 
@@ -188,5 +190,5 @@
   delete mPane;
   LStr255 titre(nom);
-  mPane = new LStdCheckBox(mPaneInfo, msg_Click, 0, 0, titre);
+  mPane = new LStdCheckBox(mPaneInfo, msg_Click, 0, 130, titre);
   ((LStdCheckBox*)mPane)->AddListener(this);
 }
@@ -205,5 +207,7 @@
 PICheckBoxMac::SetState(bool st)
 {
+  StopListening();
   ((LStdCheckBox*)mPane)->SetValue(st ? 1 : 0);
+  StartListening();
 }
  
Index: /trunk/SophyaPI/PI/piwdgmac.cc
===================================================================
--- /trunk/SophyaPI/PI/piwdgmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/piwdgmac.cc	(revision 64)
@@ -17,17 +17,41 @@
 :PIWdgGen(par, nom, sx, sy, px, py), mNom(nom)
 {
-	mPaneInfo.paneID    = 'PIWD';
-	mPaneInfo.width     = sx;
-	mPaneInfo.height    = sy;
-	mPaneInfo.visible   = true;
-	mPaneInfo.enabled   = true;
-	mPaneInfo.bindings.left =
-		mPaneInfo.bindings.top =
-		mPaneInfo.bindings.right =
-		mPaneInfo.bindings.bottom = false;
-	mPaneInfo.left      = px;
-	mPaneInfo.top       = py;
-	mPaneInfo.userCon   = 'PIWD';
-	mPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
+  mAdapterPaneInfo.paneID    = 0;
+  mAdapterPaneInfo.width     = sx;
+  mAdapterPaneInfo.height    = sy;
+  mAdapterPaneInfo.visible   = true;
+  mAdapterPaneInfo.enabled   = true;
+  mAdapterPaneInfo.bindings.left =
+    mAdapterPaneInfo.bindings.top =
+    mAdapterPaneInfo.bindings.right =
+    mAdapterPaneInfo.bindings.bottom = false;
+  mAdapterPaneInfo.left      = px;
+  mAdapterPaneInfo.top       = py;
+  mAdapterPaneInfo.userCon   = 0;
+  mAdapterPaneInfo.superView = par ? (LView*) (((PIContainerMac*)(par))->mPane) : NULL;
+
+  mAdapterViewInfo.imageSize.width = sx;
+  mAdapterViewInfo.imageSize.height = sy;
+  mAdapterViewInfo.scrollPos.h = 
+    mAdapterViewInfo.scrollPos.v = 
+    mAdapterViewInfo.scrollUnit.h = 
+    mAdapterViewInfo.scrollUnit.v = 0;
+  mAdapterViewInfo.reconcileOverhang = 0;
+
+  mAdapter = new PIPPViewAdapter(mAdapterPaneInfo, mAdapterViewInfo);
+
+  mPaneInfo.paneID    = 'PIWD';
+  mPaneInfo.width     = sx;
+  mPaneInfo.height    = sy;
+  mPaneInfo.visible   = true;
+  mPaneInfo.enabled   = true;
+  mPaneInfo.bindings.left =
+    mPaneInfo.bindings.top =
+    mPaneInfo.bindings.right =
+    mPaneInfo.bindings.bottom = true;
+  mPaneInfo.left      = 0;
+  mPaneInfo.top       = 0;
+  mPaneInfo.userCon   = 'PIWD';
+  mPaneInfo.superView = mAdapter;
 
   mViewInfo.imageSize.width = sx;
@@ -40,4 +64,5 @@
   
   mPane = new LView(mPaneInfo, mViewInfo);
+  ((LView*)mAdapter)->CalcPortOrigin();
   ((LView*)mPane)->CalcPortOrigin();
 }
@@ -47,4 +72,5 @@
 {
   delete mPane;
+  delete mAdapter;
 }
 
@@ -71,4 +97,7 @@
 PIWdgMac::SetSize(int sx, int sy)
 {
+  if (mAdapter)
+   mAdapter->ResizeFrameTo(sx, sy, true);
+  else
    mPane->ResizeFrameTo(sx, sy, true);
 }
@@ -77,4 +106,7 @@
 PIWdgMac::SetPos(int px, int py)
 {
+  if (mAdapter)
+   mAdapter->MoveBy(px-XPos(), py-YPos(), false);
+  else
    mPane->MoveBy(px-XPos(), py-YPos(), false);
 }
@@ -83,12 +115,9 @@
 PIWdgMac::SetBinding(PIBindingKind left, PIBindingKind top, 
                      PIBindingKind right, PIBindingKind bottom)
-//  $CHECK$ Reza 13/10/96    Code a modifier
-{
-  SBooleanRect r;
-  r.left    = left;
-  r.top     = top;
-  r.right   = right;
-  r.bottom  = bottom;
-  mPane->SetFrameBinding(r);
+{
+  if (mAdapter)  
+    mAdapter->SetBinding(left, top, right, bottom);
+  //else
+  //  mPane->SetBinding(left, top, right, bottom);
 }
 
@@ -132,2 +161,73 @@
 else return(false);
 }
+
+
+// Gestion de Copier/Coller
+#include <LClipboard.h>
+/* --Methode-- */
+// COPY
+bool PIWdgMac::ClaimSelection()
+{
+  int l;
+  char* txt = SelectionString(l);
+  LClipboard::GetClipboard()->SetData('TEXT',txt,l,true);
+  delete[] txt;
+  return (true);
+}
+
+/* --Methode-- */
+void PIWdgMac::LoseSelection()
+{
+}
+
+/* --Methode-- */
+// PASTE
+void PIWdgMac::RequestSelection()
+{
+  Handle h = NewHandle(0);
+  Int32 l = LClipboard::GetClipboard()->GetData('TEXT', h);
+  if (l) {
+    CopyFromSelection(*h, l);
+  }
+}
+
+/* --Methode-- */
+void PIWdgMac::CopyFromSelection(char * sv, int l)
+{
+char* buff = new char[l+2];
+strncpy(buff, sv, l);
+buff[l] = '\0';
+printf("PIWdgMac::RequestSelection() L=%d [%s] \n", l, buff);
+delete buff;
+return;
+}
+
+/* --Methode-- */
+char* PIWdgMac::SelectionString(int& len)
+{
+char *rs = new char[60];
+strcpy(rs, "Test-of-PIWdgMac::SelectionString()");
+len = strlen(rs);
+return(rs);
+}
+
+
+/* --Methode-- */
+void PIWdgMac::Manage()
+{
+  if (mAdapter) mAdapter->Show();
+  mPane->Show();
+}
+
+/* --Methode-- */
+void PIWdgMac::UnManage()
+{
+  mPane->Hide();
+  if (mAdapter) mAdapter->Hide();
+}
+
+/* --Methode-- */
+bool PIWdgMac::IfManaged()
+{
+  return(mPane->IsVisible());
+}
Index: /trunk/SophyaPI/PI/piwdgmac.h
===================================================================
--- /trunk/SophyaPI/PI/piwdgmac.h	(revision 63)
+++ /trunk/SophyaPI/PI/piwdgmac.h	(revision 64)
@@ -3,4 +3,5 @@
 
 #include "piwdggen.h"
+#include "pippviewadapter.h"
 #include <LPane.h>
 #include <LListener.h>
@@ -32,7 +33,17 @@
   virtual bool           IfManaged();
   virtual bool           IsVisible();
+  
+//  Gestion de copier-coller
+  virtual bool           ClaimSelection();
+  virtual void           LoseSelection();
+  virtual void           RequestSelection();
+  virtual void           CopyFromSelection(char *, int l);
+  virtual char*          SelectionString(int& len);
 
 protected:
   LPane*				 mPane;
+  PIPPViewAdapter*       mAdapter;
+  SPaneInfo				 mAdapterPaneInfo;
+  SViewInfo				 mAdapterViewInfo;
   SPaneInfo				 mPaneInfo;
   SViewInfo				 mViewInfo;
Index: /trunk/SophyaPI/PI/piwindowmac.cc
===================================================================
--- /trunk/SophyaPI/PI/piwindowmac.cc	(revision 63)
+++ /trunk/SophyaPI/PI/piwindowmac.cc	(revision 64)
@@ -5,4 +5,6 @@
 {
 	delete mPane;
+	delete mAdapter;
+	mAdapter = NULL;
 	mWindowInfo.WINDid = 1000+k;
 	mWindowInfo.attributes = windAttr_EraseOnUpdate |
@@ -36,9 +38,10 @@
 	mWindowInfo.userCon = 0;
 	
-	mPane = new LWindow(mWindowInfo);
+	//mPane = new LWindow(mWindowInfo);
+	mPane = LWindow::CreateWindow(1000+k,LCommander::GetTopCommander());
 	Rect r = {py, px, py+sy, px+sx};
     ((LWindow*) mPane)->DoSetBounds(r);
     SetLabel(nom);
-    ((LWindow*) mPane)->SetSuperCommander(LCommander::GetTopCommander());
+    //((LWindow*) mPane)->SetSuperCommander(LCommander::GetTopCommander());
 }
 
@@ -56,2 +59,14 @@
   PIWindowGen::Show();
 }
+
+void
+PIWindowMac::SetSize(int sx, int sy)
+{
+   ((LWindow*) mPane)->ResizeWindowTo(sx, sy);
+}
+
+void
+PIWindowMac::SetPos(int px, int py)
+{
+   ((LWindow*) mPane)->MoveWindowTo(px-XPos(), py-YPos());
+}
Index: /trunk/SophyaPI/PI/piwindowmac.h
===================================================================
--- /trunk/SophyaPI/PI/piwindowmac.h	(revision 63)
+++ /trunk/SophyaPI/PI/piwindowmac.h	(revision 64)
@@ -12,4 +12,6 @@
   virtual                ~PIWindowMac();
   virtual void           Show();
+  virtual void           SetSize(int sx, int sy);
+  virtual void           SetPos(int px, int py);
 
 protected:
