Index: /trunk/SophyaPI/PI/ex_dessin.cc
===================================================================
--- /trunk/SophyaPI/PI/ex_dessin.cc	(revision 126)
+++ /trunk/SophyaPI/PI/ex_dessin.cc	(revision 127)
@@ -40,5 +40,5 @@
 
 /* --Methode-- */
-void ExBWdg::Draw(PIGraphicGen* g)
+void ExBWdg::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
 {
 EraseWindow();
Index: /trunk/SophyaPI/PI/ex_dessin.h
===================================================================
--- /trunk/SophyaPI/PI/ex_dessin.h	(revision 126)
+++ /trunk/SophyaPI/PI/ex_dessin.h	(revision 127)
@@ -22,5 +22,5 @@
 
   virtual void   Resize();
-  virtual void   Draw(PIGraphicGen* g);
+  virtual void   Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
 
   virtual void   But1Press(int x, int y);
Index: /trunk/SophyaPI/PI/lut.h
===================================================================
--- /trunk/SophyaPI/PI/lut.h	(revision 126)
+++ /trunk/SophyaPI/PI/lut.h	(revision 127)
@@ -28,5 +28,5 @@
     if (x < Min())  return(0);
     if (x >= Max() )  return(nLevel+1);  
-    int k = (x-Min())/tablebinwidth;
+    int k = (int)((x-Min())/tablebinwidth);
     return(table[k]); 
     } 
Index: /trunk/SophyaPI/PI/pibwdggen.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.cc	(revision 126)
+++ /trunk/SophyaPI/PI/pibwdggen.cc	(revision 127)
@@ -35,5 +35,5 @@
 {
 if ( IsVisible() )  { 
-  Draw(mWGrC);
+  Draw(mWGrC, 0, 0, XSize(), YSize());
   CallDrawers(mWGrC); 
 }
@@ -41,30 +41,14 @@
 }
 
-// On met une variable pour eviter des boucles infinies entre les deux methodes 
-// Draw(PIGraphic* g, int, int, int, int) et Draw(PIGraphic* g) 
-static int fgdrawloop = 0;
-
-/* --Methode-- */
-void PIBaseWdgGen::Draw(PIGraphic* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
-{
-if (fgdrawloop == 0) 
-  { fgdrawloop=1;  Draw(g); }
-fgdrawloop = 0;
-return;
-}
-
-/* --Methode-- */
-void PIBaseWdgGen::Draw(PIGraphic* g)
+
+/* --Methode-- */
+void PIBaseWdgGen::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
 {
 #ifdef DEBUG_RZXB
 puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! ");
 #endif
-if (g->kind() != PI_PSFileGraphics) EraseWindow(0, 0, XSize(), YSize());
-if (fgdrawloop == 0) 
-  { fgdrawloop=2;  Draw(g, 0, 0, XSize(), YSize()); }
-fgdrawloop = 0;
-return;
-}
-
+if (g->kind() != PI_PSFileGraphics) EraseWindow(x0, y0, dx, dy);
+return;
+}
 
 /* --Methode-- */
@@ -178,5 +162,5 @@
 if (!psf) return;
 PIGraphicPS grpsf(psf, (PIWdg *)this, ofx, ofy);
-Draw(&grpsf);
+Draw(&grpsf, 0, 0, XSize(), YSize());
 CallDrawers(&grpsf); 
 return;
@@ -298,5 +282,5 @@
 
 /* --Methode-- */
