CHANGED: #1471 no need to go thru CInterfaceManager, when CViewRenderer has it's own Singleton.

This commit is contained in:
dfighter1985 2012-07-12 23:04:36 +02:00
parent c3913f319a
commit f5433fb361
4 changed files with 22 additions and 45 deletions

View file

@ -83,7 +83,7 @@ void resetTextContext (const char *font, bool resetInterfaceManager)
if (resetInterfaceManager) if (resetInterfaceManager)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->setTextContext( TextContext ); CViewRenderer::setTextContext( TextContext );
im->resetTextIndex(); im->resetTextIndex();
} }
} }

View file

@ -1084,8 +1084,7 @@ void prelogInit()
resetTextContext ("ryzom.ttf", false); resetTextContext ("ryzom.ttf", false);
CWidgetManager::getInstance(); CInterfaceManager::getInstance();
CInterfaceManager::create( Driver, TextContext );
// Yoyo: initialize NOW the InputHandler for Event filtering. // Yoyo: initialize NOW the InputHandler for Event filtering.
CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance(); CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance();

View file

@ -130,6 +130,8 @@ using namespace NLGUI;
#include "parser_modules.h" #include "parser_modules.h"
#include "../global.h"
using namespace NLMISC; using namespace NLMISC;
namespace NLGUI namespace NLGUI
@ -433,8 +435,15 @@ namespace
CRyzomTextFormatter RyzomTextFormatter; CRyzomTextFormatter RyzomTextFormatter;
} }
CInterfaceManager* CInterfaceManager::getInstance()
{
if( _Instance == NULL )
_Instance = new CInterfaceManager();
return _Instance;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) CInterfaceManager::CInterfaceManager()
{ {
parser = new CInterfaceParser(); parser = new CInterfaceParser();
parser->setSetupOptionsCallback( this ); parser->setSetupOptionsCallback( this );
@ -450,10 +459,8 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
parser->setCacheUIParsing( ClientCfg.CacheUIParsing ); parser->setCacheUIParsing( ClientCfg.CacheUIParsing );
CWidgetManager::parser = parser; CWidgetManager::parser = parser;
this->driver = driver; CViewRenderer::setDriver( Driver );
this->textcontext = textcontext; CViewRenderer::setTextContext( TextContext );
CViewRenderer::setDriver( driver );
CViewRenderer::setTextContext( textcontext );
CViewRenderer::hwCursorScale = ClientCfg.HardwareCursorScale; CViewRenderer::hwCursorScale = ClientCfg.HardwareCursorScale;
CViewRenderer::hwCursors = &ClientCfg.HardwareCursors; CViewRenderer::hwCursors = &ClientCfg.HardwareCursors;
CViewRenderer::getInstance(); CViewRenderer::getInstance();
@ -464,7 +471,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
CGroupHTML::options.appName = "Ryzom"; CGroupHTML::options.appName = "Ryzom";
CGroupHTML::options.appVersion = RYZOM_VERSION; CGroupHTML::options.appVersion = RYZOM_VERSION;
_Instance = this;
NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS ); NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS );
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater(); interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
_ScreenW = _ScreenH = 0; _ScreenW = _ScreenH = 0;
@ -527,7 +533,7 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_DebugTrackGroupCreateCount = 0; _DebugTrackGroupCreateCount = 0;
_DebugTrackGroupDestroyCount = 0; _DebugTrackGroupDestroyCount = 0;
#endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS #endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS
textcontext = NULL;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -605,12 +611,6 @@ void CInterfaceManager::resetShardSpecificData()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::create( NL3D::UDriver *driver, NL3D::UTextContext *textcontext )
{
nlassert( _Instance == NULL );
new CInterfaceManager( driver, textcontext );
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::destroy () void CInterfaceManager::destroy ()
{ {
@ -1535,7 +1535,7 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera)
drawViews(camera); drawViews(camera);
// The interface manager may change usual Global setup. reset them. // The interface manager may change usual Global setup. reset them.
textcontext->setShadeColor(CRGBA::Black); CViewRenderer::getTextContext()->setShadeColor(CRGBA::Black);
} }
@ -1547,8 +1547,7 @@ void CInterfaceManager::setupOptions()
// Try to change font if any // Try to change font if any
string sFont = wm->getSystemOption( CWidgetManager::OptionFont ).getValStr(); string sFont = wm->getSystemOption( CWidgetManager::OptionFont ).getValStr();
extern void resetTextContext( const char*, bool ); if ((!sFont.empty()) && (Driver != NULL))
if ((!sFont.empty()) && (driver != NULL))
resetTextContext(sFont.c_str(), true); resetTextContext(sFont.c_str(), true);
// Continue to parse the rest of the interface // Continue to parse the rest of the interface
} }
@ -3138,9 +3137,9 @@ bool CInterfaceManager::CEmoteCmd::execute(const std::string &/* rawCommandStrin
bool CInterfaceManager::testDragCopyKey() bool CInterfaceManager::testDragCopyKey()
{ {
// hardcoded for now // hardcoded for now
return driver->AsyncListener.isKeyDown(KeyCONTROL) || return Driver->AsyncListener.isKeyDown(KeyCONTROL) ||
driver->AsyncListener.isKeyDown(KeyLCONTROL) || Driver->AsyncListener.isKeyDown(KeyLCONTROL) ||
driver->AsyncListener.isKeyDown(KeyRCONTROL); Driver->AsyncListener.isKeyDown(KeyRCONTROL);
} }
// *************************************************************************** // ***************************************************************************
@ -3976,10 +3975,4 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
return true;; return true;;
} }
void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext )
{
this->textcontext = textcontext;
CViewRenderer::getInstance()->setTextContext( textcontext );
}

View file

@ -119,14 +119,7 @@ public:
public: public:
/// Singleton method : Get the unique interface loader instance /// Singleton method : Get the unique interface loader instance
static CInterfaceManager* getInstance() static CInterfaceManager* getInstance();
{
nlassert( _Instance != NULL );
return _Instance;
}
/// Create singleton
static void create( NL3D::UDriver *driver, NL3D::UTextContext *textcontext );
/// Destroy singleton /// Destroy singleton
static void destroy (); static void destroy ();
@ -428,12 +421,6 @@ public:
*/ */
static bool parseTokens(ucstring& ucstr); static bool parseTokens(ucstring& ucstr);
/// Sets the current TextContext.
void setTextContext( NL3D::UTextContext *textcontext );
/// Retrueves the current TextContext
inline NL3D::UTextContext* getTextContext() const{ return textcontext; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
private: private:
@ -582,7 +569,7 @@ private:
/// Constructor /// Constructor
CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ); CInterfaceManager();
///the singleton's instance ///the singleton's instance
static CInterfaceManager* _Instance; static CInterfaceManager* _Instance;
@ -655,8 +642,6 @@ private:
// Pop a new message box. If the message box was found, returns a pointer on it // Pop a new message box. If the message box was found, returns a pointer on it
void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode); void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode);
NL3D::UDriver *driver;
NL3D::UTextContext *textcontext;
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater; CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;
NLGUI::CInterfaceParser *parser; NLGUI::CInterfaceParser *parser;