Changeset 1124 in Sophya


Ignore:
Timestamp:
Aug 1, 2000, 1:05:06 PM (25 years ago)
Author:
ercodmgr
Message:

Ajout PIOptMenuGen::AppendPDMenu() - Possibilite d'avoir des sous-menu

ds le menu d'une Option-Widget

Suite des modifications d'ajout de tables de couleurs - Adaptation

de PIImageTools et PIDrawerTools

Amelioration de la table standard ColRV32

Reza 1/8/2000

Location:
trunk/SophyaPI/PI
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/picmap.cc

    r1122 r1124  
    2222//--
    2323
    24 #define  MXMAPIDS   15
     24#define  MXMAPIDS   16
    2525static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
    26                                       256, 256, 256, 256, 256 };
    27 static   const char*  MapNoms[MXMAPIDS]  = {"Grey32","InvGrey32","ColRJ32","ColBR32",
    28                                "ColRV32", "Grey128", "InvGrey128", "ColRJ128",
    29                                "ColBR128", "Col16",
    30                                "MIDAS_Pastel", "MIDAS_Heat", "MIDAS_Rainbow3",
    31                                "MIDAS_BlueRed", "MIDAS_BlueWhite" };
    32 static   CMapId MapIds[MXMAPIDS] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
    33                                CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128,
    34                                CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, 
    35                                CMAP_COL16,
    36                                CMAP_MIDAS_Pastel, CMAP_MIDAS_Heat, CMAP_MIDAS_Rainbow3,
    37                                CMAP_MIDAS_BlueRed, CMAP_MIDAS_BlueWhite } ;
     26                                      256, 256, 256, 256, 256, 256 };
     27
     28// Tables de couleurs :
     29// 5 Standard PI , 32  couleurs
     30// 4 Standard PI , 128 couleurs
     31// 6 MIDAS , 256 couleurs
     32// 1 Standard PI 16 couleurs
     33
     34static   const char*  MapNoms[MXMAPIDS]  = {
     35                      "Grey32","InvGrey32","ColRJ32","ColBR32","ColRV32",
     36                      "Grey128","InvGrey128","ColRJ128","ColBR128",
     37                      "MIDAS_Pastel","MIDAS_Heat","MIDAS_Rainbow3",
     38                      "MIDAS_BlueRed","MIDAS_BlueWhite","MIDAS_RedWhite",
     39                      "Rainbow16"};
     40
     41static   CMapId MapIds[MXMAPIDS] = {
     42                      CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32, CMAP_COLBR32, CMAP_COLRV32,
     43                      CMAP_GREY128, CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, 
     44                      CMAP_MIDAS_Pastel, CMAP_MIDAS_Heat, CMAP_MIDAS_Rainbow3,
     45                      CMAP_MIDAS_BlueRed, CMAP_MIDAS_BlueWhite, CMAP_MIDAS_RedWhite,
     46                      CMAP_COL16 } ;
    3847
    3948static   int mColTNums[8192];   // Max 8192 tables differentes pour le moment 
     
    4150
    4251static   int NMaxTableAuto = 0;
    43 static   PIColorMap* mMaps[15] = {NULL, NULL, NULL, NULL, NULL,
     52static   PIColorMap* mMaps[MXMAPIDS] = {
    4453                                  NULL, NULL, NULL, NULL, NULL,
    45                                   NULL, NULL, NULL, NULL, NULL  };
     54                                  NULL, NULL, NULL, NULL, NULL,
     55                                  NULL, NULL, NULL, NULL, NULL,
     56                                  NULL  };
    4657
    4758int  PIColorMap::NumberStandardColorMaps()
     
    308319  case CMAP_COLRV32 :
    309320    for( i=0; i<32; i++) {
    310       if (i < 8) {
    311         mycol.green = 15000+(i*5000); mycol.blue = 0; 
    312         mycol.red = 15000+(i*5000); }
     321      if (i < 9) {
     322        mycol.green = i*5000; mycol.blue = 0; 
     323        mycol.red = i*6000; }
     324      else if (i < 15) {
     325        mycol.green = 40000;
     326        mycol.blue = 0; 
     327        mycol.red = 50000+(i-9)*1000;
     328      }
    313329      else if (i < 21) {
    314         mycol.green = 50000-(i-7)*5000;   
    315         if (mycol.green < 0)  mycol.green = 0;
     330        mycol.green = 40000-(i-15)*8000;
    316331        mycol.blue = 0;
    317         mycol.red = 53535+(i-8)*1000;  }
     332        mycol.red = 57535+(i-15)*1600;  }
    318333      else {
    319334        mycol.green = 0;  mycol.red = 65535;
     
    388403      break;
    389404
    390   case CMAP_MIDAS_Pastel :   // Les valeurs correspondent a  je ne sais quel table MIDAS
     405  case CMAP_MIDAS_Pastel :   //
    391406  case CMAP_MIDAS_Heat :      // A faire  pour CMAP_MIDAS_Pastel CMAP_MIDAS_Heat
    392407  case CMAP_MIDAS_Rainbow3 :  //    A faire  pour Heat Rainbow3 BlueRed BlueWhite
    393408  case CMAP_MIDAS_BlueRed :   //    BlueRed -> idl11
    394409  case CMAP_MIDAS_BlueWhite : //    BlueWhite -> blulut.lutlis
     410  case CMAP_MIDAS_RedWhite :  // rouge-rose-blanc je ne sais quelle table MIDAS ??   
    395411   {
    396     static float rgb_r[256] = {
     412   float rgb_r[256] = {
    3974130, 0, 0.01961, 0.0549, 0.08627, 0.1098, 0.13725, 0.15686, 0.18039, 0.2,
    3984140.21569, 0.23529, 0.25098, 0.26275, 0.28235, 0.29412, 0.30588, 0.31765,
     
    4274430.98824, 0.99216, 0.99216, 0.99216, 0.99216, 0.99608, 0.99608, 0.99608,
    4284440.99608, 1, 1 };
    429     static float rgb_g[256] = {
     445    float rgb_g[256] = {
    4304460, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784,
    4314470.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176,
     
    4604760.89804, 0.9098, 0.91765, 0.92941, 0.94118, 0.94902, 0.96078, 0.97255,
    4614770.98039, 0.99216 };
    462     static float rgb_b[256] = {
     478    float rgb_b[256] = {
    4634790, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784,
    4644800.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176,
  • trunk/SophyaPI/PI/picmap.h

    r1122 r1124  
    2222 CMAP_COLRJ128    = 8,     // 128 couleurs du rouge au jaune/blanc
    2323 CMAP_COLBR128    = 9,     // 128 couleurs du bleu au rouge
    24  CMAP_COL16       = 10,    // 16 Couleurs Arcenciel
    2524
    26  // Tables de couleur importees de MIDAS
     25 // Tables de couleur importees de MIDAS   256 couleurs
    2726 CMAP_MIDAS_Pastel    = 101,   // Bleu-Violet-Rouge-Jaune
    2827 CMAP_MIDAS_Heat      = 102,   // Noir-Rouge-Orange-Blanc
    2928 CMAP_MIDAS_Rainbow3  = 103,   // Noir-Bleu-Vert-Jaune-Rouge-Violet-Blanc
    3029 CMAP_MIDAS_BlueRed   = 104,   // Bleu-Violet-Rouge
    31  CMAP_MIDAS_BlueWhite = 105    // Noir-Bleu-Blanc
     30 CMAP_MIDAS_BlueWhite = 105,   // Noir-Bleu-Blanc
     31 CMAP_MIDAS_RedWhite  = 106,   // Noir-Rouge-Rose-Blanc
     32
     33 //  Table simple a 16 couleurs
     34 CMAP_COL16       = 999        // 16 Couleurs Arcenciel
    3235 };
    3336
  • trunk/SophyaPI/PI/pidrwtools.cc

    r684 r1124  
    186186mOpt[1] = new PIOptMenu(this, "bwt-opt-1", bsx*1.75, bsy, cpx, cpy);
    187187mOpt[1]->AppendItem("No.CMap", 200);
    188 mOpt[1]->AppendItem("Grey32", 201);
    189 mOpt[1]->AppendItem("GreyInv32", 202);
    190 mOpt[1]->AppendItem("ColRJ32", 203);
    191 mOpt[1]->AppendItem("ColBR32", 204);
    192 mOpt[1]->AppendItem("ColRV32", 205);
    193 mOpt[1]->AppendItem("Grey128", 206);
    194 mOpt[1]->AppendItem("GreyInv128", 207);
    195 mOpt[1]->AppendItem("ColRJ128", 208);
    196 mOpt[1]->AppendItem("ColBR128", 209);
    197 mOpt[1]->AppendItem("Col16", 210);
     188int kcc;
     189//  Groupement des tables de couleurs
     190mCasc[0] = new PIMenu(mOpt[1]->Menu(), "PIStd-128Col");
     191mCasc[1] = new PIMenu(mOpt[1]->Menu(), "MIDAS-CMap");
     192
     193int nsct1,nsct2,nsct3;
     194//  D'abord les tables standard de PI  32 couleurs
     195nsct1 = 5;   // Les 5 premieres tables
     196for(kcc=0; kcc<nsct1; kcc++)
     197  mOpt[1]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     198//  Ensuite les tables standard de PI  128 couleurs
     199nsct2 = 9;   // Les 4 tables suivantes
     200for(kcc=nsct1; kcc<nsct2; kcc++)
     201  mCasc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     202mOpt[1]->AppendPDMenu(mCasc[0]);
     203//  Apres les tables importees de MIDAS
     204nsct3 = PIColorMap::NumberStandardColorMaps()-1; // Les reste jusqu'a l'avant derniere
     205for(kcc=nsct2; kcc<nsct3; kcc++)
     206  mCasc[1]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     207mOpt[1]->AppendPDMenu(mCasc[1]);
     208// Les tables qui restent ( Col16 , ... )
     209for(kcc=nsct3; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
     210mOpt[1]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     211
    198212mOpt[1]->SetValue(200);
    199213mOpt[1]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     
    316330delete mButcf[3];
    317331for(i=0; i<6; i++)  delete mOpt[i];
     332for(i=0; i<2; i++)  delete mCasc[i];
    318333delete mNlb;
    319334}
     
    341356static PIFontSize fntsz[5] = { PI_NotDefFontSize, PI_NormalSizeFont, PI_SmallSizeFont,
    342357                               PI_BigSizeFont, PI_HugeSizeFont };
    343 static CMapId cmap[11] = {  CMAP_OTHER, CMAP_GREY32, CMAP_GREYINV32,
    344                             CMAP_COLRJ32, CMAP_COLBR32, CMAP_COLRV32, 
    345                             CMAP_GREY128, CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, CMAP_COL16 };
    346358
    347359/* --Methode-- */
     
    413425  if (fc == cols[kk])  { mOpt[0]->SetValue(100+kk);  break; }   
    414426CMapId cmi = dr->GetColMapId();
    415 for(kk=0; kk<11; kk++)
    416   if (cmi == cmap[kk]) { mOpt[1]->SetValue(200+kk);  break; } 
     427if (cmi == CMAP_OTHER)  mOpt[1]->SetValue(200);
     428else for(kk=0; kk<PIColorMap::NumberStandardColorMaps(); kk++)
     429  if (cmi == PIColorMap::GetStandardColorMapId(kk)) { mOpt[1]->SetValue(201+kk);  break; } 
    417430PIMarker mk = dr->GetMarker();   
    418431for(kk=0; kk<12; kk++)
     
    519532    drw->SetColAtt(cols[k]);
    520533    k = mOpt[1]->GetValue()-200;
    521     if ( (k < 0) || (k > 10) )  k = 0;
    522     drw->SetColMapId(cmap[k]);
     534    if (k == 0) drw->SetColMapId(CMAP_OTHER);
     535    else drw->SetColMapId(PIColorMap::GetStandardColorMapId(k-1));
    523536    k =  mOpt[2]->GetValue()-300;
    524537    if ( (k < 0) || (k > 11) )  k = 0;
  • trunk/SophyaPI/PI/pidrwtools.h

    r537 r1124  
    4242// Pour couleur, fontes, etc
    4343  PIOptMenu* mOpt[6];
     44  PIMenu* mCasc[5];
    4445  PILabel* mNlb;
    4546  PIButton* mButdr[2];
  • trunk/SophyaPI/PI/piimgtools.cc

    r1122 r1124  
    150150mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy);
    151151int kcc;
    152 //  D'abord les tables standard de PI
    153 for(kcc=0; kcc<10; kcc++) 
     152//  Groupement des tables de couleurs
     153mCasc[0] = new PIMenu(mOptzc[0]->Menu(), "PIStd-128Col");
     154mCasc[1] = new PIMenu(mOptzc[0]->Menu(), "MIDAS-CMap");
     155
     156int nsct1,nsct2,nsct3;
     157//  D'abord les tables standard de PI  32 couleurs
     158nsct1 = 5;   // Les 5 premieres tables
     159for(kcc=0; kcc<nsct1; kcc++)
    154160  mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
    155 // Les tables ramenees de MIDAS
    156 mCaszc[0] = new PIMenu(mOptzc[0]->Menu(), "MIDAS-CMap");
    157 for(kcc=10; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
    158   mCaszc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
    159 mOptzc[0]->Menu()->AppendPDMenu(mCaszc[0]);
     161//  Ensuite les tables standard de PI  128 couleurs
     162nsct2 = 9;   // Les 4 tables suivantes
     163for(kcc=nsct1; kcc<nsct2; kcc++)
     164  mCasc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     165mOptzc[0]->AppendPDMenu(mCasc[0]);
     166//  Apres les tables importees de MIDAS
     167nsct3 = PIColorMap::NumberStandardColorMaps()-1; // Les reste jusqu'a l'avant derniere
     168for(kcc=nsct2; kcc<nsct3; kcc++)
     169  mCasc[1]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     170mOptzc[0]->AppendPDMenu(mCasc[1]);
     171// Les tables qui restent ( Col16 , ... )
     172for(kcc=nsct3; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
     173mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
    160174
    161175mOptzc[0]->SetValue(203);
     
    267281  delete mOptzc[i];
    268282  }
    269 delete mCaszc[0];
     283for(i=0; i<2; i++)  delete mCasc[i];
    270284for(i=0; i<5; i++)  delete mButsz[i];
    271285for(i=0; i<3; i++)  delete mButcax[i];
  • trunk/SophyaPI/PI/piimgtools.h

    r1122 r1124  
    3838// Pour la couleur et le zoom
    3939  PIOptMenu* mOptzc[2];
    40   PIMenu* mCaszc[2];
     40  PIMenu* mCasc[5];
    4141// Pour expand et compress
    4242  PIButton* mButsz[5];
  • trunk/SophyaPI/PI/pioptmenugen.h

    r329 r1124  
    1818                                   { mMen->AppendItem(nom, msg); }
    1919
     20  virtual void       AppendPDMenu(PIMenu* pdm) = 0;
     21
    2022  virtual string     GetValueStr() = 0;         // Option choisie
    2123  virtual PIMessage  GetValue() = 0;            // Message correspondant a l option choisie
  • trunk/SophyaPI/PI/pioptmenux.cc

    r1122 r1124  
    8080
    8181/* --Methode-- */
     82void PIOptMenuX::AppendPDMenu(PIMenu* pdm)
     83{
     84  if (pdm == NULL)  return;
     85  Menu()->AppendPDMenu(pdm);
     86  mPDMList.push_back(pdm);
     87}
     88
     89/* --Methode-- */
    8290void PIOptMenuX::Process(PIMessage msg, PIMsgHandler* sender, void* data)
    8391{
     
    97105Arg warg[2];
    98106n=mMen->GetNumItem((char *)s.c_str());
    99 if (n < 0)  return; 
    100 
    101 XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
    102 XtSetValues(XtWdg(), warg, 1);
    103 mStext = s;
    104 mSmsg  = mMen->ItemMsg(n);
    105 
    106 SetLabel(mStext);
    107 
     107if (n < 0)  { // On verifie si c'est ds les PD Menu
     108  list<PIMenu *>::iterator it;
     109  for(it = mPDMList.begin(); it != mPDMList.end(); it++)
     110    if ((n= (*it)->GetNumItem((char *)s.c_str())) >= 0) {
     111      mStext = s;
     112      mSmsg  = (*it)->ItemMsg(n);
     113      SetLabel(mStext);
     114      break;
     115    }
     116return;
     117}
     118else {
     119  XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
     120  XtSetValues(XtWdg(), warg, 1);
     121  mStext = s;
     122  mSmsg  = mMen->ItemMsg(n);
     123  SetLabel(mStext);
     124}
    108125return;
    109126}
     
    116133
    117134n=mMen->GetNumItemMsg(msg);
    118 if (n < 0)  return;
    119  
    120 XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
    121 XtSetValues(XtWdg(), warg, 1);
    122 mStext = mMen->ItemName(n);
    123 mSmsg  = msg;
    124 SetLabel(mStext);
     135if (n < 0)  { // On verifie si c'est ds les PD Menu
     136  list<PIMenu *>::iterator it;
     137  for(it = mPDMList.begin(); it != mPDMList.end(); it++)
     138    if ((n= (*it)->GetNumItemMsg(msg)) >= 0) {
     139      mStext = (*it)->ItemName(n);
     140      mSmsg  = msg;
     141      SetLabel(mStext);
     142      break;
     143    }
     144return;
     145}
     146else { 
     147  XtSetArg(warg[0], XmNmenuHistory, mMen->GetItemWdg(n));
     148  XtSetValues(XtWdg(), warg, 1);
     149  mSmsg  = msg;
     150  mStext = mMen->ItemName(n);
     151  SetLabel(mStext);
     152}
    125153return;
    126154}
  • trunk/SophyaPI/PI/pioptmenux.h

    r329 r1124  
    33
    44#include "pisysdep.h"
     5#include <list>
    56#include "pioptmenugen.h"
     7
    68#include PISTDWDG_H
    79
     
    1214
    1315  virtual void      FinishCreate();
     16
     17  virtual void      AppendPDMenu(PIMenu* pdm);
    1418
    1519  virtual void      Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
     
    2832  string   mStext;
    2933  PIMessage mSmsg;
     34  list<PIMenu*> mPDMList;
    3035//  SysDWdg mLabel;
    3136  GC mgc;
  • trunk/SophyaPI/PI/piversion.h

    r1034 r1124  
    22#define PIVERSION_H_SEEN
    33
    4 #define PI_VERSIONNUMBER  2.6
     4#define PI_VERSIONNUMBER  2.7
    55
    66#endif
Note: See TracChangeset for help on using the changeset viewer.