Index: trunk/SophyaPI/PI/piapplmac.cc
===================================================================
--- trunk/SophyaPI/PI/piapplmac.cc	(revision 87)
+++ trunk/SophyaPI/PI/piapplmac.cc	(revision 88)
@@ -95,2 +95,18 @@
 }
 
+/* --Methode-- */
+int PIApplicationMac::PrefXSize()
+{
+  return(10);  // $CHECK$ A remplacer Reza 13/02/98 
+}
+
+/* --Methode-- */
+int PIApplicationMac::PrefYSize()
+{
+  return(18);  // $CHECK$ A remplacer Reza 13/02/98 
+}
+
+void PIApplicationMac::RedirectOutStream(PIConsole* cons, unsigned char va)
+{}
+void PIApplicationMac::RedirectErrStream(PIConsole* cons, unsigned char va)
+{}
Index: trunk/SophyaPI/PI/piapplmac.h
===================================================================
--- trunk/SophyaPI/PI/piapplmac.h	(revision 87)
+++ trunk/SophyaPI/PI/piapplmac.h	(revision 88)
@@ -13,4 +13,9 @@
 	virtual void    Stop();
 	
+  virtual int     PrefXSize();
+  virtual int     PrefYSize();
+
+        virtual void              RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def);
+        virtual void              RedirectErrStream(PIConsole* cons, unsigned char va= PIVA_Ital);
 //protected:
 	LApplication* macAppli;
Index: trunk/SophyaPI/PI/pibwdggen.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdggen.cc	(revision 87)
+++ trunk/SophyaPI/PI/pibwdggen.cc	(revision 88)
@@ -37,5 +37,5 @@
 
 /* --Methode-- */