-void PIBaseWdgGen::CallDrawers(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+void PIBaseWdgGen::CallDrawers(PIGraphic* g, int x0, int y0, int dx, int dy)
 {
 float xmin,ymin, xmax, ymax;
Index: /trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.h	(revision 126)
+++ /trunk/SophyaPI/PI/pibwdggen.h	(revision 127)
@@ -58,5 +58,4 @@
 
 //  Fonctions qui doivent contenir le dessin du contenu du widget lui-meme
-  virtual void       Draw(PIGraphic* g);
   virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
   
@@ -99,5 +98,5 @@
 
 //  Trace des Drawers ...          
-  virtual void       CallDrawers(PIGraphicGen* g, int x0=0, int y0=0, int dx=0, int dy=0); 
+  virtual void       CallDrawers(PIGraphic* g, int x0=0, int y0=0, int dx=0, int dy=0); 
   virtual void       CallDrawer(int id);
 
Index: /trunk/SophyaPI/PI/picmapview.cc
===================================================================
--- /trunk/SophyaPI/PI/picmapview.cc	(revision 126)
+++ /trunk/SophyaPI/PI/picmapview.cc	(revision 127)
@@ -1,4 +1,5 @@
-#include <stdio.h>
-#include <string.h>
+// Module PI : Peida Interactive     PICMapView
+// Visualisation de table de couleur     R. Ansari  07/98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 
 #include "picmapview.h"
@@ -12,5 +13,5 @@
 
 {
-
+  cmap = NULL; 
 }
 
@@ -19,53 +20,65 @@
 PICMapView::~PICMapView()
 {
+  if (cmap) delete cmap;
 }
 
  
-
+/* --Methode-- */
+void PICMapView::SetColMap(PIColorMap* cmp, bool refr)
+{
+  if (cmap) delete cmap;
+  if (cmp == NULL)   cmap = NULL;
+  else cmap = new PIColorMap(*cmp);
+  if (refr)  Refresh();  
+  return;
+}
 
 /* --Methode-- */
-void PICMapView::Resize()
+void PICMapView::SetColMapId(CMapId cmapid, bool refr)
 {
-
+  if (cmap && (cmap->Type() == cmapid) && (cmapid != CMAP_OTHER) )  return;
+  if (cmap) delete cmap;
+  cmap = new PIColorMap(cmapid);
+  if (refr)  Refresh();  
+  return;
 }
 
 
 /* --Methode-- */
-void PICMapView::Draw(PIGraphicGen* g)
+void PICMapView::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
 {
-EraseWindow();
-g->SelLine(PI_NormalLine);
-g->DrawBox(10,10, XSize()-20, YSize()-20);
+  if (!cmap) { 
+    EraseWindow(0, 0, XSize(), YSize());
+    return;
+    }
+  // On presente la table de couleur verticalement si SizeY > SizeX 
+  // ou horizontale  si SizeX > SizeY
 
-g->SelLine(PI_ThinLine);
-g->DrawFBox(20, 20, 20, 20);
-g->DrawCircle(30, 30, 15);
+  int sx = XSize(); 
+  int sy = YSize(); 
 
-g->SelForeground(PI_Red);
-g->DrawFCircle(70, 30, 15);
-
-g->SelForeground(PI_Yellow);
-g->DrawFBox(10, 60, 100, 15);
-
-g->SelForeground(PI_Black);
-
-g->SelLine(PI_ThinLine);
-g->DrawLine(10, 120, 40, 120);
-g->SelLine(PI_NormalLine);
-g->DrawLine(40, 120, 70, 120);
-g->SelLine(PI_ThickLine);
-g->DrawLine(70, 120, 100, 120);
-
-g->SelForeground(PI_Magenta);
-g->DrawFCircle(120, 30, 15);
-g->SelForeground(PI_Grey);
-g->DrawFCircle(120, 60, 15);
-
-PIGrCoord x[5] = { 20, 35, 50, 65, 80 };
-PIGrCoord y[5] = { 130, 130, 130, 130, 130 };
-
-g->SelForeground(PI_Black);
-g->DrawMarkers(x, y, 5);
-return;
+  int k;
+  if (sx > sy) {    // horizontal
+    int xc, dx;
+    xc = 0;
+    for(k=0; k<cmap->NCol(); k++) {
+      dx = (sx-xc)/(cmap->NCol()-k);
+      g->SelForeground((*cmap), k);
+      g->DrawFBox(xc, 0, dx, sy);
+      xc += dx;
+    }
+  }
+  else  {    // vertical
+    int yc, dy;
+    yc = sy;
+    for(k=0; k<cmap->NCol(); k++) {
+      dy = yc/(cmap->NCol()-k);
+      yc -= dy;
+      g->SelForeground((*cmap), k);
+      g->DrawFBox(0, yc, sx, dy);
+    }
+  }
+  
+  return;
 }
 
Index: /trunk/SophyaPI/PI/picmapview.h
===================================================================
--- /trunk/SophyaPI/PI/picmapview.h	(revision 126)
+++ /trunk/SophyaPI/PI/picmapview.h	(revision 127)
@@ -1,2 +1,7 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Module PI : Peida Interactive     PICMapView
+// Visualisation de table de couleur     R. Ansari  07/98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
 #ifndef PICMAPVIEW_H_SEEN
 #define PICMAPVIEW_H_SEEN
@@ -5,20 +10,27 @@
 
 #include PIBWDG_H
+#include PICMAP_H
 
 class PICMapView : public PIBaseWdg
 {
 public:
+  enum {ClassId = 5150};
+
                   PICMapView(PIContainerGen *par, char *nom,
-                         int sx=10, int sy=10, int px=0, int py=0);
+                             int sx=256, int sy=10, int px=0, int py=0);
   virtual         ~PICMapView();
 
+  virtual long	  kind() {return ClassId; }
+
+  void            SetColMap(PIColorMap* cmp=NULL, bool refr=true);
+  void            SetColMapId(CMapId cmapid, bool refr=true);
 
 // Traitement des evenements   
 
-  virtual void   Resize();
-  virtual void   Draw(PIGraphicGen* g);
+  virtual void   Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
 
 
 protected:
+  PIColorMap* cmap;
 };
 
Index: /trunk/SophyaPI/PI/picons.cc
===================================================================
--- /trunk/SophyaPI/PI/picons.cc	(revision 126)
+++ /trunk/SophyaPI/PI/picons.cc	(revision 127)
@@ -228,6 +228,8 @@
   if (nmxrec > 0) {
     NMxRecall = (nmxrec > 5) ? nmxrec : 5;
+    if (mRStr)  delete[] mRStr;
     mRStr = new string[NMxRecall];
     mNComm = mRCindx = mRindx = 0;
+    mRStr[0] = "";
     }
   }
