Index: /trunk/SophyaPI/PI/piimage.cc
===================================================================
--- /trunk/SophyaPI/PI/piimage.cc	(revision 388)
+++ /trunk/SophyaPI/PI/piimage.cc	(revision 389)
@@ -104,5 +104,6 @@
 showinfo = false;
 
-// Fenetre et ScDrawWdg pour les coupes 
+// Fenetre et ScDrawWdg pour les coupes
+selcuts = 3;
 cutwin = NULL;
 cutscw = NULL; 
@@ -317,16 +318,33 @@
   cutarrx = new PIImg1DArrAdapter();
   cutarry = new PIImg1DArrAdapter();
+  cutarrd = new PIImg1DArrAdapter();
+  cutarra = new PIImg1DArrAdapter();
   PIYfXDrawer * drw;
+  string dum = "";
   drw = new PIYfXDrawer(cutarrx, NULL, true);
-  drw->SetColAtt(PI_Red);
-  drw->SetMarkerAtt(5, PI_CrossMarker);
-  drw->SetLineAtt(PI_ThinLine);
-  cutscw->AddScDrawer(drw, true);
+    drw->SetColAtt(PI_Red);
+    drw->SetMarkerAtt(5, PI_CrossMarker);
+    drw->SetLineAtt(PI_ThinLine);
+    cutscw->AddScDrawer(drw, true);
+    dum += "Red: X, ";
   drw = new PIYfXDrawer(cutarry, NULL, true);
-  drw->SetColAtt(PI_Blue);
-  drw->SetMarkerAtt(5, PI_TriangleMarker);
-  drw->SetLineAtt(PI_ThinLine);
-  cutscw->AddScDrawer(drw, true);
-  cutscw->SetTitles("Red: X , Blue: Y");
+    drw->SetColAtt(PI_Blue);
+    drw->SetMarkerAtt(5, PI_TriangleMarker);
+    drw->SetLineAtt(PI_ThinLine);
+    cutscw->AddScDrawer(drw, true);
+    dum += "Blue: Y, ";
+  drw = new PIYfXDrawer(cutarrd, NULL, true);
+    drw->SetColAtt(PI_Green);
+    drw->SetMarkerAtt(5, PI_PlusMarker);
+    drw->SetLineAtt(PI_ThinLine);
+    cutscw->AddScDrawer(drw, true);
+    dum += "Green: XY, ";
+  drw = new PIYfXDrawer(cutarra, NULL, true);
+    drw->SetColAtt(PI_Orange);
+    drw->SetMarkerAtt(5, PI_BoxMarker);
+    drw->SetLineAtt(PI_ThinLine);
+    cutscw->AddScDrawer(drw, true);
+    dum += "Orange: -XY";
+  cutscw->SetTitles(dum.c_str());
   UpdateCuts();
   cutwin->Show();
@@ -337,6 +355,16 @@
   delete cutwin;
   cutwin = NULL;
-  cutscw = NULL; 
-  }
+  cutscw = NULL;
+  }
+}
+
+/* --Methode-- */
+void PIImage::SelectCuts(unsigned xyda)
+// choix des cuts pour le display:
+// 1=axe des (X), 2=axe des (Y), 4=diag (X,Y), 8=anti-diag (X,-Y)
+{
+selcuts = xyda;
+if(!(selcuts&15)) selcuts = 3;
+UpdateCuts();
 }
 
@@ -959,40 +987,89 @@
 if (!cutwin || !img) return;
 
-int hsx, hsy;
+int hsx, hsy, hsmin;
+P2DArrayAdapter * img0=NULL;
 hsx = XSzPave()/2;
 hsy = YSzPave()/2;
