Salome HOME
Update translations for Chamfer and Fillet 3D operations.
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI_ConeDlg.cxx
index 1f02d00b2c225b32c09b356d393e96946e72ed95..f64a9667d71c02b2851f82e514dbe69f4fc7cae6 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  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) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 // GEOM GEOMGUI : GUI for Geometry component
@@ -200,7 +200,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId)
       disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
       globalSelection(); // close local contexts, if any
 
-      displayPreview();
+      displayPreview(true);
       break;
     }
   }
@@ -210,7 +210,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId)
   resize(minimumSizeHint());
   SelectionIntoArgument();
 
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -219,6 +219,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId)
 //=================================================================================
 void PrimitiveGUI_ConeDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -267,26 +268,28 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
     QString aName = GEOMBase::GetName( aSelectedObject.get() );
 
     myEditCurrentArgument->setText(aName);
-
-    // clear selection
-    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-    myGeomGUI->getApp()->selectionMgr()->clearSelected();
-    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-           this, SLOT(SelectionIntoArgument()));
     
     if (myEditCurrentArgument == GroupPoints->LineEdit1) {
       myPoint = aSelectedObject;
       if (myPoint && !myDir)
-       GroupPoints->PushButton2->click();
+        GroupPoints->PushButton2->click();
     }
     else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
       myDir = aSelectedObject;
       if (myDir && !myPoint)
-       GroupPoints->PushButton1->click();
+        GroupPoints->PushButton1->click();
+    }
+
+    if ((myPoint && !myDir) || (myDir && !myPoint)) {
+      // clear selection
+      disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+      myGeomGUI->getApp()->selectionMgr()->clearSelected();
+      connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+             this, SLOT(SelectionIntoArgument()));
     }
   }
 
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -326,7 +329,7 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
   send->setDown(true);
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -359,7 +362,7 @@ void PrimitiveGUI_ConeDlg::enterEvent (QEvent*)
 //=================================================================================
 void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox()
 {
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================