]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2336 sketch - coloring of selected segments
authornds <nds@opencascade.com>
Thu, 14 Dec 2017 04:35:47 +0000 (07:35 +0300)
committernds <nds@opencascade.com>
Thu, 14 Dec 2017 04:35:47 +0000 (07:35 +0300)
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_ActiveControlMgr.cpp

index 91468737ea647e0f0fadefccfe1687aac67288ec..3bbb2d79c531b1dfa029d9c960f543267e15d3bd 100755 (executable)
@@ -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);
   }
 }
 
index 629ac6d8d46a200cc2f811f0e6647e90a4301bc7..73b7ac61022dac09b4890fac3a285fa64530181d 100644 (file)
 #include "XGUI_Tools.h"
 #include "XGUI_Workshop.h"
 
-
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_IWorkshop.h>
 
+//#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);
 }