@@ -259,6 +261,6 @@
   if (mScb) mScb->SetValue(0); 
   mOffL = 0;
-}
-mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;
+  }
+else mOffL = (ldeb < mNL-mWSzL-1) ? ldeb : mNL-mWSzL-1;
 }
 
@@ -278,5 +280,5 @@
 
 /* --Methode-- */
-void PIConsole::Draw(PIGraphicGen* g)
+void PIConsole::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
 {
 EraseWindow();
@@ -332,11 +334,11 @@
       mCmdStr[mCLC] = '\0';
 //      printf("Keyb()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
-
 // Gestion de rappel des commandes 
-      mRStr[mRCindx] = mCmdStr;
-      mRCindx++;  mNComm++;
-      if (mRCindx >= NMxRecall)  mRCindx = 0;
-      mRindx = mRCindx;
-      
+      if (mCLC > 0) {
+        mRStr[mRCindx] = mCmdStr;
+        mRCindx++;  mNComm++;
+        if (mRCindx >= NMxRecall)  mRCindx = 0;
+        mRindx = mRCindx;
+        }
       Send( Msg(), PIMsg_OK, mCmdStr);
       ClrCmd();
@@ -358,5 +360,5 @@
 //      printf("Keyb()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
       if (mNComm > 0) {
-        int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall;
+        int nmxrec = ((mNComm+1) < NMxRecall) ? mNComm+1 : NMxRecall;
         if (key == PIK_Up)  {
           mRindx--; 
@@ -392,64 +394,4 @@
 }
 
-/*   Pour debugger le code - Reza 23/02/98 
-#ifdef DEBUG_PICONS
-static int lines = 0;
-if ( (kmod == PIKM_Alt) ) {
-  char buff[128];
-  int l = 0;
-  switch (toupper(key)) {
-  case 'P' :
-    DebugPrint(1);
-    break;
-  case 'H' :
-    DebugPrint(0);
-    break;
-  case 'J' :
-     AddChar('\n');
-    DebugPrint(0);
-     break;     
-  case 'R' :
-    for(l=0; l<1; l++) {
-      sprintf(buff, "Line type Reverse No %d ", lines);
-      AddStr(buff, PIVA_Reverse, false);
-      sprintf(buff, "Normal  ");
-      AddStr(buff, PIVA_Def, false);
-      sprintf(buff, "Bold  ");
-      AddStr(buff, PIVA_Bold, false);
-      lines++;
-    }   
-    Refresh();
-    break;
-  
-  case 'B' :
-    for(l=0; l<3; l++) {
-      sprintf(buff, "Line type Bold No %d \n", lines);
-      AddStr(buff, PIVA_Bold, false);
-      lines++;
-    }   
-    Refresh();
-    break;
-  
-  case 'I' :
-    for(l=0; l<3; l++) {
-      sprintf(buff, "Line type Italique No %d \n", lines);
-      AddStr(buff, PIVA_Ital, false);
-      lines++;
-    }   
-    Refresh();
-    break;
-  
-  case 'N' :
-    for(l=0; l<3; l++) {
-      sprintf(buff, "Line type Normal No %d \n", lines);
-      AddStr(buff, PIVA_Def, false);
-      lines++;
-    }   
-    Refresh();
-    break;
-  }
-}
-#endif
-*/
 
 /* --Methode-- */
Index: /trunk/SophyaPI/PI/picons.h
===================================================================
--- /trunk/SophyaPI/PI/picons.h	(revision 126)
+++ /trunk/SophyaPI/PI/picons.h	(revision 127)
@@ -1,2 +1,7 @@
+// This may look like C code, but it is really -*- C++ -*-
+// composant graphique de type console (terminal) 
+//                    R. Ansari   12/97
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
 #ifndef PICONSOLE_H
 #define PICONSOLE_H
@@ -36,5 +41,5 @@
 
 // Gestion des evenements input/draw 
-  virtual void       Draw(PIGraphicGen* g);
+  virtual void       Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
   virtual void       Resize();
   virtual void       Keyboard(int key, PIKeyModifier kmod);
Index: /trunk/SophyaPI/PI/pidrawer.h
===================================================================
--- /trunk/SophyaPI/PI/pidrawer.h	(revision 126)
+++ /trunk/SophyaPI/PI/pidrawer.h	(revision 127)
@@ -1,2 +1,6 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Objets traceur qui peuvent etre attaches a un PIBaseWidget
+//                             R. Ansari  97-98
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 #ifndef PIDRAWER_H
 #define PIDRAWER_H
Index: /trunk/SophyaPI/PI/pidrwtools.cc
===================================================================
--- /trunk/SophyaPI/PI/pidrwtools.cc	(revision 126)
+++ /trunk/SophyaPI/PI/pidrwtools.cc	(revision 127)
@@ -23,8 +23,15 @@
 void PIDrwTools::SetCurrentBaseWdg(PIBaseWdgGen* cbw)
 {
+if (mCurBW == cbw) return;
 mCurBW = cbw;
 if (cwdrwt)  { 
-  cwdrwt->mNlb->SetLabel("0");  
-  cwdrwt->mNDr = 0; 
+  if (mCurBW != NULL)  { 
+    cwdrwt->mNDr = mCurBW->NbDrawers()-1;
+    if (cwdrwt->mNDr < 0)  cwdrwt->mNDr = 0;
+    }
+  else cwdrwt->mNDr = 0;
+  char buff[32];
+  sprintf(buff,"%d", cwdrwt->mNDr);
+  cwdrwt->mNlb->SetLabel(buff);  
   }
 }
@@ -234,4 +241,8 @@
 char buff[92]; 
 mNDr = 0;
+if (mCurBW != NULL)  { 
+  mNDr = mCurBW->NbDrawers()-1;
+  if (mNDr < 0)  mNDr = 0;
+  }
 if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) {
   PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW;
@@ -240,5 +251,4 @@
   sprintf(buff, "%g  %g", scd->YMin(), scd->YMax());
   mText[1]->SetText(buff);
-  if (scd->NbDrawers() > 1)  mNDr = 1;
   }
 else {
Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 126)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 127)
@@ -13,4 +13,5 @@
 #include "piimgtools.h"
 #include "pidrwtools.h"
