Salome HOME
Issue 0021055: EDF 1602 STUDY: Object browser reactualisation when creating an object
[modules/geom.git] / src / OperationGUI / OperationGUI_GetShapesOnShapeDlg.cxx
index 729e46f5825cc9ee48a25404e6df18b91ae21e39..e9e7f4cb3b15a9961b17c59712f2247d000c71ac 100644 (file)
@@ -1,7 +1,4 @@
-//  Copyright (C) 2007-2008  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
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -19,6 +16,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : OperationGUI_GetShapesOnShapeDlg.cxx
 // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com)
@@ -116,6 +114,8 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
   GroupPoints->LineEdit2->clear();
   myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
 
+  showOnlyPreviewControl();
+
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -153,6 +153,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
 //=================================================================================
 void OperationGUI_GetShapesOnShapeDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -191,9 +192,8 @@ void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
   int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true);
 
   if (nbSel > 0) {
-    Standard_Boolean aRes = Standard_False;
-    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
-    if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) {
+    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
+    if ( GEOMBase::IsShape(aSelectedObject) ) {
       myEditCurrentArgument->setText(aName);
 
       // clear selection
@@ -214,6 +214,7 @@ void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
       }
     }
   }
+  processPreview();
 }
 
 //=================================================================================
@@ -267,7 +268,8 @@ void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog()
   GEOMBase_Skeleton::ActivateThisDialog();
   globalSelection(GEOM_ALLSHAPES);
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
-          this, SLOT( SelectionIntoArgument() ) );
+           this, SLOT( SelectionIntoArgument() ) );
+  processPreview();
 }
 
 //=================================================================================
@@ -296,9 +298,8 @@ GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation()
 bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&)
 {
   //Handle(SALOME_InteractiveObject) IO = firstIObject();
-  //Standard_Boolean testResult;
-  //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
-  //if (!testResult || anObject->_is_nil())
+  //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO );
+  //if ( anObject->_is_nil() )
   //  return false;
 
   return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);
@@ -333,8 +334,8 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
   GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1,
-                                                                  (CORBA::Short) aLimit,
-                                                                  aState);
+                                                                   (CORBA::Short) aLimit,
+                                                                   aState);
 
   if (!anObj->_is_nil())
     objects.push_back(anObj._retn());
@@ -350,4 +351,5 @@ void OperationGUI_GetShapesOnShapeDlg::ComboTextChanged()
 {
   // VRS ???? What is it for ??? commented for a while...
   //bool IsEnabled = GroupPoints->ComboBox1->currentIndex() < 3;
+  processPreview();
 }