Changeset 1297 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Nov 7, 2000, 2:08:10 PM (25 years ago)
Author:
ercodmgr
Message:

1-/ complete color map in pihisto2d
2-/ introcution de la notion de module additionnel

dans le C++EXECUTOR cmv 7/11/2000

Location:
trunk/SophyaPI/PIext
Files:
6 edited

Legend:

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

    r1291 r1297  
    1919mIncList.resize(0);
    2020mCallArgs.resize(0);
     21
     22mIncImportList.resize(0);
     23mModuleImportList.resize(0);
     24
     25// La liste de tous les modules que l'on peut ajouter
     26mModuleImportDefaultList.resize(0);
     27mModuleImportDefaultList.push_back("Samba");
     28mModuleImportDefaultList.push_back("SkyMap");
     29mModuleImportDefaultList.push_back("PMixer");
    2130
    2231// Gestion des fichiers par default dans TmpDir
     
    7483
    7584kw = "c++include";
    76 usage = "c++include: give personnal includes to be used\n";
     85usage = "c++include: add personnal includes to be used by executor\n";
    7786usage+= "Usage: c++include myinc1.h myinc2.h ...\n";
    78 usage+= "       c++include -? : give current include files\n";
    79 usage+= "       c++include    : reset current include files\n";
    80 usage+= "Warning: to be used before c++create... c++exec...";
     87usage+= "       c++include -? : list current additionnal include files\n";
     88usage+= "       c++include    : reset to no additionnal include files\n";
     89usage+= "Warning: to be used before c++create c++compile c++exec...";
    8190mpiac->RegisterCommand(kw, usage, this, hgrp);
    8291
    8392kw = "c++compileopt";
    84 usage = "c++compileopt: give additionnal compile options\n";
     93usage = "c++compileopt: add personnal compile options\n";
    8594usage+= "Usage: c++compileopt -g -O5 -IMy_Inc_Dir ...\n";
    86 usage+= "       c++compileopt -? : give current compile options\n";
    87 usage+= "       c++compileopt    : reset current compile options\n";
    88 usage+= "Warning: to be used before c++compile";
     95usage+= "       c++compileopt -? : list current additionnal compile options\n";
     96usage+= "       c++compileopt    : reset to no additionnal compile options\n";
     97usage+= "Warning: to be used before c++create c++compile c++exec ...";
    8998mpiac->RegisterCommand(kw, usage, this, hgrp);
    9099
    91100kw = "c++linkopt";
    92 usage = "c++linkopt: give additionnal link options\n";
     101usage = "c++linkopt: add personnal link options\n";
    93102usage+= "Usage: c++linkopt -g -O5 ...\n";
    94 usage+= "       c++linkopt -? : give current link options\n";
    95 usage+= "       c++linkopt    : reset current link options\n";
    96 usage+= "Warning: to be used before c++compile";
     103usage+= "       c++linkopt -? : list current additionnal link options\n";
     104usage+= "       c++linkopt    : reset to no additionnal link options\n";
     105usage+= "Warning: to be used before c++create c++compile c++exec ...";
    97106mpiac->RegisterCommand(kw, usage, this, hgrp);
    98107
    99108kw = "c++mylibs";
    100 usage = "c++mylibs: give additionnal libraries\n";
     109usage = "c++mylibs: add personnal libraries\n";
    101110usage+= "Usage: c++mylibs -LMy_Lib_Dir -lmylib1 -lmylib2 ...\n";
    102 usage+= "       c++mylibs -? : give current additionnal libraries\n";
    103 usage+= "       c++mylibs    : reset current additionnal libraries\n";
    104 usage+= "Warning: to be used before c++compile";
    105 mpiac->RegisterCommand(kw, usage, this, hgrp);
    106 
     111usage+= "       c++mylibs -? : list current additionnal libraries\n";
     112usage+= "       c++mylibs    : reset to no additionnal libraries\n";
     113usage+= "Warning: to be used before c++create c++compile c++exec ...";
     114mpiac->RegisterCommand(kw, usage, this, hgrp);
     115
     116kw = "c++import";
     117usage = "c++import: Sophya additionnal modules to be use in C++ executor\n";
     118usage+= "Usage: c++import module1 ... : set list of modules to be used by executor\n";
     119usage+= "       c++import all : set all modules known by executor\n";
     120usage+= "       c++import     : reset to no additionnal module\n";
     121usage+= "       c++import -?  : list modules currently used in executor\n";
     122usage+= "       c++import -?? : list of available modules for executor\n";
     123usage+= "Warning: to be used before c++create c++compile c++exec ...";
     124mpiac->RegisterCommand(kw, usage, this, hgrp);
    107125
    108126kw = "c++prtlevel";
     
    202220  FillLinkLibs(tokens);
    203221
     222} else if(kw == "c++import") {
     223  if(tokens.size()==1) {
     224    if(tokens[0]=="-?")
     225      {cout<<"c++import "<<GetModuleImport()<<endl; return(0);}
     226    if(tokens[0]=="-??") {
     227      cout<<"c++import possibilities :"<<endl;
     228      if(mModuleImportDefaultList.size()>0) {
     229        for(uint_4 i=0;i<mModuleImportDefaultList.size();i++)
     230          cout<<" "<<mModuleImportDefaultList[i];
     231        cout<<endl;
     232      }
     233      return(0);
     234    }
     235  }
     236  FillModuleImport(tokens);
     237
    204238} else if(kw == "c++prtlevel") {
    205239  if(tokens.size()==1) if(tokens[0]=="-?")
     
    291325void CxxExecutor::PutInclude(ofstream& os)
    292326{
    293 os<<"#include \"machdefs.h\""<<endl
    294   <<endl
    295 
    296   <<"//---- System et stdc++ include files"<<endl
     327os<<"#include \"machdefs.h\""<<endl<<endl;
     328
     329os<<"//---- System et stdc++ include files"<<endl
    297330  <<"#include <stdio.h>"<<endl
    298331  <<"#include <stdlib.h>"<<endl
     
    323356  <<"#include \"nobjmgr.h\""<<endl
    324357  <<"#include \"servnobjm.h\""<<endl
    325   <<endl
    326 
     358  <<endl;
     359
     360os<<"//---- Include files from additionnal modules"<<endl;
     361if(mIncImportList.size()>0)
     362  for(uint_4 i=0;i<mIncImportList.size();i++)
     363    os<<"#include \""<<mIncImportList[i]<<"\""<<endl;
     364os<<endl;
     365
     366os<<"//---- Objects and variables saving"<<endl
    327367  <<"#define KeepObj(obj) ___nomobj = #obj; omg.AddObj(obj,___nomobj);"<<endl
    328368  <<"#define KeepVar(var) ___nomobj = #var; omg.GetVarList().Get(___nomobj) = var ;"<<endl
     
    708748return mMyLibs;
    709749}
     750
     751/* --Methode-- */
     752void CxxExecutor::FillModuleImport(vector<string>& import)
     753{
     754mModuleImportList.resize(0);
     755mIncImportList.resize(0);
     756if(import.size()<1) return;
     757
     758if(import[0]=="all" || import[0]=="All" || import[0]=="ALL") {
     759  mModuleImportList = mModuleImportDefaultList;
     760} else {
     761  for(uint_4 i=0;i<import.size();i++) mModuleImportList.push_back(import[i]);
     762}
     763
     764// Set additionnal Includes
     765if(mModuleImportList.size()>0)
     766  for(uint_4 i=0;i<mModuleImportList.size();i++) {
     767    if(     mModuleImportList[i]=="Samba")  mIncImportList.push_back("samba.h");
     768    else if(mModuleImportList[i]=="SkyMap") mIncImportList.push_back("skymap.h");
     769    else if(mModuleImportList[i]=="PMixer") mIncImportList.push_back("pmixer.h");
     770}
     771
     772return;
     773}
     774
     775void CxxExecutor::FillModuleImport(string& import)
     776{
     777mModuleImportList.resize(0);
     778vector<string> vsimport;
     779FillVStringFrString(import,vsimport,' ');
     780FillModuleImport(vsimport);
     781}
     782
     783string CxxExecutor::GetModuleImport(void)
     784{
     785string dum = "";
     786if(mModuleImportList.size()<1) return dum;
     787for(uint_4 i=0;i<mModuleImportList.size();i++) dum += mModuleImportList[i] + " ";
     788return dum;
     789}
  • trunk/SophyaPI/PIext/cxxexecutor.h

    r1289 r1297  
    6767  string GetLinkLibs(void);
    6868
     69  void FillModuleImport(vector<string>& import);
     70  void FillModuleImport(string& import);
     71  string GetModuleImport(void);
     72
    6973private:
    7074  string mUserCodeFn;
     
    7680  vector<string> mCallArgs;
    7781
     82  // Import des modules
     83  vector<string> mIncImportList;
     84  vector<string> mModuleImportList;
     85  vector<string> mModuleImportDefaultList;
     86
     87
    7888  string mDefTmp;
    7989  string mDefRoot;
  • trunk/SophyaPI/PIext/cxxexecwin.cc

    r1285 r1297  
    289289  xtext = 7*bsx;
    290290  szx = (int)(xtext+1.5*bsx+3*spx);
    291   szy = 6*bsy+7*spy;
     291  szy = 7*bsy+8*spy;
    292292  SetSize(szx, szy);
    293293
     
    326326  mText[3] = new PIText(this,"LinkLib",xtext,bsy,px,py);
    327327  mText[3]->SetText("");
     328
     329  px = spx;
     330  py += spy+bsy;
     331  mLab[4] = new PILabel(this,"Modules",1.5*bsx,bsy,px,py);
     332  px += (int)(1.5*bsx+spx);
     333  mText[4] = new PIText(this,"ModImp",xtext,bsy,px,py);
     334  mText[4]->SetText("");
    328335
    329336// Creation de bouton d'action
     
    353360  delete mTit;
    354361  int i;
    355   for(i=0; i<4; i++) delete mLab[i];
     362  for(i=0; i<5; i++) delete mLab[i];
    356363  for(i=0; i<3; i++) delete mBut[i];
    357   for(i=0; i<4; i++) delete mText[i];
     364  for(i=0; i<5; i++) delete mText[i];
    358365}
    359366
     
    365372  mText[2]->SetText(cxxex->GetLinkOpt());
    366373  mText[3]->SetText(cxxex->GetLinkLibs());
     374  mText[4]->SetText(cxxex->GetModuleImport());
    367375  PIWindow::Show();
    368376}
     
    382390      opt = mText[3]->GetText();
    383391      cxxex->FillLinkLibs(opt);
     392      opt = mText[4]->GetText();
     393      cxxex->FillModuleImport(opt);
    384394      break;
    385395    case 600:    // Bouton Get Options
     
    388398      mText[2]->SetText(cxxex->GetLinkOpt());
    389399      mText[3]->SetText(cxxex->GetLinkLibs());
     400      mText[4]->SetText(cxxex->GetModuleImport());
    390401      break;
    391402    case 700:   // Bouton Dismiss - On cache la fenetre
  • trunk/SophyaPI/PIext/cxxexecwin.h

    r1269 r1297  
    5454  CxxExecutor * cxxex;
    5555  PILabel  * mTit;
    56   PILabel  * mLab[4];
     56  PILabel  * mLab[5];
    5757  PIButton * mBut[3];
    58   PIText   * mText[4];
     58  PIText   * mText[5];
    5959};
    6060
  • trunk/SophyaPI/PIext/pihisto2d.cc

    r1091 r1297  
    611611SetSize(wszx, wszy);
    612612
    613 // menus bar
     613// menu du style de display des bins
    614614  int cpx = 2*spx, cpy = 2*spy;
    615615mOPop[0] = new PIOptMenu(this, "optmen-h2d-1" ,2*bsx,bsy,cpx,cpy);
     
    621621mOPop[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    622622
     623// Menu du choix de la dynamique
    623624  cpy += bsy+spy;
    624625mOPop[1] = new PIOptMenu(this, "optmen-h2d-2",2*bsx,bsy,cpx,cpy);
     
    628629mOPop[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    629630
     631// Menu du choix des couleurs
    630632  cpy += bsy+spy;
    631633mOPop[2] = new PIOptMenu(this, "optmen-h2d-3",2*bsx,bsy,cpx,cpy);
    632 mOPop[2]->AppendItem("Black&White", 6301);
    633 mOPop[2]->AppendItem("Grey32"    , 6302);
    634 mOPop[2]->AppendItem("GreyInv32" , 6303);
    635 mOPop[2]->AppendItem("ColRJ32"   , 6304);
    636 mOPop[2]->AppendItem("ColBR32"   , 6305);
    637 mOPop[2]->AppendItem("ColRV32"   , 6306);
    638 mOPop[2]->AppendItem("Grey128"   , 6307);
    639 mOPop[2]->AppendItem("GreyInv128", 6308);
    640 mOPop[2]->AppendItem("ColRJ128"  , 6309);
    641 mOPop[2]->AppendItem("ColBR128"  , 6310);
    642 mOPop[2]->AppendItem("Col16"     , 6311);
    643 sdum = "Black&White"; mOPop[2]->SetValueStr(sdum);
     634mOPop[2]->AppendItem("Black&White",7000);
     635mCasc[0] = new PIMenu(mOPop[2]->Menu(), "PIStd-128Col");
     636mCasc[1] = new PIMenu(mOPop[2]->Menu(), "MIDAS-CMap");
     637int kcc,nsct1=5,nsct2=9,nsct3=PIColorMap::NumberStandardColorMaps()-1;
     638for(kcc=0; kcc<nsct1; kcc++)
     639  mOPop[2]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
     640for(kcc=nsct1; kcc<nsct2; kcc++)
     641  mCasc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
     642mOPop[2]->AppendPDMenu(mCasc[0]);
     643for(kcc=nsct2; kcc<nsct3; kcc++)
     644  mCasc[1]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
     645mOPop[2]->AppendPDMenu(mCasc[1]);
     646for(kcc=nsct3; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
     647mOPop[2]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
     648mOPop[2]->SetValue(7000);
    644649mOPop[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    645650
    646 // Labels et zone de saisie texte
     651// Labels et zones de saisie texte
    647652  cpy += 2*(bsy+spy);
    648653mLab[0] = new PILabel(this, "     Dyn: ",bsx,bsy,cpx,cpy);
     
    696701int i;
    697702if(dbg) printf("H2WinArg::~H2WinArg %lx\n",(long)this);
     703for(i=0;i<2;i++) delete mCasc[i];
    698704for(i=0;i<3;i++) delete mOPop[i];
    699705for(i=0;i<4;i++) delete mBut[i];
     
    706712void H2WinArg::SetText()
    707713//
    708 //      Gestion des fenetres de saisie de texte.
     714//      Gestion des fenetres de saisie de texte et des pop-menus.
    709715//--
    710716{
     
    726732else if(mTypScal==1) { sdum="Log10";    mOPop[1]->SetValueStr(sdum);}
    727733
    728 if(!mFgCol)                       { sdum="Black&White";mOPop[2]->SetValueStr(sdum);}
     734if(!mFgCol) {mOPop[2]->SetValue(7000);}
    729735else {
    730   if(mCmap==CMAP_GREY32)          { sdum="Grey32";     mOPop[2]->SetValueStr(sdum);}
    731   else if(mCmap==CMAP_GREYINV32)  { sdum="GreyInv32";  mOPop[2]->SetValueStr(sdum);}
    732   else if(mCmap==CMAP_COLRJ32)    { sdum="ColRJ32";    mOPop[2]->SetValueStr(sdum);}
    733   else if(mCmap==CMAP_COLBR32)    { sdum="ColBR32";    mOPop[2]->SetValueStr(sdum);}
    734   else if(mCmap==CMAP_COLRV32)    { sdum="ColRV32";    mOPop[2]->SetValueStr(sdum);}
    735   else if(mCmap==CMAP_GREY128)    { sdum="Grey128";    mOPop[2]->SetValueStr(sdum);}
    736   else if(mCmap==CMAP_GREYINV128) { sdum="GreyInv128"; mOPop[2]->SetValueStr(sdum);}
    737   else if(mCmap==CMAP_COLRJ128)   { sdum="ColRJ128";   mOPop[2]->SetValueStr(sdum);}
    738   else if(mCmap==CMAP_COLBR128)   { sdum="ColBR128";   mOPop[2]->SetValueStr(sdum);}
    739   else if(mCmap==CMAP_COL16)      { sdum="Col16";      mOPop[2]->SetValueStr(sdum);}
     736  for(int kk=0;kk<PIColorMap::NumberStandardColorMaps();kk++)
     737    if(mCmap == PIColorMap::GetStandardColorMapId(kk))
     738      {mOPop[2]->SetValue(7001+kk); break;}
    740739}
    741740
     
    788787else if (opt == 6202) { mTypScal = 1; }
    789788
    790 else if (opt == 6301) { mFgCol = false; }
    791 else if (opt == 6302) { mFgCol = true;  mCmap = CMAP_GREY32; }
    792 else if (opt == 6303) { mFgCol = true;  mCmap = CMAP_GREYINV32; }
    793 else if (opt == 6304) { mFgCol = true;  mCmap = CMAP_COLRJ32; }
    794 else if (opt == 6305) { mFgCol = true;  mCmap = CMAP_COLBR32; }
    795 else if (opt == 6306) { mFgCol = true;  mCmap = CMAP_COLRV32; }
    796 else if (opt == 6307) { mFgCol = true;  mCmap = CMAP_GREY128; }
    797 else if (opt == 6308) { mFgCol = true;  mCmap = CMAP_GREYINV128; }
    798 else if (opt == 6309) { mFgCol = true;  mCmap = CMAP_COLRJ128; }
    799 else if (opt == 6310) { mFgCol = true;  mCmap = CMAP_COLBR128; }
    800 else if (opt == 6311) { mFgCol = true;  mCmap = CMAP_COL16; }
     789else if (opt == 7000) { mFgCol = false; }
     790
     791else if (opt >= 7001 && opt <8000) {
     792  int k  = opt-7001;
     793  mFgCol = true;
     794  mCmap  = PIColorMap::GetStandardColorMapId(k);
     795}
    801796
    802797else if (opt == 6401) mFPoints = mPScal->GetValue()/100.;
  • trunk/SophyaPI/PIext/pihisto2d.h

    r330 r1297  
    9292
    9393  PIOptMenu * mOPop[3];
     94  PIMenu    * mCasc[2];
    9495  PIButton  * mBut[4];
    9596  PILabel   * mLab[4];
Note: See TracChangeset for help on using the changeset viewer.