-void PIBaseWdgGen::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
+void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
 {
 this->Draw(g);
@@ -44,5 +44,5 @@
 
 /* --Methode-- */
-void PIBaseWdgGen::Draw(PIGraphicGen* g)
+void PIBaseWdgGen::Draw(PIGraphic* g)
 {
 #ifdef DEBUG_RZXB
Index: trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- trunk/SophyaPI/PI/pibwdggen.h	(revision 87)
+++ trunk/SophyaPI/PI/pibwdggen.h	(revision 88)
@@ -57,6 +57,6 @@
 
 //  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
-  virtual void       Draw(PIGraphicGen* g);
-  virtual void       Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
+  virtual void       Draw(PIGraphic* g);
+  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
   
 // Traitement des evenements   
Index: trunk/SophyaPI/PI/pibwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/pibwdgmac.cc	(revision 87)
+++ trunk/SophyaPI/PI/pibwdgmac.cc	(revision 88)
@@ -7,4 +7,6 @@
 #include <string.h>
 
+#define mGraphic mWGrC  
+
 // Les methodes de la classe  PIBWdgGen
  
@@ -12,10 +14,13 @@
 PIBaseWdgMac::PIBaseWdgMac(PIContainerGen *par, char *nom,
                        int sx, int sy, int px, int py) :
-PIBaseWdgGen(par, nom, sx, sy, px, py), 
-mFCol(PI_Black), mBCol(PI_White)
+PIBaseWdgGen(par, nom, sx, sy, px, py) 
 {
+    mGraphic = new PIGraphicMac(this);
+
     mAdapter->AddAttachment(new PIUpdAttachment(this));
     mPane->AddAttachment(new PIUpdAttachment(this));
     cursor = NULL;
+    
+
 }
 
@@ -59,267 +64,62 @@
 }
 
-/* --Methode-- */
-void PIBaseWdgMac::DrawString(int x, int y, char* s, int /*pos*/)
-{
-  if (mPane->FocusDraw()) {
-    LocalToMacPortPoint(x, y, x, y);
-    ::MoveTo(x, y);
-    LStr255 ps = s;
-    ::TextFont(applFont);
-    ::DrawString(ps);
-  }
-}
+
 
 /* --Methode-- */
-void PIBaseWdgMac::DrawOpaqueString(int x, int y, char* s, int /*pos*/)
+void PIBaseWdgMac::SelPointerShape(PIPointer ptr)
 {
+  CursHandle c;
   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);
+    switch(ptr) {
+      case PI_ArrowPointer:
+        cursor = &qd.arrow;
+        break;
+      case PI_CrossPointer:
+        c = GetCursor(crossCursor);
+        HLock((Handle)c);
+        cursor = c ? *c : NULL;
+        break;
+      case PI_HandPointer:
+        c = GetCursor(128);
+        HLock((Handle)c);
+        cursor = c ? *c : NULL;
+        break;
+    }
   }
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::DrawMarker(int x0, int y0)
-{
-int hmsz = mMrkSz/2;
-int dmsz = mMrkSz-hmsz;
-int x[4],y[4];
-PILineAtt clatt;
-
-if (mMrk == PI_DotMarker) {
-    LocalToMacPortPoint(x0, y0, x0, y0);
-  ::MoveTo( x0, y0);
-  ::Line(0,0);
-}
-
-else
-  {
-  clatt = mLAtt;
-  SelLine(PI_ThinLine);
-  switch (mMrk)
-    {
-    case  PI_PlusMarker :
-      DrawLine(x0-hmsz, y0, x0+dmsz, y0);
-      DrawLine(x0, y0-hmsz, x0, y0+dmsz);
-      break;
-    case  PI_CrossMarker :
-      DrawLine(x0-hmsz, y0-hmsz, x0+dmsz, y0+dmsz);
-      DrawLine(x0-hmsz, y0+dmsz, x0+dmsz, y0-hmsz);
-      break;  
-    case PI_CircleMarker :
-      DrawCircle(x0, y0, hmsz);
-      break;
-    case PI_FCircleMarker :
-      DrawFCircle(x0, y0, hmsz);
-      break;
-    case PI_BoxMarker :
-      DrawBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
-      break;
-    case PI_FBoxMarker :
-      DrawFBox(x0-hmsz, y0-hmsz, mMrkSz, mMrkSz);
-      break;
-    case  PI_TriangleMarker :
-      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
-      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz;  
-      DrawPolygon(x, y, 4);
-      break;
-    case  PI_FTriangleMarker :
-      x[1] = mMrkSz; y[1] = 0; x[2] = -hmsz; y[2] = -mMrkSz; 
-      x[3] = -dmsz; y[3] = +mMrkSz; x[0] = x0-hmsz; y[0] = y0+hmsz;  
-      DrawFPolygon(x, y, 4);
-      break;
-    default :
-      ::MoveTo( x0, y0);
-      ::Line(0,0);
-      break;
-    }
-  SelLine(clatt);
-  }
-return;
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::DrawMarkers(int *x, int *y, int n)
-{
-int i;
-
-if (n <= 0)  return;
-for(i=0; i<n; i++) DrawMarker(x[i], y[i]);
-}
-
-/* --Methode-- */
-int PIBaseWdgMac::CalcStringWidth(char const* s)
-{
-  if (mPane->FocusDraw())
-    ::TextFont(applFont);
-  return ::TextWidth(s,0,strlen(s));
-}
-
-void PIBaseWdgMac::LocalToMacPortPoint(int x, int y, int& xm, int& ym)
-{
-    Point pt = {y,x};
-    //mPane->LocalToPortPoint(pt);
-//	SPoint32 loc;
-//	mPane->GetFrameLocation(loc);
-//    xm = pt.h + loc.h;
-//    ym = pt.v + loc.v;  // Ou bien ne pas utiliser de Pane, que des View ?
-    xm = pt.h;
-    ym = pt.v;
+  mPtrS = ptr;
 }
 
 
-/* --Methode-- */
-void PIBaseWdgMac::DrawLine(int x1, int y1, int x2, int y2)
-{
-  if (mPane->FocusDraw()) {
-    int x,y;
-    LocalToMacPortPoint(x1, y1, x, y);
-    ::MoveTo(x,y);
-    LocalToMacPortPoint(x2, y2, x, y);
-    ::LineTo(x,y);
-  }
-}
 
 /* --Methode-- */
-void PIBaseWdgMac::DrawBox(int x0, int y0, int dx, int dy)
+PIPointer  PIBaseWdgMac::GetPointerShape()
 {
-  if (mPane->FocusDraw()) {
-    int x,y;
-    LocalToMacPortPoint(x0, y0, x, y);
-    Rect r = {y, x, y+dy, x+dx};
-    if (r.top  > r.bottom) swap(r.top,  r.bottom);
-    if (r.left > r.right)  swap(r.left, r.right);
-    r.right++; r.bottom++;
-    ::FrameRect(&r);
-  }
+return (mPtrS);
 }
 
 
+
 /* --Methode-- */
-void PIBaseWdgMac::DrawFBox(int x0, int y0, int dx, int dy)
+bool PIBaseWdgMac::AdjustCursor()
 {
-  if (mPane->FocusDraw()) {
-    int x,y;
-    LocalToMacPortPoint(x0, y0, x, y);
-    Rect r = {y, x, y+dy, x+dx};
-    if (r.top  > r.bottom) swap(r.top,  r.bottom);
-    if (r.left > r.right)  swap(r.left, r.right);
-    r.right++; r.bottom++;
-    ::PaintRect(&r);
+  if (cursor) {
+    ::SetCursor(cursor);
+    return true;
   }
+  return false;
 }
 
-/* --Methode-- */
-void PIBaseWdgMac::DrawCircle(int x0, int y0, int r) 
+/* --Methode-- 
+void PIBaseWdgMac::Refresh()
 {
-  if (mPane->FocusDraw()) {
-    int x,y;
-    LocalToMacPortPoint(x0, y0, x, y);
-    Rect rr = {y-r, x-r, y+r, x+r};
-    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
-    if (rr.left > rr.right)  swap(rr.left, rr.right);
-    ::FrameOval(&rr);
-  }
+if (mPane->IsVisible())
+  Draw();
 }
-
-/* --Methode-- */
-void PIBaseWdgMac::DrawFCircle(int x0, int y0, int r) 
-{
-  if (mPane->FocusDraw()) {
-    int x,y;
-    LocalToMacPortPoint(x0, y0, x, y);
-    Rect rr = {y-r, x-r, y+r, x+r};
-    if (rr.top  > rr.bottom) swap(rr.top,  rr.bottom);
-    if (rr.left > rr.right)  swap(rr.left, rr.right);
-    ::PaintOval(&rr);
-  }
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::DrawPolygon(int *x, int *y, int n)
-{
-  PolyHandle h = MakePoly(x,y,n);
-  if (h) {
-    ::FramePoly(h);
-    ::KillPoly(h);
-  }
-}
+   J'ai mis cette fonction ds PIWdgMac::IsVisible()    Reza $CHECK$  01/12/97 
+*/
 
 
-/* --Methode-- */
-void PIBaseWdgMac::DrawFPolygon(int *x, int *y, int n)
-{
-  PolyHandle h = MakePoly(x,y,n);
-  if (h) {
-    ::PaintPoly(h);
-    ::KillPoly(h);
-  }
-}
-/* --Methode-- */
-PolyHandle PIBaseWdgMac::MakePoly(int *x, int *y, int n)
-{
-  if (mPane->FocusDraw()) {
-    PolyHandle h = ::OpenPoly();
-    int xx,yy;
-    LocalToMacPortPoint(x[0], y[0], xx, yy);
-    ::MoveTo(xx, yy);
-    for (int i=1; i<n; i++) {
-      LocalToMacPortPoint(x[i], y[i], xx, yy);
-      ::LineTo(xx, yy);
-    }
-    LocalToMacPortPoint(x[0], y[0], xx, yy);
-    ::MoveTo(xx, yy);
-    ClosePoly();
-    return h;
-  }
-  return NULL;
-}
 
-
-/* --Methode-- */
-void PIBaseWdgMac::SelForeground(PIColors col) 
-{
-  if (mPane->FocusDraw()) {
-    long color;
-    switch (col) {
-      case PI_Black:
-        color = blackColor;
-        break;
-      case PI_White:
-        color = whiteColor;
-        break;
-      case PI_Red:
-        color = redColor;
-        break;
-      case PI_Blue:
-        color = blueColor;
-        break;
-      case PI_Green:
-        color = greenColor;
-        break;
-      case PI_Yellow:
-        color = yellowColor;
-        break;
-      default:
-        color = blackColor;
-    }
-    ::ForeColor(color);
-    mFCol = col;
-  }
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::SelBackground(PIColors col) 
+void PIBaseWdgMac::SetBackgroundColor(PIColors col)
 {
   if (mPane->FocusDraw()) {
@@ -352,232 +152,6 @@
 }
 
-/* --Methode-- */
-void PIBaseWdgMac::SelGOMode(PIGOMode mod)
-{
-if (mod == mGOm)  return;
-  if (mPane->FocusDraw())
-    switch (mod)
-    {
-      case PI_GOCopy :
-        ::PenMode(patCopy);
-        mGOm = mod;
-        break;
-      case PI_GOXOR :
-        ::PenMode(patXor);
-        mGOm = mod;
-        break;
-    }
-return;
-}
-
-
-/* --Methode-- */
-void PIBaseWdgMac::SelFont(PIFontSize sz, PIFontAtt att)
-{
-  switch(sz) {
-      case PI_SmallSizeFont:
-        SelFontSzPt(9, att);
-        break;
-      case PI_NormalSizeFont:
-        SelFontSzPt(12, att);
-        break;
-      case PI_BigSizeFont:
-        SelFontSzPt(14, att);
-        break;
-  }
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::SelFontSzPt(int npt, PIFontAtt att)
-{
-  if (mPane->FocusDraw()) {
-    ::TextFont(applFont);
-    ::TextSize(npt);
-    switch(att) {
-      case PI_RomanFont:
-        ::TextFace(0);
-        break;
-      case PI_BoldFont:
-        ::TextFace(bold);
-        break;
-      case PI_ItalicFont:
-        ::TextFace(italic);
-        break;
-    }
-  }
-  mFSize = npt;
-  mFAtt  = att;
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::SelLine(PILineAtt att)
-{
-  if (mPane->FocusDraw()) {
-    switch(att) {
-      case PI_NormalLine:
-        ::PenSize(1,1);
-        break;
-      case PI_ThinLine:
-        ::PenSize(1,1);  // Mettre en pointille, ou bien commentaire pour Laser ?
-        break;
-      case PI_ThickLine:
-        ::PenSize(2,2);
-        break;
-    }
-  }
-  mLAtt = att;
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::SelPointerShape(PIPointer ptr)
-{
-  CursHandle c;
-  if (mPane->FocusDraw()) {
-    switch(ptr) {
-      case PI_ArrowPointer:
-        cursor = &qd.arrow;
-        break;
-      case PI_CrossPointer:
-        c = GetCursor(crossCursor);
-        HLock((Handle)c);
-        cursor = c ? *c : NULL;
-        break;
-      case PI_HandPointer:
-        c = GetCursor(128);
-        HLock((Handle)c);
-        cursor = c ? *c : NULL;
-        break;
-    }
-  }
-  mPtrS = ptr;
-}
-
-/* --Methode-- */
-void PIBaseWdgMac::SelMarker(int msz, PIMarker mrk)
-{
-if (msz > 1)  { mMrk = mrk;  mMrkSz = msz; }
-else  { mMrk = PI_DotMarker;  mMrkSz = 1; }
-return;
-}
-
-/* --Methode-- */
-PIColors  PIBaseWdgMac::GetForeground() 
-{
-return (mFCol);
-}
-
-/* --Methode-- */
-PIColors  PIBaseWdgMac::GetBackground() 
+PIColors  PIBaseWdgMac::GetBackgroundColor() 
 {
 return (mBCol);
 }
-
-
-/* --Methode-- */
-PIGOMode   PIBaseWdgMac::GetGOMode()
-{
-return (mGOm);
-}
-
-/* --Methode-- */
-PIFontAtt  PIBaseWdgMac::GetFontAtt()
-{
-return (mFAtt);
-}
-
-/* --Methode-- */
-int        PIBaseWdgMac::GetFontSize()
-{
-return (mFSize);
-}
-
-/* --Methode-- */
-PILineAtt  PIBaseWdgMac::GetLineAtt()
-{
-return (mLAtt);
-}
-
-/* --Methode-- */
-PIPointer  PIBaseWdgMac::GetPointerShape()
-{
-return (mPtrS);
-}
-
-/* --Methode-- */
-PIMarker   PIBaseWdgMac::GetMarker()
-{
-return (mMrk);
-}
-
-/* --Methode-- */
-int        PIBaseWdgMac::GetMarkerSize()
-{
-return (mMrkSz);
-}
-
-
-
-/* --Methode-- */
-bool PIBaseWdgMac::AdjustCursor()
-{
-  if (cursor) {
-    ::SetCursor(cursor);
-    return true;
-  }
-  return false;
-}
-
-/* --Methode-- 
-void PIBaseWdgMac::Refresh()
-{
-if (mPane->IsVisible())
-  Draw();
-}
-   J'ai mis cette fonction ds PIWdgMac::IsVisible()    Reza $CHECK$  01/12/97 
-*/
-
-
-
-void PIBaseWdgMac::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 87)
+++ trunk/SophyaPI/PI/pibwdgmac.h	(revision 88)
@@ -24,66 +24,19 @@
   virtual void       ActivateKeyboard();
 
-//  Trace graphiques
   virtual void       EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
-  virtual void       DrawString(int x, int y, char* s, int pos = 0);
-  virtual void       DrawOpaqueString(int x, int y, char* s, int pos = 0);
-  virtual void       DrawLine(int x1, int y1, int x2, int y2);
-  virtual void       DrawBox(int x0, int y0, int dx, int dy);
-  virtual void       DrawFBox(int x0, int y0, int dx, int dy);
-  virtual void       DrawCircle(int x0, int y0, int r);
-  virtual void       DrawFCircle(int x0, int y0, int r);
-  virtual void       DrawPolygon(int *x, int *y, int n);  
-  virtual void       DrawFPolygon(int *x, int *y, int n);  
-  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);  
-  
-  virtual void       SelForeground(PIColors col=PI_White);
-  virtual void       SelBackground(PIColors col=PI_Black);
-  virtual void       SelGOMode(PIGOMode mod=PI_GOCopy);
-  virtual void       SelFont(PIFontSize sz=PI_NormalSizeFont, 
-                             PIFontAtt att=PI_RomanFont);
-  virtual void       SelFontSzPt(int npt=12, PIFontAtt att=PI_RomanFont); 
-  virtual void       SelLine(PILineAtt att=PI_NormalLine);
   virtual void       SelPointerShape(PIPointer ptr=PI_ArrowPointer);
-  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 
-  virtual PIColors   GetForeground();
-  virtual PIColors   GetBackground();
-  virtual PIGOMode   GetGOMode();
-  virtual PIFontAtt  GetFontAtt();
-  virtual int        GetFontSize();
-  virtual PILineAtt  GetLineAtt();
+  virtual void       SetBackgroundColor(PIColors col=PI_White);
+  virtual PIColors   GetBackgroundColor();
   virtual PIPointer  GetPointerShape();
-  virtual PIMarker   GetMarker();
-  virtual int        GetMarkerSize();
-  virtual int        GetFontHeight(int& asc, int& desc);
-
+  virtual void       AssignKeyboard() {}
 
 protected:
   friend class       PIUpdAttachment;
   virtual bool       AdjustCursor();
-  void               LocalToMacPortPoint(int x, int y, int& xm, int& ym);
   CursPtr            cursor;
   
-  PolyHandle         MakePoly(int *x, int *y, int n);
 
-  PIColors  mFCol, mBCol;
-  PIGOMode  mGOm;
   PIPointer mPtrS;
-  PIFontAtt mFAtt;
-  PILineAtt mLAtt;
-  int       mFSize;
-  PIMarker  mMrk;
-  int       mMrkSz;
+  PIColors  mBCol;
 };
 
Index: trunk/SophyaPI/PI/picons.cc
===================================================================
--- trunk/SophyaPI/PI/picons.cc	(revision 87)
+++ trunk/SophyaPI/PI/picons.cc	(revision 88)
@@ -481,5 +481,5 @@
 {
 opmc->SetMsgParent((PIMsgHandler*)this);
-opmc->Show(this, x, y);
+opmc->Show((PIWdg*)this, x, y);
 }
 
Index: trunk/SophyaPI/PI/pigraphgen.h
===================================================================
--- trunk/SophyaPI/PI/pigraphgen.h	(revision 87)
+++ trunk/SophyaPI/PI/pigraphgen.h	(revision 88)
@@ -131,2 +131,10 @@
 
 #endif
+
+typedef PIGraphicGen PIGraphic;
+
+// hierarchie apparente
+//   PIGraphic               ( == Gen, mais pas visible de l'utilisateur).
+//     PIGraphicWin   ( == X ou Mac)
+//     PIGraphicPS
+//     PIGraphicUC
Index: trunk/SophyaPI/PI/piimage.cc
===================================================================
--- trunk/SophyaPI/PI/piimage.cc	(revision 87)
+++ trunk/SophyaPI/PI/piimage.cc	(revision 88)
@@ -386,5 +386,5 @@
 
 /* --Methode-- */
-void PIImage::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+void PIImage::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
 {
 PIPixmap::Draw(g, x0, y0, dx, dy);
Index: trunk/SophyaPI/PI/piimage.h
===================================================================
--- trunk/SophyaPI/PI/piimage.h	(revision 87)
+++ trunk/SophyaPI/PI/piimage.h	(revision 88)
@@ -66,5 +66,5 @@
 
   virtual void Resize();
-  virtual void Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
+  virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
 
   virtual void But1Press(int x, int y);
Index: trunk/SophyaPI/PI/pimenumac.cc
===================================================================
--- trunk/SophyaPI/PI/pimenumac.cc	(revision 87)
+++ trunk/SophyaPI/PI/pimenumac.cc	(revision 88)
@@ -191,4 +191,11 @@
 }
 
+void
+PIPUMenuMac::Show(PIWdg *w, int px, int py)
+{
+  int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),py,px,1);
+  ItemSelected(item);
+}
+
 /* --Methode-- */
 PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom)
Index: trunk/SophyaPI/PI/pimenumac.h
===================================================================
--- trunk/SophyaPI/PI/pimenumac.h	(revision 87)
+++ trunk/SophyaPI/PI/pimenumac.h	(revision 88)
@@ -61,4 +61,5 @@
                ~PIPUMenuMac();
 virtual void   Show();
+virtual void   Show(PIWdg *w, int px, int py);
 };
 
Index: trunk/SophyaPI/PI/pipixmapmac.cc
===================================================================
--- trunk/SophyaPI/PI/pipixmapmac.cc	(revision 87)
+++ trunk/SophyaPI/PI/pipixmapmac.cc	(revision 88)
@@ -76,11 +76,11 @@
 
 void
-PIPixmapMac::Draw(int,int,int,int)
+PIPixmapMac::Draw(PIGraphic* g,int,int,int,int)
 {
-  Draw();
+  Draw(g);
 }
 
 void
-PIPixmapMac::Draw()
+PIPixmapMac::Draw(PIGraphic* g)
 {
   DrawOff();
Index: trunk/SophyaPI/PI/pipixmapmac.h
===================================================================
--- trunk/SophyaPI/PI/pipixmapmac.h	(revision 87)
+++ trunk/SophyaPI/PI/pipixmapmac.h	(revision 88)
@@ -12,6 +12,6 @@
 
   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  Draw(PIGraphic* g);
+  virtual void  Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
   virtual void	Refresh();
   virtual void	DrawOff();
Index: trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 87)
+++ trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 88)
@@ -158,5 +158,5 @@
 
 void
