Index: trunk/SophyaPI/PIext/basexecut.cc
===================================================================
--- trunk/SophyaPI/PIext/basexecut.cc	(revision 546)
+++ trunk/SophyaPI/PIext/basexecut.cc	(revision 548)
@@ -75,4 +75,12 @@
   mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
   }
+else if (kw == "setinsetlimits") {
+  if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl;  return(0); }
+  double xmin = atof(tokens[0].c_str());
+  double xmax = atof(tokens[1].c_str());
+  double ymin = atof(tokens[2].c_str());
+  double ymax = atof(tokens[3].c_str());
+  mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
+  }
 else if (kw == "addtext") {
   if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl;  return(0); }
@@ -663,5 +671,5 @@
 
 kw = "graphic_att";
-usage = "To change default graphic options \n  Usage: gratt att_list \n";
+usage = "To change default graphic options \n  Usage: graphic_att att_list \n";
 usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
 usage += "\n ------------------ Graphic attribute list ------------------ \n";
@@ -686,11 +694,19 @@
 usage += ">> XYLimits : xylimits  -> Forces X-Y limits in 2-D plots \n";
 usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
-usage += ">> DisplayWindow: next same win stack \n";
-usage += "   Related commands: setxylimits";  
+usage += ">> DisplayWindow: next same win stack inset \n";
+usage += "   Related commands: setxylimits setinsetlimits";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
 kw = "setxylimits";
 usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
-usage += "\n  Related commands: gratt";  
+usage += "\n  Related commands: graphic_att";  
+mpiac->RegisterCommand(kw, usage, this, "Graphics");
+
+kw = "setinsetlimits";
+usage = "Define the display rectangle for drawers added as insets \n";
+usage += " over existing graphic objects - limits expressed as fraction \n";  
+usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
+usage += " Usage: setinsetlimits xmin xmax ymin ymax";
+usage += "\n  Related commands: graphic_att";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -699,5 +715,5 @@
 usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
 usage += "\n  Usage: addtext x y ColFontAtt TextString";
-usage += "\n  Related commands: gratt";  
+usage += "\n  Related commands: graphic_att";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -1101,6 +1117,9 @@
 usage += "  in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
 usage += "  be activated using the StackTools menu (Blink) \n";
-usage += "o Most objects can be also be displayed, overlayed on the last displayed widget (gr_att= same) \n";
-usage += "\n  Related commands: newwin zone stacknext gratt";  
+usage += "o Most objects can be also be displayed overlayed \n";
+usage += "  on the last displayed widget (gr_att= same) \n";
+usage += "o The overlay can be on a selected rectangle of the \n";  
+usage += "  last displayed widget (gr_att= inset) - See setinsetlimits\n";
+usage += "\n  Related commands: newwin zone stacknext graphic_att setinsetlimits";  
 piac->RegisterHelp(kw, usage, grp);
 
Index: trunk/SophyaPI/PIext/pihisto.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto.cc	(revision 546)
+++ trunk/SophyaPI/PIext/pihisto.cc	(revision 548)
@@ -65,5 +65,5 @@
   if(hmax<=hmin) hmax += 1.;
   SetLimits(mHisto->XMin(), mHisto->XMax(), hmin, hmax);
-  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+//  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);   NE PAS faire Reza 11/99
 }
 
@@ -71,4 +71,6 @@
 PIHisto::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
 {
+  if (axesFlags != kAxesNone) DrawAxes(g);
+
   bool oktrace = false;
   if (!mHisto)  return;  
@@ -138,19 +140,23 @@
   PIGrCoord a, d;
   double cH = (double)g->GetFontHeight(a,d);
-  double cellHeight = cH * 3.8;
+  double cellHeight = cH * 3.6;
 //  double cellWidth  = (XMax() - XMin()) * 0.23;
   char label[50];
-  sprintf(label, "N= %.8g    ", mHisto->NData());
-  label[11] ='\0';
+  sprintf(label, "N= %8g    ", mHisto->NData());   label[11] ='\0';
   double cellWidth =  (double)g->CalcStringWidth(label) * 1.1;
-  g->DrawLine(XMax() - cellWidth, YMax(),
-                       XMax() - cellWidth, YMax() - cellHeight);
-  g->DrawLine(XMax() - cellWidth, YMax() - cellHeight,
-                       XMax()            , YMax() - cellHeight);
-  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*1.2, label);
-  sprintf(label, "m= %.8g", mHisto->Mean());
-  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*2.4, label);
-  sprintf(label, "s= %.8g", mHisto->Sigma());
-  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*3.6, label);
+  double xu, yu;
+  xu = g->DeltaUCX(XMax(), - cellWidth);
+  yu = g->DeltaUCY(YMax(), - cellHeight);
+  g->DrawLine(xu, YMax(), xu, yu);
+  g->DrawLine(xu, yu, XMax(), yu);
+  xu = g->DeltaUCX(XMax(), - cellWidth*0.95);
+  yu = g->DeltaUCY(YMax(), - cH*1.15);
+  g->DrawString(xu, yu, label);
+  sprintf(label, "m= %8g", mHisto->Mean());  label[11] ='\0';
+  yu = g->DeltaUCY(YMax(), - cH*2.3);
+  g->DrawString(xu, yu, label);
+  sprintf(label, "s= %8g", mHisto->Sigma());  label[11] ='\0';
+  yu = g->DeltaUCY(YMax(), - cH*3.45);
+  g->DrawString(xu, yu, label);
                        
 }