-cutarrx->SetData(img, false, 2*hsx+1, XPave(), YPave());
-cutarry->SetData(img, true, 2*hsy+1, XPave(), YPave());
+hsmin = (hsx<hsy)? hsx: hsy;
+if(selcuts&1) img0=img; else img0=NULL;
+  cutarrx->SetData(img0, 1, 2*hsx+1, XPave(), YPave());
+if(selcuts&2) img0=img; else img0=NULL;
+  cutarry->SetData(img0, 2, 2*hsy+1, XPave(), YPave());
+if(selcuts&4) img0=img; else img0=NULL;
+  cutarrd->SetData(img0, 4, 2*hsmin+1, XPave(), YPave());
+if(selcuts&8) img0=img; else img0=NULL;
+  cutarra->SetData(img0, 8, 2*hsmin+1, XPave(), YPave());
+
 double x1,y1,x2,y2;
-double xmin, xmax, ymin, ymax;
 img->Coord(XPave()-hsx, YPave()-hsy, x1, y1);
 img->Coord(XPave()+hsx, YPave()+hsy, x2, y2);
-if (x1 < x2)  cutarrx->DefineXCoordinate(-cutarrx->Size()/2, 1.);
-else   cutarrx->DefineXCoordinate(cutarrx->Size()/2, -1.);
-if (y1 < y2)  cutarry->DefineXCoordinate(-cutarry->Size()/2, 1.);
-else   cutarry->DefineXCoordinate(cutarry->Size()/2, -1.);
+  if(x1<x2) cutarrx->DefineXCoordinate(-cutarrx->Size()/2,  1.);
+    else    cutarrx->DefineXCoordinate( cutarrx->Size()/2, -1.);
+  if(y1<y2) cutarry->DefineXCoordinate(-cutarry->Size()/2,  1.);
+    else    cutarry->DefineXCoordinate( cutarry->Size()/2, -1.);
+img->Coord(XPave()-hsmin, YPave()-hsmin, x1, y1);
+img->Coord(XPave()+hsmin, YPave()+hsmin, x2, y2);
+  if(x1<x2) cutarrd->DefineXCoordinate(-cutarrd->Size()/2,  1.);
+    else    cutarrd->DefineXCoordinate( cutarrd->Size()/2, -1.);
+  if(x1<x2) cutarra->DefineXCoordinate(-cutarra->Size()/2,  1.);
+    else    cutarra->DefineXCoordinate( cutarra->Size()/2, -1.);
 
 // On calcule les limites :
