Salome HOME
Implementation of the "16219: EDF PAL 469: "RemoveFromStudy" Function" issue.
[modules/geom.git] / src / GenerationGUI / GenerationGUI_PrismDlg.cxx
index bc2b10168ea9a169115e7db833759c2269b28fe7..6932c215f8fb62cb217753d39330766f9274c42f 100644 (file)
@@ -41,6 +41,7 @@
 #include <TopExp.hxx>
 #include <TColStd_IndexedMapOfInteger.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <Precision.hxx>
 
 #include <GEOMImpl_Types.hxx>
 
@@ -142,6 +143,7 @@ void GenerationGUI_PrismDlg::Init()
   // min, max, step and decimals for spin boxes & initial values
   double aScaleFactor = 2.0;
   double aScaleStep = 0.5;
+  double aScaleMin = Precision::Confusion() * 10.0;
 
   initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
   GroupVecH->SpinBox_DX->setValue(100.0);
@@ -153,9 +155,9 @@ void GenerationGUI_PrismDlg::Init()
   GroupDXDYDZ->SpinBox_DY->setValue(0.0);
   GroupDXDYDZ->SpinBox_DZ->setValue(0.0);
 
-  initSpinBox(GroupVecH->SpinBox_DY, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
-  initSpinBox(Group2Points->SpinBox1, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
-  initSpinBox(GroupDXDYDZ->SpinBox_SC, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
+  initSpinBox(GroupVecH->SpinBox_DY, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
+  initSpinBox(Group2Points->SpinBox1, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
+  initSpinBox(GroupDXDYDZ->SpinBox_SC, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
 
   GroupVecH->SpinBox_DY->setValue(aScaleFactor);
   Group2Points->SpinBox1->setValue(aScaleFactor);
@@ -193,6 +195,8 @@ void GenerationGUI_PrismDlg::Init()
   myPoint2.nullify();
   myVec.nullify();
 
+  showOnlyPreviewControl();
+    
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -288,7 +292,7 @@ void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
   resize(minimumSizeHint());
 
   SelectionIntoArgument();
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -297,6 +301,7 @@ void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
 //=================================================================================
 void GenerationGUI_PrismDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -380,7 +385,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
     }
   }
 
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -440,7 +445,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
   send->setDown(true);
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -473,7 +478,7 @@ void GenerationGUI_PrismDlg::enterEvent (QEvent*)
 //=================================================================================
 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
 {
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -548,7 +553,7 @@ void GenerationGUI_PrismDlg::onBothway()
   GroupDXDYDZ->SpinBox_SC->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() &&
                                       GroupDXDYDZ->CheckBox2->isChecked()); // scale factor
 
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -566,7 +571,7 @@ void GenerationGUI_PrismDlg::onScalePrism()
   GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
   GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
 
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================