Changeset 343 in Sophya


Ignore:
Timestamp:
Aug 2, 1999, 6:50:38 PM (26 years ago)
Author:
ercodmgr
Message:

Support pour l'affichage de l'info Texte a partir des Drawers dans un

PIScDrawWdg sur un rectangle selectionne par bouton-3 Reza 2/08/99

Location:
trunk/SophyaPI/PI
Files:
5 edited

Legend:

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

    r340 r343  
    131131//      Cette méthode doit calculer les limites (X/Y Min-Max) préferées par l'objet
    132132//      et doit appeler "SetLimits()". L'implementation par défaut ne fait rien.
     133//  void  AppenTextInfo(string& info, double xmin, double ymin, double xmax, double ymax)
     134//      Méthode qui met à jour la chaîne "info", avec les informations (textuelles) de
     135//      la zone définie par "xmin-xmax" , "ymin-ymax".
    133136//--
    134137
     
    441444}
    442445
     446void
     447PIDrawer::AppendTextInfo(string& info, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
     448{
     449}
     450
     451
     452
    443453
    444454void
  • trunk/SophyaPI/PI/pidrawer.h

    r207 r343  
    99#include "pigraphuc.h"
    1010
    11 #include <list>
    12 #if defined(__KCC__)
    13 #include <list.h>
    14 #endif
    1511
    1612enum {
     
    4238  virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    4339   
     40  virtual void       AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax);
     41
    4442  virtual void       Refresh();      // Recalcule les limites et reaffiche
    4543  virtual void       UpdateLimits();   // Calcule et change les limites 
  • trunk/SophyaPI/PI/piimage.cc

    r337 r343  
    305305  GetScreenPos(tpx, tpy);
    306306  string nom = Nom() + "-Cuts";
    307   cutwin = new PIWindow(this, const_cast<char *>(nom.c_str()), PIWK_normal,  300, 200, tpx, tpy+YSize()+10);
     307  int sx, sy;
     308  int ssx, ssy;
     309  PIApplicationScreenSize(ssx, ssy);
     310  if ( (ssx > 1000) && (ssy > 1000) ) { sx = 400;  sy = 250; }
     311  else { sx = 300; sy = 200; }
     312  cutwin = new PIWindow(this, nom.c_str(), PIWK_normal, sx, sy, tpx, tpy+YSize()+10);
    308313  cutwin->SetAutoDelChilds(true);
    309314  nom += "_ScWdg";
    310   cutscw = new PIScDrawWdg(cutwin, const_cast<char *>(nom.c_str()), 300, 200, 0, 0);
     315  cutscw = new PIScDrawWdg(cutwin, nom.c_str(), sx, sy, 0, 0);
    311316  cutscw->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
    312317  cutarrx = new PIImg1DArrAdapter();
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r329 r343  
    1717//      les coordonnées courantes (User-Coordinates)
    1818//      * Bouton-2 : Permet de définir un rectangle pour le zoom.
     19//      * Bouton-3 : Permet de définir un rectangle pour le texte info.
    1920//
    2021//      Gestion du clavier :
     
    2627//      * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller
    2728//      sur l'objet à la position courante.
     29//      * <Alt>I : Affiche et met a jour la fenetre Texte-Info .
    2830//      * <Alt>Z : Supprime les textes et signes ajoutés au dessin.
    2931//--
     
    6769  mCPosX = mCPosY = 0;
    6870  mPPos[0] = mPPos[1] = 0.;
     71  mPSz[0] = mPSz[1] = 0.;
    6972
    7073  mBDrw = new PIElDrawer;
     
    7679//  SetDefaultDrawRectangle(0.12, 0.08, 0.88, 0.92, true);
    7780  AddDrawer(mBDrw, true, false, false);
    78  
     81
     82//  Pour afficher les coordonnees courante (click-bouton-1) 
    7983  mTrlb = mTxw = NULL;
    8084  mTrW = NULL;
    8185  SetTextWin(NULL);
    8286
     87//  Affichage eventuelle d'infos-texte
     88  mInfoW = NULL;
     89  mInfoTxt = NULL;
     90
    8391  ActivateKeyboard();
    8492  ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
    8593  ActivateMove(1);      //    "         "         "        "
    86   ActivateButton(2);
    87   ActivateMove(2);
     94  ActivateButton(2);    //  Pour gerer le zoom
     95  ActivateMove(2);      //    "         "
     96  ActivateButton(3);    //  Pour definir la zone info-texte
     97  ActivateMove(3);      //    "         "
    8898
    8999}
     
    93103  delete mBDrw;
    94104  if (mTrW)  delete mTrW;
     105  if (mInfoW) delete mInfoW;
    95106}
    96107
     
    108119    PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
    109120    }
     121  else if (key == 'I' || key == 'i') UpdateInfoWindow();  // Fenetre Text-Info
    110122  }
    111123}
     
    131143  mPPos[0] = 0.5*(XMin()+XMax());
    132144  mPPos[1] = 0.5*(YMin()+YMax());
     145  mPSz[0] = 0.05*(XMax()+XMin());
     146  mPSz[1] = 0.05*(YMax()+YMin());
    133147  if (!tmp) {
    134148    xMinS = xmin;
     
    205219  PIDrwTools::ShowPIDrwTools();   // Fentre axes et options de trace
    206220}
     221
     222void
     223PIScDrawWdg::UpdateInfoWindow()
     224{
     225
     226if (mInfoW == NULL) { // Creation de la fenetre info
     227  string nom = Nom() + "-Info";
     228  int tpx, tpy;
     229  GetScreenPos(tpx, tpy);
     230  int sx, sy;
     231  int ssx, ssy;
     232  PIApplicationScreenSize(ssx, ssy);
     233  if ( (ssx > 1000) && (ssy > 1000) ) { sx = 400;  sy = 200; }
     234  else { sx = 300; sy = 160; }
     235  mInfoW = new PIWindow(this, nom.c_str(), PIWK_normal,  sx, sy, tpx, tpy+YSize()+10);
     236  mInfoW->SetAutoDelChilds(true);
     237  nom = Nom() + "-InfoText";
     238  mInfoTxt = new PIText(mInfoW, nom.c_str(), true, true, sx, sy, 0, 0);
     239  mInfoTxt->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
     240  mInfoTxt->SetMutiLineMode(true);
     241  mInfoTxt->SetTextEditable(false);
     242  }
     243
     244//  Boucle sur tous les drawers :
     245vector<BWDrwId>::iterator it;
     246char buff[128];
     247sprintf(buff, "Info: NDrawer= %d - Pos=%g %g  (Sz=%g,%g) \n", (int)mDrwList.size()-1,
     248        mPPos[0], mPPos[1], mPSz[0], mPSz[1] );
     249double xmin, ymin, xmax, ymax;
     250xmin = mPPos[0] - 0.5*mPSz[0];
     251xmax = mPPos[0] + 0.5*mPSz[0];
     252ymin = mPPos[1] - 0.5*mPSz[1];
     253ymax = mPPos[1] + 0.5*mPSz[1];
     254
     255string info = buff;
     256int k=0;
     257for(it = mDrwList.begin(); it != mDrwList.end(); it++) {
     258  if ((*it).drw == mBDrw )  continue;
     259  k++;
     260  sprintf(buff," --------- Drawer %d ----------- \n", k);
     261  info += buff;
     262  (*it).drw->AppendTextInfo(info, xmin, ymin, xmax, ymax);
     263  }
     264
     265mInfoW->Show();
     266mInfoTxt->Manage();
     267mInfoTxt->SetText(info);
     268}
     269
     270// .............................
     271// Bouton-1 : Position courante
    207272
    208273void
     
    296361}
    297362
    298 // Gestion du zoom
     363// .............................
     364// Bouton-2 Gestion du zoom
     365
    299366void
    300367PIScDrawWdg::But2Press(int x, int y)
     
    355422
    356423
     424// .............................
     425// Bouton-3 : Gestion de definition de la taille de rectangle Text-Info
     426
     427void
     428PIScDrawWdg::But3Press(int x, int y)
     429{
     430  xEndDrag = xBegDrag = x;
     431  yEndDrag = yBegDrag = y;
     432  cForCol = mWGrC->GetForeground();
     433  cGOmod  = mWGrC->GetGOMode();
     434  cPointer = GetPointerShape();
     435  cLatt = mWGrC->GetLineAtt();
     436  SelPointerShape(PI_CrossPointer);
     437  mWGrC->SelForeground(PI_Magenta);
     438  mWGrC->SelGOMode(PI_GOXOR);
     439  mWGrC->SelLine(PI_ThinLine);
     440  Send(Msg(), PIMsg_Active);
     441  PIDrwTools::SetCurrentBaseWdg(this);
     442}
     443
     444void
     445PIScDrawWdg::But3Release(int /*x*/, int /*y*/)
     446{
     447
     448  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     449
     450  mWGrC->SelForeground(cForCol);
     451  mWGrC->SelGOMode(cGOmod);
     452  SelPointerShape(cPointer);
     453  mWGrC->SelLine(cLatt);
     454
     455  double xl,yl,xh,yh;
     456  mBDrw->GetGraphicUC()->GrC2UC(xBegDrag, yBegDrag, xl, yl);
     457  mBDrw->GetGraphicUC()->GrC2UC(xEndDrag, yEndDrag, xh, yh);
     458  if (xl > xh) dbl_swap(xl, xh);
     459  if (yl > yh) dbl_swap(yl, yh);
     460  mPPos[0] = 0.5*(xl+xh);
     461  mPPos[1] = 0.5*(yl+yh);
     462  mPSz[0] = xh-xl;
     463  mPSz[1] = yh-yl;
     464  mCPosX =  0.5*(xBegDrag+xEndDrag);
     465  mCPosY =  0.5*(yBegDrag+yEndDrag);
     466
     467  return;
     468}
     469
     470void
     471PIScDrawWdg::Ptr3Move(int x, int y)
     472{
     473  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     474  xEndDrag = x;
     475  yEndDrag = y;
     476  mWGrC->DrawBox(xBegDrag, yBegDrag, xEndDrag-xBegDrag, yEndDrag-yBegDrag);
     477}
     478
     479
     480// --------------------------------------------------------------------------
     481// --------------------------------------------------------------------------
     482// --------------------------------------------------------------------------
    357483// ----------------------------------------------------------
    358484//  Classe de trace de points/fonctions Y=f(X)
     
    360486//  Trace Y=ax->Value() = f(X= ax->X())  si ay == NULL
    361487// ----------------------------------------------------------
     488// --------------------------------------------------------------------------
    362489
    363490/* --Methode-- */
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r329 r343  
    5959  virtual void       ActivateSpecializedControls();   // Pour activer des controles specifiques
    6060
     61  virtual void       UpdateInfoWindow();    // Affiche et met a jour la fenetre info texte
     62                                            // concernant le petit pave autour de la pos. courante
     63
    6164  void               SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30);
    6265
     
    6972  virtual void       Ptr2Move(int x, int y);
    7073 
     74  virtual void       But3Press(int x, int y);
     75  virtual void       But3Release(int x, int y);
     76  virtual void       Ptr3Move(int x, int y);
     77
    7178  virtual void       Keyboard(int key, PIKeyModifier kmod);
    7279  virtual void       PasteSelection(unsigned int typ, void *pdata, unsigned int l);
     
    7582  double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
    7683  double mPPos[2];               // Position courante (user coordinates)
     84  double mPSz[2];                // Taille courant du pave info
    7785  int mCPosX, mCPosY;              // Position click souris X,Y
    7886  bool mFgReticule;                // Controle l'affiche d'une réticule (Bouton-1)
     
    8997  PILabel * mTrlb;
    9098  PIWindow * mTrW;
     99
     100// Fenetre pour l'affichage des informations
     101  PIWindow * mInfoW;
     102  PIText * mInfoTxt;
     103
    91104
    92105private:
Note: See TracChangeset for help on using the changeset viewer.