Index: /trunk/SophyaPI/PI/pibwdggen.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdggen.h	(revision 79)
+++ /trunk/SophyaPI/PI/pibwdggen.h	(revision 80)
@@ -51,4 +51,5 @@
   virtual PIColors   GetBackgroundColor()                                    = 0;
   virtual PIPointer  GetPointerShape()                                       = 0;
+  virtual void       AssignKeyboard()                                        = 0;
 
 //  Fonction qui doit etre appelee pour rafraichir la fenetre 
Index: /trunk/SophyaPI/PI/pibwdgx.cc
===================================================================
--- /trunk/SophyaPI/PI/pibwdgx.cc	(revision 79)
+++ /trunk/SophyaPI/PI/pibwdgx.cc	(revision 80)
@@ -161,4 +161,10 @@
 
 /* --Methode-- */
+void PIBaseWdgX::AssignKeyboard()
+{
+XSetInputFocus(XtDisplay (XtWdg()), XtWindow(XtWdg()), RevertToParent, PIXGetLastEventTime());
+}
+
+/* --Methode-- */
 PIColors   PIBaseWdgX::GetBackgroundColor()
 {
Index: /trunk/SophyaPI/PI/pibwdgx.h
===================================================================
--- /trunk/SophyaPI/PI/pibwdgx.h	(revision 79)
+++ /trunk/SophyaPI/PI/pibwdgx.h	(revision 80)
@@ -32,4 +32,5 @@
   virtual PIColors   GetBackgroundColor();
   virtual PIPointer  GetPointerShape();
+  virtual void       AssignKeyboard();
 
 //  Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt )
Index: /trunk/SophyaPI/PI/picons.cc
===================================================================
--- /trunk/SophyaPI/PI/picons.cc	(revision 79)
+++ /trunk/SophyaPI/PI/picons.cc	(revision 80)
@@ -20,8 +20,9 @@
 
 static int CmdStrLen = 256;
+static int PIVA_Select = 128;
 
 /* --Methode-- */
 PIConsole::PIConsole(PIContainer* par, char* nom, PIMessage msg,
-                     int nl, int nc, int sx, int sy, int px, int py) :
+                     int nl, int nc, int sx, int sy, int px, int py, bool scb) :
 PIBaseWdg(par, nom, sx, sy, px, py) 
 {
@@ -35,6 +36,7 @@
 mCCP = mCLC = 0;
 mDCOff = 0;
-AssocScrollBar(NULL);
+
 SetMsg(msg);
+
 int i;
 for(i=0; i<mNL; i++) {
@@ -54,6 +56,6 @@
 mCPBuffer = NULL;
 mCPBufLen = 0;
-mCPbeginC =  mCPendC = 0;
-mCPbeginL = mCPendL = 0;
+mCPbeginC =  mCPendC = -1;
+mCPbeginL = mCPendL = -1;
 
 SetPrompt("Cmd> ");
@@ -63,4 +65,7 @@
 mCurL = mNL-mWSzL-1; 
 mCurC = 0;
+
+// Pour ajouter un scroll-bar
+AssocScrollBar(par, nom, scb, sx, sy, px, py);
 
 // Pour le menu des options : Fontes, couleur, ...
@@ -76,7 +81,9 @@
 nb_opmc++;
 
-ActivateKeyboard();
-// ActivateButton(1);   Pour permettre la selection 
-ActivateButton(3); // Pour afficher le menu des options (Fontes/couleur)
+ActivateKeyboard();  // Gestion de l'edition 
+ActivateButton(1);   //  Action selection / copier - coller 
+ActivateMove(1);     //      "    "     "  
+ActivateButton(2);   //      "    "     "  
+ActivateButton(3);   // Pour afficher le menu des options (Fontes/couleur)
 Manage();
 return;
@@ -91,4 +98,5 @@
 delete[] mStrBuf;
 delete[] mCmdStr;
+if (mScb) delete mScb;
 nb_opmc--;
 if (nb_opmc == 0) { delete opmc;  opmc=NULL; }
@@ -152,5 +160,5 @@
 
 /* --Methode-- */
-void PIConsole::SelectFont(PIFontSize sz, bool autosz)
+void PIConsole::SelectFont(PIFontSize sz)
 {
 int asc, desc;
@@ -162,5 +170,4 @@
 mWSzC = XSize()/mFLarg - 2;
 mOffL = 0;
-if (autosz) SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut);
 if (mScb) {
   mScb->SetMinMax(0, NbLines()-1);
@@ -170,4 +177,21 @@
 }
 
+/* --Methode-- */
+void PIConsole::AutoSize()
+{
+int dsz[2];
+dsz[0] = (mNC+2)*mFLarg - XSize();
+dsz[1] = (mWSzL+1)*mFHaut - YSize();
+Send(Msg(), PIMsg_ResizeRequest, dsz);
+SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut);
+}
+
+/* --Methode-- */
+void PIConsole::PreferedSize(int& sx, int& sy)
+{
+sx = (mNC+2)*mFLarg;
+sy = (mWSzL+1)*mFHaut;
+return;
+}
 
 /* --Methode-- */
@@ -222,17 +246,4 @@
 }
 
