From: vsv Date: Tue, 19 May 2015 16:29:29 +0000 (+0300) Subject: Restore show trihedron on viewer creation X-Git-Tag: V_1.2.0~140^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d4d127efaf520f92323c6c55a297d7cd6a132f20;p=modules%2Fshaper.git Restore show trihedron on viewer creation --- diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index b934df130..ba66473b5 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -131,7 +131,7 @@ void ModuleBase_Operation::start() { QString anId = getDescription()->operationId(); if (myIsEditing) { - anId = anId.append(EditSuffix()); + anId = anId.append(EditSuffix()); } ModelAPI_Session::get()->startOperation(anId.toStdString()); @@ -146,6 +146,13 @@ void ModuleBase_Operation::start() return; } } + /// Set current feature and remeber old current feature + if (myIsEditing) { + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aDoc = aMgr->activeDocument(); + myCurrentFeature = aDoc->currentFeature(true); + aDoc->setCurrentFeature(feature(), false); + } startOperation(); emit started(); @@ -166,6 +173,12 @@ void ModuleBase_Operation::resume() void ModuleBase_Operation::abort() { + if (myIsEditing) { + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aDoc = aMgr->activeDocument(); + aDoc->setCurrentFeature(myCurrentFeature, true); + myCurrentFeature = FeaturePtr(); + } abortOperation(); emit aborted(); @@ -178,6 +191,13 @@ void ModuleBase_Operation::abort() bool ModuleBase_Operation::commit() { if (canBeCommitted()) { + /// Set current feature and remeber old current feature + if (myIsEditing) { + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aDoc = aMgr->activeDocument(); + aDoc->setCurrentFeature(myCurrentFeature, true); + myCurrentFeature = FeaturePtr(); + } commitOperation(); // check whether there are modifications performed during the current operation // in the model diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index c453e6b06..97e742eae 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -264,6 +264,8 @@ signals: /// before operation feature creating CompositeFeaturePtr myParentFeature; + /// Last current feature before editing operation + FeaturePtr myCurrentFeature; }; #endif