Changeset 207 in Sophya
- Timestamp:
- Mar 2, 1999, 5:59:00 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pidrawer.cc
r204 r207 59 59 60 60 //++ 61 // Titre Les axes 62 //-- 63 //++ 61 64 // void SetLimits(double xmin, double xmax, double ymin, double ymax, - 62 65 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 63 66 // 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 64 76 // void SetAxesFlags(unsigned int flags=kAxesNone) 65 77 // Attributs de tracé d'axes 66 78 //| 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 68 83 // void DrawAxes(PIGraphicUC* g) 69 84 // Méthode de tracé des axes … … 95 110 yMax = ymax; 96 111 aXFlg = axrl; aYFlg = ayud; 97 CalcTicks();98 112 limitsFixed = 1; 113 } 114 115 void 116 PIDrawer::GetAxesConfig(int& xa, int& ya) 117 { 118 xa = (aXdir) ? kAxeDirRtoL : kAxeDirLtoR; 119 ya = (aYdir) ? kAxeDirUpDown : kAxeDirDownUp; 99 120 } 100 121 … … 144 165 // Modifie les attributs graphiques de "g" à partir des attributs courant 145 166 // 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 146 184 //-- 147 185 … … 283 321 if (mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 284 322 else g->SelLine(mLAtt); 323 // On calcule les ticks 324 CalcTicks(); 325 285 326 unsigned int flags = axesFlags; 286 327 -
trunk/SophyaPI/PI/pidrawer.h
r204 r207 45 45 virtual void UpdateLimits(); // Calcule et change les limites 46 46 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); 51 53 inline unsigned int GetAxesFlags() { return(axesFlags); } 52 54 53 55 inline PIGraphicUC* GetGraphicUC() { return(mGrUC); } 54 56 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, 59 62 PIColors bg=PI_NotDefColor); 60 v oidSetLineAtt(PILineAtt lat=PI_NotDefLineAtt);61 v oidSetFontAtt(PIFontSize fsz=PI_NotDefFontSize,63 virtual void SetLineAtt(PILineAtt lat=PI_NotDefLineAtt); 64 virtual void SetFontAtt(PIFontSize fsz=PI_NotDefFontSize, 62 65 PIFontAtt fat=PI_NotDefFontAtt); 63 v oidSetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);64 v oidSetColMapId(CMapId cid=CMAP_OTHER);66 virtual void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker); 67 virtual void SetColMapId(CMapId cid=CMAP_OTHER); 65 68 66 69 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 67 81 68 82 // --- Methode static ---- -
trunk/SophyaPI/PI/pidrwtools.cc
r204 r207 54 54 spy = bsy/4; 55 55 56 int wszx = 5*spx+ 3.5*bsx;56 int wszx = 5*spx+4.25*bsx; 57 57 int wszy = (6+3*0.85)*(spy+bsy); 58 58 SetSize(wszx, wszy); … … 70 70 cpy = spy*2; 71 71 cpx += spx+1.5*bsx; 72 mText[0] = new PIText(this, "x_min_max", 2. 0*bsx, bsy, cpx, cpy);72 mText[0] = new PIText(this, "x_min_max", 2.75*bsx, bsy, cpx, cpy); 73 73 mText[0]->SetText("-1.0 1.0"); 74 74 cpy += spy+bsy; 75 mText[1] = new PIText(this, "y_min_max", 2. 0*bsx, bsy, cpx, cpy);75 mText[1] = new PIText(this, "y_min_max", 2.75*bsx, bsy, cpx, cpy); 76 76 mText[1]->SetText("-1.0 1.0"); 77 77 mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); … … 80 80 cpx = spx+0.25*bsx; 81 81 cpy += 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);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); 87 87 mCkb[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 88 88 mCkb[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); … … 91 91 cpy += spy+bsy; 92 92 cpx = 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);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); 98 98 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 99 99 mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); … … 110 110 bsy = 0.85*bsy; spy = 0.85*spy; 111 111 112 mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx* 1.75, bsy, cpx, cpy);112 mOpt[0] = new PIOptMenu(this, "bwt-opt-0", bsx*2.0, bsy, cpx, cpy); 113 113 mOpt[0]->AppendItem("Def.Col", 100); 114 114 mOpt[0]->AppendItem("Black", 101); … … 131 131 mOpt[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 132 132 133 cpx += spx+ 1.75*bsx;134 mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx* 1.75, bsy, cpx, cpy);133 cpx += spx+2.25*bsx; 134 mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*2.0, bsy, cpx, cpy); 135 135 mOpt[1]->AppendItem("No.CMap", 200); 136 136 mOpt[1]->AppendItem("Grey32", 201); … … 150 150 cpx = 2*spx; 151 151 cpy += spy+bsy; 152 mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx* 1.75, bsy, cpx, cpy);152 mOpt[2] = new PIOptMenu(this, "bwt-opt-2", bsx*2.0, bsy, cpx, cpy); 153 153 mOpt[2]->AppendItem("Def.Mrk", 300); 154 154 mOpt[2]->AppendItem("Mrk Dot(.)", 301); … … 166 166 mOpt[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 167 167 168 cpx += spx+ 1.75*bsx;169 mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx* 1.75, bsy, cpx, cpy);168 cpx += spx+2.25*bsx; 169 mOpt[3] = new PIOptMenu(this, "bwt-opt-3", bsx*2.0, bsy, cpx, cpy); 170 170 mOpt[3]->AppendItem("Mrk 1 pt", 401); 171 171 mOpt[3]->AppendItem("Mrk 3 pt", 403); … … 181 181 cpx = 2*spx; 182 182 cpy += spy+bsy; 183 mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx* 1.75, bsy, cpx, cpy);183 mOpt[4] = new PIOptMenu(this, "bwt-opt-4", bsx*2.0, bsy, cpx, cpy); 184 184 mOpt[4]->AppendItem("Def.Font", 500); 185 185 mOpt[4]->AppendItem("Normal-Font", 511); … … 198 198 mOpt[4]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 199 199 200 cpx += spx+ 1.75*bsx;201 mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx* 1.75, bsy, cpx, cpy);200 cpx += spx+2.25*bsx; 201 mOpt[5] = new PIOptMenu(this, "bwt-opt-5", bsx*2.0, bsy, cpx, cpy); 202 202 mOpt[5]->AppendItem("Def.Line", 600); 203 203 mOpt[5]->AppendItem("Thin-Line", 601); … … 213 213 mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 214 214 215 cpx = 2*spx;215 cpx = spx; 216 216 cpy += spy+bsyo; 217 217 bsy = bsyo; spy = spyo; … … 227 227 mNlb->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 228 228 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); 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); 233 235 mButcf[0]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 234 236 mButcf[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 237 mButcf[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 235 238 236 239 cwdrwt = this; … … 248 251 delete mBut[i]; 249 252 delete mText[i]; 250 delete mButdr[i];251 253 delete mButcf[i]; 252 254 } 253 for(i=0; i<3; i++) delete mCkb[i]; 255 256 for(i=0; i<3; i++) { delete mCkb[i]; delete mButcf[i]; } 254 257 delete mBut[2]; 255 258 for(i=0; i<6; i++) delete mOpt[i]; … … 289 292 char buff[92]; 290 293 mNDr = 0; 294 291 295 if (mCurBW != NULL) { 292 296 mNDr = mCurBW->NbDrawers()-1; 293 297 if (mNDr < 0) mNDr = 0; 294 298 } 299 300 UpdateAttFromDrawer(); 301 302 mCkb[0]->SetState(false); 303 mCkb[1]->SetState(false); 304 mCkb[2]->SetState(false); 305 295 306 if ((mCurBW != NULL) && ( mCurBW->kind() == PIScDrawWdg::ClassId ) ) { 296 307 PIScDrawWdg* scd = ( PIScDrawWdg*)mCurBW; … … 299 310 sprintf(buff, "%g %g", scd->YMin(), scd->YMax()); 300 311 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); 301 317 } 302 318 else { … … 307 323 mNlb->SetLabel(buff); 308 324 309 mCkb[0]->SetState(false); 310 mCkb[1]->SetState(false); 311 mCkb[2]->SetState(false); 325 326 327 return; 328 } 329 330 /* --Methode-- */ 331 void PIDrwTools::UpdateAttFromDrawer() 332 { 333 334 PIDrawer* dr = NULL; 312 335 313 336 mOpt[0]->SetValue(100); … … 318 341 mOpt[5]->SetValue(600); 319 342 343 if ( (mCurBW != NULL) && (mCurBW->NbDrawers() > 0) ) 344 dr = mCurBW->GetDrawer(mNDr); 345 346 if (!dr) return; 347 int jj,kk; 348 PIColors fc = dr->GetFgColAtt(); 349 for(kk=0; kk<17; kk++) 350 if (fc == cols[kk]) { mOpt[0]->SetValue(100+kk); break; } 351 CMapId cmi = dr->GetColMapId(); 352 for(kk=0; kk<11; kk++) 353 if (cmi == cmap[kk]) { mOpt[1]->SetValue(200+kk); break; } 354 PIMarker mk = dr->GetMarker(); 355 for(kk=0; kk<12; kk++) 356 if (mk == mrk[kk]) { mOpt[2]->SetValue(300+kk); break; } 357 kk = dr->GetMarkerSz(); 358 if (kk < 1) kk = 1; 359 if (kk > 15) kk = 15; 360 if (kk%2 == 0) kk++; 361 mOpt[3]->SetValue(400+kk); 362 PIFontAtt fat = dr->GetFontAtt(); 363 PIFontSize fsz = dr->GetFontSz(); 364 for(kk=0; kk<4; kk++) 365 if (fat == fntatt[kk]) break; 366 for(jj=0; jj<5; jj++) 367 if (fsz == fntsz[jj]) break; 368 369 if (kk >= 4) kk = 3; 370 if (jj >= 5) jj = 4; 371 mOpt[4]->SetValue(500+jj*10+kk); 372 PILineAtt lat = dr->GetLineAtt(); 373 for(kk=0; kk<10; kk++) 374 if (lat == line[kk]) { mOpt[5]->SetValue(600+kk); break; } 375 320 376 return; 321 377 } 322 323 378 324 379 /* --Methode-- */ … … 360 415 361 416 case 2800 : 417 UpdateAttFromDrawer(); 418 break; 419 362 420 case 2900 : 421 case 3000 : 363 422 { 364 423 PIDrawer* drw = mCurBW->GetDrawer(mNDr); … … 381 440 if ( (k < 0) || (k > 9) ) k = 0; 382 441 drw->SetLineAtt(line[k]); 383 if (msg == 2 800) drw->Refresh();442 if (msg == 2900) drw->Refresh(); 384 443 else mCurBW->Refresh(); 385 444 } -
trunk/SophyaPI/PI/pidrwtools.h
r202 r207 30 30 31 31 protected: 32 virtual void UpdateAttFromDrawer(); 32 33 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 33 34 … … 42 43 PILabel* mNlb; 43 44 PIButton* mButdr[2]; 44 PIButton* mButcf[ 2];45 PIButton* mButcf[3]; 45 46 int mNDr; 46 47 int mtyp, msz; -
trunk/SophyaPI/PI/piscdrawwdg.h
r204 r207 32 32 inline void SetAxesFlags(unsigned int flags=kBoxAxes | kExtTicks | kLabels) 33 33 { mBDrw->SetAxesFlags(flags); } 34 inline unsigned int GetAxesFlags() { return(mBDrw->GetAxesFlags()); }35 36 34 inline void SetTitles(const char* tt=NULL, const char* tb=NULL) 37 35 { mBDrw->SetTitles(tt, tb); } … … 42 40 inline PIElDrawer* BaseDrawer() { return mBDrw; }; 43 41 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 50 54 int LimitsFixed() const {return mBDrw->LimitsFixed();} 51 55 void FreeLimits() { mBDrw->FreeLimits(); }
Note:
See TracChangeset
for help on using the changeset viewer.