-/* --Methode-- */
-void PIConsole::AssocScrollBar(PIScrollBar* scb)
-{
-mScb = scb;
-if (mScb)  { 
-  msgScb = mScb->Msg();
-  mScb->SetMsgParent(this);
-  mScb->SetMinMax(0, NbLines()-1);
-  mScb->SetSize(WindNbLines());
-  mScb->SetValue(NbLines()-WindNbLines()-1);
-  }
-else msgScb = 0;
-}
 
 /* --Methode-- */
@@ -256,9 +267,22 @@
 }
 
-static int lines = 0;
 
 /* --Methode-- */
 void PIConsole::Keyboard(int key, PIKeyModifier kmod)
 {
+
+if (kmod == PIKM_Alt) {
+  if (key == 'O' || key == 'o') {   // Menu des options 
+    opmc->SetMsgParent((PIMsgHandler*)this);
+    opmc->Show(); 
+    return;
+    }
+  else if (key == 'A' || key == 'a') {  // Pour tout selectionner
+    mCPbeginC = 0; mCPendC = XSize(); 
+    mCPbeginL = 0;  mCPendL = YSize(); 
+    SaveSelection();
+    return;
+    }
+  }
 
 if (mNCmdL < 1)  return;
@@ -283,12 +307,4 @@
 else if (kmod == PIKM_Alt) {
   if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller)
-  else if (key == 'A' || key == 'a') {  // Pour tout selectionner
-    if (ClaimSelection()) {   // Definition de la zone de copie
-      SelectionLost();
-      mCPbeginC = 0; mCPendC = mNC; 
-      mCPbeginL = mNL-mWSzL-mOffL;  mCPendL = mNL-mOffL; 
-      }
-    else  mCPbeginC =  mCPendC = mCPbeginL = mCPendL = 0;
-    }
   }
 
@@ -323,5 +339,5 @@
     case PIK_Up :
     case PIK_Down :
-      printf("Process()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
+//      printf("Process()-Debug- CursorUp/Down(%d)  Index= %d %d  \n", key, mRindx, mRCindx);
       if (mNComm > 0) {
         int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall;
@@ -361,4 +377,5 @@
 /*   Pour debugger le code - Reza 23/02/98 
 #ifdef DEBUG_PICONS
+static int lines = 0;
 if ( (kmod == PIKM_Alt) ) {
   char buff[128];
@@ -419,9 +436,44 @@
 */
 
-/* --Methode-- 
+/* --Methode-- */
 void PIConsole::But1Press(int x, int y)
 {
-printf("PIConsole::But1Press(%d %d ) \n", x, y);
-} */
+Send(Msg(), PIMsg_Active);
+AssignKeyboard();
+mWGrC->SelGOMode(PI_GOXOR);
+mWGrC->SelForeground(mFgC);
+mCPbeginC = x;  mCPbeginL = y;
+mCPendC = mCPendL = -1;
+} 
+
+/* --Methode-- */
+void PIConsole::Ptr1Move(int x, int y)
+{
+if (mCPendC >= 0) mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+mCPendC = x;  mCPendL = y;
+mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+}
+ 
+/* --Methode-- */
+void PIConsole::But1Release(int x, int y)
+{
+if ( (mCPendC >= 0) && (mCPbeginC >= 0) ) { 
+  mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL);
+  mCPendC = x;  mCPendL = y;
+  }
+else { 
+  mCPbeginC =  mCPendC = -1;
+  mCPbeginL = mCPendL = -1;
+  }
+mWGrC->SelGOMode(PI_GOCopy);
+mWGrC->SelForeground(mFgC);
+SaveSelection();
+} 
+
+/* --Methode-- */
+void PIConsole::But2Press(int x, int y)
+{
+RequestSelection();  // Pour recuperer la selection = coller (copier/coller)
+} 
 
 /* --Methode-- */
