From b767cb1e1d53fe95c7c343b77e8b2d509aa3137a Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 14 Dec 2017 07:35:47 +0300 Subject: [PATCH] Issue #2336 sketch - coloring of selected segments --- src/PartSet/PartSet_Module.cpp | 3 ++- src/XGUI/XGUI_ActiveControlMgr.cpp | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 91468737e..3bbb2d79c 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -998,7 +998,8 @@ void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) if (!aCons.IsNull()) aToUseZLayer = true; } - aCtx->SetZLayer(anAIS, myVisualLayerId); + if (aToUseZLayer) + aCtx->SetZLayer(anAIS, myVisualLayerId); } } diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index 629ac6d8d..73b7ac610 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -24,10 +24,19 @@ #include "XGUI_Tools.h" #include "XGUI_Workshop.h" - #include #include +//#define DEBUG_ACTIVE_SELECTOR + +#ifdef DEBUG_ACTIVE_SELECTOR +void debugInfo(const QString& theMessage, XGUI_ActiveControlSelector* theSelector) +{ + std::cout << theMessage.toStdString().c_str() << ", active: " + << theSelector ? theSelector->getType().toStdString().c_str() : "NULL" << std::endl; +} +#endif + //******************************************************************** XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop), myActiveSelector(0) @@ -70,6 +79,10 @@ void XGUI_ActiveControlMgr::onSelectorActivated() activateSelector(aSelector); XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes(); XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters(); + +#ifdef DEBUG_ACTIVE_SELECTOR + debugInfo("onSelectorActivated", myActiveSelector); +#endif } //******************************************************************** @@ -80,7 +93,7 @@ void XGUI_ActiveControlMgr::onSelectorDeactivated() return; myActiveSelector->setActive(false); - myActiveSelector = NULL; + activateSelector(NULL); XGUI_ActiveControlSelector* aSelectorToBeActivated = 0; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) @@ -95,6 +108,9 @@ void XGUI_ActiveControlMgr::onSelectorDeactivated() XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes(); XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters(); +#ifdef DEBUG_ACTIVE_SELECTOR + debugInfo("onSelectorDeactivated", myActiveSelector); +#endif } //******************************************************************** @@ -104,11 +120,15 @@ void XGUI_ActiveControlMgr::onSelectionChanged() return; myActiveSelector->processSelection(); +#ifdef DEBUG_ACTIVE_SELECTOR + debugInfo("onSelectionChanged", myActiveSelector); +#endif } //******************************************************************** void XGUI_ActiveControlMgr::activateSelector(XGUI_ActiveControlSelector* theSelector) { myActiveSelector = theSelector; - theSelector->setActive(true); + if (myActiveSelector) + myActiveSelector->setActive(true); } -- 2.39.2