Salome HOME
Issue 0021055: EDF 1602 STUDY: Object browser reactualisation when creating an object
[modules/geom.git] / src / BlocksGUI / BlocksGUI.cxx
index e2707c163aaa952fb7dbc686ef6ff764be1380d8..307f66f7ecf5304e9373b5313b6fadab82f452f1 100644 (file)
@@ -1,6 +1,7 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  CEA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
 //  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.salome-platform.org or email : webmaster.salome@opencascade.org
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//
-//
-//  File   : BooleanGUI.cxx
-//  Author : Julia DOOVSKIKH
-//  Module : GEOM
-//  $Header$
 
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : BooleanGUI.cxx
+// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
+//
 #include "BlocksGUI.h"
 
 #include "BlocksGUI_QuadFaceDlg.h"
 #include "BlocksGUI_BlockDlg.h"
 #include "BlocksGUI_TrsfDlg.h"
-//#include "BlocksGUI_CheckMultiBlockDlg.h"
 #include "BlocksGUI_ExplodeDlg.h"
 #include "BlocksGUI_PropagateDlg.h"
 
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-
-BlocksGUI* BlocksGUI::myGUIObject = 0;
+#include <GeometryGUI.h>
+#include "GeometryGUI_Operations.h"
 
-//=======================================================================
-// function : GetBlocksGUI()
-// purpose  : Get the only BlocksGUI object [ static ]
-//=======================================================================
-BlocksGUI* BlocksGUI::GetBlocksGUI()
-{
-  if ( myGUIObject == 0 )
-    myGUIObject = new BlocksGUI();
-
-  return myGUIObject;
-}
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
 
 //=======================================================================
 // function : BlocksGUI()
 // purpose  : Constructor
 //=======================================================================
-BlocksGUI::BlocksGUI()
-     : GEOMGUI()
+BlocksGUI::BlocksGUI( GeometryGUI* parent )
+  : GEOMGUI( parent )
 {
 }
 
@@ -74,51 +61,28 @@ BlocksGUI::~BlocksGUI()
 // function : OnGUIEvent()
 // purpose  :
 //=======================================================================
-bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
+bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
 {
-  GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
-
-  SALOME_Selection* Sel = SALOME_Selection::Selection
-    (QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-
-  QDialog* aDlg = NULL;
-
-  switch (theCommandID)
-  {
-    case 9999:
-      aDlg = new BlocksGUI_BlockDlg (parent, Sel);
-      break;
-
-    case 9998:
-      aDlg = new BlocksGUI_TrsfDlg (parent, Sel);
-      break;
-
-    case 9997:
-      aDlg = new BlocksGUI_QuadFaceDlg (parent, Sel);
-      break;
-
-    case 9996:
-//      aDlg = new BlocksGUI_CheckMultiBlockDlg (parent, Sel);
-      QAD_MessageBox::warn1 (parent,
-                             QObject::tr("WRN_WARNING"), 
-                             QObject::tr("WRN_NOT_IMPLEMENTED"),
-                             QObject::tr("BUT_OK"));
-      break;
-
-    case 9995:
-      aDlg = new BlocksGUI_ExplodeDlg (parent, Sel);
-      break;
-    case 99991:
-      aDlg = new BlocksGUI_PropagateDlg (parent, "", Sel);
-      break;
-
-    default:
-      parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-      break;
+  getGeometryGUI()->EmitSignalDeactivateDialog();
+
+  QDialog* aDlg = 0;
+
+  switch ( theCommandID ) {
+  case GEOMOp::OpHexaSolid:      aDlg = new BlocksGUI_BlockDlg    ( getGeometryGUI(), parent ); break;
+  case GEOMOp::OpMultiTransform: aDlg = new BlocksGUI_TrsfDlg     ( getGeometryGUI(), parent ); break;
+  case GEOMOp::OpQuadFace:       aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break;
+  case GEOMOp::OpExplodeBlock:   aDlg = new BlocksGUI_ExplodeDlg  ( getGeometryGUI(), parent ); break;
+  case GEOMOp::OpPropagate:      aDlg = new BlocksGUI_PropagateDlg( getGeometryGUI(), parent ); break;
+  default:
+    getGeometryGUI()->getApp()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
+    break;
   }
 
-  if (aDlg != NULL)
+  if ( aDlg ) {
+    aDlg->updateGeometry();
+    aDlg->resize( aDlg->minimumSizeHint() );
     aDlg->show();
+  }
 
   return true;
 }
@@ -128,8 +92,11 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
 //=====================================================================================
 extern "C"
 {
-  GEOMGUI* GetLibGUI()
+#ifdef WIN32
+  __declspec( dllexport )
+#endif
+  GEOMGUI* GetLibGUI( GeometryGUI* parent )
   {
-    return BlocksGUI::GetBlocksGUI();
+    return new BlocksGUI( parent );
   }
 }