+#include PIAPP_H
 
 // --------------------------------------------------------------------------------
@@ -43,9 +44,19 @@
 
 
-zow = NULL;
-gvw = NULL; 
-trtw = NULL;
-trtlb = txw = NULL;
-SetTextWin(NULL);
+zow = NULL;   // Widget zoom
+gvw = NULL;   // widget vue globale
+cmvw = NULL;  // widget ColorMapView
+// Fenetre transient et Label pour affichage de l'info (texte PixVal)
+int tx, ty;
+PIApplicationPrefCompSize(tx, ty);
+tx *= 5;    ty = (int)(ty*0.8);
+trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0);
+trtw->SetAutoDelChilds(true);
+trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0);
+trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
+ustrtw = atrtw = false;
+if ((sx < 300) || (sy < 150) ) atrtw = true;
+showinfo = false;
+
 gpixm = zpixm = pixm = NULL;
 xsgpxm = xszpxm = xspxm = 0;
@@ -68,4 +79,8 @@
 SetColMap(CMAP_COLRJ32);
 
+// pour le copier-coller
+cpbuffer = NULL;
+cpbuflen = 0;
+
 SetBackgroundColor(PI_Black);
 
@@ -86,5 +101,4 @@
 if (pixm) delete pixm;
 if (zpixm) delete zpixm;
