Changeset 343 in Sophya
- Timestamp:
- Aug 2, 1999, 6:50:38 PM (26 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pidrawer.cc
r340 r343 131 131 // Cette méthode doit calculer les limites (X/Y Min-Max) préferées par l'objet 132 132 // 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". 133 136 //-- 134 137 … … 441 444 } 442 445 446 void 447 PIDrawer::AppendTextInfo(string& info, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/) 448 { 449 } 450 451 452 443 453 444 454 void -
trunk/SophyaPI/PI/pidrawer.h
r207 r343 9 9 #include "pigraphuc.h" 10 10 11 #include <list>12 #if defined(__KCC__)13 #include <list.h>14 #endif15 11 16 12 enum { … … 42 38 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 43 39 40 virtual void AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax); 41 44 42 virtual void Refresh(); // Recalcule les limites et reaffiche 45 43 virtual void UpdateLimits(); // Calcule et change les limites -
trunk/SophyaPI/PI/piimage.cc
r337 r343 305 305 GetScreenPos(tpx, tpy); 306 306 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); 308 313 cutwin->SetAutoDelChilds(true); 309 314 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); 311 316 cutscw->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 312 317 cutarrx = new PIImg1DArrAdapter(); -
trunk/SophyaPI/PI/piscdrawwdg.cc
r329 r343 17 17 // les coordonnées courantes (User-Coordinates) 18 18 // * Bouton-2 : Permet de définir un rectangle pour le zoom. 19 // * Bouton-3 : Permet de définir un rectangle pour le texte info. 19 20 // 20 21 // Gestion du clavier : … … 26 27 // * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller 27 28 // sur l'objet à la position courante. 29 // * <Alt>I : Affiche et met a jour la fenetre Texte-Info . 28 30 // * <Alt>Z : Supprime les textes et signes ajoutés au dessin. 29 31 //-- … … 67 69 mCPosX = mCPosY = 0; 68 70 mPPos[0] = mPPos[1] = 0.; 71 mPSz[0] = mPSz[1] = 0.; 69 72 70 73 mBDrw = new PIElDrawer; … … 76 79 // SetDefaultDrawRectangle(0.12, 0.08, 0.88, 0.92, true); 77 80 AddDrawer(mBDrw, true, false, false); 78 81 82 // Pour afficher les coordonnees courante (click-bouton-1) 79 83 mTrlb = mTxw = NULL; 80 84 mTrW = NULL; 81 85 SetTextWin(NULL); 82 86 87 // Affichage eventuelle d'infos-texte 88 mInfoW = NULL; 89 mInfoTxt = NULL; 90 83 91 ActivateKeyboard(); 84 92 ActivateButton(1); // Pour pouvoir activer la fenetre et coordonnees 85 93 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); // " " 88 98 89 99 } … … 93 103 delete mBDrw; 94 104 if (mTrW) delete mTrW; 105 if (mInfoW) delete mInfoW; 95 106 } 96 107 … … 108 119 PIDrwTools::ShowPIDrwTools(); // Fentre axes et options de trace 109 120 } 121 else if (key == 'I' || key == 'i') UpdateInfoWindow(); // Fenetre Text-Info 110 122 } 111 123 } … … 131 143 mPPos[0] = 0.5*(XMin()+XMax()); 132 144 mPPos[1] = 0.5*(YMin()+YMax()); 145 mPSz[0] = 0.05*(XMax()+XMin()); 146 mPSz[1] = 0.05*(YMax()+YMin()); 133 147 if (!tmp) { 134 148 xMinS = xmin; … … 205 219 PIDrwTools::ShowPIDrwTools(); // Fentre axes et options de trace 206 220 } 221 222 void 223 PIScDrawWdg::UpdateInfoWindow() 224 { 225 226 if (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 : 245 vector<BWDrwId>::iterator it; 246 char buff[128]; 247 sprintf(buff, "Info: NDrawer= %d - Pos=%g %g (Sz=%g,%g) \n", (int)mDrwList.size()-1, 248 mPPos[0], mPPos[1], mPSz[0], mPSz[1] ); 249 double xmin, ymin, xmax, ymax; 250 xmin = mPPos[0] - 0.5*mPSz[0]; 251 xmax = mPPos[0] + 0.5*mPSz[0]; 252 ymin = mPPos[1] - 0.5*mPSz[1]; 253 ymax = mPPos[1] + 0.5*mPSz[1]; 254 255 string info = buff; 256 int k=0; 257 for(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 265 mInfoW->Show(); 266 mInfoTxt->Manage(); 267 mInfoTxt->SetText(info); 268 } 269 270 // ............................. 271 // Bouton-1 : Position courante 207 272 208 273 void … … 296 361 } 297 362 298 // Gestion du zoom 363 // ............................. 364 // Bouton-2 Gestion du zoom 365 299 366 void 300 367 PIScDrawWdg::But2Press(int x, int y) … … 355 422 356 423 424 // ............................. 425 // Bouton-3 : Gestion de definition de la taille de rectangle Text-Info 426 427 void 428 PIScDrawWdg::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 444 void 445 PIScDrawWdg::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 470 void 471 PIScDrawWdg::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 // -------------------------------------------------------------------------- 357 483 // ---------------------------------------------------------- 358 484 // Classe de trace de points/fonctions Y=f(X) … … 360 486 // Trace Y=ax->Value() = f(X= ax->X()) si ay == NULL 361 487 // ---------------------------------------------------------- 488 // -------------------------------------------------------------------------- 362 489 363 490 /* --Methode-- */ -
trunk/SophyaPI/PI/piscdrawwdg.h
r329 r343 59 59 virtual void ActivateSpecializedControls(); // Pour activer des controles specifiques 60 60 61 virtual void UpdateInfoWindow(); // Affiche et met a jour la fenetre info texte 62 // concernant le petit pave autour de la pos. courante 63 61 64 void SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30); 62 65 … … 69 72 virtual void Ptr2Move(int x, int y); 70 73 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 71 78 virtual void Keyboard(int key, PIKeyModifier kmod); 72 79 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l); … … 75 82 double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom 76 83 double mPPos[2]; // Position courante (user coordinates) 84 double mPSz[2]; // Taille courant du pave info 77 85 int mCPosX, mCPosY; // Position click souris X,Y 78 86 bool mFgReticule; // Controle l'affiche d'une réticule (Bouton-1) … … 89 97 PILabel * mTrlb; 90 98 PIWindow * mTrW; 99 100 // Fenetre pour l'affichage des informations 101 PIWindow * mInfoW; 102 PIText * mInfoTxt; 103 91 104 92 105 private:
Note:
See TracChangeset
for help on using the changeset viewer.