mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 00:18:43 +00:00
CHANGED: #1471 Moved some more GUI code from CInterfaceManager to CWidgetManager.
This commit is contained in:
parent
6506989e14
commit
b2ee4d275c
12 changed files with 165 additions and 151 deletions
|
@ -160,7 +160,7 @@ namespace NLGUI
|
||||||
|
|
||||||
/// \name Parameter variable
|
/// \name Parameter variable
|
||||||
// @{
|
// @{
|
||||||
const std::string &getDefine(const std::string &id) const;
|
const std::string& getDefine(const std::string &id) const;
|
||||||
bool isDefineExist(const std::string &id) const;
|
bool isDefineExist(const std::string &id) const;
|
||||||
void setDefine(const std::string &id, const std::string &value);
|
void setDefine(const std::string &id, const std::string &value);
|
||||||
// @}
|
// @}
|
||||||
|
@ -228,6 +228,8 @@ namespace NLGUI
|
||||||
|
|
||||||
void setCacheUIParsing( bool b ){ cacheUIParsing = b; }
|
void setCacheUIParsing( bool b ){ cacheUIParsing = b; }
|
||||||
|
|
||||||
|
CInterfaceAnim* getAnim( const std::string &name ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace NLGUI
|
||||||
class CInterfaceGroup;
|
class CInterfaceGroup;
|
||||||
class CViewPointerBase;
|
class CViewPointerBase;
|
||||||
class CInterfaceOptions;
|
class CInterfaceOptions;
|
||||||
|
class CInterfaceAnim;
|
||||||
|
|
||||||
class IParser
|
class IParser
|
||||||
{
|
{
|
||||||
|
@ -56,6 +57,8 @@ namespace NLGUI
|
||||||
virtual bool parseGroupChildren( xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload ) = 0;
|
virtual bool parseGroupChildren( xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload ) = 0;
|
||||||
virtual uint getProcedureNumActions( const std::string &procName ) const = 0;
|
virtual uint getProcedureNumActions( const std::string &procName ) const = 0;
|
||||||
virtual bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string ¶ms ) const = 0;
|
virtual bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string ¶ms ) const = 0;
|
||||||
|
virtual const std::string& getDefine(const std::string &id) const = 0;
|
||||||
|
virtual CInterfaceAnim* getAnim( const std::string &name ) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Manages the GUI widgets
|
/// Manages the GUI widgets
|
||||||
|
@ -164,6 +167,14 @@ namespace NLGUI
|
||||||
CInterfaceElement* getElementFromId( const std::string &sEltId );
|
CInterfaceElement* getElementFromId( const std::string &sEltId );
|
||||||
CInterfaceElement* getElementFromId( const std::string &sStart, const std::string &sEltId );
|
CInterfaceElement* getElementFromId( const std::string &sStart, const std::string &sEltId );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a window from its Id of its group.
|
||||||
|
* NB: "ctrl_launch_modal" is a special Id which return the last ctrl which has launch a modal. NULL if modal closed.
|
||||||
|
* \param groupId : the Id of the window group
|
||||||
|
*/
|
||||||
|
/// get an element from a define ID. shortcut for getElementFromId(getDefine(define))
|
||||||
|
CInterfaceElement* getElementFromDefine( const std::string &defineId );
|
||||||
|
|
||||||
/// Get the window from an element (ui:interface:###)
|
/// Get the window from an element (ui:interface:###)
|
||||||
CInterfaceGroup* getWindow(CInterfaceElement*);
|
CInterfaceGroup* getWindow(CInterfaceElement*);
|
||||||
|
|
||||||
|
@ -216,6 +227,9 @@ namespace NLGUI
|
||||||
void popModalWindow();
|
void popModalWindow();
|
||||||
// pop all top modal windows with the given category (a string stored in the modal)
|
// pop all top modal windows with the given category (a string stored in the modal)
|
||||||
void popModalWindowCategory(const std::string &category);
|
void popModalWindowCategory(const std::string &category);
|
||||||
|
|
||||||
|
void hideAllWindows();
|
||||||
|
void hideAllNonSavableWindows();
|
||||||
|
|
||||||
CCtrlBase *getCtrlLaunchingModal ()
|
CCtrlBase *getCtrlLaunchingModal ()
|
||||||
{
|
{
|
||||||
|
@ -455,6 +469,11 @@ namespace NLGUI
|
||||||
|
|
||||||
void registerOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler* handler );
|
void registerOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler* handler );
|
||||||
void removeOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler *handler );
|
void removeOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler *handler );
|
||||||
|
|
||||||
|
void startAnim( const std::string &animId );
|
||||||
|
void stopAnim( const std::string &animId );
|
||||||
|
void updateAnims();
|
||||||
|
void removeFinishedAnims();
|
||||||
|
|
||||||
static IParser *parser;
|
static IParser *parser;
|
||||||
|
|
||||||
|
@ -525,6 +544,8 @@ namespace NLGUI
|
||||||
|
|
||||||
uint32 screenH;
|
uint32 screenH;
|
||||||
uint32 screenW;
|
uint32 screenW;
|
||||||
|
|
||||||
|
std::vector< CInterfaceAnim* > activeAnims;
|
||||||
|
|
||||||
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
|
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
|
||||||
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
|
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
|
||||||
|
|
|
@ -2652,6 +2652,18 @@ namespace NLGUI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CInterfaceAnim* CInterfaceParser::getAnim( const std::string &name) const
|
||||||
|
{
|
||||||
|
TAnimMap::const_iterator it = _AnimMap.find( name );
|
||||||
|
if( it == _AnimMap.end() )
|
||||||
|
{
|
||||||
|
nlwarning( "anim %s not found", name.c_str() );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CInterfaceParser::parseStyle(xmlNodePtr cur)
|
bool CInterfaceParser::parseStyle(xmlNodePtr cur)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "nel/gui/view_text.h"
|
#include "nel/gui/view_text.h"
|
||||||
#include "nel/gui/view_bitmap.h"
|
#include "nel/gui/view_bitmap.h"
|
||||||
#include "nel/gui/group_container.h"
|
#include "nel/gui/group_container.h"
|
||||||
|
#include "nel/gui/interface_anim.h"
|
||||||
#include "nel/misc/events.h"
|
#include "nel/misc/events.h"
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
|
@ -453,6 +454,12 @@ namespace NLGUI
|
||||||
return pIEL;
|
return pIEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
CInterfaceElement* CWidgetManager::getElementFromDefine( const std::string &defineId )
|
||||||
|
{
|
||||||
|
return getElementFromId( parser->getDefine( defineId ) );
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CWidgetManager::setTopWindow (CInterfaceGroup* win)
|
void CWidgetManager::setTopWindow (CInterfaceGroup* win)
|
||||||
{
|
{
|
||||||
|
@ -728,6 +735,56 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CWidgetManager::hideAllWindows()
|
||||||
|
{
|
||||||
|
for (uint nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
||||||
|
{
|
||||||
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
||||||
|
if (rMG.Group->getActive())
|
||||||
|
{
|
||||||
|
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
||||||
|
{
|
||||||
|
std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
|
||||||
|
std::list<CInterfaceGroup*>::const_iterator itw;
|
||||||
|
for (itw = rList.begin(); itw!= rList.end();)
|
||||||
|
{
|
||||||
|
CInterfaceGroup *pIG = *itw;
|
||||||
|
itw++; // since setActive invalidate the iterator, be sure we move to the next one before
|
||||||
|
pIG->setActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CWidgetManager::hideAllNonSavableWindows()
|
||||||
|
{
|
||||||
|
for (uint nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
||||||
|
{
|
||||||
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
||||||
|
if (rMG.Group->getActive())
|
||||||
|
{
|
||||||
|
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
||||||
|
{
|
||||||
|
std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
|
||||||
|
std::list<CInterfaceGroup*>::const_iterator itw;
|
||||||
|
for (itw = rList.begin(); itw!= rList.end();)
|
||||||
|
{
|
||||||
|
CInterfaceGroup *pIG = *itw;
|
||||||
|
CGroupContainer *cont = dynamic_cast<CGroupContainer *>(pIG);
|
||||||
|
itw++; // since setActive invalidate the iterator, be sure we move to the next one before
|
||||||
|
if (!cont || !cont->isSavable())
|
||||||
|
{
|
||||||
|
pIG->setActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
CInterfaceGroup* CWidgetManager::getWindowUnder (sint32 x, sint32 y)
|
CInterfaceGroup* CWidgetManager::getWindowUnder (sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
|
@ -977,6 +1034,8 @@ namespace NLGUI
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
|
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
_AlphaRolloverSpeedDB = NULL;
|
||||||
|
|
||||||
|
activeAnims.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2005,6 +2064,11 @@ namespace NLGUI
|
||||||
|
|
||||||
bool CWidgetManager::handleEvent( const CEventDescriptor &evnt )
|
bool CWidgetManager::handleEvent( const CEventDescriptor &evnt )
|
||||||
{
|
{
|
||||||
|
// Check if we can receive events (no anims!)
|
||||||
|
for( uint32 i = 0; i < activeAnims.size(); ++i )
|
||||||
|
if( activeAnims[i]->isDisableButtons() )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( evnt.getType() == CEventDescriptor::system )
|
if( evnt.getType() == CEventDescriptor::system )
|
||||||
{
|
{
|
||||||
const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt );
|
const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt );
|
||||||
|
@ -2916,6 +2980,54 @@ namespace NLGUI
|
||||||
onWidgetsDrawnHandlers.erase( itr );
|
onWidgetsDrawnHandlers.erase( itr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void CWidgetManager::startAnim( const std::string &animId )
|
||||||
|
{
|
||||||
|
CInterfaceAnim *pIT = parser->getAnim( animId );
|
||||||
|
if( pIT == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
stopAnim( animId );
|
||||||
|
pIT->start();
|
||||||
|
activeAnims.push_back( pIT );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWidgetManager::removeFinishedAnims()
|
||||||
|
{
|
||||||
|
sint32 i = 0;
|
||||||
|
for( i = 0; i < (sint32)activeAnims.size(); ++i )
|
||||||
|
{
|
||||||
|
CInterfaceAnim *pIA = activeAnims[i];
|
||||||
|
if (pIA->isFinished())
|
||||||
|
{
|
||||||
|
activeAnims.erase( activeAnims.begin() + i );
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void CWidgetManager::stopAnim( const std::string &animId )
|
||||||
|
{
|
||||||
|
CInterfaceAnim *pIT = parser->getAnim( animId );
|
||||||
|
|
||||||
|
for( uint i = 0; i < activeAnims.size(); ++i )
|
||||||
|
if( activeAnims[ i ] == pIT )
|
||||||
|
{
|
||||||
|
activeAnims.erase( activeAnims.begin() + i );
|
||||||
|
if( !pIT->isFinished() )
|
||||||
|
pIT->stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWidgetManager::updateAnims()
|
||||||
|
{
|
||||||
|
std::vector< CInterfaceAnim* >::iterator itr;
|
||||||
|
for( itr = activeAnims.begin(); itr != activeAnims.end(); ++itr )
|
||||||
|
(*itr)->update();
|
||||||
|
}
|
||||||
|
|
||||||
CWidgetManager::CWidgetManager()
|
CWidgetManager::CWidgetManager()
|
||||||
{
|
{
|
||||||
_Pointer = NULL;
|
_Pointer = NULL;
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ void CFarTP::sendReady()
|
||||||
{
|
{
|
||||||
// Remove all existing keys and load them back, and load new interface config
|
// Remove all existing keys and load them back, and load new interface config
|
||||||
pIM->loadKeys();
|
pIM->loadKeys();
|
||||||
pIM->hideAllWindows();
|
CWidgetManager::getInstance()->hideAllWindows();
|
||||||
pIM->loadInterfaceConfig();
|
pIM->loadInterfaceConfig();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2971,7 +2971,7 @@ public:
|
||||||
|
|
||||||
// **** Init Screen Aspect Ratio
|
// **** Init Screen Aspect Ratio
|
||||||
// Init the combo box, according to the value
|
// Init the combo box, according to the value
|
||||||
pCB= dynamic_cast<CDBGroupComboBox*>(pIM->getElementFromDefine( "game_config_screen_ratio_cb" ));
|
pCB= dynamic_cast<CDBGroupComboBox*>( CWidgetManager::getInstance()->getElementFromDefine( "game_config_screen_ratio_cb" ));
|
||||||
if(pCB)
|
if(pCB)
|
||||||
{
|
{
|
||||||
// Bkup for cancel
|
// Bkup for cancel
|
||||||
|
@ -3376,7 +3376,7 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler
|
||||||
ClientCfg.writeDouble("ScreenAspectRatio", ClientCfg.ScreenAspectRatio);
|
ClientCfg.writeDouble("ScreenAspectRatio", ClientCfg.ScreenAspectRatio);
|
||||||
|
|
||||||
// set content, and freeze the edit box
|
// set content, and freeze the edit box
|
||||||
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>(pIM->getElementFromDefine("game_config_screen_ratio_eb"));
|
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromDefine("game_config_screen_ratio_eb"));
|
||||||
if(eb)
|
if(eb)
|
||||||
{
|
{
|
||||||
eb->setFrozen(true);
|
eb->setFrozen(true);
|
||||||
|
@ -3387,7 +3387,7 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// just unfreeze the edit box, and set correct value
|
// just unfreeze the edit box, and set correct value
|
||||||
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>(pIM->getElementFromDefine("game_config_screen_ratio_eb"));
|
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromDefine("game_config_screen_ratio_eb"));
|
||||||
if(eb)
|
if(eb)
|
||||||
{
|
{
|
||||||
eb->setFrozen(false);
|
eb->setFrozen(false);
|
||||||
|
@ -3420,7 +3420,7 @@ class CHandlerGameConfigChangeScreenRatioCustom : public IActionHandler
|
||||||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
||||||
sint mode= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:SCREEN_RATIO_MODE")->getValue32();
|
sint mode= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:SCREEN_RATIO_MODE")->getValue32();
|
||||||
if (mode != 2) return;
|
if (mode != 2) return;
|
||||||
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>(pIM->getElementFromDefine("game_config_screen_ratio_eb"));
|
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromDefine("game_config_screen_ratio_eb"));
|
||||||
if(eb)
|
if(eb)
|
||||||
{
|
{
|
||||||
// validate the value
|
// validate the value
|
||||||
|
|
|
@ -930,9 +930,8 @@ class CAHAnimStart : public IActionHandler
|
||||||
public:
|
public:
|
||||||
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
|
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
string sAnim = getParam(Params, "anim");
|
string sAnim = getParam(Params, "anim");
|
||||||
pIM->startAnim(sAnim);
|
CWidgetManager::getInstance()->startAnim(sAnim);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
REGISTER_ACTION_HANDLER (CAHAnimStart, "anim_start");
|
REGISTER_ACTION_HANDLER (CAHAnimStart, "anim_start");
|
||||||
|
@ -943,9 +942,8 @@ class CAHAnimStop : public IActionHandler
|
||||||
public:
|
public:
|
||||||
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
|
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
string sAnim = getParam(Params, "anim");
|
string sAnim = getParam(Params, "anim");
|
||||||
pIM->stopAnim(sAnim);
|
CWidgetManager::getInstance()->stopAnim(sAnim);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
REGISTER_ACTION_HANDLER (CAHAnimStop, "anim_stop");
|
REGISTER_ACTION_HANDLER (CAHAnimStop, "anim_stop");
|
||||||
|
|
|
@ -562,7 +562,6 @@ void CInterfaceManager::reset()
|
||||||
CViewRenderer::getInstance()->reset();
|
CViewRenderer::getInstance()->reset();
|
||||||
CWidgetManager::getInstance()->reset();
|
CWidgetManager::getInstance()->reset();
|
||||||
|
|
||||||
_ActiveAnims.clear();
|
|
||||||
for (uint32 i = 0; i < _IDStringWaiters.size(); ++i)
|
for (uint32 i = 0; i < _IDStringWaiters.size(); ++i)
|
||||||
delete _IDStringWaiters[i];
|
delete _IDStringWaiters[i];
|
||||||
_IDStringWaiters.clear();
|
_IDStringWaiters.clear();
|
||||||
|
@ -1424,25 +1423,13 @@ void CInterfaceManager::updateFrameEvents()
|
||||||
// Handle anims done in 2 times because some AH can add or remove anims
|
// Handle anims done in 2 times because some AH can add or remove anims
|
||||||
// First ensure we are working on a safe vector and update all anims
|
// First ensure we are working on a safe vector and update all anims
|
||||||
sint i;
|
sint i;
|
||||||
vector<CInterfaceAnim*> vTmp = _ActiveAnims;
|
CWidgetManager::getInstance()->updateAnims();
|
||||||
for (i = 0; i < (sint)vTmp.size(); ++i)
|
|
||||||
{
|
|
||||||
CInterfaceAnim *pIA = vTmp[i];
|
|
||||||
pIA->update();
|
|
||||||
}
|
|
||||||
IngameDbMngr.flushObserverCalls();
|
IngameDbMngr.flushObserverCalls();
|
||||||
NLGUI::CDBManager::getInstance()->flushObserverCalls();
|
NLGUI::CDBManager::getInstance()->flushObserverCalls();
|
||||||
//
|
|
||||||
// Next : Test if we have to remove anims
|
CWidgetManager::getInstance()->removeFinishedAnims();
|
||||||
for (i = 0; i < (sint)_ActiveAnims.size(); ++i)
|
|
||||||
{
|
|
||||||
CInterfaceAnim *pIA = _ActiveAnims[i];
|
|
||||||
if (pIA->isFinished())
|
|
||||||
{
|
|
||||||
_ActiveAnims.erase (_ActiveAnims.begin()+i);
|
|
||||||
--i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
IngameDbMngr.flushObserverCalls();
|
IngameDbMngr.flushObserverCalls();
|
||||||
NLGUI::CDBManager::getInstance()->flushObserverCalls();
|
NLGUI::CDBManager::getInstance()->flushObserverCalls();
|
||||||
|
@ -1978,11 +1965,6 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
{
|
{
|
||||||
// Check if we can receive events (no anims!)
|
|
||||||
for (uint i = 0; i < _ActiveAnims.size(); ++i)
|
|
||||||
if (_ActiveAnims[i]->isDisableButtons())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
handled = CWidgetManager::getInstance()->handleEvent( event );
|
handled = CWidgetManager::getInstance()->handleEvent( event );
|
||||||
|
@ -2141,12 +2123,6 @@ void CInterfaceManager::processServerIDString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
CInterfaceElement* CInterfaceManager::getElementFromDefine (const std::string &defineId)
|
|
||||||
{
|
|
||||||
return CWidgetManager::getInstance()->getElementFromId(getDefine(defineId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CInterfaceManager::runProcedure (const string &procName, CCtrlBase *pCaller,
|
void CInterfaceManager::runProcedure (const string &procName, CCtrlBase *pCaller,
|
||||||
const vector<string> ¶mList)
|
const vector<string> ¶mList)
|
||||||
|
@ -2209,42 +2185,6 @@ void CInterfaceManager::setProcedureAction(const std::string &procName, uint act
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void CInterfaceManager::startAnim (const string &animId)
|
|
||||||
{
|
|
||||||
TAnimMap::iterator it = _AnimMap.find(animId);
|
|
||||||
if (it == _AnimMap.end())
|
|
||||||
{
|
|
||||||
nlwarning ("anim %s not found", animId.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CInterfaceAnim *pIT = it->second;
|
|
||||||
stopAnim (animId);
|
|
||||||
pIT->start();
|
|
||||||
_ActiveAnims.push_back (pIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
void CInterfaceManager::stopAnim (const string &animId)
|
|
||||||
{
|
|
||||||
TAnimMap::iterator it = _AnimMap.find(animId);
|
|
||||||
if (it == _AnimMap.end())
|
|
||||||
{
|
|
||||||
nlwarning ("anim %s not found", animId.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CInterfaceAnim *pIT = it->second;
|
|
||||||
for (uint i = 0; i < _ActiveAnims.size(); ++i)
|
|
||||||
if (_ActiveAnims[i] == pIT)
|
|
||||||
{
|
|
||||||
_ActiveAnims.erase (_ActiveAnims.begin()+i);
|
|
||||||
if (!pIT->isFinished())
|
|
||||||
pIT->stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucstring &text, const string &masterGroup, TCaseMode caseMode)
|
void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucstring &text, const string &masterGroup, TCaseMode caseMode)
|
||||||
{
|
{
|
||||||
|
@ -3629,58 +3569,6 @@ void CInterfaceManager::luaGarbageCollect()
|
||||||
dumpLuaString(NLMISC::toString("Memory Used : %d Kb", _LuaState->getGCCount()));
|
dumpLuaString(NLMISC::toString("Memory Used : %d Kb", _LuaState->getGCCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceManager::hideAllWindows()
|
|
||||||
{
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
|
||||||
for (uint nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
|
||||||
{
|
|
||||||
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
||||||
if (rMG.Group->getActive())
|
|
||||||
{
|
|
||||||
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
|
||||||
{
|
|
||||||
list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
|
|
||||||
list<CInterfaceGroup*>::const_iterator itw;
|
|
||||||
for (itw = rList.begin(); itw!= rList.end();)
|
|
||||||
{
|
|
||||||
CInterfaceGroup *pIG = *itw;
|
|
||||||
itw++; // since setActive invalidate the iterator, be sure we move to the next one before
|
|
||||||
pIG->setActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceManager::hideAllNonSavableWindows()
|
|
||||||
{
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
|
||||||
for (uint nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
|
||||||
{
|
|
||||||
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
||||||
if (rMG.Group->getActive())
|
|
||||||
{
|
|
||||||
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
|
||||||
{
|
|
||||||
list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
|
|
||||||
list<CInterfaceGroup*>::const_iterator itw;
|
|
||||||
for (itw = rList.begin(); itw!= rList.end();)
|
|
||||||
{
|
|
||||||
CInterfaceGroup *pIG = *itw;
|
|
||||||
CGroupContainer *cont = dynamic_cast<CGroupContainer *>(pIG);
|
|
||||||
itw++; // since setActive invalidate the iterator, be sure we move to the next one before
|
|
||||||
if (!cont || !cont->isSavable())
|
|
||||||
{
|
|
||||||
pIG->setActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CInterfaceManager::createLocalBranch(const std::string &fileName, NLMISC::IProgressCallback &progressCallBack)
|
void CInterfaceManager::createLocalBranch(const std::string &fileName, NLMISC::IProgressCallback &progressCallBack)
|
||||||
{
|
{
|
||||||
|
|
|
@ -235,14 +235,6 @@ public:
|
||||||
void addServerID (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL);
|
void addServerID (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL);
|
||||||
void processServerIDString();
|
void processServerIDString();
|
||||||
|
|
||||||
/**
|
|
||||||
* get a window from its Id of its group.
|
|
||||||
* NB: "ctrl_launch_modal" is a special Id which return the last ctrl which has launch a modal. NULL if modal closed.
|
|
||||||
* \param groupId : the Id of the window group
|
|
||||||
*/
|
|
||||||
/// get an element from a define ID. shortcut for getElementFromId(getDefine(define))
|
|
||||||
CInterfaceElement* getElementFromDefine (const std::string &defineId);
|
|
||||||
|
|
||||||
/// Control specific
|
/// Control specific
|
||||||
|
|
||||||
/// Enable/Disable window movement
|
/// Enable/Disable window movement
|
||||||
|
@ -273,10 +265,6 @@ public:
|
||||||
void runProcedure(const std::string &procName, CCtrlBase *pCaller, const std::vector<std::string> ¶mList);
|
void runProcedure(const std::string &procName, CCtrlBase *pCaller, const std::vector<std::string> ¶mList);
|
||||||
// replace an action in a procedure (if possible)
|
// replace an action in a procedure (if possible)
|
||||||
void setProcedureAction(const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms);
|
void setProcedureAction(const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms);
|
||||||
// Execute a anim
|
|
||||||
void startAnim(const std::string &animId);
|
|
||||||
void stopAnim(const std::string &animId);
|
|
||||||
|
|
||||||
|
|
||||||
// InGame ContextMenu
|
// InGame ContextMenu
|
||||||
void launchContextMenuInGame (const std::string &nameOfCM);
|
void launchContextMenuInGame (const std::string &nameOfCM);
|
||||||
|
@ -395,10 +383,6 @@ public:
|
||||||
// Get the list of InGame XML Interface files, with any AddOn ones
|
// Get the list of InGame XML Interface files, with any AddOn ones
|
||||||
static std::vector<std::string> getInGameXMLInterfaceFiles();
|
static std::vector<std::string> getInGameXMLInterfaceFiles();
|
||||||
|
|
||||||
// hide all the windows
|
|
||||||
void hideAllWindows();
|
|
||||||
void hideAllNonSavableWindows();
|
|
||||||
|
|
||||||
/// \name Action Counter sync
|
/// \name Action Counter sync
|
||||||
// @{
|
// @{
|
||||||
|
|
||||||
|
@ -631,9 +615,6 @@ private:
|
||||||
uint32 _ScreenW, _ScreenH; // Change res detection
|
uint32 _ScreenW, _ScreenH; // Change res detection
|
||||||
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
|
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
|
||||||
|
|
||||||
// List of active Anims
|
|
||||||
std::vector<CInterfaceAnim*> _ActiveAnims;
|
|
||||||
|
|
||||||
// Modes
|
// Modes
|
||||||
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
||||||
uint8 _CurrentMode;
|
uint8 _CurrentMode;
|
||||||
|
|
|
@ -965,7 +965,7 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls)
|
||||||
int CLuaIHMRyzom::hideAllWindows(CLuaState &/* ls */)
|
int CLuaIHMRyzom::hideAllWindows(CLuaState &/* ls */)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaIHM_hideAllWindows)
|
//H_AUTO(Lua_CLuaIHM_hideAllWindows)
|
||||||
CInterfaceManager::getInstance()->hideAllWindows();
|
CWidgetManager::getInstance()->hideAllWindows();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ int CLuaIHMRyzom::hideAllWindows(CLuaState &/* ls */)
|
||||||
int CLuaIHMRyzom::hideAllNonSavableWindows(CLuaState &/* ls */)
|
int CLuaIHMRyzom::hideAllNonSavableWindows(CLuaState &/* ls */)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaIHM_hideAllNonSavableWindows)
|
//H_AUTO(Lua_CLuaIHM_hideAllNonSavableWindows)
|
||||||
CInterfaceManager::getInstance()->hideAllNonSavableWindows();
|
CWidgetManager::getInstance()->hideAllNonSavableWindows();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1647,7 +1647,7 @@ void CEditor::waitScenarioScreen()
|
||||||
{
|
{
|
||||||
setMode(GoingToEditionMode);
|
setMode(GoingToEditionMode);
|
||||||
}
|
}
|
||||||
getUI().hideAllWindows();
|
CWidgetManager::getInstance()->hideAllWindows();
|
||||||
CInterfaceGroup *waitScreen = dynamic_cast<CInterfaceGroup *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_connecting"));
|
CInterfaceGroup *waitScreen = dynamic_cast<CInterfaceGroup *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_connecting"));
|
||||||
if (waitScreen)
|
if (waitScreen)
|
||||||
{
|
{
|
||||||
|
@ -3942,7 +3942,7 @@ void CEditor::release()
|
||||||
saveCurrentKeySet();
|
saveCurrentKeySet();
|
||||||
saveUIConfig();
|
saveUIConfig();
|
||||||
}
|
}
|
||||||
getUI().hideAllWindows(); // make sure all action handlers are called while the r2 lua environment is still active
|
CWidgetManager::getInstance()->hideAllWindows(); // make sure all action handlers are called while the r2 lua environment is still active
|
||||||
clearContent();
|
clearContent();
|
||||||
_EntityCustomSelectBoxMap.clear();
|
_EntityCustomSelectBoxMap.clear();
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,7 @@ void releaseClientTime()
|
||||||
// updateClientTime :
|
// updateClientTime :
|
||||||
//
|
//
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
CWidgetManager::SInterfaceTimes times;
|
||||||
|
|
||||||
void updateClientTime()
|
void updateClientTime()
|
||||||
{
|
{
|
||||||
|
@ -382,7 +383,6 @@ void updateClientTime()
|
||||||
NetMngr.startReplay();
|
NetMngr.startReplay();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CWidgetManager::SInterfaceTimes times;
|
|
||||||
times.lastFrameMs = T0;
|
times.lastFrameMs = T0;
|
||||||
times.thisFrameMs = T1;
|
times.thisFrameMs = T1;
|
||||||
times.frameDiffMs = DT64;
|
times.frameDiffMs = DT64;
|
||||||
|
|
Loading…
Reference in a new issue