Index: /trunk/SophyaPI/PI/ex_dessin.cc
===================================================================
--- /trunk/SophyaPI/PI/ex_dessin.cc	(revision 71)
+++ /trunk/SophyaPI/PI/ex_dessin.cc	(revision 72)
@@ -40,40 +40,40 @@
 
 /* --Methode-- */
-void ExBWdg::Draw()
+void ExBWdg::Draw(PIGraphicGen* g)
 {
 EraseWindow();
-SelLine(PI_NormalLine);
-DrawBox(10,10, XSize()-20, YSize()-20);
+g->SelLine(PI_NormalLine);
+g->DrawBox(10,10, XSize()-20, YSize()-20);
 
-SelLine(PI_ThinLine);
-DrawFBox(20, 20, 20, 20);
-DrawCircle(30, 30, 15);
+g->SelLine(PI_ThinLine);
+g->DrawFBox(20, 20, 20, 20);
+g->DrawCircle(30, 30, 15);
 
-SelForeground(PI_Red);
-DrawFCircle(70, 30, 15);
+g->SelForeground(PI_Red);
+g->DrawFCircle(70, 30, 15);
 
-SelForeground(PI_Yellow);
-DrawFBox(10, 60, 100, 15);
+g->SelForeground(PI_Yellow);
+g->DrawFBox(10, 60, 100, 15);
 
-SelForeground(PI_Black);
-DrawString(20, 90, str);
+g->SelForeground(PI_Black);
+g->DrawString(20, 90, str);
 
-SelLine(PI_ThinLine);
-DrawLine(10, 120, 40, 120);
-SelLine(PI_NormalLine);
-DrawLine(40, 120, 70, 120);
-SelLine(PI_ThickLine);
-DrawLine(70, 120, 100, 120);
+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);
 
-SelForeground(PI_Magenta);
-DrawFCircle(120, 30, 15);
-SelForeground(PI_Grey);
-DrawFCircle(120, 60, 15);
+g->SelForeground(PI_Magenta);
+g->DrawFCircle(120, 30, 15);
+g->SelForeground(PI_Grey);
+g->DrawFCircle(120, 60, 15);
 
-int x[5] = { 20, 35, 50, 65, 80 };
-int y[5] = { 130, 130, 130, 130, 130 };
+PIGrCoord x[5] = { 20, 35, 50, 65, 80 };
+PIGrCoord y[5] = { 130, 130, 130, 130, 130 };
 
-SelForeground(PI_Black);
-DrawMarkers(x, y, 5);
+g->SelForeground(PI_Black);
+g->DrawMarkers(x, y, 5);
 return;
 }
@@ -107,6 +107,6 @@
 if (++mfnt > 2)  mfnt = 0;
 if (++mmrk > 8)  mmrk = 0; 
-SelFont(PI_NormalSizeFont, att[mfnt]);
-SelMarker(8, pmk[mmrk]);
+mWGrC->SelFont(PI_NormalSizeFont, att[mfnt]);
+mWGrC->SelMarker(8, pmk[mmrk]);
 return;
 }
@@ -123,6 +123,6 @@
 {
 SelPointerShape(PI_HandPointer);
-SelForeground(PI_Blue);
-DrawFBox(0, 0, 8, 8);
+mWGrC->SelForeground(PI_Blue);
+mWGrC->DrawFBox(0, 0, 8, 8);
 return;
 }
