Index: trunk/SophyaPI/PI/Tests/pist.cc
===================================================================
--- trunk/SophyaPI/PI/Tests/pist.cc	(revision 1895)
+++ trunk/SophyaPI/PI/Tests/pist.cc	(revision 1896)
@@ -48,4 +48,21 @@
                          int sx=10, int sy=10, int px=0, int py=0);
   virtual         ~StringPosDrawWdg();
+
+// Traitement des evenements   
+//  virtual void   Resize();
+  virtual void   Draw(PIGraphic* g, int x0, int y0, int dx, int dy);
+
+protected:
+};
+
+// ---- Declaration de la classe CompStringDrawWdg --------
+class CompStringDrawWdg : public StringDrawWdg
+{
+public:
+// Les methodes ...
+
+                  CompStringDrawWdg(PIContainerGen *par, char *nom,
+				    int sx=10, int sy=10, int px=0, int py=0);
+  virtual         ~CompStringDrawWdg();
 
 // Traitement des evenements   
@@ -419,4 +436,202 @@
 
 /* ........................................................... */
+/*     Classe CompStringDrawWdg (Implementation des methodes)             */
+/* ........................................................... */
+
+/* --Methode-- */
+CompStringDrawWdg::CompStringDrawWdg(PIContainerGen *par, char *nom,
+                       int sx, int sy, int px, int py) 
+: StringDrawWdg(par, nom, sx, sy, px, py)
+
+{
+}
+
+/* --Methode-- */
+CompStringDrawWdg::~CompStringDrawWdg()
+{
+}
+ 
+
+/* --Methode-- */
+void CompStringDrawWdg::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/)
+{
+PIFontAtt att[4] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont, PI_BoldItalicFont};
+PIFontSize fsz[5] = { PI_TinySizeFont, PI_SmallSizeFont, PI_NormalSizeFont, 
+		      PI_BigSizeFont, PI_HugeSizeFont };
+PIFontName fn[4] = { PI_CourierFont, PI_HelveticaFont, 
+		     PI_TimesFont, PI_SymbolFont};
+char * fnstr[4] = { "Courier-Font", "Helvetica-Font", 
+		     "Times-Font", "Symbol-Font"};
+char * attstr[4] = { "RomanFont" , "BoldFont", "ItalicFont", "BoldItalicFont"};
+char * fszstr[5] = { "TinySizeFont", "SmallSizeFont", "NormalSizeFont", 
+		      "BigSizeFont", "HugeSizeFont" };
+
+if (g->kind() != PI_PSFileGraphics ) EraseWindow();
+
+
+int ia=0, js=0;
+int k;
+for(k=0; k<4; k++)
+  if (att[k] == mFAtt)  {ia = k; break; }
+for(k=0; k<5; k++)
+  if (fsz[k] == mFSize)  {js = k; break; }
+
+if ((mFSize != mSFSize) || (mFAtt != mSFAtt))
+  for(k=0; k<10; k++)
+    mSL[k] = mSH[k] = 0;
+PIFont f(14, PI_DefaultFont, mFAtt);
+g->SelFont(f);
+g->SelForeground(PI_Black);
+g->SelLine(PI_ThinLine);
+
+g->DrawString(20,24,"StringDraw");
+g->DrawString(XSize()/5,24,attstr[ia]);
+g->DrawString(XSize()/3,24,fszstr[js]);
+
+
+PIFont fx(14,fn[2]);
+fx.SetFontSz(mFSize);
+fx.SetFontAtt(mFAtt);
+g->SelFont(fx);
+int fh,fa,fd;
+fh = fx.GetFontHeight(fa, fd);
+cout << " FontSize= " << f.GetFontSize() << " FontHeight= " << fh << endl;
+
+g->DrawCompString(XSize()/2,40,"10","-34",NULL);
+g->DrawCompString(XSize()/2+60,40,"10","+78",NULL);
+g->DrawCompString(XSize()/2+120,40, "10", NULL, "a");
+
+int xpos, ypos;
+char *s, *su, *sd;
+
+// --------------- Vertical Top -----------------
+
+xpos = 30;  ypos = 75;
+s = "HLeftVTop";
+su = "824";
+sd = "ij";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalTop);
+
+xpos = XSize()/2;  ypos = 75;
+s = "HCenVTop";
+su = "76843";
+sd = "abc";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalTop);
+
+xpos = XSize()-30;  ypos = 75;
+s = "HRigVTop";
+su = "76843";
+sd = "abc";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalTop);
+
+// --------------- Vertical Center ----------------- 
+xpos = 30;  ypos = 150;
+s = "HLeftVCen";
+su = "32987";
+sd = NULL;
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalCenter);
+
+xpos = XSize()/2;  ypos = 150;
+s = "HCenVCen";
+su = "32987";
+sd = "klm";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalCenter);
+
+xpos = XSize()-30;  ypos = 150;
+s = "HRigVCen";
+su = "2";
+sd = "alpha";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalCenter);
+
+// --------------- Vertical BaseLine -----------------
+xpos = 30;  ypos = 250;
+s = "HLeftVBas";
+su = "3";
+sd = "beta";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalBaseLine);
+
+xpos = XSize()/2;  ypos = 250;
+s = "HCenVBas";
+su = "gamma";
+sd = "44";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalBaseLine);
+
+xpos = XSize()-30;  ypos = 250;
+s = "HRigVBas";
+su = "55";
+sd = "alpha";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalBaseLine);
+
+// --------------- Vertical Bottom -----------------
+xpos = 30;  ypos = 325;
+s = "HLeftVBot";
+su = "abc";
+sd = "6";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalBottom);
+
+xpos = XSize()/2;  ypos = 325;
+s = "HCentVBot";
+su = NULL;
+sd = "lm";
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalBottom);
+
+xpos = XSize()-30;  ypos = 325;
+s = "HLeftVBot";
+su = NULL;
+sd = NULL;
+g->SelForeground(PI_Red);
+g->DrawLine(xpos-50, ypos, xpos+50, ypos); 
+g->DrawLine(xpos, ypos-10, xpos, ypos+10);
+g->SelForeground(PI_Black);
+g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalBottom);
+ 
+return;
+}
+
+/* ........................................................... */
 /*                       Classe PITApp                         */
 /* ........................................................... */
