Changeset 3355 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc
- Timestamp:
- Oct 23, 2007, 12:02:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pistdimgapp.cc
r3024 r3355 761 761 } 762 762 763 // <ZThread> global PIApplication event loop synchronisation 764 SyncPIS zs(getMutex(), fglock, 2); 765 763 766 // On decode les options graphiques 764 767 vector<string> opts; 765 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 768 string wname = name; 769 DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname); 766 770 767 771 // Pas de same ou inset pour DispImage 768 772 if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next; 769 770 // <ZThread> global PIApplication event loop synchronisation771 SyncPIS zs(getMutex(), fglock, 2);772 773 773 774 // Choix de la taille de fenetre … … 778 779 if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100; 779 780 px = py = 0; 780 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *) name.c_str());781 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str()); 781 782 if (fgimagnav) { // Creation de naviguateur d'image 782 piin = new PIImageNavigator(win, (char *) name.c_str(), sx, sy, px,py);783 piin = new PIImageNavigator(win, (char *)wname.c_str(), sx, sy, px,py); 783 784 piin->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 784 785 piin->Show(); … … 789 790 } 790 791 else { // Creation de widget PIImage normal 791 pii = new PIImage(win, (char *) name.c_str(), sx, sy, px,py);792 pii = new PIImage(win, (char *)wname.c_str(), sx, sy, px,py); 792 793 pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 793 794 pii->SetZoomWin(zoom, false); … … 845 846 } 846 847 848 // <ZThread> global PIApplication event loop synchronisation 849 SyncPIS zs(getMutex(), fglock, 2); 850 847 851 // On decode les options graphiques 848 852 vector<string> opts; 849 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 853 string wname = name; 854 DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname); 850 855 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 851 852 // <ZThread> global PIApplication event loop synchronisation853 SyncPIS zs(getMutex(), fglock, 2);854 856 855 857 // Trace en superpoistion … … 898 900 sx = 200+mFgScSz*100; 899 901 sy = 200+mFgScSz*100; 900 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *) name.c_str());901 902 scw = new PIScDrawWdg(win, (char *) name.c_str(), sx, sy, px, py);902 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str()); 903 904 scw = new PIScDrawWdg(win, (char *)wname.c_str(), sx, sy, px, py); 903 905 scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 904 906 scw->SetUserData(NULL, oid); … … 923 925 // Titre du plot 924 926 if (mAddTitle) { 925 if (title.length() <= 0) title = name; string t2="";927 if (title.length() <= 0) title = wname; string t2=""; 926 928 scw->SetTitles(title, t2); 927 929 } … … 948 950 } 949 951 952 // <ZThread> global PIApplication event loop synchronisation 953 SyncPIS zs(getMutex(), fglock, 2); 954 950 955 // On decode les options graphiques 951 956 vector<string> opts; 952 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 957 string wname = name; 958 DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname); 953 959 954 960 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 955 956 // <ZThread> global PIApplication event loop synchronisation957 SyncPIS zs(getMutex(), fglock, 2);958 961 959 962 // Trace en superpoistion … … 1002 1005 sx = 200+mFgScSz*100; 1003 1006 sy = 200+mFgScSz*100; 1004 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *) name.c_str());1005 PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *) name.c_str(), sx, sy, px, py);1007 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str()); 1008 PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)wname.c_str(), sx, sy, px, py); 1006 1009 wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 1007 1010 wd3->SetUserData(NULL, oid); … … 1026 1029 // Titre du plot 1027 1030 if (mAddTitle) { 1028 if (title.length() <= 0) title = name; string t2="";1031 if (title.length() <= 0) title = wname; string t2=""; 1029 1032 wd3->SetTitles(title, t2); 1030 1033 } … … 1493 1496 { 1494 1497 if (mStW) mStW->DispNext(); 1498 } 1499 1500 /* --Methode-- */ 1501 void PIStdImgApp::SelectLastWidget(string & nom) 1502 { 1503 1504 if ( (mLastWdg != NULL) && (mLastWdg->Nom() == nom) ) return; 1505 if ( (mCurWdg != NULL) && (mCurWdg->Nom() == nom) ) { 1506 mLastWdg = mCurWdg; 1507 return; 1508 } 1509 1510 PIWdg* bw = NULL; 1511 long wsid = -1; 1512 BWMList::iterator it; 1513 for(it = mBWList.begin(); it != mBWList.end(); it++) { 1514 if ( ((*it).second->Nom() == nom) && ((*it).first > wsid)) { 1515 bw = (*it).second; wsid = (*it).first; 1516 } 1517 } 1518 if (bw != NULL) { 1519 if (bw->kind() == PIImageNavigator::ClassId) 1520 mLastWdg = dynamic_cast<PIImageNavigator *>(bw)->ImageWdg(); 1521 else mLastWdg = dynamic_cast<PIBaseWdg *>(bw); 1522 } 1523 return; 1524 } 1525 1526 /* --Methode-- */ 1527 void PIStdImgApp::SelectLastWidgetByObjName(string & nom) 1528 { 1529 int oid = ObjMgr()->NameToOId(nom); 1530 if (oid < 0) return; 1531 1532 if ( (mLastWdg != NULL) && (mLastWdg->UserFlag() == oid) ) return; 1533 if ( (mCurWdg != NULL) && (mCurWdg->UserFlag() == oid) ) { 1534 mLastWdg = mCurWdg; 1535 return; 1536 } 1537 1538 PIWdg* bw = NULL; 1539 long wsid = -1; 1540 BWMList::iterator it; 1541 for(it = mBWList.begin(); it != mBWList.end(); it++) { 1542 if ( ((*it).second->UserFlag() == oid) && ((*it).first > wsid)) { 1543 bw = (*it).second; wsid = (*it).first; 1544 } 1545 } 1546 if (bw != NULL) { 1547 if (bw->kind() == PIImageNavigator::ClassId) 1548 mLastWdg = dynamic_cast<PIImageNavigator *>(bw)->ImageWdg(); 1549 else mLastWdg = dynamic_cast<PIBaseWdg *>(bw); 1550 } 1551 return; 1495 1552 } 1496 1553 … … 1749 1806 1750 1807 /* --Methode-- */ 1751 DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts )1808 DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts, string& wname) 1752 1809 { 1753 1810 DispWinEnum rc = Disp_Next; … … 1774 1831 else if (token == "same") rc = Disp_Same; 1775 1832 else if (token == "inset") rc = Disp_Inset; 1776 else if (token == "stack") rc = Disp_Stack; 1777 else if (token == "next") rc = Disp_Next; 1833 else if (token == "stack") rc = Disp_Stack; 1834 else if (token == "next") rc = Disp_Next; 1835 else if (token.substr(0,6)=="samew=") { 1836 string snom=token.substr(6); 1837 SelectLastWidget(snom); 1838 rc = Disp_Same; 1839 } 1840 else if (token.substr(0,6)=="inset=") { 1841 double fx1,fx2,fy1,fy2; 1842 fx1=fy1=0.4; fx2=fy2=0.6; 1843 sscanf(token.substr(6).c_str(),"%lg,%lg,%lg,%lg",&fx1,&fx2,&fy1,&fy2); 1844 SetInsetLimits(fx1, fx2, fy1, fy2); 1845 rc = Disp_Inset; 1846 } 1847 else if (token.substr(0,6)=="wname=") { // specification de nom de widget 1848 wname=token.substr(6); 1849 } 1778 1850 // Option a etre decode par les drawers, etc ... 1779 1851 else opts.push_back(token);
Note:
See TracChangeset
for help on using the changeset viewer.