Index: /trunk/SophyaPI/PI/pihisto2d.cc
===================================================================
--- /trunk/SophyaPI/PI/pihisto2d.cc	(revision 149)
+++ /trunk/SophyaPI/PI/pihisto2d.cc	(revision 150)
@@ -1,3 +1,4 @@
 #include <stdio.h>
+#include "piapplgen.h"
 #include "pihisto2d.h"
 #include "nbrandom.h"
@@ -506,4 +507,5 @@
 mH2Wdg = NULL;
 
+// Valeurs par defaut
 mFgCol    = false;
 mCmap     = CMAP_GREYINV32;
@@ -517,6 +519,16 @@
 mLogScale = 10.;
 
+// Taille automatique
+int bsx, bsy;
+PIApplicationPrefCompSize(bsx, bsy);  // environ 6 lettres
+int spx = (bsx>=10) ? bsx/10 : 1;  // intervalle entre lettres X
+int spy = (bsy>=5) ? bsy/5 : 1;    // intervalle entre lettres Y
+int wszx = 5*spx+bsx+int(2.5*bsx); // Taille fenetre en X
+int wszy = 11*spy+8*bsy;           // Taille fenetre en Y
+SetSize(wszx, wszy);
+
 // menus bar
-mOPop[0] = new PIOptMenu(this, "optmen-h2d-1" ,100,25,10,10);
+  int cpx = 2*spx, cpy = 2*spy;
+mOPop[0] = new PIOptMenu(this, "optmen-h2d-1" ,2*bsx,bsy,cpx,cpy);
 mOPop[0]->AppendItem("Carres Var."  , 6101);
 mOPop[0]->AppendItem("....."        , 6102);
@@ -524,46 +536,70 @@
 mOPop[0]->AppendItem("Carres Pleins", 6104);
 sdum = "Carres Var."; mOPop[0]->SetValueStr(sdum);
