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 3e5137810b
commit 99b8ee5758
4 changed files with 22 additions and 45 deletions

View file

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

View file

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

View file

@ -130,6 +130,8 @@ using namespace NLGUI;
#include "parser_modules.h"
#include "../global.h"
using namespace NLMISC;
namespace NLGUI
@ -433,8 +435,15 @@ namespace
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->setSetupOptionsCallback( this );
@ -450,10 +459,8 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
parser->setCacheUIParsing( ClientCfg.CacheUIParsing );
CWidgetManager::parser = parser;
this->driver = driver;
this->textcontext = textcontext;
CViewRenderer::setDriver( driver );
CViewRenderer::setTextContext( textcontext );
CViewRenderer::setDriver( Driver );
CViewRenderer::setTextContext( TextContext );
CViewRenderer::hwCursorScale = ClientCfg.HardwareCursorScale;
CViewRenderer::hwCursors = &ClientCfg.HardwareCursors;
CViewRenderer::getInstance();
@ -464,7 +471,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
CGroupHTML::options.appName = "Ryzom";
CGroupHTML::options.appVersion = RYZOM_VERSION;
_Instance = this;
NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS );
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
_ScreenW = _ScreenH = 0;
@ -527,7 +533,7 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_DebugTrackGroupCreateCount = 0;
_DebugTrackGroupDestroyCount = 0;
#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 ()
{
@ -1535,7 +1535,7 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera)
drawViews(camera);
// 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
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);
// Continue to parse the rest of the interface
}
@ -3138,9 +3137,9 @@ bool CInterfaceManager::CEmoteCmd::execute(const std::string &/* rawCommandStrin
bool CInterfaceManager::testDragCopyKey()
{
// hardcoded for now
return driver->AsyncListener.isKeyDown(KeyCONTROL) ||
driver->AsyncListener.isKeyDown(KeyLCONTROL) ||
driver->AsyncListener.isKeyDown(KeyRCONTROL);
return Driver->AsyncListener.isKeyDown(KeyCONTROL) ||
Driver->AsyncListener.isKeyDown(KeyLCONTROL) ||
Driver->AsyncListener.isKeyDown(KeyRCONTROL);
}
// ***************************************************************************
@ -3976,10 +3975,4 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
return true;;
}
void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext )
{
this->textcontext = textcontext;
CViewRenderer::getInstance()->setTextContext( textcontext );
}

View file

@ -119,14 +119,7 @@ public:
public:
/// Singleton method : Get the unique interface loader instance
static CInterfaceManager* getInstance()
{
nlassert( _Instance != NULL );
return _Instance;
}
/// Create singleton
static void create( NL3D::UDriver *driver, NL3D::UTextContext *textcontext );
static CInterfaceManager* getInstance();
/// Destroy singleton
static void destroy ();
@ -428,12 +421,6 @@ public:
*/
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:
@ -582,7 +569,7 @@ private:
/// Constructor
CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext );
CInterfaceManager();
///the singleton's 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
void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode);
NL3D::UDriver *driver;
NL3D::UTextContext *textcontext;
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;
NLGUI::CInterfaceParser *parser;