From baee35347b87169ad5f08c84590d20e9422dfa31 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 29 Jun 2012 06:15:56 +0200 Subject: [PATCH] CHANGED: #1471 CGroupTable and CGroupCell no longer depend on CInterfaceManager, and a Ryzom game global. --HG-- branch : gui-refactoring --- code/nel/include/nel/gui/widget_manager.h | 1 + .../client/src/interface_v3/group_table.cpp | 20 ++++++------------- .../client/src/interface_v3/group_table.h | 5 ++++- code/ryzom/client/src/main_loop.cpp | 7 ++++--- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 98fae80d6..0083e20c0 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -51,6 +51,7 @@ namespace NLGUI virtual void addLuaClassAssociation( CInterfaceGroup *group, const std::string &luaScript ) = 0; virtual CInterfaceGroup* createGroupInstance( const std::string &templateName, const std::string &parentID, const std::pair< std::string, std::string > *templateParams, uint numParams, bool updateLinks = true ) = 0; virtual CInterfaceGroup* createGroupInstance( const std::string &templateName, const std::string &parentID, std::vector< std::pair< std::string, std::string > > &templateParams, bool updateLinks = true ) = 0; + virtual bool parseGroupChildren( xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload ); }; /// Manages the GUI widgets diff --git a/code/ryzom/client/src/interface_v3/group_table.cpp b/code/ryzom/client/src/interface_v3/group_table.cpp index bdb37b895..4711ed4ca 100644 --- a/code/ryzom/client/src/interface_v3/group_table.cpp +++ b/code/ryzom/client/src/interface_v3/group_table.cpp @@ -15,27 +15,21 @@ // along with this program. If not, see . - -#include "stdpch.h" - #include "group_table.h" -#include "interface_manager.h" +#include "nel/gui/widget_manager.h" #include "nel/gui/interface_element.h" -#include "../client_chat_manager.h" #include "nel/gui/view_bitmap.h" #include "nel/gui/view_text_id.h" #include "nel/gui/group_container.h" - #include "nel/misc/i_xml.h" #include "nel/misc/i18n.h" - #include "nel/misc/xml_auto_ptr.h" using namespace std; using namespace NLMISC; -extern CClientChatManager ChatMngr; -extern bool DebugUICell; + +bool CGroupCell::DebugUICell = false; // ---------------------------------------------------------------------------- CGroupCell::CGroupCell(const TCtorParam ¶m) @@ -91,7 +85,7 @@ bool CGroupCell::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup, uint colum Group->setId(parentGroup->getId() + Group->getId()); setEnclosedGroupDefaultParams(); // parse the children - bool ok = CInterfaceManager::getInstance()->parseGroupChildren(cur, Group, false); + bool ok = CWidgetManager::parser->parseGroupChildren(cur, Group, false); if (!ok) return false; // align ptr = (char*) xmlGetProp( cur, (xmlChar*)"align" ); @@ -191,8 +185,7 @@ bool CGroupCell::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup, uint colum // ---------------------------------------------------------------------------- void CGroupCell::draw () { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if (DebugUICell) + if ( CGroupCell::DebugUICell ) { // Draw cell CViewRenderer &rVR = *CViewRenderer::getInstance(); @@ -791,7 +784,7 @@ void CGroupTable::checkCoords () } else { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); + CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft(); if (pCB != NULL) { @@ -944,7 +937,6 @@ void CGroupTable::draw () sint32 border = Border + CellSpacing + CellPadding; if (border) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); CRGBA finalColor; finalColor.modulateFromColor (BgColor, CWidgetManager::getInstance()->getGlobalColor()); finalColor.A = CurrentAlpha; diff --git a/code/ryzom/client/src/interface_v3/group_table.h b/code/ryzom/client/src/interface_v3/group_table.h index ba14e7039..77c3e507c 100644 --- a/code/ryzom/client/src/interface_v3/group_table.h +++ b/code/ryzom/client/src/interface_v3/group_table.h @@ -22,7 +22,6 @@ #include "nel/misc/types_nl.h" #include "nel/gui/group_frame.h" #include "nel/gui/view_text.h" -#include "view_link.h" #include "nel/gui/ctrl_button.h" /** @@ -101,8 +100,12 @@ public: void setTextureTile(bool tiled); void setTextureScale(bool scaled); + static void setDebugUICell( bool d ){ DebugUICell = d; } + static bool getDebugUICell(){ return DebugUICell; } + private: void setEnclosedGroupDefaultParams(); + static bool DebugUICell; }; /** diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 61dda28bd..1300de86d 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -146,6 +146,7 @@ #include "string_manager_client.h" #include "nel/gui/lua_manager.h" +#include "interface_v3/group_table.h" /////////// @@ -317,7 +318,6 @@ uint32 OldWidth; // Last Width of the window. uint32 OldHeight; // Last Height of the window. bool ShowInterface = true; // Do the Chat OSD have to be displayed. -bool DebugUICell = false; bool DebugUIView = false; bool DebugUICtrl = false; bool DebugUIGroup = false; @@ -4394,7 +4394,8 @@ NLMISC_COMMAND(debugUI, "Debug the ui : show/hide quads of bboxs and hotspots", else fromString(args[0], on); } - DebugUICell = on; + + CGroupCell::setDebugUICell( on ); DebugUIView = on; DebugUICtrl = on; DebugUIGroup = on; @@ -4426,7 +4427,7 @@ NLMISC_COMMAND(debugUIGroup, "Debug the ui : show/hide quads of bboxs and hotspo // show hide the debuging of cells NLMISC_COMMAND(debugUICell, "Debug the ui : show/hide quads of bboxs for cells", "") { - DebugUICell = !DebugUICell; + CGroupCell::setDebugUICell( !CGroupCell::getDebugUICell() ) return true; }