-
-mOPop[1] = new PIOptMenu(this, "optmen-h2d-2", 100,25,10,40);
+mOPop[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+  cpy += bsy+spy;
+mOPop[1] = new PIOptMenu(this, "optmen-h2d-2",2*bsx,bsy,cpx,cpy);
 mOPop[1]->AppendItem("Lineaire", 6201);
 mOPop[1]->AppendItem("Log10"   , 6202);
 sdum = "Lineaire"; mOPop[1]->SetValueStr(sdum);
-
-mOPop[2] = new PIOptMenu(this, "optmen-h2d-3", 100,25,10,70);
-mOPop[2]->AppendItem("B&W"       , 6301);
+mOPop[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+
+  cpy += bsy+spy;
+mOPop[2] = new PIOptMenu(this, "optmen-h2d-3",2*bsx,bsy,cpx,cpy);
+mOPop[2]->AppendItem("Black&White", 6301);
 mOPop[2]->AppendItem("Grey32"    , 6302);
 mOPop[2]->AppendItem("GreyInv32" , 6303);
-mOPop[2]->AppendItem("RJ32"      , 6304);
-mOPop[2]->AppendItem("BR32"      , 6305);
-mOPop[2]->AppendItem("RV32"      , 6306);
+mOPop[2]->AppendItem("ColRJ32"   , 6304);
+mOPop[2]->AppendItem("ColBR32"   , 6305);
+mOPop[2]->AppendItem("ColRV32"   , 6306);
 mOPop[2]->AppendItem("Grey128"   , 6307);
 mOPop[2]->AppendItem("GreyInv128", 6308);
-mOPop[2]->AppendItem("RJ128"     , 6309);
-mOPop[2]->AppendItem("BR128"     , 6310);
-mOPop[2]->AppendItem("Arc16"     , 6311);
-sdum = "B&W"; mOPop[2]->SetValueStr(sdum);
+mOPop[2]->AppendItem("ColRJ128"  , 6309);
+mOPop[2]->AppendItem("ColBR128"  , 6310);
+mOPop[2]->AppendItem("Col16"     , 6311);
+sdum = "Black&White"; mOPop[2]->SetValueStr(sdum);
+mOPop[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 
 // Labels et zone de saisie texte
-mLab[0] = new PILabel(this, "     Dyn: ",60,30,10,110); 
-mLab[1] = new PILabel(this, "    Frac: ",60,30,10,145);
-mLab[2] = new PILabel(this, " LogScal: ",60,30,10,180);
-
-mText[0] = new PIText(this, "Dynamique",150,30,80,110);
-mText[1] = new PIText(this, "Fraction" ,150,30,80,145);
-mText[2] = new PIText(this, "LogScale" ,150,30,80,180);
+  cpy += 2*(bsy+spy);
+mLab[0] = new PILabel(this, "     Dyn: ",bsx,bsy,cpx,cpy); 
+mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mText[0] = new PIText(this, "Dynamique" ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
+mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+  cpy += bsy+spy;
+mLab[1] = new PILabel(this, "    Frac: ",bsx,bsy,cpx,cpy);
+mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mText[1] = new PIText(this, "Fraction"  ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
+mText[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+  cpy += bsy+spy;
+mLab[2] = new PILabel(this, " LogScal: ",bsx,bsy,cpx,cpy);
+mLab[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mText[2] = new PIText(this, "LogScale"  ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
+mText[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 SetText();
 
 // Labels et curseur mobile
-mLab[3] = new PILabel(this, "   PerPt: ",60,30,10,215);
-mPScal = new PIScale(this,"FracPoints",6401,kSDirLtoR,150,20,80,215);
+  cpy += bsy+spy;
+mLab[3] = new PILabel(this, "   PerPt: ",bsx,bsy,cpx,cpy);
+mLab[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+mPScal = new PIScale(this,"FracPoints",6401,kSDirLtoR
+                        ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
+mPScal->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 mPScal->SetMinMax(0,100);
-int imfp = mFPoints*100.f;
-mPScal->SetValue(imfp);
+int imfp = mFPoints*100.f; mPScal->SetValue(imfp);
 
 // Boutons
-mBut[0] = new PIButton(this, "Apply",   6001, 60, 20, 150,10);
-mBut[1] = new PIButton(this, "Dismiss", 6002, 60, 20, 150,35);
-mBut[2] = new PIButton(this, "Get"  ,   6003, 60, 20, 150,60);
-mBut[3] = new PIButton(this, "Print",   6004, 60, 20, 150,85);
+  cpx = 2*bsx+5*spx, cpy = 2*spy;
+mBut[0] = new PIButton(this, "Apply",  6001,bsx,bsy,cpx,cpy);
+mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+  cpy += bsy+spy;
+mBut[1] = new PIButton(this, "Dismiss",6002,bsx,bsy,cpx,cpy);
+mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+  cpy += bsy+spy;
+mBut[2] = new PIButton(this, "Get"  ,  6003,bsx,bsy,cpx,cpy);
+mBut[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+  cpy += bsy+spy;
+mBut[3] = new PIButton(this, "Print",  6004,bsx,bsy,cpx,cpy);
+mBut[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 // FinishCreate();
 }
@@ -607,19 +643,19 @@
 else if(mTypScal==1) { sdum="Log10";    mOPop[1]->SetValueStr(sdum);}
 
-if(!mFgCol)                       { sdum="B&W";        mOPop[2]->SetValueStr(sdum);}
+if(!mFgCol)                       { sdum="Black&White";mOPop[2]->SetValueStr(sdum);}
 else {
   if(mCmap==CMAP_GREY32)          { sdum="Grey32";     mOPop[2]->SetValueStr(sdum);}
   else if(mCmap==CMAP_GREYINV32)  { sdum="GreyInv32";  mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COLRJ32)    { sdum="RJ32";       mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COLBR32)    { sdum="BR32";       mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COLRV32)    { sdum="RV32";       mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLRJ32)    { sdum="ColRJ32";    mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLBR32)    { sdum="ColBR32";    mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLRV32)    { sdum="ColRV32";    mOPop[2]->SetValueStr(sdum);}
   else if(mCmap==CMAP_GREY128)    { sdum="Grey128";    mOPop[2]->SetValueStr(sdum);}
   else if(mCmap==CMAP_GREYINV128) { sdum="GreyInv128"; mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COLRJ128)   { sdum="RJ128";      mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COLBR128)   { sdum="BR128";      mOPop[2]->SetValueStr(sdum);}
-  else if(mCmap==CMAP_COL16)      { sdum="Arc16";      mOPop[2]->SetValueStr(sdum);}
-}
-
-printf("H2WinArg::SetText\n");
+  else if(mCmap==CMAP_COLRJ128)   { sdum="ColRJ128";   mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COLBR128)   { sdum="ColBR128";   mOPop[2]->SetValueStr(sdum);}
+  else if(mCmap==CMAP_COL16)      { sdum="Col16";      mOPop[2]->SetValueStr(sdum);}
+}
+
+if(dbg)printf("H2WinArg::SetText\n");
 }
 