@@ -447,4 +662,5 @@
 m[0]->AppendItem("StringDrawWdg", 10101);
 m[0]->AppendItem("StringPosDrawWdg", 10102);
+m[0]->AppendItem("CompStringDrawWdg", 10103);
 m[0]->AppendItem("->eps", 10111);
 m[0]->AppendItem("->ps", 10112);
@@ -521,4 +737,18 @@
       wp->SetAutoDelChilds(true);
       StringPosDrawWdg* exb  = new StringPosDrawWdg(wp, "sposdrawwdg", 600, 400, 0, 0);
+      exb->SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_elastic);
+      wp->SetUserData(exb);
+      wp->Show();
+      }
+    break;
+
+    case 10103: // Creation d'un StringPosDrawWdg
+      {
+      nbwin++;
+      sprintf(strg, "Creation CompStringDrawWdg   \n Fenetre No %d ", nbwin);
+      sprintf(strg,"CompStringDrawWdg - %d", nbwin);
+      PIWindow* wp = new PIWindow(this, strg, PIWK_normal,  600, 400, 150, 150);
+      wp->SetAutoDelChilds(true);
+      CompStringDrawWdg* exb  = new CompStringDrawWdg(wp, "compposdrawwdg", 600, 400, 0, 0);
       exb->SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_elastic);
       wp->SetUserData(exb);
