]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Set "Apply" command button enabled in the tool bar of the application when nested...
authornds <natalia.donis@opencascade.com>
Wed, 8 Jul 2015 16:43:55 +0000 (19:43 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 9 Jul 2015 04:02:01 +0000 (07:02 +0300)
src/XGUI/XGUI_OperationMgr.cpp

index b5579b88c70dc9039863dce28cdef98da28658a9..c04cb9c6ce955df93c6fc6368efd18cbbf548779 100644 (file)
@@ -248,8 +248,19 @@ void XGUI_OperationMgr::onOperationStarted()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
   
-  bool isNestedOk = (myOperations.count() >= 1) && 
-                     myOperations.at(0)->isValid();
+  // the enable state of the parent operation of the nested one is defined by the rules that
+  // firstly there are nested operations and secondly the parent operation is valid
+  ModuleBase_Operation* aPrevOp;
+  Operations::const_iterator anIt = myOperations.end();
+  if (anIt != myOperations.begin()) { // there are items in the operations list
+    --anIt;
+    aPrevOp = *anIt; // the last top operation, the operation which is started
+    if (anIt != myOperations.begin()) { // find the operation where the started operation is nested
+      --anIt;
+      aPrevOp = *anIt;
+    }
+  }
+  bool isNestedOk = (myOperations.count() >= 1) && aPrevOp->isValid();
   emit nestedStateChanged(isNestedOk);
   emit operationStarted(aSenderOperation);
 }