Index: trunk/SophyaPI/PIext/pihisto.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto.cc	(revision 1855)
+++ trunk/SophyaPI/PIext/pihisto.cc	(revision 1856)
@@ -38,4 +38,5 @@
   mAdDO = ad;     // Flag pour suppression automatique de mHisto
   SetStats(true);
+  SetName("HistoDrw");
 }
 
Index: trunk/SophyaPI/PIext/pihisto2d.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto2d.cc	(revision 1855)
+++ trunk/SophyaPI/PIext/pihisto2d.cc	(revision 1856)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include "piapplgen.h"
+#include <pisysdep.h>
+#include PIAPP_H
 #include "pihisto2d.h"
 #include "nbrandom.h"
@@ -40,4 +41,7 @@
 UseDyn();
 UseFrac();
+SetName("Histo2DDrw"); 
+// PIHisto2D has specific control tools
+mFgSpecContWind = true;
 }
 
@@ -190,4 +194,15 @@
  SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());
 }
+
+//++
+void PIHisto2D::ShowControlWindow(PIBaseWdgGen* wdg)
+//
+//	Affichage de la fenetre de controle H2WinArg
+//--
+{
+  H2WinArg::SetCurrentPIHisto2D(this);
+  H2WinArg::ShowPIHisto2DTools(wdg);
+}
+
 
 //++
@@ -445,4 +460,5 @@
 static int nb_h2dWinArg = 0;
 
+
 //++
 PIH2DWdg::PIH2DWdg(PIContainerGen *par, const char *nom, int sx, int sy, int px, int py)
@@ -536,5 +552,7 @@
 //--
 {
-h2dWinArg->SetPIH2DWdg(this);
+// h2dWinArg->SetPIH2DWdg(this);
+h2dWinArg->SetCurrentBaseWdg(this);
+h2dWinArg->SetCurrentPIHisto2D(this->GetPIHisto());
 h2dWinArg->SetMsgParent((PIMsgHandler*)this);
 if(!h2dWinArg->Visible()) h2dWinArg->Show();
@@ -583,6 +601,48 @@
 //--
 
-//++
-H2WinArg::H2WinArg(PIH2DWdg *par)
+PIBaseWdgGen* H2WinArg::mBWdg = NULL;
+PIHisto2D* H2WinArg::mH2DDrw = NULL;
+static H2WinArg* cur_h2winarg = NULL;
+
+void H2WinArg::ShowPIHisto2DTools()
+{
+  if (cur_h2winarg == NULL)  cur_h2winarg = new H2WinArg(PIApplicationGetApp());
+  cur_h2winarg->Show();
+}
+
+void H2WinArg::ShowPIHisto2DTools(PIBaseWdgGen* cbw)
+{
+  if (cur_h2winarg == NULL)  cur_h2winarg = new H2WinArg(PIApplicationGetApp());
+  mBWdg = cbw;
+  cur_h2winarg->Show();
+}
+
+void H2WinArg::HidePIHisto2DTools()
+{
+  if (cur_h2winarg != NULL)  cur_h2winarg->Hide();
+}
+
+void H2WinArg::SetCurrentBaseWdg(PIBaseWdgGen* cbw)
+{
+  mBWdg = cbw;
+}
+
+void H2WinArg::SetCurrentPIHisto2D(PIHisto2D* h2ddrw)
+{
+  mH2DDrw = h2ddrw;
+}
+
+PIBaseWdgGen* H2WinArg::GetCurrentBaseWdg()
+{
+  return(mBWdg);
+}
+
+PIHisto2D* H2WinArg::GetCurrentPIHisto2D()
+{
+  return(mH2DDrw);
+}
+
+//++
+H2WinArg::H2WinArg(PIMsgHandler* par)
 //
 //	Creation de la fenetre de gestion des parametres
@@ -623,5 +683,4 @@
 //--
 : PIWindow((PIMsgHandler *)par,"Options",PIWK_dialog,250,260,150,150)
-, mH2Wdg(NULL)
 , mFgCol(false), mCmap(CMAP_GREYINV32), mRevCmap(false)
 , mTypScal(0)  , mLogScale(10.)
@@ -781,4 +840,5 @@
 }
 
+/* A-Virer  Reza 11/01/2002 
 //++
 void H2WinArg::SetPIH2DWdg(PIH2DWdg* h2wdg)
@@ -791,4 +851,5 @@
 if(dbg) printf("H2WinArg::SetPIH2DWdg mH2Wdg = %lx\n",(long)mH2Wdg);
 }
+  Fin de A-Virer ---- */
 
 //++
