Salome HOME
Update copyright notes (for 2010)
[modules/geom.git] / src / BasicGUI / BasicGUI_PointDlg.cxx
index 6dbd90b262613595cd4575bfe935147ded5de995..ef68dfb54d07a0512f9609b62631f612e7f1bdaf 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  GEOM GEOMGUI : GUI for Geometry component
 //  File   : BasicGUI_PointDlg.cxx
 //  Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-
+//
 #include "BasicGUI_PointDlg.h"
 
 #include <SUIT_ResourceMgr.h>
@@ -43,6 +44,7 @@
 #include <QLabel>
 #include <QRadioButton>
 #include <QMenu>
+#include <QTimer>
 
 #include <gp_Pnt.hxx>
 #include <TopoDS_Shape.hxx>
@@ -230,28 +232,28 @@ void BasicGUI_PointDlg::Init()
   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
 
   /* min, max, step and decimals for spin boxes */
-  initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+  initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
   GroupXYZ->SpinBox_DX->setValue( 0.0 );
   GroupXYZ->SpinBox_DY->setValue( 0.0 );
   GroupXYZ->SpinBox_DZ->setValue( 0.0 );
 
-  initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+  initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
   GroupRefPoint->SpinBox_DX->setValue( 0.0 );
   GroupRefPoint->SpinBox_DY->setValue( 0.0 );
   GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
 
   step = 0.1;
 
-  initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision" );
   GroupOnCurve->SpinBox_DX->setValue( 0.5 );
 
-  initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision" );
   GroupOnSurface->SpinBox_DX->setValue( 0.5 );
-  initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision" );
   GroupOnSurface->SpinBox_DY->setValue( 0.5 );
 
   /* signals and slots connections */
@@ -263,8 +265,7 @@ void BasicGUI_PointDlg::Init()
 
   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
 
-  connect( myParamCoord->button( PARAM_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
-  connect( myParamCoord->button( COORD_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
+  connect( myParamCoord,   SIGNAL( buttonClicked( int ) ), this, SLOT( ClickParamCoord( int ) ) );
   connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupOnCurve->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
@@ -310,8 +311,6 @@ void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
   GroupRefPoint->SpinBox_DX->setSingleStep(step);
   GroupRefPoint->SpinBox_DY->setSingleStep(step);
   GroupRefPoint->SpinBox_DZ->setSingleStep(step);
-  GroupOnSurface->SpinBox_DX->setSingleStep(step);
-  GroupOnSurface->SpinBox_DY->setSingleStep(step);
 }
 
 
@@ -420,9 +419,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   myY->setText( "" );
   myZ->setText( "" );
 
-  qApp->processEvents();
-  updateGeometry();
-  resize( 100, 100 );
+  QTimer::singleShot(50, this, SLOT(updateSize()));
 
   SelectionIntoArgument();
 }
@@ -952,7 +949,7 @@ void BasicGUI_PointDlg::addSubshapesToStudy()
 // function : ClickParamCoord()
 // purpose  :
 //=================================================================================
-void BasicGUI_PointDlg::ClickParamCoord()
+void BasicGUI_PointDlg::ClickParamCoord( int id )
 {
   updateParamCoord( true );
   displayPreview();
@@ -965,7 +962,6 @@ void BasicGUI_PointDlg::ClickParamCoord()
 void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
 {
   bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
-  GroupXYZ->setShown( !isParam );
 
   const int id = getConstructorId();
   if ( id == GEOM_POINT_EDGE ) {
@@ -978,11 +974,11 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
     GroupOnSurface->SpinBox_DX->setShown( isParam );
     GroupOnSurface->SpinBox_DY->setShown( isParam );
   }
-  if ( theIsUpdate ) {
-    qApp->processEvents();
-    updateGeometry();
-    resize( minimumSizeHint() );
-  }
+
+  GroupXYZ->setShown( !isParam );
+
+  if ( theIsUpdate )
+    QTimer::singleShot(50, this, SLOT(updateSize()));
 }
 
 //=================================================================================
@@ -1001,3 +997,14 @@ void BasicGUI_PointDlg::onBtnPopup( QAction* a )
   
   localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 }
+
+//=================================================================================
+// function : updateSize
+// purpose  : adjust dialog size to minimum
+//=================================================================================
+void BasicGUI_PointDlg::updateSize() 
+{
+  qApp->processEvents();
+  updateGeometry();
+  resize( minimumSizeHint() );
+}