Changeset 349 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Aug 4, 1999, 3:37:31 PM (26 years ago)
Author:
ercodmgr
Message:

A/ ajout des blocs foreach et ameliorations gestion des variables ($x)
pour l'interpreteur piacmd.
B/ Ajout PIStdImgApp::AddText et corrections diverses

Reza 05/08/99

Location:
trunk/SophyaPI/PIext
Files:
6 edited

Legend:

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

    r345 r349  
    7777  mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
    7878  }
     79else if (kw == "addtext") {
     80  if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl;  return(0); }
     81  double xp = atof(tokens[0].c_str());
     82  double yp = atof(tokens[1].c_str());
     83  bool fgsr = true;
     84  string txt = tokens[3];
     85  for(int k=4; k<tokens.size(); k++) txt += (' ' + tokens[k]);
     86  int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
     87  mImgApp->AddText(txt, xp, yp);
     88  if (fgsr) mImgApp->RestoreGraphicAtt();
     89  }
     90 
    7991// >>>>>>>>>>> Link dynamique de fonctions C++
    8092else if (kw == "link" ) {
     
    609621kw = "setxylimits";
    610622usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
     623usage += "\n  Related commands: gratt"; 
     624mpiac->RegisterCommand(kw, usage, this, "Graphics");
     625
     626kw = "addtext";
     627usage = "Adds a text string to the current graphic object";
     628usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
     629usage += "\n  Usage: addtext x y ColFontAtt TextString";
    611630usage += "\n  Related commands: gratt"; 
    612631mpiac->RegisterCommand(kw, usage, this, "Graphics");
  • trunk/SophyaPI/PIext/piacmd.cc

    r335 r349  
    22#include <stdio.h>
    33#include <stdlib.h>
     4#include <ctype.h>
    45#include <math.h>
    56
     
    1718
    1819// ------------------------------------------------------------
    19 //         Gestion d'une fenetre d'aide interactive       
     20//         Gestion d'une fenetre d'aide interactive 
     21//                    Classe   PIAHelpWind   
    2022// ------------------------------------------------------------
    2123
     
    117119}
    118120
     121// ------------------------------------------------------------
     122//         Bloc de commandes (Foreach, ...)   
     123//               Classe  PIACmdBloc   
     124// ------------------------------------------------------------
     125
     126class PIACmdBloc {
     127public:
     128                PIACmdBloc(PIACmd* piac, PIACmdBloc* par, vector<string>& args);
     129                ~PIACmdBloc();
     130  inline PIACmdBloc*   Parent() { return(parent); }
     131  inline bool   CheckOK() { return((typ >= 0) ? true : false); }
     132  inline void   AddLine(string& line) 
     133    { lines.push_back(line); bloclineid.push_back(lines.size()); }
     134  inline void   AddBloc(PIACmdBloc* blk) 
     135    { blocs.push_back(blk); bloclineid.push_back(-blocs.size()); }
     136  PIACmdBloc*   Execute();
     137protected:
     138  PIACmd* piacmd;
     139  PIACmdBloc* parent;
     140  int typ;           // 0 foreach , 1 integer loop, 2 float loop
     141  string varname;
     142  vector<string> strlist;
     143  vector<string> lines;
     144  vector<PIACmdBloc *> blocs;
     145  vector<int> bloclineid;
     146  int i1,i2,di;
     147  float f1,f2,df;
     148};
     149
     150/* --Methode-- */
     151PIACmdBloc::PIACmdBloc(PIACmd* piac, PIACmdBloc* par, vector<string>& args)
     152{
     153piacmd = piac;
     154parent = par;
     155typ = -1;
     156i1 = 0;  i2 = -1;  di = 1;
     157f1 = 0.; f2 = -1.; df = 1.;
     158if ((args.size() < 2) ||  !isalpha((int)args[0][0]) )  return;
     159varname = args[0];
     160if (isalpha((int)args[1][0]) ) { // This is a foreach-integer bloc
     161  for(int kk=1; kk<args.size(); kk++) strlist.push_back(args[kk]);
     162  typ = 0;
     163  }
     164else { // This is an integer or float loop
     165  size_t l = args[1].length();
     166  size_t p = args[1].find(':');
     167  size_t pp = args[1].find('.');
     168  bool fl = (pp < l) ? true : false;  // Float loop or integer loop
     169  if (p >= l) return;  // Syntaxe error
     170  string a1 = args[1].substr(0, p);
     171  string aa = args[1].substr(p+1);
     172  p = aa.find(':');
     173  string a2, a3;
     174  bool hasa3 = false;
     175  if (p < aa.length() ) {
     176    a2 = aa.substr(0,p);
     177    a3 = aa.substr(p+1);
     178    hasa3 = true;
     179    }
     180  else  a2 = aa;
     181  if (fl) {
     182    typ = 2;
     183    f1 = atof(a1.c_str());
     184    f2 = atof(a2.c_str());
     185    if (hasa3)  df = atof(a3.c_str());
     186    else df = 1.;
     187    }
     188  else {
     189    typ = 1;
     190    i1 = atoi(a1.c_str());
     191    i2 = atoi(a2.c_str());
     192    if (hasa3)  di = atoi(a3.c_str());
     193    else di = 1;
     194    }
     195  }
     196}
     197
     198/* --Methode-- */
     199PIACmdBloc::~PIACmdBloc()
     200{
     201for(int k=0; k<blocs.size(); k++) delete blocs[k];
     202}
     203
     204/* --Methode-- */
     205PIACmdBloc* PIACmdBloc::Execute()
     206{
     207// cout << " DBG * PIACmdBloc::Execute() " << typ << " - " << bloclineid.size() <<
     208//      " I1,I2=" << i1 << " , " << i2 << " , " << di << endl;
     209string cmd;
     210int k=0;
     211int kj=0;
     212int kk=0;
     213char buff[32];
     214if (typ == 0)   // foreach string loop
     215  for(k=0; k<strlist.size(); k++) {
     216    cmd = "set " + varname + " " + strlist[k];
     217    piacmd->Interpret(cmd);
     218    for(kj=0; kj<bloclineid.size(); kj++) {
     219      kk = bloclineid[kj];
     220      if (kk > 0)  piacmd->Interpret(lines[kk-1]);
     221      else blocs[-kk-1]->Execute();
     222      }
     223  }
     224else if (typ == 1)  // Integer loop
     225  for(int i=i1; i<i2; i+=di) {
     226    k++;
     227    if (++k > 9999) {
     228      cout << ">>> Maximum PIACmdBloc loop limit (9999) -> break " << endl;
     229      break;
     230      }
     231    sprintf(buff, " %d", i);
     232    cmd = "set " + varname + buff;
     233    piacmd->Interpret(cmd);
     234    for(kj=0; kj<bloclineid.size(); kj++) {
     235      kk = bloclineid[kj];
     236      if (kk > 0)  piacmd->Interpret(lines[kk-1]);
     237      else blocs[-kk-1]->Execute();
     238      }
     239  }
     240else if (typ == 2)  // float loop
     241  for(float f=f1; f<f2; f+=df) {
     242    k++;
     243    if (++k > 9999) {
     244      cout << ">>> Maximum PIACmdBloc loop limit (9999) -> break " << endl;
     245      break;
     246      }
     247    sprintf(buff, " %g", f);
     248    cmd = "set " + varname + buff;
     249    piacmd->Interpret(cmd);
     250    for(kj=0; kj<bloclineid.size(); kj++) {
     251      kk = bloclineid[kj];
     252      if (kk > 0)  piacmd->Interpret(lines[kk-1]);
     253      else blocs[-kk-1]->Execute();
     254      }
     255  }
     256
     257return(parent);
     258}
     259
     260// ------------------------------------------------------------
     261//         Classe PIACmd
     262// ------------------------------------------------------------
     263
    119264static PIACmd* curpiacmd = NULL;
    120265/* --Methode-- */
     
    125270system("cp history.pic hisold.pic");
    126271hist.open("history.pic");
     272histon = true;
    127273trace = false;   timing = false;
    128274gltimer = NULL;
     275curblk = NULL;
     276felevel = 0;
    129277
    130278cmdhgrp["All"] = 0;
     
    138286string usage;
    139287usage = ">>> (piacmd) Interpreter's keywords : \n";
    140 usage += "  timingon  timingoff traceon  traceoff \n";
    141 usage += "  set unset listvar listcommands exec shell \n";
    142 usage += "  > set varname 'string'   # To set a variable, $varname \n";
     288usage += "  > set varname string   # To set a variable, $varname \n";
     289usage += "  > get newvarname varname # To set a newvariable, equal to $varname \n";
    143290usage += "  > setol varname patt     # Fills varname with object list \n";
    144291usage += "  > unset varname          # clear variable definition \n";
    145292usage += "  > echo string            # output string \n";
     293usage += "  > foreach varname string-list # Loop \n";
     294usage += "  > foreach varname i1:i2[:di]  # Integer loop  \n";
     295usage += "  > foreach varname f1:f2[:df]  # Float loop  \n";
     296usage += "  > end                         # end loops \n";
    146297usage += "  > listvars   # List of variable names and values \n";
    147298usage += "  > listcommands # List of all known commands \n";
     
    150301usage += "  > help <command_name>  # <command_name> usage info \n";
    151302usage += "  > helpwindow           # Displays help window \n";
     303usage += "  > timingon  timingoff traceon  traceoff \n";
    152304string grp = "Commands";
    153305RegisterHelp(kw, usage, grp);
     
    266418{
    267419if (!cl) return;
    268 interpmap[cl->Name()] = cl;
    269 }
     420interpmap[cl->Name()] = cl;}
    270421
    271422/* --Methode-- */
     
    286437int rc = 0;
    287438cmdtok tokens;
    288 if (s.length() < 1)  return(0);
    289 
    290 hist << s << endl;   // On enregistre les commandes
    291 
    292 if (s[0] == '#') {
    293   cout << "PIACmd::Interpret() Comment-Line:" << s << endl;
    294   return(0);
    295   }
     439CmdVarList::iterator it;
     440
     441// Removing leading blanks
     442size_t p,q,q2,l;
     443l = s.length();
     444if (l < 1)  return(0);
     445if (s[0] == '#') return(0); // si c'est un commentaire
     446p=s.find_first_not_of(" \t");
     447if (p < l) s = s.substr(p);
     448// else return(0);
     449
     450// On enregistre les commandes
     451if (histon) hist << s << endl;   
     452
     453
    296454string toks,kw;
    297 size_t p = s.find_first_not_of(" ");
    298 s = s.substr(p);
    299 p = 0;
    300 size_t q = s.find_first_of(" ");
    301 size_t l = s.length();
    302 
     455
     456// >>>> Substitution d'alias (1er mot)
     457int als = 0;
     458while (als < 2) {
     459  p = s.find_first_not_of(" ");
     460  s = s.substr(p);
     461  p = 0;
     462  q = s.find_first_of(" ");
     463  l = s.length();
     464  string w1 =  (q < l) ? s.substr(p,q-p) : s.substr(p);
     465  it = mAliases.find(w1);
     466  if (it != mAliases.end())  s =  (*it).second + s.substr(q);
     467  else als++;
     468  als++;
     469  }
     470
     471// >>>> Separating keyword
    303472if (q < l)
    304473  {  kw = s.substr(p,q-p);  toks = s.substr(q, l-q); }
    305474else { kw = s.substr(p,l-p);  toks = ""; }
    306475
     476// On verifie si nous sommes dans un bloc
     477if ( (curblk != NULL) && (kw != "foreach") ) { // On est dans un bloc
     478  if (kw != "end")   { curblk->AddLine(s);  return(0); }
     479  else {
     480    PIACmdBloc* curb = curblk;
     481    curblk = curb->Parent();
     482    felevel--;
     483    if (curblk  == NULL) {
     484       mImgApp->GetConsole()->SetPrompt("Cmd> ");
     485       //       cout << " *DBG* Executing bloc " << endl;
     486       curb->Execute();
     487       }
     488    else  {
     489      char prompt[64];
     490      sprintf(prompt, "foreach-%d> ", felevel);
     491      mImgApp->GetConsole()->SetPrompt(prompt);
     492      }
     493    return(0);
     494    }
     495  }
     496
     497// Nous ne sommes donc pas dans un bloc ....   
     498
     499// >>>> Variable substitution 
     500string s2="";
     501p = 0;
     502l = s.length();
     503string vn;
     504while (p < l) {
     505  q = s.find('$',p);
     506  //  cout << "DBG: " << s2 << " p= " << p << " q= " << q << " L= " << l << endl;
     507  if (q > l) break;
     508  if ((q>0) && (s[q-1] == '\\')) {   // Escape character \$
     509     s2 += (s.substr(p,q-1-p) + '$') ; p = q+1;
     510     continue;
     511     }
     512  if (q >= l-1) {
     513      cerr << " Syntax error !!! " << endl;
     514      return(0);
     515      }
     516  vn = "";
     517  if ( s[q+1] == '{' ) {  // Variable in the form ${name}
     518    q2 = s.find('}',q+1);
     519    if (q2 >= l) {
     520      cerr << " Syntax error !!! " << endl;
     521      return(0);
     522      }
     523    vn = s.substr(q+2,q2-q-2);
     524    q2++;
     525    }
     526  else if ( s[q+1] == '[' ) {  // Variable in the form $[varname]  -> This is $$varname
     527    q2 = s.find(']',q+1);
     528    if (q2 >= l) {
     529      cerr << " Syntax error !!! " << endl;
     530      return(0);
     531      }
     532    vn = s.substr(q+2,q2-q-2);
     533    it =  mVars.find(vn); 
     534    if ( (vn.length() < 1) || (it == mVars.end()) ) {
     535      cerr << " Error: Undefined variable " << vn << " ! " << endl;
     536      return(0);
     537      }
     538    vn = mVars[vn];
     539    q2++;
     540    }
     541  else {
     542    q2 = s.find_first_of(" .:/,]()$",q+1);
     543    if (q2 > l) q2 = l;
     544    vn = s.substr(q+1, q2-q-1);
     545    }
     546  it =  mVars.find(vn); 
     547  if ( (vn.length() < 1) || (it == mVars.end()) ) {
     548    cerr << " Error: Undefined variable " << vn << " ! " << endl;
     549    return(0);
     550    }
     551  s2 += (s.substr(p, q-p) + (*it).second);
     552  p = q2;
     553  }
     554if (p < l) s2 += s.substr(p);
     555
     556p = s2.find_first_not_of(" \t");
     557if (p < l) s2 = s2.substr(p);
     558
     559
     560// >>>> Separating keyword and tokens
     561q = s2.find(' ');
     562l = s2.length();
     563if (q < l)
     564  {  kw = s2.substr(0,q);  toks = s2.substr(q, l-q); }
     565else { kw = s2;  toks = ""; }
     566
    307567q = 0;
    308568while (q < l)  {
    309   p = toks.find_first_not_of(" ",q+1); // au debut d'un token
     569  p = toks.find_first_not_of(" \t",q+1); // au debut d'un token
    310570  if (p>=l) break;
    311   q = toks.find_first_of(" ",p); // la fin du token;
     571  q = toks.find_first_of(" \t",p); // la fin du token;
    312572  string token = toks.substr(p,q-p);
    313573  tokens.push_back(token);
    314574  }
    315575
    316 for(int k=0; k<tokens.size(); k++) { // On remplace les $varname par la valeur de la variable
    317   if ((tokens[k])[0] != '$')  continue;
    318   CmdVarList::iterator it = mVars.find(tokens[k].substr(1));
    319   if (it != mVars.end())  tokens[k] = (*it).second;
    320   }
     576
     577// Si c'est un foreach, on cree un nouveau bloc
     578if (kw == "foreach") {
     579  //     cout << " *DBG* We got a foreach... " << endl;
     580  PIACmdBloc* bloc = new PIACmdBloc(this, curblk, tokens);
     581  if (!bloc->CheckOK()) {
     582    cerr << "foreach syntax Error ! " << endl;
     583    delete bloc;
     584    return(0);
     585    }
     586  felevel++;
     587  if (curblk)  curblk->AddBloc(bloc);
     588  else {
     589    char prompt[64];
     590    sprintf(prompt, "foreach-%d> ", felevel);
     591    mImgApp->GetConsole()->SetPrompt(prompt);
     592    }
     593  curblk = bloc;
     594  //  cout << " *DBG* New Bloc created ... " << endl;
     595  return(0);
     596  }
     597
    321598
    322599// cout << "PIACmd::Do() DBG  KeyW= " << kw << " NbArgs= " << tokens.size() << endl;
     
    325602
    326603// >>>>>>>>>>> Commande d'interpreteur
    327 if (kw == "helpwindow") ShowHelpWindow();
     604else if (kw == "helpwindow") ShowHelpWindow();
    328605else if (kw == "help") {
    329606  if (tokens.size() > 0) cout << GetUsage(tokens[0]) << endl;
     
    336613else if (kw == "set") {
    337614  if (tokens.size() < 2) { cout << "PIACmd::Interpret() Usage: set varname string" << endl;  return(0); }
    338   string xx = "";
    339   for (int kk=1; kk<tokens.size(); kk++)  xx += (tokens[kk] + ' ');
     615  if ((tokens[0].length() < 1) || !isalpha((int)tokens[0][0]) ) {
     616    cerr << "PIACmd::Interpret()/Error Variable name should start with alphabetic" << endl;
     617    return(0);
     618    }
     619  string xx = tokens[1];
     620  for (int kk=2; kk<tokens.size(); kk++)  xx += (' ' + tokens[kk] );
    340621  mVars[tokens[0]] = xx;
    341622  }
     623
     624else if (kw == "getvar") {
     625  if (tokens.size() < 2) { cout << "PIACmd::Interpret() Usage: getvar newvarname varname" << endl;  return(0); }
     626  it = mVars.find(tokens[1]);
     627  if (it == mVars.end()) {
     628    cerr << "Error - No " << tokens[1] << " Variable " << endl;
     629    return(0);
     630    }
     631  if ((tokens[0].length() < 1) || !isalpha((int)tokens[0][0]) ) {
     632    cerr << "PIACmd::Interpret()/Error Variable name should start with alphabetic" << endl;
     633    return(0);
     634    }
     635  mVars[tokens[0]] = (*it).second;
     636  }
     637
     638else if (kw == "alias") {
     639  if (tokens.size() < 2) { cout << "PIACmd::Interpret() Usage: alias aliasname string" << endl;  return(0); }
     640  if ((tokens[0].length() < 1) || !isalpha((int)tokens[0][0]) ) {
     641    cerr << "PIACmd::Interpret()/Error alias name should start with alphabetic" << endl;
     642    return(0);
     643    }
     644  string xx = tokens[1];
     645  for (int kk=2; kk<tokens.size(); kk++)  xx += (' ' + tokens[kk]);
     646  mAliases[tokens[0]] = xx;
     647  }
     648
    342649else if (kw == "setol") {
    343650  if (tokens.size() < 2) { cout << "PIACmd::Interpret() Usage: setol varname objnamepattern" << endl;  return(0); }
     651  if ((tokens[0].length() < 1) || !isalpha((int)tokens[0][0]) ) {
     652    cerr << "PIACmd::Interpret()/Error Variable name should start with alphabetic" << endl;
     653    return(0);
     654    }
    344655  vector<string> ol;
    345   mObjMgr->GetObjList(tokens[1], ol);
    346   string vol = "";
    347   for (int kk=0; kk<ol.size(); kk++)  vol += (ol[kk] + ' ');
     656  mObjMgr->GetObjList(tokens[1], ol);
     657  string vol;
     658  if (ol.size() < 1) vol = "";
     659  else {
     660     vol = ol[0];
     661    for (int kk=1; kk<ol.size(); kk++)  vol += (' ' + ol[kk]);
     662    }
    348663  mVars[tokens[0]] = vol;
    349664  }
     
    388703else if (kw == "exec") {
    389704  if (tokens.size() < 1) { cout << "PIACmd::Interpret() Usage: exec filename" << endl;  return(0); }
    390   ExecFile(tokens[0]);
     705  ExecFile(tokens[0], tokens);
    391706  }
    392707else if (kw == "shell") {
     
    444759
    445760/* --Methode-- */
    446 int PIACmd::ExecFile(string& file)
     761int PIACmd::ExecFile(string& file, vector<string>& args)
    447762{
    448763char line_buff[512];
     
    454769  return(0);
    455770  }
    456  
    457 hist << "### Executing commands from " << file << endl;
     771
     772// hist << "### Executing commands from " << file << endl;
     773
     774// Setting $0 ... $99 variables
     775int k;
     776CmdVarList::iterator it;
     777char buff[32];
     778// First, we clear all previous values
     779string vn="#";
     780it = mVars.find(vn);
     781if (it != mVars.end())  mVars.erase(it);
     782for(k=0; k<99; k++) {   
     783  sprintf(buff,"%d",k);
     784  vn = buff;
     785  it = mVars.find(vn);
     786  if (it != mVars.end())  mVars.erase(it);
     787  }
     788// We then set them
     789vn="#";
     790sprintf(buff,"%d",(int)args.size());
     791mVars[vn] = buff;
     792for(k=0; k<args.size(); k++) {   
     793  sprintf(buff,"%d",k);
     794  vn = buff;
     795  mVars[vn] = args[k];
     796  }
     797
    458798if (trace) {
    459799  mImgApp->GetConsole()->AddStr("### Executing commands from ", PIVA_Magenta);
     
    462802  }
    463803
     804histon = false;
    464805while (fgets(line_buff,511,fip) != NULL)
    465806  {
     
    469810  Interpret(line);
    470811  }
    471 hist << "### End of Exec( " << file << " ) " << endl;
     812histon = false;
     813
     814// hist << "### End of Exec( " << file << " ) " << endl;
    472815if (trace) {
    473816  mImgApp->GetConsole()->AddStr("### End of Exec( ", PIVA_Magenta);
  • trunk/SophyaPI/PIext/piacmd.h

    r333 r349  
    4545class Timer;
    4646class PDynLinkMgr;
    47 class PIAHelpWind;
     47
     48class PIAHelpWind; // Fenetre d'aide en ligne
     49class PIACmdBloc;
    4850
    4951// ---------------------------------------------------------------------
     
    5355// ---------------------------------------------------------------------
    5456
    55 class PIAHelpWind;   // Fenetre d'aide en ligne
    5657
    5758class PIACmd : public CmdInterpreter  {
     
    7475  virtual int           ExecuteCommandLine(string& line);
    7576  virtual int           ExecuteCommand(string& keyw, vector<string>& args);
    76   virtual int           ExecFile(string& file);
     77  virtual int           ExecFile(string& file, vector<string>& args);
    7778
    7879  virtual string&       GetUsage(const string& kw);
     
    114115//  Pour stocker les variables definies par l'interpreteur
    115116  typedef map<string, string, less<string> > CmdVarList;
    116   CmdVarList mVars;    // Liste des variables
     117  CmdVarList mVars;     // Liste des variables
     118  CmdVarList mAliases;  // Liste des alias
     119
     120  PIACmdBloc * curblk;  // Bloc de commande courant (foreach, ...)
     121  int felevel;          // foreah level
     122
    117123  ofstream hist;       //  History file
     124  bool histon;        //  True ->  history file
    118125  bool trace;          // Trace flag
    119126  bool timing;         // Display CPU Time
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r347 r349  
    533533}
    534534
     535/* --Methode-- */
     536void PIStdImgApp::AddText(string const & txt, double xp, double yp)
     537{
     538if (!mLastWdg)  return;
     539PIElDrawer *eld=NULL;
     540PIScDrawWdg* sdw=NULL;
     541PIDraw3DWdg* w3d=NULL;
     542PIImage* imgw;
     543switch(mLastWdg->kind()) {
     544  case PIScDrawWdg::ClassId :
     545    sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
     546    if (sdw) eld = sdw->BaseDrawer();
     547    break;
     548  case PIDraw3DWdg::ClassId :
     549    w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
     550    if (w3d) eld = w3d->BaseDrawer();
     551    break;
     552  case PIImage::ClassId :
     553    imgw = dynamic_cast<PIImage *>(mLastWdg);
     554    if (imgw) eld = imgw->MyElDrawer();
     555    break;
     556  default :
     557    break;
     558  }
     559if (eld) {
     560  if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )     eld->SetFontAtt(mFSz, mFAtt);
     561  eld->ElAddText(xp,yp,txt.c_str(),mFCol);
     562  eld->Refresh();
     563  }
     564}
    535565
    536566/* --Methode-- */
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r347 r349  
    5353     int  DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", int oid=0);
    5454     int  Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0);
     55
     56  //  Fonction d'ajout de texte (provisoire - Aout 99)
     57     void AddText(string const & txt, double xp, double yp);
     58
    5559
    5660     void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
  • trunk/SophyaPI/PIext/servnobjm.cc

    r345 r349  
    16521652gi.a2 = PI_NotDefFontSize;
    16531653gi.a1 = PI_NotDefFontAtt;
    1654 GrAlines["deffont"] = gi;
     1654GrAfonts["deffont"] = gi;
    16551655
    16561656gi.a2 = PI_NormalSizeFont;
    16571657gi.a1 = PI_RomanFont;
    1658 GrAlines["normalfont"] = gi;
     1658GrAfonts["normalfont"] = gi;
    16591659gi.a1 = PI_BoldFont;
    1660 GrAlines["boldfont"] = gi;
     1660GrAfonts["boldfont"] = gi;
    16611661gi.a1 = PI_ItalicFont;
    1662 GrAlines["italicfont"] = gi;
     1662GrAfonts["italicfont"] = gi;
    16631663gi.a2 = PI_SmallSizeFont;
    16641664gi.a1 = PI_RomanFont;
    1665 GrAlines["smallfont"] = gi;
     1665GrAfonts["smallfont"] = gi;
    16661666gi.a1 = PI_BoldFont;
    1667 GrAlines["smallboldfont"] = gi;
     1667GrAfonts["smallboldfont"] = gi;
    16681668gi.a1 = PI_ItalicFont;
    1669 GrAlines["smallitalicfont"] = gi;
     1669GrAfonts["smallitalicfont"] = gi;
    16701670gi.a2 = PI_BigSizeFont;
    16711671gi.a1 = PI_RomanFont;
    1672 GrAlines["bigfont"] = gi;
     1672GrAfonts["bigfont"] = gi;
    16731673gi.a1 = PI_BoldFont;
    1674 GrAlines["bigboldfont"] = gi;
     1674GrAfonts["bigboldfont"] = gi;
    16751675gi.a1 = PI_ItalicFont;
    1676 GrAlines["bigitalicfont"] = gi;
     1676GrAfonts["bigitalicfont"] = gi;
    16771677gi.a2 = PI_HugeSizeFont;
    16781678gi.a1 = PI_RomanFont;
    1679 GrAlines["hugefont"] = gi;
     1679GrAfonts["hugefont"] = gi;
    16801680gi.a1 = PI_BoldFont;
    1681 GrAlines["hugeboldfont"] = gi;
     1681GrAfonts["hugeboldfont"] = gi;
    16821682gi.a1 = PI_ItalicFont;
    1683 GrAlines["hugeitalicfont"] = gi;
     1683GrAfonts["hugeitalicfont"] = gi;
    16841684
    16851685
Note: See TracChangeset for help on using the changeset viewer.