@@ -446,9 +498,23 @@
 {
 // printf("Debug PIConsole::SelectionLost() %lx (L=%d)\n",(long)mCPBuffer, mCPBufLen);
-if (mCPBuffer) delete[] mCPBuffer;  
+if (!mCPBuffer) return;
+delete[] mCPBuffer;  
 mCPBuffer = NULL;
 mCPBufLen = 0;
-mCPbeginC =  mCPendC = 0;
-mCPbeginL = mCPendL = 0;
+mCPbeginC =  mCPendC = -1;
+mCPbeginL = mCPendL = -1;
+int i,j;
+int l1,l2;
+l1 = mNL+1; l2 = -1;
+for(i=0; i<mNL; i++)   // On enleve le bit select a tous les caracteres 
+  for(j=0; j<mNC; j++) 
+    if ( mAtt[mLPo[i]+j] & PIVA_Select) {
+      if (l1 > i)  l1 = i;
+      if (l2 < i)  l2 = i;
+      mAtt[mLPo[i]+j] &= ~PIVA_Select ;
+    }
+
+if (IsVisible() && l2 > -1)  DisplayLines(mWGrC, l1, l2);
+return;
 }
 
@@ -464,39 +530,12 @@
 {
 typ = PICP_string;
-if (!mCPBuffer) {  // Il faut effectuer la copie
-  int l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL);
-  if (l < 1) l = 1;
-  mCPBufLen = l;
-  mCPBuffer = new char[l+1];
-  int i,j,k;
-  k = 0;  
-  for(j=mCPbeginL; j<mCPendL; j++) { 
-    for(i=mCPbeginC; i<mCPendC; i++)  
-      { mCPBuffer[k] = mText[mLPo[j]+i]; k++; }
-    mCPBuffer[k] = '\n'; k++;
-    }
-  mCPBuffer[l] = '\0';
-  }
-// printf("PIConsole::ProvideSelection() %d-%d %d-%d -> %d (%lx)\n", mCPbeginL, mCPendL, mCPbeginC, mCPendC, 
-//       mCPBufLen,(long) mCPBuffer);
-int i; for(i=0; i<40; i++) putchar(mCPBuffer[i]);  printf("\n");
 len = mCPBufLen;
 return(mCPBuffer);
 }
 
-/* --Methode-- */
-void PIConsole::CmdAddChar(int key)
-{
-  int k, kmx;
-  if ( (mCCP < CmdStrLen) && isprint(key) ) {   // Ajout de caracteres
-    if (mCCP < mCLC)  { // Insertion au milieu de la chaine
-      kmx = (mCLC < CmdStrLen) ? mCLC : CmdStrLen-1;
-      //      printf(" ++DBG++ C=%d L=%d MX=%d KMX=%d\n", mCCP, mCLC, CmdStrLen,kmx);
-      for(k=kmx; k>mCCP; k--) mCmdStr[k] = mCmdStr[k-1];   mCLC = kmx+1;      
-    }
-    mCmdStr[mCCP] = key;  mCCP++; 
-    if (mCCP > mCLC)  mCLC = mCCP;
-    }
-}
+/* ----------------------------------------------------------------------------- */
+/*    ---------------------- Methodes protected -------------------------        */
+/* ----------------------------------------------------------------------------- */
+
 
 /* --Methode-- 
@@ -519,4 +558,33 @@
 */
 
