Changeset 209 in Sophya


Ignore:
Timestamp:
Mar 3, 1999, 4:05:17 PM (27 years ago)
Author:
ercodmgr
Message:

Amelioration DrwTools et gestion actions clavier (Alt...) Reza 03/03/99

Location:
trunk/SophyaPI/PI
Files:
6 edited

Legend:

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

    r207 r209  
    500500{
    501501  PILineAtt savlineatt = g->GetLineAtt();
    502   g->SelLine(PI_ThinDashedLine);
     502//  g->SelLine(PI_ThinDashedLine);
     503  g->SelLine(PI_ThinDottedLine);
    503504
    504505  for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep)
  • trunk/SophyaPI/PI/pidrwtools.cc

    r207 r209  
    5454spy = bsy/4;
    5555
    56 int wszx = 5*spx+4.25*bsx;
    57 int wszy = (6+3*0.85)*(spy+bsy);
     56int wszx = 5*spx+3.5*bsx;
     57int wszy = (7+3*0.85)*(spy+bsy);
    5858SetSize(wszx, wszy);
    5959
     
    6262int csx = cpx;
    6363int csy = cpy;
    64 mLab[0] = new PILabel(this, "X Min Max", 1.5*bsx, bsy, cpx, cpy);
     64mLab[0] = new PILabel(this, "X Min Max", 1.25*bsx, bsy, cpx, cpy);
    6565cpy += spy+bsy;
    66 mLab[1] = new PILabel(this, "Y Min Max", 1.5*bsx, bsy, cpx, cpy);
     66mLab[1] = new PILabel(this, "Y Min Max", 1.25*bsx, bsy, cpx, cpy);
    6767mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    6868mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    6969
    7070cpy = spy*2;
    71 cpx += spx+1.5*bsx;
    72 mText[0] = new PIText(this, "x_min_max", 2.75*bsx, bsy, cpx, cpy);
     71cpx += spx+1.25*bsx;
     72mText[0] = new PIText(this, "x_min_max", 2.25*bsx, bsy, cpx, cpy);
    7373mText[0]->SetText("-1.0  1.0");
    7474cpy += spy+bsy;
    75 mText[1] = new PIText(this, "y_min_max", 2.75*bsx, bsy, cpx, cpy);
     75mText[1] = new PIText(this, "y_min_max", 2.25*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*1.25, bsy, cpx, cpy);
    83 cpx += spx+1.25*bsx;
    84 mCkb[1] = new PICheckBox(this,"Y-UpDn", 2000, bsx*1.25, bsy, cpx, cpy);
    85 cpx += spx+1.25*bsx;
    86 mCkb[2] = new PICheckBox(this,"Grid", 2000, bsx*1.25, bsy, cpx, cpy);
     82mCkb[0] = new PICheckBox(this,"X-RtoL", 2000, bsx, bsy, cpx, cpy);
     83cpx += spx+bsx;
     84mCkb[1] = new PICheckBox(this,"Y-UpDn", 2000, bsx, bsy, cpx, cpy);
     85cpx += spx+bsx;
     86mCkb[2] = new PICheckBox(this,"Grid", 2000, bsx, 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);
     
    9090
    9191cpy += spy+bsy;
    92 cpx = 2.5*spx;;
    93 mBut[0] = new PIButton(this, "Apply", 2600, bsx*1.25, bsy, cpx, cpy);
    94 cpx += bsx*1.50;
    95 mBut[1] = new PIButton(this, "Auto", 2700, bsx*1.25, bsy, cpx, cpy);
    96 cpx += bsx*1.50;
    97 mBut[2] = new PIButton(this, "Dismiss", 2500,  bsx*1.25, bsy, cpx, cpy);
     92cpx = spx+0.25*bsx;;
     93mBut[0] = new PIButton(this, "SetAxes", 2600, bsx*1.5, bsy, cpx, cpy);
     94cpx += bsx*1.5+3*spx;
     95mBut[1] = new PIButton(this, "AutoLimits", 2700, bsx*1.5, bsy, cpx, cpy);
    9896mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    9997mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    100 mBut[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    10198
    10299int offy = cpy+bsy+spy*2;
     
    110107bsy = 0.85*bsy;   spy = 0.85*spy;
    111108
    112 mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*2.0, bsy, cpx, cpy);
     109mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*1.75, bsy, cpx, cpy);
    113110mOpt[0]->AppendItem("Def.Col", 100);
    114111mOpt[0]->AppendItem("Black", 101);
     
    131128mOpt[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    132129
    133 cpx += spx+2.25*bsx;
    134 mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*2.0, bsy, cpx, cpy);
     130cpx += spx+1.75*bsx;
     131mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*1.75, bsy, cpx, cpy);
    135132mOpt[1]->AppendItem("No.CMap", 200);
    136133mOpt[1]->AppendItem("Grey32", 201);
     
    150147cpx = 2*spx;
    151148cpy += spy+bsy;
    152 mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*2.0, bsy, cpx, cpy);
     149mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*1.75, bsy, cpx, cpy);
    153150mOpt[2]->AppendItem("Def.Mrk", 300);
    154151mOpt[2]->AppendItem("Mrk Dot(.)", 301);
     
    166163mOpt[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    167164
    168 cpx += spx+2.25*bsx;
    169 mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*2.0, bsy, cpx, cpy);
     165cpx += spx+1.75*bsx;
     166mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*1.75, bsy, cpx, cpy);
    170167mOpt[3]->AppendItem("Mrk 1 pt", 401);
    171168mOpt[3]->AppendItem("Mrk 3 pt", 403);
     
    181178cpx = 2*spx;
    182179cpy += spy+bsy;
    183 mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*2.0, bsy, cpx, cpy);
     180mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*1.75, bsy, cpx, cpy);
    184181mOpt[4]->AppendItem("Def.Font", 500);
    185182mOpt[4]->AppendItem("Normal-Font", 511);
     
    198195mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    199196
    200 cpx += spx+2.25*bsx;
    201 mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*2.0, bsy, cpx, cpy);
     197cpx += spx+1.75*bsx;
     198mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*1.75, bsy, cpx, cpy);
    202199mOpt[5]->AppendItem("Def.Line", 600);
    203200mOpt[5]->AppendItem("Thin-Line", 601);
     
    213210mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    214211
    215 cpx = spx;
     212cpx = 2*spx;
    216213cpy += spy+bsyo;
    217214bsy = bsyo; spy = spyo;
     
    227224mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    228225
    229 cpx = wszx-2.5*bsx-3*spx;
    230 mButcf[0] = new PIButton(this, "GetAtt", 2800, bsx*0.80, bsy, cpx, cpy);
    231 cpx += 0.80*bsx+spx;
    232 mButcf[1] = new PIButton(this, "SetAtt", 2900, bsx*0.80, bsy, cpx, cpy);
    233 cpx += 0.80*bsx+spx;
    234 mButcf[2] = new PIButton(this, "Refresh", 3000, bsx*0.90, bsy, cpx, cpy);
     226cpx = wszx-1.7*bsx-3*spx;
     227mButcf[0] = new PIButton(this, "GetAtt", 2800, 0.85*bsx, bsy, cpx, cpy);
     228cpx += 0.85*bsx+spx;
     229mButcf[1] = new PIButton(this, "SetAtt", 2900, 0.85*bsx, bsy, cpx, cpy);
    235230mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    236231mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     232
     233cpx = spx+0.25*bsx;;
     234cpy += spy+bsy;
     235mButcf[2] = new PIButton(this, "Refresh", 3000, bsx*1.5, bsy, cpx, cpy);
    237236mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     237cpx += bsx*1.5+3*spx;
     238mButcf[3] = new PIButton(this, "Dismiss", 3777, bsx*1.5, bsy, cpx, cpy);
     239mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     240mButcf[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    238241
    239242cwdrwt = this;
     
    382385
    383386msg = UserMsg(msg);
    384 if (msg == 2500)  { Hide(); return; }
     387if (msg == 3777)  { Hide(); return; }
    385388
    386389if (mCurBW == NULL)   return;
  • trunk/SophyaPI/PI/pidrwtools.h

    r207 r209  
    3636// Pour changer les axes
    3737  PILabel* mLab[2];
    38   PIButton* mBut[3];
     38  PIButton* mBut[2];
    3939  PIText* mText[2];
    4040  PICheckBox* mCkb[3];
     
    4343  PILabel* mNlb;
    4444  PIButton* mButdr[2];
    45   PIButton* mButcf[3];
     45  PIButton* mButcf[4];
    4646  int mNDr;
    4747  int mtyp, msz;
  • trunk/SophyaPI/PI/piimage.cc

    r204 r209  
    1313#include "pidrwtools.h"
    1414#include PIAPP_H
     15
     16//++
     17// Class        PIImage
     18// Lib          PI
     19// include      piimage.h
     20//
     21//      Classe pour la l'affichage et la manipulation d'images.
     22//      Peut contrôler un PIPixmap pour l'affichage d'une zone
     23//      agrandie (zoom) et un PIPixmap pour l'affichage de toute
     24//      l'image (réduite).
     25//      Utilise les adaptateur de tableaux 2D manipuler le
     26//      contenu des images ("P2DArrayAdapter").
     27//
     28//      * Bouton-1 : Envoie le message "PIMsg_Active" et affiche
     29//      les coordonnées courantes et la valeur du pixel,
     30//      et positionne le pavé.
     31//      * Bouton-2 : Permet de définir une zone de l'image.
     32//      * Bouton-3 : Permet de déplacer l'image dans la fenêtre
     33//
     34//      Gestion du clavier :
     35//      * <Alt>O : Affichage de la fenêtre de contrôle des paramètres de visualisation.
     36//      * <Alt>G : Affichage de la fenêtre de changement des attributs graphiques
     37//      * <Alt>R : Rafraîchit l'affichage.
     38//      * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller
     39//      sur l'objet à la position courante.
     40//      * <Alt>C : *Copier*/Coller Permet de copier le contenu de la zone sélectionnée
     41//      de l'image sous forme texte.
     42//      * <Alt>Z : Supprime les textes et signes ajoutés au dessin.
     43//      * Touches Curseurs : déplace la pavé.
     44//--
     45//++
     46// Links        Parents
     47// PIPixmap
     48//--
     49
     50//++
     51// Titre        Constructeurs, méthodes
     52//--
     53//++
     54//  PIImage(PIContainerGen *par, char *nom=NULL, int sx=0, int sy=0, int px=0, int py=0)
     55//      Créateur
     56// 
     57//--
    1558
    1659// --------------------------------------------------------------------------------
     
    438481cur_piimage = this;
    439482if (kmod == PIKM_Alt) {
    440   if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
    441   if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
    442   if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options
    443 
     483  if      (key == 'R' || key == 'r') Apply(true);  // Pour tout rafraichir 
     484  else if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
     485  else if (key == 'Z' || key == 'z') { mdrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
     486  else if (key == 'O' || key == 'o') PIImgTools::ShowPIImgTools();   // Fentre LUT et options
     487  else if (key == 'G' || key == 'g') {   // Fentre attributs graphiques
     488    PIDrwTools::SetCurrentBaseWdg(this);
     489    PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
     490    }
    444491// ----  Le copier ----
    445   if ((key == 'C' || key == 'c') && img) {
     492  else if ((key == 'C' || key == 'c') && img) {
    446493    // On limite la taille a 48x48
    447494    int i1 = XPave(); 
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r204 r209  
    1515//      de *Drawer* avec la gestion de zoom (agrandissement).
    1616//      * Bouton-1 : Envoie le message "PIMsg_Active" et affiche
    17 //      les coordonnées courant (User-Coordinates)
     17//      les coordonnées courantes (User-Coordinates)
    1818//      * Bouton-2 : Permet de définir un rectangle pour le zoom.
    1919//
    2020//      Gestion du clavier :
    21 //      * <Alt>O : Affichage d'une fenêtre de changement des attributs graphiques
     21//      * <Alt>O : Active/Affiche les  contrôles de paramètres spécifiques
     22//      (Par défaut, action identique à <Alt>G)
     23//      * <Alt>G : Affichage de la fenêtre de changement des attributs graphiques
     24//      * <Alt>R : Rafraîchit l'affichage.
     25//      * <Alt>M : Active/Désactive l'affichage d'une réticule de mesure (Bouton-1)
    2226//      * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller
    23 //      sur l'objet à la position courante de la souris
     27//      sur l'objet à la position courante.
    2428//      * <Alt>Z : Supprime les textes et signes ajoutés au dessin.
    2529//--
     
    6064:PIBaseWdg(par, nom, sx, sy, px, py)
    6165{
     66  mFgReticule = false;
     67  mCPosX = mCPosY = 0;
     68  mPPos[0] = mPPos[1] = 0.;
     69
    6270  mBDrw = new PIElDrawer;
    6371  SetLimits(-1.,1.,-1.,1.,kAxeDirLtoR,kAxeDirDownUp);
     
    9199{
    92100if (kmod == PIKM_Alt) {
    93   if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
    94   if (key == 'Z' || key == 'z') { mBDrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
    95   if (key == 'O' || key == 'o') {
     101  if      (key == 'R' || key == 'r')  Refresh(); // rafraichir l'affichage
     102  else if (key == 'M' || key == 'm') mFgReticule = !mFgReticule; // reticule de mesure
     103  else if (key == 'V' || key == 'v') RequestSelection();  // Pour coller (copier/coller) 
     104  else if (key == 'Z' || key == 'z') { mBDrw->ElDelAll();  Refresh(); } // Pour supprimer tous les signes
     105  else if (key == 'O' || key == 'o') ActivateSpecializedControls();
     106  else if (key == 'G' || key == 'g') {
    96107    PIDrwTools::SetCurrentBaseWdg(this);
    97108    PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
     
    177188// Gestion affichage coordonnees du point
    178189
    179 string   PIScDrawWdg::GetClickText(double x, double y)
     190string   
     191PIScDrawWdg::GetClickText(double x, double y)
    180192// Donne le texte a afficher pour position x,y 
    181193{
     
    187199
    188200void
     201PIScDrawWdg::ActivateSpecializedControls()
     202// Par défaut affiche la fenetres des attributs graphiques et axes
     203{
     204  PIDrwTools::SetCurrentBaseWdg(this);
     205  PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
     206}
     207
     208void
    189209PIScDrawWdg::But1Press(int x, int y)
    190210{
    191   if (UpdateText(x, y))
    192      {
    193      if (mTrW)
    194        {
    195        int tpx, tpy;
    196        GetScreenPos(tpx, tpy);       
    197        tpy -= (mTrW->YSize()+5);
    198        if (tpy < 0)  tpy = 0;
    199        mTrW->SetPos(tpx, tpy);
    200        mTrW->Show();
    201        }
    202      SelPointerShape(PI_CrossPointer);
    203      }
     211  UpdateText(x, y);
     212  if (mTrW)
     213    {
     214    int tpx, tpy;
     215    GetScreenPos(tpx, tpy);       
     216    tpy -= (mTrW->YSize()+5);
     217    if (tpy < 0)  tpy = 0;
     218    mTrW->SetPos(tpx, tpy);
     219    mTrW->Show();
     220    }
     221  if (mFgReticule) { // On trace une reticule
     222    cForCol = mWGrC->GetForeground();
     223    cGOmod  = mWGrC->GetGOMode();
     224    cLatt = mWGrC->GetLineAtt();
     225    mWGrC->SelForeground(PI_Magenta);
     226    mWGrC->SelGOMode(PI_GOXOR);
     227    mWGrC->SelLine(PI_ThinLine);
     228    mWGrC->DrawLine(x, 0, x, YSize());
     229    mWGrC->DrawLine(0, y, XSize(), y);
     230    mCPosX = x;   mCPosY = y;
     231    }
     232  else SelPointerShape(PI_CrossPointer);
     233
    204234  Send(Msg(), PIMsg_Active);
    205235  PIDrwTools::SetCurrentBaseWdg(this);
     
    209239PIScDrawWdg::Ptr1Move(int x, int y)
    210240{
     241  if (mFgReticule) { // On trace une reticule
     242    mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());
     243    mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);
     244    mWGrC->DrawLine(x, 0, x, YSize());
     245    mWGrC->DrawLine(0, y, XSize(), y);
     246    mCPosX = x;   mCPosY = y;
     247    } 
    211248  UpdateText(x, y);
    212249}
     
    215252PIScDrawWdg::But1Release(int x, int y)
    216253{
    217   if (UpdateText(x, y))
    218     SelPointerShape(PI_ArrowPointer);
     254  UpdateText(x, y);
     255  if (mFgReticule) { // On efface la reticule
     256    mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());
     257    mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);
     258    mWGrC->SelForeground(cForCol);
     259    mWGrC->SelGOMode(cGOmod);
     260    mWGrC->SelLine(cLatt);
     261    mCPosX = mCPosY = 0;
     262    }
     263  else SelPointerShape(PI_ArrowPointer);
    219264  if (mTrW)  mTrW->Hide();
    220265}
    221266
    222 bool
     267void
    223268PIScDrawWdg::UpdateText(int xp, int yp)
    224269{
     
    227272  mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy);
    228273  mPPos[0] = dx;  mPPos[1] = dy;
    229   if ((mTxw == NULL) && (mTrlb == NULL)) return(false);
    230274 
    231275  string ctxt =  GetClickText(dx, dy);
     
    235279  if (mTrlb)
    236280    mTrlb->SetLabel(ctxt);
    237   return(true);
     281  return;
    238282
    239283}
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r207 r209  
    5757
    5858  virtual string     GetClickText(double x, double y); // Donne le texte a afficher pour position x,y
     59  virtual void       ActivateSpecializedControls();   // Pour activer des controles specifiques
    5960
    6061  void               SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30);
     
    7374protected:
    7475  double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
    75   double mPPos[2];               // Position click souris X,Y
     76  double mPPos[2];               // Position courante (user coordinates)
     77  int mCPosX, mCPosY;              // Position click souris X,Y
     78  bool mFgReticule;                // Controle l'affiche d'une réticule (Bouton-1)
    7679
    7780  PIElDrawer* mBDrw;
     
    8891
    8992private:
    90   bool  UpdateText(int xp, int yp);
     93  void  UpdateText(int xp, int yp);
    9194};
    9295
Note: See TracChangeset for help on using the changeset viewer.