From 909f4d9aee36ca76def69a8f50dbe6b27dfa782e Mon Sep 17 00:00:00 2001 From: sbh Date: Tue, 6 May 2014 10:35:08 +0400 Subject: [PATCH] Issue #6 uncheck only one aborted operation, not all nested stack --- src/ModuleBase/ModuleBase_WidgetPoint2D.cpp | 2 ++ src/XGUI/XGUI_ActionsMgr.cpp | 8 ++++++++ src/XGUI/XGUI_ActionsMgr.h | 1 + src/XGUI/XGUI_OperationMgr.cpp | 5 +++++ src/XGUI/XGUI_OperationMgr.h | 2 ++ src/XGUI/XGUI_Workshop.cpp | 13 ++++++++----- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp index 35c91813d..d0ce1b11e 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -66,7 +66,9 @@ bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr th boost::shared_ptr aPoint = boost::dynamic_pointer_cast(aData->attribute(myFeatureAttributeID)); + bool isBlocked = this->blockSignals(true); aPoint->setValue(myXSpin->value(), myYSpin->value()); + this->blockSignals(isBlocked); return true; } diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 6eac9883a..46b15993a 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -88,6 +88,14 @@ void XGUI_ActionsMgr::restoreCommandState() } } +void XGUI_ActionsMgr::updateAction(const QString& theId) +{ + if(myActions.contains(theId)){ + myActions[theId]->setEnabled(myActionsState[theId]); + myActions[theId]->setChecked(false); + } +} + void XGUI_ActionsMgr::setNestedActionsEnabled(bool isEnabled) { foreach(QString eachKey, myNestedActions) { diff --git a/src/XGUI/XGUI_ActionsMgr.h b/src/XGUI/XGUI_ActionsMgr.h index 336af1a0b..fe80fa21e 100644 --- a/src/XGUI/XGUI_ActionsMgr.h +++ b/src/XGUI/XGUI_ActionsMgr.h @@ -34,6 +34,7 @@ public: void saveCommandsState(); void restoreCommandState(); + void updateAction(const QString&); void setNestedActionsEnabled(bool); public slots: diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 4f4caf21c..7119a8fa1 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -27,6 +27,11 @@ bool XGUI_OperationMgr::hasOperation() const return (myOperations.count() > 0) && (myOperations.last() != NULL); } +int XGUI_OperationMgr::operationsCount() const +{ + return myOperations.count(); +} + bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) { if (!canStartOperation(theOperation)) diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index e3f653cca..fc6214d56 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -36,6 +36,8 @@ public: ModuleBase_Operation* currentOperation() const; /// Returns true is operation manager has at least one non-null operation. bool hasOperation() const; + /// Returns number of operations in the stack + int operationsCount() const; /// Start the operation and append it to the stack of operations /// \param theOperation the started operation /// \return the state whether the current operation is started diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a956d0487..112f3bd1d 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -246,11 +246,14 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) { ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); - if(aOperation->getDescription()->xmlRepresentation().isEmpty()) { //!< No need for property panel - updateCommandStatus(); - } else { - hidePropertyPanel(); - updateCommandStatus(); + //!< No need for property panel + updateCommandStatus(); + hidePropertyPanel(); + if(myOperationMgr->operationsCount() > 1) { + myActionsMgr->updateAction(theOperation->getDescription()->operationId()); + return; + } + if(!aOperation->getDescription()->xmlRepresentation().isEmpty()) { myActionsMgr->restoreCommandState(); } } -- 2.39.2