Index: trunk/SophyaPI/PIext/pihisto2d.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto2d.cc	(revision 546)
+++ trunk/SophyaPI/PIext/pihisto2d.cc	(revision 548)
@@ -176,5 +176,5 @@
   if(!mHisto) return;
   SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());
-  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+//  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);   Ne pas faire - Reza 11/99
 }
 
@@ -193,4 +193,7 @@
 //--
 {
+
+if (axesFlags != kAxesNone) DrawAxes(g);
+
 if(!mHisto) return;
 // Caracteristiques histogramme
Index: trunk/SophyaPI/PIext/pintuple.cc
===================================================================
--- trunk/SophyaPI/PIext/pintuple.cc	(revision 546)
+++ trunk/SophyaPI/PIext/pintuple.cc	(revision 548)
@@ -134,5 +134,5 @@
   
   SetLimits(xmin-dx, xmax+dx, ymin-dy, ymax+dy);
-  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
+//  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);  Ne pas faire - Reza 11/99
 }
 
@@ -146,4 +146,5 @@
 
 if (!mNT) return;
+if (axesFlags != kAxesNone) DrawAxes(g);
 if ( (xK < 0) || (yK < 0) )  return;
 if (mLAtt == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
@@ -201,11 +202,14 @@
   PIGrCoord a,d;
   double cH = (double)g->GetFontHeight(a,d);
-  double cellHeight = cH * 1.4;
+  double cellHeight = cH * 1.3;
   double cellWidth =  (double)g->CalcStringWidth(label) * 1.1;
-  g->DrawLine(XMax() - cellWidth, YMax(),
-                       XMax() - cellWidth, YMax() - cellHeight);
-  g->DrawLine(XMax() - cellWidth, YMax() - cellHeight,
-                       XMax()            , YMax() - cellHeight);
-  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*1.2, label);
+  double xu, yu;
+  xu = g->DeltaUCX(XMax(), - cellWidth);
+  yu = g->DeltaUCY(YMax(), - cellHeight);
+  g->DrawLine(xu, YMax(), xu, yu);
+  g->DrawLine(xu, yu, XMax(), yu);
+  xu = g->DeltaUCX(XMax(), - cellWidth*0.95);
+  yu = g->DeltaUCY(YMax(), - cH*1.15);
+  g->DrawString(xu, yu, label);
 }
 
Index: trunk/SophyaPI/PIext/pistdimgapp.cc
===================================================================
--- trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 546)
+++ trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 548)
@@ -201,6 +201,6 @@
 mZoom = 0;
 mAxesFlags = kBoxAxes | kExtTicks | kLabels;
-mXmin = mYmin = -1.;
-mXmax = mYmax = 1;
+SetXYLimits(-1, 1., -1., 1.);
+SetInsetLimits(0.4, 0.6, 0.4, 0.6);
 maXlog = maYlog = false;
 SaveGraphicAtt();
@@ -463,7 +463,23 @@
 if ( mCmapid != CMAP_OTHER ) scd->SetColMapId(mCmapid);
 
-if ( (opt == Disp_Same) && (mLastWdg) ) {
+
+if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) )  opt = Disp_Next;
+// Trace en superpoistion
+if ( (opt == Disp_Same) && (mLastWdg) ) {  
   if (mLastWdg->kind() == PIScDrawWdg::ClassId)  ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
   else mLastWdg->AddDrawer(scd, true, true, true);
+  scd->Refresh(); 
+  mDId++;
+  mDrwList[mDId] = scd;
+  return(-mDId);   
+}
+// Trace en medaillon
+else if ( (opt == Disp_Inset) && (mLastWdg) ) {
+  PIGrCoord x1, x2, y1, y2;
+  x1 = mIXmin;  x2 = mIXmax;
+  y2 = 1.-mIYmin;  y1 = 1.-mIYmax;
+  scd->SetAxesFlags(mAxesFlags);
+  scd->UpdateLimits();
+  mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
   scd->Refresh();
   mDId++;
@@ -471,5 +487,4 @@
   return(-mDId);   
 }