-if (txw)  txw->SetLabel("");
 if (zow) 
   {
@@ -100,9 +114,11 @@
   gvw->SetUserData(NULL, 0); 
   }
+if (cmvw)  cmvw->SetColMap(NULL, true);
 if (lut) delete lut;
 delete mdrw;
 delete gvdrw;
 if (aisup && img)  delete img;   // Suppression automatique d'image
-if (trtw)  delete trtw;
+delete trtw;
+if (cpbuffer)  delete[] cpbuffer;
 if (this == cur_piimage)  cur_piimage = NULL;
 }
@@ -181,24 +197,32 @@
 }
 
-
-/* --Methode-- */
-void PIImage::SetTextWin(PILabel * tw, bool trw, int tx, int ty)
-{
-txw = tw;
-if (trw)
-  {
-  if (trtw)  trtw->SetSize(tx, ty);
-  else
-    {
-    trtw = new PIWindow(this, "PixVal", PIWK_transient, tx, ty, 0, 0);
-    trtw->SetAutoDelChilds(true);
-    trtlb = new PILabel(trtw, "PixVal", tx, ty, 0, 0);
-    trtlb->SetBinding(PIBK_fixed,PIBK_fixed, PIBK_fixed,PIBK_fixed);
-    }
-  }
-else
-  if (trtw) { delete trtw; trtw = NULL;  trtlb = NULL; }
-
-return;
+/* --Methode-- */
+void PIImage::SetCMapWin(PICMapView * cw, bool refr)
+{
+cmvw = cw;
+if (cmvw && refr) cmvw->SetColMapId(GetColMapId(),true);
+}
+
+
+/* --Methode-- */
+void PIImage::UseInfoWin(bool trw)
+{
+ustrtw = trw;
+}
+
+/* --Methode-- */
+void PIImage::ShowInfo(bool si)
+{
+if (showinfo == si) return;
+showinfo = si;
+if (showinfo && img)  { 
+  char buff[256];
+  float x,y;
+  img->XYCoord(xpav, ypav, x, y);
+  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ", 
+          x, y , (*img)(xpav, ypav), xpav, ypav );
+  DrawInfo(mWGrC, buff);
+  }
+else DrawInfo(mWGrC, NULL);
 }
 
@@ -326,4 +350,5 @@
 if (zow)  zow->SetColMap(cmap, refr);
 if (gvw)  gvw->SetColMap(cmap, refr);
+if (cmvw) cmvw->SetColMapId(cmap, true);
 return;
 }
@@ -334,6 +359,5 @@
 {
 if (img == NULL)  return;
-if (mw)
-  {  
+if (mw)  {  
   ComputePixmap();
   Send(Msg(), PIMsg_Active);
@@ -341,19 +365,18 @@
   PIDrwTools::SetCurrentBaseWdg(this);
   }
+else {
+  char buff[256];
+  float x,y;
+  img->XYCoord(xpav, ypav, x, y);
+  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ", 
+          x, y , (*img)(xpav, ypav), xpav, ypav );
+  if (ustrtw || atrtw)  trtlb->SetLabel((string)buff);
+  else DrawInfo(mWGrC, buff);
+  }
 if (zow != NULL)   ComputeZoomPixmap();
 if (gvw != NULL)
   if ( (gvw->UserData() != this) || (mw) )  SetGloVPixmap();
-
-if (txw || trtlb)
-  {
-  char buff[256];
-  float x,y;
-  img->XYCoord(xpav, ypav, x, y);
-  sprintf(buff,"X= %g , Y= %g  PixVal= %g (%d,%d)", 
-          x, y , (*img)(xpav, ypav), xpav, ypav );
-  if (txw)  txw->SetLabel((string)buff);
-  if (trtlb)  trtlb->SetLabel((string)buff);
-  }
-
+if (cmvw) cmvw->SetColMapId(GetColMapId(),true);
+  
 return;
 }
