Salome HOME
Code refactoring
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI_DiskDlg.cxx
index fb23cb4ef0799ff557e5a32c0c18de6494a20723..397188996cce99568bebcfd8097962a0c2bc86b4 100755 (executable)
@@ -49,8 +49,7 @@
 //=================================================================================
 PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
                                             bool modal, Qt::WindowFlags fl)
-  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
-    myInitial(true)
+  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_DISK_PNT_VEC_R")));
@@ -253,20 +252,9 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked (int constructorId)
   qApp->processEvents();
   updateGeometry();
   resize(minimumSizeHint());
+  SelectionIntoArgument();
 
-  if (myInitial) {
-    myInitial = false;
-    if (constructorId == 1 || constructorId == 2) {
-      // on dialog initialization we init the first field with a selected object (if any)
-      SelectionIntoArgument();
-    }
-    else {
-      displayPreview();
-    }
-  }
-  else {
-    displayPreview();
-  }
+  displayPreview();
 }
 
 //=================================================================================
@@ -321,10 +309,9 @@ void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
 
   // nbSel == 1
   Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-  Standard_Boolean testResult = Standard_False;
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, testResult);
+  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
 
-  if (!testResult || CORBA::is_nil(aSelectedObject))
+  if ( CORBA::is_nil(aSelectedObject) )
     return;
 
   QString aName = GEOMBase::GetName(aSelectedObject);
@@ -349,7 +336,7 @@ void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
       //Find SubShape Object in Father
       GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
 
-      if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+      if (aFindedObject->_is_nil()) { // Object not found in study
         GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
       }