-PIScDrawWdg::Draw(PIGraphicGen* g)
+PIScDrawWdg::Draw(PIGraphic* g)
 {
   EraseWindow();
@@ -168,5 +168,5 @@
 
 void
-PIScDrawWdg::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+PIScDrawWdg::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
 {
   float xmin,xmax,ymin,ymax;
@@ -199,5 +199,4 @@
   return((string)buff);
 }
-
 
 void
Index: trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- trunk/SophyaPI/PI/piscdrawwdg.h	(revision 87)
+++ trunk/SophyaPI/PI/piscdrawwdg.h	(revision 88)
@@ -26,6 +26,6 @@
   virtual void       Resize();
   
-  virtual void       Draw(PIGraphicGen* g);
-  virtual void       Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
+  virtual void       Draw(PIGraphic* g);
+  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
   virtual void       DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
   
Index: trunk/SophyaPI/PI/pistdwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 87)
+++ trunk/SophyaPI/PI/pistdwdgmac.cc	(revision 88)
@@ -74,5 +74,5 @@
 
 /* --Methode-- */
-void PITextMac::SetMutiLineMode(bool mlm)
+void PITextMac::SetMutiLineMode(bool /*mlm*/)
 {
 return;
@@ -181,4 +181,96 @@
 }
 
+/************* PIScrollBarMac ************/
+static ControlActionUPP	sSBarAction2 = nil;
+
+
+PIScrollBarMac::PIScrollBarMac(PIContainerGen* par, char* nom, PIMessage msg,
+                       bool vert, int sx, int sy, int px, int py)
+: PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py)
+{
+  delete mPane;
+  LStr255 titre(nom);
+  mPane = new LStdControl(mPaneInfo, msg_Click, 1, 1, 10,
+						  scrollBarProc, 130, titre, (Int32) this);
+  ((LStdControl*)mPane)->AddListener(this);
+  
+  if (sSBarAction2 == nil) {	// Allocate UPP if necessary
+	sSBarAction2 = NewControlActionProc((ProcPtr) SBarAction);
+  }
+  ((LStdControl*)mPane)->SetActionProc(sSBarAction2);
+}
+
+PIScrollBarMac::~PIScrollBarMac()
+{}
+
+void
+PIScrollBarMac::ListenToMessage(MessageT inMessage, void *)
+{
+  if (inMessage == msg_ThumbDragged)
+    Send(myMsg, PIMsg_DataChanged);
+}
+
+void
+PIScrollBarMac::SetMinMax(int min, int max)
+{
+  ((LStdControl*)mPane)->SetMinValue(min);
+  ((LStdControl*)mPane)->SetMaxValue(max);
+}
+
+void
+PIScrollBarMac::SetValue(int val)
+{
+  StopListening();
+  ((LStdControl*)mPane)->SetValue(val);
+  StartListening();
+}
+
+int
+PIScrollBarMac::GetValue()
+{
+  return ((LStdControl*)mPane)->GetValue();
+}
+
+pascal void
+PIScrollBarMac::SBarAction(
+	ControlHandle	inMacControl,
+	Int16			inPart)
+{
+	PIScrollBarMac		*theScroller =
+							(PIScrollBarMac *) GetControlReference(inMacControl);
+	theScroller->HandleScroll(inPart);
+}
+
+void
+PIScrollBarMac::HandleScroll(
+	const Int16		inPart)
+{
+    int delta;
+	switch (inPart) {				// Determine how much to scroll
+	
+		case kControlUpButtonPart:	// Scroll left one unit
+			delta = -1;
+			break;
+			
+		case kControlDownButtonPart:	// Scroll right one unit
+			delta = 1;
+			break;
+			
+		case kControlPageUpPart:		// Scroll left by Frame width
+										//   less one unit of overlap
+			delta = -10;
+			break;
+			
+		case kControlPageDownPart:		// Scroll right by Frame width
+										//   less one unit of overlap
+			delta = 10;
+			break;
+	}
+	
+	if (delta != 0) {
+	    SetValue(GetValue()+delta);
+	}
+}
+
 /************* PICheckBoxMac ************/
 #include <LStdControl.h>
