Changeset 1568 in Sophya


Ignore:
Timestamp:
Jul 6, 2001, 3:43:06 PM (24 years ago)
Author:
ansari
Message:

Ajout methodes pour gestion de fontes (helvetica, ...) ds PIDrawer - Reza 6/7/2001

Location:
trunk/SophyaPI/PI
Files:
2 edited

Legend:

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

    r587 r1568  
    4949  mDndfg = false;  // Pour controle de l'appel de Detach() si delete
    5050
     51  mFgHighLight = false;  // Flag de control d'affichage en mode HighLight
     52
    5153  mFCol = mBCol = PI_NotDefColor;
    5254  mLAtt = PI_NotDefLineAtt;
     
    5658  mMrk = PI_NotDefMarker;
    5759  mCmapid = CMAP_OTHER;
     60  mRevCmap = false;
     61  mFName = PI_DefaultFont;
    5862}
    5963
     
    152156//      Cette méthode doit calculer les limites (X/Y Min-Max) préferées par l'objet
    153157//      et doit appeler "SetLimits()". L'implementation par défaut ne fait rien.
     158//  void  HighLight(bool fgh)
     159//      Rafraichit le dessin du PIDrawer sur tous les PIBaseWdg auxquel il est attaché,
     160//      en mode "HighLight" si "fgh==true", en mode normal sinon.
    154161//  void  AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax)
    155162//      Méthode qui met à jour la chaîne "info", avec les informations (textuelles) de
     
    171178         (*it).wdg->CallDrawer((*it).id);
    172179
     180}
     181void
     182PIDrawer::HighLight(bool fgh)
     183{
     184  mFgHighLight = fgh;
     185  Refresh();
     186  mFgHighLight = false;
    173187}
    174188
     
    182196//      Modifie l'attribut type de ligne
    183197// void  SetFontAtt(PIFontSize fsz=PI_NotDefFontSize, PIFontAtt fat=PI_NotDefFontAtt)
    184 //      L'attribut Type de fonte
     198//      Selection taille et attribut de fonte
     199// void  SetFont(PIFontName fn, PIFontSize fsz=PI_NotDefFontSize, PIFontAtt fat=PI_NotDefFontAtt)
     200//      Selection de type, taile et attribut de fonte
    185201// void  SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker)
    186202//      L'attribut type et taille de marker
    187 // void  SetColMapId(CMapId cid=CMAP_OTHER)
    188 //      L'attribut choix de la table de couleurs
     203// void  SetColMapId(CMapId cid=CMAP_OTHER, bool rev=false)
     204//      L'attribut choix de la table de couleurs, et son flag d'inversion
    189205// void  SelGraAtt(PIGraphicUC* g)
    190206//      Modifie les attributs graphiques de "g" à partir des attributs courant
     
    207223// CMapId GetColMapId()
    208224//      Renvoie l'attribut de type de table de couleur
     225// CMapId GetColMapId(bool & rev)
     226//      Renvoie l'attribut de type de table de couleur,
     227//      et le flag d'inversion de la table de couleur
    209228//--
    210229
     
    230249
    231250void
     251PIDrawer::SetFont(PIFontName fn, PIFontSize fsz, PIFontAtt fat)
     252{
     253  mFName = fn;
     254  mFSz = fsz;
     255  mFAtt = fat;
     256}
     257
     258void
    232259PIDrawer::SetMarkerAtt(int sz, PIMarker mrk)
    233260{
     
    237264
    238265void
    239 PIDrawer::SetColMapId(CMapId cid)
     266PIDrawer::SetColMapId(CMapId cid, bool rev)
    240267{
    241268  mCmapid = cid;
     269  mRevCmap = rev;
    242270}
    243271
     
    248276  if (mBCol != PI_NotDefColor)    g->SelBackground(mBCol);
    249277  if (mLAtt != PI_NotDefLineAtt)  g->SelLine(mLAtt);
    250   if ( (mFSz != PI_NotDefFontSize) || (mFAtt != PI_NotDefFontAtt) )
     278  if (mFName != PI_DefaultFont) {
     279    PIFont myfont(mFName);
     280    myfont.SetFontAtt(mFAtt);
     281    myfont.SetFontSz(mFSz);
     282    g->SelFont(myfont);
     283  }
     284  else if ( (mFSz != PI_NotDefFontSize) || (mFAtt != PI_NotDefFontAtt)  )
    251285                                  g->SelFont(mFSz, mFAtt);
    252286  if ( (mMrk != PI_NotDefMarker) || (mMSz >= 0) )
     
    287321  mGrUC->SetUCS(xMin, xMax, yMin, yMax, aXFlg, aYFlg);
    288322  if (aXlog || aYlog) mGrUC->SetLogScale(aXlog, aYlog);
     323  if (mFgHighLight) mGrUC->SelGOMode(PI_GOInvert);
    289324  return(mGrUC);
    290325}
     
    647682void  PIElDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
    648683{
     684SelGraAtt(g);   // DrawAxes change certains attributs graphiques
    649685DrawAxes(g);   // Trace des axes
    650 
    651686SelGraAtt(g);   // DrawAxes change certains attributs graphiques
     687
    652688if (mFSz == PI_NotDefFontSize) g->SelFont(PI_NormalSizeFont);
    653689// Trace des titres
  • trunk/SophyaPI/PI/pidrawer.h

    r505 r1568  
    4545  virtual void       UpdateLimits();   // Calcule et change les limites 
    4646
     47  // Gestion d'affichage en mode HighLight : fgh=true -> highlight =false -> normal
     48  virtual void       HighLight(bool fgh); 
     49
    4750  inline double      XMin() const {return xMin;}
    4851  inline double      XMax() const {return xMax;}
     
    6770  virtual void       SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
    6871                                PIFontAtt fat=PI_NotDefFontAtt);
     72  virtual void       SetFont(PIFontName fn, PIFontSize fsz=PI_NotDefFontSize,
     73                             PIFontAtt fat=PI_NotDefFontAtt);
    6974  virtual void       SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
    70   virtual void       SetColMapId(CMapId cid=CMAP_OTHER);
     75  virtual void       SetColMapId(CMapId cid=CMAP_OTHER, bool rev=false);
    7176
    7277  void               SelGraAtt(PIGraphicUC* g);
     
    7883  inline PIFontSize  GetFontSz()    { return(mFSz);  }
    7984  inline PIFontAtt   GetFontAtt()   { return(mFAtt); }
     85  inline PIFontName  GetFontName()  { return(mFName);}
    8086  inline int         GetMarkerSz()  { return(mMSz);  }
    8187  inline PIMarker    GetMarker()    { return(mMrk);  }
    8288  inline CMapId      GetColMapId()  { return(mCmapid); }
     89  inline CMapId      GetColMapId(bool & rev)  { rev = mRevCmap; return(mCmapid); }
    8390
    8491
     
    127134  PIGraphicUC* mGrUC;
    128135
     136// Flag de control d'affichage en mode HighLight
     137  bool mFgHighLight;
     138
    129139  list<DrwBWId>  mBWdgList;
    130140  bool mDndfg;
     
    133143  PIColors           mFCol, mBCol;
    134144  PILineAtt          mLAtt;
     145  PIFontName         mFName;
    135146  PIFontSize         mFSz;
    136147  PIFontAtt          mFAtt;
     
    138149  PIMarker           mMrk; 
    139150  CMapId             mCmapid;
    140  
     151  bool               mRevCmap;
     152
    141153};
    142154
Note: See TracChangeset for help on using the changeset viewer.