From 8437a0319d2b00098a1661c813d7593a05a10f6d Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 6 Jun 2012 05:48:51 +0200 Subject: [PATCH] CHANGED: #1471 CInterfaceGroup no longer depends on CGroupContainer. --HG-- branch : gui-refactoring --- code/ryzom/client/src/interface_v3/chat_window.cpp | 3 ++- code/ryzom/client/src/interface_v3/group_editbox.cpp | 3 ++- code/ryzom/client/src/interface_v3/group_map.cpp | 3 ++- .../client/src/interface_v3/interface_group.cpp | 12 +++++++----- code/ryzom/client/src/interface_v3/interface_group.h | 4 +--- .../client/src/interface_v3/people_interraction.cpp | 3 ++- code/ryzom/client/src/interface_v3/people_list.cpp | 5 +++-- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index c7d16f60b..3351e59ff 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -1319,7 +1319,8 @@ public: } // Clear input string pEB->setInputString (ucstring("")); - CGroupContainer *gc = pEB->getEnclosingContainer(); + CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() ); + if (gc) { // Restore position of enclosing container if it hasn't been moved/scaled/poped by the user diff --git a/code/ryzom/client/src/interface_v3/group_editbox.cpp b/code/ryzom/client/src/interface_v3/group_editbox.cpp index d7be6bb33..de6f83e3a 100644 --- a/code/ryzom/client/src/interface_v3/group_editbox.cpp +++ b/code/ryzom/client/src/interface_v3/group_editbox.cpp @@ -1071,7 +1071,8 @@ void CGroupEditBox::updateCoords() if (_BackupFatherContainerPos) { - CGroupContainer *gc = getEnclosingContainer(); + CGroupContainer *gc = static_cast< CGroupContainer* >( getEnclosingContainer() ); + if (gc && !gc->getTouchFlag(true)) { diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 1ff4c3023..f6653d8ab 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -858,7 +858,8 @@ void CGroupMap::updateCoords() { updateSelectionAxisSize(); // - CGroupContainer *enclosingContainer = getEnclosingContainer(); + CGroupContainer *enclosingContainer = static_cast< CGroupContainer* >( getEnclosingContainer() ); + if (!enclosingContainer || !enclosingContainer->getActive()) return; // update position of landmarks updateScale(); diff --git a/code/ryzom/client/src/interface_v3/interface_group.cpp b/code/ryzom/client/src/interface_v3/interface_group.cpp index ebab56ed8..ba59626ed 100644 --- a/code/ryzom/client/src/interface_v3/interface_group.cpp +++ b/code/ryzom/client/src/interface_v3/interface_group.cpp @@ -22,9 +22,9 @@ #include "interface_group.h" #include "interface_link.h" -#include "ctrl_scroll.h" #include "widget_manager.h" -#include "group_container.h" + +#include "ctrl_scroll.h" #include "group_editbox.h" #include "group_scrolltext.h" #include "lua_ihm_ryzom.h" @@ -1539,15 +1539,17 @@ void CInterfaceGroup::setRightClickHandler(const std::string &handler) } // ------------------------------------------------------------------------------------------------ -CGroupContainer *CInterfaceGroup::getEnclosingContainer() +CInterfaceGroup* CInterfaceGroup::getEnclosingContainer() { CInterfaceGroup *ig = this; do { - if (ig->isGroupContainer()) return static_cast(ig); + if( ig->isGroupContainer() ) + return ig; ig = ig->getParent(); } - while(ig); + while( ig != NULL ); + return NULL; } diff --git a/code/ryzom/client/src/interface_v3/interface_group.h b/code/ryzom/client/src/interface_v3/interface_group.h index 892fa0203..d2a93f49c 100644 --- a/code/ryzom/client/src/interface_v3/interface_group.h +++ b/code/ryzom/client/src/interface_v3/interface_group.h @@ -22,8 +22,6 @@ #include "ctrl_base.h" #include "action_handler.h" -class CGroupContainer; - // ---------------------------------------------------------------------------- class CInterfaceGroup : public CCtrlBase { @@ -251,7 +249,7 @@ public: // quick way to know if the group is a CGroupContainer bool isGroupContainer() const { return _IsGroupContainer; } - CGroupContainer *getEnclosingContainer(); + CInterfaceGroup* getEnclosingContainer(); sint getInsertionOrder(CViewBase *vb) const; diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index ffd8572e4..668c5f977 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2189,7 +2189,8 @@ class CHandlerTellContact : public IActionHandler if (!pCaller) return; CInterfaceGroup *ig = pCaller->getParent(); if (!ig) return; - CGroupContainer *gc = ig->getEnclosingContainer(); + CGroupContainer *gc = static_cast< CGroupContainer* >( ig->getEnclosingContainer() ); + if (!gc) return; CPeopleList *list; uint peopleIndex; diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 1b904bbeb..5c4821e72 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -572,7 +572,7 @@ void CPeopleList::reset() removeAllPeoples(); _BaseContainer->setContent(NULL); - CGroupContainer *father = dynamic_cast(_BaseContainer->getParent()->getEnclosingContainer()); + CGroupContainer *father = static_cast(_BaseContainer->getParent()->getEnclosingContainer()); if (father) { father->delGroup(_BaseContainer); @@ -894,7 +894,8 @@ class CHandlerContactEntry : public IActionHandler // Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now // it is simpler to keep it as it and to just use this action handler to manage user input. if (!pCaller || !pCaller->getParent()) return; - CGroupContainer *gc = pCaller->getParent()->getEnclosingContainer(); + CGroupContainer *gc = static_cast< CGroupContainer* >( pCaller->getParent()->getEnclosingContainer() ); + // title gives the name of the player ucstring playerName = gc->getUCTitle();