From: nds Date: Thu, 29 Oct 2015 12:34:49 +0000 (+0300) Subject: 1. Create->Edit->Create is realized as 2 transaction: for the first pair the setEditO... X-Git-Tag: V_2.0.0_alfa1~6^2~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a7c7560bde33353019f45030709ed2a85823afe7;p=modules%2Fshaper.git 1. Create->Edit->Create is realized as 2 transaction: for the first pair the setEditOperation() is provided to change mode of operation from create to edit. Purpose: do not use additional transaction. 2. Code simplification in reentrant manager. --- diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 7d03e735f..5ac197114 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -49,6 +49,15 @@ ModuleBase_OperationFeature::~ModuleBase_OperationFeature() clearPreselection(); } +void ModuleBase_OperationFeature::setEditOperation() +{ + if (isEditOperation()) + return; + + myIsEditing = true; + propertyPanel()->setEditingMode(isEditOperation()); +} + FeaturePtr ModuleBase_OperationFeature::feature() const { return myFeature; diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index 48c8506e1..f32bbb384 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -64,6 +64,11 @@ Q_OBJECT /// Returns True id the current operation is launched in editing mode bool isEditOperation() const { return myIsEditing; } + /// 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(); + /// Returns the operation feature /// \return the feature FeaturePtr feature() const; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 16119db37..fbde087ad 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -132,7 +132,6 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) XGUI_Workshop* aWorkshop = aConnector->workshop(); XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); - connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased())); connect(anOpMgr, SIGNAL(operationActivatedByPreselection()), this, SLOT(onOperationActivatedByPreselection())); @@ -269,6 +268,9 @@ void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation) void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation) { + /// Restart sketcher operations automatically + mySketchReentrantMgr->operationStarted(theOperation); + if (PartSet_SketcherMgr::isSketchOperation(theOperation)) { mySketchMgr->startSketch(theOperation); } @@ -461,7 +463,14 @@ void PartSet_Module::clearViewer() void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) { - mySketchReentrantMgr->propertyPanelDefined(theOperation); + ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + if (!aFOperation) + return; + + ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); + // we have to manually activate the sketch label in edit mode + if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && (aFOperation->isEditOperation())) + aPanel->activateWidget(aPanel->modelWidgets().first()); } @@ -505,11 +514,6 @@ void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* the anOpMgr->onKeyReleased(theEvent); } -void PartSet_Module::onEnterReleased() -{ - mySketchReentrantMgr->enterReleased(); -} - void PartSet_Module::onOperationActivatedByPreselection() { if (!mySketchReentrantMgr->canBeCommittedByPreselection()) @@ -586,7 +590,7 @@ ModuleBase_ModelWidget* PartSet_Module::activeWidget() const { ModuleBase_ModelWidget* anActiveWidget = 0; - anActiveWidget = mySketchReentrantMgr->activeWidget(); + anActiveWidget = mySketchReentrantMgr->internalActiveWidget(); if (!anActiveWidget) { ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); if (aOperation) { diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index e5a37bcda..bc97ed5cc 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -240,10 +240,6 @@ protected slots: /// \param theEvent the key event void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); - /// SLOT, that is called by enter key released - /// Set a specific type of restarting the current operation - void onEnterReleased(); - /// SLOT, that is called by the current operation filling with the preselection. /// It commits the operation of it is can be committed void onOperationActivatedByPreselection(); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index bf034c85a..028ebd650 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -628,18 +628,22 @@ void PartSet_SketcherMgr::onApplicationStarted() ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); + PartSet_SketcherReetntrantMgr* aReentranceMgr = myModule->sketchReentranceMgr(); + XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); if (aPropertyPanel) { connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)), this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*))); - PartSet_SketcherReetntrantMgr* aReentranceMgr = myModule->sketchReentranceMgr(); connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)), aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&))); connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), aReentranceMgr, SLOT(onWidgetActivated())); } + XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); + connect(anOpMgr, SIGNAL(keyEnterReleased()), aReentranceMgr, SLOT(onEnterReleased())); + XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer(); connect(aViewerProxy, SIGNAL(enterViewPort()), this, SLOT(onEnterViewPort())); connect(aViewerProxy, SIGNAL(leaveViewPort()), this, SLOT(onLeaveViewPort())); diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index de4baeee1..af2723111 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -23,10 +23,9 @@ PartSet_SketcherReetntrantMgr::PartSet_SketcherReetntrantMgr(ModuleBase_IWorkshop* theWorkshop) : QObject(theWorkshop), myWorkshop(theWorkshop), - myIsInternalEditOperation(false), - myLastOperationId(""), - myPreviousAttributeID(""), - myRestartingMode(RM_None) + myRestartingMode(RM_None), + myIsFlagsBlocked(false), + myIsInternalEditOperation(false) { } @@ -34,7 +33,7 @@ PartSet_SketcherReetntrantMgr::~PartSet_SketcherReetntrantMgr() { } -ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::activeWidget() const +ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::internalActiveWidget() const { ModuleBase_ModelWidget* aWidget = 0; if (!isActiveMgr()) @@ -68,61 +67,18 @@ bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* the if (!isActiveMgr()) return aProcessed; - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); - if (!aFOperation) - return aProcessed; + aProcessed = myIsInternalEditOperation; + resetFlags(); - FeaturePtr aFeature = aFOperation->feature(); - std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aFeature); - if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed || - myRestartingMode == RM_EmptyFeatureUsed)) { - myLastOperationId = aFOperation->id().toStdString(); - myLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() : FeaturePtr(); - PartSet_Module* aModule = module(); - if (!aModule->sketchMgr()->sketchSolverError()) { - if (!aFOperation->isEditOperation()) { - FeaturePtr anOperationFeature = aFOperation->feature(); - if (anOperationFeature.get() != NULL) { - aModule->editFeature(anOperationFeature); - aProcessed = true; - - myIsInternalEditOperation = true; - // activate selection filters of the first widget in the viewer - onWidgetActivated(); - - // activate the last active widget in the Property Panel - if (!myPreviousAttributeID.empty()) { - ModuleBase_Operation* anEditOperation = aModule->currentOperation(); - if (anEditOperation) { - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - ModuleBase_ModelWidget* aPreviousAttributeWidget = 0; - QList aWidgets = aPanel->modelWidgets(); - for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) { - if (aWidgets[i]->attributeID() == myPreviousAttributeID) - aPreviousAttributeWidget = aWidgets[i]; - } - // If the current widget is a selector, do nothing, it processes the mouse press - if (aPreviousAttributeWidget && !aPreviousAttributeWidget->isViewerSelector()) - aPreviousAttributeWidget->focusTo(); - } - } - } - } - else { - // the flag should be reset before start to do not react to the widget deactivate - myIsInternalEditOperation = false; - aModule->launchOperation(myLastOperationId.c_str()); - breakOperationSequence(); - aProcessed = true; - } - } - } + return aProcessed; +} - if (!aProcessed) - breakOperationSequence(); +void PartSet_SketcherReetntrantMgr::operationStarted(ModuleBase_Operation* theOperation) +{ + if (!isActiveMgr()) + return; - return aProcessed; + resetFlags(); } void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOperation) @@ -130,21 +86,11 @@ void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOp if (!isActiveMgr()) return; - if (myIsInternalEditOperation) { - // abort the created feature, which is currently edited - SessionPtr aMgr = ModelAPI_Session::get(); - if (aMgr->hasModuleDocument() && aMgr->canUndo()) { - aMgr->undo(); - workshop()->operationMgr()->updateApplyOfOperations(); - workshop()->updateCommandStatus(); - } - } - myIsInternalEditOperation = false; - breakOperationSequence(); + resetFlags(); } -bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow*/* theWnd*/, - QMouseEvent*/* theEvent*/) +bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* /* theWnd*/, + QMouseEvent* /* theEvent*/) { bool aProcessed = false; if (!isActiveMgr()) @@ -153,16 +99,29 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow*/* if (myIsInternalEditOperation) { PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast(module()->activeWidget()); if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) { - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); - anOperation->commit(); + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (myWorkshop->currentOperation()); + FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() : FeaturePtr(); + restartOperation(); aProcessed = true; + + if (aLastFeature) { + ModuleBase_IPropertyPanel* aPanel = myWorkshop->currentOperation()->propertyPanel(); + PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast(aPanel->activeWidget()); + if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) { + QList aSelection; + aSelection.append(ModuleBase_ViewerPrs(aLastFeature, TopoDS_Shape(), NULL)); + if (aPoint2DWdg->setSelection(aSelection, true)) + aPanel->activateNextWidget(aPoint2DWdg); + } + } } } return aProcessed; } -bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow*/* theWnd*/, - QMouseEvent*/* theEvent*/) +bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/, + QMouseEvent* /* theEvent*/) { return isActiveMgr() && myIsInternalEditOperation; } @@ -179,7 +138,7 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* ModuleBase_ModelWidget* anActiveWidget = anOperation->propertyPanel()->activeWidget(); if (!anActiveWidget || !anActiveWidget->isViewerSelector()) { - anOperation->commit(); + restartOperation(); aProcessed = true; // fill the widget by the mouse event point @@ -193,29 +152,20 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* return aProcessed; } -void PartSet_SketcherReetntrantMgr::propertyPanelDefined(ModuleBase_Operation* theOperation) +void PartSet_SketcherReetntrantMgr::onWidgetActivated() { if (!isActiveMgr()) return; - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); - if (!aFOperation) + if (!myIsInternalEditOperation) return; - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - if (PartSet_SketcherMgr::isSketchOperation(aFOperation) && (aFOperation->isEditOperation())) { - // we have to manually activate the sketch label in edit mode - aPanel->activateWidget(aPanel->modelWidgets().first()); - } - else if ((aFOperation->id() == myLastOperationId.c_str()) && myLastFeature) { - // Restart last operation type - ModuleBase_ModelWidget* aWgt = aPanel->activeWidget(); - PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast(module()->activeWidget()); - if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) { - QList aSelection; - aSelection.append(ModuleBase_ViewerPrs(myLastFeature, TopoDS_Shape(), NULL)); - if (aPoint2DWdg->setSelection(aSelection, true)) - aPanel->activateNextWidget(aPoint2DWdg); - } + PartSet_Module* aModule = module(); + ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); + ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); + if (aFirstWidget != aPanel->activeWidget()) { + ModuleBase_WidgetSelector* aWSelector = dynamic_cast(aFirstWidget); + if (aWSelector) + aWSelector->activateSelectionAndFilters(true); } } @@ -223,19 +173,21 @@ void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePrevio { if (!isActiveMgr()) return; + XGUI_OperationMgr* anOpMgr = workshop()->operationMgr(); + if (!anOpMgr->isApplyEnabled()) + return; - ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); - if (anOperation) { - if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) { + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (myWorkshop->currentOperation()); + if (aFOperation) { + if (PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) { + XGUI_OperationMgr* anOpMgr = workshop()->operationMgr(); if (myRestartingMode != RM_Forbided) { myRestartingMode = RM_LastFeatureUsed; - myPreviousAttributeID = thePreviousAttributeID; + startInternalEdit(thePreviousAttributeID); } - XGUI_Workshop* aWorkshop = workshop(); - XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); - // do nothing if the feature can not be applyed - if (anOpMgr->isApplyEnabled()) - anOperation->commit(); + else + aFOperation->commit(); } } } @@ -265,14 +217,14 @@ void PartSet_SketcherReetntrantMgr::onVertexSelected() } } -void PartSet_SketcherReetntrantMgr::enterReleased() +void PartSet_SketcherReetntrantMgr::onEnterReleased() { if (!isActiveMgr()) return; ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); - if (/*!aFOperation->isEditOperation() || */myIsInternalEditOperation) + if (myIsInternalEditOperation) myRestartingMode = RM_EmptyFeatureUsed; } @@ -281,24 +233,6 @@ bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection() return !isActiveMgr() || myRestartingMode == RM_None; } -void PartSet_SketcherReetntrantMgr::onWidgetActivated() -{ - if (!isActiveMgr()) - return; - - if (!myIsInternalEditOperation) - return; - - PartSet_Module* aModule = module(); - ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); - ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); - if (aFirstWidget != aPanel->activeWidget()) { - ModuleBase_WidgetSelector* aWSelector = dynamic_cast(aFirstWidget); - if (aWSelector) - aWSelector->activateSelectionAndFilters(true); - } -} - bool PartSet_SketcherReetntrantMgr::isActiveMgr() const { PartSet_SketcherMgr* aSketcherMgr = module()->sketchMgr(); @@ -307,11 +241,59 @@ bool PartSet_SketcherReetntrantMgr::isActiveMgr() const PartSet_SketcherMgr::isNestedSketchOperation(aCurrentOperation); } -void PartSet_SketcherReetntrantMgr::breakOperationSequence() +void PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) { - myLastOperationId = ""; - myLastFeature = FeaturePtr(); - myRestartingMode = RM_None; + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (myWorkshop->currentOperation()); + + aFOperation->setEditOperation(); + FeaturePtr anOperationFeature = aFOperation->feature(); + if (anOperationFeature.get() != NULL) { + + myIsInternalEditOperation = true; + // activate selection filters of the first widget in the viewer + onWidgetActivated(); + + // activate the last active widget in the Property Panel + if (!thePreviousAttributeID.empty()) { + ModuleBase_Operation* anEditOperation = module()->currentOperation(); + if (anEditOperation) { + ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); + ModuleBase_ModelWidget* aPreviousAttributeWidget = 0; + QList aWidgets = aPanel->modelWidgets(); + for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) { + if (aWidgets[i]->attributeID() == thePreviousAttributeID) + aPreviousAttributeWidget = aWidgets[i]; + } + // If the current widget is a selector, do nothing, it processes the mouse press + if (aPreviousAttributeWidget && !aPreviousAttributeWidget->isViewerSelector()) + aPreviousAttributeWidget->focusTo(); + } + } + } +} + +void PartSet_SketcherReetntrantMgr::restartOperation() +{ + if (myIsInternalEditOperation) { + ModuleBase_OperationFeature* aFOperation = dynamic_cast( + myWorkshop->currentOperation()); + if (aFOperation) { + myIsFlagsBlocked = true; + aFOperation->commit(); + module()->launchOperation(aFOperation->id()); + myIsFlagsBlocked = false; + resetFlags(); + } + } +} + +void PartSet_SketcherReetntrantMgr::resetFlags() +{ + if (!myIsFlagsBlocked) { + myIsInternalEditOperation = false; + myRestartingMode = RM_None; + } } XGUI_Workshop* PartSet_SketcherReetntrantMgr::workshop() const diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReetntrantMgr.h index 54cdfd20c..f8f9ae0f9 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.h @@ -24,8 +24,8 @@ class PartSet_Module; /// \ingroup PartSet_SketcherReetntrantMgr /// It provides reentrant create operations in sketch, that is when all inputs are valid, /// automatic validation of the creation and switch the created entity to edit mode -/// ('internal' edit operation), -/// with the ability to simultaneously create the next entity of same type (re-entrance of the operation). +/// ('internal' edit operation), with the ability to simultaneously create the next entity +/// of same type (re-entrance of the operation). /// OK valids the current edition and exits from the operation (no re-entrance). /// Cancel removes (undo) the entity currently edited and exits from the operation (no re-entrance). class PARTSET_EXPORT PartSet_SketcherReetntrantMgr : public QObject @@ -47,24 +47,26 @@ public: virtual ~PartSet_SketcherReetntrantMgr(); public: - /// If the internal edit operation is started, this is the first widget of the operation - ModuleBase_ModelWidget* activeWidget() const; - - /// Restarts sketcher operation automatically. If the commited operation is created, it starts - /// an 'internal' edit operation for the created feature. If an 'internal' operation is committed, - /// a create operation for a new feature with the current feature kind is started. - /// Some internal flags are taken into accout, such as whether the previous feature should be - /// used for initialization of created one or whether the restart of operation is forbidden. - /// \param theOperation a committed operation - /// \return true if an operation restarted + /// Returns a first widget of the current opeation if the internal edit operation is active + /// or return null. If the current widget of the operation is a viewer selector, it returns null. + ModuleBase_ModelWidget* internalActiveWidget() const; + + /// Resets the internal flags + /// \param theOperation a started operation + void operationStarted(ModuleBase_Operation* theOperation); + + /// Resets the internal flags + /// \param theOperation a started operation + /// \return state whether the internal edit operation was active bool operationCommitted(ModuleBase_Operation* theOperation); - /// \param theOperation a committed operation + /// Resets the internal flags + /// \param theOperation a started operation void operationAborted(ModuleBase_Operation* theOperation); /// Return true if the manager processes the mouse move event /// It happens if the current operation is an internal edit operation and the first - /// control can be filled by the mouse move event. The operation is committed. + /// control can be filled by the mouse move event. The operation is restarted. /// \return true if operation is committed. bool processMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); @@ -74,43 +76,49 @@ public: /// Return true if the manager processes the mouse enter event /// It happens if the current operation is an internal edit operation. - /// The operation is committed. + /// The operation is restarted. If the first widget of the started operation is + /// the point 2d, it processes this mouse event /// \return true if operation is committed. bool processMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); - /// Activates the operation widgets relatively the internal reentrant flags - void propertyPanelDefined(ModuleBase_Operation* theOperation); - - - /// Processing of vertex selected, if the feature is line, save flags to stop reentrant operation - void vertexSelected(); - - /// It is called by enter key released - /// Set a specific type of restarting the current operation - void enterReleased(); - /// It is called by the current operation filling with the preselection. /// Returns false if the reentrant mode of the operation is not empty. bool canBeCommittedByPreselection(); private slots: /// SLOT, that is called by a widget activating in the property panel - /// If the 'internal' edit operation is started, it activates the first control selection + /// If the 'internal' edit operation is started, it activates the first widget selection void onWidgetActivated(); /// SLOT, that is called by no more widget signal emitted by property panel - /// Set a specific flag to restart the sketcher operation + /// Start an internal edit operation or, if the internal flag is forbided, commits + /// the current operation + /// \param thePreviousAttributeID an index of the previous active attribute void onNoMoreWidgets(const std::string& thePreviousAttributeID); - /// Processing of vertex selected + /// Processing of vertex selected. Set an internal reentrant flag to forbiddent state if + /// the current feature is a line and there are not obligate widgets anymore void onVertexSelected(); + /// SLOT, that is called by enter key released + /// Set a specific type of restarting the current operation to do not use the feature + /// for initialization of a new started operation. + void onEnterReleased(); + private: /// Returns true if the current operation is a sketch or a nested sketch operation bool isActiveMgr() const; + /// Sets the focus to the last control of the property panel and activates selection + /// of the first widget to can select first value of the next create operation + /// \param thePreviousAttributeID an index of the previous attribute to set focus to this widget + void startInternalEdit(const std::string& thePreviousAttributeID); + + /// Commits the current operation and launches a new with the commited operation feature index + void restartOperation(); + /// Breaks sequense of automatically resterted operations - void breakOperationSequence(); + void resetFlags(); /// Returns the workshop XGUI_Workshop* workshop() const; @@ -121,13 +129,9 @@ private: private: ModuleBase_IWorkshop* myWorkshop; /// the workshop + RestartingMode myRestartingMode; /// automatical restarting mode flag + bool myIsFlagsBlocked; /// true when reset of flags should not be perfromed bool myIsInternalEditOperation; /// true when the 'internal' edit is started - - std::string myLastOperationId; - FeaturePtr myLastFeature; - - std::string myPreviousAttributeID; - RestartingMode myRestartingMode; /// Automatical restarting mode flag }; #endif