Index: trunk/SophyaPI/PI/pistdwdgmac.h
===================================================================
--- trunk/SophyaPI/PI/pistdwdgmac.h	(revision 87)
+++ trunk/SophyaPI/PI/pistdwdgmac.h	(revision 88)
@@ -57,4 +57,27 @@
 };
 
+class PIScrollBarMac : public PIScrollBarGen
+{
+public:
+                     PIScrollBarMac(PIContainerGen* par, char* nom, 
+                                PIMessage msg=PIMsg_DataChanged, bool vert=true,
+                                int sx=100, int sy=10, int px=0, int py=0);
+                    ~PIScrollBarMac();
+
+  virtual void       ActivateDrag(bool /*acd*/=false) {};
+  virtual void       SetMinMax(int min, int max);
+  virtual void       SetValue(int val);
+  virtual int        GetValue(); 
+  virtual void	     ListenToMessage(MessageT inMessage, void *ioParam);
+  virtual void	     HandleScroll(const Int16 inPart);
+  virtual void       SetSize(int sz) {msz = sz;}
+  virtual int        GetSize() {return msz;}
+protected:
+  static pascal void SBarAction(ControlHandle inMacControl,
+								Int16 inPart);
+  int msz;
+};
+
+
 class PICheckBoxMac : public PICheckBoxGen
 {
@@ -75,4 +98,5 @@
 typedef PITextMac    PIText;
 typedef PIScaleMac   PIScale;
+typedef PIScrollBarMac PIScrollBar;
 typedef PICheckBoxMac PICheckBox;
 
Index: trunk/SophyaPI/PI/piupdattachment.cc
===================================================================
--- trunk/SophyaPI/PI/piupdattachment.cc	(revision 87)
+++ trunk/SophyaPI/PI/piupdattachment.cc	(revision 88)
@@ -9,5 +9,5 @@
 : LAttachment(), myWdg(wdg)
 {
-
+  myGraphic = (PIGraphicMac*) wdg->WindowGraphic();
 }
 
@@ -15,4 +15,5 @@
 {
   if (lastCursPane == this) lastCursPane = NULL;
+  delete myGraphic;
 }
 
@@ -22,5 +23,5 @@
     switch(msg) {
       case msg_DrawOrPrint:
-        myWdg->Draw();
+        myWdg->Draw(myGraphic);
  		break;
       case msg_Resize:
Index: trunk/SophyaPI/PI/piupdattachment.h
===================================================================
--- trunk/SophyaPI/PI/piupdattachment.h	(revision 87)
+++ trunk/SophyaPI/PI/piupdattachment.h	(revision 88)
@@ -18,4 +18,5 @@
 
  PIBaseWdgMac* myWdg;
+ PIGraphicMac* myGraphic;
  
  friend class PIPPApplMac;
Index: trunk/SophyaPI/PI/piwdggen.h
===================================================================
--- trunk/SophyaPI/PI/piwdggen.h	(revision 87)
+++ trunk/SophyaPI/PI/piwdggen.h	(revision 88)
@@ -74,5 +74,5 @@
   virtual bool           ClaimSelection(unsigned int typ=PICP_string)                     = 0;
   virtual void           SelectionLost()                                                  = 0;
-  virtual int            RequestSelection(unsigned int typ=PICP_string)                   = 0;
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string)                   = 0;
   virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len)           = 0;
   virtual void           SelectionTransferEnd()                                           = 0;
