clearPreselection();
}
-void ModuleBase_OperationFeature::setEditOperation(const bool theRestartTransaction)
+void ModuleBase_OperationFeature::setEditOperation(const bool& isEditState
+ /*const bool theRestartTransaction*/)
{
- if (isEditOperation())
+ bool isCurrentEditState = isEditOperation();
+ if (isCurrentEditState == isEditState)
return;
+ /*
+ // this case is obsolete as it was not approved for reentrant sketch operation
+ // it was implemented when isEditState did not exist and only edit operation can be set
if (theRestartTransaction) {
// finsh previous create operation
emit beforeCommitted();
}
ModelAPI_Session::get()->startOperation(anId.toStdString());
emit beforeStarted();
- }
- else
- myIsEditing = true;
+ } else*/
+ myIsEditing = isEditState;
propertyPanel()->setEditingMode(isEditOperation());
}
/// 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
- /// \param theRestartTransaction if true, the current model transaction is committed and
+ /// \param isEditState boolean state whether the operation should become editing or creating
+ // \param theRestartTransaction if true, the current model transaction is committed and
/// the new one is started
- void setEditOperation(const bool theRestartTransaction);
+ void setEditOperation(const bool& isEditState/*const bool theRestartTransaction*/);
/// Returns the operation feature
/// \return the feature
void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel()
{
if (!isNestedEditOperation(getCurrentOperation()) ||
- myModule->sketchReentranceMgr()->isInternalEditActive())
+ myModule->sketchReentranceMgr()->isInternalEditActive()) {
+ myModule->sketchReentranceMgr()->updateInternalEditActiveState();
return;
+ }
// it is necessary to restore current selection in order to restore it after the values are modified
restoreSelection();
myCurrentSelection.clear();
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
aDisplayer->enableUpdateViewer(myPreviousUpdateViewerEnabled);
aDisplayer->updateViewer();
+
+
}
void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
return myIsInternalEditOperation;
}
+void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState()
+{
+ if (myIsInternalEditOperation) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (myWorkshop->currentOperation());
+ if (aFOperation) {
+ FeaturePtr aFeature = aFOperation->feature();
+ QString anError = myWorkshop->module()->getFeatureError(aFeature);
+ // stop started internal edit operation as soon as the operation becomes invalid
+ // it is especially important for the sketch tangent arc feature
+ if (!anError.isEmpty()) {
+ aFOperation->setEditOperation(false);
+ //workshop()->operationMgr()->updateApplyOfOperations();
+ beforeStopInternalEdit();
+ myIsInternalEditOperation = false;
+ }
+ }
+ }
+}
+
bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* theOperation)
{
bool aProcessed = false;
(myWorkshop->currentOperation());
if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) {
- aFOperation->setEditOperation(false);
+ aFOperation->setEditOperation(true/*, false*/);
workshop()->operationMgr()->updateApplyOfOperations();
createInternalFeature();
/// Return true if the current edit operation is an internal
bool isInternalEditActive() const;
+ /// Stop internal edit if the operation feature is invalid
+ void updateInternalEditActiveState();
+
/// if the internal flags allow it and the manager is active, it starts an internal edit operation
/// for the created operation.
/// \param thePreviousAttributeID an index of the previous active attribute