// were changed here
if (isModified) {
aCurrentOperation->onValuesChanged();
- ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(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
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: {
{
myIsApplyEnabled = theEnabled;
emit validationStateChanged(theEnabled);
+
+ bool aParentValid = isParentOperationValid();
+ emit nestedStateChanged(aParentValid);
}
bool XGUI_OperationMgr::isApplyEnabled() const
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);
-
emit operationStarted(aSenderOperation);
}
void XGUI_OperationMgr::onOperationCommitted()
{
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);
}
for (int i = 0; i < theTimes; ++i) {
aMgr->undo();
}
- updateCompositeActionState();
updateCommandStatus();
}
for (int i = 0; i < theTimes; ++i) {
aMgr->redo();
}
- updateCompositeActionState();
updateCommandStatus();
// unblock the viewer update functionality and make update on purpose
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<std::string> aUndoList = ModelAPI_Session::get()->undoList();
/// 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();