Salome HOME
Fix for bug PAL12858(EDF210 GEOM Preferences menu of GEOM: color of the wireframe?)
[modules/geom.git] / src / RepairGUI / RepairGUI_CloseContourDlg.cxx
index 46721ef621b8bbb174ff0587dc1e6e285a431135..640306b4b21e1d157feea61f550e27f17cd34fee 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_CloseContourDlg.h"
 
-#include "QAD_RightFrame.h"
-#include "QAD_Desktop.h"
-#include "OCCViewer_Viewer3d.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "SUIT_Session.h"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "GEOMImpl_Types.hxx"
 
 #include <TopAbs.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <qlabel.h>
 
+using namespace std;
 
 //=================================================================================
 // class    : RepairGUI_CloseContourDlg()
@@ -46,11 +50,13 @@ using namespace std;
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(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_CloseContourDlg::RepairGUI_CloseContourDlg(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_CLOSECONTOUR")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CLOSECONTOUR")));
+  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
 
   setCaption(tr("GEOM_CLOSECONTOUR_TITLE"));
 
@@ -97,6 +103,8 @@ RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(QWidget* parent, const char
   GroupPoints->getGroupBoxLayout()->addMultiCellWidget(myIsVertexGr, 2, 2, 0, 2);
   /***************************************************************/
 
+  setHelpFileName("close_contour.htm");
+
   Init();
 }
 
@@ -123,14 +131,10 @@ void RepairGUI_CloseContourDlg::Init()
   myWiresInd = new GEOM::short_array();
   myWiresInd->length( 0 );
   
-  myGeomGUI->SetState( 0 );
+  //myGeomGUI->SetState( 0 );
   initSelection();
 
   /* 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()));
 
@@ -139,7 +143,8 @@ void RepairGUI_CloseContourDlg::Init()
   connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
 
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) );
 }
@@ -178,16 +183,6 @@ bool RepairGUI_CloseContourDlg::ClickOnApply()
   return true;
 }
 
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose  :
-//=================================================================================
-void RepairGUI_CloseContourDlg::ClickOnCancel()
-{
-  GEOMBase_Skeleton::ClickOnCancel();
-}
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
@@ -204,9 +199,9 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
   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
     {
@@ -216,7 +211,7 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
       {
         myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
         TopoDS_Shape aShape;
-        if ( myGeomBase->GetShape( myObject, aShape, TopAbs_WIRE ) )
+        if ( GEOMBase::GetShape( myObject, aShape, TopAbs_WIRE ) )
           mySelectWiresEdt->setText( myEditCurrentArgument->text() );
       }
       else
@@ -225,7 +220,7 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
     else if ( myEditCurrentArgument == mySelectWiresEdt )
     {
       TColStd_IndexedMapOfInteger aMap;
-      mySelection->GetIndex( anIO, aMap );
+      myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap );
       const int n = aMap.Extent();
       myWiresInd->length( n );
       for ( int i = 1; i <= n; i++ )
@@ -271,17 +266,6 @@ void RepairGUI_CloseContourDlg::LineEditReturnPressed()
 }
 
 
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose  :
-//=================================================================================
-void RepairGUI_CloseContourDlg::DeactivateActiveDialog()
-{
-  myGeomGUI->SetState( -1 );
-  GEOMBase_Skeleton::DeactivateActiveDialog();
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -289,7 +273,8 @@ void RepairGUI_CloseContourDlg::DeactivateActiveDialog()
 void RepairGUI_CloseContourDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   myEditCurrentArgument = GroupPoints->LineEdit1;
   myEditCurrentArgument->setText("");
@@ -297,7 +282,7 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog()
   myObject = GEOM::GEOM_Object::_nil();
   myWiresInd->length( 0 );
 
-  myGeomGUI->SetState( 0 );
+  //myGeomGUI->SetState( 0 );
   initSelection();
 }
 
@@ -319,7 +304,7 @@ void RepairGUI_CloseContourDlg::enterEvent(QEvent* e)
 //=================================================================================
 void RepairGUI_CloseContourDlg::closeEvent(QCloseEvent* e)
 {
-  myGeomGUI->SetState( -1 );
+  //myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::closeEvent( e );
 }
 
@@ -339,7 +324,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_CloseContourDlg::createOperation()
 bool RepairGUI_CloseContourDlg::isValid( QString& msg )
 {
   TopoDS_Shape aTmpShape;
-  return !myObject->_is_nil() && ( myWiresInd->length() || myGeomBase->GetShape( myObject, aTmpShape, TopAbs_WIRE ) );
+  return !myObject->_is_nil() && ( myWiresInd->length() || GEOMBase::GetShape( myObject, aTmpShape, TopAbs_WIRE ) );
 }
 
 //=================================================================================
@@ -388,5 +373,3 @@ void RepairGUI_CloseContourDlg::initSelection()
     localSelection( myObject, TopAbs_WIRE );
   }
 }
-
-