#include "ModuleBase_Operation.h"
#include "ModuleBase_IWorkshop.h"
#include "ModuleBase_IModule.h"
+#include "ModuleBase_OperationDescription.h"
#include "ModelAPI_CompositeFeature.h"
#include "ModelAPI_Session.h"
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;
void XGUI_OperationMgr::onOperationStarted()
{
ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(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);
}
void XGUI_OperationMgr::onOperationCommitted()
{
+ updateApplyOfOperations();
+
ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(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);
}