Index: trunk/SophyaPI/PI/pigraphgen.cc
===================================================================
--- trunk/SophyaPI/PI/pigraphgen.cc	(revision 1895)
+++ trunk/SophyaPI/PI/pigraphgen.cc	(revision 1896)
@@ -196,5 +196,89 @@
 			     const char* s_up, const char* s_dn, int pos)
 {
-  // AFAIREREZA012002
+  if ((s_up == NULL) && (s_dn == NULL)) {
+    if (s != NULL)  DrawString(x,y,s,pos);
+    return;
+  }
+
+  int fh,fas,fds;
+  fh = myFont.GetFontHeight(fas, fds);
+  int sw_s = 0;
+  if (s != NULL) sw_s = myFont.GetStringWidth(s);
+
+  PIFont fnt_save(myFont);
+  PIFont fnt_ss(myFont);
+  fnt_ss.SetFontSzPt(2*myFont.GetFontSize()/3);
+
+  int sw_sup = 0;
+  if (s_up != NULL) sw_sup = fnt_ss.GetStringWidth(s_up);
+  int sw_sdn = 0;
+  if (s_dn != NULL) sw_sdn = fnt_ss.GetStringWidth(s_dn);
+
+  PIGrCoord xs,ys; 
+  int posh = pos & PI_HorizontalPosition;
+  int posv = pos & PI_VerticalPosition;
+
+  int dyu, dyd;
+  dyu = -fh/2;  dyd = fh/2-fh/5; 
+  if (posv == PI_VerticalBaseLine) {
+    dyu = -fh/2;  dyd = fh/2-fh/5; 
+    }
+  else if (posv == PI_VerticalBottom) { 
+    dyu = -fh/2-fds;  dyd = fh/2-fh/5-fds; 
+    }
+  else if (posv == PI_VerticalCenter) {
+    dyu = -fds;  dyd = fh-fh/5-fds; 
+  }
+  else if (posv == PI_VerticalTop) {
+    dyu = fh/2-fds;  dyd = 3*fh/2-fh/5-fds; 
+  }
+
+  int deltaposx = ((fh/8) > 0) ? fh/8 : 1;
+
+
+  if ((pos == 0) || ((posh == PI_HorizontalLeft) && (posv == PI_VerticalBaseLine))) {
+    if (s != NULL)  DrawString(x, y, s, 0);
+    xs = (int)x+sw_s+deltaposx;
+    ys = (int)y+dyu;
+    SelFont(fnt_ss);
+    if (s_up != NULL) DrawString(xs, ys, s_up, 0);
+    ys = (int)y+dyd;
+    if (s_dn != NULL) DrawString(xs, ys, s_dn, 0);
+  }
+  else {
+    if (posh == PI_HorizontalRight) {
+      int sw_ss_max = ( sw_sup > sw_sdn ) ? sw_sup : sw_sdn;
+      xs = (int)x-sw_ss_max-deltaposx;
+      if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight | posv);
+      SelFont(fnt_ss);
+      xs = (int)xs+deltaposx;
+      ys = (int)y+dyu;
+      if (s_up != NULL) DrawString(xs, ys, s_up, 0);
+      ys = (int)y+dyd;
+      if (s_dn != NULL) DrawString(xs, ys, s_dn, 0);      
+    }
+    else if (posh == PI_HorizontalCenter) {
+      int sw_tot = sw_sup+sw_sdn+sw_s+deltaposx;
+      xs = (int)x-sw_tot/2+sw_s; 
+      if (s != NULL)  DrawString(xs, y, s, PI_HorizontalRight | posv);
+      SelFont(fnt_ss);
+      xs = (int)xs+deltaposx;
+      ys = (int)y+dyu;
+      if (s_up != NULL) DrawString(xs, ys, s_up, 0);
+      ys = (int)y+dyd;
+      if (s_dn != NULL) DrawString(xs, ys, s_dn, 0);            
+    }
+    else {
+      if (s != NULL)  DrawString(x, y, s, posv);
+      SelFont(fnt_ss);
+      xs = (int)x+sw_s+deltaposx;
+      ys = (int)y+dyu;
+      if (s_up != NULL) DrawString(xs, ys, s_up, 0);
+      ys = (int)y+dyd;
+      if (s_dn != NULL) DrawString(xs, ys, s_dn, 0);
+    }
+  }
+  SelFont(fnt_save);
+  return;
 }
 
@@ -564,11 +648,15 @@
 //	Des constructeurs et des méthodes de conversion à partir 
 //	et vers des "int", "float" et "double" sont définis.
-//	L'objet conserve le type effectif de l'argument lors de la 
-//	création ou de la dernière affectation.
+//	La valeur entiere d'un objet PIGrCoord construite à partir 
+//	d'une valeur flottante (ou suite à une affectation) correpond
+//	à l'entier le plus proche.
 // 
-//|	PIGrCoord gco;
-//|	gco = 3.141596 ; 
+//|	PIGrCoord gco = 3.14;
 //|	int ic = gco;     // ic -> 3
-//|	float fc = gco;   // fc -> 3.141596
+//|	float fc = gco;   // fc -> 3.14
+//|	gco = 1.1;        // (int)gco -> 1
+//|	gco = 1.6;        // (int)gco -> 2
+//|	gco = -0.4;       // (int)gco -> 0
+//|	gco = -0.7;       // (int)gco -> -1
 //--
 //++