-if (cutarrx->Size() > cutarry->Size() ) {
-  xmax = cutarrx->Size()/2. + 1.;   
-  xmin = -xmax; 
-} 
-else {
-  xmax = cutarry->Size()/2. + 1.;   
-  xmin = -xmax; 
-} 
- 
-int i;
-double cv;
-ymax = ymin = cutarrx->Value(0);
-for(i=1; i<cutarrx->Size(); i++) {
-  cv = cutarrx->Value(i);
-  if (cv < ymin)  ymin = cv;
-  if (cv > ymax)  ymax = cv;
-}
-for(i=0; i<cutarry->Size(); i++) {
-  cv = cutarry->Value(i);
-  if (cv < ymin)  ymin = cv;
-  if (cv > ymax)  ymax = cv;
+double xmin=0., xmax=0., ymin=0., ymax=0.; bool vue=false;
+if(cutarrx->Size()) {
+  if(!vue) vue=true;
+  xmax=cutarrx->Size()/2.+1.; xmin=-xmax; 
+}
+if(cutarry->Size()) {
+  if(!vue)
+    {vue=true; xmax=cutarry->Size()/2.+1.; xmin=-xmax;}
+  else if(cutarry->Size()>xmax)
+    {xmax=cutarry->Size()/2.+1.; xmin=-xmax;}
+}
+if(cutarrd->Size()) {
+  if(!vue)
+    {vue=true; xmax=cutarrd->Size()/2.+1.; xmin=-xmax;}
+  else if(cutarrd->Size()>xmax)
+    {xmax=cutarrd->Size()/2.+1.; xmin=-xmax;}
+}
+if(cutarra->Size()) {
+  if(!vue)
+    {vue=true; xmax=cutarra->Size()/2.+1.; xmin=-xmax;}
+  else if(cutarra->Size()>xmax)
+    {xmax=cutarra->Size()/2.+1.; xmin=-xmax;}
+}
+
+int i; double cv; vue = false;
+if(cutarrx->Size()) {
+  vue=true; ymax=ymin=cutarrx->Value(0);
+  for(i=0; i<cutarrx->Size(); i++) {
+    cv = cutarrx->Value(i);
+    if (cv < ymin)  ymin = cv;
+    if (cv > ymax)  ymax = cv;
+  }
+}
+if(cutarry->Size()) {
+  if(!vue) {vue=true; ymax=ymin=cutarry->Value(0);}
+  for(i=0; i<cutarry->Size(); i++) {
+    cv = cutarry->Value(i);
+    if (cv < ymin)  ymin = cv;
+    if (cv > ymax)  ymax = cv;
+  }
+}
+if(cutarrd->Size()) {
+  if(!vue) {vue=true; ymax=ymin=cutarrd->Value(0);}
+  for(i=0; i<cutarrd->Size(); i++) {
+    cv = cutarrd->Value(i);
+    if (cv < ymin)  ymin = cv;
+    if (cv > ymax)  ymax = cv;
+  }
+}
+if(cutarra->Size()) {
+  if(!vue) {vue=true; ymax=ymin=cutarra->Value(0);}
+  for(i=0; i<cutarra->Size(); i++) {
+    cv = cutarra->Value(i);
+    if (cv < ymin)  ymin = cv;
+    if (cv > ymax)  ymax = cv;
+  }
 }
 ymin -= 0.05*(ymax-ymin);
@@ -1236,13 +1313,16 @@
 {
 data = NULL;
-fgay = false;
+fgaxyda = 1;
 off1 = off2 = 0;
 }
 
 /* --Methode-- */
-void PIImage::PIImg1DArrAdapter::SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2)
-{
-data = d;
-fgay = ax;
+void PIImage::PIImg1DArrAdapter::SetData(P2DArrayAdapter* d, unsigned short axyda
+                                        ,int sz,int o1,int o2)
+// axyda&1 axe (X), axyda&2 axe (Y), axyda&4 diag (X,Y), axyda&8 anti-diag (X,-Y)
+{
+data = d; mSize = 0;
+fgaxyda = axyda;
+if(!data) return;
 if (o1 < 0)  o1 = 0;
 if (o2 < 0)  o2 = 0;
@@ -1260,16 +1340,29 @@
 {
 if (!data) return(0.);
-int k;
-if (fgay) { 
+int j,k;
+if (fgaxyda&1) {          // Axe X
+  j = off1-mSize/2+i;
+  if (j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1;
+  return((*data)(j,off2));
+  }
+else if (fgaxyda&2) {     // Axe Y
   k = off2-mSize/2+i;
-  if (k < 0)  k = 0;
-  if (k >= data->YSize()) k = data->YSize()-1;
-  return((*data)(off1, k));
-  }
-else { 
-  k = off1-mSize/2+i;
-  if (k < 0)  k = 0;
-  if (k >= data->XSize()) k = data->XSize()-1;
-  return((*data)(k, off2));
-  }
-}
+  if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1;
+  return((*data)(off1,k));
+  }
+else if (fgaxyda&4) {     // Axe XY
+  j = off1-mSize/2+i;
+  k = off2-mSize/2+i;
+  if(j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1;
+  if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1;
+  return((*data)(j,k));
+  }
+else if (fgaxyda&8) {     // Axe -XY
+  j = off1-mSize/2+i;
+  k = off2+mSize/2-i;
+  if(j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1;
+  if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1;
+  return((*data)(j,k));
+  }
+return(0.);
+}
Index: /trunk/SophyaPI/PI/piimage.h
===================================================================
--- /trunk/SophyaPI/PI/piimage.h	(revision 388)
+++ /trunk/SophyaPI/PI/piimage.h	(revision 389)
@@ -49,4 +49,5 @@
 
   void ShowCuts(bool cuts=true);
+  void SelectCuts(unsigned xyda=3);
 
 //  Gestion du choix de LUT, facteur d agrandissement, table de couleur
@@ -110,8 +111,8 @@
 	             PIImg1DArrAdapter();
      virtual double  Value(int i);
-     virtual void    SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2);
+     virtual void    SetData(P2DArrayAdapter* d, unsigned short axyda, int sz, int o1, int o2);
   protected :
     P2DArrayAdapter* data;
-    bool fgay;
+    unsigned short fgaxyda;
     int off1, off2;
   };
@@ -176,10 +177,12 @@
   PIColors cucol;    // Attribut de couleur du curseur
   int xszpav, yszpav;
-// Pour gerer une fenetre pour les coupes en X,Y 
-  bool hascuts;
+// Pour gerer une fenetre pour les coupes en X,Y
+  unsigned short selcuts;
   PIWindow * cutwin;
   PIScDrawWdg * cutscw;
   PIImg1DArrAdapter * cutarrx; 
   PIImg1DArrAdapter * cutarry; 
+  PIImg1DArrAdapter * cutarrd; 
+  PIImg1DArrAdapter * cutarra; 
 
 // buffer pour copier-coller
Index: /trunk/SophyaPI/PI/piimgtools.cc
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.cc	(revision 388)
+++ /trunk/SophyaPI/PI/piimgtools.cc	(revision 389)
@@ -83,9 +83,20 @@
 cpy += 2*spy+bsy; 
 cpx = 3*spx;
-mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.75, bsy, cpx, cpy);
-cpx += bsx*1.75+2*spx;
-mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.75, bsy, cpx, cpy);
+mBut[0] = new PIButton(this, "Apply", 2500, bsx, bsy, cpx, cpy);
 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+cpx += bsx+2*spx;
