X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_IModule.cpp;fp=src%2FModuleBase%2FModuleBase_IModule.cpp;h=9fad87772dcd7795f71e6c9b8faad01846a8ed10;hb=312c60ce13126a82e02b4db09e0885ef526199f8;hp=ad7eb2eddec5c9d13fc19560e78c13aedc2bab2f;hpb=53301428650c668276d219b0564d2ae82e82c5b0;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index ad7eb2edd..9fad87772 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -88,7 +88,7 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId, ModuleBase_OperationFeature* aCurOperation = dynamic_cast (myWorkshop->currentOperation()); - QString anOperationKind = aCurOperation ? aCurOperation->getDescription()->operationId() : ""; + QString aCurOperationKind = aCurOperation ? aCurOperation->getDescription()->operationId() : ""; bool isCommitted; if (!myWorkshop->canStartOperation(theCmdId, isCommitted)) @@ -105,7 +105,7 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId, if (aMessage.get()) { setReentrantPreSelection(aMessage); } - else if (anOperationKind.isEmpty() || anOperationKind == theCmdId) { + else if (canUsePreselection(aCurOperationKind, theCmdId)) { // restore of previous opeation is absent or new launched operation has the same kind aFOperation->initSelection(aPreSelected); } @@ -215,6 +215,23 @@ bool ModuleBase_IModule::canDisplayObject(const ObjectPtr& theObject) const return true; } +bool ModuleBase_IModule::canUsePreselection(const QString& thePreviousOperationKind, + const QString& theStartedOperationKind) +{ + // no previous operation + if (thePreviousOperationKind.isEmpty()) + return true; + // edit operation + if (thePreviousOperationKind.endsWith(ModuleBase_OperationFeature::EditSuffix())) + return true; + + // reentrant operation + if (thePreviousOperationKind == theStartedOperationKind) + return true; + + return false; +} + bool ModuleBase_IModule::canUndo() const { SessionPtr aMgr = ModelAPI_Session::get();