From: nds Date: Fri, 5 Dec 2014 06:26:04 +0000 (+0300) Subject: An improvement for the sketch operation restarting mode change. X-Git-Tag: V_0.6.0^2~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c56d3c2768b68d422725bba39fa83ad59c56b75;p=modules%2Fshaper.git An improvement for the sketch operation restarting mode change. The operation should be restarted in the following cases: 1. There are no more widgets in the property panel, 2. If the vertex is selected beforehand the first case happens, the operation should not be restarted(ForbidRestarting) 3. During the operation commit the restarting flag is analized to perfrom the restart if necessary. 4. Enter button release should restart operation but the previous feature is not concidered. --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 3dec04e88..c0875b7c1 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -93,7 +93,7 @@ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) : ModuleBase_IModule(theWshop), - myIsDragging(false), myRestartingMode(RM_LastFeatureUse), myDragDone(false) + myIsDragging(false), myRestartingMode(RM_None), myDragDone(false) { //myWorkshop = dynamic_cast(theWshop); ModuleBase_IViewer* aViewer = aViewer = theWshop->viewer(); @@ -145,13 +145,13 @@ void PartSet_Module::onOperationComitted(ModuleBase_Operation* theOperation) FeaturePtr aFeature = theOperation->feature(); std::shared_ptr aSPFeature = std::dynamic_pointer_cast(aFeature); - if (aSPFeature && (myRestartingMode != RM_None)) { + if (aSPFeature && (myRestartingMode == RM_LastFeatureUse || + myRestartingMode == RM_LastFeatureUse)) { myLastOperationId = theOperation->id(); myLastFeature = myRestartingMode == RM_LastFeatureUse ? theOperation->feature() : FeaturePtr(); launchOperation(myLastOperationId); - } else { - breakOperationSequence(); } + breakOperationSequence(); } void PartSet_Module::breakOperationSequence() @@ -159,7 +159,6 @@ void PartSet_Module::breakOperationSequence() myLastOperationId = ""; myLastFeature = FeaturePtr(); myRestartingMode = RM_None; - } void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation) @@ -169,7 +168,6 @@ void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation) void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation) { - myRestartingMode = RM_LastFeatureUse; if (theOperation->id().toStdString() == SketchPlugin_Sketch::ID()) { // Display all sketcher sub-Objects myCurrentSketch = std::dynamic_pointer_cast(theOperation->feature()); @@ -531,6 +529,8 @@ void PartSet_Module::onNoMoreWidgets() std::shared_ptr aSPFeature = std::dynamic_pointer_cast(aFeature); if (aSPFeature) { + if (myRestartingMode != RM_ForbidRestarting) + myRestartingMode = RM_LastFeatureUse; aOperation->commit(); } } @@ -560,7 +560,7 @@ void PartSet_Module::onVertexSelected(ObjectPtr theObject, const TopoDS_Shape& t ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); const QList& aWidgets = aPanel->modelWidgets(); if (aWidgets.last() == aPanel->activeWidget()) { - breakOperationSequence(); + myRestartingMode = RM_ForbidRestarting; } } } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 2f981fd66..86a813d16 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -31,6 +31,7 @@ Q_OBJECT /// Enumeration to specify the restart operation properties. enum RestartingMode { RM_None, /// the operation should not be restarted + RM_ForbidRestarting, /// the operation should not be restarted after there is no active widget RM_LastFeatureUse, /// the operation is restarted and use the previous feature for own initialization RM_LastFeatureEmpty /// the operation is restarted and does not use the previous feature };