Salome HOME
Fix bug 13058: 'Remove webs' functionality works incorrectly.
[modules/geom.git] / src / OperationGUI / OperationGUI.cxx
index 6838a57d7d58839909672de2bb3deda2e402ebcf..1372e926da4b94ce304d5d497441cbbbff76a6cb 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -30,6 +30,7 @@
 
 #include "SUIT_Session.h"
 #include "SUIT_Desktop.h"
+#include "SalomeApp_Application.h"
 
 #include <TopTools_MapOfShape.hxx>
 #include <TopExp_Explorer.hxx>
 
 using namespace std;
 
-OperationGUI* OperationGUI::myGUIObject = 0;
-
-//=======================================================================
-// function : GetOperationGUI()
-// purpose  : Get the only OperationGUI object [ static ]
-//=======================================================================
-OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent )
-{
-  if ( myGUIObject == 0 ) {
-    // init OperationGUI only once
-    myGUIObject = new OperationGUI( parent );
-  }
-  return myGUIObject;
-}
-
 //=======================================================================
 // function : OperationGUI()
 // purpose  : Constructor
@@ -67,7 +53,6 @@ OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent)
 {
 }
 
-
 //=======================================================================
 // function : ~OperationGUI()
 // purpose  : Destructor
@@ -83,30 +68,22 @@ OperationGUI::~OperationGUI()
 //=======================================================================
 bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
 {
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if (!app) return false;
+
   getGeometryGUI()->EmitSignalDeactivateDialog();
-  
-  switch ( theCommandID )
+
+  switch (theCommandID)
   {
-    case 503: // PARTITION
-      ( new OperationGUI_PartitionDlg( parent, "" ) )->show();
-    break;
-    case 504: // ARCHIMEDE
-      new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent );
-    break;
-    case 505: // FILLET
-      new OperationGUI_FilletDlg( parent );    
-    break;
-    case 506: // CHAMFER
-      new OperationGUI_ChamferDlg( parent );
-    break;
-    case 507: // CLIPPING RANGE
-      ( new OperationGUI_ClippingDlg( parent, "" ) )->show();
-    break;
-    default:
-      SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-    break;
+  case 503: (new OperationGUI_PartitionDlg(getGeometryGUI(), parent))->show(); break;
+  case 504: (new OperationGUI_ArchimedeDlg(getGeometryGUI(), parent))->show(); break;
+  case 505: (new OperationGUI_FilletDlg   (getGeometryGUI(), parent))->show(); break;
+  case 506: (new OperationGUI_ChamferDlg  (getGeometryGUI(), parent))->show(); break;
+  case 507: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
+  default:
+    app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
   }
-  
+
   return true;
 }
 
@@ -120,6 +97,6 @@ extern "C"
 #endif
   GEOMGUI* GetLibGUI(GeometryGUI* parent)
   {
-    return OperationGUI::GetOperationGUI(parent);
+    return new OperationGUI(parent);
   }
 }