Changeset 2465 in Sophya for trunk/SophyaPI/PIext/piacmd.cc
- Timestamp:
- Nov 27, 2003, 11:51:58 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.