+mBut[1] = new PIButton(this, "Dismiss", 2600, bsx, bsy, cpx, cpy);
 mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
+cpx += bsx+2*spx;
+mOptCut = new PIOptMenu(this, "Cut", bsx, bsy, cpx, cpy);
+mOptCut->AppendItem("Cut X",301);
+mOptCut->AppendItem("Cut Y",302);
+mOptCut->AppendItem("CutXY",303);
+mOptCut->AppendItem("Cut D",304);
+mOptCut->AppendItem("Cut A",308);
+mOptCut->AppendItem("CutDA",312);
+mOptCut->AppendItem("CutAll",315);
+mOptCut->SetValue(303);
+mOptCut->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 
 int offy = cpy+bsy+spy*2;
@@ -217,5 +228,5 @@
 for(i=0; i<3; i++)  delete mButcax[i];
 for(i=0; i<5; i++)  delete mButoa[i];
-
+delete mOptCut;
 }
 
@@ -243,4 +254,5 @@
 mOptzc[0]->SetValue(203);
 mOptzc[1]->SetValue(101);
+mOptCut->SetValue(303);
 return;
 }
@@ -383,4 +395,9 @@
   PIImage::CurrentPIImage()->SetColMapId(cmap[msg-201], true);
 
+// Cuts
+if(301<=msg && msg<=315) {
+  PIImage::CurrentPIImage()->SelectCuts((unsigned short) (msg-300));
+}
+
 return;
 }
Index: /trunk/SophyaPI/PI/piimgtools.h
===================================================================
--- /trunk/SophyaPI/PI/piimgtools.h	(revision 388)
+++ /trunk/SophyaPI/PI/piimgtools.h	(revision 389)
@@ -43,4 +43,6 @@
 // Options show/hide
   PIButton* mButoa[5];
+// Options Cuts
+  PIOptMenu* mOptCut;
 };
 
