Changeset 2387 in Sophya
- Timestamp:
- May 20, 2003, 5:21:51 PM (22 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pidrawer.cc
r2349 r2387 101 101 if (mGrUC) delete mGrUC; 102 102 if (ckdeact) PIDrwTools::UpdateActiveDrawer(); 103 // On supprime la fenetre PIDrwOptionStringWindow le cas echeant 104 PIDrwOptionStringWindow::RemoveDrwOptionStringWindow(this); 103 105 } 104 106 -
trunk/SophyaPI/PI/pidrwtools.cc
r2378 r2387 7 7 #include "pidrwtools.h" 8 8 #include <iostream> 9 #include <list> 10 #include <typeinfo> 9 11 #include "piscdrawwdg.h" 10 12 #include "pi3dwdg.h" … … 119 121 120 122 int wszx = 5*spx+3.5*bsx; 121 int wszy = ( 2+6*0.85)*bsy+(7+6*0.85)*spy;123 int wszy = (3+6*0.85)*bsy+(8+6*0.85)*spy; 122 124 SetSize(wszx, wszy); 123 125 … … 331 333 cpy += bsy+spy; 332 334 cpx = 2*spx; 333 int butszx = 0.7*bsx; 335 int butszx = bsx; 336 int busp = (wszx-4*spx-3*butszx)/2; 334 337 mButcf[0] = new PIButton(this, "GetAtt", 2500, butszx, bsy, cpx, cpy); 335 cpx += butszx+ spx;338 cpx += butszx+busp; 336 339 mButcf[1] = new PIButton(this, "SetAtt", 2600, butszx, bsy, cpx, cpy); 337 cpx += butszx+ spx;340 cpx += butszx+busp; 338 341 mButcf[2] = new PIButton(this, "Select", 2700, butszx, bsy, cpx, cpy); 339 342 mButcf[2]->ActivatePress(true); 340 cpx += butszx+spx; 341 butszx = wszx-cpx-2*spx; 343 344 butszx = 1.2*bsx; 345 cpx = (wszx-2*butszx-4*spx)/2; 346 cpy += bsy+spy; 347 mButcf[4] = new PIButton(this, "OptionString", 2900, butszx, bsy, cpx, cpy); 348 cpx += butszx+4*spx; 342 349 mButcf[3] = new PIButton(this, "ShowControl", 2800, butszx, bsy, cpx, cpy); 343 350 344 butszx = 1. 4*bsx;351 butszx = 1.6*bsx; 345 352 cpx = (wszx-2*butszx-4*spx)/2; 346 353 cpy += 2*spy+bsy; 347 mButcf[4] = new PIButton(this, "Refresh", 3000, bsx*1.2, bsyo, cpx, cpy); 348 cpx += butszx+2*spx; 349 mButcf[5] = new PIButton(this, "Dismiss", 3777, butszx, bsyo, cpx, cpy); 350 354 mButcf[5] = new PIButton(this, "Refresh", 3000, butszx, bsyo, cpx, cpy); 355 cpx += butszx+4*spx; 356 mButcf[6] = new PIButton(this, "Dismiss", 3777, butszx, bsyo, cpx, cpy); 357 358 for(kb=0; kb<7; kb++) 359 mButcf[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 351 360 for(kb=0; kb<6; kb++) 352 mButcf[kb]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);353 for(kb=0; kb<5; kb++)354 361 mButcf[kb]->SetUnSensitive(); 355 362 … … 364 371 if (cwdrwt == this) cwdrwt = NULL; 365 372 int i; 366 for(i=0; i< 6; i++) delete mButcf[i];373 for(i=0; i<7; i++) delete mButcf[i]; 367 374 for(i=0; i<2; i++) delete mButdr[i]; 368 375 for(i=0; i<10 ; i++) delete mOpt[i]; … … 461 468 if (butsensnew < 2) { 462 469 for(kb=0; kb<2;kb++) mButdr[kb]->SetUnSensitive(); 463 for(kb=0; kb< 4;kb++) mButcf[kb]->SetUnSensitive();464 if (butsensnew == 0) mButcf[ 4]->SetUnSensitive();465 else mButcf[ 4]->SetSensitive();470 for(kb=0; kb<5;kb++) mButcf[kb]->SetUnSensitive(); 471 if (butsensnew == 0) mButcf[5]->SetUnSensitive(); 472 else mButcf[5]->SetSensitive(); 466 473 } 467 474 else { … … 469 476 for(kb=0; kb<3;kb++) mButcf[kb]->SetSensitive(); 470 477 mButcf[4]->SetSensitive(); 478 mButcf[5]->SetSensitive(); 471 479 } 472 480 } … … 479 487 480 488 PIDrawer* dr = NULL; 489 481 490 482 491 mOpt[0]->SetValue(100); … … 493 502 494 503 if (!dr) return; 504 495 505 int ii,jj,kk; 496 506 PIGraphicAtt const & gratt = dr->GetGraphicAtt(); … … 628 638 break; 629 639 640 case 2900 : 641 if ((mCurBW != NULL) && (mCurBW->GetDrawer(mNDr) != NULL) ) 642 PIDrwOptionStringWindow::ShowDrwOptionStringWindow(mCurBW->GetDrawer(mNDr)); 643 630 644 case 3000 : 631 645 SetGraphicAtt(true); … … 654 668 655 669 656 670 //--------------------------------------------------------------- 671 //---------------- Classe PIDrwOptionStringWindow --------------- 672 //--------------------------------------------------------------- 673 674 //++ 675 // Class PIDrwOptionStringWindow 676 // Lib PI 677 // include pidrwtools.h 678 // 679 // Classe de fenêtre de dialogue permettant de modifier interactivement 680 // Les attributs graphique des "Drawer" par l'appel à *DecodeOptionString()*. 681 //-- 682 // Links Parents 683 // PIWindow 684 //-- 685 //++ 686 // Links Voir aussi 687 // PIDrawer 688 // PIDrwTools 689 //-- 690 691 //++ 692 // Titre Méthodes statiques 693 //-- 694 //++ 695 // void ShowDrwOptionStringWindow(PIDrawer* drw) 696 // Méthode statique permettant l'affichage de la fenêtre de changement des 697 // attributs graphiques à travers *PIDrawer::DecodeOptionString()* 698 // pour le drawer "drw". 699 // void RemoveDrwOptionStringWindow( 700 // Suppression de la fenêtre associé à "drw" (appelée par le destructeur 701 // des PIDrawer) 702 //-- 703 704 static list<PIDrwOptionStringWindow* > drwoswlist; 705 706 /* --Methode-- */ 707 void PIDrwOptionStringWindow::ShowDrwOptionStringWindow(PIDrawer* drw) 708 { 709 if (drw == NULL) return; 710 list<PIDrwOptionStringWindow* >::iterator it; 711 for(it=drwoswlist.begin(); it!= drwoswlist.end(); it++) 712 if ((*it)->GetDrawer() == drw) { 713 (*it)->Show(); 714 return; 715 } 716 PIDrwOptionStringWindow* osw = 717 new PIDrwOptionStringWindow(PIApplicationGetApp(), drw); 718 drwoswlist.push_back(osw); 719 osw->Show(); 720 } 721 722 /* --Methode-- */ 723 void PIDrwOptionStringWindow::RemoveDrwOptionStringWindow(PIDrawer* drw) 724 { 725 if (drw == NULL) return; 726 list<PIDrwOptionStringWindow* >::iterator it; 727 for(it=drwoswlist.begin(); it!= drwoswlist.end(); it++) 728 if ((*it)->GetDrawer() == drw) { 729 (*it)->Hide(); 730 delete *it; 731 drwoswlist.erase(it); 732 break; 733 } 734 return; 735 } 736 737 /* --Methode-- */ 738 PIDrwOptionStringWindow::PIDrwOptionStringWindow(PIApplication* par, PIDrawer* drw) 739 : PIWindow((PIMsgHandler *)par, "DrwOptionString", PIWK_normal, 400, 200, 100, 200) 740 , mDrw(drw) 741 { 742 int bsx, bsy; 743 int tsx, tsy; 744 int spx, spy; 745 PIApplicationPrefCompSize(bsx, bsy); 746 spx = bsx/8; spy = bsy/6; 747 tsx = 6*bsx+2*spx; tsy = 6*bsy+4*spy; 748 SetSize(tsx,tsy); 749 int cpx = spx; 750 int cpy = spy; 751 mTxt[0] = new PIText(this, "drwoshelp", true, true, bsx*6.0, 4*bsy, cpx, cpy); 752 mTxt[0]->SetTextEditable(false); 753 mTxt[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 754 mTxt[0]->SetText(""); 755 cpy += 4*bsy+spy; 756 mTxt[1] = new PIText(this, "drwosset", bsx*6.0, bsy, cpx, cpy); 757 mTxt[1]->SetTextEditable(true); 758 mTxt[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 759 mTxt[1]->SetText(""); 760 cpy += bsy+spy; 761 mLab = new PILabel(this, "drwntyp", bsx*2.2, bsy, cpx, cpy); 762 mLab->SetBorderWidth(1); 763 mLab->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 764 mLab->SetLabel(""); 765 cpx += 2.6*bsx; 766 mBut[0] = new PIButton(this, "SetOption", 555, bsx*1.5, bsy, cpx, cpy); 767 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 768 cpx += 1.8*bsx; 769 mBut[1] = new PIButton(this, "Dimiss", 777, bsx*1.5, bsy, cpx, cpy); 770 mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 771 } 772 773 /* --Methode-- */ 774 PIDrwOptionStringWindow::~PIDrwOptionStringWindow() 775 { 776 delete mTxt[0]; 777 delete mTxt[1]; 778 delete mLab; 779 delete mBut[0]; 780 delete mBut[1]; 781 } 782 /* --Methode-- */ 783 void PIDrwOptionStringWindow::Show() 784 { 785 if (mDrw) { 786 string hs; 787 mDrw->GetOptionsHelpInfo(hs); 788 mTxt[0]->SetText(hs); 789 mTxt[1]->SetText(""); 790 hs = mDrw->Nom(); 791 hs += " (T="; 792 hs += typeid(*mDrw).name(); 793 hs += ")"; 794 mLab->SetLabel(hs); 795 } 796 PIWindow::Show(); 797 } 798 799 800 /* --Methode-- */ 801 void PIDrwOptionStringWindow::Process(PIMessage msg, PIMsgHandler* sender, void* data) 802 { 803 PIMessage mod = ModMsg(msg); 804 msg = UserMsg(msg); 805 806 switch (msg) { 807 case 777: 808 Hide(); 809 break; 810 case 555: 811 if (mDrw) { 812 vector<string> vops; 813 string ops = mTxt[1]->GetText(); 814 //cout << " DBG-A " << ops << endl; 815 size_t len = ops.length(); 816 size_t cp = ops.find_first_not_of(' ', 0); 817 if ((cp < 0) || (cp >= len) ) break; 818 size_t tp = ops.find(' ', cp); 819 while ((tp > cp) && (tp < len)) { 820 vops.push_back(ops.substr(cp, tp-cp)); 821 cp = tp+1; 822 tp = ops.find(' ', cp); 823 } 824 if (cp < len) vops.push_back(ops.substr(cp)); 825 // cout << " DBG-B " << vops.size() << endl; 826 //for(int kk=0; kk< vops.size() ; kk++) 827 // cout << " DBG-C[" << kk << "] " << vops[kk] << endl; 828 mDrw->DecodeOptionString(vops, false); 829 ops = "<< " + ops + " >> Decoded"; 830 mTxt[1]->SetText(ops); 831 mDrw->Refresh(); 832 } 833 default : 834 break; 835 836 } 837 } -
trunk/SophyaPI/PI/pidrwtools.h
r2230 r2387 13 13 #include "pibwdggen.h" 14 14 15 // ------ --- fenetre de dialogue pour modifs axes et options des Drawers ----------15 // ------ fenetres de dialogue pour modifs options/attributs des Drawers ---------- 16 16 // -------------------------------------------------------------------------------- 17 17 18 class PIDrawer; // Declaration des objets drawer 18 19 20 // fenetre de gestion interactive des attributs graphique 19 21 class PIDrwTools : public PIWindow 20 22 { … … 45 47 PILabel* mDrName; 46 48 PIButton* mButdr[2]; 47 PIButton* mButcf[ 6];49 PIButton* mButcf[7]; 48 50 int mNDr; 49 51 // mButSens - Pour l'etat de sensibilite des boutons … … 55 57 }; 56 58 59 // Classe pour le changement interactive des attributs par appel 60 // a DecodeOptionString 61 62 class PIDrwOptionStringWindow : public PIWindow 63 { 64 public: 65 static void ShowDrwOptionStringWindow(PIDrawer* drw); 66 static void RemoveDrwOptionStringWindow(PIDrawer* drw); 67 68 PIDrwOptionStringWindow(PIApplication* par, PIDrawer* drw); 69 ~PIDrwOptionStringWindow(); 70 virtual void Show(); 71 inline PIDrawer* GetDrawer() { return mDrw; } 72 73 protected: 74 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 75 private: 76 PIText* mTxt[2]; 77 PILabel* mLab; 78 PIButton* mBut[2]; 79 PIDrawer* mDrw; 80 }; 81 57 82 #endif -
trunk/SophyaPI/PI/pieldrw.cc
r2349 r2387 595 595 return(ndec+ndec1); 596 596 } 597 /* --Methode-- */ 598 void PIElDrawer::GetOptionsHelpInfo(string& info) 599 { 600 info += " ---- PIElDrawer options help info : \n" ; 601 info += " >> Axe and grid configuration: \n"; 602 info += " axesnone stdaxes defaxes \n"; 603 info += " boxaxes boxaxesgrid fineaxes fineaxesgrid \n"; 604 info += " centeredaxes finecenteredaxes centeredaxesgrid \n"; 605 info += " finecenteredaxesgrid grid/nogrid \n"; 606 info += " >> Axe ticks/labels: \n"; 607 info += " labels/nolabels ticks/noticks minorticks/nominorticks \n"; 608 info += " extticks/intticks/extintticks nbticks=X_NbTicks,Y_NbTicks \n"; 609 info += " tickslen=MajorTickLenFrac,MinorTickLenFraC \n"; 610 info += " >> Axe label font size: \n"; 611 info += " autofontsize=FontSizeFrac fixedfontsize \n"; 612 info += " >> Up/Down title: title tit notitle notit \n"; 613 info += " ... Color/Font/line attributes : \n"; 614 // On recupere ensuite la chaine info de la classe de base 615 PIDrawer::GetOptionsHelpInfo(info); 616 return; 617 } 597 618 598 619 /* --Methode-- */ -
trunk/SophyaPI/PI/pieldrw.h
r2349 r2387 217 217 // Methode de decodage des options 218 218 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 219 // Texte d'aide des options disponibles 220 virtual void GetOptionsHelpInfo(string& info); 219 221 220 222 virtual void DrawAxes(PIGraphicUC* g); // Trace d'axes avec label axe X,Y
Note:
See TracChangeset
for help on using the changeset viewer.