Changeset 2465 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Nov 27, 2003, 11:51:58 AM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2419 r2465 1071 1071 { 1072 1072 string kw, usage, grp; 1073 grp = "External Modules"; 1074 string gdesc = "Dynamic load (shared object modules) management command group"; 1075 mpiac->AddHelpGroup(grp, gdesc); 1073 1076 kw = "loadmodule"; 1074 1077 usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename"; 1075 1078 usage += "\n Related commands: link"; 1076 mpiac->RegisterCommand(kw, usage, this, "External Modules");1079 mpiac->RegisterCommand(kw, usage, this, grp); 1077 1080 kw = "link"; 1078 1081 usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]"; 1079 1082 usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names "; 1080 1083 usage += "\n Related commands: call loadmodule linkff2"; 1081 mpiac->RegisterCommand(kw, usage, this, "External Modules");1084 mpiac->RegisterCommand(kw, usage, this, grp); 1082 1085 kw = "linkff2"; 1083 1086 usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]"; 1084 1087 usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names "; 1085 1088 usage += "\n Related commands: call link loadmodule"; 1086 mpiac->RegisterCommand(kw, usage, this, "External Modules");1089 mpiac->RegisterCommand(kw, usage, this, grp); 1087 1090 kw = "call"; 1088 1091 usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]"; 1089 1092 usage += "\n User function : f(vector<string>& args)"; 1090 1093 usage += "\n Related commands: link"; 1091 mpiac->RegisterCommand(kw, usage, this, "External Modules"); 1092 1094 mpiac->RegisterCommand(kw, usage, this, grp); 1095 1096 grp = "Graphics"; 1097 gdesc = "Basic graphics and object display commands"; 1098 mpiac->AddHelpGroup(grp, gdesc); 1093 1099 kw = "zone"; 1094 1100 usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]"; 1095 1101 usage += "\n Related commands: newwin"; 1096 mpiac->RegisterCommand(kw, usage, this, "Graphics");1102 mpiac->RegisterCommand(kw, usage, this, grp); 1097 1103 kw = "newwin"; 1098 1104 usage = "To Create a New Graphic window, with zones \n"; … … 1100 1106 usage += " Usage: newwin [nx ny [sizeX sizeY]] "; 1101 1107 usage += "\n Related commands: zone"; 1102 mpiac->RegisterCommand(kw, usage, this, "Graphics");1108 mpiac->RegisterCommand(kw, usage, this, grp); 1103 1109 kw = "stacknext"; 1104 1110 usage = "Displays the next widget on stack window \n Usage: stacknext"; 1105 mpiac->RegisterCommand(kw, usage, this, "Graphics");1111 mpiac->RegisterCommand(kw, usage, this, grp); 1106 1112 1107 1113 kw = "graphicatt"; … … 1147 1153 usage += ">> DisplayWindow: next same win stack inset \n"; 1148 1154 usage += " Related commands: setaxesatt setinsetlimits "; 1149 mpiac->RegisterCommand(kw, usage, this, "Graphics");1155 mpiac->RegisterCommand(kw, usage, this, grp); 1150 1156 1151 1157 kw = "setaxesatt"; … … 1167 1173 usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n"; 1168 1174 usage += " The rectangle is defined as a fraction of the widget size\n"; 1169 mpiac->RegisterCommand(kw, usage, this, "Graphics");1175 mpiac->RegisterCommand(kw, usage, this, grp); 1170 1176 1171 1177 kw = "setinsetlimits"; … … 1175 1181 usage += " Usage: setinsetlimits xmin xmax ymin ymax"; 1176 1182 usage += "\n Related commands: graphicatt /inset"; 1177 mpiac->RegisterCommand(kw, usage, this, "Graphics");1183 mpiac->RegisterCommand(kw, usage, this, grp); 1178 1184 1179 1185 kw = "drpanel"; … … 1181 1187 usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]"; 1182 1188 usage += "\n Related commands: addtext addline addrect addcirc ..."; 1183 mpiac->RegisterCommand(kw, usage, this, "Graphics");1189 mpiac->RegisterCommand(kw, usage, this, grp); 1184 1190 1185 1191 kw = "addtext"; … … 1348 1354 usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]"; 1349 1355 usage += "\n Related commands: addtext graphicatt"; 1350 mpiac->RegisterCommand(kw, usage, this, "Graphics");1356 mpiac->RegisterCommand(kw, usage, this, grp); 1351 1357 1352 1358 kw = "addtitle"; 1353 1359 usage = "Set the title string (top title / bottom title) \n"; 1354 1360 usage += " alias for settitle "; 1355 mpiac->RegisterCommand(kw, usage, this, "Graphics");1361 mpiac->RegisterCommand(kw, usage, this, grp); 1356 1362 1357 1363 kw = "setaxelabels"; … … 1359 1365 usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]"; 1360 1366 usage += "\n Related commands: settitle addtext graphicatt"; 1361 mpiac->RegisterCommand(kw, usage, this, "Graphics");1367 mpiac->RegisterCommand(kw, usage, this, grp); 1362 1368 1363 1369 kw = "addaxelabels"; 1364 1370 usage = "Set the X and Y axis labels for the current 2D graphic object"; 1365 1371 usage += " alias for setaxelabels "; 1366 mpiac->RegisterCommand(kw, usage, this, "Graphics");1372 mpiac->RegisterCommand(kw, usage, this, grp); 1367 1373 1368 1374 RegisterPIGraphicsHelp(mpiac); -
trunk/SophyaPI/PIext/piacmd.cc
r2463 r2465 43 43 inline void AddHelpGroup(const char * hgrp, int gid) 44 44 { hgrpom->AppendItem(hgrp, 20000+gid); } 45 inline void AddHelpGroup(string const & hgrp, int gid) 46 { hgrpom->AppendItem(hgrp.c_str(), 20000+gid); } 45 47 inline void ClearHelpList() 46 48 { mNitem=0; hitemlist->DeleteAllItems(); } 47 49 inline void AddHelpItem(const char * hitem) 48 50 { mNitem++; hitemlist->AppendItem(hitem, 100+mNitem); } 51 inline void SetHelpTextLabel(string const & htxt, string const & hlab) 52 { mTxt->SetText(htxt); mLab->SetLabel(hlab); } 53 49 54 protected : 50 55 PIStdImgApp* dap; … … 144 149 mObjMgr = omg; 145 150 mImgApp = app; 146 147 //MOVE if (mImgApp) mImgApp->GetConsole()->SetPrompt(spromptmul);148 //?? cmdhgrp["All"] = 0;149 //?? cmdgrpid = 1;150 //?? cmdhgrp["PIACmd"] = 1;151 151 helpwin = new PIAHelpWind(app, this); 152 helpwin->AddHelpGroup("All", 0); 153 // helpwin->AddHelpGroup("PIACmd", 1); 152 helpwin_initdone = false; 154 153 155 154 string kw = "exitpiapp"; 156 155 string grp = "PIACmd"; 156 string gdesc = "piapp interpreter (class PIACmd) additional builtin commands"; 157 AddHelpGroup(grp, gdesc); 158 157 159 string usage = "To end the piapp session "; 158 160 RegisterCommand(kw, usage, NULL, grp); … … 175 177 cxxexwin = new CxxExecWind(app, cxxe); 176 178 179 InitializeHelpWindowMenu(); 177 180 } 178 181 … … 192 195 193 196 /* --Methode-- */ 194 int PIACmd::CheckHelpGrp(string& grp) 195 { 196 int gid=0; 197 CmdHGroup::iterator it = cmdhgrp.find(grp); 198 if (it == cmdhgrp.end()) { 199 cmdgrpid++; gid = cmdgrpid; 200 cmdhgrp[grp] = gid; 201 helpwin->AddHelpGroup(grp.c_str(), gid); 202 } 203 else gid = (*it).second; 204 return(gid); 197 bool PIACmd::CheckHelpGrp(string& grp, int& gid, string& desc) 198 { 199 bool fgnewgrp = Commander::CheckHelpGrp(grp, gid, desc); 200 if (helpwin_initdone && fgnewgrp) helpwin->AddHelpGroup(grp.c_str(), gid); 201 return fgnewgrp; 205 202 } 206 203 … … 209 206 { 210 207 helpwin->ClearHelpList(); 208 if (gid == 0) { 209 string htxt = "All registered commands"; 210 string hlab = "All (HelpGroup)"; 211 helpwin->SetHelpTextLabel(htxt, hlab); 212 } 213 else { 214 CmdHGroup::iterator ith; 215 for(ith = cmdhgrp.begin(); ith != cmdhgrp.end(); ith++) { 216 if ((*ith).second.gid == gid) { 217 string hlab = (*ith).first; 218 hlab += " (HelpGroup)"; 219 helpwin->SetHelpTextLabel((*ith).second.desc, hlab); 220 break; 221 } 222 } 223 } 211 224 CmdExmap::iterator it; 212 225 for(it = helpexmap.begin(); it != helpexmap.end(); it++) { … … 220 233 } 221 234 235 /* --Methode-- */ 236 void PIACmd::InitializeHelpWindowMenu() 237 { 238 helpwin->AddHelpGroup("All", 0); 239 CmdHGroup::iterator it; 240 for(it = cmdhgrp.begin(); it != cmdhgrp.end(); it++) 241 helpwin->AddHelpGroup((*it).first, (*it).second.gid); 242 helpwin_initdone = true; 243 } 222 244 223 245 /* Fonction */ … … 247 269 248 270 // >>>>>>>>>>> Commande d'interpreteur 249 if (kw == "helpwindow") ShowHelpWindow(); 271 if (kw == "helpwindow") { 272 ShowHelpWindow(); 273 return 0; 274 } 250 275 // ----> Sortie d'application 251 276 else if (kw == "exitpiapp") { 252 277 mImgApp->Stop(); 253 return (0);278 return 0; 254 279 } 255 280 else return Commander::ExecuteCommandLine(kw, tokens, toks); 256 281 return 0; 257 282 } 258 283 -
trunk/SophyaPI/PIext/piacmd.h
r2463 r2465 45 45 // inline CmdInterpreter* CurrentInterpreter() { return(curcmdi); } 46 46 47 inline CmdExecutor* 48 inline CmdExecutor* 49 inline PIStdImgApp* 47 inline CmdExecutor* BaseExecutor() { return(basexec); } 48 inline CmdExecutor* ContExecutor() { return(cntexec); } //_OP_ 49 inline PIStdImgApp* GetImgApp() { return(mImgApp); } 50 50 51 51 // Pour utilisation par PIAHelpWind uniquement … … 53 53 54 54 protected: 55 virtual int CheckHelpGrp(string& grp); 55 virtual bool CheckHelpGrp(string& grp, int& gid, string& desc); 56 virtual void InitializeHelpWindowMenu(); 56 57 57 58 virtual void SetCurrentPrompt(const char* pr); … … 71 72 // Fenetre d'aide interactive 72 73 PIAHelpWind* helpwin; 74 bool helpwin_initdone; 75 // Fenetres d'execution interactive de C++ , options correspondantes 73 76 CxxExecWind* cxxexwin; 74 77 CxxOptionWind* cxxoptwin;
Note:
See TracChangeset
for help on using the changeset viewer.