Changeset 2465 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Nov 27, 2003, 11:51:58 AM (22 years ago)
Author:
ansari
Message:

Suite modification/adaptations a la classe PIACmd qui herite maintenent de SOPHYA::Commander - Reza 27/11/2003

Location:
trunk/SophyaPI/PIext
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2419 r2465  
    10711071{
    10721072string kw, usage, grp;
     1073grp = "External Modules";
     1074string gdesc = "Dynamic load (shared object modules) management command group";
     1075mpiac->AddHelpGroup(grp, gdesc);
    10731076kw = "loadmodule";
    10741077usage = "To load and initialize modules \n  Usage: loadmodule fnameso modulename";
    10751078usage += "\n  Related commands: link"; 
    1076 mpiac->RegisterCommand(kw, usage, this, "External Modules");
     1079mpiac->RegisterCommand(kw, usage, this, grp);
    10771080kw = "link";
    10781081usage = "Dynamic linking of compiled user functions \n  Usage: link fnameso f1 [f2 f3]";
    10791082usage += "\n  fnameso: Shared-object file name, f1,f2,f3 : User function names ";
    10801083usage += "\n  Related commands: call loadmodule linkff2"; 
    1081 mpiac->RegisterCommand(kw, usage, this, "External Modules");
     1084mpiac->RegisterCommand(kw, usage, this, grp);
    10821085kw = "linkff2";
    10831086usage = "Dynamic linking of compiled user functions (Set 2)\n  Usage: linkff2 fnameso f1 [f2 f3]";
    10841087usage += "\n  fnameso: Shared-object file name, f1,f2,f3 : User function names ";
    10851088usage += "\n  Related commands: call link loadmodule"; 
    1086 mpiac->RegisterCommand(kw, usage, this, "External Modules");
     1089mpiac->RegisterCommand(kw, usage, this, grp);
    10871090kw = "call";
    10881091usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
    10891092usage += "\n  User function : f(vector<string>& args)";
    10901093usage += "\n  Related commands: link"; 
    1091 mpiac->RegisterCommand(kw, usage, this, "External Modules");
    1092 
     1094mpiac->RegisterCommand(kw, usage, this, grp);
     1095
     1096grp = "Graphics";
     1097gdesc = "Basic graphics and object display commands";
     1098mpiac->AddHelpGroup(grp, gdesc);
    10931099kw = "zone";
    10941100usage = "To Divide the Graphic window \n  Usage: zone [nx=1 ny=1]";
    10951101usage += "\n  Related commands: newwin"; 
    1096 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1102mpiac->RegisterCommand(kw, usage, this, grp);
    10971103kw = "newwin";
    10981104usage = "To Create a New Graphic window, with zones \n";
     
    11001106usage += "    Usage: newwin [nx ny [sizeX sizeY]] ";
    11011107usage += "\n  Related commands: zone"; 
    1102 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1108mpiac->RegisterCommand(kw, usage, this, grp);
    11031109kw = "stacknext";
    11041110usage = "Displays the next widget on stack window \n  Usage: stacknext";
    1105 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1111mpiac->RegisterCommand(kw, usage, this, grp);
    11061112
    11071113kw = "graphicatt";
     
    11471153usage += ">> DisplayWindow: next same win stack inset \n";
    11481154usage += "   Related commands: setaxesatt setinsetlimits "; 
    1149 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1155mpiac->RegisterCommand(kw, usage, this, grp);
    11501156
    11511157kw = "setaxesatt";
     
    11671173usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
    11681174usage += "          The rectangle is defined as a fraction of the widget size\n";
    1169 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1175mpiac->RegisterCommand(kw, usage, this, grp);
    11701176
    11711177kw = "setinsetlimits";
     
    11751181usage += " Usage: setinsetlimits xmin xmax ymin ymax";
    11761182usage += "\n  Related commands: graphicatt /inset"; 
    1177 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1183mpiac->RegisterCommand(kw, usage, this, grp);
    11781184
    11791185kw = "drpanel";
     
    11811187usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
    11821188usage += "\n  Related commands: addtext addline addrect addcirc ..."; 
    1183 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1189mpiac->RegisterCommand(kw, usage, this, grp);
    11841190
    11851191kw = "addtext";
     
    13481354usage += "\n  Usage: settitle TopTitle [BottomTitle] [fontAtt]";
    13491355usage += "\n  Related commands: addtext graphicatt"; 
    1350 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1356mpiac->RegisterCommand(kw, usage, this, grp);
    13511357
    13521358kw = "addtitle";
    13531359usage = "Set the title string (top title / bottom title) \n";
    13541360usage += "   alias for settitle ";
    1355 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1361mpiac->RegisterCommand(kw, usage, this, grp);
    13561362
    13571363kw = "setaxelabels";
     
    13591365usage += "\n  Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
    13601366usage += "\n  Related commands: settitle addtext graphicatt"; 
    1361 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1367mpiac->RegisterCommand(kw, usage, this, grp);
    13621368
    13631369kw = "addaxelabels";
    13641370usage = "Set the X and Y axis labels for the current 2D graphic object";
    13651371usage += "   alias for setaxelabels ";
    1366 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1372mpiac->RegisterCommand(kw, usage, this, grp);
    13671373
    13681374RegisterPIGraphicsHelp(mpiac);
  • trunk/SophyaPI/PIext/piacmd.cc

    r2463 r2465  
    4343  inline  void  AddHelpGroup(const char * hgrp, int gid)
    4444                    { hgrpom->AppendItem(hgrp, 20000+gid); }
     45  inline  void  AddHelpGroup(string const & hgrp, int gid)
     46                    { hgrpom->AppendItem(hgrp.c_str(), 20000+gid); }
    4547  inline  void  ClearHelpList()
    4648                    { mNitem=0; hitemlist->DeleteAllItems(); }
    4749  inline  void  AddHelpItem(const char * hitem)
    4850                    { mNitem++;  hitemlist->AppendItem(hitem, 100+mNitem); }
     51  inline  void  SetHelpTextLabel(string const & htxt, string const & hlab)
     52                    { mTxt->SetText(htxt); mLab->SetLabel(hlab); }
     53
    4954protected :
    5055  PIStdImgApp* dap;
     
    144149mObjMgr = omg;
    145150mImgApp = app;
    146 
    147 //MOVE if (mImgApp) mImgApp->GetConsole()->SetPrompt(spromptmul);
    148 //?? cmdhgrp["All"] = 0;
    149 //?? cmdgrpid = 1;
    150 //?? cmdhgrp["PIACmd"] = 1;
    151151helpwin = new PIAHelpWind(app, this);
    152 helpwin->AddHelpGroup("All", 0);
    153 // helpwin->AddHelpGroup("PIACmd", 1);
     152helpwin_initdone = false;
    154153
    155154string kw = "exitpiapp";
    156155string grp = "PIACmd";
     156string gdesc = "piapp interpreter (class PIACmd) additional builtin commands";
     157AddHelpGroup(grp, gdesc);
     158
    157159string usage = "To end the piapp session ";
    158160RegisterCommand(kw, usage, NULL, grp);
     
    175177cxxexwin  = new  CxxExecWind(app, cxxe);
    176178
     179InitializeHelpWindowMenu();
    177180}
    178181
     
    192195
    193196/* --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);
     197bool PIACmd::CheckHelpGrp(string& grp, int& gid, string& desc)
     198{
     199bool fgnewgrp = Commander::CheckHelpGrp(grp, gid, desc);
     200if (helpwin_initdone && fgnewgrp) helpwin->AddHelpGroup(grp.c_str(), gid);
     201return fgnewgrp;
    205202}
    206203
     
    209206{
    210207helpwin->ClearHelpList();
     208if (gid == 0) {
     209  string htxt = "All registered commands";
     210  string hlab = "All (HelpGroup)";
     211  helpwin->SetHelpTextLabel(htxt, hlab);
     212}
     213else {
     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}
    211224CmdExmap::iterator it;
    212225for(it = helpexmap.begin(); it != helpexmap.end(); it++) {
     
    220233}
    221234
     235/* --Methode-- */
     236void 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}
    222244
    223245/* Fonction */
     
    247269
    248270// >>>>>>>>>>> Commande d'interpreteur
    249 if (kw == "helpwindow") ShowHelpWindow();
     271if (kw == "helpwindow") {
     272  ShowHelpWindow();
     273  return 0;
     274}
    250275// ----> Sortie d'application
    251276else if (kw == "exitpiapp") {
    252277  mImgApp->Stop();
    253   return(0);
     278  return 0;
    254279}
    255280else return Commander::ExecuteCommandLine(kw, tokens, toks);
    256 
     281return 0;
    257282}
    258283
  • trunk/SophyaPI/PIext/piacmd.h

    r2463 r2465  
    4545    //  inline  CmdInterpreter* CurrentInterpreter() { return(curcmdi); }
    4646
    47   inline  CmdExecutor*    BaseExecutor()  { return(basexec); }
    48   inline  CmdExecutor*    ContExecutor()  { return(cntexec); } //_OP_
    49   inline  PIStdImgApp*    GetImgApp() { return(mImgApp); }
     47  inline  CmdExecutor*   BaseExecutor()  { return(basexec); }
     48  inline  CmdExecutor*   ContExecutor()  { return(cntexec); } //_OP_
     49  inline  PIStdImgApp*   GetImgApp() { return(mImgApp); }
    5050
    5151//   Pour utilisation par PIAHelpWind uniquement
     
    5353
    5454protected:
    55   virtual int   CheckHelpGrp(string& grp);
     55  virtual bool  CheckHelpGrp(string& grp, int& gid, string& desc);
     56  virtual void  InitializeHelpWindowMenu();
    5657
    5758  virtual void  SetCurrentPrompt(const char* pr);
     
    7172// Fenetre d'aide interactive
    7273  PIAHelpWind* helpwin;
     74  bool helpwin_initdone;
     75// Fenetres d'execution interactive de C++ , options correspondantes
    7376  CxxExecWind* cxxexwin;
    7477  CxxOptionWind* cxxoptwin;
Note: See TracChangeset for help on using the changeset viewer.