From 1a121b1e8e39095614e936eb0b8f606f9d8cdaf2 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 13 Nov 2015 19:16:12 +0300 Subject: [PATCH] Issue #1080 generation of plugin Shaper v1.4 with VisualStudio 2010 --- src/ModuleBase/ModuleBase_Operation.cpp | 4 +++- src/ModuleBase/ModuleBase_Operation.h | 3 ++- src/ModuleBase/ModuleBase_OperationFeature.cpp | 6 +++--- src/ModuleBase/ModuleBase_OperationFeature.h | 3 ++- src/XGUI/XGUI_OperationMgr.cpp | 7 ++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 66b0a51aa..8b19dcd82 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -75,7 +75,7 @@ bool ModuleBase_Operation::canBeCommitted() const return isValid(); } -void ModuleBase_Operation::start() +bool ModuleBase_Operation::start() { myIsModified = false; @@ -83,6 +83,8 @@ void ModuleBase_Operation::start() startOperation(); emit started(); + + return true; } void ModuleBase_Operation::postpone() diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index a7cf23c5b..0fffbc0fd 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -121,7 +121,8 @@ signals: /// to change behavior of operation. There is no point in using this method. It would /// be better to inherit own operator from base one and redefine startOperation method /// instead. - virtual void start(); + /// \return true if the start is successful + virtual bool start(); /// Deactivates current operation which can be resumed later. virtual void postpone(); diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index da5ff1fcb..c8f1224b6 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -200,7 +200,7 @@ bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject) return myVisualizedObjects.find(theObject) != myVisualizedObjects.end(); } -void ModuleBase_OperationFeature::start() +bool ModuleBase_OperationFeature::start() { setIsModified(false); QString anId = getDescription()->operationId(); @@ -220,12 +220,12 @@ void ModuleBase_OperationFeature::start() // in order to update commands status in the workshop, to be exact the feature action // to be unchecked abort(); - return; + return false; } } //Already called startOperation(); emit started(); - + return true; } void ModuleBase_OperationFeature::abort() diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index 32e648bd9..ab0ce8c90 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -133,7 +133,8 @@ signals: /// to change behavior of operation. There is no point in using this method. It would /// be better to inherit own operator from base one and redefine startOperation method /// instead. - void start(); + /// \return true if the start is successful + virtual bool start(); /// Aborts operation /// Public slot. Aborts operation. This slot is not virtual and cannot be redefined. diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index e0139d8f5..d441258e8 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -136,9 +136,10 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) connect(aFOperation, SIGNAL(activatedByPreselection()), SIGNAL(operationActivatedByPreselection())); - theOperation->start(); - onValidateOperation(); - return true; + bool isStarted = theOperation->start(); + if (isStarted) + onValidateOperation(); + return isStarted; } bool XGUI_OperationMgr::abortAllOperations() -- 2.39.2