Changeset 207 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Mar 2, 1999, 5:59:00 PM (27 years ago)
Author:
ercodmgr
Message:

Amelioration gestion att. graphiques des drawers ds DrwTools Reza 02/03/99

Location:
trunk/SophyaPI/PI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pidrawer.cc

    r204 r207  
    5959
    6060//++
     61// Titre        Les axes
     62//--
     63//++
    6164// void  SetLimits(double xmin, double xmax, double ymin, double ymax, -
    6265//                 int axrl=kAxeDirSame, int ayud=kAxeDirSame)
    6366//      Définit les limites du système de coordonnées.
     67//|     kAxeDirSame , kAxeDirAuto
     68//|     kAxeDirLtoR , kAxeDirRtoL  (Axe X)
     69//|     kAxeDirDownUp , kAxeDirUpDown (Axe Y)   
     70// void  GetAxesConfig(int& xa, int& ya)
     71//      Renvoie la configuration des axes.
     72// double XMin()  XMax()
     73//      Limites de l'axe X
     74// double YMin()  YMax()
     75//      Limites de l'axe Y
    6476// void  SetAxesFlags(unsigned int flags=kAxesNone)
    6577//      Attributs de tracé d'axes
    6678//|     kStdAxes , kBoxAxes , kTicks , kIntTicks , kExtTicks
    67 //|     kMajTicks , kMinTicks , kLabels , kAxesDflt , kAxesNone
     79//|     kMajTicks , kMinTicks , kLabels , kGridOn
     80//|     kAxesDflt , kAxesNone
     81// unsigned int GetAxesFlags()
     82//      Renvoie les attributs de tracé d'axes 
    6883// void  DrawAxes(PIGraphicUC* g)
    6984//      Méthode de tracé des axes
     
    95110  yMax = ymax;
    96111  aXFlg = axrl;  aYFlg = ayud;
    97   CalcTicks();
    98112  limitsFixed = 1;
     113}
     114
     115void
     116PIDrawer::GetAxesConfig(int& xa, int& ya)
     117{
     118xa = (aXdir) ? kAxeDirRtoL : kAxeDirLtoR;
     119ya = (aYdir) ? kAxeDirUpDown : kAxeDirDownUp;
    99120}
    100121
     
    144165//      Modifie les attributs graphiques de "g" à partir des attributs courant
    145166//      de l'objet "PIDrawer"
     167//
     168// PIColors  GetFgColAtt()
     169//      Renvoie l'attribut de couleur d'avant-plan
     170// PIColors  GetBgColAtt()
     171//      Renvoie l'attribut de couleur d'arrière-plan
     172// PILineAtt  GetLineAtt()
     173//      Renvoie l'attribut de ligne
     174// PIFontSize GetFontSz()
     175//      Renvoie l'attribut de taille de fonte
     176// PIFontAtt  GetFontAtt()
     177//      Renvoie l'attribut de type de fonte
     178// int  GetMarkerSz()
     179//      Renvoie l'attribut de taille de marker
     180// PIMarker GetMarker()
     181//      Renvoie l'attribut de type de marker
     182// CMapId GetColMapId()
     183//      Renvoie l'attribut de type de table de couleur
    146184//--
    147185
     
    283321  if (mLAtt == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
    284322  else g->SelLine(mLAtt);
     323//  On calcule les ticks
     324  CalcTicks();
     325
    285326  unsigned int flags = axesFlags;
    286327
  • trunk/SophyaPI/PI/pidrawer.h

    r204 r207  
    4545  virtual void       UpdateLimits();   // Calcule et change les limites 
    4646
    47   double XMin() const {return xMin;}
    48   double XMax() const {return xMax;}
    49   double YMin() const {return yMin;}
    50   double YMax() const {return yMax;}
     47  inline double      XMin() const {return xMin;}
     48  inline double      XMax() const {return xMax;}
     49  inline double      YMin() const {return yMin;}
     50  inline double      YMax() const {return yMax;}
     51
     52  void                GetAxesConfig(int& xa, int& ya);
    5153  inline unsigned int GetAxesFlags() { return(axesFlags); }
    5254 
    5355  inline PIGraphicUC*    GetGraphicUC() { return(mGrUC); }
    5456
    55   int    LimitsFixed() const {return limitsFixed;}
    56   void   FreeLimits() {limitsFixed = 0;}
    57 
    58   void               SetColAtt(PIColors fg=PI_NotDefColor,
     57  inline int          LimitsFixed() const {return limitsFixed;}
     58  inline void         FreeLimits() {limitsFixed = 0;}
     59
     60// Changement des attributs graphiques
     61  virtual void       SetColAtt(PIColors fg=PI_NotDefColor,
    5962                               PIColors bg=PI_NotDefColor);
    60   void               SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
    61   void               SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
     63  virtual void       SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
     64  virtual void       SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
    6265                                PIFontAtt fat=PI_NotDefFontAtt);
    63   void               SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
    64   void               SetColMapId(CMapId cid=CMAP_OTHER);
     66  virtual void       SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
     67  virtual void       SetColMapId(CMapId cid=CMAP_OTHER);
    6568
    6669  void               SelGraAtt(PIGraphicUC* g);
     70
     71// Acces aux attributs graphiques
     72  inline PIColors    GetFgColAtt()  { return(mFCol); }
     73  inline PIColors    GetBgColAtt()  { return(mBCol); }
     74  inline PILineAtt   GetLineAtt()   { return(mLAtt); }
     75  inline PIFontSize  GetFontSz()    { return(mFSz);  }
     76  inline PIFontAtt   GetFontAtt()   { return(mFAtt); }
     77  inline int         GetMarkerSz()  { return(mMSz);  }
     78  inline PIMarker    GetMarker()    { return(mMrk);  }
     79  inline CMapId      GetColMapId()  { return(mCmapid); }
     80
    6781
    6882//  --- Methode static ----
  • trunk/SophyaPI/PI/pidrwtools.cc

    r204 r207  
    5454spy = bsy/4;
    5555
    56 int wszx = 5*spx+3.5*bsx;
     56int wszx = 5*spx+4.25*bsx;
    5757int wszy = (6+3*0.85)*(spy+bsy);
    5858SetSize(wszx, wszy);
     
    7070cpy = spy*2;
    7171cpx += spx+1.5*bsx;
    72 mText[0] = new PIText(this, "x_min_max", 2.0*bsx, bsy, cpx, cpy);
     72mText[0] = new PIText(this, "x_min_max", 2.75*bsx, bsy, cpx, cpy);
    7373mText[0]->SetText("-1.0  1.0");
    7474cpy += spy+bsy;
    75 mText[1] = new PIText(this, "y_min_max", 2.0*bsx, bsy, cpx, cpy);
     75mText[1] = new PIText(this, "y_min_max", 2.75*bsx, bsy, cpx, cpy);
    7676mText[1]->SetText("-1.0  1.0");
    7777mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    8080cpx = spx+0.25*bsx;
    8181cpy += spy+bsy;
    82 mCkb[0] = new PICheckBox(this,"X-RtoL", 2000, bsx, bsy, cpx, cpy);
    83 cpx += spx+bsx;
    84 mCkb[1] = new PICheckBox(this,"Y-UpDn", 2000, bsx, bsy, cpx, cpy);
    85 cpx += spx+bsx;
    86 mCkb[2] = new PICheckBox(this,"Grid", 2000, bsx, bsy, cpx, cpy);
     82mCkb[0] = new PICheckBox(this,"X-RtoL", 2000, bsx*1.25, bsy, cpx, cpy);
     83cpx += spx+1.25*bsx;
     84mCkb[1] = new PICheckBox(this,"Y-UpDn", 2000, bsx*1.25, bsy, cpx, cpy);
     85cpx += spx+1.25*bsx;
     86mCkb[2] = new PICheckBox(this,"Grid", 2000, bsx*1.25, bsy, cpx, cpy);
    8787mCkb[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    8888mCkb[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    9191cpy += spy+bsy;
    9292cpx = 2.5*spx;;
    93 mBut[0] = new PIButton(this, "Apply", 2600, bsx, bsy, cpx, cpy);
    94 cpx += bsx*1.25;
    95 mBut[1] = new PIButton(this, "Auto", 2700, bsx, bsy, cpx, cpy);
    96 cpx += bsx*1.25;
    97 mBut[2] = new PIButton(this, "Dismiss", 2500,  bsx, bsy, cpx, cpy);
     93mBut[0] = new PIButton(this, "Apply", 2600, bsx*1.25, bsy, cpx, cpy);
     94cpx += bsx*1.50;
     95mBut[1] = new PIButton(this, "Auto", 2700, bsx*1.25, bsy, cpx, cpy);
     96cpx += bsx*1.50;
     97mBut[2] = new PIButton(this, "Dismiss", 2500,  bsx*1.25, bsy, cpx, cpy);
    9898mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    9999mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    110110bsy = 0.85*bsy;   spy = 0.85*spy;
    111111
    112 mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*1.75, bsy, cpx, cpy);
     112mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*2.0, bsy, cpx, cpy);
    113113mOpt[0]->AppendItem("Def.Col", 100);
    114114mOpt[0]->AppendItem("Black", 101);
     
    131131mOpt[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    132132
    133 cpx += spx+1.75*bsx;
    134 mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*1.75, bsy, cpx, cpy);
     133cpx += spx+2.25*bsx;
     134mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*2.0, bsy, cpx, cpy);
    135135mOpt[1]->AppendItem("No.CMap", 200);
    136136mOpt[1]->AppendItem("Grey32", 201);
     
    150150cpx = 2*spx;
    151151cpy += spy+bsy;
    152 mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*1.75, bsy, cpx, cpy);
     152mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*2.0, bsy, cpx, cpy);
    153153mOpt[2]->AppendItem("Def.Mrk", 300);
    154154mOpt[2]->AppendItem("Mrk Dot(.)", 301);
     
    166166mOpt[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    167167
    168 cpx += spx+1.75*bsx;
    169 mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*1.75, bsy, cpx, cpy);
     168cpx += spx+2.25*bsx;
     169mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*2.0, bsy, cpx, cpy);
    170170mOpt[3]->AppendItem("Mrk 1 pt", 401);
    171171mOpt[3]->AppendItem("Mrk 3 pt", 403);
     
    181181cpx = 2*spx;
    182182cpy += spy+bsy;
    183 mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*1.75, bsy, cpx, cpy);
     183mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*2.0, bsy, cpx, cpy);
    184184mOpt[4]->AppendItem("Def.Font", 500);
    185185mOpt[4]->AppendItem("Normal-Font", 511);
     
    198198mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    199199
    200 cpx += spx+1.75*bsx;
    201 mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*1.75, bsy, cpx, cpy);
     200cpx += spx+2.25*bsx;
     201mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*2.0, bsy, cpx, cpy);
    202202mOpt[5]->AppendItem("Def.Line", 600);
    203203mOpt[5]->AppendItem("Thin-Line", 601);
     
    213213mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    214214
    215 cpx = 2*spx;
     215cpx = spx;
    216216cpy += spy+bsyo;
    217217bsy = bsyo; spy = spyo;
     
    227227mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    228228
    229 cpx = wszx-1.7*bsx-3*spx;
    230 mButcf[0] = new PIButton(this, "SetAtt", 2800, bsx*0.85, bsy, cpx, cpy);
    231 cpx += 0.85*bsx+spx;
    232 mButcf[1] = new PIButton(this, "Refresh", 2900, bsx*0.85, bsy, cpx, cpy);
     229cpx = wszx-2.5*bsx-3*spx;
     230mButcf[0] = new PIButton(this, "GetAtt", 2800, bsx*0.80, bsy, cpx, cpy);
     231cpx += 0.80*bsx+spx;
     232mButcf[1] = new PIButton(this, "SetAtt", 2900, bsx*0.80, bsy, cpx, cpy);
     233cpx += 0.80*bsx+spx;
     234mButcf[2] = new PIButton(this, "Refresh", 3000, bsx*0.90, bsy, cpx, cpy);
    233235mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    234236mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     237mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    235238
    236239cwdrwt = this;
     
    248251  delete mBut[i];
    249252  delete mText[i];
    250   delete mButdr[i];
    251253  delete mButcf[i];
    252254  }
    253 for(i=0; i<3; i++) delete mCkb[i];
     255
     256for(i=0; i<3; i++) { delete mCkb[i];   delete mButcf[i]; }
    254257delete mBut[2];
    255258for(i=0; i<6; i++)  delete mOpt[i];
     
    289292char buff[92];
    290293mNDr = 0;
     294
    291295if (mCurBW != NULL)  {
    292296  mNDr = mCurBW->NbDrawers()-1;
    293297  if (mNDr < 0)  mNDr = 0;
    294298  }
     299
     300UpdateAttFromDrawer();
     301
     302mCkb[0]->SetState(false);
     303mCkb[1]->SetState(false);
     304mCkb[2]->SetState(false);
     305
    295306if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) {
    296307  PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW;
     
    299310  sprintf(buff, "%g  %g", scd->YMin(), scd->YMax());
    300311  mText[1]->SetText(buff);
     312  int xa, ya;
     313  scd->GetAxesConfig(xa, ya);
     314  if (xa & kAxeDirRtoL) mCkb[0]->SetState(true);
     315  if (ya & kAxeDirUpDown)  mCkb[1]->SetState(true);
     316  if (scd->GetAxesFlags() & kGridOn) mCkb[2]->SetState(true);
    301317  }
    302318else {
     
    307323mNlb->SetLabel(buff);
    308324
    309 mCkb[0]->SetState(false);
    310 mCkb[1]->SetState(false);
    311 mCkb[2]->SetState(false);
     325
     326
     327return;
     328}
     329
     330/* --Methode-- */
     331void PIDrwTools::UpdateAttFromDrawer()
     332{
     333
     334PIDrawer* dr = NULL;
    312335
    313336mOpt[0]->SetValue(100);
     
    318341mOpt[5]->SetValue(600);
    319342
     343if ( (mCurBW != NULL) && (mCurBW->NbDrawers() > 0) )
     344  dr = mCurBW->GetDrawer(mNDr);
     345
     346if (!dr)  return;
     347int jj,kk;
     348PIColors fc = dr->GetFgColAtt();
     349for(kk=0; kk<17; kk++)
     350  if (fc == cols[kk])  { mOpt[0]->SetValue(100+kk);  break; }   
     351CMapId cmi = dr->GetColMapId();
     352for(kk=0; kk<11; kk++)
     353  if (cmi == cmap[kk]) { mOpt[1]->SetValue(200+kk);  break; } 
     354PIMarker mk = dr->GetMarker();   
     355for(kk=0; kk<12; kk++)
     356  if (mk == mrk[kk])   { mOpt[2]->SetValue(300+kk);  break; }
     357kk = dr->GetMarkerSz();
     358if (kk < 1)  kk = 1;
     359if (kk > 15) kk = 15;
     360if (kk%2 == 0) kk++;
     361mOpt[3]->SetValue(400+kk);
     362PIFontAtt fat = dr->GetFontAtt();
     363PIFontSize fsz = dr->GetFontSz();
     364for(kk=0; kk<4; kk++)
     365  if (fat ==  fntatt[kk]) break;
     366for(jj=0; jj<5; jj++)
     367  if (fsz == fntsz[jj])  break;
     368
     369if (kk >= 4) kk = 3;
     370if (jj >= 5) jj = 4;
     371mOpt[4]->SetValue(500+jj*10+kk);
     372PILineAtt lat = dr->GetLineAtt();
     373for(kk=0; kk<10; kk++)
     374  if (lat == line[kk])   { mOpt[5]->SetValue(600+kk);  break; }
     375
    320376return;
    321377}
    322 
    323378
    324379/* --Methode-- */
     
    360415
    361416  case 2800 :
     417    UpdateAttFromDrawer();
     418    break;
     419
    362420  case 2900 :
     421  case 3000 :
    363422    {
    364423    PIDrawer* drw = mCurBW->GetDrawer(mNDr);
     
    381440    if ( (k < 0) || (k > 9) )  k = 0;
    382441    drw->SetLineAtt(line[k]);
    383     if (msg == 2800) drw->Refresh();
     442    if (msg == 2900) drw->Refresh();
    384443    else mCurBW->Refresh();
    385444    }
  • trunk/SophyaPI/PI/pidrwtools.h

    r202 r207  
    3030
    3131protected:
     32  virtual void  UpdateAttFromDrawer();
    3233  virtual void  Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
    3334
     
    4243  PILabel* mNlb;
    4344  PIButton* mButdr[2];
    44   PIButton* mButcf[2];
     45  PIButton* mButcf[3];
    4546  int mNDr;
    4647  int mtyp, msz;
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r204 r207  
    3232  inline void        SetAxesFlags(unsigned int flags=kBoxAxes | kExtTicks | kLabels)
    3333                                  { mBDrw->SetAxesFlags(flags); }
    34   inline unsigned int GetAxesFlags() { return(mBDrw->GetAxesFlags()); }
    35 
    3634  inline void        SetTitles(const char* tt=NULL, const char* tb=NULL)
    3735                            { mBDrw->SetTitles(tt, tb); }
     
    4240  inline PIElDrawer* BaseDrawer() { return mBDrw; };
    4341
    44   double XMin() const {return mBDrw->XMin();}
    45   double XMax() const {return mBDrw->XMax();}
    46   double YMin() const {return mBDrw->YMin();}
    47   double YMax() const {return mBDrw->YMax();}
    48   double XPPos() const { return mPPos[0]; }
    49   double YPPos() const { return mPPos[1]; }
     42// Configuration et limites des axes
     43  inline unsigned int GetAxesFlags() { return(mBDrw->GetAxesFlags()); }
     44  inline void         GetAxesConfig(int& xa, int& ya) { mBDrw->GetAxesConfig(xa, ya); }
     45
     46  inline double XMin() const {return mBDrw->XMin();}
     47  inline double XMax() const {return mBDrw->XMax();}
     48  inline double YMin() const {return mBDrw->YMin();}
     49  inline double YMax() const {return mBDrw->YMax();}
     50
     51  inline double XPPos() const { return mPPos[0]; }
     52  inline double YPPos() const { return mPPos[1]; }
     53
    5054  int    LimitsFixed() const {return mBDrw->LimitsFixed();}
    5155  void   FreeLimits() { mBDrw->FreeLimits(); }
Note: See TracChangeset for help on using the changeset viewer.