Salome HOME
Values of element controls have been added to Mesh info
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Operation.cxx
index d51ed14395b9dca61162636703e4fed180b620e1..5646c72029d89af634deffa25a3e8bd229bc35fd 100755 (executable)
@@ -1,25 +1,24 @@
-//  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
 //
-//  SMESH SMESHGUI : implementaion of Salome mesh GUI
 //  File   : SMESHGUI_Operation.cxx
 //  Author : Sergey LITONIN, Open CASCADE S.A.S.
 
@@ -50,7 +49,8 @@
 // Purpose : Constructor
 //=======================================================================
 SMESHGUI_Operation::SMESHGUI_Operation()
-: LightApp_Operation()
+: LightApp_Operation(),
+  myIsApplyAndClose( false )
 {
   myHelpFileName = "";
 }
@@ -158,8 +158,10 @@ _PTR(Study) SMESHGUI_Operation::studyDS() const
 //=======================================================================
 void SMESHGUI_Operation::onOk()
 {
+  setIsApplyAndClose( true );
   if( onApply() )
     commit();
+  setIsApplyAndClose( false );
   //else
   //  abort();
 }
@@ -214,6 +216,26 @@ void SMESHGUI_Operation::initDialog()
 {
 }
 
+//================================================================
+// name    : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+//           accepted by Apply & Close button
+//================================================================
+void SMESHGUI_Operation::setIsApplyAndClose( const bool theFlag )
+{
+  myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// name    : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+//           accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_Operation::isApplyAndClose() const
+{
+  return myIsApplyAndClose;
+}
+
 /*!
  * \brief Verifies whether study of operation is locked
   * \param theMess - specifies whether message box must be shown if study is locked
@@ -258,10 +280,8 @@ bool SMESHGUI_Operation::isValid( SUIT_Operation* theOtherOp ) const
   }
 
   return ( theOtherOp &&
-           ( theOtherOp->inherits("SMESHGUI_Operation") &&
-             ( !anOps.contains(theOtherOp->metaObject()->className() ) ||
-               anOps.contains(metaObject()->className()) ) ) ||
-           ( theOtherOp->inherits("LightApp_ShowHideOp") ) );
+         ( ( theOtherOp->inherits("SMESHGUI_Operation") && ( !anOps.contains(theOtherOp->metaObject()->className() ) || anOps.contains(metaObject()->className()) ) ) ||
+           ( theOtherOp->inherits("LightApp_ShowHideOp") ) ) );
 
   return true;
 }