Changeset 1971 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc


Ignore:
Timestamp:
Apr 30, 2002, 2:34:41 PM (23 years ago)
Author:
ansari
Message:

1/ Basculement de decodage des options de display aux methodes
PIDrawer/PIWdg::DecodeOptionString()
2/ Possibilite de Show/Hide de la partie Zoom/ColorMap/Stat du MainWindow

Reza 30/4/2002

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r1905 r1971  
    9393m[3]->AppendItem("Window", 10411);
    9494m[3]->AppendItem("Window 2x1", 10421);
    95 m[3]->AppendItem("Window 1x2", 10412);
     95// m[3]->AppendItem("Window 1x2", 10412);
    9696m[3]->AppendItem("Window 2x2", 10422);
    97 m[3]->AppendItem("Window 3x1", 10431);
     97// m[3]->AppendItem("Window 3x1", 10431);
    9898m[3]->AppendItem("Window 3x3", 10433);
    9999m[3]->AppendItem("Cur->LastWdg", 10441);
    100100m[3]->AppendItem("Close CurWin", 10460);
     101m[3]->AppendCheckItem("StatZoomWin", 10470);
     102m[3]->SetStateMsg(10470, true);
    101103
    102104m[4] = new PIMenu(Menubar(),"PostScript");
     
    138140MainWin()->SetSize(msx, msy);
    139141
     142//------------------------------------------------------
     143// On cree un container intermediaire permettant de gerer
     144// le widget zoom, colormap, stats, ...
     145
    140146int bss = 100+mFgScSz*15;
    141 gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5);
     147
     148int statc_szy = bss+10+14+mFgScSz*2+5;
     149statcont = new PIContainer(MainWin(), "ZGCSCont", msx, statc_szy, 0, 0);
     150statcont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
     151
     152gimv = new PIPixmap(statcont, "GloV", bss, bss, 5, 5);
    142153gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
    143 zoom = new PIPixmap(MainWin(), "Zoom", bss, bss, bss+10, 5);
     154zoom = new PIPixmap(statcont, "Zoom", bss, bss, bss+10, 5);
    144155zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
    145 cmapv = new PICMapView(MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
     156cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
    146157cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
    147 
    148 int cpy = bss+10+14+mFgScSz*2+5;
     158labstat = new PILabel(statcont, "statlabel", msx-2*(bss+20), 20, 2*bss+20, 10);
     159labstat->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
     160labstat->SetLabel("Stat-Zoom-ColMap Window");
     161labstat->SetForegroundColor(PI_Red);
     162labstat->SetBorderWidth(1);
     163statcont->Show();
     164// StatZoomWindowSetVisible(true);
     165//------------------------------------------------------
     166
     167//int cpy = bss+10+14+mFgScSz*2+5;
     168int cpy = statc_szy;
    149169
    150170// Creation d'une console avec gestion des commandes 
    151 mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy );
     171consolecont = new PIContainer(MainWin(), "ConsoleCont", msx, msy-cpy, 0, cpy );
     172consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
     173mCons = new PIConsole(consolecont, "Console", 30200, 512, 132, msx, msy-cpy, 0, 0 );
    152174mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
    153175mCons->AcceptCmd(true, 50);
     176consolecont->Show();
    154177redirecout = false;
    155178// RedirectStdOutErr(true);  pas par defaut
     
    200223
    201224// Attributs graphiques courants
    202 mFCol = mBCol = PI_NotDefColor;
    203 mLAtt = PI_NotDefLineAtt;
    204 mFName = PI_DefaultFont;   
    205 mFSz = PI_NotDefFontSize;
    206 mFAtt = PI_NotDefFontAtt;
    207 mMSz = -1;
    208 mMrk = PI_NotDefMarker;
    209 mCmapid = CMAP_OTHER;
    210 mRevCmap = false;
    211 mZoom = 0;
    212225mAxesFlags = kBoxAxes | kExtTicks | kLabels;
    213 SetXYLimits(-1, 1., -1., 1.);
    214 mFXYlim = false;
    215226SetInsetLimits(0.4, 0.6, 0.4, 0.6);
    216 SetImageCenterPosition(-1,-1);
    217 mFImgCenter = false;
    218 maXlog = maYlog = false;
    219227mAddTitle = true;
    220 SaveGraphicAtt();
    221228
    222229// Initialisation
     
    269276delete gimv;
    270277delete cmapv;
     278delete labstat;
     279
     280delete statcont;
    271281
    272282delete pfc_fits;
     
    275285
    276286delete mCons;
     287 delete consolecont;
    277288
    278289delete mObjmgrw;
     
    449460
    450461/* --Methode-- */
    451 int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid)
     462int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop, int oid)
    452463{
    453464PIImage* pii;
     
    468479  }
    469480
    470 int zm = 1;
    471 if (mZoom == 0) {  // Facteur de zoom auto
    472   zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() :  nouv->YSize();
    473   zm = (zm >= 250) ? 250/zm : 1;
    474   }
    475 else zm = mZoom;
    476 
    477 if (zm == 0)  zm = 1;
    478 if (zm < -10)  zm = -10;
    479 if (zm > 10)  zm = 10;
    480 
    481 if (zm > 0)  { sx = nouv->XSize()*zm;  sy = nouv->YSize()*zm; }
    482 else  {
    483   sx = (int)((float)nouv->XSize()*(-1./float(zm))); 
    484   sy = (int)((float)nouv->YSize()*(-1./float(zm)));
    485   }
     481// On decode les options graphiques
     482vector<string> opts;
     483DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     484
     485// Pas de same ou inset pour DispImage
     486if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next;
     487
     488// Choix de la taille de fenetre
     489#define MINPIIMGSIZE 100
     490sx = (nouv->XSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
     491sy = (nouv->YSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
    486492if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
    487493if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
    488494px = py = 0;
    489 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
     495win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    490496pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
    491497pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     
    493499pii->SetGloVWin(gimv, false);
    494500pii->SetCMapWin(cmapv, false);
    495 pii->SetZoom(zm, false);
    496 if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, mRevCmap, false);
    497501pii->ShowCursor(true);
    498502pii->SetUserData(NULL, oid);
    499 // Centrage eventuel du pave
    500 if (mFImgCenter && (mXImgCenter > 0) && (mYImgCenter > 0)) {
    501   pii->SetImage(nouv, false);
    502   pii->SetPave(mXImgCenter, mYImgCenter, true, true);
    503   }
    504 else pii->SetImage(nouv, true);
     503
     504// decode des options en chaine de caracteres
     505pii->DecodeOptionString(mDefaultAtt, false);  // d'abord les options par defaut
     506pii->DecodeOptionString(opts);      // ensuite, les options specifies en argument
     507
     508
     509// On recalcule la taille de la fenetre si Disp_Win
     510if (dwopt == Disp_Win) {
     511  int sx2 = (int)((float)nouv->XSize()*pii->GetZoomF());
     512  int sy2 = (int)((float)nouv->YSize()*pii->GetZoomF());
     513 
     514  if (sx2 > 400+mFgScSz*100) sx2 = 400+mFgScSz*100;
     515  if (sy2 > 400+mFgScSz*100) sy2 = 400+mFgScSz*100;
     516  if (sx2 < MINPIIMGSIZE) sx = MINPIIMGSIZE;
     517  if (sy2 < MINPIIMGSIZE) sy = MINPIIMGSIZE;
     518  if ((sx2 != sx) || (sy2 != sy))  win->SetSize(sx2, sy2);
     519}
     520
     521pii->SetImage(nouv, false);
     522
    505523// printf("!!DBG!! PIImage Pos= %d %d  Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize()   );
    506524mCurWin = win;
     
    509527mBWId++;
    510528mBWList[mBWId] = pii;
     529pii->Refresh();
    511530return(mBWId);
    512531}
     
    514533
    515534/* --Methode-- */
    516 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, int oid)
     535int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, string const& sop,
     536                              string title, int oid)
    517537{
    518538if (scd == NULL)
     
    522542  }
    523543
    524 // Changement d'attributs graphiques courants du drawer
    525 if (mFCol != PI_NotDefColor) scd->GetGraphicAtt().SetColAtt(mFCol, mBCol);
    526 if (mLAtt != PI_NotDefLineAtt) scd->GetGraphicAtt().SetLineAtt(mLAtt);
    527 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
    528   scd->GetGraphicAtt().SetFontAtt(mFSz, mFAtt);
    529 if ( mFName != PI_DefaultFont )
    530   scd->GetGraphicAtt().SetFontAtt(mFName, scd->GetGraphicAtt().GetFontSz(),
    531                                scd->GetGraphicAtt().GetFontAtt());
    532 if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) )
    533   scd->GetGraphicAtt().SetMarkerAtt(mMSz, mMrk);
    534 if ( mCmapid != CMAP_OTHER ) scd->GetGraphicAtt().SetColMapId(mCmapid);
    535 
    536 
    537 if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) )  opt = Disp_Next;
     544// On decode les options graphiques
     545vector<string> opts;
     546DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     547if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) )  dwopt = Disp_Next;
    538548// Trace en superpoistion
    539 if ( (opt == Disp_Same) && (mLastWdg) ) { 
     549if ( (dwopt == Disp_Same) && (mLastWdg) ) { 
     550  // Les options
     551  scd->DecodeOptionString(mDefaultAtt, false);
     552  scd->DecodeOptionString(opts, true);
     553
    540554  if (mLastWdg->kind() == PIScDrawWdg::ClassId)  ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
    541555  else mLastWdg->AddDrawer(scd, true, true, true);
     
    546560}
    547561// Trace en medaillon
    548 else if ( (opt == Disp_Inset) && (mLastWdg) ) {
     562else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
    549563  PIGrCoord x1, x2, y1, y2;
    550564  x1 = mIXmin;  x2 = mIXmax;
    551565  y2 = 1.-mIYmin;  y1 = 1.-mIYmax;
     566  // Les options
     567  scd->DecodeOptionString(mDefaultAtt, false);
     568  scd->DecodeOptionString(opts, true);
     569
    552570  scd->SetAxesFlags(mAxesFlags);
    553   if (maXlog || maYlog)  scd->SetLogScale(maXlog, maYlog);  // Echelle log
    554   if (mFXYlim)  // Forcage limites XY
    555     scd->SetLimits(mXmin, mXmax, mYmin, mYmax); 
    556   else scd->UpdateLimits();
     571  scd->UpdateLimits();
    557572  mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
    558573  scd->Refresh();
     
    562577}
    563578
     579// Creation d'un nouveau PIScDrawWdg
    564580PIWindow* win;
    565581PIScDrawWdg* scw;
     
    567583sx = 200+mFgScSz*100;
    568584sy = 200+mFgScSz*100;
    569 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
    570 /*
    571 if (typeid(*scd) != typeid(PIHisto2D))
    572 else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
    573 */
     585win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
     586
    574587scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
    575588scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    576589scw->SetUserData(NULL, oid);
    577 if (maXlog || maYlog)  scw->SetLogScale(maXlog, maYlog);  // Echelle log
    578 if (mFXYlim)  // Forcage limites XY
    579   scw->SetLimits(mXmin, mXmax, mYmin, mYmax);
     590
     591// Decodage des options :
     592vector<string> scwatt;
    580593scw->SetAxesFlags(mAxesFlags);
    581 // Fonte de trace d'axe
    582 scw->BaseDrawer()->GetGraphicAtt().SetFontAtt(mFName, mFSz, mFAtt);
    583 /*
    584 if (typeid(*scd) != typeid(PIHisto2D))
    585 else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
    586 */
    587 scw->AddScDrawer(scd, true);
     594if ( mDefaultAtt.size() > 0) {
     595  scwatt = mDefaultAtt;
     596  scw->DecodeOptionString(scwatt, true);
     597}
     598if ( mAxesAtt.size() > 0) {
     599  scwatt = mAxesAtt;
     600  scw->DecodeOptionString(scwatt, true);
     601}
     602if (opts.size() > 0)
     603  scd->DecodeOptionString(opts, true);
     604if (opts.size() > 0)
     605  scw->DecodeOptionString(opts, false);
     606
    588607//   Titre du plot
    589608if (mAddTitle) {
     
    592611}
    593612
     613scw->AddScDrawer(scd, true);
    594614// scw->Refresh();   ? Pas necessaire  Reza 19/08/98, 05/05/99 $CHECK$
     615
    595616mCurWin = win;
    596617mCurWdg = scw;
     
    602623
    603624/* --Methode-- */
    604 int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title, int oid)
     625int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, string const& sop,
     626                              string title, int oid)
    605627{
    606628if (dr3 == NULL)
     
    610632  }
    611633
    612 // Changement d'attributs graphiques courants du drawer
    613 if (mFCol != PI_NotDefColor) dr3->GetGraphicAtt().SetColAtt(mFCol, mBCol);
    614 if (mLAtt != PI_NotDefLineAtt) dr3->GetGraphicAtt().SetLineAtt(mLAtt);
    615 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
    616   dr3->GetGraphicAtt().SetFontAtt(mFSz, mFAtt);
    617 if ( mFName != PI_DefaultFont )
    618   dr3->GetGraphicAtt().SetFontAtt(mFName, dr3->GetGraphicAtt().GetFontSz(),
    619                                   dr3->GetGraphicAtt().GetFontAtt());
    620 if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) )
    621   dr3->GetGraphicAtt().SetMarkerAtt(mMSz, mMrk);
    622 if ( mCmapid != CMAP_OTHER ) dr3->GetGraphicAtt().SetColMapId(mCmapid);
    623 
    624 if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) )  opt = Disp_Next;
     634// On decode les options graphiques
     635vector<string> opts;
     636DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     637
     638if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) )  dwopt = Disp_Next;
    625639// Trace en superpoistion
    626 if ( (opt == Disp_Same) && (mLastWdg) ) {
     640if ( (dwopt == Disp_Same) && (mLastWdg) ) {
     641  // Les options
     642  dr3->DecodeOptionString(mDefaultAtt, false);
     643  dr3->DecodeOptionString(opts, true);
     644
    627645  if (mLastWdg->kind() == PIDraw3DWdg::ClassId)  ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
    628646  else mLastWdg->AddDrawer(dr3, true, true, true);
     
    633651}
    634652// Trace en medaillon
    635 else if ( (opt == Disp_Inset) && (mLastWdg) ) {
     653else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
    636654  PIGrCoord x1, x2, y1, y2;
    637655  x1 = mIXmin;  x2 = mIXmax;
    638656  y2 = 1.-mIYmin;  y1 = 1.-mIYmax;
     657  // Les options
     658  dr3->DecodeOptionString(mDefaultAtt, false);
     659  dr3->DecodeOptionString(opts, true);
     660
    639661  dr3->SetAxesFlags(mAxesFlags);
    640662  dr3->UpdateLimits();
     
    651673sx = 200+mFgScSz*100;
    652674sy = 200+mFgScSz*100;
    653 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
     675win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    654676PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
    655677wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    656678wd3->SetUserData(NULL, oid);
    657 wd3->AddDrawer3D(dr3, true);
     679
     680// Decodage des options :
     681vector<string> scwatt;
     682// wd3->SetAxesFlags(mAxesFlags);  Attributs d'axes 3D a faire
     683if ( mDefaultAtt.size() > 0) {
     684  scwatt = mDefaultAtt;
     685  wd3->DecodeOptionString(scwatt, true);
     686}
     687if ( mAxesAtt.size() > 0) {
     688  scwatt = mAxesAtt;
     689  wd3->DecodeOptionString(scwatt, true);
     690}
     691if (opts.size() > 0) 
     692  dr3->DecodeOptionString(opts, true);
     693if (opts.size() > 0) 
     694  wd3->DecodeOptionString(opts, false);
     695
    658696//   Titre du plot
    659697if (mAddTitle) {
     
    661699  wd3->SetTitles(title, t2);   
    662700}
     701
     702wd3->AddDrawer3D(dr3, true);
    663703// wd3->Refresh();   ?Pas necessaire   $CHECK$ 05/05/99
     704
    664705mCurWin = win;
    665706mCurWdg = wd3;
     
    671712
    672713/* --Methode-- */
    673 void PIStdImgApp::AddText(string const & txt, double xp, double yp)
     714void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
    674715{
    675716PIElDrawer *eld=CurrentElDrawer();
    676717if (eld == NULL) return;
    677718
    678 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
    679   eld->GetGraphicAtt().SetFontAtt(mFSz, mFAtt);
    680 if ( mFName != PI_DefaultFont )
    681   eld->GetGraphicAtt().SetFontAtt(mFName, eld->GetGraphicAtt().GetFontSz(),
    682                                   eld->GetGraphicAtt().GetFontAtt());
    683 eld->ElAddText(xp,yp,txt.c_str(),mFCol);
     719vector<string> opts;
     720ParseDisplayOption(sop, opts);
     721PIGraphicAtt gratt(opts);
     722eld->ElAddText(xp,yp,txt.c_str(), gratt.GetColor());
    684723eld->Refresh();
    685724}
    686725
    687726/* --Methode-- */
    688 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2)
     727void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop)
    689728{
    690729PIElDrawer *eld=CurrentElDrawer();
    691730if (eld == NULL) return;
    692731
    693 eld->ElAddLine(xp1, yp1, xp2, yp2, mFCol);
     732vector<string> opts;
     733ParseDisplayOption(sop, opts);
     734PIGraphicAtt gratt(opts);
     735eld->ElAddLine(xp1, yp1, xp2, yp2, gratt.GetColor());
    694736eld->Refresh();
    695737}
    696738
    697739/* --Methode-- */
    698 void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill)
     740void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
     741                               string const& sop, bool fgfill)
    699742{
    700743PIElDrawer *eld=CurrentElDrawer();
     
    715758  yp = yp2; dy = yp1-yp2;
    716759}
    717 if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, mFCol);
    718 else eld->ElAddRect(xp, yp, dx, dy, mFCol);
     760
     761vector<string> opts;
     762ParseDisplayOption(sop, opts);
     763PIGraphicAtt gratt(opts);
     764
     765if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, gratt.GetColor());
     766else eld->ElAddRect(xp, yp, dx, dy, gratt.GetColor());
    719767eld->Refresh();
    720768}
    721769
    722770/* --Methode-- */
    723 void PIStdImgApp::AddCircle(double xc, double yc, double r, bool fgfill)
     771void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
    724772{
    725773PIElDrawer *eld=CurrentElDrawer();
    726774if (eld == NULL) return;
    727775
    728 if (fgfill) eld->ElAddFCirc(xc, yc, r, mFCol);
    729 else eld->ElAddCirc(xc, yc, r, mFCol);
     776vector<string> opts;
     777ParseDisplayOption(sop, opts);
     778PIGraphicAtt gratt(opts);
     779
     780if (fgfill) eld->ElAddFCirc(xc, yc, r, gratt.GetColor());
     781else eld->ElAddCirc(xc, yc, r, gratt.GetColor());
    730782eld->Refresh();
    731783}
     
    737789if (eld == NULL) return;
    738790
    739 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
    740   eld->GetGraphicAtt().SetFontAtt(mFSz, mFAtt);
    741 if ( mFName != PI_DefaultFont )
    742   eld->GetGraphicAtt().SetFontAtt(mFName, eld->GetGraphicAtt().GetFontSz(),
    743                                   eld->GetGraphicAtt().GetFontAtt());
    744791eld->SetTitles(titletop, titlebottom);
    745792eld->Refresh();
     
    815862
    816863/* --Methode-- */
    817 PIWindow* PIStdImgApp::GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
     864PIWindow* PIStdImgApp::GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
    818865{
    819866PIWindow* rw;
     
    821868switch (typ) {
    822869  case Disp_Next :  // Fenetre graphique courante
     870  case Disp_Default :
    823871    {
    824872    if (mGrW == NULL) CreateGraphWin();
     
    9931041}
    9941042
     1043/* --Methode-- */
     1044void PIStdImgApp::StatZoomWindowSetVisible(bool fg)
     1045{
     1046
     1047  if (fg) {
     1048    consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
     1049    int szy = MainWin()->YSize();
     1050    MainWin()->SetSize(MainWin()->XSize(), szy+statcont->YSize());
     1051    consolecont->SetPos(0, statcont->YSize());
     1052    consolecont->SetSize(MainWin()->XSize(), szy);
     1053    consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
     1054    statcont->Show();
     1055    m[3]->SetStateMsg(10470, true);
     1056  }
     1057  else {
     1058    statcont->Hide();
     1059    consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
     1060    MainWin()->SetSize(MainWin()->XSize(), MainWin()->YSize()-statcont->YSize());
     1061    consolecont->SetPos(0, 0);
     1062    consolecont->SetSize(MainWin()->XSize(), MainWin()->YSize());
     1063    consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
     1064    m[3]->SetStateMsg(10470, false);   
     1065  }
     1066 
     1067}
    9951068
    9961069/* --Methode-- */
     
    10401113m[4]->SetSensitivityMsg(10516, false);
    10411114}
     1115
     1116//---------------------------------------------------------------------------
     1117//--------- Gestion des attributs graphiques et autres options de trace -----
     1118
     1119/* --Methode-- */
     1120void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
     1121{
     1122  mIXmin = xmin;  mIXmax= xmax;
     1123  mIYmin = ymin;  mIYmax= ymax;
     1124}
     1125
     1126/* --Methode-- */
     1127void PIStdImgApp::SetDefaultGraphicAttributes(string const & opt)
     1128{
     1129  ParseDisplayOption(opt, mDefaultAtt);
     1130}
     1131
     1132/* --Methode-- */
     1133void PIStdImgApp::SetDefaultAxesAttributes(string const & opt)
     1134{
     1135  ParseDisplayOption(opt, mAxesAtt);
     1136}
     1137
     1138/* --Methode-- */
     1139DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts)
     1140{
     1141  DispWinEnum rc = Disp_Next;
     1142  //DBG  cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl;
     1143  if (opts.size() > 0)  opts.erase(opts.begin(), opts.end());
     1144  if (sop.length() < 1) return(rc);
     1145  string gratt = sop;
     1146  for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
     1147  if ( (gratt == "def") || (gratt == "default") ) return(rc);
     1148// On separe en mots espaces par des blancs ou tabulation
     1149  size_t p = 0;
     1150  size_t q = 0;
     1151  size_t l = gratt.length();
     1152  string token;
     1153  while (q < l)  {
     1154    p = gratt.find_first_not_of(" \t",q);   // au debut d'un token
     1155    if (p >= l) break;
     1156    q = gratt.find_first_of(" \t",p);       // Premier blanc ou tab suivant
     1157    if (q<l) token = gratt.substr(p,q-p);
     1158    else token = gratt.substr(p);
     1159    if (token == "") continue;
     1160    // Decodage option fenetre d'affichage (win, next, ...)
     1161    if (token == "win")   rc =  Disp_Win;
     1162    else if (token == "same")  rc = Disp_Same;
     1163    else if (token == "inset")   rc = Disp_Inset;
     1164    else  if (token == "stack")   rc = Disp_Stack;
     1165    // Option a etre decode par les drawers, etc ...
     1166    else  opts.push_back(token);
     1167  }
     1168
     1169  //DBG  cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl;
     1170  return (rc);
     1171}
     1172
     1173//---------------------------------------------------------------------------
     1174//------------       Methodes privees (MBProcessx, ...)    ----------
    10421175
    10431176/* --Methode-- */
     
    12951428      DeleteWindow(mCurWin);
    12961429      break;
     1430    case 10470 :
     1431      StatZoomWindowSetVisible(m[3]->GetStateMsg(10470));
     1432      break;
    12971433  default:
    12981434    cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " <<  msg << endl;   
     
    14611597
    14621598
    1463 /* --Methode-- */
    1464 void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)
    1465 {
    1466   mFCol = fg;
    1467   mBCol = bg;
    1468 }
    1469 /* --Methode-- */
    1470 void PIStdImgApp::SetLineAtt(PILineAtt lat)
    1471 {
    1472   mLAtt = lat;
    1473 }
    1474 
    1475 /* --Methode-- */
    1476 void PIStdImgApp::SetFontName(PIFontName fn)
    1477 {
    1478   mFName = fn;
    1479 }
    1480 
    1481 /* --Methode-- */
    1482 void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
    1483 {
    1484   mFSz = fsz;
    1485   mFAtt = fat;
    1486 }
    1487 /* --Methode-- */
    1488 void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)
    1489 {
    1490   mMSz = sz;
    1491   mMrk = mrk;
    1492 }
    1493 
    1494 /* --Methode-- */
    1495 void PIStdImgApp::SetZoomAtt(int zoom)
    1496 {
    1497   if ( (zoom > 10) || (zoom < -10) ) zoom = 0;
    1498   mZoom = zoom;
    1499 }
    1500 /* --Methode-- */
    1501 void PIStdImgApp::SetAxesAtt(unsigned int axfl)
    1502 {
    1503   mAxesFlags = axfl;
    1504 }
    1505 /* --Methode-- */
    1506 void PIStdImgApp::SetXYLimits(double xmin, double xmax, double ymin, double ymax)
    1507 {
    1508   mXmin = xmin;  mXmax= xmax;
    1509   mYmin = ymin;  mYmax= ymax;
    1510 }
    1511 /* --Methode-- */
    1512 void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
    1513 {
    1514   mIXmin = xmin;  mIXmax= xmax;
    1515   mIYmin = ymin;  mIYmax= ymax;
    1516 }
    1517 /* --Methode-- */
    1518 void PIStdImgApp::SetImageCenterPosition(int x, int y)
    1519 {
    1520   mXImgCenter = x;  mYImgCenter = y;
    1521 }
    1522 
    1523 /* --Methode-- */
    1524 void PIStdImgApp::SaveGraphicAtt()
    1525 {
    1526   mSFCol = mFCol;
    1527   mSBCol = mBCol;
    1528   mSLAtt = mLAtt;
    1529   mSFName = mFName;
    1530   mSFSz = mFSz;
    1531   mSFAtt = mFAtt;
    1532   mSMSz = mMSz;
    1533   mSMrk = mMrk;
    1534   mSCmapid = mCmapid;
    1535   mSRevCmap = mRevCmap;
    1536   mSZoom = mZoom;
    1537   mSAxesFlags = mAxesFlags;
    1538   mSXmin = mXmin;  mSXmax = mXmax;
    1539   mSYmin = mYmin;  mSYmax = mYmax;
    1540   mSIXmin = mIXmin;  mSIXmax = mIXmax;
    1541   mSIYmin = mIYmin;  mSIYmax = mIYmax;
    1542   mSFXYlim = mFXYlim;
    1543   mSXImgCenter = mXImgCenter;
    1544   mSYImgCenter = mYImgCenter;
    1545   mSFImgCenter = mFImgCenter;
    1546   mSaXlog = maXlog;
    1547   mSaYlog = maYlog;
    1548   mSAddTitle = mAddTitle;
    1549 }
    1550 
    1551 /* --Methode-- */
    1552 void PIStdImgApp::RestoreGraphicAtt()
    1553 {
    1554   mFCol = mSFCol;
    1555   mBCol = mSBCol;
    1556   mLAtt = mSLAtt;
    1557   mFName = mSFName;
    1558   mFSz = mSFSz;
    1559   mFAtt = mSFAtt;
    1560   mMSz = mSMSz;
    1561   mMrk = mSMrk;
    1562   mCmapid = mSCmapid;
    1563   mRevCmap = mSRevCmap;
    1564   mZoom = mSZoom;
    1565   mAxesFlags = mSAxesFlags;
    1566   mXmin = mSXmin;  mXmax = mSXmax;
    1567   mYmin = mSYmin;  mYmax = mSYmax;
    1568   mIXmin = mSIXmin;  mIXmax = mSIXmax;
    1569   mIYmin = mSIYmin;  mIYmax = mSIYmax;
    1570   mFXYlim = mSFXYlim;
    1571   mXImgCenter = mSXImgCenter;
    1572   mYImgCenter = mSYImgCenter;
    1573   mFImgCenter = mSFImgCenter;
    1574   maXlog = mSaXlog;
    1575   maYlog = mSaYlog;
    1576   mAddTitle = mSAddTitle;
    1577 }
    15781599
    15791600//  -------------------------------------------------
     
    16201641string info = "piapp : Interactive analysis program\n";
    16211642info += buff;
    1622 info += "(C) LAL-IN2P3/CNRS  1996-2000\n";
    1623 info += "(C) SPP-DAPNIA/CEA  1996-2000\n";
     1643info += "(C) LAL-IN2P3/CNRS  1996-2002\n";
     1644info += "(C) SPP-DAPNIA/CEA  1996-2002\n";
    16241645infow_txt->SetText(info);
    16251646}
Note: See TracChangeset for help on using the changeset viewer.