+//  Gestion du scroll-bar
+static int Scb_Width = 14;
+
+/* --Methode-- */
+void PIConsole::AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py)
+{
+if (!scb) {
+  mScb = NULL;
+  msgScb = 0;
+  SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+  return;   
+}
+
+sx -= Scb_Width;
+SetSize(sx, sy);
+SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+char name[128];
+strcpy(name,"ScrollBar_");
+strncat(name, nom, 127);
+msgScb = Msg()+55;
+mScb = new PIScrollBar (par, name, msgScb, true, Scb_Width, sy, px+sx, py);
+mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed);
+  
+mScb->SetMsgParent(this);
+mScb->SetMinMax(0, NbLines()-1);
+mScb->SetSize(WindNbLines());
+mScb->SetValue(NbLines()-WindNbLines()-1);
+}
+
 /* --Methode-- */
 void PIConsole::ScrollUp()
@@ -558,10 +626,10 @@
                       PI_RomanFont, PI_RomanFont, PI_BoldFont, 
                       PI_ItalicFont, PI_RomanFont};
-PIColors fgc, bgc;
+PIColors fgc, bgc, dbgc;
 
 g->SelForeground(mFgC);
 g->SelBackground(mBgC);
 fgc =  g->GetForeground();
-bgc =  g->GetBackground();
+dbgc = bgc =  g->GetBackground();
 
 int dx = mFLarg;
@@ -592,4 +660,6 @@
      lva = mAtt[mLPo[l]+j];
      g->SelFont(mFTaille, vafat[lva]);
+     if (lva & PIVA_Select) bgc = PI_Grey; 
+     else bgc = dbgc;
      if (lva & PIVA_Reverse) { 
        g->SelForeground(bgc);
@@ -612,18 +682,12 @@
 
 g->SelForeground(fgc);
-g->SelBackground(bgc);
-return;
-}
-/* --Methode-- */
-void PIConsole::ClrCmd() 
-{ 
-mCCP = 0; mCLC = 0; mDCOff = 0;
-mCmdStr[0] = '\0'; 
-}  
+g->SelBackground(dbgc);
+return;
+}
 
 /* --Methode-- */
 void PIConsole::UpdCmdLine()
 {
-  char strg[260]; //debug
+//  char strg[260];  debug
 int l1,l2;
 l1 = l2 = mNL-1;
@@ -637,5 +701,5 @@
   mText[mLPo[mNL-1]+j] = mPrompt[j];
   mAtt[mLPo[mNL-1]+j] = PIVA_Ital;
-  strg[j] = mPrompt[j];  
+//  strg[j] = mPrompt[j];    debug
   }  
 jj2 = mWSzC-j1;
@@ -650,14 +714,36 @@
   mText[mLPo[mNL-1]+j] = mCmdStr[k];
   mAtt[mLPo[mNL-1]+j] = PIVA_Bold;
-  strg[j] = mCmdStr[k];  
+//  strg[j] = mCmdStr[k];   debug 
   k++;
   }  
 
-strg[j] = '\0';
+// strg[j] = '\0';   Debug
 // printf("UpdCmdLine() %d %d - %s (%d) \n [%d %d %d] %d\n", koff,kmx,strg,j1+mCCP-koff, mWSzC, j1, jj2, mCCP-(jj2/2));
 mAtt[mLPo[mNL-1]+j1+mCCP-koff] = PIVA_Reverse;    // Pour le curseur
 DisplayLines(mWGrC, l1, l2);
-
-}
+}
+
+/* --Methode-- */
+void PIConsole::ClrCmd() 
+{ 
+mCCP = 0; mCLC = 0; mDCOff = 0;
+mCmdStr[0] = '\0'; 
+}  
+
+/* --Methode-- */
+void PIConsole::CmdAddChar(int key)
+{
+  int k, kmx;
+  if ( (mCCP < CmdStrLen) && isprint(key) ) {   // Ajout de caracteres
+    if (mCCP < mCLC)  { // Insertion au milieu de la chaine
+      kmx = (mCLC < CmdStrLen) ? mCLC : CmdStrLen-1;
+      //      printf(" ++DBG++ C=%d L=%d MX=%d KMX=%d\n", mCCP, mCLC, CmdStrLen,kmx);
+      for(k=kmx; k>mCCP; k--) mCmdStr[k] = mCmdStr[k-1];   mCLC = kmx+1;      
+    }
+    mCmdStr[mCCP] = key;  mCCP++; 
+    if (mCCP > mCLC)  mCLC = mCCP;
+    }
+}
+
 
 /* --Methode-- */
