X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_OperationFeature.cpp;h=0471bfae79e26b601075e030af60a165015df91b;hb=29dfb8a802f61cacf5f57fb79c62badee00ebcdf;hp=125e7e84b40956c41846ed7792c087387c7e4520;hpb=d481e13e400f2ea0e35c25884e73ccddaffd0f70;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 125e7e84b..0471bfae7 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -54,22 +54,23 @@ void ModuleBase_OperationFeature::setEditOperation(const bool theRestartTransact if (isEditOperation()) return; - myIsEditing = true; if (theRestartTransaction) { - FeaturePtr aPrevFeature = myPreviousCurrentFeature; - + // finsh previous create operation + emit beforeCommitted(); SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_Session::get()->finishOperation(); + // start new edit operation + myIsEditing = true; QString anId = getDescription()->operationId(); if (myIsEditing) { anId = anId.append(EditSuffix()); } ModelAPI_Session::get()->startOperation(anId.toStdString()); emit beforeStarted(); - - myPreviousCurrentFeature = aPrevFeature; } + else + myIsEditing = true; propertyPanel()->setEditingMode(isEditOperation()); } @@ -85,17 +86,9 @@ bool ModuleBase_OperationFeature::isValid() const return true; // rename operation if (myFeature->isAction()) return true; - //Get validators for the Id - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - bool aValid = aFactory->validate(myFeature); - // the feature exec state should be checked in order to do not apply features, which result can not - // be built. E.g. extrusion on sketch, where the "to" is a perpendicular plane to the sketch - bool isDone = ( myFeature->data()->execState() == ModelAPI_StateDone - || myFeature->data()->execState() == ModelAPI_StateMustBeUpdated ); - - return aValid && isDone; + std::string anError = ModelAPI_Tools::getFeatureError(myFeature); + return anError.empty(); } void ModuleBase_OperationFeature::startOperation() @@ -199,7 +192,7 @@ bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject) return myVisualizedObjects.find(theObject) != myVisualizedObjects.end(); } -void ModuleBase_OperationFeature::start() +bool ModuleBase_OperationFeature::start() { setIsModified(false); QString anId = getDescription()->operationId(); @@ -219,12 +212,12 @@ void ModuleBase_OperationFeature::start() // in order to update commands status in the workshop, to be exact the feature action // to be unchecked abort(); - return; + return false; } } //Already called startOperation(); emit started(); - + return true; } void ModuleBase_OperationFeature::abort() @@ -246,7 +239,8 @@ void ModuleBase_OperationFeature::abort() if (aPropertyPanel) aPropertyPanel->cleanContent(); - myFeature->setStable(true); + if (myFeature.get()) + myFeature->setStable(true); abortOperation(); stopOperation(); @@ -266,6 +260,13 @@ void ModuleBase_OperationFeature::abort() bool ModuleBase_OperationFeature::commit() { + ModuleBase_IPropertyPanel* aPanel = propertyPanel(); + if (aPanel) { + ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) { + anActiveWidget->storeValue(); + } + } if (canBeCommitted()) { emit beforeCommitted(); // the widgets of property panel should not process any events come from data mode