@@ -363,4 +386,7 @@
 {
 // printf("PIImage::Resize\n");
+// On bascule sur la fenetre transient pour l'affichage des valeurs si fenetre trop petite
+if ((XSize() < 300) || (YSize() < 150) ) atrtw = true;  
+else atrtw = false;
 PIPixmap::Resize();
 CenterPave();
@@ -374,10 +400,18 @@
 PIPixmap::Draw(g, x0, y0, dx, dy);
 winovis = false;    // $CHECK$ Reza A enlever si possible 17/6/96
-if (curshow)
-  {
+if (curshow) {
   int xc,yc;
   PosImg2W(xpav, ypav, &xc, &yc);
   if ((xc >= x0) && (xc < x0+dx) && 
       (yc >= y0) && (yc < y0+dy) )  DrawCursor(g, xc, yc);
+  }
+
+if (showinfo) {
+  char buff[256];
+  float x,y;
+  img->XYCoord(xpav, ypav, x, y);
+  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ", 
+        x, y , (*img)(xpav, ypav), xpav, ypav );
+  DrawInfo(mWGrC, buff); 
   }
 
@@ -393,5 +427,32 @@
   if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes 
   if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options 
-  }
+
+// ----  Le copier ---- 
+  if (key == 'C' || key == 'c') { 
+    // On limite la taille a 48x48
+    int i1 = XPave();  
+    int i2 = ( XSzPave() < 48 ) ? i1+XSzPave() : i1+48;
+    int j1 = YPave();  
+    int j2 = ( YSzPave() < 48 ) ? j1+YSzPave() : i1+48;
+    if ( ( (i2-i1) < 1 ) || ((j2-j1) < 1) ) return;
+    if (!ClaimSelection())  return;  // On n'a pas pu prendre possession de la zone d'echange
+    if (cpbuffer)  delete[] cpbuffer;
+    cpbuflen = (j2-j1)*(i2-i1+2)*12+(j2-j1)+128;
+    cpbuffer = new char[cpbuflen];
+    sprintf(cpbuffer,"PIImage: Pave(%dx%d) en (%d, %d) MaxCopie= 48x48 \n", 
+            XSzPave(), YSzPave(), i1, j1);
+    int i,j;
+    int l = strlen(cpbuffer);
+    for(j=j1; j<j2; j++) {
+      sprintf(cpbuffer+l,"L %3d:",j);
+      l += 6;
+      for(i=i1; i<i2; i++) { sprintf(cpbuffer+l," %10g", (*img)(i, j));  l += 11; }
+      cpbuffer[l] = '\n';  l++;
+      }
+    cpbuffer[l] = '\0';
+    cpbuflen = l+1;
+    }
+  }
+
 
 else if (kmod == PIKM_Blank) {
@@ -429,5 +490,5 @@
 SelPointerShape(PI_CrossPointer);
 xpav = xp;  ypav = yp;
-ShowTrTxW();
+if (ustrtw || atrtw) ShowTrTxW();
 Apply(false);
 if (curshow)  DrawCursor(mWGrC, -1,-1);
@@ -453,5 +514,6 @@
 SelPointerShape(PI_ArrowPointer);
 if (curshow)  DrawCursor(mWGrC);
-if (trtw)  trtw->Hide();
+if (ustrtw || atrtw) trtw->Hide();
+else if (!showinfo) DrawInfo(mWGrC, NULL);
 return;
 }
@@ -474,5 +536,5 @@
 else mWGrC->SelForeground(PI_Magenta);
 mWGrC->SelLine(PI_NormalLine);
-ShowTrTxW();
+if (ustrtw || atrtw) ShowTrTxW();
 return;
 }
@@ -488,14 +550,15 @@
 dxmv = x-xmv0;  dymv = y-ymv0;
 mWGrC->DrawBox(xmv0, ymv0, dxmv, dymv);
-if (txw || trtlb)
-  {
-  char buff[256];  
-  float x,y;
-  img->XYCoord(xp, yp, x, y);
-  sprintf(buff,"X= %g , Y= %g  PixVal= %g  (C= %d,%d)", 
-          x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
-  if (txw)  txw->SetLabel((string)buff);
-  if (trtlb)  trtlb->SetLabel((string)buff);
-  }
+
+ {
+ char buff[256];  
+ float x,y;
+ img->XYCoord(xp, yp, x, y);
+ sprintf(buff," X= %g , Y= %g  Pix= %g  (C= %d,%d)   ", 
+         x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
+ if (ustrtw || atrtw) trtlb->SetLabel((string)buff);
+ else DrawInfo(mWGrC, buff);
+ }
+
 return;
 }
@@ -520,5 +583,6 @@
 Apply(false);
 if (curshow)  DrawCursor(mWGrC);
-if (trtw)  trtw->Hide();
+if (ustrtw || atrtw) trtw->Hide();
+else if (!showinfo) DrawInfo(mWGrC, NULL);
 return;
 }
