From 7686107df8c1e55ae932a39b3f86204408874066 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 6 Jun 2012 01:56:25 +0200 Subject: [PATCH] CHANGED: #1471 moved makeWindow and unMakeWindow methods to CWidgetManager from CInterfaceManager. So CInterfaceGroup no longer depends on CInterfaceManager. --- code/ryzom/client/src/character_cl.cpp | 2 +- code/ryzom/client/src/forage_source_cl.cpp | 2 +- .../client/src/interface_v3/chat_window.cpp | 6 +- .../client/src/interface_v3/ctrl_base.cpp | 9 +-- .../src/interface_v3/flying_text_manager.cpp | 2 +- .../src/interface_v3/group_container.cpp | 4 +- .../interface_v3/group_in_scene_bubble.cpp | 20 +++--- .../src/interface_v3/interface_group.cpp | 23 +++--- .../src/interface_v3/interface_link.cpp | 10 +-- .../src/interface_v3/interface_manager.cpp | 68 ------------------ .../src/interface_v3/interface_manager.h | 8 --- .../client/src/interface_v3/view_base.cpp | 7 +- .../src/interface_v3/widget_manager.cpp | 70 +++++++++++++++++++ .../client/src/interface_v3/widget_manager.h | 6 ++ code/ryzom/client/src/r2/displayer_visual.cpp | 2 +- 15 files changed, 116 insertions(+), 123 deletions(-) diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index 55f1af798..8503e505b 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -452,7 +452,7 @@ void CCharacterCL::releaseInSceneInterfaces() { if (_InSceneUserInterface) { - CInterfaceManager::getInstance()->unMakeWindow(_InSceneUserInterface); + CWidgetManager::getInstance()->unMakeWindow(_InSceneUserInterface); if (_InSceneUserInterface->getParent()) { _InSceneUserInterface->getParent()->delGroup(_InSceneUserInterface); diff --git a/code/ryzom/client/src/forage_source_cl.cpp b/code/ryzom/client/src/forage_source_cl.cpp index a62509aab..b59a91d52 100644 --- a/code/ryzom/client/src/forage_source_cl.cpp +++ b/code/ryzom/client/src/forage_source_cl.cpp @@ -177,7 +177,7 @@ void CForageSourceCL::releaseInSceneInterfaces() { if (_InSceneUserInterface) { - CInterfaceManager::getInstance()->unMakeWindow(_InSceneUserInterface); + CWidgetManager::getInstance()->unMakeWindow(_InSceneUserInterface); if (_InSceneUserInterface->getParent()) { _InSceneUserInterface->getParent()->delGroup(_InSceneUserInterface); diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index b9824f115..c7d16f60b 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -294,7 +294,7 @@ void CChatWindow::deleteContainer() } else { - CInterfaceManager::getInstance()->unMakeWindow(_Chat); + CWidgetManager::getInstance()->unMakeWindow(_Chat); if (_Chat->getParent()) { _Chat->getParent()->delGroup(_Chat); @@ -772,7 +772,7 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); pRoot->addGroup (pGC); pGC->setParent(pRoot); // must be done before makeWindow - pIM->makeWindow(pGC); + CWidgetManager::getInstance()->makeWindow(pGC); pGC->open(); pGC->updateCoords(); pGC->center(); @@ -897,7 +897,7 @@ bool CChatGroupWindow::removeFreeTeller(const std::string &containerID) pIM->removeGroupContainerImage(_FreeTellers[i]->getId(), m); } CInterfaceGroup *pRoot = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface")); - pIM->unMakeWindow(_FreeTellers[i]); + CWidgetManager::getInstance()->unMakeWindow(_FreeTellers[i]); pRoot->delGroup (_FreeTellers[i]); _FreeTellers[i] = NULL; _FreeTellers.erase(_FreeTellers.begin()+i); diff --git a/code/ryzom/client/src/interface_v3/ctrl_base.cpp b/code/ryzom/client/src/interface_v3/ctrl_base.cpp index b68851a0f..1eea06182 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_base.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_base.cpp @@ -15,12 +15,10 @@ // along with this program. If not, see . - -#include "stdpch.h" - -#include "ctrl_base.h" #include "nel/misc/xml_auto_ptr.h" -#include "interface_manager.h" +#include "ctrl_base.h" +#include "interface_group.h" +#include "widget_manager.h" using namespace NLMISC; @@ -41,7 +39,6 @@ bool CCtrlBase::handleEvent(const NLGUI::CEventDescriptor &event) if (!((NLGUI::CEventDescriptorActiveCalledOnParent &) eds).getActive()) { // the mouse capture should be lost when the ctrl is hidden - CInterfaceManager *manager = CInterfaceManager::getInstance(); if (CWidgetManager::getInstance()->getCapturePointerLeft() == this) { CWidgetManager::getInstance()->setCapturePointerLeft(NULL); diff --git a/code/ryzom/client/src/interface_v3/flying_text_manager.cpp b/code/ryzom/client/src/interface_v3/flying_text_manager.cpp index 48bac19ab..f8ef9e29c 100644 --- a/code/ryzom/client/src/interface_v3/flying_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/flying_text_manager.cpp @@ -202,7 +202,7 @@ void CFlyingTextManager::unlinkToInterface(CGroupInfo &gi) // remove from group and window list CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->unMakeWindow(gi.GroupInScene); + CWidgetManager::getInstance()->unMakeWindow(gi.GroupInScene); // remove but don't delete gi.GroupInScene->getParent()->delGroup(gi.GroupInScene, true); gi.GroupInScene->setParent(NULL); diff --git a/code/ryzom/client/src/interface_v3/group_container.cpp b/code/ryzom/client/src/interface_v3/group_container.cpp index 5a4820c71..6f48f5598 100644 --- a/code/ryzom/client/src/interface_v3/group_container.cpp +++ b/code/ryzom/client/src/interface_v3/group_container.cpp @@ -3289,7 +3289,7 @@ void CGroupContainer::popupCurrentPos() _ParentPos = parent; CInterfaceManager *im = CInterfaceManager::getInstance(); - im->makeWindow(this); + CWidgetManager::getInstance()->makeWindow(this); CWidgetManager::getInstance()->setTopWindow(this); CWidgetManager::getInstance()->clearViewUnders(); CWidgetManager::getInstance()->clearCtrlsUnders(); @@ -3346,7 +3346,7 @@ void CGroupContainer::popin(sint32 insertPos /* = -1 */, bool putBackInFatherCon _MovingInParentList = false; CInterfaceManager *im = CInterfaceManager::getInstance(); - im->unMakeWindow(this); + CWidgetManager::getInstance()->unMakeWindow(this); CWidgetManager::getInstance()->clearViewUnders(); CWidgetManager::getInstance()->clearCtrlsUnders(); _Parent = NULL; diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index b5734ce35..2c8211619 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -124,7 +124,7 @@ bool CGroupInSceneBubbleManager::checkTimeOut(vector &rList) // Time out ? if (rList[i].timeOut ()) { - pIM->unMakeWindow(rList[i].Group); + CWidgetManager::getInstance()->unMakeWindow(rList[i].Group); if (rList[i].Group->getParent()) rList[i].Group->getParent()->delGroup(rList[i].Group); else @@ -155,7 +155,7 @@ void CGroupInSceneBubbleManager::alignMessagePopup (vector &rList, bool { CPopup popup = rList.front(); rList.erase (rList.begin()); - pIM->unMakeWindow(popup.Group); + CWidgetManager::getInstance()->unMakeWindow(popup.Group); if (popup.Group->getParent()) popup.Group->getParent()->delGroup(popup.Group); else @@ -264,7 +264,7 @@ void CGroupInSceneBubbleManager::release () for (i=0; i<_Bubbles.size(); i++) if (_Bubbles[i]) { - pIM->unMakeWindow(_Bubbles[i]); + CWidgetManager::getInstance()->unMakeWindow(_Bubbles[i]); if (_Bubbles[i]->getParent()) { _Bubbles[i]->getParent()->delGroup(_Bubbles[i]); @@ -279,7 +279,7 @@ void CGroupInSceneBubbleManager::release () // Remove messages for (i=0; i<_MessagePopup.size(); i++) { - pIM->unMakeWindow(_MessagePopup[i].Group); + CWidgetManager::getInstance()->unMakeWindow(_MessagePopup[i].Group); if (_MessagePopup[i].Group->getParent()) _MessagePopup[i].Group->getParent()->delGroup(_MessagePopup[i].Group); else @@ -290,7 +290,7 @@ void CGroupInSceneBubbleManager::release () // Remove messages for (i=0; i<_MessagePopupCentered.size(); i++) { - pIM->unMakeWindow(_MessagePopupCentered[i].Group); + CWidgetManager::getInstance()->unMakeWindow(_MessagePopupCentered[i].Group); if (_MessagePopupCentered[i].Group->getParent()) _MessagePopupCentered[i].Group->getParent()->delGroup(_MessagePopupCentered[i].Group); else @@ -301,7 +301,7 @@ void CGroupInSceneBubbleManager::release () // Remove messages for (i=0; i<_BubblePopup.size(); i++) { - pIM->unMakeWindow(_BubblePopup[i].Group); + CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group); if (_BubblePopup[i].Group->getParent()) _BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group); else @@ -344,7 +344,7 @@ void CGroupInSceneBubbleManager::update () // Time out ? if (_BubblePopup[i].timeOut ()) { - pIM->unMakeWindow(_BubblePopup[i].Group); + CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group); if (_BubblePopup[i].Group->getParent()) _BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group); else @@ -369,7 +369,7 @@ void CGroupInSceneBubbleManager::update () (target->getWReal() != _BubblePopup[i].TargetW) || (target->getHReal() != _BubblePopup[i].TargetH)) { - pIM->unMakeWindow(_BubblePopup[i].Group); + CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[i].Group); if (_BubblePopup[i].Group->getParent()) _BubblePopup[i].Group->getParent()->delGroup(_BubblePopup[i].Group); else @@ -397,7 +397,7 @@ void CGroupInSceneBubbleManager::update () { if (_BubblePopup[j].Group == _GroupToDelete[i]) { - pIM->unMakeWindow(_BubblePopup[j].Group); + CWidgetManager::getInstance()->unMakeWindow(_BubblePopup[j].Group); if (_BubblePopup[j].Group->getParent()) _BubblePopup[j].Group->getParent()->delGroup(_BubblePopup[j].Group); else @@ -420,7 +420,7 @@ void CGroupInSceneBubbleManager::update () if (pChar != NULL) pChar->setBubble(NULL); - pIM->unMakeWindow(_DynBubbles[j].Bubble); + CWidgetManager::getInstance()->unMakeWindow(_DynBubbles[j].Bubble); if (_DynBubbles[j].Bubble->getParent()) _DynBubbles[j].Bubble->getParent()->delGroup(_DynBubbles[j].Bubble); else diff --git a/code/ryzom/client/src/interface_v3/interface_group.cpp b/code/ryzom/client/src/interface_v3/interface_group.cpp index fb3ce0052..50002fc9d 100644 --- a/code/ryzom/client/src/interface_v3/interface_group.cpp +++ b/code/ryzom/client/src/interface_v3/interface_group.cpp @@ -14,23 +14,22 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - -#include "stdpch.h" +#include "nel/misc/xml_auto_ptr.h" +#include "nel/misc/stream.h" +#include "nel/gui/lua_manager.h" +#include "nel/gui/lua_ihm.h" +#include "nel/gui/view_renderer.h" #include "interface_group.h" -#include "interface_manager.h" -#include "nel/misc/xml_auto_ptr.h" +#include "interface_link.h" +#include "view_text.h" +#include "ctrl_scroll.h" +#include "widget_manager.h" #include "group_container.h" #include "group_editbox.h" #include "group_scrolltext.h" -#include "nel/gui/lua_ihm.h" #include "lua_ihm_ryzom.h" - -#include "nel/misc/stream.h" -#include "nel/gui/lua_manager.h" - using namespace std; using namespace NL3D; @@ -1112,7 +1111,7 @@ bool CInterfaceGroup::delElement (const std::string &id, bool noWarning) { // If this is a root window if (pIG->getRootWindow () == pIG) - CInterfaceManager::getInstance()->unMakeWindow(pIG, noWarning); + CWidgetManager::getInstance()->unMakeWindow(pIG, noWarning); delGroup (pIG, false); return true; } @@ -1129,7 +1128,7 @@ bool CInterfaceGroup::delElement (CInterfaceElement *pIE, bool noWarning) CInterfaceGroup *pIG= static_cast(pIE); // unmake window if it is if (pIG->getRootWindow () == pIG) - CInterfaceManager::getInstance()->unMakeWindow(pIG, noWarning); + CWidgetManager::getInstance()->unMakeWindow(pIG, noWarning); return delGroup(pIG); } else if(pIE->isCtrl()) diff --git a/code/ryzom/client/src/interface_v3/interface_link.cpp b/code/ryzom/client/src/interface_v3/interface_link.cpp index 2ef066363..1b0ee7619 100644 --- a/code/ryzom/client/src/interface_v3/interface_link.cpp +++ b/code/ryzom/client/src/interface_v3/interface_link.cpp @@ -14,16 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "action_handler.h" -#include "interface_link.h" -#include "interface_group.h" -#include "interface_element.h" -#include "widget_manager.h" #include "nel/gui/interface_expr.h" #include "nel/gui/interface_expr_node.h" #include "nel/gui/reflect.h" #include "nel/gui/db_manager.h" #include "nel/misc/cdb_branch.h" +#include "action_handler.h" +#include "interface_link.h" +#include "interface_element.h" +#include "interface_group.h" +#include "widget_manager.h" using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 63406bcb3..40602c748 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -3504,74 +3504,6 @@ void CInterfaceManager::disableContextHelpForControl(CCtrlBase *pCtrl) disableContextHelp(); } -// ------------------------------------------------------------------------------------------------ -void CInterfaceManager::makeWindow(CInterfaceGroup *group) -{ - if (!group) return; - std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); - uint32 i = 0; - for (i = 0; i < _MasterGroups.size(); ++i) - { - if (_MasterGroups[i].Group == group->getParent()) - break; - } - - if (i == _MasterGroups.size()) - { - string stmp = string("not found master group for window: ")+group->getId(); - nlwarning (stmp.c_str()); - return; - } - else - { - // check if group hasn't been inserted twice. - if (_MasterGroups[i].isWindowPresent(group)) - { - nlwarning("Window inserted twice"); - } - else - { - _MasterGroups[i].addWindow(group,group->getPriority()); - } - } -} - -// ------------------------------------------------------------------------------------------------ -void CInterfaceManager::unMakeWindow(CInterfaceGroup *group, bool noWarning) -{ - if (!group) return; - std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); - uint32 i = 0; - for (i = 0; i < _MasterGroups.size(); ++i) - { - if (_MasterGroups[i].Group == group->getParent()) - break; - } - - if (i == _MasterGroups.size()) - { - if (!noWarning) - { - string stmp = string("not found master group for window: ")+group->getId(); - nlwarning (stmp.c_str()); - } - return; - } - else - { - // check if group hasn't been inserted twice. - if (!_MasterGroups[i].isWindowPresent(group)) - { - if (!noWarning) - nlwarning("Window not inserted in master group"); - } - else - { - _MasterGroups[i].delWindow(group); - } - } -} - // *************************************************************************** void CInterfaceManager::enableMouseHandling(bool handle) { diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 2a67fd038..20644ffd7 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -388,14 +388,6 @@ public: void setContextHelpActive(bool active); - - // Add a group into the windows list of its master goup - void makeWindow(CInterfaceGroup *group); - - // Remove a group from the windows list of its master group - void unMakeWindow(CInterfaceGroup *group, bool noWarning=false); - - bool isMouseOverWindow() const {return _MouseOverWindow;} // Enable mouse Events to interface. if false, release Captures. diff --git a/code/ryzom/client/src/interface_v3/view_base.cpp b/code/ryzom/client/src/interface_v3/view_base.cpp index a8cfb0213..70bf9255c 100644 --- a/code/ryzom/client/src/interface_v3/view_base.cpp +++ b/code/ryzom/client/src/interface_v3/view_base.cpp @@ -14,12 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - -#include "stdpch.h" - #include "view_base.h" -#include "interface_manager.h" +#include "interface_group.h" +#include "widget_manager.h" CViewBase::~CViewBase() { diff --git a/code/ryzom/client/src/interface_v3/widget_manager.cpp b/code/ryzom/client/src/interface_v3/widget_manager.cpp index 740218e8b..1c7da44b2 100644 --- a/code/ryzom/client/src/interface_v3/widget_manager.cpp +++ b/code/ryzom/client/src/interface_v3/widget_manager.cpp @@ -1238,6 +1238,76 @@ void CWidgetManager::notifyElementCaptured(CCtrlBase *c) } } +// ------------------------------------------------------------------------------------------------ +void CWidgetManager::makeWindow(CInterfaceGroup *group) +{ + if(!group) + return; + + uint32 i = 0; + for (i = 0; i < _MasterGroups.size(); ++i) + { + if (_MasterGroups[i].Group == group->getParent()) + break; + } + + if (i == _MasterGroups.size()) + { + std::string stmp = std::string("not found master group for window: ")+group->getId(); + nlwarning (stmp.c_str()); + return; + } + else + { + // check if group hasn't been inserted twice. + if (_MasterGroups[i].isWindowPresent(group)) + { + nlwarning("Window inserted twice"); + } + else + { + _MasterGroups[i].addWindow(group,group->getPriority()); + } + } +} + +// ------------------------------------------------------------------------------------------------ +void CWidgetManager::unMakeWindow(CInterfaceGroup *group, bool noWarning) +{ + if (!group) + return; + + uint32 i = 0; + for (i = 0; i < _MasterGroups.size(); ++i) + { + if (_MasterGroups[i].Group == group->getParent()) + break; + } + + if (i == _MasterGroups.size()) + { + if (!noWarning) + { + std::string stmp = std::string("not found master group for window: ")+group->getId(); + nlwarning (stmp.c_str()); + } + return; + } + else + { + // check if group hasn't been inserted twice. + if (!_MasterGroups[i].isWindowPresent(group)) + { + if (!noWarning) + nlwarning("Window not inserted in master group"); + } + else + { + _MasterGroups[i].delWindow(group); + } + } +} + CWidgetManager::CWidgetManager() { diff --git a/code/ryzom/client/src/interface_v3/widget_manager.h b/code/ryzom/client/src/interface_v3/widget_manager.h index 68fb78a19..ba7cdbf6a 100644 --- a/code/ryzom/client/src/interface_v3/widget_manager.h +++ b/code/ryzom/client/src/interface_v3/widget_manager.h @@ -261,6 +261,12 @@ public: void notifyElementCaptured(CCtrlBase *c); + // Add a group into the windows list of its master goup + void makeWindow( CInterfaceGroup *group ); + + // Remove a group from the windows list of its master group + void unMakeWindow( CInterfaceGroup *group, bool noWarning = false ); + static IParser *parser; private: diff --git a/code/ryzom/client/src/r2/displayer_visual.cpp b/code/ryzom/client/src/r2/displayer_visual.cpp index 3e49d57fa..9eb8c0431 100644 --- a/code/ryzom/client/src/r2/displayer_visual.cpp +++ b/code/ryzom/client/src/r2/displayer_visual.cpp @@ -65,7 +65,7 @@ CDisplayerVisual::~CDisplayerVisual() { if (_IconInScene) { - getEditor().getUI().unMakeWindow(_IconInScene); + CWidgetManager::getInstance()->unMakeWindow(_IconInScene); if (_IconInScene->getParent()) { _IconInScene->getParent()->delGroup(_IconInScene);