From: nds Date: Mon, 24 Aug 2015 12:50:38 +0000 (+0300) Subject: Synchronization of Apply/ApplyAll buttons. X-Git-Tag: V_1.4.0_beta4~276 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e9187ec48b7a5a84b13852b96c432e072b2a182c;p=modules%2Fshaper.git Synchronization of Apply/ApplyAll buttons. --- diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index c1d3708bd..3840be472 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -532,10 +532,6 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve // were changed here if (isModified) { aCurrentOperation->onValuesChanged(); - ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - aWorkshop->updateCompositeActionState(); } Events_Loop::loop()->flush(aMoveEvent); // up all move events - to be processed in the solver //Events_Loop::loop()->flush(aUpdateEvent); // up update events - to redisplay presentations diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 8d2eada7c..6dc01fa3d 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -236,6 +236,10 @@ QAction* XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId, QOb case Accept: case AcceptAll: aResult = new QAction(QIcon(":pictures/button_ok.png"), "", theParent); + // the default value is disabled, some modifications should be performed in order + // to update enable state of this action. + // AcceptAll is blinked when sketch is started from enabled to disabled. + aResult->setEnabled(false); break; case Abort: case AbortAll: { diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 63be4a0e7..1845110e8 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -188,6 +188,9 @@ void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled) { myIsApplyEnabled = theEnabled; emit validationStateChanged(theEnabled); + + bool aParentValid = isParentOperationValid(); + emit nestedStateChanged(aParentValid); } bool XGUI_OperationMgr::isApplyEnabled() const @@ -298,13 +301,6 @@ 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); - emit operationStarted(aSenderOperation); } @@ -317,10 +313,6 @@ void XGUI_OperationMgr::onOperationAborted() void XGUI_OperationMgr::onOperationCommitted() { 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); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 391ed7cdd..82fb45c18 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -663,7 +663,6 @@ void XGUI_Workshop::onUndo(int theTimes) for (int i = 0; i < theTimes; ++i) { aMgr->undo(); } - updateCompositeActionState(); updateCommandStatus(); } @@ -687,7 +686,6 @@ void XGUI_Workshop::onRedo(int theTimes) for (int i = 0; i < theTimes; ++i) { aMgr->redo(); } - updateCompositeActionState(); updateCommandStatus(); // unblock the viewer update functionality and make update on purpose @@ -850,20 +848,6 @@ void XGUI_Workshop::updateCommandStatus() emit commandStatusUpdated(); } -//****************************************************** -void XGUI_Workshop::updateCompositeActionState() -{ - // 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(); - bool aParentValid = operationMgr()->isParentOperationValid(); - bool aCurrentValid = operationMgr()->currentOperation() && - operationMgr()->currentOperation()->isValid(); - - QAction* aAcceptAllAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); - aAcceptAllAct->setEnabled(aParentValid && (aCanUndo || aCurrentValid)); -} - void XGUI_Workshop::updateHistory() { std::list aUndoList = ModelAPI_Session::get()->undoList(); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 510ee796d..60926cf71 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -258,10 +258,6 @@ signals: /// Update of commands status void updateCommandStatus(); - // Update enable state of accept all button. It is enabled if the the parent operation is - // valid and there are modifications in sesstion(undo can be performed). - void updateCompositeActionState(); - /// update history list (undo/redo commands) void updateHistory();