X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_OperationMgr.cpp;h=fe2b72830ae95b4697dcf0850139e3788beb8bdc;hb=7c06295aea6523048b676312fbeb5da673c0659d;hp=63be4a0e732d961eae848755c6f8168166df5793;hpb=8c61cbe058ed744affb3ae76379c8f3ce1d1cdf2;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 63be4a0e7..fe2b72830 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -9,6 +9,7 @@ #include "ModuleBase_Operation.h" #include "ModuleBase_IWorkshop.h" #include "ModuleBase_IModule.h" +#include "ModuleBase_OperationDescription.h" #include "ModelAPI_CompositeFeature.h" #include "ModelAPI_Session.h" @@ -190,6 +191,19 @@ void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled) emit validationStateChanged(theEnabled); } +void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation) +{ + if (theOperation) + emit nestedStateChanged(theOperation->getDescription()->operationId().toStdString(), + theOperation->isValid()); + else { + foreach(ModuleBase_Operation* anOperation, myOperations) { + emit nestedStateChanged(anOperation->getDescription()->operationId().toStdString(), + anOperation->isValid()); + } + } +} + bool XGUI_OperationMgr::isApplyEnabled() const { return myIsApplyEnabled; @@ -298,13 +312,7 @@ void XGUI_OperationMgr::onAbortOperation() void XGUI_OperationMgr::onOperationStarted() { ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - - bool aParentValid = isParentOperationValid(); - // in order to apply is enabled only if there are modifications in the model - // e.g. sketch can be applyed only if at least one nested element modification is finished - bool aCanUndo = ModelAPI_Session::get()->canUndo(); - emit nestedStateChanged(aParentValid && aCanUndo); - + updateApplyOfOperations(aSenderOperation); emit operationStarted(aSenderOperation); } @@ -316,11 +324,9 @@ void XGUI_OperationMgr::onOperationAborted() void XGUI_OperationMgr::onOperationCommitted() { + updateApplyOfOperations(); + ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - // in order to apply is enabled only if there are modifications in the model - // e.g. sketch can be applyed only if at least one nested element create is finished - bool aCanUndo = ModelAPI_Session::get()->canUndo(); - emit nestedStateChanged(myOperations.count() >= 1 && aCanUndo); emit operationCommitted(aSenderOperation); }