From: nds Date: Thu, 8 Oct 2015 13:48:43 +0000 (+0300) Subject: SetCurrentFeature in resumeOperation(). It should be improved by moving this call... X-Git-Tag: V_1.4.0_demo2~10^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=185eeb27c54a3c06946f9b3a4d99dae468daa125;p=modules%2Fshaper.git SetCurrentFeature in resumeOperation(). It should be improved by moving this call to the commit transaction. --- diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index a6829d1bc..82f6db270 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -119,6 +120,16 @@ void ModuleBase_OperationFeature::stopOperation() Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } +void ModuleBase_OperationFeature::resumeOperation() +{ + ModuleBase_Operation::resumeOperation(); + //if (!myIsEditing) + setCurrentFeature(feature()); + //SessionPtr aMgr = ModelAPI_Session::get(); + //DocumentPtr aDoc = aMgr->activeDocument(); + //aDoc->setCurrentFeature(feature(), false); +} + FeaturePtr ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) { if (myParentFeature.get()) { @@ -238,7 +249,7 @@ void ModuleBase_OperationFeature::abort() bool aIsOp = aMgr->isOperation(); if (!aIsOp) aMgr->startOperation(); - aDoc->setCurrentFeature(myPreviousCurrentFeature, true); + aDoc->setCurrentFeature(myPreviousCurrentFeature, false);//true); if (!aIsOp) aMgr->finishOperation(); myPreviousCurrentFeature = FeaturePtr(); @@ -273,16 +284,25 @@ bool ModuleBase_OperationFeature::commit() SessionPtr aMgr = ModelAPI_Session::get(); /// Set current feature and remeber old current feature + if (myIsEditing) { - DocumentPtr aDoc = aMgr->activeDocument(); + setCurrentFeature(myPreviousCurrentFeature); + /*DocumentPtr aDoc = aMgr->activeDocument(); bool aIsOp = aMgr->isOperation(); if (!aIsOp) aMgr->startOperation(); aDoc->setCurrentFeature(myPreviousCurrentFeature, true); if (!aIsOp) - aMgr->finishOperation(); + aMgr->finishOperation();*/ myPreviousCurrentFeature = FeaturePtr(); } + else { + /*CompositeFeaturePtr aCompositeFeature = ModelAPI_Tools::compositeOwner(feature()); + if (aCompositeFeature.get()) + setCurrentFeature(aCompositeFeature);//myPreviousCurrentFeature); + //else + // setCurrentFeature(feature());*/ + } commitOperation(); aMgr->finishOperation(); @@ -296,6 +316,18 @@ bool ModuleBase_OperationFeature::commit() return false; } +void ModuleBase_OperationFeature::setCurrentFeature(const FeaturePtr& theFeature) +{ + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aDoc = aMgr->activeDocument(); + bool aIsOp = aMgr->isOperation(); + if (!aIsOp) + aMgr->startOperation(); + aDoc->setCurrentFeature(theFeature, false);//true); + if (!aIsOp) + aMgr->finishOperation(); +} + void ModuleBase_OperationFeature::activateByPreselection() { if (myPreSelection.empty()) diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index f9d850fb8..3e5da9914 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -96,6 +96,8 @@ Q_OBJECT /// \return Currently installed property panel //ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } + void setCurrentFeature(const FeaturePtr& theFeature); + /// Activates widgets by preselection if it is accepted. Emits signal if the activation is correct virtual void activateByPreselection(); @@ -137,6 +139,9 @@ signals: /// Hide feature/results if they were hided on start virtual void stopOperation(); + /// Virtual method called after operation resume (see resume() method for more description) + virtual void resumeOperation(); + /// Creates an operation new feature /// \param theFlushMessage the flag whether the create message should be flushed /// \returns the created feature