From: nds Date: Tue, 3 Nov 2015 13:26:51 +0000 (+0300) Subject: Internal Edit operation in a transaction. X-Git-Tag: V_2.0.0_alfa1~6^2~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa6aa2e8be0857e27fd6de1dedcae2d61144fea4;p=modules%2Fshaper.git Internal Edit operation in a transaction. --- diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 35fa3a02d..974a126b3 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -49,12 +49,27 @@ ModuleBase_OperationFeature::~ModuleBase_OperationFeature() clearPreselection(); } -void ModuleBase_OperationFeature::setEditOperation() +void ModuleBase_OperationFeature::setEditOperation(const bool theRestartTransaction) { if (isEditOperation()) return; myIsEditing = true; + if (theRestartTransaction) { + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aDoc = aMgr->activeDocument(); + FeaturePtr aFeature = aDoc->currentFeature(false); + ModelAPI_Session::get()->finishOperation(); + FeaturePtr anAFeature = aDoc->currentFeature(false); + + QString anId = getDescription()->operationId(); + if (myIsEditing) { + anId = anId.append(EditSuffix()); + } + ModelAPI_Session::get()->startOperation(anId.toStdString()); + emit beforeStarted(); + } + propertyPanel()->setEditingMode(isEditOperation()); } diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index f32bbb384..2cc3d2a3d 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -67,7 +67,9 @@ Q_OBJECT /// Change the operation mode from create to edit. /// The transaction and the operation name in the model history of transaction are the same. /// It updates the edit state in the widgets of property panel - void setEditOperation(); + /// \param theRestartTransaction if true, the current model transaction is committed and + /// the new one is started + void setEditOperation(const bool theRestartTransaction); /// Returns the operation feature /// \return the feature diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index 6b6c356d1..61284fd7b 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -281,7 +281,7 @@ void PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePrev ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); - aFOperation->setEditOperation(); + aFOperation->setEditOperation(true); FeaturePtr anOperationFeature = aFOperation->feature(); if (anOperationFeature.get() != NULL) {