@@ -536,5 +600,5 @@
 if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
 if (curshow)  DrawCursor(mWGrC,-1,-1);
-ShowTrTxW();
+if (ustrtw || atrtw) ShowTrTxW();
 SelPointerShape(PI_TDLRArrowPointer);
 xmv0 = xp;
@@ -551,11 +615,9 @@
 if (xmv0 < 0)  return;
 if ( PosW2Img(x, y, &xp, &yp) )  return;
-if (txw || trtlb)
-  {
-  char buff[256];
-  sprintf(buff,"DelX= %d , DelY= %d ", xp-xmv0, yp-ymv0);
-  if (txw) txw->SetLabel((string)buff);
-  if (trtlb) trtlb->SetLabel((string)buff);
-  }
+
+char buff[256];
+sprintf(buff," DelX= %d , DelY= %d    ", xp-xmv0, yp-ymv0);
+if (ustrtw || atrtw) trtlb->SetLabel((string)buff);
+else DrawInfo(mWGrC, buff);
 }
 
@@ -566,5 +628,5 @@
 
 SelPointerShape(PI_ArrowPointer);
-if (trtw)  trtw->Hide();
+if (ustrtw || atrtw) trtw->Hide();
 if (img == NULL)  return;
 if (xmv0 < 0)  return;
@@ -597,4 +659,23 @@
 mdrw->Refresh();
 }
+
+/* --Methode-- */
+void * PIImage::ProvideSelection(unsigned int& typ, unsigned int& len)
+{
+typ = PICP_string;
+len = cpbuflen;
+return(cpbuffer);
+}
+
+/* --Methode-- */
+void PIImage::SelectionLost()
+{
+if (cpbuffer)  delete[] cpbuffer;
+cpbuffer = NULL;
+cpbuflen = 0;
+return;
+}
+
+
 
 /* --Methode-- */
@@ -733,5 +814,5 @@
 
 /* --Methode-- */
-void PIImage::DrawCursor(PIGraphicGen* g) 
+void PIImage::DrawCursor(PIGraphic* g) 
 {
 int xc, yc;
@@ -744,5 +825,5 @@
  
 /* --Methode-- */
-void PIImage::DrawCursor(PIGraphicGen* g, int xc, int yc)
+void PIImage::DrawCursor(PIGraphic* g, int xc, int yc)
 {
 
@@ -776,4 +857,26 @@
 }
 
+ 
+/* --Methode-- */
+void PIImage::DrawInfo(PIGraphic* g, char* txt)
+{
+g->SelFont(PI_NormalSizeFont, PI_RomanFont);
+if (txt) { 
+  PIColors fgc = g->GetForeground();
+  PIGOMode gm = g->GetGOMode();
+  g->SelGOMode(PI_GOCopy);
+  g->SelForeground(PI_White);
+  g->SelBackground(PI_Black);
+  g->DrawOpaqueString(20, YSize()-5, txt);
+  g->SelGOMode(gm);
+  g->SelForeground(fgc);
+  }
+else {
+  int a,d,h;
+  h = g->GetFontHeight(a, d);
+  PIPixmap::Draw(g, 0, YSize()-10-h, XSize(), h+10); 
+  }
+return;
+}
 
 /* --Methode-- */
Index: /trunk/SophyaPI/PI/piimage.h
===================================================================
--- /trunk/SophyaPI/PI/piimage.h	(revision 126)
+++ /trunk/SophyaPI/PI/piimage.h	(revision 127)
@@ -1,2 +1,3 @@
+// This may look like C code, but it is really -*- C++ -*-
 // Module PI : Peida Interactive     PIImage
 // Affichage d image            R. Ansari  05/95
@@ -14,4 +15,5 @@
 #include PISTDWDG_H
 #include PIWIN_H
+#include "picmapview.h"
 
 class PIImage : public PIPixmap
@@ -35,8 +37,11 @@
                        { mdrw->SetAxesFlags(flags); mdrw->Refresh(); }
 
-// Fenetre de Zoom, text, ...
-  void SetZoomWin(PIPixmap * zw, bool refr=true);
-  void SetGloVWin(PIPixmap * zw, bool refr=true);
-  void SetTextWin(PILabel * tw, bool trw=true, int tx=350, int ty=30);
+// Fenetre de Zoom, Vue global, ColorMap, text, ...
+  void SetZoomWin(PIPixmap * zw, bool refr=false);
+  void SetGloVWin(PIPixmap * zw, bool refr=false);
+  void SetCMapWin(PICMapView * cw, bool refr=false);
+
+  void UseInfoWin(bool trw=false);
+  void ShowInfo(bool si=true); 
   void ShowCursor(bool sc=true); 
 
@@ -67,4 +72,5 @@
   void Apply(bool mw=true);
 
+// Gestion du trace et des evenements 
   virtual void Resize();
   virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
@@ -81,5 +87,8 @@
   virtual void Ptr3Move(int x, int y);
 
-  virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l);
+// Gestion du copier-coller
+  virtual void   PasteSelection(unsigned int typ, void *pdata, unsigned int l);
+  virtual void*  ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void   SelectionLost();
 
 //  Pour acces par les ImgTools (LutWind, ...)
