Index: /trunk/SophyaPI/PI/picmap.cc
===================================================================
--- /trunk/SophyaPI/PI/picmap.cc	(revision 1121)
+++ /trunk/SophyaPI/PI/picmap.cc	(revision 1122)
@@ -22,13 +22,18 @@
 //--
 
-#define  MXMAPIDS   10 
-static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256};
+#define  MXMAPIDS   15
+static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
+                                      256, 256, 256, 256, 256 };
 static   const char*  MapNoms[MXMAPIDS]  = {"Grey32","InvGrey32","ColRJ32","ColBR32",
                                "ColRV32", "Grey128", "InvGrey128", "ColRJ128",
-                               "ColBR128", "Col16"};
+                               "ColBR128", "Col16",
+                               "MIDAS_Pastel", "MIDAS_Heat", "MIDAS_Rainbow3", 
+                               "MIDAS_BlueRed", "MIDAS_BlueWhite" };
 static   CMapId MapIds[MXMAPIDS] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
                                CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128, 
                                CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128,  
-                               CMAP_COL16 } ;
+                               CMAP_COL16,
+                               CMAP_MIDAS_Pastel, CMAP_MIDAS_Heat, CMAP_MIDAS_Rainbow3, 
+                               CMAP_MIDAS_BlueRed, CMAP_MIDAS_BlueWhite } ;
 
 static   int mColTNums[8192];   // Max 8192 tables differentes pour le moment  
@@ -36,5 +41,25 @@
 
 static   int NMaxTableAuto = 0;
