Salome HOME
Updated for PAL14857.
[modules/geom.git] / src / TransformationGUI / TransformationGUI_MultiTranslationDlg.cxx
index 108dbb1dd285a6969cb252dc4e88fea4a6e7b84d..75f3e4d3500d2cc942e389147cb55112ae12bba1 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_MultiTranslationDlg.h"
 
-#include "GEOMImpl_Types.hxx"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include <qlabel.h>
 
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
+#include "GEOMImpl_Types.hxx"
 
 #include <qcheckbox.h>
 
@@ -46,12 +50,15 @@ using namespace std;
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(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_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
+  (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_MULTITRANSLATION_SIMPLE")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
-  QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
+  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
+  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
+  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
+  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
 
   setCaption(tr("GEOM_MULTITRANSLATION_TITLE"));
 
@@ -95,6 +102,8 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(QWi
   Layout1->addWidget(GroupDimensions, 2, 0);
   /***************************************************************/
 
+  setHelpFileName("multi_translation.htm");
+
   Init();
 }
 
@@ -116,20 +125,20 @@ TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
 void TransformationGUI_MultiTranslationDlg::Init()
 {
   /* Get setting of step value from file configuration */
-  QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
-  double step = St.toDouble();
-
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
+  
   double SpecificStep = 1;
   /* min, max, step and decimals for spin boxes & initial values */
-  GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
-  GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
+  GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
+  GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3);
   GroupPoints->SpinBox_DX->SetValue(myStepU);
   GroupPoints->SpinBox_DY->SetValue(myNbTimesU);
 
-  GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, step, 3);
-  GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
-  GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3);
-  GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
+  GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
+  GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3);
+  GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
+  GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3);
   GroupDimensions->SpinBox_DX1->SetValue(myStepU);
   GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU);
   GroupDimensions->SpinBox_DX2->SetValue(myStepV);
@@ -170,7 +179,8 @@ void TransformationGUI_MultiTranslationDlg::Init()
   connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
   connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
   
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   
   initName( tr( "GEOM_MULTITRANSLATION" ) );
@@ -184,7 +194,7 @@ void TransformationGUI_MultiTranslationDlg::Init()
 //=================================================================================
 void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
 {
-  disconnect(mySelection, 0, this, 0);
+  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
   
   myStepU = myStepV = 50.0;
   myNbTimesU = myNbTimesV = 2;
@@ -231,7 +241,8 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI
   
   myEditCurrentArgument->setFocus();
   myBase = myVectorU = GEOM::GEOM_Object::_nil();
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
 
@@ -261,16 +272,6 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
 }
 
 
-//=======================================================================
-// function : ClickOnCancel()
-// purpose  :
-//=======================================================================
-void TransformationGUI_MultiTranslationDlg::ClickOnCancel()
-{
-  GEOMBase_Skeleton::ClickOnCancel();
-}
-
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection as changed or other case
@@ -279,7 +280,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText("");
   
-  if(mySelection->IObjectCount() != 1) {
+  if(IObjectCount() != 1) {
     if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1)
       myBase = GEOM::GEOM_Object::_nil();
     else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2)
@@ -291,7 +292,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
 
   // nbSel == 1
   Standard_Boolean testResult = Standard_False;;
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
+  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
 
   if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
     return;
@@ -368,22 +369,13 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
 void TransformationGUI_MultiTranslationDlg::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_MultiTranslationDlg::DeactivateActiveDialog()
-{
-  GEOMBase_Skeleton::DeactivateActiveDialog();
-}
-
-
 //=================================================================================
 // function : enterEvent()
 // purpose  :
@@ -470,7 +462,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV()
 //=================================================================================
 GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
 {
-  return getGeomEngine()->GetITransformOperations( getStudyId() );
+  return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
 }
 
 
@@ -534,6 +526,6 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
 //=================================================================================
 void  TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e )
 {
-  myGeomGUI->SetState( -1 );
+  // myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::closeEvent( e );
 }