Salome HOME
Fix for the bug IPAL22807:"TC6.4.0: input objects are not highlighted in 3D viewer"
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI_BoxDlg.cxx
index a5a400628d359871683ca65f14695d831d02151e..6bbc7b0f4feafd5850015f8ed0ddff0b62559d29 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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
@@ -184,7 +184,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId)
       disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
       globalSelection(); // close local contexts, if any
 
-      displayPreview();
+      displayPreview(true);
       break;
     }
   }
@@ -194,7 +194,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId)
   resize(minimumSizeHint());
   SelectionIntoArgument();
 
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -203,6 +203,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId)
 //=================================================================================
 void PrimitiveGUI_BoxDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -250,26 +251,26 @@ void PrimitiveGUI_BoxDlg::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) {
       myPoint1 = aSelectedObject;
       if (myPoint1 && !myPoint2)
-       GroupPoints->PushButton2->click();
+        GroupPoints->PushButton2->click();
     }
     else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
       myPoint2 = aSelectedObject;
       if (myPoint2 && !myPoint1)
-       GroupPoints->PushButton1->click();
+        GroupPoints->PushButton1->click();
+    }
+    if ((myPoint1 && !myPoint2) || (myPoint2 && !myPoint1)) {
+      // 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);
 }
 
 //=================================================================================
@@ -311,7 +312,7 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
           this, SLOT(SelectionIntoArgument()));
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -326,7 +327,7 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog()
     connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
             this, SLOT(SelectionIntoArgument()));
   }
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================
@@ -345,7 +346,7 @@ void PrimitiveGUI_BoxDlg::enterEvent (QEvent*)
 //=================================================================================
 void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox()
 {
-  displayPreview();
+  displayPreview(true);
 }
 
 //=================================================================================