void debugInfo(const QString& theMessage, XGUI_ActiveControlSelector* theSelector)
{
std::cout << theMessage.toStdString().c_str() << ", active: "
- << theSelector ? theSelector->getType().toStdString().c_str() : "NULL" << std::endl;
+ << (theSelector ? theSelector->getType().toStdString().c_str() : "NULL") << std::endl;
}
#endif
//********************************************************************
XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop)
-: myWorkshop(theWorkshop), myActiveSelector(0)
+: myWorkshop(theWorkshop), myActiveSelector(0), myIsBlocked(false)
{
connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
}
if (!aSelector || aSelector == myActiveSelector)
return;
- if (myActiveSelector)
+ if (myIsBlocked) // we've come here from the same method
+ return;
+ myIsBlocked = true;
+ if (myActiveSelector) {
myActiveSelector->setActive(false);
-
+ }
activateSelector(aSelector);
XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes();
XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters();
#ifdef DEBUG_ACTIVE_SELECTOR
debugInfo("onSelectorActivated", myActiveSelector);
#endif
+ myIsBlocked = false;
}
//********************************************************************
if (!aSelector || aSelector != myActiveSelector || !myActiveSelector)
return;
+ if (myIsBlocked) // we've come here from the same method
+ return;
+ myIsBlocked = true;
+
myActiveSelector->setActive(false);
activateSelector(NULL);
#ifdef DEBUG_ACTIVE_SELECTOR
debugInfo("onSelectorDeactivated", myActiveSelector);
#endif
+ myIsBlocked = false;
}
//********************************************************************