-static   PIColorMap* mMaps[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+static   PIColorMap* mMaps[15] = {NULL, NULL, NULL, NULL, NULL, 
+                                  NULL, NULL, NULL, NULL, NULL, 
+                                  NULL, NULL, NULL, NULL, NULL  };
+
+int  PIColorMap::NumberStandardColorMaps()
+{
+  return ( MXMAPIDS );
+}
+
+CMapId PIColorMap::GetStandardColorMapId(int num)
+{
+  if ( (num < 0) || (num >= MXMAPIDS) )  num = 0;
+  return (MapIds[num]) ;
+}
+
+string PIColorMap::GetStandardColorMapName(int num)
+{
+  if ( (num < 0) || (num >= MXMAPIDS) )  num = 0;
+  return (MapNoms[num]) ;
+}
+
 
 //++
@@ -77,8 +102,11 @@
 
    if (NMaxTableAuto == 0) { //  Il faut allouer les tables de depart
-     if ( TotNbColors() > 2048 ) NMaxTableAuto = MXMAPIDS-1;
+     if ( TotNbColors() > 4096 ) NMaxTableAuto = MXMAPIDS-1;
      else NMaxTableAuto = 3; 
-     for(k=0; k<NMaxTableAuto; k++)  { 
+     //     for(k=0; k<NMaxTableAuto; k++)  { 
+     for(k=0; k<3; k++)  {   // On alloue les 3 tables de depart
         mnom = MapNoms[k]; 
+	cout << " PIColorMap::PIColorMap(CMapId id) Allocating ColorMap " 
+	     << mnom << " ... " << endl;
         mMaps[k] = new PIColorMap(MapIds[k], MapNCols[k], mnom);
      }
@@ -88,10 +116,17 @@
    for(kdx=0; kdx<MXMAPIDS; kdx++)  if (id == MapIds[kdx])  break;
    if (kdx == MXMAPIDS)  { id = MapIds[0];  kdx = 0; }
-   for(k=0; k<NMaxTableAuto; k++)  
-     if (id == mMaps[k]->Type()) {
+   for(k=0; k<NMaxTableAuto; k++) {
+     if ((MapIds[k] == id) && (mMaps[k] == NULL))  { //  Table pas encore alloue 
+       mnom = MapNoms[k]; 
+       cout << " PIColorMap::PIColorMap(CMapId id) Allocating ColorMap " 
+	     << mnom << " ... " << endl;
+       mMaps[k] = new PIColorMap(MapIds[k], MapNCols[k], mnom);
+     }
+     if (mMaps[k] && (id == mMaps[k]->Type()) ) {
        CopyFrom(mMaps[k]);  
        mCTId = mMaps[k]->mCTId;  mColTNums[mCTId]++;
        break;
      }
+   }
    if (Type() != id)  {  // Table pas encore trouve dans la liste
      k = NMaxTableAuto;
@@ -353,4 +388,118 @@
       break;
 
+  case CMAP_MIDAS_Pastel :   // Les valeurs correspondent a  je ne sais quel table MIDAS
+  case CMAP_MIDAS_Heat :      // A faire  pour CMAP_MIDAS_Pastel CMAP_MIDAS_Heat 
+  case CMAP_MIDAS_Rainbow3 :  //    A faire  pour Heat Rainbow3 BlueRed BlueWhite
+  case CMAP_MIDAS_BlueRed :   //    BlueRed -> idl11
+  case CMAP_MIDAS_BlueWhite : //    BlueWhite -> blulut.lutlis
+   {
+    static float rgb_r[256] = {
+0, 0, 0.01961, 0.0549, 0.08627, 0.1098, 0.13725, 0.15686, 0.18039, 0.2, 
+0.21569, 0.23529, 0.25098, 0.26275, 0.28235, 0.29412, 0.30588, 0.31765, 
+0.33333, 0.34118, 0.35294, 0.36078, 0.37255, 0.38431, 0.39216, 0.4, 
+0.41176, 0.41961, 0.43137, 0.43529, 0.44314, 0.45098, 0.45882, 0.46667, 
+0.47059, 0.48235, 0.48627, 0.49412, 0.50196, 0.50588, 0.5098, 0.51765, 
+0.52157, 0.53333, 0.53725, 0.54118, 0.54902, 0.55294, 0.55686, 0.56078, 
+0.56471, 0.57255, 0.58039, 0.58431, 0.58824, 0.59216, 0.59608, 0.6, 0.60392,
+0.60784, 0.61176, 0.61569, 0.61961, 0.62745, 0.63137, 0.63529, 0.63922, 
+0.64314, 0.64706, 0.65098, 0.6549, 0.6549, 0.65882, 0.66275, 0.66667 ,
+0.67059, 0.67843, 0.67843, 0.68235, 0.68627, 0.6902, 0.6902, 0.69412, 
+0.69804, 0.70196, 0.70196, 0.70588, 0.7098, 0.71373, 0.71373, 0.71765, 
+0.72157, 0.72157, 0.72941, 0.73333, 0.73333, 0.73725, 0.74118, 0.74118, 
+0.7451, 0.7451, 0.74902, 0.75294, 0.75294, 0.75686, 0.76078, 0.76078, 
+0.76471, 0.76471, 0.76863, 0.76863, 0.77255, 0.78039, 0.78039, 0.78431, 
+0.78431, 0.78824, 0.78824, 0.79216, 0.79216, 0.79608, 0.79608, 0.8, 0.8, 
+0.80392, 0.80392, 0.80784, 0.80784, 0.81176, 0.81176, 0.81569, 0.81569, 
+0.81961, 0.81961, 0.82745, 0.82745, 0.83137, 0.83137, 0.83529, 0.83529, 
+0.83922, 0.83922, 0.83922, 0.84314, 0.84314, 0.84706, 0.84706, 0.85098, 
+0.85098, 0.8549, 0.8549, 0.8549, 0.85882, 0.85882, 0.86275, 0.86275, 
+0.86275, 0.86667, 0.86667, 0.87059, 0.87059, 0.87059, 0.87843, 0.87843, 
+0.88235, 0.88235, 0.88235, 0.88627, 0.88627, 0.8902, 0.8902, 0.8902, 0.89412, 
+0.89412, 0.89412, 0.89804, 0.89804, 0.89804, 0.90196, 0.90196, 0.90588, 
+0.90588, 0.90588, 0.9098, 0.9098, 0.9098, 0.91373, 0.91373, 0.91373, 
+0.91765, 0.91765, 0.91765, 0.92157, 0.92157, 0.92157, 0.92941, 0.92941, 
+0.92941, 0.93333, 0.93333, 0.93333, 0.93725, 0.93725, 0.93725, 0.94118, 
+0.94118, 0.94118, 0.94118, 0.9451, 0.9451, 0.9451, 0.94902, 0.94902, 
+0.94902, 0.95294, 0.95294, 0.95294, 0.95686, 0.95686, 0.95686, 0.95686, 
+0.96078, 0.96078, 0.96078, 0.96471, 0.96471, 0.96471, 0.96471, 0.96863, 
+0.96863, 0.96863, 0.97255, 0.97255, 0.97255, 0.97255, 0.98039, 0.98039, 
+0.98039, 0.98039, 0.98431, 0.98431, 0.98431, 0.98824, 0.98824, 0.98824, 
+0.98824, 0.99216, 0.99216, 0.99216, 0.99216, 0.99608, 0.99608, 0.99608, 
+0.99608, 1, 1 };
+    static float rgb_g[256] = {
+0, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784, 
+0.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176, 
+0.01569, 0.01569, 0.01569, 0.01569, 0.01961, 0.01961, 0.01961, 0.01961, 
+0.02353, 0.02353, 0.02353, 0.02745, 0.02745, 0.02745, 0.02745, 0.03137, 
+0.03137, 0.03137, 0.03529, 0.03529, 0.03529, 0.03529, 0.04314, 0.04314, 
+0.04314, 0.04706, 0.04706, 0.04706, 0.05098, 0.05098, 0.05098, 0.0549, 
+0.0549, 0.0549, 0.05882, 0.05882, 0.05882, 0.06275, 0.06275, 0.06275, 0.06667, 
+0.06667, 0.06667, 0.07059, 0.07059, 0.07451, 0.07451, 0.07451, 0.07843, 
+0.07843, 0.08235, 0.08235, 0.08235, 0.08627, 0.08627, 0.0902, 0.0902, 
+0.0902, 0.09412, 0.09412, 0.09804, 0.09804, 0.10196, 0.10196, 0.10588, 
+0.10588, 0.1098, 0.1098, 0.1098, 0.11765, 0.11765, 0.12157, 0.12157, 
+0.12549, 0.12549, 0.12941, 0.12941, 0.13333, 0.13725, 0.13725, 0.14118, 
+0.14118, 0.1451, 0.1451, 0.14902, 0.14902, 0.15294, 0.15686, 0.15686, 
+0.16078, 0.16078, 0.16471, 0.16863, 0.16863, 0.17255, 0.17255, 0.17647, 
+0.18039, 0.18039, 0.18431, 0.18824, 0.18824, 0.19608, 0.2, 0.2, 0.20392, 
+0.20784, 0.20784, 0.21176, 0.21569, 0.21961, 0.21961, 0.22353, 0.22745, 
+0.23137, 0.23137, 0.23529, 0.23922, 0.24314, 0.24314, 0.24706, 0.25098, 
+0.2549, 0.25882, 0.26275, 0.26275, 0.27059, 0.27451, 0.27843, 0.28235, 
+0.28627, 0.2902, 0.29412, 0.29804, 0.29804, 0.30196, 0.30588, 0.3098, 
+0.31373, 0.31765, 0.32157, 0.32549, 0.33333, 0.33725, 0.34118, 0.3451, 
+0.34902, 0.35294, 0.35686, 0.36078, 0.36471, 0.37255, 0.37647, 0.38039, 
+0.38431, 0.38824, 0.39216, 0.4, 0.40392, 0.40784, 0.41176, 0.41961, 0.42353, 
+0.42745, 0.43529, 0.43922, 0.44314, 0.45098, 0.4549, 0.45882, 0.46667, 
+0.47059, 0.47843, 0.48235, 0.4902, 0.49412, 0.50196, 0.50588, 0.51373, 
+0.51765, 0.52549, 0.52941, 0.53725, 0.54118, 0.54902, 0.55686, 0.56078, 
+0.56863, 0.57647, 0.58039, 0.58824, 0.59608, 0.6, 0.60784, 0.61569, 
+0.62353, 0.63137, 0.63529, 0.64314, 0.65098, 0.65882, 0.66667, 0.67451, 
+0.68235, 0.6902, 0.69804, 0.70588, 0.71373, 0.72157, 0.72941, 0.73725, 0.7451, 
+0.75294, 0.76078, 0.77255, 0.78039, 0.78824, 0.79608, 0.80392, 0.81569, 
+0.82353, 0.83137, 0.84314, 0.85098, 0.86275, 0.87059, 0.87843, 0.8902 ,
+0.89804, 0.9098, 0.91765, 0.92941, 0.94118, 0.94902, 0.96078, 0.97255, 
+0.98039, 0.99216 };
+    static float rgb_b[256] = {
+0, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784, 
+0.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176, 
+0.01569, 0.01569, 0.01569, 0.01569, 0.01961, 0.01961, 0.01961, 0.01961, 
+0.02353, 0.02353, 0.02353, 0.02745, 0.02745, 0.02745, 0.02745, 0.03137, 
+0.03137, 0.03137, 0.03529, 0.03529, 0.03529, 0.03529, 0.04314, 0.04314, 
+0.04314, 0.04706, 0.04706, 0.04706, 0.05098, 0.05098, 0.05098, 0.0549, 
+0.0549, 0.0549, 0.05882, 0.05882, 0.05882, 0.06275, 0.06275, 0.06275, 0.06667, 
+0.06667, 0.06667, 0.07059, 0.07059, 0.07451, 0.07451, 0.07451, 0.07843, 
+0.07843, 0.08235, 0.08235, 0.08235, 0.08627, 0.08627, 0.0902, 0.0902, 
+0.0902, 0.09412, 0.09412, 0.09804, 0.09804, 0.10196, 0.10196, 0.10588, 
+0.10588, 0.1098, 0.1098, 0.1098, 0.11765, 0.11765, 0.12157, 0.12157, 
+0.12549, 0.12549, 0.12941, 0.12941, 0.13333, 0.13725, 0.13725, 0.14118, 
+0.14118, 0.1451, 0.1451, 0.14902, 0.14902, 0.15294, 0.15686, 0.15686, 
+0.16078, 0.16078, 0.16471, 0.16863, 0.16863, 0.17255, 0.17255, 0.17647, 
+0.18039, 0.18039, 0.18431, 0.18824, 0.18824, 0.19608, 0.2, 0.2, 0.20392, 
+0.20784, 0.20784, 0.21176, 0.21569, 0.21961, 0.21961, 0.22353, 0.22745, 
+0.23137, 0.23137, 0.23529, 0.23922, 0.24314, 0.24314, 0.24706, 0.25098, 
+0.2549, 0.25882, 0.26275, 0.26275, 0.27059, 0.27451, 0.27843, 0.28235, 
+0.28627, 0.2902, 0.29412, 0.29804, 0.29804, 0.30196, 0.30588, 0.3098, 
+0.31373, 0.31765, 0.32157, 0.32549, 0.33333, 0.33725, 0.34118, 0.3451, 
+0.34902, 0.35294, 0.35686, 0.36078, 0.36471, 0.37255, 0.37647, 0.38039, 
+0.38431, 0.38824, 0.39216, 0.4, 0.40392, 0.40784, 0.41176, 0.41961, 0.42353, 
+0.42745, 0.43529, 0.43922, 0.44314, 0.45098, 0.4549, 0.45882, 0.46667, 
+0.47059, 0.47843, 0.48235, 0.4902, 0.49412, 0.50196, 0.50588, 0.51373, 
+0.51765, 0.52549, 0.52941, 0.53725, 0.54118, 0.54902, 0.55686, 0.56078, 
+0.56863, 0.57647, 0.58039, 0.58824, 0.59608, 0.6, 0.60784, 0.61569, 0.62353, 
+0.63137, 0.63529, 0.64314, 0.65098, 0.65882, 0.66667, 0.67451, 0.68235, 
+0.6902, 0.69804, 0.70588, 0.71373, 0.72157, 0.72941, 0.73725, 0.7451, 
+0.75294, 0.76078, 0.77255, 0.78039, 0.78824, 0.79608, 0.80392, 0.81569, 
+0.82353, 0.83137, 0.84314, 0.85098, 0.86275, 0.87059, 0.87843, 0.8902, 
+0.89804, 0.9098, 0.91765, 0.92941, 0.94118, 0.94902, 0.96078, 0.97255, 
+0.98039, 0.99216 };
+    for(i=0; i<mNCol; i++) {
+      mycol.red = (rgb_r[i]*65535.); 
+      mycol.green = (rgb_g[i]*65535.); 
+      mycol.blue = (rgb_b[i]*65535.); 
+      AllocColor(mycol, i);      
+    }
+   }
+    break;
+
   default :
     for(i=0; i<mNCol; i++) {
Index: /trunk/SophyaPI/PI/picmap.h
===================================================================
--- /trunk/SophyaPI/PI/picmap.h	(revision 1121)
+++ /trunk/SophyaPI/PI/picmap.h	(revision 1122)
@@ -22,5 +22,12 @@
  CMAP_COLRJ128    = 8,     // 128 couleurs du rouge au jaune/blanc
  CMAP_COLBR128    = 9,     // 128 couleurs du bleu au rouge
- CMAP_COL16       = 10     // 16 Couleurs Arcenciel
+ CMAP_COL16       = 10,    // 16 Couleurs Arcenciel
+
+ // Tables de couleur importees de MIDAS
+ CMAP_MIDAS_Pastel    = 101,   // Bleu-Violet-Rouge-Jaune
+ CMAP_MIDAS_Heat      = 102,   // Noir-Rouge-Orange-Blanc
+ CMAP_MIDAS_Rainbow3  = 103,   // Noir-Bleu-Vert-Jaune-Rouge-Violet-Blanc
+ CMAP_MIDAS_BlueRed   = 104,   // Bleu-Violet-Rouge
+ CMAP_MIDAS_BlueWhite = 105    // Noir-Bleu-Blanc
  };
 
@@ -34,4 +41,7 @@
 
   static void CleanColorMaps();
+  static int  NumberStandardColorMaps();
+  static CMapId GetStandardColorMapId(int num);
+  static string GetStandardColorMapName(int num);
 
 protected:
Index: /trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.cc	(revision 1121)
+++ /trunk/SophyaPI/PI/piimgtools.cc	(revision 1122)
@@ -149,14 +149,14 @@
 cpy = offy;
 mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy);
-mOptzc[0]->AppendItem("Grey32", 201);
-mOptzc[0]->AppendItem("GreyInv32", 202);
-mOptzc[0]->AppendItem("ColRJ32", 203);
-mOptzc[0]->AppendItem("ColBR32", 204);
-mOptzc[0]->AppendItem("ColRV32", 205);
-mOptzc[0]->AppendItem("Grey128", 206);
-mOptzc[0]->AppendItem("GreyInv128", 207);
-mOptzc[0]->AppendItem("ColRJ128", 208);
-mOptzc[0]->AppendItem("ColBR128", 209);
-mOptzc[0]->AppendItem("Col16", 210);
+int kcc;
+//  D'abord les tables standard de PI
+for(kcc=0; kcc<10; kcc++)  
+  mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
+// Les tables ramenees de MIDAS
+mCaszc[0] = new PIMenu(mOptzc[0]->Menu(), "MIDAS-CMap");
+for(kcc=10; kcc<PIColorMap::NumberStandardColorMaps(); kcc++) 
+  mCaszc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
+mOptzc[0]->Menu()->AppendPDMenu(mCaszc[0]);
+
 mOptzc[0]->SetValue(203);
 mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
@@ -267,4 +267,5 @@
   delete mOptzc[i];
   }
+delete mCaszc[0];
 for(i=0; i<5; i++)  delete mButsz[i];
 for(i=0; i<3; i++)  delete mButcax[i];
@@ -432,13 +433,8 @@
 
 
-CMapId cmap[10] =  { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
-                      CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128,
-                      CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128,
-                      CMAP_COL16 };
-
 if ((msg <= 110) && (msg >= 90))  // Zoom
   PIImage::CurrentPIImage()->SetZoom((int)(msg-100), true);
-else if ((msg > 200) && (msg < 211)) // Changement de couleur 
-  PIImage::CurrentPIImage()->SetColMapId(cmap[msg-201], true);
+else if ((msg > 200) && (msg < 299)) // Changement de couleur 
+  PIImage::CurrentPIImage()->SetColMapId(PIColorMap::GetStandardColorMapId(msg-201), true);
 
 // Cuts
Index: /trunk/SophyaPI/PI/piimgtools.h
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.h	(revision 1121)
+++ /trunk/SophyaPI/PI/piimgtools.h	(revision 1122)
@@ -38,4 +38,5 @@
 // Pour la couleur et le zoom
   PIOptMenu* mOptzc[2];
+  PIMenu* mCaszc[2];
 // Pour expand et compress
   PIButton* mButsz[5];
Index: /trunk/SophyaPI/PI/pioptmenux.cc
===================================================================
--- /trunk/SophyaPI/PI/pioptmenux.cc	(revision 1121)
+++ /trunk/SophyaPI/PI/pioptmenux.cc	(revision 1122)
@@ -83,8 +83,8 @@
 {
 // printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender);
-if (sender == mMen)   {
+  // if (sender == mMen)   {    Ca peut venir d'un cascade menu !!
   SetValue(UserMsg(msg));
   ReSend(msg, this, NULL);
-}
+  //}
 return;
 }
@@ -114,4 +114,5 @@
 int n;
 Arg warg[2];
+
 n=mMen->GetNumItemMsg(msg);
 if (n < 0)  return;
