From b059beaa04c31859789fe2f56e70ebd07e4e829f Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 13 Dec 2017 09:24:45 +0300 Subject: [PATCH] Activation objects redesign : widgetActivated should not be processed in ReentrantManager because selection activate find active widget(by module from reentrant manager) and will itself activate selection/filters for this widget. --- src/ModuleBase/ModuleBase_IPropertyPanel.h | 3 +- src/PartSet/PartSet_SketcherMgr.cpp | 4 +-- src/PartSet/PartSet_SketcherReentrantMgr.cpp | 36 ++++++++++---------- src/PartSet/PartSet_SketcherReentrantMgr.h | 2 +- src/XGUI/XGUI_PropertyPanel.cpp | 2 +- src/XGUI/XGUI_PropertyPanel.h | 1 - src/XGUI/XGUI_SelectionActivate.cpp | 28 +++++++-------- src/XGUI/XGUI_SelectionActivate.h | 8 ++--- 8 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index e2b1010ac..446e0e59b 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -100,7 +100,7 @@ signals: /// The signal about the widget activation /// \param theWidget the activated widget - void widgetActivated(ModuleBase_ModelWidget* theWidget); + //void widgetActivated(ModuleBase_ModelWidget* theWidget); /// Emited when there is no next widget /// \param thePreviousAttributeID an attribute key of the previous active widget @@ -117,7 +117,6 @@ public slots: /** * Makes the given widget active, highlights it and removes * highlighting from the previous active widget - * emits widgetActivated(theWidget) signal * \param theWidget which has to be activated * \param theEmitSignal a flag to prohibit signal emit */ diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 01ec24d19..657d14075 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -673,8 +673,8 @@ void PartSet_SketcherMgr::onApplicationStarted() connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)), aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&))); - connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), - aReentranceMgr, SLOT(onWidgetActivated())); + //connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), + // aReentranceMgr, SLOT(onWidgetActivated())); } XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer(); diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 95ca672cd..0e4aebf79 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -322,23 +322,23 @@ void PartSet_SketcherReentrantMgr::setReentrantPreSelection( aReentrantMessage->setClickedPoint(myClickedSketchPoint); } -void PartSet_SketcherReentrantMgr::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) { - myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector); - } - } -} +//void PartSet_SketcherReentrantMgr::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) { +// myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector); +// } +// } +//} void PartSet_SketcherReentrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID) { @@ -504,7 +504,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); // activate selection filters of the first widget in the viewer - onWidgetActivated(); + //onWidgetActivated(); // activate the last active widget in the Property Panel if (!thePreviousAttributeID.empty()) { diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.h b/src/PartSet/PartSet_SketcherReentrantMgr.h index 7a7b26c46..073b534e8 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.h +++ b/src/PartSet/PartSet_SketcherReentrantMgr.h @@ -139,7 +139,7 @@ public: 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 widget selection - void onWidgetActivated(); + //void onWidgetActivated(); /// SLOT, that is called by no more widget signal emitted by property panel /// Start an internal edit operation or, if the internal flag is forbided, commits diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index f2531ef37..e46ab2d5b 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -494,7 +494,7 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, cons Events_Loop::loop()->flush(anEvent); if (isEmitSignal) { - emit widgetActivated(myActiveWidget); + //emit widgetActivated(myActiveWidget); if (!myActiveWidget && !isEditingMode()) { emit noMoreWidgets(aPreviosAttributeID); } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index fe16ed115..e8b7082c9 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -143,7 +143,6 @@ public slots: /** * Makes the given widget active, highlights it and removes * highlighting from the previous active widget - * emits widgetActivated(theWidget) signal * \param theWidget which has to be activated * \param theEmitSignal a flag to prohibit signal emit */ diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 13a67569d..9b8d2a5d5 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -120,20 +120,6 @@ void XGUI_SelectionActivate::updateSelectionFilters() activateSelectionFilters(aSelectionFilters); } -//************************************************************** -void XGUI_SelectionActivate::activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget) -{ - // activate selection modes - QIntList aModes; - getSelectionModes(theWidget, aModes); - activateObjects(aModes, getDisplayer()->displayedObjects(), true); - - // activate selection filters - SelectMgr_ListOfFilter aSelectionFilters; - getSelectionFilters(theWidget, aSelectionFilters); - activateSelectionFilters(aSelectionFilters); -} - //************************************************************** void XGUI_SelectionActivate::activateSelectionFilters (const SelectMgr_ListOfFilter& theSelectionFilters) @@ -150,6 +136,20 @@ void XGUI_SelectionActivate::activateSelectionFilters } } +//************************************************************** +void XGUI_SelectionActivate::activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget) +{ + // activate selection modes + QIntList aModes; + getSelectionModes(theWidget, aModes); + activateObjects(aModes, getDisplayer()->displayedObjects(), true); + + // activate selection filters + SelectMgr_ListOfFilter aSelectionFilters; + getSelectionFilters(theWidget, aSelectionFilters); + activateSelectionFilters(aSelectionFilters); +} + //************************************************************** void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes) diff --git a/src/XGUI/XGUI_SelectionActivate.h b/src/XGUI/XGUI_SelectionActivate.h index 1c149f816..9795c48d9 100644 --- a/src/XGUI/XGUI_SelectionActivate.h +++ b/src/XGUI/XGUI_SelectionActivate.h @@ -67,10 +67,6 @@ public: XGUI_EXPORT virtual void activateSelectionFilters (const SelectMgr_ListOfFilter& theSelectionFilters); - /// Activate or deactivate selection and selection filters like the widget is active - /// \param theWidget a source widget of selection modes/filters - XGUI_EXPORT virtual void activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget); - /// Returns list of currently active selection modes /// Selection modes will be returned according to TopAbs_ShapeEnum XGUI_EXPORT QIntList activeSelectionModes() const; @@ -137,6 +133,10 @@ public: XGUI_EXPORT void deactivateTrihedronInSelectionModes(); protected: + /// Activate or deactivate selection and selection filters like the widget is active + /// \param theWidget a source widget of selection modes/filters + virtual void activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget); + /// Returns selection modes of the widget /// \param theWidget model widget /// \param theModes selection modes -- 2.39.2