@@ -666,4 +752,87 @@
 mFgC = fc; mBgC = bc;
 SetBackgroundColor(bc);
+}
+
+
+/* --Methode-- */
+void PIConsole::SaveSelection()
+{
+int i,j,k,l;
+int l1, l2, nl, nc;
+
+if (mCPbeginC > mCPendC) { j = mCPbeginC; mCPbeginC = mCPendC ; mCPendC = j; }
+if (mCPbeginL > mCPendL) { j = mCPbeginL; mCPbeginL = mCPendL ; mCPendL = j; }
+
+nc = (mCPendC-mCPbeginC)/mFLarg;
+nl = (mCPendL-mCPbeginL)/mFHaut;
+// printf("*DBG* NC=%d NL=%d \n",nc, nl); 
+l1 = mNL+1; l2 = -1;
+
+if (mCPBuffer) {
+  delete[] mCPBuffer;  
+  mCPBuffer = NULL;
+  mCPBufLen = 0;
+  for(i=0; i<mNL; i++)   // On enleve le bit select a tous les caracteres 
+    for(j=0; j<mNC; j++) 
+      if ( mAtt[mLPo[i]+j] & PIVA_Select) {
+        if (l1 > i)  l1 = i;
+        if (l2 < i)  l2 = i;
+        mAtt[mLPo[i]+j] &= ~PIVA_Select ;
+      }
+  }
+
+// printf("**DBG** Save: C= %d %d  L = %d %d \n", mCPbeginC, mCPendC, mCPbeginL, mCPendL);
+
+if (!ClaimSelection()) { 
+  mCPbeginC = mCPendC = -1;
+  mCPbeginL = mCPendL = -1;
+  return;
+  }
+
+
+// On transforme la position sur la fenetre en position en caracteres ds les buffers
+
+mCPbeginC = mCPbeginC/mFLarg-1;
+mCPendC = (int) ( (float)mCPendC/(float)mFLarg-0.8 );
+mCPbeginL = (int) ( (float)mCPbeginL/(float)mFHaut-0.5 ) ;
+mCPendL = (int) ( (float)mCPendL/(float)mFHaut-0.3 ) ;
+// printf("..DBG.. C= %d %d  L = %d %d ", mCPbeginC, mCPendC, mCPbeginL, mCPendL);
+j = mNL-mWSzL-mOffL;
+mCPbeginL += j;  mCPendL += j;
+// printf(" -> %d %d \n", mCPbeginL, mCPendL);
+
+if (mCPbeginC < 0) mCPbeginC = 0;
+if (mCPendC > mNC) mCPendC = mNC;
+if (mCPbeginL < 0) mCPbeginL = 0;
+if (mCPendL > mNL) mCPendL = mNL;
+
+if ( (nc > 0) && (nl > 0) ) {
+  l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL);
+  if (l < 0) l = 0;
+  mCPBufLen = l;
+  mCPBuffer = new char[l+1];  
+  k = 0;  
+  for(j=mCPbeginL; j<mCPendL; j++) { 
+    for(i=mCPbeginC; i<mCPendC; i++)  { 
+      mAtt[mLPo[j]+i] |= PIVA_Select;
+      mCPBuffer[k] = mText[mLPo[j]+i]; k++; 
+      }
+    mCPBuffer[k] = '\n'; k++;
+    }
+  mCPBuffer[l] = '\0';
+  if (l1 > mCPbeginL) l1 = mCPbeginL;
+  if (l2 < (mCPendL-1))  l2 = mCPendL-1;
+  }
+else {  
+  l = 0;   
+  mCPbeginC =  mCPendC = mCPbeginL = mCPendL = -1; 
+  mCPBufLen = 0;
+  mCPBuffer = new char[10];  
+  mCPBuffer[0] = mCPBuffer[1] = '\0';
+  }
+
+//  printf("*DBG* Save_Display %d %d \n", l1, l2);
+
+if (l2 > -1) DisplayLines(mWGrC, l1, l2);
 }
 
@@ -680,10 +849,13 @@
     case 3101 :
       SelectFont(PI_SmallSizeFont);