@@ -131,7 +131,7 @@
 void ExBWdg::But3Release(int x, int y)
 {
-SelForeground(PI_White);
-DrawFBox(0, 0, 8, 8);
-SelForeground(PI_Black);
+mWGrC->SelForeground(PI_White);
+mWGrC->DrawFBox(0, 0, 8, 8);
+mWGrC->SelForeground(PI_Black);
 SelPointerShape(PI_ArrowPointer);
 return;
@@ -149,6 +149,6 @@
 
 printf("ExBWdg::Keyboard: Key= %d (%c) , Mod= %d \n", key, (char)key, (int)kmod);
-SelFont(PI_BigSizeFont, PI_BoldFont);
-DrawString(20, 75, buf);
+mWGrC->SelFont(PI_BigSizeFont, PI_BoldFont);
+mWGrC->DrawString(20, 75, buf);
 
 if ( (kmod == PIKM_Alt) && (key == 'c') ) {
Index: /trunk/SophyaPI/PI/ex_dessin.h
===================================================================
--- /trunk/SophyaPI/PI/ex_dessin.h	(revision 71)
+++ /trunk/SophyaPI/PI/ex_dessin.h	(revision 72)
@@ -22,5 +22,5 @@
 
   virtual void   Resize();
-  virtual void   Draw();
+  virtual void   Draw(PIGraphicGen* g);
 
   virtual void   But1Press(int x, int y);
Index: /trunk/SophyaPI/PI/picmap.cc
===================================================================
--- /trunk/SophyaPI/PI/picmap.cc	(revision 71)
+++ /trunk/SophyaPI/PI/picmap.cc	(revision 72)
@@ -91,5 +91,5 @@
   mColTNums[mCTId]--; 
   if ( mColTNums[mCTId] == 0 )  { FreeColors();  mColTNums[mCTId] = 0; }
-  printf("\n");
+//  printf("\n");
 }
 
Index: /trunk/SophyaPI/PI/picmapx.cc
===================================================================
--- /trunk/SophyaPI/PI/picmapx.cc	(revision 71)
+++ /trunk/SophyaPI/PI/picmapx.cc	(revision 72)
@@ -138,5 +138,5 @@
 {
 if (NTotColors > 0)  return(NTotColors);
-Visual* vis;
+// Visual* vis;
 // DefaultVisual(PIXDisplay(),  PIXScreen() );
 int k,kk;
Index: /trunk/SophyaPI/PI/picons.cc
===================================================================
--- /trunk/SophyaPI/PI/picons.cc	(revision 72)
+++ /trunk/SophyaPI/PI/picons.cc	(revision 72)
@@ -0,0 +1,521 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "picons.h"
+
+
+/*  --------------------------------------------------------------------------------- */
+/*  ---------  Classe PIConsole : I/O (Ecriture/lecture) texte standard  ------------ */
+/*  --------------------------------------------------------------------------------- */
+
+static int CmdStrLen = 256;
+
+/* --Methode-- */
+PIConsole::PIConsole(PIContainer* par, char* nom, PIMessage msg,
+                     int nl, int nc, int sx, int sy, int px, int py) :
+PIBaseWdg(par, nom, sx, sy, px, py) 
+{
+mNL = (nl > 10) ? nl : 10;
+mNC = (nc > 40) ? nc : 40;
+mText = new char[mNL*mNC];
+mAtt = new unsigned char[mNL*mNC];
+mLPo = new int[mNL];
+mStrBuf = new char[mNC+1];
+mCmdStr = new char[CmdStrLen+1];
+mCCP = mCLC = 0;
+AssocScrollBar(NULL);
+SetMsg(msg);
+int i;
+for(i=0; i<mNL; i++) {
+  mLPo[i] = i*mNC;
+  ClearLine(i);
+  }
+
+mOffL = 0;
+mNCmdL = 0;
+SetPrompt("Cmd> ");
+ClrCmd();
+SelectFont();
+mCurL = mNL-mWSzL-1; 
+mCurC = 0;
+
+ActivateKeyboard();
+Manage();
+return;
+}
+
+/* --Methode-- */
+PIConsole::~PIConsole()
+{
+delete[] mText;
+delete[] mAtt;
+delete[] mLPo;
+delete[] mStrBuf;
+delete[] mCmdStr;
+}
+
+/* --Methode-- */
+void PIConsole::AddChar(char c, unsigned char va, bool ref)
+{
+int l1, l2;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+else l1 = l2 = mCurL; 
+if (c == '\n') {
+  mCurC = 0;
+  mCurL++;   
+  }
+else {
+  mText[mLPo[mCurL]+mCurC] = c;
+  mAtt[mLPo[mCurL]+mCurC] = va;
+  if (++mCurC == mNC) {mCurC = 0;  mCurL++; }
+  }
+
+if (mCurL >= (mNL-mNCmdL) ) { // Il faut scroller 
+  ScrollUp();
+  mCurL = mNL-mNCmdL-1;
+  l1 = mNL-mWSzL-1; 
+}
+if (l2 < mCurL) l2 = mCurL;
+if (ref) DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+
+/* --Methode-- */
+void PIConsole::AddStr(char* strg, unsigned char va, bool ref)
+{
+int l1, l2;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+else l1 = l2 = mCurL; 
+
+char c;
+while ( (c = *strg) != '\0') {
+  if ( c != '\n' ) {
+    mText[mLPo[mCurL]+mCurC] = c;
+    mAtt[mLPo[mCurL]+mCurC] = va;
+    if (++mCurC == mNC) {mCurC = 0;  mCurL++; }
+    }
+  else { mCurL++; mCurC = 0; } 
+  if (mCurL >= (mNL-mNCmdL) ) { // Il faut scroller 
+    ScrollUp();
+    mCurL = mNL-mNCmdL-1;
+    }
+  strg++;
+  }
+
+if (l2 < mCurL) l2 = mCurL;
+if (ref) DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SelectFont(PIFontSize sz)
+{
+int asc, desc;
+mWGrC->SelFont(sz);
+mFTaille = sz;
+mFHaut = mWGrC->GetFontHeight(asc, desc);
+mFLarg = mWGrC->CalcStringWidth("A");
+mWSzL = YSize()/mFHaut;
+mWSzC = XSize()/mFLarg;
+}
+
+/* --Methode-- */
+void PIConsole::AcceptCmd(bool acc)
+{
+int l1, l2;
+if (acc) {
+  if (mNCmdL)  return;  // Pas de changement d'etat
+  if (mCurL == (mNL-1) ) { l1 = mNL-mWSzL-1; ScrollUp(); mCurL = (mNL-2); }
+  else l1 = mNL-1;
+  mNCmdL = 1;
+  ClrCmd();
+  UpdCmdLine();
+  l2 = mNL-1;
+  }
+else {
+  if (mNCmdL == 0)  return;  // Pas de changement d'etat
+  mNCmdL = 0;
+  ClearLine(mNL-1);
+  ClrCmd();
+  l1 = l2 = mNL-1;
+  }
+DisplayLines(mWGrC, l1, l2);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SetPrompt(char* prompt)
+{
+strncpy(mPrompt, prompt, 31);  
+mPrompt[31] = '\0';
+return;
+}
+
+/* --Methode-- */
+void PIConsole::SetDispOffset(int ldeb)
+{
+if (ldeb < 0)    { 
+  if (mScb) mScb->SetValue(NbLines()-WindNbLines()-1);
+  mOffL = 0;
+}
+else if (ldeb >= mNL-mWSzL-1)  mOffL = 0;
+else mOffL = (mNL-mWSzL-1)-ldeb;
+if (mOffL < 0)  mOffL = 0;
+}
+
+/* --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-- */
+void PIConsole::Resize()
+{
+mWSzL = YSize()/mFHaut;
+mWSzC = XSize()/mFLarg;
+if (mScb) {
+  mScb->SetMinMax(0, NbLines()-1);
+  mScb->SetSize(WindNbLines());
+  mScb->SetValue(NbLines()-WindNbLines()-1);
+  }
+mOffL = 0;
+}
+
+/* --Methode-- */
+void PIConsole::Draw(PIGraphicGen* g)
+{
+EraseWindow();
+DisplayLines(g, 0, mNL);
+}
+
+static int lines = 0;
+
+/* --Methode-- */
+void PIConsole::Keyboard(int key, PIKeyModifier kmod)
+{
+char c = ' ' ;
+if (isprint(key))  c = key;
+
+printf("PIConsole::Keyboard: Key= %d (%c) Mod= %d  NCmdL=%d (%d,%d)\n", 
+       key, c, (int)kmod, mNCmdL, mCCP, mCLC);
+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;
+  }
+}
+
+if (mNCmdL < 1)  return;
+
+int k;
+bool fgfk = false;
+if (kmod == PIKM_Blank) {
+  switch (key) {
+    case PIK_Return :    
+    case PIK_Enter :
+      mCmdStr[mCLC] = '\0';
+      printf("Process()-Debug- <CR/Enter> CmdStr= %s (L=%d)\n", mCmdStr, strlen(mCmdStr) );
+      Send( Msg(), PIMsg_OK, mCmdStr);
+      ClrCmd();
+      break;
+
+    case PIK_BackSpace :
+    case 127 :    // Touche del
+    case 8 :      // Touche backspace
+      if (mCCP > 0)  { 
+        for(k=mCCP-1; k<mCLC-1; k++)  mCmdStr[k] = mCmdStr[k+1];
+        mCmdStr[mCLC-1] = ' ';   mCCP--;  mCLC--;
+      }
+      //      printf("Process()-Debug- Backspace CCP,CLC= %d %d CmdStr= %s (L=%d) \n", mCCP, mCLC, 
+      //      mCmdStr, strlen(mCmdStr));
+      break;
+    case PIK_Left :
+      if (mCCP > 0)  mCCP--;
+      //      printf("Process()-Debug- Left CCP,CLC= %d %d  \n", mCCP, mCLC);
+      break;
+    case PIK_Right :
+      if (mCCP < mCLC)  mCCP++;
+      //      printf("Process()-Debug- Right CCP,CLC= %d %d  \n", mCCP, mCLC);
+      break;
+    default :
+      fgfk = true;
+      break;
+    }
+  }
+if ( ( fgfk && (kmod == PIKM_Blank) ) || (kmod == PIKM_Shift)  ) CmdAddChar(key);
+UpdCmdLine();
+// DisplayLines(mNL-1, mNL-1);
+return;
+}
+
+/* --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-- */
+void PIConsole::DebugPrint(int lp)
+{
+printf("PIConsole::DebugPrint() - NL,NC= %d %d - WSzL,C= %d %d Cur= %d %d\n", mNL, mNC, 
+        mWSzL, mWSzC, mCurL, mCurC);
+printf(" OffL, NCmdL= %d %d - mCCP, mCLC= %d %d - LPo= %d %d \n", 
+        mOffL, mNCmdL, mCCP, mCLC, mLPo[mNL-2], mLPo[mNL-1]);
+
+if (lp == 0)  return;
+int i,j;
+for(j=0; j<mNL; j++) {
+  printf("Line[%d] (%d) = ", j, mLPo[j]);
+  for(i=0; i<mNC; i++)  putchar(mText[mLPo[j]+i]);
+  putchar('\n');
+  }
+return;
+}
+
+/* --Methode-- */
+void PIConsole::ScrollUp()
+{
+int i,l,kpo;
+l = mNL-1-mNCmdL;
+kpo = mLPo[0];
+for(i=0; i<mNL-mNCmdL-1; i++)   mLPo[i] = mLPo[i+1];
+mLPo[l] = kpo;
+ClearLine(l);
+return;
+}
+
+/* --Methode-- */
+void PIConsole::ClearLine(int l)
+{
+if ((l<0) || (l >= mNL)) return;
+int j;
+for(j=0; j<mNC; j++) {
+  mText[mLPo[l]+j] = ' ';
+  mAtt[mLPo[l]+j] = PIVA_Def;
+  }
+return;
+}
+
+/* --Methode-- */
+void PIConsole::DisplayLines(PIGraphicGen* g, int l1, int l2)
+{
+int j,l,k,l0;
+int x,y;
+
+// printf("PIConsole::DisplayLines(%d %d ) \n ", l1, l2);
+
+if (! IsVisible() )   return;
+
+int lva = -1;
+
+PIFontAtt vafat[8] = {PI_RomanFont, PI_BoldFont, PI_ItalicFont,
+                      PI_RomanFont, PI_RomanFont, PI_BoldFont, 
+                      PI_ItalicFont, PI_RomanFont};
+PIColors fgc, bgc;
+fgc =  g->GetForeground();
+bgc =  g->GetBackground();
+
+l0 = mNL-mWSzL-1-mOffL;
+if (l0 < 0) l0 = 0;
+if (l1 < l0) l1 = l0;
+if (l2 > mNL-mOffL-1) l2 =  mNL-mOffL-1;
+
+for(l=l1; l<=l2; l++) {
+ y = (l-l0)*mFHaut;
+ k = 0;   x = 0;
+ for(j=0; j<mNC; j++) {
+   if (mAtt[mLPo[l]+j] != lva) {
+     if (k > 0) {
+       mStrBuf[k] = '\0';     
+       g->DrawOpaqueString(x, y, mStrBuf);
+       //     printf("l,J,K=%d %d %d - X,Y= %d %d - %s \n", l,j,k,x,y,mStrBuf);
+       x += k*mFLarg;  k = 0;  
+       }
+     lva = mAtt[mLPo[l]+j];
+     g->SelFont(mFTaille, vafat[lva]);
+     if (lva & PIVA_Reverse) { 
+       g->SelForeground(bgc);
+       g->SelBackground(fgc);
+       }
+     else  { 
+       g->SelForeground(fgc);
+       g->SelBackground(bgc);
+       }
+     }
+   mStrBuf[k] = mText[mLPo[l]+j];
+   k++;
+   }
+   if (k > 0) {
+     mStrBuf[k] = '\0';     
+     g->DrawOpaqueString(x, y, mStrBuf);
+     //     printf("l,J,K=%d %d %d - X,Y= %d %d - %s \n", l,j,k,x,y,mStrBuf);
+   }
+ }
+
+g->SelForeground(fgc);
+g->SelBackground(bgc);
+return;
+}
+/* --Methode-- */
+void PIConsole::ClrCmd() 
+{ 
+mCCP = 0; mCLC = 0; 
+mCmdStr[0] = '\0'; 
+}  
+
+/* --Methode-- */
+void PIConsole::UpdCmdLine()
+{
+  char strg[260]; //debug
+int l1,l2;
+l1 = l2 = mNL-1;
+if (mOffL != 0)  // Decalage d'affichage precedant -> Tout rafraichir 
+  { l1 = mNL-mWSzL-1; l2 = mNL-1;  SetDispOffset(-1); }
+
+ClearLine(mNL-1);
+int j1,j2,j,jj2;
+j1 = strlen(mPrompt);
+for(j=0; j<j1; j++) {
+  mText[mLPo[mNL-1]+j] = mPrompt[j];
+  mAtt[mLPo[mNL-1]+j] = PIVA_Bold;
+  strg[j] = mPrompt[j];  
+  }  
+jj2 = mWSzC-j1;
+int koff = (mCCP >= jj2) ? mCCP-(jj2/2) : 0;
+int kmx = mCLC-koff;
+j2 = j1+kmx;
+if (j2 > mWSzC)  j2 = mWSzC;
+int k = koff;
+for(j=j1; j<j2; j++) {
+  mText[mLPo[mNL-1]+j] = mCmdStr[k];
+  mAtt[mLPo[mNL-1]+j] = PIVA_Def;
+  strg[j] = mCmdStr[k];  
+  k++;
+  }  
+
+strg[j] = '\0';
+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::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+int off;
+printf("PIConsole::Process() UserMsg()= %d ModMsg= %d \n", (int)UserMsg(msg), 
+       (int)ModMsg(msg) );
+if ((ModMsg(msg) == PIMsg_DataChanged) && (UserMsg(msg) == msgScb) ) {
+  off = (int)data;
+  printf(" PIConsole::Process() From ScrollBar : Off=%d \n ", off);
+  SetDispOffset(off);
+  Refresh();
+  }
+else ReSend(msg, sender, data);
+}
+
+/*  --------------------------------------------------------------------------------- */
+/*  --------------   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 72)
+++ /trunk/SophyaPI/PI/picons.h	(revision 72)
@@ -0,0 +1,100 @@
+#ifndef PICONSOLE_H
+#define PICONSOLE_H
+
+#include "pisysdep.h"
+
+#include PISTDWDG_H 
+#include PICONT_H
+#include PIBWDG_H
+
+enum PIVAType {    
+  PIVA_Def = 0,
+  PIVA_Bold = 1,
+  PIVA_Ital = 2,
+  PIVA_Reverse = 4
+};
+
+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();
+
+          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       MoveCursor(int il, int jc);
+//          void       DelChar(int il, int jc); 
+
+          void       SelectFont(PIFontSize sz=PI_NormalSizeFont);
+          void       AcceptCmd(bool acc=true);
+          void       SetPrompt(char* prompt); 
+  inline  int        WindNbLines() { return mWSzL; }
+  inline  int        NbLines() { return mNL; }
+          void       SetDispOffset(int ldeb=-1);
+          void       AssocScrollBar(PIScrollBar* scb);
+          
+  inline  string     GetCmdString() { mCmdStr[mCLC] = '\0'; return((string)mCmdStr); }
+
+  virtual void       Draw(PIGraphicGen* g);
+  virtual void       Resize();
+  virtual void       Keyboard(int key, PIKeyModifier kmod);
+
+          void       DebugPrint(int cont=0);
+
+protected:
+          void       ScrollUp();
+          void       ClearLine(int l);
+          void       DisplayLines(PIGraphicGen* g, int l1, int l2);
+          void       UpdCmdLine();
+          void       ClrCmd();
+          void       CmdAddChar(int key);
+  virtual void       Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+  int mNL, mNC;
+  int mCurL, mCurC; 
+  int mWSzL, mWSzC, mOffL;
+  int mNCmdL;
+  char* mText;
+  unsigned char* mAtt;
+  int* mLPo;
+  char* mStrBuf;
+  int mFHaut, mFLarg;
+  PIFontSize mFTaille;
+  char  mPrompt[32];
+  char* mCmdStr;
+  int mCCP, mCLC;
+
+// S il y a un scroll-bar associe
+  PIScrollBar* mScb;
+  PIMessage msgScb;
+};
+
+
+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  void       Refresh() { mCons->Refresh(); }
+
+  PIConsole* mCons;
+
+protected:
+  PIScrollBar* mScb;
+};
+
+#endif
Index: /trunk/SophyaPI/PI/pidrawer.cc
===================================================================
--- /trunk/SophyaPI/PI/pidrawer.cc	(revision 71)
+++ /trunk/SophyaPI/PI/pidrawer.cc	(revision 72)
@@ -265,5 +265,5 @@
   float xOffset = 0;
   int kk;
-  g->SelFontSz(yMajTickLen*4.);
+  g->SelFontSz(xMajTickLen*4.);
   for (float x=xBeg; x<=xMax; x += xStep) {
       char label[20]; sprintf(label, "%-6g", x);
@@ -280,5 +280,4 @@
       g->DrawString(x+xOffset, y, label);
   }
-  printf(" DBGDBG Out of PIDrawer::DrawHLabels  \n");
 }
 
@@ -287,5 +286,5 @@
 {
   float xOffset = 0;
-  g->SelFontSz(yMajTickLen*4.);
+  g->SelFontSz(xMajTickLen*4.);
   for (float y=yBeg; y<=yMax; y += yStep) {
       char label[20]; sprintf(label, "%-6g", y);
Index: /trunk/SophyaPI/PI/pigraphuc.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphuc.cc	(revision 71)
+++ /trunk/SophyaPI/PI/pigraphuc.cc	(revision 72)
@@ -451,5 +451,4 @@
 {
   if (!mGrC) return;
-  printf("-DBG- PIGraphicUC::SelFont(sz=%d) \n", sz);
   mGrC->SelFont(sz, att);
   return;  
@@ -460,5 +459,4 @@
 {
   if (!mGrC) return;
-  printf("-DBG- PIGraphicUC::SelFontSzPt(npt=%d) \n", npt);
   mGrC->SelFontSzPt(npt, att);
   return;  
@@ -490,5 +488,4 @@
   if (npt < 8) npt = 8;
   if (npt > 127) npt = 127;
-  printf("-DBG- PIGraphicUC::SelFontSz(%g->%g,%g ) %d \n", (float)sz, fx, fy, npt);
   mGrC->SelFontSzPt(npt, att);
 }
@@ -502,5 +499,4 @@
   DUC2GrC((float)sz, (float)sz, fx, fy);
   int isz = int(0.5*(fx+fy+1));
-  printf("-DBG- PIGraphicUC::SelMarkerSzSz(%g->%g,%g ) %d \n", (float)sz, fx, fy, isz);
   mGrC->SelMarker( isz, mrk);
 }
@@ -589,5 +585,5 @@
   float dx = mGrC->CalcStringWidth(s);
   float dxx, dxy;
-  DUC2GrC(dx, dx, dxx, dxy);
+  DGrC2UC(dx, dx, dxx, dxy);
   return(dxx);
 }
Index: /trunk/SophyaPI/PI/pigraphx.cc
===================================================================
--- /trunk/SophyaPI/PI/pigraphx.cc	(revision 71)
+++ /trunk/SophyaPI/PI/pigraphx.cc	(revision 72)
@@ -347,5 +347,4 @@
 if (att & PI_BoldFont) j = 1;
 if (att & PI_ItalicFont) j = 2;
-printf(" >DBg< PIGraphicX::SelFontSzPt(%d , ) \n", npt);
 SelectFont(isel, j);
 
@@ -376,6 +375,4 @@
 if (att & PI_BoldFont) j = 1;
 if (att & PI_ItalicFont) j = 2;
-
-printf(" >DBg< PIGraphicX::SelFont(sz=%d  ) \n", sz);
 
 SelectFont(i, j);
@@ -685,7 +682,6 @@
     if (count > 0)  break;
     }
-  if (count > 0) {
+  if (count > 0) 
     fntst[isz][jat] = XLoadQueryFont(mdsp, buff);
-    printf("PIGraphicX::SelectFont-DBG-/ font %s loaded \n", buff); }
   else
     { printf("PIGraphicX::SelectFont/ Pb font %s - Using default \n", buff);    
@@ -696,5 +692,4 @@
 mFSize = fntsz[isz];
 mFSt = fntst[isz][jat];
-printf("PIGraphicX::SelectFont-DBG-/ %d %d -> %d \n", isz, jat, mFSize); 
 XSetFont(XtDisplay(MyWdg()), DefGC(), fntst[isz][jat]->fid);
 return;
Index: /trunk/SophyaPI/PI/pintuple.cc
===================================================================
--- /trunk/SophyaPI/PI/pintuple.cc	(revision 71)
+++ /trunk/SophyaPI/PI/pintuple.cc	(revision 72)
@@ -75,5 +75,5 @@
 float xp,yp,xer,yer;
 char buff[128];
-int nok, nl2;
+int nok;
 
 if (!mNT) return;
Index: /trunk/SophyaPI/PI/piscdrawwdg.cc
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 71)
+++ /trunk/SophyaPI/PI/piscdrawwdg.cc	(revision 72)
@@ -181,9 +181,4 @@
 }
 
-void
-PIScDrawWdg::DrawSelf(PIGraphicUC*)
-{
-return;
-}
 
 void
@@ -391,6 +386,6 @@
   PIScContDrw* rd;
   if (mDrawWdg) mDrawWdg->RemoveScDrawer(this);
-  mDrawWdg = NULL;  mDrawer = rd;
   rd = new PIScContDrw(this);
+  mDrawWdg = NULL;    mDrawer = rd;
   UpdateSize();
   return((PIDrawer*)rd);
Index: /trunk/SophyaPI/PI/piscdrawwdg.h
===================================================================
--- /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 71)
+++ /trunk/SophyaPI/PI/piscdrawwdg.h	(revision 72)
@@ -28,5 +28,4 @@
   virtual void       Draw(PIGraphicGen* g);
   virtual void       Draw(PIGraphicGen* g, int x0, int y0, int dx, int dy);
-  virtual void       DrawSelf(PIGraphicUC* g);
   virtual void       DrawSelf(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
   
Index: /trunk/SophyaPI/PI/sc_sample.cc
===================================================================
--- /trunk/SophyaPI/PI/sc_sample.cc	(revision 71)
+++ /trunk/SophyaPI/PI/sc_sample.cc	(revision 72)
@@ -1,2 +1,6 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string>
+
 #include "sc_sample.h"
 
@@ -11,6 +15,6 @@
 mfd = new PIScFuncDrawer(f);
   SetLimits(-3,3,-4,4);
-AddDrawer(mfd);
-SetAxesFlags();
+AddScDrawer(mfd);
+SetAxesFlags(kAxesDflt);
 }
 
@@ -22,24 +26,25 @@
 
 void
-ScSample::DrawSelf()
+ScSample::DrawSelf(PIGraphicUC* g, float, float, float, float)
 {
-double x[5] = {-2, -1., 1., 1.7, 2.2};
-double y[5] = {-2.5, -2.0, -1.5, -2., -2.5};
+PIGrCoord x[5] = {-2, -1., 1., 1.7, 2.2};
+PIGrCoord y[5] = {-2.5, -2.0, -1.5, -2., -2.5};
 
 int i;
-SelForeground(PI_Green);
-BaseDrawer()->SelMarker(0.3, PI_BoxMarker);
-BaseDrawer()->DrawMarkers(x, y, 5);
-SelForeground(PI_Magenta);
-BaseDrawer()->SelMarker(0.3, PI_FCircleMarker);
+g->SelForeground(PI_Green);
+g->SelMarkerSz(0.3, PI_BoxMarker);
+g->DrawMarkers(x, y, 5);
+g->SelForeground(PI_Magenta);
+printf(" +DBG+ ScSample::DrawSelf - Marker(%g) \n", 0.3);
+g->SelMarkerSz(0.3, PI_FCircleMarker);
 for(i=0; i<5; i++)
-   y[i]+=1.;
-BaseDrawer()->DrawMarkers(x, y, 5);
-SelForeground(PI_Black);
+   y[i] = (float)(y[i]) + 1.;
+g->DrawMarkers(x, y, 5);
+g->SelForeground(PI_Black);
 
-BaseDrawer()->DrawLine(-4, -4, 4, 4);
-BaseDrawer()->DrawLine(-2, -5, 5, 2);
-BaseDrawer()->DrawLine(-5, -4, -2, -2);
-BaseDrawer()->DrawLine(1, -10, 1, 10);
+g->DrawLine(-4, -4, 4, 4);
+g->DrawLine(-2, -5, 5, 2);
+g->DrawLine(-5, -4, -2, -2);
+g->DrawLine(1, -10, 1, 10);
 return;  
 }
Index: /trunk/SophyaPI/PI/sc_sample.h
===================================================================
--- /trunk/SophyaPI/PI/sc_sample.h	(revision 71)
+++ /trunk/SophyaPI/PI/sc_sample.h	(revision 72)
@@ -1,3 +1,3 @@
-#include "pisysdep.h"
+// #include "pisysdep.h"
 
 #include "piscdrawwdg.h"
@@ -10,5 +10,5 @@
 
   
-  virtual void DrawSelf();
+  virtual void DrawSelf(PIGraphicUC* g, float, float, float, float);
 
 };
