Salome HOME
Update for bug IPAL19949.
[modules/geom.git] / src / OperationGUI / OperationGUI_ArchimedeDlg.cxx
index 26a867ae2eb011f96f2859f52d3bab4b9757af4c..9102c527377835877a9203f44a41d5b2616dfe60 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 "OperationGUI_ArchimedeDlg.h"
 #include "DlgRef_1Sel3Spin.h"
 
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include <qlabel.h>
 
 //=================================================================================
 // class    : OperationGUI_ArchimedeDlg()
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, SALOME_Selection* Sel )
-: GEOMBase_Skeleton( parent, "ArchimedeDlg", Sel, false,
-    WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
+  : GEOMBase_Skeleton(theGeometryGUI, parent, "ArchimedeDlg", false,
+                      WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  mySelection = Sel;
-
-  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE")));
-  QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE")));
+  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
   
   setCaption(tr("GEOM_ARCHIMEDE_TITLE"));
 
@@ -68,8 +70,10 @@ OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, SALOME_Se
   Layout1->addWidget(GroupPoints, 2, 0);
   /***************************************************************/
 
+  setHelpFileName("archimede_page.html");
+
   /* Initialisations */
-  Init( mySelection );
+  Init();
 }
 
 
@@ -87,23 +91,21 @@ OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg()
 // function : Init()
 // purpose  :
 //=================================================================================
-void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel )
+void OperationGUI_ArchimedeDlg::Init()
 {
-  mySelection = Sel;
-
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
 
   /* Get setting of myStep value from file configuration */
-  QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
-  myStep = !St.isEmpty() ? St.toDouble() : 100;
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  double myStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
 
   double SpecificStep1 = 0.1;
   double SpecificStep2 = 0.01;
   /* min, max, myStep and decimals for spin boxes & initial values */
-  GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, myStep, 3);
-  GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep1, 3);
-  GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, SpecificStep2, 3);
+  GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, DBL_DIGITS_DISPLAY);
+  GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY);
+  GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, DBL_DIGITS_DISPLAY);
 
   GroupPoints->SpinBox_DX->SetValue( 100.0 );
   GroupPoints->SpinBox_DY->SetValue( 1.0 );
@@ -119,17 +121,14 @@ void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel )
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double)));
   
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
-
+  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+         this, SLOT(SelectionIntoArgument()));
+  
   initName( tr( "GEOM_ARCHIMEDE" ) );
-
+  
   globalSelection( GEOM_ALLSHAPES );
 
   SelectionIntoArgument();
-  
-  /* displays Dialog */
-  GroupPoints->show();
-  this->show();
 }
 
 
@@ -167,11 +166,11 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
   myEditCurrentArgument->setText( "" );
   myShape = GEOM::GEOM_Object::_nil();
   
-  if ( mySelection->IObjectCount() != 1 )
+  if ( IObjectCount() != 1 )
     return;
 
   Standard_Boolean testResult = Standard_False;
-  myShape = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult );
+  myShape = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
 
   if ( !testResult || myShape->_is_nil() || !GEOMBase::IsShape( myShape ) )
   {
@@ -207,7 +206,8 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
   globalSelection( GEOM_ALLSHAPES );
-  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  connect(myGeomGUI->getApp()->selectionMgr(),
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   return;
 }