+      AutoSize();
       break;
     case 3102 :
       SelectFont(PI_NormalSizeFont);
+      AutoSize();
       break;
     case 3103 :
       SelectFont(PI_BigSizeFont);
+      AutoSize();
       break;
     case 3201 :
@@ -713,34 +885,2 @@
 }
 
-/*  --------------------------------------------------------------------------------- */
-/*  --------------   Classe PIScConsole : Console avec ScrollBar  ------------------- */
-/*  --------------------------------------------------------------------------------- */
-
-static int Scb_Width = 12;
-static int Scb_msg = 400;
-
-/* --Methode-- */
-PIScConsole::PIScConsole(PIContainer* par, char* nom, PIMessage msg,
-                     int nl, int nc, int sx, int sy, int px, int py) :
-PIContainer(par, nom, sx, sy, px, py) 
-{
-char name[80];
-strcpy(name,"TextArea_");
-strncat(name, nom, 70);
-mCons = new PIConsole(this, name, msg, nl, nc, sx-Scb_Width, sy, 0, 0);
-mCons->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
-strcpy(name,"ScrollBar_");
-strncat(name, nom, 70);
-mScb = new PIScrollBar (this, name, Scb_msg, true, Scb_Width, sy, sx-Scb_Width, 0);
-mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed);
-mCons->AssocScrollBar(mScb);
-Show();
-}
-
-/* --Methode-- */
-PIScConsole::~PIScConsole()
-{
-delete mCons;
-delete mScb;
-}
-
Index: /trunk/SophyaPI/PI/picons.h
===================================================================
--- /trunk/SophyaPI/PI/picons.h	(revision 79)
+++ /trunk/SophyaPI/PI/picons.h	(revision 80)
@@ -17,28 +17,33 @@
 class PIConsole : public PIBaseWdg {
 public:
-                     PIConsole(PIContainer* par, char* nom, PIMessage msg,
-                               int nl, int nc, int sx=300, int sy=200, int px=0, int py=0);
+                     PIConsole(PIContainer* par, char* nom, PIMessage msg, int nl, int nc, 
+                               int sx=300, int sy=200, int px=0, int py=0, bool scb=true);
                      ~PIConsole();
 
+// Interface d utilisation : 
           void       AddChar(char c, unsigned char va= PIVA_Def, bool ref=true);
           void       AddStr(char* strg, unsigned char va= PIVA_Def, bool ref=true);
 
-          void       SelectFont(PIFontSize sz=PI_NormalSizeFont, bool autosz=true);
+          void       SelectFont(PIFontSize sz=PI_NormalSizeFont);
+          void       AutoSize();
+          void       PreferedSize(int& sx, int& sy);
           void       AcceptCmd(bool acc=true, int nrecmx=20);
           void       SetPrompt(char* prompt); 
 
   inline  int        WindNbLines() { return mWSzL; }
-  inline  int        NbLines() { return mNL; }
-
-          void       SetDispOffset(int ldeb=-1);
-          void       AssocScrollBar(PIScrollBar* scb);
-          
+  inline  int        NbLines() { return mNL; }          
   inline  string     GetCmdString() { mCmdStr[mCLC] = '\0'; return((string)mCmdStr); }
 
+// Gestion des evenements input/draw 
   virtual void       Draw(PIGraphicGen* g);
   virtual void       Resize();
   virtual void       Keyboard(int key, PIKeyModifier kmod);
+  virtual void       But1Press(int x, int y);
+  virtual void       Ptr1Move(int x, int y);
+  virtual void       But1Release(int x, int y);
+  virtual void       But2Press(int x, int y);
   virtual void       But3Press(int x, int y);
 
+// Gestion de copier/coller
   virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
   virtual void*      ProvideSelection(unsigned int& typ, unsigned int& len);
@@ -47,5 +52,7 @@
 
 protected:
+          void       AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py);
           void       ScrollUp();
+          void       SetDispOffset(int ldeb=-1);
           void       ClearLine(int l);
           void       DisplayLines(PIGraphicGen* g, int l1, int l2);
@@ -54,5 +61,8 @@
           void       CmdAddChar(int key);
           void       SelFgBgCol(PIColors fc=PI_Black, PIColors bc=PI_White);
