From 13436fe425e95d712e453110038e001f93ac92f1 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 23 Mar 2017 11:33:32 +0300 Subject: [PATCH] Issue #2024 - Redesign of circle and arc of circle: fill Reference Attribute Type of Circle macro feature should be saved by restarting of operation. --- src/Config/Config_Keywords.h | 1 + src/ModuleBase/ModuleBase_ModelWidget.cpp | 9 +- src/ModuleBase/ModuleBase_ModelWidget.h | 7 ++ src/ModuleBase/ModuleBase_PagedContainer.cpp | 9 +- src/PartSet/CMakeLists.txt | 6 +- src/PartSet/PartSet_Module.cpp | 4 +- src/PartSet/PartSet_Module.h | 6 +- src/PartSet/PartSet_SketcherMgr.cpp | 24 ++-- ...r.cpp => PartSet_SketcherReentrantMgr.cpp} | 111 +++++++++++++----- ...ntMgr.h => PartSet_SketcherReentrantMgr.h} | 20 +++- src/PartSet/PartSet_WidgetPoint2d.cpp | 2 +- src/SketchPlugin/plugin-Sketch.xml | 2 +- 12 files changed, 140 insertions(+), 61 deletions(-) rename src/PartSet/{PartSet_SketcherReetntrantMgr.cpp => PartSet_SketcherReentrantMgr.cpp} (84%) mode change 100755 => 100644 rename src/PartSet/{PartSet_SketcherReetntrantMgr.h => PartSet_SketcherReentrantMgr.h} (90%) mode change 100755 => 100644 diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 6b4a1312f..befdd08e5 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -80,6 +80,7 @@ const static char* ATTR_OBLIGATORY = "obligatory"; const static char* ATTR_CONCEALMENT = "concealment"; const static char* ATTR_USE_RESET = "use_reset"; const static char* ATTR_GREED = "greed"; +const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit"; // WDG_INFO properties const static char* INFO_WDG_TEXT = FEATURE_TEXT; diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index db9908a41..aa0470f7a 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -51,6 +51,8 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false); + myIsModifiedInEdit = theData->getBooleanAttribute(ATTR_MODIFIED_IN_EDIT, true); + myDefaultValue = theData->getProperty(ATTR_DEFAULT); myUseReset = theData->getBooleanAttribute(ATTR_USE_RESET, true); myIsComputedDefault = theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED; @@ -310,7 +312,12 @@ bool ModuleBase_ModelWidget::storeValue() setValueState(Stored); emit beforeValuesChanged(); - bool isDone = storeValueCustom(); + bool isDone = false; + // value is stored only in creation mode and in edition if there is not + // XML flag prohibited modification in edit mode(macro feature circle/arc) + if (!isEditingMode() || isModifiedInEdit()) + isDone = storeValueCustom(); + emit afterValuesChanged(); return isDone; diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 25db7bcfc..fcd2ad508 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -93,6 +93,10 @@ Q_OBJECT /// \return the boolean result bool isUseReset() const { return myUseReset; } + /// Returns this parameter value in the xml file + /// \return the boolean result + bool isModifiedInEdit() const { return myIsModifiedInEdit; } + /// Returns this widget value state /// \return the enumeration result ValueState getValueState() const { return myState; } @@ -359,6 +363,9 @@ private: /// an XML internal state bool myIsInternal; + // an XML state, the value is not stored into model if the widget is in edit mode + bool myIsModifiedInEdit; + /// the reset state. If it is false, the reset method of the widget is not performed bool myUseReset; /// blocked flag of modification of the value state diff --git a/src/ModuleBase/ModuleBase_PagedContainer.cpp b/src/ModuleBase/ModuleBase_PagedContainer.cpp index 42d48907f..8723cbd77 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.cpp +++ b/src/ModuleBase/ModuleBase_PagedContainer.cpp @@ -111,8 +111,13 @@ bool ModuleBase_PagedContainer::storeValueCustom() void ModuleBase_PagedContainer::onPageChanged() { - storeValue(); - if (myIsFocusOnCurrentPage) focusTo(); + if (!storeValue()) + return; + // focus might be changed only if the value is correcly stored + // if it is not stored, reentrant manager will handle by this widget + // after it will restart operation, the widget might be removed + if (myIsFocusOnCurrentPage) + focusTo(); } diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index bb1035a06..3793d26af 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -25,7 +25,7 @@ SET(PROJECT_HEADERS PartSet_PreviewPlanes.h PartSet_ResultSketchPrs.h PartSet_SketcherMgr.h - PartSet_SketcherReetntrantMgr.h + PartSet_SketcherReentrantMgr.h PartSet_Tools.h PartSet_Validators.h PartSet_WidgetChoice.h @@ -47,7 +47,7 @@ SET(PROJECT_MOC_HEADERS PartSet_MenuMgr.h PartSet_Module.h PartSet_SketcherMgr.h - PartSet_SketcherReetntrantMgr.h + PartSet_SketcherReentrantMgr.h PartSet_WidgetChoice.h PartSet_WidgetEditor.h PartSet_WidgetFeaturePointSelector.h @@ -75,7 +75,7 @@ SET(PROJECT_SOURCES PartSet_PreviewPlanes.cpp PartSet_ResultSketchPrs.cpp PartSet_SketcherMgr.cpp - PartSet_SketcherReetntrantMgr.cpp + PartSet_SketcherReentrantMgr.cpp PartSet_Tools.cpp PartSet_Validators.cpp PartSet_WidgetEditor.cpp diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 14f18c942..67b4adf85 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -16,7 +16,7 @@ #include "PartSet_WidgetFileSelector.h" #include "PartSet_WidgetSketchCreator.h" #include "PartSet_SketcherMgr.h" -#include "PartSet_SketcherReetntrantMgr.h" +#include "PartSet_SketcherReentrantMgr.h" #include "PartSet_ResultSketchPrs.h" #include "PartSet_MenuMgr.h" #include "PartSet_CustomPrs.h" @@ -132,7 +132,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) new PartSet_IconFactory(); mySketchMgr = new PartSet_SketcherMgr(this); - mySketchReentrantMgr = new PartSet_SketcherReetntrantMgr(theWshop); + mySketchReentrantMgr = new PartSet_SketcherReentrantMgr(theWshop); XGUI_ModuleConnector* aConnector = dynamic_cast(theWshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index ed00ebef5..3c7316458 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -34,7 +34,7 @@ class XGUI_Workshop; class PartSet_MenuMgr; class PartSet_CustomPrs; class PartSet_SketcherMgr; -class PartSet_SketcherReetntrantMgr; +class PartSet_SketcherReentrantMgr; class ModelAPI_Result; class QAction; @@ -203,7 +203,7 @@ public: PartSet_SketcherMgr* sketchMgr() const { return mySketchMgr; } /// Returns sketch reentrant manager - PartSet_SketcherReetntrantMgr* sketchReentranceMgr() const { return mySketchReentrantMgr; } + PartSet_SketcherReentrantMgr* sketchReentranceMgr() const { return mySketchReentrantMgr; } /// Returns listener of overconstraint signal /// \return the listener @@ -408,7 +408,7 @@ private: SelectMgr_ListOfFilter mySelectionFilters; PartSet_SketcherMgr* mySketchMgr; - PartSet_SketcherReetntrantMgr* mySketchReentrantMgr; + PartSet_SketcherReentrantMgr* mySketchReentrantMgr; PartSet_MenuMgr* myMenuMgr; /// A default custom presentation, which is used for references objects of started operation PartSet_CustomPrs* myCustomPrs; diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 5497da37a..1fd62e95d 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -5,7 +5,7 @@ // Author: Vitaly SMETANNIKOV #include "PartSet_SketcherMgr.h" -#include "PartSet_SketcherReetntrantMgr.h" +#include "PartSet_SketcherReentrantMgr.h" #include "PartSet_Module.h" #include "PartSet_MouseProcessor.h" #include "PartSet_Tools.h" @@ -615,7 +615,7 @@ 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(); + PartSet_SketcherReentrantMgr* aReentranceMgr = myModule->sketchReentranceMgr(); XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); if (aPropertyPanel) { @@ -1540,19 +1540,23 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) { - /*Temporary commented as we do not modify values in property panel + //Temporary commented as we do not modify values in property panel if (isToConnect) { - connect(theWidget, SIGNAL(beforeValuesChanged()), - this, SLOT(onBeforeValuesChangedInPropertyPanel())); + //connect(theWidget, SIGNAL(beforeValuesChanged()), + // this, SLOT(onBeforeValuesChangedInPropertyPanel())); + //connect(theWidget, SIGNAL(afterValuesChanged()), + // this, SLOT(onAfterValuesChangedInPropertyPanel())); connect(theWidget, SIGNAL(afterValuesChanged()), - this, SLOT(onAfterValuesChangedInPropertyPanel())); + myModule->sketchReentranceMgr(), SLOT(onAfterValuesChangedInPropertyPanel())); } else { - disconnect(theWidget, SIGNAL(beforeValuesChanged()), - this, SLOT(onBeforeValuesChangedInPropertyPanel())); + //disconnect(theWidget, SIGNAL(beforeValuesChanged()), + // this, SLOT(onBeforeValuesChangedInPropertyPanel())); + //disconnect(theWidget, SIGNAL(afterValuesChanged()), + // this, SLOT(onAfterValuesChangedInPropertyPanel())); disconnect(theWidget, SIGNAL(afterValuesChanged()), - this, SLOT(onAfterValuesChangedInPropertyPanel())); - }*/ + myModule->sketchReentranceMgr(), SLOT(onAfterValuesChangedInPropertyPanel())); + } } void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp old mode 100755 new mode 100644 similarity index 84% rename from src/PartSet/PartSet_SketcherReetntrantMgr.cpp rename to src/PartSet/PartSet_SketcherReentrantMgr.cpp index 36ae78513..45547cb74 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -#include "PartSet_SketcherReetntrantMgr.h" +#include "PartSet_SketcherReentrantMgr.h" #include "PartSet_Module.h" #include "PartSet_SketcherMgr.h" #include "PartSet_WidgetPoint2d.h" @@ -38,21 +38,23 @@ #include -PartSet_SketcherReetntrantMgr::PartSet_SketcherReetntrantMgr(ModuleBase_IWorkshop* theWorkshop) +PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop* theWorkshop) : QObject(theWorkshop), myWorkshop(theWorkshop), myRestartingMode(RM_None), myIsFlagsBlocked(false), myIsInternalEditOperation(false), + myIsValueChangedBlocked(false), + myInternalActiveWidget(0), myNoMoreWidgetsAttribute("") { } -PartSet_SketcherReetntrantMgr::~PartSet_SketcherReetntrantMgr() +PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() { } -ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::internalActiveWidget() const +ModuleBase_ModelWidget* PartSet_SketcherReentrantMgr::internalActiveWidget() const { ModuleBase_ModelWidget* aWidget = 0; if (!isActiveMgr()) @@ -70,12 +72,12 @@ ModuleBase_ModelWidget* PartSet_SketcherReetntrantMgr::internalActiveWidget() co return aWidget; } -bool PartSet_SketcherReetntrantMgr::isInternalEditActive() const +bool PartSet_SketcherReentrantMgr::isInternalEditActive() const { return myIsInternalEditOperation; } -void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState() +void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() { if (myIsInternalEditOperation) { ModuleBase_OperationFeature* aFOperation = dynamic_cast @@ -95,7 +97,7 @@ void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState() } } -bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* theOperation) +bool PartSet_SketcherReentrantMgr::operationCommitted(ModuleBase_Operation* theOperation) { bool aProcessed = false; if (!isActiveMgr()) @@ -107,7 +109,7 @@ bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* the return aProcessed; } -void PartSet_SketcherReetntrantMgr::operationStarted(ModuleBase_Operation* theOperation) +void PartSet_SketcherReentrantMgr::operationStarted(ModuleBase_Operation* theOperation) { if (!isActiveMgr()) return; @@ -121,7 +123,7 @@ void PartSet_SketcherReetntrantMgr::operationStarted(ModuleBase_Operation* theOp resetFlags(); } -void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOperation) +void PartSet_SketcherReentrantMgr::operationAborted(ModuleBase_Operation* theOperation) { if (!isActiveMgr()) return; @@ -129,7 +131,7 @@ void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOp resetFlags(); } -bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* theWnd, +bool PartSet_SketcherReentrantMgr::processMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { bool aProcessed = false; @@ -186,13 +188,13 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* th return aProcessed; } -bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/, +bool PartSet_SketcherReentrantMgr::processMousePressed(ModuleBase_IViewWindow* /* theWnd*/, QMouseEvent* /* theEvent*/) { return isActiveMgr() && myIsInternalEditOperation; } -bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd, +bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { bool aProcessed = false; @@ -257,7 +259,7 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* return aProcessed; } -void PartSet_SketcherReetntrantMgr::onWidgetActivated() +void PartSet_SketcherReentrantMgr::onWidgetActivated() { if (!isActiveMgr()) return; @@ -274,7 +276,7 @@ void PartSet_SketcherReetntrantMgr::onWidgetActivated() } } -void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID) +void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID) { if (!isActiveMgr()) return; @@ -306,7 +308,7 @@ void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePrevio } } -bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousAttributeID) +bool PartSet_SketcherReentrantMgr::processEnter(const std::string& thePreviousAttributeID) { bool isDone = false; @@ -333,7 +335,7 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA return isDone; } -void PartSet_SketcherReetntrantMgr::onVertexSelected() +void PartSet_SketcherReentrantMgr::onVertexSelected() { if (!isActiveMgr()) return; @@ -360,7 +362,21 @@ void PartSet_SketcherReetntrantMgr::onVertexSelected() } } -void PartSet_SketcherReetntrantMgr::onBeforeStopped() +void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() +{ + // blocked flag in order to avoid circling when storeValue will be applied in + // this method to cached widget + if (myIsValueChangedBlocked) + return; + + if (isInternalEditActive()) { + ModuleBase_ModelWidget* aWidget = (ModuleBase_ModelWidget*)sender(); + if (!aWidget->isModifiedInEdit()) + restartOperation(); + } +} + +void PartSet_SketcherReentrantMgr::onBeforeStopped() { if (!isActiveMgr() || !myIsInternalEditOperation) return; @@ -368,17 +384,17 @@ void PartSet_SketcherReetntrantMgr::onBeforeStopped() beforeStopInternalEdit(); } -bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection() +bool PartSet_SketcherReentrantMgr::canBeCommittedByPreselection() { return !isActiveMgr() || myRestartingMode == RM_None; } -bool PartSet_SketcherReetntrantMgr::isInternalEditStarted() const +bool PartSet_SketcherReentrantMgr::isInternalEditStarted() const { return myIsInternalEditOperation; } -bool PartSet_SketcherReetntrantMgr::isActiveMgr() const +bool PartSet_SketcherReentrantMgr::isActiveMgr() const { ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation(); @@ -395,7 +411,7 @@ bool PartSet_SketcherReetntrantMgr::isActiveMgr() const return anActive; } -bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) +bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) { bool isDone = false; /// this is workaround for ModuleBase_WidgetEditor, used in SALOME mode. Sometimes key enter @@ -468,7 +484,7 @@ bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePrev return isDone; } -void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit() +void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() { ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); @@ -480,12 +496,29 @@ void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit() deleteInternalFeature(); } -void PartSet_SketcherReetntrantMgr::restartOperation() +void PartSet_SketcherReentrantMgr::restartOperation() { if (myIsInternalEditOperation) { ModuleBase_OperationFeature* aFOperation = dynamic_cast( myWorkshop->currentOperation()); if (aFOperation) { + // obtain widgets(attributes) which content should be applied to attributes of new feature + ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); + ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + const QList& aWidgets = aPanel->modelWidgets(); + QList aValueWidgets; + for (int i = 0, aSize = aWidgets.size(); i < aSize; i++) { + ModuleBase_ModelWidget* aWidget = aWidgets[i]; + if (!aWidget->isModifiedInEdit()) { + aValueWidgets.append(aWidget); + // the widget is cashed to fill feature of new operation by the current widget value + // we set empty parent to the widget in order to remove it ourselves. Reason: restart + // operation will clear property panel and delete all widgets. This widget should be + // removed only after applying value of the widget to new created feature. + aWidget->setParent(0); + } + } + myNoMoreWidgetsAttribute = ""; myIsFlagsBlocked = true; module()->launchOperation(aFOperation->id()); @@ -499,11 +532,26 @@ void PartSet_SketcherReetntrantMgr::restartOperation() onNoMoreWidgets(myNoMoreWidgetsAttribute); myNoMoreWidgetsAttribute = ""; } + + // filling new feature by the previous value of active widget + // (e.g. circle_type in macro Circle) + ModuleBase_OperationFeature* aFOperation = dynamic_cast( + myWorkshop->currentOperation()); + myIsValueChangedBlocked = true; // flag to avoid onAfterValuesChangedInPropertyPanel slot + for (int i = 0, aSize = aValueWidgets.size(); i < aSize; i++) { + ModuleBase_ModelWidget* aWidget = aValueWidgets[i]; + aWidget->setEditingMode(false); + aWidget->setFeature(aFOperation->feature()); + aWidget->storeValue(); + // we must delete this widget + delete aWidget; + } + myIsValueChangedBlocked = false; } } } -void PartSet_SketcherReetntrantMgr::createInternalFeature() +void PartSet_SketcherReentrantMgr::createInternalFeature() { ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); @@ -546,7 +594,7 @@ void PartSet_SketcherReetntrantMgr::createInternalFeature() } } -void PartSet_SketcherReetntrantMgr::deleteInternalFeature() +void PartSet_SketcherReentrantMgr::deleteInternalFeature() { if (myInternalActiveWidget) { ModuleBase_WidgetSelector* aWSelector = @@ -564,7 +612,7 @@ void PartSet_SketcherReetntrantMgr::deleteInternalFeature() myInternalFeature = FeaturePtr(); } -void PartSet_SketcherReetntrantMgr::resetFlags() +void PartSet_SketcherReentrantMgr::resetFlags() { if (!myIsFlagsBlocked) { myIsInternalEditOperation = false; @@ -573,7 +621,7 @@ void PartSet_SketcherReetntrantMgr::resetFlags() } } -bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature, +bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(const FeaturePtr& theSourceFeature, const FeaturePtr& theNewFeature, const CompositeFeaturePtr& theSketch, const bool isTemporary) @@ -640,7 +688,7 @@ bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& t return aChanged; } -bool PartSet_SketcherReetntrantMgr::isTangentArc(ModuleBase_Operation* theOperation, +bool PartSet_SketcherReentrantMgr::isTangentArc(ModuleBase_Operation* theOperation, const CompositeFeaturePtr& /*theSketch*/) const { bool aTangentArc = false; @@ -657,21 +705,20 @@ bool PartSet_SketcherReetntrantMgr::isTangentArc(ModuleBase_Operation* theOperat return aTangentArc; } -void PartSet_SketcherReetntrantMgr::updateAcceptAllAction() +void PartSet_SketcherReentrantMgr::updateAcceptAllAction() { CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); if (aSketch.get()) workshop()->errorMgr()->updateAcceptAllAction(aSketch); } -XGUI_Workshop* PartSet_SketcherReetntrantMgr::workshop() const +XGUI_Workshop* PartSet_SketcherReentrantMgr::workshop() const { XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); return aConnector->workshop(); } -PartSet_Module* PartSet_SketcherReetntrantMgr::module() const +PartSet_Module* PartSet_SketcherReentrantMgr::module() const { return dynamic_cast(myWorkshop->module()); } - diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReentrantMgr.h old mode 100755 new mode 100644 similarity index 90% rename from src/PartSet/PartSet_SketcherReetntrantMgr.h rename to src/PartSet/PartSet_SketcherReentrantMgr.h index 5ae8a76b7..b430c2389 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReentrantMgr.h @@ -1,7 +1,7 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -#ifndef PartSet_SketcherReetntrantMgr_H -#define PartSet_SketcherReetntrantMgr_H +#ifndef PartSet_SketcherReentrantMgr_H +#define PartSet_SketcherReentrantMgr_H #include "PartSet.h" @@ -23,7 +23,7 @@ class QMouseEvent; class XGUI_Workshop; class PartSet_Module; -/// \ingroup PartSet_SketcherReetntrantMgr +/// \ingroup PartSet_SketcherReentrantMgr /// 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 @@ -31,7 +31,7 @@ class PartSet_Module; /// 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 +class PARTSET_EXPORT PartSet_SketcherReentrantMgr : public QObject { Q_OBJECT @@ -47,8 +47,8 @@ enum RestartingMode { public: /// Constructor /// \param theWorkshop a workshop instance - PartSet_SketcherReetntrantMgr(ModuleBase_IWorkshop* theWorkshop); - virtual ~PartSet_SketcherReetntrantMgr(); + PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop* theWorkshop); + virtual ~PartSet_SketcherReentrantMgr(); public: /// Returns a first widget of the current opeation if the internal edit operation is active @@ -120,6 +120,13 @@ private slots: /// the current feature is a line and there are not obligate widgets anymore void onVertexSelected(); + /// Listens to the signal about the modification of the values + /// have been done in the property panel. If the manager has active edit operation and + /// the active widget does not process the modification of value, the manager will + /// restart current operation and fill a new feature attribute by the value of current + /// widget + void onAfterValuesChangedInPropertyPanel(); + /// Deactivates selection and filters of the first operation widget if it is an internal /// 'edit' operation void onBeforeStopped(); @@ -182,6 +189,7 @@ private: 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 + bool myIsValueChangedBlocked; /// blocked flag to avoid circling by value changed FeaturePtr myPreviousFeature; /// feature of the previous operation, which is restarted FeaturePtr myInternalFeature; diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index cb727289e..cf095fe0c 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -7,7 +7,7 @@ #include "PartSet_WidgetPoint2d.h" #include #include -#include +#include #include #include diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index fa03e34ae..e2492432a 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -76,7 +76,7 @@ icon="icons/Sketch/circle.png" title="Circle" tooltip="Create circle"> - + -- 2.30.2