@@ -801,6 +862,8 @@
               ,(int)UserMsg(msg),(int)ModMsg(msg),(long)sender);
 
-if(!mH2Wdg) return;
-PIHisto2D* mpih = mH2Wdg->GetPIHisto();
+// if(!mH2Wdg) return;
+if(!mBWdg) return;
+// PIHisto2D* mpih = mH2Wdg->GetPIHisto();
+PIHisto2D* mpih = mH2DDrw;
 if(!mpih) return;
 
@@ -835,5 +898,5 @@
   mpih->UseDyn(mHMin,mHMax);
   mpih->UseFrac(mFracMin,mFracMax);
-  mH2Wdg->Refresh();  // On rafraichit le dessin (tout le PIScDrawWdg)
+  mBWdg->Refresh();  // On rafraichit le dessin (tout le PIScDrawWdg)
 }
 else if(opt==6002) this->Hide();
Index: trunk/SophyaPI/PIext/pihisto2d.h
===================================================================
--- trunk/SophyaPI/PIext/pihisto2d.h	(revision 1855)
+++ trunk/SophyaPI/PIext/pihisto2d.h	(revision 1856)
@@ -31,4 +31,7 @@
   virtual void UpdateLimits();
   virtual void DrawStats(PIGraphicUC* g);
+
+//  Methode permettant l'affichage d'une fenetre de controle specialisee 
+  virtual void ShowControlWindow(PIBaseWdgGen* wdg);
 
   inline Histo2D*       Histogram()   {return(mHisto);}
@@ -80,8 +83,16 @@
 class H2WinArg : public PIWindow {
 public :
-  H2WinArg(PIH2DWdg *par);
+  H2WinArg(PIMsgHandler* par);
   ~H2WinArg();
 
-  void SetPIH2DWdg(PIH2DWdg* h2wdg);
+  static void ShowPIHisto2DTools();
+  static void ShowPIHisto2DTools(PIBaseWdgGen* cbw);
+  static void HidePIHisto2DTools();
+  static void SetCurrentBaseWdg(PIBaseWdgGen* cbw);
+  static void SetCurrentPIHisto2D(PIHisto2D* h2ddrw);
+
+  static PIBaseWdgGen* GetCurrentBaseWdg();
+  static PIHisto2D* GetCurrentPIHisto2D();
+
   void SetText();
 
@@ -89,5 +100,6 @@
 
 protected:
-  PIH2DWdg  * mH2Wdg;
+  static PIBaseWdgGen * mBWdg;
+  static PIHisto2D*  mH2DDrw;
 
   PIOptMenu * mOPop[3];
Index: trunk/SophyaPI/PIext/pintup3d.cc
===================================================================
--- trunk/SophyaPI/PIext/pintup3d.cc	(revision 1855)
+++ trunk/SophyaPI/PIext/pintup3d.cc	(revision 1856)
@@ -50,4 +50,5 @@
   SelectErrBar();
   SelectLabel(NULL);
+  SetName("NTup3DDrw");
 }
 
Index: trunk/SophyaPI/PIext/pintuple.cc
===================================================================
--- trunk/SophyaPI/PIext/pintuple.cc	(revision 1855)
+++ trunk/SophyaPI/PIext/pintuple.cc	(revision 1856)
@@ -50,4 +50,5 @@
   SelectErrBar();
   SelectLabel(NULL);
+  SetName("NTupleDrw");
 }
 
Index: trunk/SophyaPI/PIext/pistdimgapp.cc
===================================================================
--- trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 1855)
+++ trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 1856)
@@ -19,5 +19,5 @@
 
 #include "pistdimgapp.h"
-#include "pihisto2d.h"
+// #include "pihisto2d.h"
 #include "psfile.h"
 #include "piimgtools.h"
@@ -564,7 +564,9 @@
 sy = 200+mFgScSz*100;
 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
+/*
 if (typeid(*scd) != typeid(PIHisto2D)) 
-   scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
 else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
+*/
+scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
 scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 scw->SetUserData(NULL, oid);
@@ -575,7 +577,9 @@
 // Fonte de trace d'axe
 scw->BaseDrawer()->SetFont(mFName, mFSz, mFAtt);
-
-if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
+/*
+if (typeid(*scd) != typeid(PIHisto2D)) 
 else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
+*/
+scw->AddScDrawer(scd, true);
 //   Titre du plot
 if (mAddTitle) {
