Salome HOME
Fix for PAL10496.
[modules/geom.git] / src / RepairGUI / RepairGUI_RemoveHolesDlg.cxx
index 8572c9fbc603b9290ceede75ffeef8965c7cf2d8..4f5b2c335fdfbebc4c1a635f30e3021f202199e4 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
 //
 //
 //
 //  Module : GEOM
 //  $Header$
 
-using namespace std;
 #include "RepairGUI_RemoveHolesDlg.h"
 
-#include "QAD_RightFrame.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Session.h"
 
-#include "GEOM_Displayer.h"
-#include "OCCViewer_Viewer3d.h"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "GEOMImpl_Types.hxx"
 
 #include <TopAbs.hxx>
+#include <TColStd_MapOfInteger.hxx>
 
+using namespace std;
 
 //=================================================================================
 // class    : RepairGUI_RemoveHolesDlg()
@@ -49,11 +49,13 @@ using namespace std;
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
-  :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
+                                                   const char* name, bool modal, WFlags fl)
+  :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
+                     WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_HOLES")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_HOLES")));
+  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
 
   setCaption(tr("GEOM_REMOVE_HOLES_TITLE"));
 
@@ -103,6 +105,8 @@ RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(QWidget* parent, const char*
   GroupPoints->getGroupBoxLayout()->addLayout( aDetectLay, 3, 0 );
   /***************************************************************/
 
+  setHelpFileName("suppress_holes.htm");
+
   Init();
 }
 
@@ -129,17 +133,13 @@ void RepairGUI_RemoveHolesDlg::Init()
   myWiresInd = new GEOM::short_array();
   myWiresInd->length( 0 );
 
-  myGeomGUI->SetState( 0 );
+  //myGeomGUI->SetState( 0 );
   initSelection();
 
   myClosed = -1;
   myOpen = -1;
   
   /* signals and slots connections */
-  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
-  connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
-  connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
-
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
 
@@ -148,7 +148,8 @@ void RepairGUI_RemoveHolesDlg::Init()
   connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
 
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) );
   connect( myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect()) );
@@ -167,8 +168,6 @@ void RepairGUI_RemoveHolesDlg::ClickOnOk()
     ClickOnCancel();
 }
 
-
-
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
@@ -192,16 +191,6 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
 }
 
 
-//=================================================================================
-// function : ClickOnCancel()
-// purpose  :
-//=================================================================================
-void RepairGUI_RemoveHolesDlg::ClickOnCancel()
-{
-  GEOMBase_Skeleton::ClickOnCancel();
-}
-
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection
@@ -213,9 +202,9 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
   if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil();
   else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 );
 
-  if ( mySelection->IObjectCount() == 1 )
+  if ( IObjectCount() == 1 )
   {
-    Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+    Handle(SALOME_InteractiveObject) anIO = firstIObject();
 
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 )     // face selection
     {
@@ -229,7 +218,7 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
     else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() )
     {
       TColStd_IndexedMapOfInteger aMap;
-      mySelection->GetIndex( anIO, aMap );
+      ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap );
       const int n = aMap.Extent();
       myWiresInd->length( n );
       for ( int i = 1; i <= n; i++ )
@@ -275,17 +264,6 @@ void RepairGUI_RemoveHolesDlg::LineEditReturnPressed()
 }
 
 
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose  :
-//=================================================================================
-void RepairGUI_RemoveHolesDlg::DeactivateActiveDialog()
-{
-  myGeomGUI->SetState( -1 );
-  GEOMBase_Skeleton::DeactivateActiveDialog();
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -293,7 +271,8 @@ void RepairGUI_RemoveHolesDlg::DeactivateActiveDialog()
 void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   myEditCurrentArgument = GroupPoints->LineEdit1;
   myEditCurrentArgument->setText("");
@@ -304,7 +283,7 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
   myClosed = -1;
   myOpen = -1;
 
-  myGeomGUI->SetState( 0 );
+  //myGeomGUI->SetState( 0 );
   initSelection();
 }
 
@@ -326,7 +305,7 @@ void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e)
 //=================================================================================
 void RepairGUI_RemoveHolesDlg::closeEvent(QCloseEvent* e)
 {
-  myGeomGUI->SetState( -1 );
+  //myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::closeEvent( e );
 }
 
@@ -441,6 +420,6 @@ void RepairGUI_RemoveHolesDlg::onDetect()
     msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen );
   else
     msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
-  QAD_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
+  SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
 }