+          void       SaveSelection();  // Pour copier la selection dans un buffer
+
   virtual void       Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
 
   int mNL, mNC;         // Nb de lignes, colonnes total de la console
@@ -90,31 +100,3 @@
 
 
-class PIScConsole : public PIContainer {
-public :
-                     PIScConsole(PIContainer* par, char* nom, PIMessage msg,
-                               int nl, int nc, int sx=300, int sy=200, int px=0, int py=0);
-                     ~PIScConsole();
-
-  inline  void       AddChar(char c, unsigned char va= PIVA_Def, bool ref=true)
-                             { mCons->AddChar(c, va, ref); }
-  inline  void       AddStr(char* strg, unsigned char va= PIVA_Def, bool ref=true)
-                             { mCons->AddStr(strg, va, ref); }
-
-  inline  void       SelectFont(PIFontSize sz=PI_NormalSizeFont) 
-                             { mCons->SelectFont(sz); }
-
-  inline  void       AcceptCmd(bool acc=true)
-                             { mCons->AcceptCmd(acc); }
-  inline  void       SetPrompt(char* prompt) 
-                             { mCons->SetPrompt(prompt); }
-  inline  string     GetCmdString() { return(mCons->GetCmdString()); }
-
-  inline  void       Refresh() { mCons->Refresh(); }
-
-  PIConsole* mCons;
-
-protected:
-  PIScrollBar* mScb;
-};
-
 #endif
Index: /trunk/SophyaPI/PI/pimenux.cc
===================================================================
--- /trunk/SophyaPI/PI/pimenux.cc	(revision 79)
+++ /trunk/SophyaPI/PI/pimenux.cc	(revision 80)
@@ -360,5 +360,6 @@
 evt.window = XtWindow(PIXtTopWdg());
 evt.root = DefaultRootWindow(evt.display);
-evt.serial = 8866559909;
+evt.serial = PIXGetLastEventSerial(); 
+evt.time = PIXGetLastEventTime();
 evt.send_event = False;
 evt.same_screen = XQueryPointer(evt.display, evt.window, &(evt.root), 
@@ -399,5 +400,6 @@
 evt.x = px;
 evt.y = py;
-evt.serial = 8866559909;
+evt.serial = PIXGetLastEventSerial(); 
+evt.time = PIXGetLastEventTime();
 evt.send_event = False;
 evt.same_screen = True;
Index: /trunk/SophyaPI/PI/pimsghandler.h
===================================================================
--- /trunk/SophyaPI/PI/pimsghandler.h	(revision 79)
+++ /trunk/SophyaPI/PI/pimsghandler.h	(revision 80)
@@ -1,8 +1,8 @@
+#ifndef PIMSGHANDLER_H_SEEN
+#define PIMSGHANDLER_H_SEEN
+
 /* Classe de gestion de messages */
 
 #include <stdlib.h>
-
-#ifndef PIMSGHANDLER_H_SEEN
-#define PIMSGHANDLER_H_SEEN
 
 enum {
@@ -12,4 +12,5 @@
         PIMsg_Close         = 2,
         PIMsg_Resize        = 3,
+        PIMsg_ResizeRequest = 4,
 
 	PIMsg_Click         = 21,
Index: /trunk/SophyaPI/PI/piwindowgen.cc
===================================================================
--- /trunk/SophyaPI/PI/piwindowgen.cc	(revision 79)
+++ /trunk/SophyaPI/PI/piwindowgen.cc	(revision 80)
@@ -90,9 +90,14 @@
 /*  avec un message ActiveWdg de la part de la fenetre              */
 {
-
-if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 
+if (ModMsg(msg) == PIMsg_ResizeRequest) { 
+  // On change la taille de la fenetre - data est un pointeur sur entier
+  // data[0] represente l'increment (positif ou negatif) en X, data[1] en Y
+  int* nsz = (int*) data;
+  SetSize(XSize()+nsz[0], YSize()+nsz[1]);
+  return;
+  }
+else if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 
   Hide();   // Action par defaut en cas de MsgClose.
-
-if (ModMsg(msg) == PIMsg_Active)
+else if (ModMsg(msg) == PIMsg_Active)
   Send(Msg(),PIMsg_Active);
 