Index: trunk/SophyaPI/PI/piwdgmac.cc
===================================================================
--- trunk/SophyaPI/PI/piwdgmac.cc	(revision 87)
+++ trunk/SophyaPI/PI/piwdgmac.cc	(revision 88)
@@ -167,5 +167,5 @@
 /* --Methode-- */
 // COPY
-bool PIWdgMac::ClaimSelection()
+bool PIWdgMac::ClaimSelection(unsigned int)
 {
   int l;
@@ -177,5 +177,5 @@
 
 /* --Methode-- */
-void PIWdgMac::LoseSelection()
+void PIWdgMac::SelectionLost()
 {
 }
@@ -183,5 +183,5 @@
 /* --Methode-- */
 // PASTE
-void PIWdgMac::RequestSelection()
+unsigned int PIWdgMac::RequestSelection(unsigned int)
 {
   Handle h = NewHandle(0);
@@ -190,4 +190,5 @@
     CopyFromSelection(*h, l);
   }
+  return 1;
 }
 
@@ -204,4 +205,10 @@
 
 /* --Methode-- */
+void PIWdgMac::PasteSelection(unsigned int, void *buff, unsigned int l)
+{
+  CopyFromSelection((char*) buff, l);
+}
+
+/* --Methode-- */
 char* PIWdgMac::SelectionString(int& len)
 {
@@ -214,4 +221,15 @@
 
 /* --Methode-- */
+void* PIWdgMac::ProvideSelection(unsigned int&, unsigned int& len)
+{
+  return SelectionString(len);
+}
+
+/* --Methode-- */
+void PIWdgMac::SelectionTransferEnd()
+{
+}
+
+/* --Methode-- */
 void PIWdgMac::Manage()
 {
Index: trunk/SophyaPI/PI/piwdgmac.h
===================================================================
--- trunk/SophyaPI/PI/piwdgmac.h	(revision 87)
+++ trunk/SophyaPI/PI/piwdgmac.h	(revision 88)
@@ -35,9 +35,15 @@
   
 //  Gestion de copier-coller
-  virtual bool           ClaimSelection();
-  virtual void           LoseSelection();
-  virtual void           RequestSelection();
+// $$CHECK$$ Pourquoi les noms ont-ils change ???
+// En plus, pour des trucs tout aussi obscurs...
+// Et c'est quoi, typ, qui en plus n'est pas utilise sous X ???
+  virtual bool           ClaimSelection(unsigned int typ=PICP_string);
+  virtual void           SelectionLost();
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string);
+  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void           PasteSelection(unsigned int typ, void *, unsigned int l);
   virtual void           CopyFromSelection(char *, int l);
   virtual char*          SelectionString(int& len);
+  virtual void           SelectionTransferEnd();
 
 protected:
@@ -49,4 +55,6 @@
   SViewInfo				 mViewInfo;
   string                 mNom;
+  
+  friend class PIGraphicMac;
 };
 
