]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/OperationGUI/OperationGUI_ChamferDlg.cxx
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / OperationGUI / OperationGUI_ChamferDlg.cxx
index ccfc070c14161f7ea5fbfd608cd75e82f4ae73af..69c35501733c55dbc2fb753a5fd118bb7422a12e 100644 (file)
@@ -1,29 +1,29 @@
-//  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
 // File   : OperationGUI_ChamferDlg.cxx
 // Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
 #include "OperationGUI_ChamferDlg.h"
 #include <SalomeApp_DoubleSpinBox.h>
 
@@ -91,7 +91,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q
 
   // Create second group
 
-  myGrp2 = new QGroupBox(tr("GEOM_CHAMFER_EDGES"), centralWidget());
+  myGrp2 = new QGroupBox(tr("GEOM_CHAMFER_EDGE"), centralWidget());
 
   aLayout = new QGridLayout(myGrp2);
   aLayout->setMargin(9); aLayout->setSpacing(6);
@@ -122,7 +122,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q
 
   // Create fourth group
 
-  myGrp4 = new QGroupBox(tr("GEOM_CHAMFER_EDGE"), centralWidget());
+  myGrp4 = new QGroupBox(tr("GEOM_CHAMFER_EDGES"), centralWidget());
 
   aLayout = new QGridLayout(myGrp4);
   aLayout->setMargin(9); aLayout->setSpacing(6);
@@ -193,6 +193,8 @@ void OperationGUI_ChamferDlg::Init()
   myFace[ Face1 ] = -1;
   myFace[ Face2 ] = -1;
 
+  showOnlyPreviewControl();
+
   // signals and slots connections
 
   // main buttons
@@ -354,7 +356,7 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId)
       myEditCurrentArgument->setText("");
     }
 
-    displayPreview();
+    processPreview();
   }
 
   qApp->processEvents();
@@ -368,6 +370,7 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId)
 //=================================================================================
 void OperationGUI_ChamferDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -421,7 +424,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
       if ( !anObj->_is_nil() ) {
         myShape = anObj;
         myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
-        displayPreview();
+        processPreview();
       }
     }
 
@@ -444,7 +447,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
             QString aFaceName = QString(GEOMBase::GetName(anObj)) + ":%1";
             myEditCurrentArgument->setText(aFaceName.arg(anIndex));
             myFace[ aCurrFocus ] = anIndex;
-            displayPreview();
+            processPreview();
          }
       }
     }
@@ -479,14 +482,15 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
           else if (aConstructorId == 3)
             myEdges = anIndexes;
 
-          displayPreview();
+          processPreview();
         }
       }
     }
   }
 
   // clear selection
-  if (aCurrFocus != Faces && aCurrFocus != Edges) {
+  if (aCurrFocus != Face1 && aCurrFocus != Face2 &&
+      aCurrFocus != Faces && aCurrFocus != Edges) {
     disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
     myGeomGUI->getApp()->selectionMgr()->clearSelected();
     connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
@@ -567,7 +571,7 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument()
   activateSelection();
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -615,7 +619,7 @@ void OperationGUI_ChamferDlg::enterEvent (QEvent*)
 //=================================================================================
 void OperationGUI_ChamferDlg::ValueChangedInSpinBox (double)
 {
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -836,7 +840,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
     else {
       anObj = anOper->MakeChamferEdgeAD(myShape,
                                         mySpinBox[ SpinBox23 ]->value(),
-                                        mySpinBox[ SpinBox24 ]->value() * PI180,
+                                        mySpinBox[ SpinBox24 ]->value() * M_PI / 180.,
                                         myFace[ Face1 ],
                                         myFace[ Face2 ]);
       if (!anObj->_is_nil())
@@ -868,7 +872,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
     else {
       anObj = anOper->MakeChamferFacesAD(myShape,
                                          mySpinBox[ SpinBox33 ]->value(),
-                                         mySpinBox[ SpinBox34 ]->value() * PI180,
+                                         mySpinBox[ SpinBox34 ]->value() * M_PI / 180.,
                                          anArray);
       if (!anObj->_is_nil())
       {
@@ -896,7 +900,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
     else {
       anObj = anOper->MakeChamferEdgesAD(myShape,
                                          mySpinBox[ SpinBox43 ]->value(),
-                                         mySpinBox[ SpinBox44 ]->value() * PI180,
+                                         mySpinBox[ SpinBox44 ]->value() * M_PI / 180.,
                                          anArray);
       if (!anObj->_is_nil())
       {
@@ -960,5 +964,5 @@ void OperationGUI_ChamferDlg::RadioButtonPressed()
   myRadioButton[ RadioButton41 ]->blockSignals(false);
   myRadioButton[ RadioButton42 ]->blockSignals(false);
 
-  displayPreview();
+  processPreview();
 }