Salome HOME
Updated for PAL14857.
[modules/geom.git] / src / TransformationGUI / TransformationGUI_PositionDlg.cxx
index d6fca90516bbdfd5d6a073d4bf13b1d0dd008811..07c3dee7c18f7c97a722e8aaaf2d7e6a4abe5dcf 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
 //
 //
 //
 
 #include "TransformationGUI_PositionDlg.h"
 
-#include "QAD_Desktop.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
 
+#include <qlabel.h>
 #include <qcheckbox.h>
 
+#include "TColStd_MapOfInteger.hxx"
+
 #include "GEOMImpl_Types.hxx"
 
 #include "utilities.h"
@@ -45,12 +51,15 @@ using namespace std;
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-TransformationGUI_PositionDlg::TransformationGUI_PositionDlg(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)
+TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
+  (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_POSITION")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POSITION2")));
-  QPixmap imageselect(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
+  QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION")));
+  QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION2")));
+  QPixmap imageselect(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT")));
 
   setCaption(tr("GEOM_POSITION_TITLE"));
 
@@ -79,6 +88,8 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg(QWidget* parent,  c
   Layout1->addWidget(Group1, 2, 0);
   
   /***************************************************************/
+
+  setHelpFileName("modify_the_location.htm");  
   
   Init();
 }
@@ -127,7 +138,8 @@ void TransformationGUI_PositionDlg::Init()
   
   connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
   
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   initName( tr( "GEOM_POSITION" ) );
   ConstructorsClicked( 0 );
@@ -141,7 +153,7 @@ void TransformationGUI_PositionDlg::Init()
 //=================================================================================
 void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
 {
-  disconnect( mySelection, 0, this, 0 );
+  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
   
   globalSelection();
   myEditCurrentArgument = Group1->LineEdit1;
@@ -167,12 +179,12 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
        break;
       }
     }
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   SelectionIntoArgument();
 }
 
 
-
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -199,16 +211,6 @@ bool TransformationGUI_PositionDlg::ClickOnApply()
 }
 
 
-//=======================================================================
-// function : ClickOnCancel()
-// purpose  :
-//=======================================================================
-void TransformationGUI_PositionDlg::ClickOnCancel()
-{
-  GEOMBase_Skeleton::ClickOnCancel();
-}
-
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection has changed
@@ -219,29 +221,27 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
   QString aName;
 
   if(myEditCurrentArgument == Group1->LineEdit1) {
-    int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName);
+    int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
     if(aNbSel < 1) {
       myObjects.length(0);
       displayPreview();
       return;
     }
-    GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects);
+    GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
     if (!myObjects.length()) {
       displayPreview();
       return;
     }
-    if(aNbSel != 1)
-      aName = tr("%1_objects").arg(aNbSel);
   }
   else if(myEditCurrentArgument == Group1->LineEdit2) {
     myStartLCS = GEOM::GEOM_Object::_nil();
-    if(mySelection->IObjectCount() != 1) {
+    if(IObjectCount() != 1) {
       displayPreview();
       return;
     }
 
     Standard_Boolean testResult = Standard_False;
-    myStartLCS = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
+    myStartLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
     if(!testResult || CORBA::is_nil( myStartLCS )) {
       displayPreview();
       return;
@@ -250,13 +250,13 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
   }
   else if(myEditCurrentArgument == Group1->LineEdit3) {
     myEndLCS = GEOM::GEOM_Object::_nil();
-    if(mySelection->IObjectCount() != 1) {
+    if(IObjectCount() != 1) {
       displayPreview();
       return;
     }
     
     Standard_Boolean testResult = Standard_False;
-    myEndLCS = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
+    myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
     if(!testResult || CORBA::is_nil( myEndLCS )) {
       displayPreview();
       return;
@@ -322,21 +322,12 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
 void TransformationGUI_PositionDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   ConstructorsClicked( getConstructorId() );
 }
 
 
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose  : public slot to deactivate if active
-//=================================================================================
-void TransformationGUI_PositionDlg::DeactivateActiveDialog()
-{
-  GEOMBase_Skeleton::DeactivateActiveDialog();
-}
-
-
 //=================================================================================
 // function : enterEvent()
 // purpose  : when mouse enter onto the QWidget