void PartSet_Module::onFeatureTriggered()
{
- SessionPtr aMgr = ModelAPI_Session::get();
- // 1. check whether the delete should be processed in the module
- ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
- if (isNestedOp) {
- // in case if in the viewer nothing is displayed, the create operation should not be
- // comitted even if all values of the feature are initialized
- if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
- QAction* aCmd = dynamic_cast<QAction*>(sender());
- //Do nothing on uncheck
- if (aCmd->isCheckable() && !aCmd->isChecked())
- return;
-
- // the action information should be saved before the operation is aborted
- // because this abort leads to update command status, which unchecks this action
- anOperation->abort();
-
- launchOperation(aCmd->data().toString());
+ QAction* aCmd = dynamic_cast<QAction*>(sender());
+ if (aCmd->isCheckable() && aCmd->isChecked()) {
+ // 1. check whether the delete should be processed in the module
+ ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
+ bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
+ if (isNestedOp) {
+ // in case if in the viewer nothing is displayed, the create operation should not be
+ // comitted even if all values of the feature are initialized
+ if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
+ // the action information should be saved before the operation is aborted
+ // because this abort leads to update command status, which unchecks this action
+ anOperation->abort();
+ launchOperation(aCmd->data().toString());
+ }
}
}
ModuleBase_IModule::onFeatureTriggered();
void XGUI_Workshop::onUndo(int theTimes)
{
objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
- if (operationMgr()->canStopOperation())
- operationMgr()->abortOperation(operationMgr()->currentOperation());
- else
- return;
-
SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isOperation()) {
+ /// this is important for nested operrations
+ /// when sketch opeation is active, this condition is false and
+ /// the sketch operation is not aborted
+ operationMgr()->onAbortOperation();
+ }
for (int i = 0; i < theTimes; ++i) {
aMgr->undo();
}
//******************************************************
void XGUI_Workshop::onRedo(int theTimes)
{
- if (operationMgr()->canStopOperation())
- operationMgr()->abortOperation(operationMgr()->currentOperation());
- else
- return;
-
// the viewer update should be blocked in order to avoid the features blinking. For the created
// feature a results are created, the flush of the created signal caused the viewer redisplay for
// each created result. After a redisplay signal is flushed. So, the viewer update is blocked until
objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isOperation()) {
+ /// this is important for nested operrations
+ /// when sketch opeation is active, this condition is false and
+ /// the sketch operation is not aborted
+ operationMgr()->onAbortOperation();
+ }
for (int i = 0; i < theTimes; ++i) {
aMgr->redo();
}