-else if (opt == Disp_Same)  opt = Disp_Next;
 
 PIWindow* win;
@@ -519,4 +534,6 @@
 if ( mCmapid != CMAP_OTHER ) dr3->SetColMapId(mCmapid);
 
+if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) )  opt = Disp_Next;
+// Trace en superpoistion
 if ( (opt == Disp_Same) && (mLastWdg) ) {
   if (mLastWdg->kind() == PIDraw3DWdg::ClassId)  ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
@@ -527,5 +544,18 @@
   return(-mDId);   
 }
-else if (opt == Disp_Same)  opt = Disp_Next;
+// Trace en medaillon
+else if ( (opt == Disp_Inset) && (mLastWdg) ) {
+  PIGrCoord x1, x2, y1, y2;
+  x1 = mIXmin;  x2 = mIXmax;
+  y2 = 1.-mIYmin;  y1 = 1.-mIYmax;
+  dr3->SetAxesFlags(mAxesFlags);
+  dr3->UpdateLimits();
+  mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
+  dr3->Refresh();
+  mDId++;
+  mDrwList[mDId] = dr3;
+  return(-mDId);   
+}
+
 
 PIWindow* win;
@@ -1294,4 +1324,11 @@
 
 /* --Methode-- */
+void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
+{
+  mIXmin = xmin;  mIXmax= xmax;
+  mIYmin = ymin;  mIYmax= ymax;
+}
+
+/* --Methode-- */
 void PIStdImgApp::SaveGraphicAtt()
 {
@@ -1308,4 +1345,6 @@
   mSXmin = mXmin;  mSXmax = mXmax;
   mSYmin = mYmin;  mSYmax = mYmax;
+  mSIXmin = mIXmin;  mSIXmax = mIXmax;
+  mSIYmin = mIYmin;  mSIYmax = mIYmax;
   mSFXYlim = mFXYlim;
   mSaXlog = maXlog;
@@ -1328,4 +1367,6 @@
   mXmin = mSXmin;  mXmax = mSXmax;
   mYmin = mSYmin;  mYmax = mSYmax;
+  mIXmin = mSIXmin;  mIXmax = mSIXmax;
+  mIYmin = mSIYmin;  mIYmax = mSIYmax;
   mFXYlim = mSFXYlim;
   maXlog = mSaXlog;
Index: trunk/SophyaPI/PIext/pistdimgapp.h
===================================================================
--- trunk/SophyaPI/PIext/pistdimgapp.h	(revision 546)
+++ trunk/SophyaPI/PIext/pistdimgapp.h	(revision 548)
@@ -31,5 +31,5 @@
 
 
-enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3};
+enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3, Disp_Inset=4};
 
 typedef map<long, PIWindow*, less<long> > WindMList;
@@ -101,4 +101,5 @@
      void  SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels);
      void  SetXYLimits(double xmin=-1., double xmax=1., double ymin=-1., double ymax=1.);
+     void  SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
      inline void  UseXYLimits(bool fg=false) {  mFXYlim=fg; }
      inline void  SetXLogScale(bool logx=false) { maXlog = logx; }
@@ -171,4 +172,6 @@
     double	 mXmin, mXmax, mYmin, mYmax;
     double	 mSXmin, mSXmax, mSYmin, mSYmax;
+    double	 mIXmin, mIXmax, mIYmin, mIYmax;
+    double	 mSIXmin, mSIXmax, mSIYmin, mSIYmax;
     bool	 mFXYlim, mSFXYlim;
     bool	 maXlog, mSaXlog;
Index: trunk/SophyaPI/PIext/servnobjm.cc
===================================================================
--- trunk/SophyaPI/PIext/servnobjm.cc	(revision 546)
+++ trunk/SophyaPI/PIext/servnobjm.cc	(revision 548)
@@ -1314,4 +1314,5 @@
   if ( (grt[k] == "win") || (grt[k] == "w") )  ropt =  Disp_Win;
   else if ( (grt[k] == "same") || (grt[k] == "s") )  ropt = Disp_Same;
+  else if ( (grt[k] == "inset") || (grt[k] == "ins") )  ropt = Disp_Inset;
   else  if ( (grt[k] == "stack") || (grt[k] == "st") )  ropt = Disp_Stack;
   else fgcont = false;