@@ -94,6 +103,7 @@
   void SetGloVPixmap();
 
-  void DrawCursor(PIGraphicGen* g);
-  void DrawCursor(PIGraphicGen* g, int xc, int yc);
+  void DrawCursor(PIGraphic* g);
+  void DrawCursor(PIGraphic* g, int xc, int yc);
+  void DrawInfo(PIGraphic* g, char* txt);
 
   void ShowTrTxW();
@@ -127,8 +137,11 @@
   int xsgpxm, ysgpxm;
   PIElDrawer* gvdrw;
+// Fenetre d'affichage du ColMap
+  PICMapView* cmvw;
 // Fenetre/champ de texte
-  PILabel * txw;
   PILabel * trtlb;
   PIWindow * trtw;
+  bool ustrtw, atrtw;
+  bool showinfo;
 // Le pave et le curseur
   int xpav, ypav;
@@ -138,4 +151,7 @@
   int xcurs, ycurs;
   int xszpav, yszpav;
+// buffer pour copier-coller
+  char* cpbuffer;
+  int cpbuflen;
 
 //  PIImage courante 
Index: /trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.cc	(revision 126)
+++ /trunk/SophyaPI/PI/piimgtools.cc	(revision 127)
@@ -346,4 +346,12 @@
     break;
 
+  case 5311 :
+    mpii->ShowInfo(true);
+    break;
+
+  case 5312 :
+    mpii->ShowInfo(false);
+    break;
+
   case 5321 :
     mpii->ShowCursor(true);
Index: /trunk/SophyaPI/PI/pipixmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/pipixmapx.cc	(revision 126)
+++ /trunk/SophyaPI/PI/pipixmapx.cc	(revision 127)
@@ -60,5 +60,5 @@
 }
 
-/* --Methode-- */
+/*DEL07 --Methode-- 
 void PIPixmapX::Draw(PIGraphicGen* g)
 {
@@ -67,21 +67,26 @@
 if (g->kind() == PI_PSFileGraphics ) {
     g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
-  /*  Il faut faire quelque chose Sinon ??! */ 
+    //  Il faut faire quelque chose Sinon ??! 
   }
 else  Draw(g, 0, 0, XSize(), YSize());
 }
+*/
 
 /* --Methode-- */
-void PIPixmapX::Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy)
+void PIPixmapX::Draw(PIGraphic* g, int x0, int y0, int dx, int dy)
 {
-int mx, my, ox, oy;
-Window xw;
-Display * mdsp;
+
 if (!g) return; 
-if (g->kind() == PI_PSFileGraphics ) return;
 if ((myximg == NULL) || (cmap == NULL)) return;
 
-xw = XtWindow(XtWdg());
-mdsp = PIXDisplay();
+if (g->kind() == PI_PSFileGraphics ) {
+  if (pixmap) g->DrawPixmap(ofx, ofy, pixmap, nx, ny, cmap);
+  return;
+  }
+
+Window xw = XtWindow(XtWdg());
+Display * mdsp = PIXDisplay();
+
+int mx, my, ox, oy;
 
 if (x0 < 0)  x0 = 0;
Index: /trunk/SophyaPI/PI/pipixmapx.h
===================================================================
--- /trunk/SophyaPI/PI/pipixmapx.h	(revision 126)
+++ /trunk/SophyaPI/PI/pipixmapx.h	(revision 127)
@@ -13,6 +13,5 @@
   virtual void  Refresh();
   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, int x0, int y0, int dx, int dy);
 
 
Index: /trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 126)
+++ /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 127)
@@ -5,6 +5,4 @@
 #ifndef PISCDRAWWDG_H
 #define PISCDRAWWDG_H
-
-#include <vector>
 
 #include "pisysdep.h"
