CHANGED: Merged the latest changes of gui-refactoring branch

This commit is contained in:
dfighter1985 2012-07-13 06:29:25 +02:00
parent eb025cff22
commit 9d38b416c2
85 changed files with 6538 additions and 6651 deletions

View file

@ -147,6 +147,9 @@ namespace NLGUI
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
virtual void serial(NLMISC::IStream &f);
uint32 getDepth( CInterfaceGroup *group );
protected:
// This is the ContextHelp filled by default in parse()
ucstring _ContextHelp;

View file

@ -0,0 +1,83 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_SHEET_CTRL_SELECTION_H
#define CL_SHEET_CTRL_SELECTION_H
namespace NLGUI
{
class IActionHandler;
/** Infos about a selection group
*/
class CSheetSelectionGroup
{
public:
CSheetSelectionGroup(std::string name) : _Name(name), _Active(false), _TextureIndex(-1), _Color(NLMISC::CRGBA::White), _GlobalColorEnabled(true) {}
void setTexture(const std::string &texName);
sint32 getTextureIndex() const { return _TextureIndex; }
sint32 getTextureWidth() const { return _TextureWidth; }
sint32 getTextureHeight() const { return _TextureHeight; }
void setColor(NLMISC::CRGBA color) { _Color = color; }
NLMISC::CRGBA getColor() const { return _Color; }
void setActive(bool active) { _Active = active; }
bool isActive() const { return _Active; }
const std::string &getName() const { return _Name; }
void enableGlobalColor(bool enabled) { _GlobalColorEnabled = enabled; }
bool isGlobalColorEnabled() const { return _GlobalColorEnabled; }
private:
std::string _Name;
bool _Active;
sint32 _TextureIndex; // index for the selection texture
sint32 _TextureWidth;
sint32 _TextureHeight;
NLMISC::CRGBA _Color; // color that modulate the texture of selection
bool _GlobalColorEnabled;
};
/** Class to manage selection of sheet.
* Sheet are managed by groups, identified by their ID.
*/
class CCtrlSheetSelection
{
public:
// Add a group, and returns its index, or -1 if already created.
sint addGroup(const std::string &name);
// Get a group by its name (must exist)
CSheetSelectionGroup *getGroup(const std::string &name);
const CSheetSelectionGroup *getGroup(const std::string &name) const;
// Get a group by its index
CSheetSelectionGroup *getGroup(uint index);
const CSheetSelectionGroup *getGroup(uint index) const;
// Get the index of a group from its name, return -1 if not a group
sint getGroupIndex(const std::string &name) const;
// Deactivate all groups
void deactivateAll();
// delete all groups
void deleteGroups();
private:
//
typedef std::vector<CSheetSelectionGroup> TGroupVect;
typedef std::map<std::string, uint> TGroupNameToIndex;
private:
TGroupVect _Groups;
TGroupNameToIndex _GroupNameToIndex;
};
}
#endif

View file

@ -456,6 +456,8 @@ namespace NLGUI
return "";
}
bool isInGroup( CInterfaceGroup *group );
protected:
///the parent

View file

@ -72,7 +72,12 @@ namespace NLGUI
public:
CInterfaceOptions();
// for factory construction
struct TCtorParam
{
};
CInterfaceOptions( const TCtorParam &/* param */ );
virtual ~CInterfaceOptions();
virtual bool parse (xmlNodePtr cur);
@ -103,7 +108,7 @@ namespace NLGUI
{
public:
COptionsLayer();
COptionsLayer( const TCtorParam &/* param */ );
~COptionsLayer();
virtual bool parse (xmlNodePtr cur);
@ -159,7 +164,7 @@ namespace NLGUI
class COptionsContainerInsertion : public CInterfaceOptions
{
public:
COptionsContainerInsertion();
COptionsContainerInsertion( const TCtorParam &/* param */ );
virtual bool parse (xmlNodePtr cur);
sint32 TxId_R_Arrow;
@ -173,7 +178,7 @@ namespace NLGUI
class COptionsContainerMove : public CInterfaceOptions
{
public:
COptionsContainerMove();
COptionsContainerMove( const TCtorParam &/* param */ );
virtual bool parse (xmlNodePtr cur);
sint32 TrackW;
@ -193,7 +198,7 @@ namespace NLGUI
class COptionsList : public CInterfaceOptions
{
public:
COptionsList();
COptionsList( const TCtorParam &/* param */ );
virtual bool parse (xmlNodePtr cur);
uint getNumParams() const {return _NumParams;}

View file

@ -0,0 +1,331 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RZ_INTERFACE_PARSER_H
#define RZ_INTERFACE_PARSER_H
#include "nel/misc/types_nl.h"
#include "nel/3d/u_texture.h"
#include "nel/gui/ctrl_sheet_selection.h"
#include "nel/gui/interface_link.h"
#include "nel/misc/smart_ptr.h"
#include "nel/gui/lua_helper.h"
#include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h"
namespace NLGUI
{
class CInterfaceElement;
class CInterfaceGroup;
class CInterfaceOptions;
class CInterfaceLink;
class CCtrlBase;
class CGroupList;
class CGroupContainer;
class CInterfaceAnim;
class CViewPointer;
// ***************************************************************************
/**
* class managing the interface parsing
* \author Matthieu 'TrapII' Besson
* \author Nevrax France
* \date 2002
*/
class CInterfaceParser : public IParser
{
public:
class IParserModule
{
public:
enum ParsingStage
{
None = 0,
Unresolved = 1,
Resolved = 2,
GroupChildren = 4
};
IParserModule(){
parser = NULL;
parsingStage = None;
}
virtual ~IParserModule(){}
bool canParseInStage( ParsingStage stage )
{
if( ( parsingStage & static_cast< uint >( stage ) ) != 0 )
return true;
else
return false;
}
virtual bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup ) = 0;
void setParser( CInterfaceParser *p ){ parser = p; }
protected:
CInterfaceParser *parser;
uint parsingStage;
};
class ISetupOptionCallbackClass
{
public:
virtual void setupOptions() = 0;
};
CInterfaceParser();
virtual ~CInterfaceParser();
public:
/**
* Parsing methods
*/
/** Load a set of xml files
* \param isFilename true if xmlFileNames array contains the names of the xml file, false, if each
* array is a script itself
*/
bool parseInterface (const std::vector<std::string> &xmlFileNames, bool reload, bool isFilename = true, bool checkInData = false);
bool parseXMLDocument (xmlNodePtr root, bool reload);
bool parseTemplateNode (xmlNodePtr node,xmlNodePtr instance,xmlNodePtr templ);
bool parseInstance(xmlNodePtr cur);
bool parseVector (xmlNodePtr cur);
bool parseVariable (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseOptions (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseGroup (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseGroupChildren(xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseControl (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseLink (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseView (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
bool parseTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
bool parseDefine(xmlNodePtr cur);
bool parseProcedure(xmlNodePtr cur, bool reload);
bool parseSheetSelection(xmlNodePtr cur);
bool parseAnim(xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseStyle(xmlNodePtr cur);
bool parseLUAScript (xmlNodePtr cur);
bool setupTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
bool setupTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
void addModule( std::string name, IParserModule *module );
IParserModule* getModuleFor( std::string name ) const;
void removeAllModules();
// Called by each parse in parseXMLDocument
bool solveDefine(xmlNodePtr cur);
bool solveStyle(xmlNodePtr cur);
// Solve All define in a string. return false if some define not founs (defError contains this define)
bool solveDefine(const std::string &propVal, std::string &newPropVal, std::string &defError);
// Called after template & options parsing
void setupOptions();
/**
* Initializer
*/
bool initCoordsAndLuaScript ();
/// Association builders : associate an element of the interface with the string ID of
/// another element used as reference for position values
void addParentPositionAssociation (CInterfaceElement *element, const std::string &parentID);
void addParentSizeAssociation (CInterfaceElement *element, const std::string &parentID);
void addParentSizeMaxAssociation (CInterfaceElement *element, const std::string &parentID);
/// LUA Class Association builder : associate a lua script to a group (called for each group after every document parsed)
void addLuaClassAssociation(CInterfaceGroup *group, const std::string &luaScript);
/**
* Accessors
*/
// access to control sheet selection
CCtrlSheetSelection &getCtrlSheetSelection() { return _CtrlSheetSelection; }
/// \name Parameter variable
// @{
const std::string& getDefine(const std::string &id) const;
bool isDefineExist(const std::string &id) const;
void setDefine(const std::string &id, const std::string &value);
// @}
/// \name Dynamic links mgt
// @{
/** Associate the given dynamic link with an ID
* \return true if succesful
*/
bool addLink(CInterfaceLink *link, const std::string &id);
/** remove the given link from its ID
* \return true if succesful
*/
bool removeLink(const std::string &id);
// @}
/** create a template from an instance consisting of a single group
* \param templateName name of the template in the xml
* \param templateParams array containing each template parameter and its name
* \param number of template parameters in the array
*/
CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, const std::pair<std::string, std::string> *templateParams, uint numParams, bool updateLinks = true);
CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, std::vector<std::pair<std::string, std::string> > &templateParams, bool updateLinks = true)
{
if (templateParams.size() > 0)
return createGroupInstance(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks);
else
return createGroupInstance(templateName, parentID, NULL, 0, updateLinks);
}
/** create a template from an instance consisting of a single control or group
* \param templateName name of the template in the xml
* \param templateParams array containing each template parameter and its name
* \param number of template parameters in the array
*/
CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, const std::pair<std::string,std::string> *templateParams, uint numParams, bool updateLinks /* = true */);
CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, std::vector<std::pair<std::string, std::string> > &templateParams, bool updateLinks = true)
{
if (templateParams.size() > 0)
return createUIElement(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks);
else
return createUIElement(templateName, parentID, NULL, 0, updateLinks);
}
static void freeXMLNodeAndSibblings(xmlNodePtr node);
// search a "tree" node in the hierarchy that match node. may return root! NULL if not found
static xmlNodePtr searchTreeNodeInHierarchy(xmlNodePtr root, const char *node);
/// \name Clearing mgt
// @{
void removeAllLinks();
void removeAllProcedures();
void removeAllDefines();
void removeAllTemplates();
void removeAllAnims();
void removeAll();
// @}
// get info on procedure. return 0 if procedure not found
uint getProcedureNumActions( const std::string &procName ) const;
// return false if procedure not found, or if bad action index. return false if has some param variable (@0...)
bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string &params ) const;
void setCacheUIParsing( bool b ){ cacheUIParsing = b; }
CInterfaceAnim* getAnim( const std::string &name ) const;
CProcedure* getProc( const std::string &name );
protected:
/**
* Temporary data for init
*/
/// vector storing parsed templates during init. At the end of init, only used template are kept
std::vector<xmlNodePtr> _Templates;
// map linking an element to its parent position used during init only
std::map<CInterfaceElement*,std::string> _ParentPositionsMap;
std::map<CInterfaceElement*,std::string> _ParentSizesMap;
std::map<CInterfaceElement*,std::string> _ParentSizesMaxMap;
// map linking a group to its lua script. used during init only
std::map<CInterfaceGroup*,std::string> _LuaClassAssociation;
/**
* Data of initialized interface
*/
/// Define Variable list
typedef std::map<std::string, std::string> TVarMap;
typedef TVarMap::iterator ItVarMap;
typedef TVarMap::const_iterator CstItVarMap;
TVarMap _DefineMap;
bool validDefineChar(char c) const;
class CStyleProperty
{
public:
std::string Name;
std::string Value;
};
class CStyle
{
public:
std::vector<CStyleProperty> Properties;
};
/// Procedure list
typedef std::map<std::string,CProcedure> TProcedureMap;
typedef TProcedureMap::iterator ItProcedureMap;
typedef TProcedureMap::const_iterator CstItProcedureMap;
TProcedureMap _ProcedureMap;
// mgt of sheet selections (inventory, buy, sell..)
CCtrlSheetSelection _CtrlSheetSelection;
// Map of dynamic links
typedef std::map<std::string, NLMISC::CSmartPtr<CInterfaceLink> > TLinkMap;
TLinkMap _LinkMap;
// Map of anims
typedef std::map<std::string, CInterfaceAnim *> TAnimMap;
TAnimMap _AnimMap;
// Map of styles.
typedef std::map<std::string, CStyle> TStyleMap;
TStyleMap _StyleMap;
protected:
std::map< std::string, IParserModule* > moduleMap;
// List of script loaded (for reloadLua command)
std::set<std::string> _LuaFileScripts;
bool cacheUIParsing;
bool luaInitialized;
ISetupOptionCallbackClass *setupCallback;
public:
void initLUA();
void uninitLUA();
bool isLuaInitialized() const{ return luaInitialized; }
/// Load A .lua. false if parse error. string 'error' contains the eventual error desc (but warning still displayed)
bool loadLUA( const std::string &luaFile, std::string &error );
/// Reload all LUA scripts inserted through <lua>
void reloadAllLuaFileScripts();
void setSetupOptionsCallback( ISetupOptionCallbackClass *cb ){ setupCallback = cb; }
};
}
#endif // RZ_INTERFACE_PARSER_H

View file

@ -45,13 +45,17 @@ namespace NLGUI
bool executeLuaScript( const std::string &luaScript, bool smallScript = false );
void ResetLuaState();
void forceGarbageCollect();
private:
CLuaManager();
static CLuaManager *instance;
static bool debugLua;
NLMISC::CSmartPtr< NLGUI::CLuaState > luaState;
NLGUI::CLuaState *luaState;
};
}

View file

@ -0,0 +1,72 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PARSER_H
#define PARSER_H
#include <string>
#include <vector>
#include "nel/misc/types_nl.h"
namespace NLGUI
{
class CInterfaceElement;
class CInterfaceGroup;
class CInterfaceAnim;
class CProcedure;
class CCtrlSheetSelection;
class CInterfaceLink;
class IParser
{
public:
IParser();
virtual ~IParser();
static IParser* createParser();
virtual void addParentPositionAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
virtual void addParentSizeAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
virtual void addParentSizeMaxAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
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 ) = 0;
virtual uint getProcedureNumActions( const std::string &procName ) const = 0;
virtual bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string &params ) const = 0;
virtual const std::string& getDefine(const std::string &id) const = 0;
virtual CInterfaceAnim* getAnim( const std::string &name ) const = 0;
virtual CProcedure* getProc( const std::string &name ) = 0;
virtual bool parseInterface( const std::vector< std::string > &xmlFileNames, bool reload, bool isFilename = true, bool checkInData = false ) = 0;
virtual void initLUA() = 0;
virtual void uninitLUA() = 0;
virtual bool isLuaInitialized() const = 0;
virtual bool loadLUA( const std::string &luaFile, std::string &error ) = 0;
virtual void reloadAllLuaFileScripts() = 0;
virtual void removeAllTemplates() = 0;
virtual bool solveDefine( const std::string &propVal, std::string &newPropVal, std::string &defError ) = 0;
virtual CInterfaceElement* createUIElement( const std::string &templateName, const std::string &parentID, const std::pair< std::string,std::string> *templateParams, uint numParams, bool updateLinks ) = 0;
virtual CInterfaceElement* createUIElement( const std::string &templateName, const std::string &parentID, std::vector< std::pair< std::string, std::string > > &templateParams, bool updateLinks = true ) = 0;
virtual bool isDefineExist( const std::string &id ) const = 0;
virtual CCtrlSheetSelection &getCtrlSheetSelection() = 0;
virtual bool addLink( CInterfaceLink *link, const std::string &id ) = 0;
virtual bool removeLink( const std::string &id ) = 0;
};
}
#endif

View file

@ -0,0 +1,77 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PROC_H
#define PROC_H
#include "nel/misc/types_nl.h"
#include <string>
#include <vector>
namespace NLGUI
{
class CParamBlock
{
public:
// -1 if not a param id, but a string
sint32 NumParam;
std::string String;
CParamBlock()
{
NumParam = -1;
}
};
class CProcAction
{
public:
// a condition to launch this action handler (is an expression)
std::vector< CParamBlock > CondBlocks;
// the action handler (may be proc!!)
std::string Action;
// A list of string/or param number => to build the final params at execution
std::vector< CParamBlock > ParamBlocks;
// build a paramBlock from a string
void buildParamBlock( const std::string &params );
// from ParamBlock, and a paramList (skip the 0th), build params.
void buildParams( const std::vector< std::string > &paramList, std::string &params ) const;
void buildCondBlock( const std::string &params );
void buildCond( const std::vector< std::string > &paramList, std::string &cond ) const;
static void buildBlocks( const std::string &in, std::vector< CParamBlock > &out );
static void eval( const std::vector< std::string > &inArgs, const std::vector< CParamBlock > &inBlocks, std::string &out );
};
class CProcedure
{
public:
// List of the actions
std::vector< CProcAction > Actions;
};
}
#endif

View file

@ -26,6 +26,9 @@
#include "nel/misc/types_nl.h"
#include "nel/gui/interface_common.h"
#include "nel/gui/interface_options.h"
#include "nel/gui/event_descriptor.h"
#include "nel/3d/u_camera.h"
#include "nel/gui/parser.h"
namespace NLMISC
{
@ -41,25 +44,28 @@ namespace NLGUI
class CInterfaceGroup;
class CViewPointerBase;
class CInterfaceOptions;
class IParser
{
public:
virtual void addParentPositionAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
virtual void addParentSizeAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
virtual void addParentSizeMaxAssociation( CInterfaceElement *element, const std::string &parentID ) = 0;
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 ) = 0;
virtual uint getProcedureNumActions( const std::string &procName ) const = 0;
virtual bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string &params ) const = 0;
};
class CInterfaceAnim;
class CProcedure;
/// Manages the GUI widgets
class CWidgetManager{
public:
class INewScreenSizeHandler
{
public:
virtual ~INewScreenSizeHandler(){}
virtual void process( uint32 w, uint32 h ) = 0;
};
class IOnWidgetsDrawnHandler
{
public:
virtual ~IOnWidgetsDrawnHandler(){};
virtual void process() = 0;
};
struct SInterfaceTimes
{
public:
@ -147,6 +153,14 @@ namespace NLGUI
CInterfaceElement* getElementFromId( 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:###)
CInterfaceGroup* getWindow(CInterfaceElement*);
@ -200,6 +214,9 @@ namespace NLGUI
// pop all top modal windows with the given category (a string stored in the modal)
void popModalWindowCategory(const std::string &category);
void hideAllWindows();
void hideAllNonSavableWindows();
CCtrlBase *getCtrlLaunchingModal ()
{
if (_ModalStack.empty()) return NULL;
@ -216,6 +233,9 @@ namespace NLGUI
CCtrlBase* getCurContextHelp(){ return curContextHelp; }
float _DeltaTimeStopingContextHelp;
float _MaxTimeStopingContextHelp;
sint _LastXContextHelp;
sint _LastYContextHelp;
CViewPointerBase* getPointer(){ return _Pointer; }
void setPointer( CViewPointerBase *pointer ){ _Pointer = pointer; }
@ -256,6 +276,52 @@ namespace NLGUI
void reset();
void checkCoords();
CInterfaceGroup* getWindowForActiveMasterGroup( const std::string &windowName );
void drawOverExtendViewText();
// Internal : adjust a tooltip with respect to its parent. Returns the number of coordinate that were clamped
// against the screen border
uint adjustTooltipPosition( CCtrlBase *newCtrl, CInterfaceGroup *win, THotSpot ttParentRef,
THotSpot ttPosRef, sint32 xParent, sint32 yParent,
sint32 wParent, sint32 hParent );
void updateTooltipCoords();
// Update tooltip coordinate if they need to be (getInvalidCoords() returns a value != 0)
void updateTooltipCoords(CCtrlBase *newCtrl);
/// for ContextHelp action handler only: set the result name
void setContextHelpText( const ucstring &text ){ _ContextHelpText = text; }
ucstring& getContextHelpText(){ return _ContextHelpText; }
/// force disable the context help
void disableContextHelp();
/// force disable the context help, if it is issued from the given control
void disableContextHelpForControl(CCtrlBase *pCtrl);
CCtrlBase* getNewContextHelpCtrl();
void drawContextHelp();
void setContextHelpActive(bool active);
void getNewWindowCoordToNewScreenSize( sint32 &x, sint32 &y, sint32 w, sint32 h,
sint32 newW, sint32 newH) const;
// move windows according to new screen size
void moveAllWindowsToNewScreenSize(sint32 newScreenW, sint32 newScreenH, bool fixCurrentUI );
void updateAllLocalisedElements();
void drawViews( NL3D::UCamera camera );
bool handleEvent( const CEventDescriptor &evnt );
bool handleMouseMoveEvent( const CEventDescriptor &eventDesc );
// Relative move of pointer
void movePointer (sint32 dx, sint32 dy);
// Set absolute coordinates of pointer
@ -319,6 +385,8 @@ namespace NLGUI
// Enable mouse Events to interface. if false, release Captures.
void enableMouseHandling( bool handle );
bool isMouseHandlingEnabled() const{ return _MouseHandlingEnabled; }
bool isMouseOverWindow() const{ return _MouseOverWindow; }
void setMouseOverWindow( bool b ){ _MouseOverWindow = b; }
// Get the User DblClick Delay (according to save...), in milisecond
uint getUserDblClickDelay();
@ -380,12 +448,34 @@ namespace NLGUI
void setIngame( bool i ){ inGame = i; }
bool isIngame() const{ return inGame; }
static IParser *parser;
void setScreenWH( uint32 w, uint32 h ){ screenW = w; screenH = h; }
void registerNewScreenSizeHandler( INewScreenSizeHandler *handler );
void removeNewScreenSizeHandler( INewScreenSizeHandler *handler );
void registerOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler* handler );
void removeOnWidgetsDrawnHandler( IOnWidgetsDrawnHandler *handler );
void startAnim( const std::string &animId );
void stopAnim( const std::string &animId );
void updateAnims();
void removeFinishedAnims();
// execute a procedure. give a list of parameters. NB: the first param is the name of the proc (skipped)...
void runProcedure( const std::string &procName, CCtrlBase *pCaller, const std::vector< std::string > &paramList );
// replace an action in a procedure (if possible)
void setProcedureAction( const std::string &procName, uint actionIndex, const std::string &ah, const std::string &params );
const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; }
IParser* getParser() const{ return parser; }
private:
CWidgetManager();
~CWidgetManager();
IParser *parser;
static CWidgetManager *instance;
std::vector< SMasterGroup > _MasterGroups;
std::vector< SModalWndInfo > _ModalStack;
@ -440,7 +530,22 @@ namespace NLGUI
SInterfaceTimes interfaceTimes;
ucstring _ContextHelpText;
bool _ContextHelpActive;
bool inGame;
bool _MouseOverWindow;
CEventDescriptorKey lastKeyEvent;
uint32 screenH;
uint32 screenW;
std::vector< CInterfaceAnim* > activeAnims;
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
};
}

View file

@ -223,5 +223,22 @@ namespace NLGUI
return "context_help";
}
uint32 CCtrlBase::getDepth( CInterfaceGroup *group )
{
uint32 depth = 1;
CInterfaceGroup *parent = getParent();
while( parent != NULL )
{
if ( parent == group )
break;
else
parent = parent->getParent();
depth++;
}
// The Resizer Ctrls take the precedence over Sons controls.
return depth + getDeltaDepth();
}
}

View file

@ -0,0 +1,98 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string>
#include <map>
#include "nel/misc/types_nl.h"
#include "nel/misc/rgba.h"
#include "nel/gui/ctrl_sheet_selection.h"
#include "nel/gui/view_renderer.h"
namespace NLGUI
{
//=============================================================
void CSheetSelectionGroup::setTexture(const std::string &texName)
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIndex = rVR.getTextureIdFromName(texName);
rVR.getTextureSizeFromId(_TextureIndex, _TextureWidth, _TextureHeight);
}
//=============================================================
void CCtrlSheetSelection::deleteGroups()
{
_Groups.clear();
_GroupNameToIndex.clear();
}
//=============================================================
sint CCtrlSheetSelection::addGroup(const std::string &name)
{
if (getGroupIndex(name) != -1)
{
nlwarning("<CCtrlSheetSelection::addGroup> Group inserted twice : %s", name.c_str());
return - 1;
}
_Groups.push_back(CSheetSelectionGroup(name));
_GroupNameToIndex[name] = (uint)_Groups.size() - 1;
return (sint)_Groups.size() - 1;
}
//=============================================================
sint CCtrlSheetSelection::getGroupIndex(const std::string &name) const
{
TGroupNameToIndex::const_iterator it = _GroupNameToIndex.find(name);
return it == _GroupNameToIndex.end() ? - 1 : (sint) it->second;
}
//=============================================================
CSheetSelectionGroup *CCtrlSheetSelection::getGroup(const std::string &name)
{
return getGroup(getGroupIndex(name));
}
//=============================================================
const CSheetSelectionGroup *CCtrlSheetSelection::getGroup(const std::string &name) const
{
return getGroup(getGroupIndex(name));
}
//=============================================================
CSheetSelectionGroup *CCtrlSheetSelection::getGroup(uint index)
{
if (index > _Groups.size())
{
// nlwarning("<CCtrlSheetSelection::getGroup> invalid group index");
return NULL;
}
return &_Groups[index];
}
//=============================================================
const CSheetSelectionGroup *CCtrlSheetSelection::getGroup(uint index) const
{
if (index > _Groups.size())
{
nlwarning("<CCtrlSheetSelection::getGroup> invalid group index");
return NULL;
}
return &_Groups[index];
}
}

View file

@ -950,7 +950,7 @@ namespace NLGUI
else
parentId = _Paragraph->getId();
CInterfaceGroup *inst = CWidgetManager::parser->createGroupInstance(templateName, parentId+":"+id, tmplParams);
CInterfaceGroup *inst = CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, parentId+":"+id, tmplParams);
if (inst)
{
inst->setId(parentId+":"+id);
@ -1258,7 +1258,7 @@ namespace NLGUI
tmplParams.push_back(TTmplParam("active", "true"));
if (!minWidth.empty())
tmplParams.push_back(TTmplParam("wmin", minWidth));
CInterfaceGroup *buttonGroup = CWidgetManager::parser->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams);
CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams);
if (buttonGroup)
{
@ -2422,7 +2422,7 @@ namespace NLGUI
tmplParams.push_back(TTmplParam("onclick", "browse"));
tmplParams.push_back(TTmplParam("onclick_param", param));
tmplParams.push_back(TTmplParam("active", "true"));
CInterfaceGroup *buttonGroup = CWidgetManager::parser->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams);
CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, _Paragraph->getId(), tmplParams);
if (buttonGroup)
{
@ -2614,7 +2614,7 @@ namespace NLGUI
templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false"));
templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false"));
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", "1024"));
CInterfaceGroup *textArea = CWidgetManager::parser->createGroupInstance (templateName.c_str(),
CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(),
getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
// Group created ?
@ -2652,7 +2652,7 @@ namespace NLGUI
// Not added ?
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string> ("id", name));
CInterfaceGroup *group = CWidgetManager::parser->createGroupInstance (templateName.c_str(),
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(),
getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
// Group created ?
@ -3510,11 +3510,11 @@ namespace NLGUI
{
const std::string &procName= params;
// look into this proc
uint numActions= CWidgetManager::parser->getProcedureNumActions(procName);
uint numActions= CWidgetManager::getInstance()->getParser()->getProcedureNumActions(procName);
for(uint i=0;i<numActions;i++)
{
string procAh, procParams;
if( CWidgetManager::parser->getProcedureAction(procName, i, procAh, procParams))
if( CWidgetManager::getInstance()->getParser()->getProcedureAction(procName, i, procAh, procParams))
{
// recurs proc if needed!
if (actionLaunchUrlRecurs(procAh, procParams, url))

View file

@ -344,7 +344,7 @@ namespace NLGUI
}
string completeId = _Parent->getId() + ":" + _Lines[_Lines.size()-1].Id;
CInterfaceGroup *pUGLeft = CWidgetManager::parser->createGroupInstance((const char*)usergroup, completeId, vparams);
CInterfaceGroup *pUGLeft = CWidgetManager::getInstance()->getParser()->createGroupInstance((const char*)usergroup, completeId, vparams);
if (pUGLeft)
setUserGroupLeft((uint)_Lines.size()-1, pUGLeft, true);
}
@ -359,7 +359,7 @@ namespace NLGUI
}
string completeId = _Parent->getId() + ":" + _Lines[_Lines.size()-1].Id;
CInterfaceGroup *pUG = CWidgetManager::parser->createGroupInstance((const char*)usergroup, completeId, vparams);
CInterfaceGroup *pUG = CWidgetManager::getInstance()->getParser()->createGroupInstance((const char*)usergroup, completeId, vparams);
if (pUG)
setUserGroupRight((uint)_Lines.size()-1, pUG, true);
}
@ -1139,13 +1139,13 @@ namespace NLGUI
}
// create the real separator. It may be larger than the group list, this is why we create a separate group
CInterfaceGroup *separator = CWidgetManager::parser->createGroupInstance("menu_separator", "", NULL, 0);
CInterfaceGroup *separator = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_separator", "", NULL, 0);
if (!separator) return;
separator->setId(ID_MENU_SEPARATOR);
addGroup(separator);
separator->setParent(this);
// create place holder group
CInterfaceGroup *ph = CWidgetManager::parser->createGroupInstance("menu_separator_empty", "", NULL, 0);
CInterfaceGroup *ph = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_separator_empty", "", NULL, 0);
if (!ph)
{
delGroup(separator);

View file

@ -87,7 +87,7 @@ namespace NLGUI
Group->setId(parentGroup->getId() + Group->getId());
setEnclosedGroupDefaultParams();
// parse the children
bool ok = CWidgetManager::parser->parseGroupChildren(cur, Group, false);
bool ok = CWidgetManager::getInstance()->getParser()->parseGroupChildren(cur, Group, false);
if (!ok) return false;
// align
ptr = (char*) xmlGetProp( cur, (xmlChar*)"align" );

View file

@ -156,7 +156,7 @@ namespace NLGUI
idparent = parentGroup->getId() +":";
else
idparent = "ui:";
CWidgetManager::parser->addParentPositionAssociation(this, idparent + string((const char*)ptr));
CWidgetManager::getInstance()->getParser()->addParentPositionAssociation(this, idparent + string((const char*)ptr));
}
}
@ -177,7 +177,7 @@ namespace NLGUI
if (parentGroup)
idparent = parentGroup->getId();
}
CWidgetManager::parser->addParentSizeAssociation( this, idparent );
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idparent );
}
ptr = (char*) xmlGetProp (cur, (xmlChar*)"sizeref");
@ -1258,6 +1258,19 @@ namespace NLGUI
}
bool CInterfaceElement::isInGroup( CInterfaceGroup *group )
{
CInterfaceGroup *parent = getParent();
while( parent != NULL )
{
if( parent == group )
return true;
else
parent = parent->getParent();
}
return false;
}
}

View file

@ -324,7 +324,7 @@ namespace NLGUI
if (parentGroup)
idparent = parentGroup->getId();
}
CWidgetManager::parser->addParentSizeMaxAssociation (this, idparent);
CWidgetManager::getInstance()->getParser()->addParentSizeMaxAssociation (this, idparent);
}
// left & right clicks
@ -348,7 +348,7 @@ namespace NLGUI
// LuaClass script
ptr = xmlGetProp (cur, (xmlChar*)"lua_class");
if( ptr )
CWidgetManager::parser->addLuaClassAssociation( this, (const char*)ptr );
CWidgetManager::getInstance()->getParser()->addLuaClassAssociation( this, (const char*)ptr );
return true;
}

View file

@ -19,6 +19,8 @@
#include "nel/gui/interface_element.h"
#include "nel/gui/interface_options.h"
#include "nel/gui/view_renderer.h"
#include "nel/misc/factory.h"
#include <string>
using namespace std;
using namespace NLMISC;
@ -44,7 +46,7 @@ namespace NLGUI
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
CInterfaceOptions::CInterfaceOptions()
CInterfaceOptions::CInterfaceOptions( const TCtorParam &/* param */ )
{
}
@ -132,7 +134,9 @@ namespace NLGUI
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
COptionsLayer::COptionsLayer()
NLMISC_REGISTER_OBJECT(CInterfaceOptions, COptionsLayer, std::string, "layer");
COptionsLayer::COptionsLayer( const TCtorParam &param ) :
CInterfaceOptions( param )
{
TxId_TL = TxId_T = TxId_TR = TxId_L = TxId_R = TxId_Blank = TxId_BL = TxId_B = -2;
TxId_BR = TxId_BL_Open = TxId_B_Open = TxId_BR_Open = TxId_EL_Open = TxId_EM_Open = TxId_ER_Open =-2;
@ -237,7 +241,9 @@ namespace NLGUI
}
// ----------------------------------------------------------------------------
COptionsContainerInsertion::COptionsContainerInsertion()
NLMISC_REGISTER_OBJECT(CInterfaceOptions, COptionsContainerInsertion, std::string, "container_insertion_opt");
COptionsContainerInsertion::COptionsContainerInsertion( const TCtorParam &param ) :
CInterfaceOptions( param )
{
TxId_R_Arrow = -2;
TxId_L_Arrow = -2;
@ -264,7 +270,9 @@ namespace NLGUI
// ***************************************************************************
COptionsContainerMove::COptionsContainerMove()
NLMISC_REGISTER_OBJECT(CInterfaceOptions, COptionsContainerMove, std::string, "container_move_opt");
COptionsContainerMove::COptionsContainerMove( const TCtorParam &param ) :
CInterfaceOptions( param )
{
TrackW = -8;
TrackH = 22;
@ -289,7 +297,9 @@ namespace NLGUI
}
// ***************************************************************************
COptionsList::COptionsList()
NLMISC_REGISTER_OBJECT(CInterfaceOptions, COptionsList, std::string, "list");
COptionsList::COptionsList( const TCtorParam &param ) :
CInterfaceOptions( param )
{
_NumParams= 0;
}

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,7 @@ namespace NLGUI
CLuaManager::~CLuaManager()
{
delete luaState;
luaState = NULL;
}
@ -51,5 +52,18 @@ namespace NLGUI
return true;
}
void CLuaManager::ResetLuaState()
{
delete luaState;
luaState = new CLuaState( debugLua );
}
void CLuaManager::forceGarbageCollect()
{
nlinfo("Collecting Garbaged LUA variables");
luaState->setGCThreshold( 0 );
nlinfo( NLMISC::toString( "Memory Used : %d Kb", luaState->getGCCount() ).c_str() );
}
}

View file

@ -0,0 +1,39 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/misc/rgba.h"
#include <map>
#include "nel/gui/interface_group.h"
#include "nel/gui/interface_parser.h"
namespace NLGUI
{
IParser::IParser()
{
}
IParser::~IParser()
{
}
IParser* IParser::createParser()
{
return new CInterfaceParser();
}
}

167
code/nel/src/gui/proc.cpp Normal file
View file

@ -0,0 +1,167 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/gui/proc.h"
#include "nel/misc/algo.h"
using namespace NLMISC;
namespace NLGUI
{
#define PROC_PARAM_IDENT '@'
// ***************************************************************************
void CProcAction::buildParamBlock( const std::string &params )
{
buildBlocks( params, ParamBlocks );
}
void CProcAction::buildParams( const std::vector< std::string > &paramList, std::string &params ) const
{
eval( paramList, ParamBlocks, params );
}
void CProcAction::buildCondBlock( const std::string &params )
{
buildBlocks( params, CondBlocks );
}
void CProcAction::buildCond( const std::vector< std::string > &paramList, std::string &params ) const
{
eval( paramList, CondBlocks, params );
}
// ***************************************************************************
void CProcAction::buildBlocks( const std::string &in, std::vector< CParamBlock > &out )
{
out.clear();
if(in.empty())
return;
std::string lastString;
std::string::size_type curPos= 0;
std::string::size_type lastPos= 0;
//if it has some @ then solve proc value
while( (curPos=in.find(PROC_PARAM_IDENT, curPos)) != std::string::npos)
{
// If it is end of line
if(curPos==in.size()-1)
{
// then skip
curPos= in.size();
}
else
{
// Skip all @
uint countNbIdent = 0;
while (curPos<in.size() && in[curPos]==PROC_PARAM_IDENT)
{
curPos++;
countNbIdent++;
}
// get the id pos
uint countNbDigit = 0;
uint startIdPos= (uint)curPos;
while (curPos<in.size() && in[curPos]>='0' && in[curPos]<='9')
{
curPos++;
countNbDigit++;
}
if (curPos == startIdPos)
{
// No digit so it is a normal db entry
lastString+= in.substr (lastPos, curPos-(countNbIdent-1)-lastPos);
// all @ are skipped
}
else
{
// There is some digit it is an argument
// copy the last not param sub string.
sint nbToCopy = (sint)(curPos-countNbIdent-countNbDigit-lastPos);
if (nbToCopy > 0)
lastString += in.substr(lastPos, nbToCopy);
// if not empty, add to the param block
if (!lastString.empty())
{
CParamBlock pb;
pb.String = lastString;
out.push_back(pb);
// clear it
lastString.clear();
}
// get the param id
sint paramId;
fromString(in.substr(startIdPos, curPos-startIdPos), paramId);
// Add it to the param block
CParamBlock pb;
pb.NumParam = paramId;
out.push_back(pb);
}
// valid pos is current pos
lastPos= curPos;
}
}
// concat last part
lastString+= in.substr(lastPos, in.size()-lastPos);
if(!lastString.empty())
{
CParamBlock pb;
pb.String = lastString;
out.push_back(pb);
}
}
// ***************************************************************************
void CProcAction::eval( const std::vector<std::string> &inArgs, const std::vector< CParamBlock > &inBlocks, std::string &out )
{
// clear the ret string
out.clear();
// for all block
for (uint i=0; i < inBlocks.size(); i++)
{
const CParamBlock &pb = inBlocks[i];
// if the block is a raw string
if (pb.NumParam < 0)
{
// concat with the block
out += pb.String;
}
// else get from paramList
else
{
// add 1, because paramList[0] is the name of the procedure
sint idInList = pb.NumParam+1;
// if param exist
if (idInList < (sint)inArgs.size())
// concat with the params
out += inArgs[idInList];
// else skip (should fail)
}
}
}
}

View file

@ -161,13 +161,13 @@ namespace NLGUI
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor"));
_StringCursor = CWidgetManager::parser->createGroupInstance("string_cursor", "", templateParams);
_StringCursor = CWidgetManager::getInstance()->getParser()->createGroupInstance("string_cursor", "", templateParams);
if (_StringCursor)
_StringCursor->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
templateParams.clear();
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor_hardware"));
_StringCursorHardware = CWidgetManager::parser->createGroupInstance("string_cursor_hardware", "", templateParams);
_StringCursorHardware = CWidgetManager::getInstance()->getParser()->createGroupInstance("string_cursor_hardware", "", templateParams);
if (_StringCursorHardware)
_StringCursorHardware->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
}

File diff suppressed because it is too large Load diff

View file

@ -747,11 +747,20 @@ const CActionsManager::CCategoryLocator *CActionsManager::getActionLocator (cons
while ((ite != _ActionCategory.end ()) && (ite->first == name.Name))
{
// Ref on the base action
const CBaseAction &baseAction = _Categories[ite->second.CategoryId].BaseActions[ite->second.BaseActionId];
const CCategory &cat = _Categories[ite->second.CategoryId];
uint baseActionId = ite->second.BaseActionId;
uint baseActionSize = cat.BaseActions.size();
if( ite->second.BaseActionId >= cat.BaseActions.size() )
return NULL;
const CBaseAction &baseAction = cat.BaseActions[ite->second.BaseActionId];
// Check parameters
uint i;
for (i=0; i<baseAction.Parameters.size (); i++)
uint s = baseAction.Parameters.size();
for (i=0; i<s; i++)
{
bool parameterOk = false;
const CBaseAction::CParameter &parameter = baseAction.Parameters[i];

View file

@ -30,8 +30,8 @@
///////////
// CLASS //
class CCombo;
class CAction;
class CActionsManager;
class CAction;
/**
* The goal of CCombo is to gather together Inputs that will validate an Action.
@ -308,8 +308,6 @@ struct CTKeyHashMapTraits
*/
class CActionsManager
{
friend class CInterfaceParser;
public:
/// Typedef to use the map easily.

View file

@ -5079,7 +5079,7 @@ NLMISC_COMMAND(luaReload, "reload all .lua script files", "")
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(ClientCfg.AllowDebugLua)
{
pIM->reloadAllLuaFileScripts();
CWidgetManager::getInstance()->getParser()->reloadAllLuaFileScripts();
return true;
}
else
@ -5105,7 +5105,7 @@ NLMISC_COMMAND(luaScript, "Execute a lua script", "direct_script_code")
}
// not smallScript because suppose var can change a lot
pIM->executeLuaScript(script, false);
CLuaManager::getInstance().executeLuaScript(script, false);
return true;
}
@ -5186,7 +5186,7 @@ NLMISC_COMMAND(luaGC, "Force a garbage collector of lua", "")
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(ClientCfg.AllowDebugLua)
{
pIM->luaGarbageCollect();
CLuaManager::getInstance().forceGarbageCollect();
return true;
}
else

View file

@ -37,12 +37,12 @@ public:
public:
uint KeywordsCount;
std::string Action;
std::vector<string> Keywords;
std::vector<std::string> Keywords;
};
CUserCommand (const string &commandName, const ucstring &help, const ucstring &argsHelp);
CUserCommand (const std::string &commandName, const ucstring &help, const ucstring &argsHelp);
void addMode (const string &action, uint numArg, bool infiniteAgr, const std::vector<string> &keywords);
void addMode (const std::string &action, uint numArg, bool infiniteAgr, const std::vector<std::string> &keywords);
// From ICommand
virtual bool execute(const std::string &rawCommandString, const std::vector<std::string> &args, NLMISC::CLog &log, bool quiet, bool human);

View file

@ -838,7 +838,7 @@ void updateBGDownloaderUI()
{
if (LuaBGDSuccessFlag)
{
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchSuccess()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()");
}
}
else
@ -858,19 +858,19 @@ void updateBGDownloaderUI()
}
if (LuaBGDSuccessFlag && bgWindowVisible)
{
LuaBGDSuccessFlag = im->executeLuaScript(toString("bgdownloader:setPatchProgress(%f)", progress));
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript(toString("bgdownloader:setPatchProgress(%f)", progress));
}
// display current priority of the downloader
if (LuaBGDSuccessFlag && bgWindowVisible)
{
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:displayPriority()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:displayPriority()");
}
}
break;
case BGDownloader::TaskResult_Success:
if (LuaBGDSuccessFlag && bgWindowVisible)
{
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchSuccess()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()");
}
// task finished
AvailablePatchs = 0;
@ -887,7 +887,7 @@ void updateBGDownloaderUI()
// error case
if (LuaBGDSuccessFlag && bgWindowVisible)
{
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setPatchError()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchError()");
}
break;
}
@ -900,12 +900,12 @@ void updateBGDownloaderUI()
if (isBGDownloadEnabled())
{
// no necessary patch for now
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setNoNecessaryPatch()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoNecessaryPatch()");
}
else
{
// no download ui
LuaBGDSuccessFlag = im->executeLuaScript("bgdownloader:setNoDownloader()");
LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoDownloader()");
}
}
}
@ -967,9 +967,9 @@ TInterfaceState globalMenu()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nScreenConnecting, nScreenIntro, nScreenServerCrashed;
fromString(pIM->getDefine("screen_connecting"), nScreenConnecting);
fromString(pIM->getDefine("screen_intro"), nScreenIntro);
fromString(pIM->getDefine("screen_crashing"), nScreenServerCrashed);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_connecting"), nScreenConnecting);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_intro"), nScreenIntro);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_crashing"), nScreenServerCrashed);
// SKIP INTRO : Write to the database if we have to skip the intro and write we want to skip further intro to client cfg
if (ClientCfg.SkipIntro)
@ -1004,7 +1004,7 @@ TInterfaceState globalMenu()
Actions.enable(true);
EditActions.enable(true);
LuaBGDSuccessFlag = true;
pIM->reloadAllLuaFileScripts();
CWidgetManager::getInstance()->getParser()->reloadAllLuaFileScripts();
}
#endif
@ -2059,7 +2059,7 @@ public:
{
vector<string> p;
p.push_back(sProc);
pIM->runProcedure(sProc, pCaller, p);
CWidgetManager::getInstance()->runProcedure(sProc, pCaller, p);
CInterfaceExprValue result;
if (CInterfaceExpr::eval(sCond, result))
@ -2136,7 +2136,7 @@ public:
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine =pIM->createGroupInstance("t_mainland", GROUP_LIST_MAINLAND, params);
CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_mainland", GROUP_LIST_MAINLAND, params);
if (pNewLine != NULL)
{
CViewBase *pVBon = pNewLine->getView("online");
@ -2261,7 +2261,7 @@ public:
}
First = false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
return pIM->createGroupInstance(templateName, GROUP_LIST_KEYSET, params);
return CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, GROUP_LIST_KEYSET, params);
}
void addGroupInList(CInterfaceGroup *pNewLine)
@ -2722,7 +2722,7 @@ class CAHScenarioControl : public IActionHandler
params.push_back(pair<string,string>("id", toString(Mainlands[i].Id)));
params.push_back(pair<string,string>("w", "1024"));
params.push_back(pair<string,string>("tooltip", "uiRingFilterShard"));
CInterfaceGroup *toggleGr =pIM->createGroupInstance("label_toggle_button", shardList->getId(), params);
CInterfaceGroup *toggleGr = CWidgetManager::getInstance()->getParser()->createGroupInstance("label_toggle_button", shardList->getId(), params);
shardList->addChild(toggleGr);
// set unicode name
CViewText *shardName = dynamic_cast<CViewText *>(toggleGr->getView("button_text"));

View file

@ -1245,7 +1245,7 @@ void CFarTP::sendReady()
{
// Remove all existing keys and load them back, and load new interface config
pIM->loadKeys();
pIM->hideAllWindows();
CWidgetManager::getInstance()->hideAllWindows();
pIM->loadInterfaceConfig();
}
else

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

@ -315,11 +315,10 @@ class CAHMilkoMenuDoResetInterface : public IActionHandler
// run procedure
vector<string> v;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (mode == "R2TestMode")
pIM->runProcedure ("proc_reset_r2ed_interface", NULL, v);
CWidgetManager::getInstance()->runProcedure ("proc_reset_r2ed_interface", NULL, v);
else
pIM->runProcedure("proc_reset_interface", NULL, v);
CWidgetManager::getInstance()->runProcedure("proc_reset_interface", NULL, v);
}
};
REGISTER_ACTION_HANDLER(CAHMilkoMenuDoResetInterface, "milko_menu_do_reset_interface");

View file

@ -35,7 +35,7 @@
#include "bot_chat_page_dynamic_mission.h"
#include "bot_chat_page_ring_sessions.h"
#include "dbctrl_sheet.h"
#include "ctrl_sheet_selection.h"
#include "nel/gui/ctrl_sheet_selection.h"
#include "nel/gui/interface_expr.h"
#include "nel/gui/group_menu.h"
#include "nel/gui/group_container.h"
@ -743,11 +743,11 @@ static void chooseSheath (ITEMFAMILY::EItemFamily eIF, string sAllSkills)
{
// Choose right sheath
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLwrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLwrite = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLread = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_nb"));
sint32 nNbSheath = (sint32)pNLread->getValue64();
if (nNbSheath == 0) return;
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_active"));
sint32 nActiveSheath = (sint32)pNLread->getValue64();
bool bFound = false;
for (sint32 i = 0; i < ((nNbSheath/2)+1); ++i)
@ -763,7 +763,7 @@ static void chooseSheath (ITEMFAMILY::EItemFamily eIF, string sAllSkills)
while (nSheathToTest >= (INVENTORIES::sheath+nNbSheath)) nSheathToTest -= nNbSheath;
string sPath;
sPath = pIM->getDefine("set_base") + ":" + NLMISC::toString(nSheathToTest) + ":" + pIM->getDefine("set_r") + ":SHEET";
sPath = CWidgetManager::getInstance()->getParser()->getDefine("set_base") + ":" + NLMISC::toString(nSheathToTest) + ":" + CWidgetManager::getInstance()->getParser()->getDefine("set_r") + ":SHEET";
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(sPath);
sint32 sheetid = (sint32)pNLread->getValue64();
CItemSheet *pIS = dynamic_cast<CItemSheet *>(SheetMngr.get(CSheetId(sheetid)));
@ -1080,7 +1080,7 @@ public:
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// start the npc web page
pIM->executeLuaScript("game:startNpcWebPage()", true);
CLuaManager::getInstance().executeLuaScript("game:startNpcWebPage()", true);
}
};
REGISTER_ACTION_HANDLER( CHandlerContextWebPage, "context_web_page");
@ -1305,7 +1305,7 @@ class CSelectItemSheet : public IActionHandler
if (!ctrlSheet) return;
sint selectionGroup = ctrlSheet->getSelectionGroup();
CInterfaceManager *im = CInterfaceManager::getInstance();
const CCtrlSheetSelection &css = im->getCtrlSheetSelection();
const CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *csg = css.getGroup(selectionGroup);
if (csg && csg->isActive())
{
@ -1857,7 +1857,7 @@ public:
if (ClientCfg.Light)
{
vector<string> v;
CInterfaceManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v);
CWidgetManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v);
//CInterfaceManager::getInstance()->launchContextMenuInGame("ui:interface:game_context_menu");
}
@ -2103,7 +2103,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
if ( pE->isPlayer() )
{
// Player => deduce RegionForce & ForceLevel from the database
CCDBNodeLeaf *pDbTargetUid = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_uid") );
CCDBNodeLeaf *pDbTargetUid = NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("target_uid") );
if ( ! pDbTargetUid )
return;
// Hide the target level if the USER is not in PVP FACTION
@ -2121,7 +2121,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
return;
}
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("target_player_level") );
if ( ! pDbPlayerLevel )
return;
sint nLevel = pDbPlayerLevel->getValue32();
@ -2158,13 +2158,13 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
// Set color
if (nForceRegion > 6) nForceRegion = 6;
if (nForceRegion < 1) nForceRegion = 1;
CRGBA col = CInterfaceElement::convertColor(pIM->getDefine("region_force_"+toString(nForceRegion)).c_str());
CRGBA col = CInterfaceElement::convertColor(CWidgetManager::getInstance()->getParser()->getDefine("region_force_"+toString(nForceRegion)).c_str());
pVBR->setColor(col);
// Set texture
if (nLevelForce > 8) nLevelForce = 8;
if (nLevelForce < 1) nLevelForce = 1;
string sTexture = pIM->getDefine("force_level_"+toString(nLevelForce));
string sTexture = CWidgetManager::getInstance()->getParser()->getDefine("force_level_"+toString(nLevelForce));
pVBL->setTexture(sTexture);
// Set tooltip
@ -2227,12 +2227,12 @@ class CAHUpdateCurrentMode : public IActionHandler
sint32 nNewMode = (sint32)eVal.getInteger();
sint32 nModeMinInf, nModeMaxInf, nModeMinLab, nModeMaxLab, nModeMinKey, nModeMaxKey;
fromString(pIM->getDefine("mode_min_info"), nModeMinInf);
fromString(pIM->getDefine("mode_max_info"), nModeMaxInf);
fromString(pIM->getDefine("mode_min_lab"), nModeMinLab);
fromString(pIM->getDefine("mode_max_lab"), nModeMaxLab);
fromString(pIM->getDefine("mode_min_keys"), nModeMinKey);
fromString(pIM->getDefine("mode_max_keys"), nModeMaxKey);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_min_info"), nModeMinInf);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_max_info"), nModeMaxInf);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_min_lab"), nModeMinLab);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_max_lab"), nModeMaxLab);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_min_keys"), nModeMinKey);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_max_keys"), nModeMaxKey);
sint32 nMode = 0;
if ((nNewMode >= nModeMinInf) && (nNewMode <= nModeMaxInf))
@ -2275,14 +2275,14 @@ class CAHUpdateCurrentMode : public IActionHandler
sint32 tmpMode;
// Is NewMode entry active ?
fromString(pIM->getDefine("mode_magic"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_magic"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Magic)) != 0)
bFound = true;
if (!bFound)
{
fromString(pIM->getDefine("mode_combat"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_combat"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Combat)) != 0)
bFound = true;
@ -2290,7 +2290,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_create"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_faber_create"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberCreate)) != 0)
bFound = true;
@ -2298,7 +2298,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_repair"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_faber_repair"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberRepair)) != 0)
bFound = true;
@ -2306,7 +2306,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_refine"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_faber_refine"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberRefine)) != 0)
bFound = true;
@ -2314,7 +2314,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_commerce"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_commerce"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Commerce)) != 0)
bFound = true;
@ -2322,14 +2322,14 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_macros"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_macros"), tmpMode);
if (nNewMode == tmpMode)
bFound = true; // Not in DB !!!
}
if (!bFound)
{
fromString(pIM->getDefine("mode_special_labo"), tmpMode);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("mode_special_labo"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Special)) != 0)
bFound = true;
@ -2747,7 +2747,7 @@ public:
vector<string> vecStr;
vecStr.push_back(procNames[desktop]);
vecStr.push_back(sValue);
pIM->runProcedure(procNames[desktop], NULL, vecStr);
CWidgetManager::getInstance()->runProcedure(procNames[desktop], NULL, vecStr);
}*/
CInterfaceManager *pIM = CInterfaceManager::getInstance();
@ -2773,11 +2773,10 @@ public:
{
_FirstTime = false;
CInterfaceManager *pIM= CInterfaceManager::getInstance();
vector<string> vecStr;
vecStr.push_back("tb_setdesktop");
vecStr.push_back(Params);
pIM->runProcedure("tb_setdesktop", NULL, vecStr);
CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr);
}
else // Not the first time
{
@ -2971,7 +2970,7 @@ public:
// **** Init Screen Aspect Ratio
// 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)
{
// Bkup for cancel
@ -3376,7 +3375,7 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler
ClientCfg.writeDouble("ScreenAspectRatio", ClientCfg.ScreenAspectRatio);
// 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)
{
eb->setFrozen(true);
@ -3387,7 +3386,7 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler
else
{
// 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)
{
eb->setFrozen(false);
@ -3420,7 +3419,7 @@ class CHandlerGameConfigChangeScreenRatioCustom : public IActionHandler
CInterfaceManager *pIM= CInterfaceManager::getInstance();
sint mode= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:SCREEN_RATIO_MODE")->getValue32();
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)
{
// validate the value
@ -3705,7 +3704,7 @@ public:
ucstring str;
fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life");
@ -3722,7 +3721,7 @@ public:
ucstring str;
fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina");
@ -3739,7 +3738,7 @@ public:
ucstring str;
fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap");
@ -3756,7 +3755,7 @@ public:
ucstring str;
fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus");
@ -3786,7 +3785,7 @@ public:
ucstring str= CI18N::get("uittBulkFormat");
strFindReplace(str, "%v", toString(val) );
strFindReplace(str, "%m", toString(maxVal) );
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk");
@ -3799,8 +3798,8 @@ uint32 getMissionTitle(sint32 nSelected)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
if (nSelected < 0)
return 0;
@ -3816,8 +3815,8 @@ void runMissionProc(sint32 nSelected)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
if (nSelected < 0)
return;
@ -3846,8 +3845,8 @@ public:
sint32 nSelected = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:MISSION_SELECTED")->getValue32();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
// If no mission selected or title selected becomes invalid -> search a new title to select
if ((nSelected == -1) || (getMissionTitle(nSelected) == 0))

View file

@ -160,7 +160,7 @@ void CInterfaceHelp::initWindows()
CInterfaceManager *pIM= CInterfaceManager::getInstance();
sint maxHelpWindow;
fromString(pIM->getDefine("MAX_HELP_WINDOW"), maxHelpWindow);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("MAX_HELP_WINDOW"), maxHelpWindow);
// Allow Max 256. More may be a script error...
clamp(maxHelpWindow, 0, 256);
@ -1437,7 +1437,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
{
// Mul item quality by a constant
uint maxAbsorb= item->getQuality();
CCDBNodeLeaf *nodeFactor= NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("player_protect_absorbfactor"), false);
CCDBNodeLeaf *nodeFactor= NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("player_protect_absorbfactor"), false);
if(nodeFactor)
maxAbsorb= maxAbsorb*nodeFactor->getValue32()/100;
@ -3546,7 +3546,7 @@ void setConsoModSuccessTooltip( CDBCtrlSheet *cs )
strFindReplace(ustr, "%modifier", "@{0F0F}"+toString(nodeSM->getValue32())+"@{FFFF}");
// replace the context help that is required.
pIM->setContextHelpText(ustr);
CWidgetManager::getInstance()->setContextHelpText(ustr);
}
}
@ -3568,13 +3568,13 @@ public:
// special tooltip? (pvp outpost and xp catalyzer)
sint specialTTId= getBonusMalusSpecialTT(cs);
if(specialTTId==BONUS_MALUS::XpCatalyser)
pIM->setContextHelpText(CI18N::get("uittXpBonus"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus"));
else if(specialTTId==BONUS_MALUS::OutpostPVPOn)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostOn"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn"));
else if(specialTTId==BONUS_MALUS::OutpostPVPOutOfZone)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone"));
else if(specialTTId==BONUS_MALUS::OutpostPVPInRound)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostInRound"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound"));
else if(specialTTId==BONUS_MALUS::DeathPenalty)
{
CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEATH_XP_MALUS", false);
@ -3582,7 +3582,7 @@ public:
{
ucstring txt = CI18N::get("uittDeathPenalty");
strFindReplace(txt, "%dp", toString((100*node->getValue16())/254));
pIM->setContextHelpText(txt);
CWidgetManager::getInstance()->setContextHelpText(txt);
}
}
// if disabled.
@ -3595,7 +3595,7 @@ public:
str+= CI18N::get("uittAuraDisabled");
// and replace the context help that is required.
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
// else keep the default one
}
@ -3622,7 +3622,7 @@ public:
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index));
if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt))
{
pIM->setContextHelpText(CEntityCL::removeTitleFromName(txt));
CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt));
}
}
};
@ -3668,7 +3668,7 @@ public:
str += toString(minTimeRemaining);
// replace the context help that is required.
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip");
@ -3783,7 +3783,7 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s
if(viewBmp)
{
// texture name in config.xml
viewBmp->setTexture(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(faberType) ));
viewBmp->setTexture(CWidgetManager::getInstance()->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(faberType) ));
}

View file

@ -109,11 +109,11 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(WindowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_display")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display)
{
CClientItemInfo const& itemInfo = getInventory().getItemInfo( ItemSlotId );
@ -199,14 +199,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
// get the dialog stack
CGroupContainer* group = dynamic_cast<CGroupContainer*>( CWidgetManager::getInstance()->getElementFromId(WindowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
@ -336,14 +336,14 @@ void CInterfaceItemEdition::CItemEditionWindow::end()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(windowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
// disable the window
@ -375,14 +375,14 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(windowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
bool textValid = editShort->getActive();
@ -1317,7 +1317,7 @@ class CHandlerActiveSheath : public IActionHandler
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Get the user interface value.
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("ui_set_active") )->getValue32();
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active") )->getValue32();
// Write to the Local Database.
NLGUI::CDBManager::getInstance()->getDbProp( "LOCAL:INVENTORY:ACTIVE_SHEATH" )->setValue32(activeSheath);
@ -1358,7 +1358,7 @@ class CHandlerReceiveActiveSheath : public IActionHandler
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( "LOCAL:INVENTORY:ACTIVE_SHEATH" )->getValue32();
// Write to the Local Database.
NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("ui_set_active") )->setValue32(activeSheath);
NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active") )->setValue32(activeSheath);
}
};
REGISTER_ACTION_HANDLER( CHandlerReceiveActiveSheath, "receive_active_sheath" );

View file

@ -288,8 +288,6 @@ class CActionHandlerProc : public IActionHandler
public:
virtual void execute (CCtrlBase *pCaller, const std::string &params)
{
CInterfaceManager *mngr= CInterfaceManager::getInstance();
// split the parameters
vector<string> paramList;
splitString(params, "|", paramList);
@ -297,7 +295,7 @@ public:
return;
// execute the procedure
mngr->runProcedure(paramList[0], pCaller, paramList);
CWidgetManager::getInstance()->runProcedure(paramList[0], pCaller, paramList);
}
};
REGISTER_ACTION_HANDLER (CActionHandlerProc, "proc");
@ -436,7 +434,7 @@ class CActionHandlerAddLink : public IActionHandler
CInterfaceLink *il = new CInterfaceLink;
il->init(targetsVect, expr, ah, ahparam, ahcond, parentGroup);
CInterfaceManager *im = CInterfaceManager::getInstance();
im->addLink(il, id);
CWidgetManager::getInstance()->getParser()->addLink(il, id);
il->update();
}
};
@ -455,7 +453,7 @@ class CActionHandlerRemoveLink : public IActionHandler
return;
}
CInterfaceManager *im = CInterfaceManager::getInstance();
im->removeLink(id);
CWidgetManager::getInstance()->getParser()->removeLink(id);
}
};
REGISTER_ACTION_HANDLER (CActionHandlerRemoveLink, "remove_link");
@ -491,7 +489,7 @@ CInterfaceGroup *createMenuColorWidget(const string &colDbEntry,
make_pair(string("tooltip"), toolTipTextID),
make_pair(string("ccd_title"), ccdTitle),
};
return im->createGroupInstance("menu_color_widget", "", params, 3);
return CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_color_widget", "", params, 3);
}
// ***************************************************************************
@ -930,9 +928,8 @@ class CAHAnimStart : public IActionHandler
public:
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string sAnim = getParam(Params, "anim");
pIM->startAnim(sAnim);
CWidgetManager::getInstance()->startAnim(sAnim);
}
};
REGISTER_ACTION_HANDLER (CAHAnimStart, "anim_start");
@ -943,9 +940,8 @@ class CAHAnimStop : public IActionHandler
public:
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string sAnim = getParam(Params, "anim");
pIM->stopAnim(sAnim);
CWidgetManager::getInstance()->stopAnim(sAnim);
}
};
REGISTER_ACTION_HANDLER (CAHAnimStop, "anim_stop");

View file

@ -1652,7 +1652,7 @@ public:
else
strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK"));
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip");

View file

@ -447,9 +447,9 @@ class CAHNextSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_nb"));
sint64 nVal = pNLCurSetRead->getValue64() - INVENTORIES::sheath1;
sint64 nMax = pNLNbSet->getValue64();
nVal++;
@ -471,9 +471,9 @@ class CAHPreviousSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_nb"));
sint64 nVal = pNLCurSetRead->getValue64() - INVENTORIES::sheath1;
sint64 nMax = pNLNbSet->getValue64();
if (nVal == 0) nVal = nMax;
@ -495,8 +495,8 @@ class CAHSetSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("set_nb"));
sint64 nVal;
fromString(Params, nVal);
nVal -= INVENTORIES::sheath1;

View file

@ -524,7 +524,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
if(mpBuild.RequirementType==CMPBuild::ItemPartReq)
{
// texture name in config.xml
viewBmp->setTexture(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(mpBuild.FaberTypeRequired) ));
viewBmp->setTexture(CWidgetManager::getInstance()->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(mpBuild.FaberTypeRequired) ));
}
else if(mpBuild.RequirementType==CMPBuild::SpecificItemReq)
{

View file

@ -41,7 +41,7 @@ void CBotChatPagePlayerGift::begin()
NLGUI::CDBManager::getInstance()->getDbProp(BOT_CHAT_BASE_DB_PATH ":PLAYER_GIFT")->setValue32(0);
// clear money proposal value
CCDBNodeLeaf *moneyProposal = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("money_proposal"));
CCDBNodeLeaf *moneyProposal = NLGUI::CDBManager::getInstance()->getDbProp(CWidgetManager::getInstance()->getParser()->getDefine("money_proposal"));
if (moneyProposal) moneyProposal->setValue64(0);
// clear 'accept' button

View file

@ -208,7 +208,7 @@ void CBotChatPageTrade::begin()
if(dbPriceMin) dbPriceMin->setValue32(0);
if(dbPriceMax)
{
fromString(pIM->getDefine("bot_chat_filter_max_price"), value);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("bot_chat_filter_max_price"), value);
dbPriceMax->setValue32(value);
}
@ -218,7 +218,7 @@ void CBotChatPageTrade::begin()
if(dbQualityMin) dbQualityMin->setValue32(0);
if(dbQualityMax)
{
fromString(pIM->getDefine("bot_chat_filter_max_quality"), value);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("bot_chat_filter_max_quality"), value);
dbQualityMax->setValue32(value);
}
@ -1688,7 +1688,7 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default
// setup icon according to pvp clan
CInterfaceManager *pIM= CInterfaceManager::getInstance();
factionName = NLMISC::toLower(factionName);
string factionIcon= pIM->getDefine(toString("faction_icon_%s", factionName.c_str()));
string factionIcon= CWidgetManager::getInstance()->getParser()->getDefine(toString("faction_icon_%s", factionName.c_str()));
CViewBitmap *vBmp= dynamic_cast<CViewBitmap*>(fpGroup->getView("unit_price:item_price:icone"));
if(vBmp) vBmp->setTexture(factionIcon);
vBmp= dynamic_cast<CViewBitmap*>(fpGroup->getView("total_price:item_price:icone"));
@ -2079,7 +2079,7 @@ std::string CBotChatPageTrade::getItemSheetNameForItemType(ITEM_TYPE::TItemType
itemTypeDef+= ITEM_TYPE::toString(it);
// return empty string if not found
return pIM->getDefine(itemTypeDef);
return CWidgetManager::getInstance()->getParser()->getDefine(itemTypeDef);
}
@ -2249,7 +2249,7 @@ class CAHConfirmTrade : public IActionHandler
case 1: enableResale = true; break;
default: // 2: comes only from Enter of Shift+Enter key from an edit box or in the modal window
{
const NLGUI::CEventDescriptorKey& keyEvent = CInterfaceManager::getInstance()->getLastEventKeyDesc();
const NLGUI::CEventDescriptorKey& keyEvent = CWidgetManager::getInstance()->getLastKeyEvent();
enableResale = ! keyEvent.getKeyShift();
}
}
@ -2426,10 +2426,8 @@ class CHandlerBotChatTTItemType : public IActionHandler
public:
void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// \todo yoyo: for now disable tooltip
pIM->setContextHelpText(ucstring());
CWidgetManager::getInstance()->setContextHelpText(ucstring());
}
};
REGISTER_ACTION_HANDLER(CHandlerBotChatTTItemType, "botchat_tt_item_type");

View file

@ -108,7 +108,7 @@ static CInterfaceGroup *parseCommandTag(ucstring &line)
make_pair(string("ah"), params[2]),
make_pair(string("ah_params"), params[3])
};
return CInterfaceManager::getInstance()->createGroupInstance(params[0], "", uiTemplateParams, 4);
return CWidgetManager::getInstance()->getParser()->createGroupInstance(params[0], "", uiTemplateParams, 4);
}
static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CViewText *text)

View file

@ -119,7 +119,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId)
params.insert(params.end(), desc.ChatTemplateParams.begin(), desc.ChatTemplateParams.end());
// create a chat container from the template
CInterfaceGroup *chatGroup = im->createGroupInstance(chatTemplate, "ui:interface", params);
CInterfaceGroup *chatGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(chatTemplate, "ui:interface", params);
if (chatGroup)
{
_Chat = dynamic_cast<CGroupContainer *>(chatGroup);
@ -554,7 +554,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
// on a new message, change the Tab color
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CRGBA newMsgColor= CRGBA::stringToRGBA(pIM->getDefine("chat_group_tab_color_newmsg").c_str());
CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str());
ucstring newmsg = msg;
ucstring prefix;
@ -754,7 +754,7 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
std::string templateName = "contact_chat_friend";
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceGroup *pIG = pIM->createGroupInstance(templateName, "ui:interface", properties);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, "ui:interface", properties);
if (!pIG) return NULL;
CGroupContainer *pGC = dynamic_cast<CGroupContainer *>(pIG);
if (!pGC)
@ -1422,7 +1422,7 @@ public:
CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC");
// force a refresh of the ui
im->executeLuaScript("CharTracking:forceRefresh()");
CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()");
}
}
};

View file

@ -1,95 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "ctrl_sheet_selection.h"
#include "interface_manager.h"
//=============================================================
void CSheetSelectionGroup::setTexture(const std::string &texName)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIndex = rVR.getTextureIdFromName(texName);
rVR.getTextureSizeFromId(_TextureIndex, _TextureWidth, _TextureHeight);
}
//=============================================================
void CCtrlSheetSelection::deleteGroups()
{
_Groups.clear();
_GroupNameToIndex.clear();
}
//=============================================================
sint CCtrlSheetSelection::addGroup(const std::string &name)
{
if (getGroupIndex(name) != -1)
{
nlwarning("<CCtrlSheetSelection::addGroup> Group inserted twice : %s", name.c_str());
return - 1;
}
_Groups.push_back(CSheetSelectionGroup(name));
_GroupNameToIndex[name] = (uint)_Groups.size() - 1;
return (sint)_Groups.size() - 1;
}
//=============================================================
sint CCtrlSheetSelection::getGroupIndex(const std::string &name) const
{
TGroupNameToIndex::const_iterator it = _GroupNameToIndex.find(name);
return it == _GroupNameToIndex.end() ? - 1 : (sint) it->second;
}
//=============================================================
CSheetSelectionGroup *CCtrlSheetSelection::getGroup(const std::string &name)
{
return getGroup(getGroupIndex(name));
}
//=============================================================
const CSheetSelectionGroup *CCtrlSheetSelection::getGroup(const std::string &name) const
{
return getGroup(getGroupIndex(name));
}
//=============================================================
CSheetSelectionGroup *CCtrlSheetSelection::getGroup(uint index)
{
if (index > _Groups.size())
{
// nlwarning("<CCtrlSheetSelection::getGroup> invalid group index");
return NULL;
}
return &_Groups[index];
}
//=============================================================
const CSheetSelectionGroup *CCtrlSheetSelection::getGroup(uint index) const
{
if (index > _Groups.size())
{
nlwarning("<CCtrlSheetSelection::getGroup> invalid group index");
return NULL;
}
return &_Groups[index];
}

View file

@ -1,87 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_SHEET_CTRL_SELECTION_H
#define CL_SHEET_CTRL_SELECTION_H
class CDBCtrlSheet;
namespace NLGUI
{
class IActionHandler;
}
/** Infos about a selection group
*/
class CSheetSelectionGroup
{
public:
CSheetSelectionGroup(std::string name) : _Name(name), _Active(false), _TextureIndex(-1), _Color(NLMISC::CRGBA::White), _GlobalColorEnabled(true) {}
void setTexture(const std::string &texName);
sint32 getTextureIndex() const { return _TextureIndex; }
sint32 getTextureWidth() const { return _TextureWidth; }
sint32 getTextureHeight() const { return _TextureHeight; }
void setColor(NLMISC::CRGBA color) { _Color = color; }
NLMISC::CRGBA getColor() const { return _Color; }
void setActive(bool active) { _Active = active; }
bool isActive() const { return _Active; }
const std::string &getName() const { return _Name; }
void enableGlobalColor(bool enabled) { _GlobalColorEnabled = enabled; }
bool isGlobalColorEnabled() const { return _GlobalColorEnabled; }
private:
std::string _Name;
bool _Active;
sint32 _TextureIndex; // index for the selection texture
sint32 _TextureWidth;
sint32 _TextureHeight;
NLMISC::CRGBA _Color; // color that modulate the texture of selection
bool _GlobalColorEnabled;
};
/** Class to manage selection of sheet.
* Sheet are managed by groups, identified by their ID.
*/
class CCtrlSheetSelection
{
public:
// Add a group, and returns its index, or -1 if already created.
sint addGroup(const std::string &name);
// Get a group by its name (must exist)
CSheetSelectionGroup *getGroup(const std::string &name);
const CSheetSelectionGroup *getGroup(const std::string &name) const;
// Get a group by its index
CSheetSelectionGroup *getGroup(uint index);
const CSheetSelectionGroup *getGroup(uint index) const;
// Get the index of a group from its name, return -1 if not a group
sint getGroupIndex(const std::string &name) const;
// Deactivate all groups
void deactivateAll();
// delete all groups
void deleteGroups();
private:
//
typedef std::vector<CSheetSelectionGroup> TGroupVect;
typedef std::map<std::string, uint> TGroupNameToIndex;
private:
TGroupVect _Groups;
TGroupNameToIndex _GroupNameToIndex;
};
#endif

View file

@ -389,7 +389,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
prop = (char*) xmlGetProp( cur, (xmlChar*)"selection_group" );
if (prop)
{
const CCtrlSheetSelection &css = CInterfaceManager::getInstance()->getCtrlSheetSelection();
const CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
_SheetSelectionGroup = css.getGroupIndex((const char *) prop);
if (_SheetSelectionGroup == -1)
{
@ -2518,7 +2518,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
// draw selection border if this sheet is selected
if (_SheetSelectionGroup != -1) // is this sheet selectable ?
{ // yes, check if it is selected
const CCtrlSheetSelection &css = pIM->getCtrlSheetSelection();
const CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *ssg = css.getGroup(_SheetSelectionGroup);
if (ssg)
{
@ -2985,7 +2985,7 @@ void CDBCtrlSheet::setCurrSelection(CDBCtrlSheet *selected)
const std::string &CDBCtrlSheet::getSelectionGroupAsString() const
{
CInterfaceManager *im = CInterfaceManager::getInstance();
const CCtrlSheetSelection &css = im->getCtrlSheetSelection();
const CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *csg = css.getGroup(_SheetSelectionGroup);
static const string emptyStr;
return csg ? csg->getName() : emptyStr;
@ -4176,7 +4176,7 @@ void CDBCtrlSheet::initArmourColors()
{
_ArmourColor[col] = CRGBA::White;
std::string defineName= "armour_color_" + toString(col);
std::string colVal= pIM->getDefine(defineName);
std::string colVal= CWidgetManager::getInstance()->getParser()->getDefine(defineName);
if(!colVal.empty())
_ArmourColor[col] = convertColor(colVal.c_str());
}

View file

@ -226,7 +226,7 @@ void CDBGroupBuildPhrase::setupBuildSentence()
if(_GroupValid)
{
sint rootTextMaxw;
fromString(pIM->getDefine("phrase_build_root_info_maxw"), rootTextMaxw);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("phrase_build_root_info_maxw"), rootTextMaxw);
_MainWords[0].InfoView->setLineMaxW(rootTextMaxw);
}
@ -1194,8 +1194,8 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase)
{
// get define, and verify data
uint numWeaponSkill;
fromString(pIM->getDefine("phrase_max_restrict_combat"), numWeaponSkill);
string strWeaponSkill= pIM->getDefine("phrase_def_skill_restrict_combat");
fromString(CWidgetManager::getInstance()->getParser()->getDefine("phrase_max_restrict_combat"), numWeaponSkill);
string strWeaponSkill= CWidgetManager::getInstance()->getParser()->getDefine("phrase_def_skill_restrict_combat");
vector<string> weaponSkillList;
splitString(strWeaponSkill, " ", weaponSkillList);
nlassert(weaponSkillList.size()==numWeaponSkill);

View file

@ -110,7 +110,7 @@ CInterfaceGroup *CDBGroupListSheetIconPhrase::createSectionGroup(const std::str
tempVec[0].first="id"; tempVec[0].second= igName;
// make parent to me
CInterfaceGroup *pIG = pIM->createGroupInstance(LSP_SECTION_TEMPLATE, getId(), tempVec);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getParser()->createGroupInstance(LSP_SECTION_TEMPLATE, getId(), tempVec);
pIG->setParent (this);
addGroup (pIG);

View file

@ -142,7 +142,7 @@ CInterfaceGroup *CDBGroupListSheetTextPhrase::createSectionGroup(const std::str
tempVec[0].first="id"; tempVec[0].second= igName;
// make parent to the list, not me
CInterfaceGroup *pIG = pIM->createGroupInstance(LSP_SECTION_TEMPLATE, _List->getId(), tempVec);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getParser()->createGroupInstance(LSP_SECTION_TEMPLATE, _List->getId(), tempVec);
pIG->setParent (_List);
_List->addGroup (pIG);

View file

@ -64,7 +64,7 @@ void CFlyingTextManager::initInGame()
string id = "in_scene_flying_text_"+toString (i);
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *groupInfo = pIM->createGroupInstance ("in_scene_flying_text",
CInterfaceGroup *groupInfo = CWidgetManager::getInstance()->getParser()->createGroupInstance ("in_scene_flying_text",
"ui:interface", templateParams);
// if ok
if(groupInfo)
@ -92,7 +92,7 @@ void CFlyingTextManager::initInGame()
}
// misc
fromString(pIM->getDefine("in_scene_flying_char_offsetx"), _CharacterWindowOffsetX);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("in_scene_flying_char_offsetx"), _CharacterWindowOffsetX);
}
// ***************************************************************************

View file

@ -127,7 +127,7 @@ void CGroupHTMLCS::getParameters (std::vector<CParameter> &parameters, bool enco
{
webIgReady = true;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->executeLuaScript("game:onWebIgReady()");
CLuaManager::getInstance().executeLuaScript("game:onWebIgReady()");
}
// For each line

View file

@ -56,10 +56,11 @@ void contextHelp (const std::string &name)
{
string defineTarget = name+"_"+toString(index)+"_target";
string defineUrl = name+"_"+toString(index)+"_url";
if (pIM->isDefineExist(defineTarget) && pIM->isDefineExist(defineUrl))
if ( CWidgetManager::getInstance()->getParser()->isDefineExist(defineTarget) &&
CWidgetManager::getInstance()->getParser()->isDefineExist(defineUrl))
{
string target = pIM->getDefine(defineTarget);
string url = pIM->getDefine(defineUrl);
string target = CWidgetManager::getInstance()->getParser()->getDefine(defineTarget);
string url = CWidgetManager::getInstance()->getParser()->getDefine(defineUrl);
CInterfaceElement *elementTarget = CWidgetManager::getInstance()->getElementFromId(target);
if (elementTarget && elementTarget->getActive())
@ -176,12 +177,12 @@ void CGroupInSceneBubbleManager::alignMessagePopup (vector<CPopup> &rList, bool
sint32 offsetY;
if (bCenter)
{
fromString(pIM->getDefine("popup_pos_y_center"), offsetY);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("popup_pos_y_center"), offsetY);
offsetY = pRoot->getHReal() - offsetY;
offsetY -= rList[i].Group->getH();
}
else
fromString(pIM->getDefine("popup_pos_y"), offsetY);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("popup_pos_y"), offsetY);
rList[i].Group->setY(offsetY);
rList[i].Group->invalidateCoords();
@ -228,7 +229,7 @@ void CGroupInSceneBubbleManager::init ()
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("3dbulle_L",
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("3dbulle_L",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -508,7 +509,7 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t
templateParams.push_back (std::pair<std::string,std::string>("skillid", toString(skillId)));
templateParams.push_back (std::pair<std::string,std::string>("delta", toString(delta)));
CInterfaceGroup *group = pIM->createGroupInstance ("skill_popup",
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("skill_popup",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -574,7 +575,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("message_popup",
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("message_popup",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -623,7 +624,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message,
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("message_popup_center",
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("message_popup_center",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -695,7 +696,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance (templateName+v+h,
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName+v+h,
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -896,7 +897,7 @@ void CGroupInSceneBubbleManager::dynChatOpen (uint32 nBotUID, uint32 nBotName, c
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("dyn_3dbulle_L", "ui:interface", templateParams);
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("dyn_3dbulle_L", "ui:interface", templateParams);
if (group == NULL)
{
nlwarning("cannot create dyn_3dbulle_L");
@ -1009,7 +1010,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("webig_3dbulle_L", "ui:interface", templateParams);
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance ("webig_3dbulle_L", "ui:interface", templateParams);
if (group == NULL)
{
nlwarning("cannot create webig_3dbulle_L");

View file

@ -282,10 +282,10 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
// Some constants
sint barHeight, barSpace, textH;
fromString(pIM->getDefine("in_scene_user_info_bar_h"), barHeight);
fromString(pIM->getDefine("in_scene_user_info_bar_space"), barSpace);
fromString(pIM->getDefine("in_scene_user_info_text_h"), textH);
fromString(pIM->getDefine("in_scene_user_bar_length"), CGroupInSceneUserInfo::_BatLength);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("in_scene_user_info_bar_h"), barHeight);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("in_scene_user_info_bar_space"), barSpace);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("in_scene_user_info_text_h"), textH);
fromString(CWidgetManager::getInstance()->getParser()->getDefine("in_scene_user_bar_length"), CGroupInSceneUserInfo::_BatLength);
// Build the bars
uint barCount = 0;
@ -1175,7 +1175,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::newGroupInScene(const std::string
{
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
groupInfo = CInterfaceManager::getInstance()->createGroupInstance ( templateName,
groupInfo = CWidgetManager::getInstance()->getParser()->createGroupInstance ( templateName,
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
}

View file

@ -426,7 +426,7 @@ class CHandlerRunQuickHelp : public IActionHandler
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Get the quick help radio buttons base id
string buttonId = pIM->getDefine("quick_help_buttons");
string buttonId = CWidgetManager::getInstance()->getParser()->getDefine("quick_help_buttons");
if (!buttonId.empty())
{
// Get the button id

View file

@ -373,7 +373,7 @@ void CGroupSkills::createAllTreeNodes()
// create the template
tempVec[0].first="id"; tempVec[0].second= pNode->Id;
tempVec[1].first="skillid"; tempVec[1].second= NLMISC::toString(i);
CInterfaceGroup *pIG = pIM->createGroupInstance(_TemplateSkill, getId() + ":" + WIN_TREE_LIST, tempVec);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getParser()->createGroupInstance(_TemplateSkill, getId() + ":" + WIN_TREE_LIST, tempVec);
if (pIG == NULL)
nlwarning("error");
// Set Skill Name

View file

@ -817,7 +817,7 @@ class CAHGuildSheetOpen : public IActionHandler
vector< pair<string, string> > vParams;
vParams.push_back(vector< pair<string, string> >::value_type("id", templateId));
CInterfaceGroup *pLine = NULL;
pLine = pIM->createGroupInstance (TEMPLATE_GUILD_MEMBER, LIST_GUILD_MEMBERS, vParams);
pLine = CWidgetManager::getInstance()->getParser()->createGroupInstance (TEMPLATE_GUILD_MEMBER, LIST_GUILD_MEMBERS, vParams);
if (pLine == NULL) continue;
// Set name

View file

@ -764,10 +764,10 @@ void CInterfaceConfig::streamToDataBase (NLMISC::IStream &f, uint32 uiDbSaveVers
defVerId[i]='_';
}
// check if exist
if(pIM->isDefineExist(defVerId))
if( CWidgetManager::getInstance()->getParser()->isDefineExist(defVerId))
{
uint32 dbVer;
fromString(pIM->getDefine(defVerId), dbVer);
fromString(CWidgetManager::getInstance()->getParser()->getDefine(defVerId), dbVer);
// if the version in the file is older than the version this db want, abort read
if(uiDbSaveVersion<dbVer)
wantRead= false;

View file

@ -988,7 +988,7 @@ static DECLARE_INTERFACE_USER_FCT(getBotChatBuyFilterMPIcon)
}
CInterfaceManager *pIM= CInterfaceManager::getInstance();
result.setString(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(RM_FABER_TYPE::TRMFType(args[0].getInteger())) ));
result.setString(CWidgetManager::getInstance()->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(RM_FABER_TYPE::TRMFType(args[0].getInteger())) ));
return true;
}

View file

@ -22,7 +22,7 @@
#include "../sheet_manager.h"
#include "nel/gui/interface_expr.h"
#include "dbctrl_sheet.h"
#include "ctrl_sheet_selection.h"
#include "nel/gui/ctrl_sheet_selection.h"
#include "dbgroup_list_sheet.h"
#include "interface_manager.h"
#include "sbrick_manager.h"
@ -541,11 +541,11 @@ static DECLARE_INTERFACE_USER_FCT(isRoomLeftFor)
CInterfaceManager *im = CInterfaceManager::getInstance();
// see if there is room in the bags
// get the number of bags
std::string nbBagPath = im->getDefine("bag_nb");
std::string nbBagPath = CWidgetManager::getInstance()->getParser()->getDefine("bag_nb");
CCDBNodeLeaf *prop = NLGUI::CDBManager::getInstance()->getDbProp(nbBagPath);
if (!prop) return false;
uint nbItemInBags = 8 * (uint) prop->getValue32(); // there are 8 item per bag
std::string bagsPath = im->getDefine("bag");
std::string bagsPath = CWidgetManager::getInstance()->getParser()->getDefine("bag");
if (bagsPath.empty()) return false;
uint k = 0;
for(k = 0; k < nbItemInBags; ++k)
@ -581,7 +581,7 @@ static DECLARE_INTERFACE_USER_FCT(isRoomLeftFor)
for(k = 0; k < numArmorSlots; ++k)
{
std::string dbPath = im->getDefine(armourInfos[k].DefineName);
std::string dbPath = CWidgetManager::getInstance()->getParser()->getDefine(armourInfos[k].DefineName);
if (dbPath.empty()) return false;
CCDBNodeLeaf *armorProp = NLGUI::CDBManager::getInstance()->getDbProp(dbPath + ":SHEET");
if (!armorProp) return false;
@ -609,7 +609,7 @@ static DECLARE_INTERFACE_USER_FCT(getSelectionGroupNameFromId)
if (args.size() != 1) return false;
if (!args[0].toInteger()) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CCtrlSheetSelection &css = im->getCtrlSheetSelection();
CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
CSheetSelectionGroup *csg = css.getGroup((uint) args[0].getInteger());
if (csg) result.setString(csg->getName());
else result.setString("");
@ -625,7 +625,7 @@ static DECLARE_INTERFACE_USER_FCT(getSelectionGroupIdFromName)
if (args.size() != 1) return false;
if (!args[0].toString()) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CCtrlSheetSelection &css = im->getCtrlSheetSelection();
CCtrlSheetSelection &css = CWidgetManager::getInstance()->getParser()->getCtrlSheetSelection();
result.setInteger(css.getGroupIndex(args[0].getString().c_str()));
return true;
}

File diff suppressed because it is too large Load diff

View file

@ -35,8 +35,8 @@
#include "nel/gui/view_renderer.h"
// InterfaceV3
#include "interface_parser.h"
#include "ctrl_sheet_selection.h"
#include "nel/gui/interface_parser.h"
#include "nel/gui/ctrl_sheet_selection.h"
#include "nel/gui/interface_options.h"
#include "interface_config.h"
#include "interface_pointer.h"
@ -51,6 +51,8 @@
#include "../ingame_database_manager.h"
#include "nel/gui/lua_manager.h"
//the network database node
extern CCDBSynchronised IngameDbMngr;
@ -80,7 +82,7 @@ namespace NLGUI
* \author Nevrax France
* \date 2002
*/
class CInterfaceManager : public CInterfaceParser, public NLGUI::IInputEventListener
class CInterfaceManager : public NLGUI::CInterfaceParser::ISetupOptionCallbackClass, public NLGUI::IInputEventListener
{
public:
@ -117,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 ();
@ -146,6 +141,8 @@ public:
void setInGame( bool i );
bool isInGame() const { return _InGame; }
void initLUA();
/// initialize the whole login interface
void initLogin();
@ -233,14 +230,6 @@ public:
void addServerID (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL);
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
/// Enable/Disable window movement
@ -266,15 +255,6 @@ public:
/// Handle The Event. return true if the interfaceManager catch it and if must not send to the Game Action Manager
bool handleEvent (const NLGUI::CEventDescriptor &eventDesc);
bool handleMouseMoveEvent( const NLGUI::CEventDescriptor &eventDesc );
// execute a procedure. give a list of parameters. NB: the first param is the name of the proc (skipped)...
void runProcedure(const std::string &procName, CCtrlBase *pCaller, const std::vector<std::string> &paramList);
// replace an action in a procedure (if possible)
void setProcedureAction(const std::string &procName, uint actionIndex, const std::string &ah, const std::string &params);
// Execute a anim
void startAnim(const std::string &animId);
void stopAnim(const std::string &animId);
// InGame ContextMenu
void launchContextMenuInGame (const std::string &nameOfCM);
@ -284,12 +264,6 @@ public:
* Draw views
*/
void drawViews (NL3D::UCamera camera);
void drawAutoAdd ();
void drawContextHelp ();
//void drawContextMenu ();
/// Update all the elements
void updateAllLocalisedElements ();
// display a debug info
void displayDebugInfo(const ucstring &str, TSystemInfoMode mode = InfoMsg);
@ -329,17 +303,6 @@ public:
*/
bool getCurrentValidMessageBoxOnOk(std::string &ahOnOk, const std::string &masterGroup="ui:interface");
/// force disable the context help
void disableContextHelp();
/// force disable the context help, if it is issued from the given control
void disableContextHelpForControl(CCtrlBase *pCtrl);
/// for ContextHelp action handler only: set the result name
void setContextHelpText(const ucstring &text);
void setContextHelpActive(bool active);
bool isMouseOverWindow() const {return _MouseOverWindow;}
// Modes
void setMode(uint8 newMode);
uint8 getMode() const { return _CurrentMode; }
@ -397,23 +360,13 @@ public:
/// \name LUA
// @{
/// Execute a lua script (smallScript for speed optimisation, see lua_helper). return false if parse/execute error (warning/sysinfo displayed)
bool executeLuaScript(const std::string &luaScript, bool smallScript= false);
/// Reload all LUA scripts inserted through <lua>
void reloadAllLuaFileScripts();
/// For debug: dump in the sysinfo and nlwarning state of lua. detail range from 0 to 2 (clamped).
void dumpLuaState(uint detail);
/// For debug: force a garbage collector
void luaGarbageCollect();
// @}
// Get the list of InGame XML Interface files, with any AddOn ones
static std::vector<std::string> getInGameXMLInterfaceFiles();
// hide all the windows
void hideAllWindows();
void hideAllNonSavableWindows();
/// \name Action Counter sync
// @{
@ -457,14 +410,9 @@ public:
return 0;
}
// Description of the last key event that called an action handler
const NLGUI::CEventDescriptorKey& getLastEventKeyDesc() const { return _LastEventKeyDesc; }
void notifyMailAvailable();
void notifyForumUpdated();
void updateTooltipCoords();
/** Returns a human readable timestamp with the given format.
*/
static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");
@ -473,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:
@ -601,6 +543,8 @@ public:
NLMISC::CCDBNodeLeaf *_DB_UI_DUMMY_PREREQUISIT_VALID;
NLMISC::CCDBNodeLeaf *_DB_UI_DUMMY_FACTION_TYPE;
void updateDesktops( uint32 newScreenW, uint32 newScreenH );
private:
NLMISC::CCDBNodeLeaf *_CheckMailNode;
@ -625,25 +569,13 @@ private:
/// Constructor
CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext );
CInterfaceManager();
///the singleton's instance
static CInterfaceManager* _Instance;
NLMISC::CCDBNodeLeaf *_DescTextTarget;
bool _MouseOverWindow;
// Context Help
bool _ContextHelpActive;
//CCtrlBasePtr _CurCtrlContextHelp;
//Delay before displaying ContextHelp on a ctrl having wantInstantContextHelp set to false (in seconds)
float _MaxTimeStopingContextHelp;
sint _LastXContextHelp;
sint _LastYContextHelp;
ucstring _ContextHelpText;
CCtrlBase *getNewContextHelpCtrl();
/// Current waiting id and string from server
struct SIDStringWaiter
{
@ -658,12 +590,6 @@ private:
uint32 _ScreenW, _ScreenH; // Change res detection
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
// List of active Anims
std::vector<CInterfaceAnim*> _ActiveAnims;
bool isControlInWindow (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd);
uint getDepth (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd);
// Modes
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
uint8 _CurrentMode;
@ -688,10 +614,6 @@ private:
NLMISC::CCDBNodeLeaf *_WarningColor;
NLMISC::CCDBNodeLeaf *_ErrorColor;
void drawOverExtendViewText();
CInterfaceGroup *getWindowForActiveMasterGroup(const std::string &windowName);
CDBLandmarkObs _LandmarkObs;
/// \name LUA
@ -710,9 +632,6 @@ private:
// Item Carac requirement
sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS];
// Description of the last key event that called an action handler
NLGUI::CEventDescriptorKey _LastEventKeyDesc;
// observers for copying database branch changes
CServerToLocalAutoCopy ServerToLocalAutoCopyInventory;
CServerToLocalAutoCopy ServerToLocalAutoCopyExchange;
@ -720,32 +639,10 @@ private:
CServerToLocalAutoCopy ServerToLocalAutoCopySkillPoints;
CServerToLocalAutoCopy ServerToLocalAutoCopyDMGift;
// move windows according to new screen size
void moveAllWindowsToNewScreenSize(sint32 newScreenW, sint32 newScreenH, bool fixCurrentUI);
void getNewWindowCoordToNewScreenSize(sint32 &x, sint32 &y, sint32 w, sint32 h, sint32 newW, sint32 newH) const;
// 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);
// Internal : adjust a tooltip with respect to its parent. Returns the number of coordinate that were clamped
// against the screen border
uint adjustTooltipPosition(CCtrlBase *newCtrl,
CInterfaceGroup *win,
THotSpot ttParentRef,
THotSpot ttPosRef,
sint32 xParent,
sint32 yParent,
sint32 wParent,
sint32 hParent
);
// Update tooltip coordinate if they need to be (getInvalidCoords() returns a value != 0)
void updateTooltipCoords(CCtrlBase *newCtrl);
NL3D::UDriver *driver;
NL3D::UTextContext *textcontext;
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;
};
#endif // NL_INTERFACE_MANAGER_H

View file

@ -38,6 +38,7 @@ using namespace NLMISC;
extern CEntityAnimationManager *EAM;
NLMISC_REGISTER_OBJECT(CInterfaceOptions, CMissionIconList, std::string, "mission_icons");
// ***************************************************************************
bool CMissionIconList::parse(xmlNodePtr cur)
@ -90,7 +91,9 @@ bool CMissionIconList::parse(xmlNodePtr cur)
// ***************************************************************************
COptionsAnimationSet::COptionsAnimationSet()
NLMISC_REGISTER_OBJECT(CInterfaceOptions, COptionsAnimationSet, std::string, "animation_set");
COptionsAnimationSet::COptionsAnimationSet( const TCtorParam &param ) :
CInterfaceOptions( param )
{
AnimationSet= NULL;
}

View file

@ -26,6 +26,8 @@ using namespace NLGUI;
class CMissionIconList : public CInterfaceOptions
{
public:
CMissionIconList( const TCtorParam &param ) : CInterfaceOptions( param ){}
~CMissionIconList(){}
virtual bool parse (xmlNodePtr cur);
sint32 getBackTexID(uint index) const { return index >= IconBackTexID.size() ? -1 : IconBackTexID[index]; }
sint32 getTexID(uint index) const { return index >= IconTexID.size() ? -1 : IconTexID[index]; }
@ -40,7 +42,7 @@ private:
class COptionsAnimationSet : public CInterfaceOptions
{
public:
COptionsAnimationSet();
COptionsAnimationSet( const TCtorParam &/* param */ );
// see code for important release note
virtual ~COptionsAnimationSet();
virtual bool parse (xmlNodePtr cur);

File diff suppressed because it is too large Load diff

View file

@ -1,375 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RZ_INTERFACE_PARSER_H
#define RZ_INTERFACE_PARSER_H
#include "nel/misc/types_nl.h"
#include "nel/3d/u_texture.h"
#include "ctrl_sheet_selection.h"
#include "nel/gui/interface_link.h"
#include "nel/misc/smart_ptr.h"
#include "game_share/brick_types.h"
#include "nel/gui/lua_helper.h"
#include "nel/gui/widget_manager.h"
using namespace NLGUI;
namespace NLGUI
{
class CInterfaceElement;
class CInterfaceGroup;
class CInterfaceOptions;
class CInterfaceLink;
class CCtrlBase;
class CGroupList;
class CGroupContainer;
class CInterfaceAnim;
class CViewPointer;
}
class CBrickJob;
// ***************************************************************************
/**
* class managing the interface parsing
* \author Matthieu 'TrapII' Besson
* \author Nevrax France
* \date 2002
*/
// this is the base class for CInterfaceManager
class CInterfaceParser : public IParser
{
public:
CInterfaceParser();
virtual ~CInterfaceParser();
public:
/**
* Parsing methods
*/
/** Load a set of xml files
* \param isFilename true if xmlFileNames array contains the names of the xml file, false, if each
* array is a script itself
*/
bool parseInterface (const std::vector<std::string> &xmlFileNames, bool reload, bool isFilename = true, bool checkInData = false);
bool parseXMLDocument (xmlNodePtr root, bool reload);
bool parseTemplateNode (xmlNodePtr node,xmlNodePtr instance,xmlNodePtr templ);
bool parseInstance(xmlNodePtr cur);
// bool parseDynamicList (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseVector (xmlNodePtr cur);
bool parseObserver (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseVariable (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseOptions (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseGroup (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseGroupChildren(xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseControl (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseLink (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseView (xmlNodePtr cur, CInterfaceGroup * parentGroup, bool reload);
bool parseTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
bool parseTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
bool parseDefine(xmlNodePtr cur);
bool parseProcedure(xmlNodePtr cur, bool reload);
bool parseSheetSelection(xmlNodePtr cur);
bool parseCareerGenerator(xmlNodePtr cur);
bool parseAnim(xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseScene3D (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseActionCategory (xmlNodePtr cur);
bool parseKey(xmlNodePtr cur);
bool parseMacro(xmlNodePtr cur);
bool parseCommand(xmlNodePtr cur);
bool parseBrickCareerGenerator(xmlNodePtr cur);
bool parseBrickSuffixGenerator(xmlNodePtr cur);
bool parseStyle(xmlNodePtr cur);
bool parseDDX (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseLUAScript (xmlNodePtr cur);
bool setupTree (xmlNodePtr cur, CWidgetManager::SMasterGroup *parentGroup);
bool setupTreeNode (xmlNodePtr cur, CGroupContainer *parentGroup);
// Called by each parse in parseXMLDocument
bool solveDefine(xmlNodePtr cur);
bool solveStyle(xmlNodePtr cur);
// Solve All define in a string. return false if some define not founs (defError contains this define)
bool solveDefine(const std::string &propVal, std::string &newPropVal, std::string &defError);
// Called after template & options parsing
virtual void setupOptions() { }
/**
* Initializer
*/
bool initCoordsAndLuaScript ();
/// Association builders : associate an element of the interface with the string ID of
/// another element used as reference for position values
void addParentPositionAssociation (CInterfaceElement *element, const std::string &parentID);
void addParentSizeAssociation (CInterfaceElement *element, const std::string &parentID);
void addParentSizeMaxAssociation (CInterfaceElement *element, const std::string &parentID);
/// LUA Class Association builder : associate a lua script to a group (called for each group after every document parsed)
void addLuaClassAssociation(CInterfaceGroup *group, const std::string &luaScript);
/**
* Accessors
*/
// access to control sheet selection
CCtrlSheetSelection &getCtrlSheetSelection() { return _CtrlSheetSelection; }
/// \name Parameter variable
// @{
const std::string &getDefine(const std::string &id) const;
bool isDefineExist(const std::string &id) const;
void setDefine(const std::string &id, const std::string &value);
// @}
/// \name Dynamic links mgt
// @{
/** Associate the given dynamic link with an ID
* \return true if succesful
*/
bool addLink(CInterfaceLink *link, const std::string &id);
/** remove the given link from its ID
* \return true if succesful
*/
bool removeLink(const std::string &id);
// @}
/** create a template from an instance consisting of a single group
* \param templateName name of the template in the xml
* \param templateParams array containing each template parameter and its name
* \param number of template parameters in the array
*/
CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, const std::pair<std::string, std::string> *templateParams, uint numParams, bool updateLinks = true);
CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, std::vector<std::pair<std::string, std::string> > &templateParams, bool updateLinks = true)
{
if (templateParams.size() > 0)
return createGroupInstance(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks);
else
return createGroupInstance(templateName, parentID, NULL, 0, updateLinks);
}
/** create a template from an instance consisting of a single control or group
* \param templateName name of the template in the xml
* \param templateParams array containing each template parameter and its name
* \param number of template parameters in the array
*/
CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, const std::pair<std::string,std::string> *templateParams, uint numParams, bool updateLinks /* = true */);
CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, std::vector<std::pair<std::string, std::string> > &templateParams, bool updateLinks = true)
{
if (templateParams.size() > 0)
return createUIElement(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks);
else
return createUIElement(templateName, parentID, NULL, 0, updateLinks);
}
static void freeXMLNodeAndSibblings(xmlNodePtr node);
// search a "tree" node in the hierarchy that match node. may return root! NULL if not found
static xmlNodePtr searchTreeNodeInHierarchy(xmlNodePtr root, const char *node);
/// \name Clearing mgt
// @{
void removeAllLinks();
void removeAllProcedures();
void removeAllDefines();
void removeAllTemplates();
void removeAllAnims();
void removeAll();
// @}
// get info on procedure. return 0 if procedure not found
uint getProcedureNumActions( const std::string &procName ) const;
// return false if procedure not found, or if bad action index. return false if has some param variable (@0...)
bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string &params ) const;
protected:
/**
* Temporary data for init
*/
/// vector storing parsed templates during init. At the end of init, only used template are kept
std::vector<xmlNodePtr> _Templates;
// map linking an element to its parent position used during init only
std::map<CInterfaceElement*,std::string> _ParentPositionsMap;
std::map<CInterfaceElement*,std::string> _ParentSizesMap;
std::map<CInterfaceElement*,std::string> _ParentSizesMaxMap;
// map linking a group to its lua script. used during init only
std::map<CInterfaceGroup*,std::string> _LuaClassAssociation;
/**
* Data of initialized interface
*/
/// Define Variable list
typedef std::map<std::string, std::string> TVarMap;
typedef TVarMap::iterator ItVarMap;
typedef TVarMap::const_iterator CstItVarMap;
TVarMap _DefineMap;
bool validDefineChar(char c) const;
/// Procedure def
class CParamBlock
{
public:
// -1 if not a param id, but a string
sint32 NumParam;
std::string String;
CParamBlock()
{
NumParam= -1;
}
};
class CAction
{
public:
// a condition to launch this action handler (is an expression)
std::vector<CParamBlock> CondBlocks;
// the action handler (may be proc!!)
std::string Action;
// A list of string/or param number => to build the final params at execution
std::vector<CParamBlock> ParamBlocks;
// build a paramBlock from a string
void buildParamBlock (const std::string &params);
// from ParamBlock, and a paramList (skip the 0th), build params.
void buildParams (const std::vector<std::string> &paramList, std::string &params) const;
void buildCondBlock (const std::string &params);
void buildCond (const std::vector<std::string> &paramList, std::string &cond) const;
static void buildBlocks (const std::string &in, std::vector<CParamBlock> &out);
static void eval (const std::vector<std::string> &inArgs, const std::vector<CParamBlock> &inBlocks, std::string &out);
};
class CProcedure
{
public:
// List of the actions
std::vector<CAction> Actions;
};
class CStyleProperty
{
public:
std::string Name;
std::string Value;
};
class CStyle
{
public:
std::vector<CStyleProperty> Properties;
};
/// Procedure list
typedef std::map<std::string,CProcedure> TProcedureMap;
typedef TProcedureMap::iterator ItProcedureMap;
typedef TProcedureMap::const_iterator CstItProcedureMap;
TProcedureMap _ProcedureMap;
// mgt of sheet selections (inventory, buy, sell..)
CCtrlSheetSelection _CtrlSheetSelection;
// Map of dynamic links
typedef std::map<std::string, NLMISC::CSmartPtr<CInterfaceLink> > TLinkMap;
TLinkMap _LinkMap;
// Map of anims
typedef std::map<std::string, CInterfaceAnim *> TAnimMap;
TAnimMap _AnimMap;
// Map of styles.
typedef std::map<std::string, CStyle> TStyleMap;
TStyleMap _StyleMap;
protected:
bool parseCareerGeneratorParams(xmlNodePtr cur,
std::string &templateCareer,
std::string &templateJob,
std::string &careerWindow,
std::string &jobWindow,
xmlNodePtr &rootTreeNode,
bool &brickTypeFilter,
BRICK_TYPE::EBrickType &brickType
);
void createJobBricks(BRICK_TYPE::EBrickType brickType, xmlNodePtr &nextSibling, xmlNodePtr parentTreeNode,
const CBrickJob &job, const std::string &templateBrick, const std::string &baseWindowId, sint32 xstart);
bool parseGeneratorRootContainer(xmlNodePtr cur, xmlNodePtr &rootTreeNode);
protected:
// LUA
// ----------------------------------------------------------------------------------
// LUA Interface State. NB: The LUA environnement is not shared between Login/OutGame/InGame
NLMISC::CSmartPtr<CLuaState> _LuaState;
void initLUA();
void uninitLUA();
// List of script loaded (for reloadLua command)
std::set<std::string> _LuaFileScripts;
// Load A .lua. false if parse error. string 'error' contains the eventual error desc (but warning still displayed)
bool loadLUA(const std::string &luaFile, std::string &error);
};
#endif // RZ_INTERFACE_PARSER_H

View file

@ -133,7 +133,7 @@ public:
// execute a small script. NB: use a small script here because
// most often action handlers are called from xml files => lot of redundant script
pIM->executeLuaScript(sParams, true);
CLuaManager::getInstance().executeLuaScript(sParams, true);
// pop UI caller
if(pCaller)
@ -179,7 +179,7 @@ static DECLARE_INTERFACE_USER_FCT(lua)
// assign return value in retId.
script= retId + "= " + script;
// execute a small script here, because most often exprs are called from xml files => lot of redundant script
pIM->executeLuaScript(script, true);
CLuaManager::getInstance().executeLuaScript(script, true);
// *** retrieve and convert return value
@ -607,7 +607,7 @@ int CLuaIHMRyzom::formatUI(CLuaState &ls)
// *** format with %
CInterfaceManager *pIM= CInterfaceManager::getInstance();
std::string newPropVal, defError;
if(!pIM->solveDefine(propVal, newPropVal, defError))
if( !CWidgetManager::getInstance()->getParser()->solveDefine(propVal, newPropVal, defError))
{
throw ELuaIHMException("formatUI(): Can't find define: '%s'", defError.c_str());
}
@ -965,7 +965,7 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls)
int CLuaIHMRyzom::hideAllWindows(CLuaState &/* ls */)
{
//H_AUTO(Lua_CLuaIHM_hideAllWindows)
CInterfaceManager::getInstance()->hideAllWindows();
CWidgetManager::getInstance()->hideAllWindows();
return 0;
}
@ -973,7 +973,7 @@ int CLuaIHMRyzom::hideAllWindows(CLuaState &/* ls */)
int CLuaIHMRyzom::hideAllNonSavableWindows(CLuaState &/* ls */)
{
//H_AUTO(Lua_CLuaIHM_hideAllNonSavableWindows)
CInterfaceManager::getInstance()->hideAllNonSavableWindows();
CWidgetManager::getInstance()->hideAllNonSavableWindows();
return 0;
}
@ -1255,8 +1255,7 @@ int CLuaIHMRyzom::disableContextHelp(CLuaState &ls)
//H_AUTO(Lua_CLuaIHM_disableContextHelp)
CLuaStackChecker lsc(&ls, 0);
CLuaIHM::checkArgCount(ls, "disableContextHelp", 0);
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->disableContextHelp();
CWidgetManager::getInstance()->disableContextHelp();
return 0;
}
@ -1275,8 +1274,7 @@ int CLuaIHMRyzom::disableContextHelpForControl(CLuaState &ls)
CInterfaceElement *pIE= CLuaIHM::getUIOnStack(ls, 1);
// go
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->disableContextHelpForControl(dynamic_cast<CCtrlBase*>(pIE));
CWidgetManager::getInstance()->disableContextHelpForControl(dynamic_cast<CCtrlBase*>(pIE));
return 0;
}
@ -1528,7 +1526,7 @@ int CLuaIHMRyzom::createGroupInstance(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *result = im->createGroupInstance(ls.toString(1), ls.toString(2), templateParams);
CInterfaceGroup *result = CWidgetManager::getInstance()->getParser()->createGroupInstance(ls.toString(1), ls.toString(2), templateParams);
if (!result)
{
ls.pushNil();
@ -1567,7 +1565,7 @@ int CLuaIHMRyzom::createRootGroupInstance(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *result = im->createGroupInstance(ls.toString(1), "ui:interface:"+string(ls.toString(2)), templateParams);
CInterfaceGroup *result = CWidgetManager::getInstance()->getParser()->createGroupInstance(ls.toString(1), "ui:interface:"+string(ls.toString(2)), templateParams);
if (!result)
{
ls.pushNil();
@ -1614,7 +1612,7 @@ int CLuaIHMRyzom::createUIElement(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceElement *result = im->createUIElement(ls.toString(1), ls.toString(2), templateParams);
CInterfaceElement *result = CWidgetManager::getInstance()->getParser()->createUIElement(ls.toString(1), ls.toString(2), templateParams);
if (!result)
{
ls.pushNil();
@ -1695,7 +1693,7 @@ int CLuaIHMRyzom::updateAllLocalisedElements(CLuaState &ls)
CLuaStackChecker lsc(&ls);
CLuaIHM::checkArgCount(ls, "updateAllLocalisedElements", 0);
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->updateAllLocalisedElements();
CWidgetManager::getInstance()->updateAllLocalisedElements();
//
TTime endTime = CTime::getLocalTime();
if (ClientCfg.R2EDVerboseParseTime)
@ -1963,17 +1961,15 @@ std::string CLuaIHMRyzom::getDefine(const std::string &def)
{
//H_AUTO(Lua_CLuaIHM_getDefine)
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(ClientCfg.DisplayLuaDebugInfo && !pIM->isDefineExist(def))
if(ClientCfg.DisplayLuaDebugInfo && !CWidgetManager::getInstance()->getParser()->isDefineExist(def))
debugInfo(toString("getDefine(): '%s' not found", def.c_str()));
return pIM->getDefine(def);
return CWidgetManager::getInstance()->getParser()->getDefine(def);
}
// ***************************************************************************
void CLuaIHMRyzom::setContextHelpText(const ucstring &text)
{
//H_AUTO(Lua_CLuaIHM_setContextHelpText)
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->setContextHelpText(text);
CWidgetManager::getInstance()->setContextHelpText(text);
}
// ***************************************************************************
@ -2645,7 +2641,7 @@ bool CLuaIHMRyzom::isRingAccessPointInReach()
// ***************************************************************************
void CLuaIHMRyzom::updateTooltipCoords()
{
CInterfaceManager::getInstance()->updateTooltipCoords();
CWidgetManager::getInstance()->updateTooltipCoords();
}
// ***************************************************************************
@ -2707,7 +2703,7 @@ sint32 CLuaIHMRyzom::getTargetLevel()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("target_player_level") );
return pDbPlayerLevel ? pDbPlayerLevel->getValue32() : -1;
}
else
@ -2772,7 +2768,7 @@ sint32 CLuaIHMRyzom::getTargetForceRegion()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("target_player_level") );
if (!pDbPlayerLevel) return -1;
sint nLevel = pDbPlayerLevel->getValue32();
if ( nLevel < 250 )
@ -2800,7 +2796,7 @@ sint32 CLuaIHMRyzom::getTargetLevelForce()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( CWidgetManager::getInstance()->getParser()->getDefine("target_player_level") );
if (!pDbPlayerLevel) return -1;
sint nLevel = pDbPlayerLevel->getValue32();
if ( nLevel < 250 )

View file

@ -89,7 +89,7 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s
vParams.push_back(make_pair(string("id"), templateId));
vParams.push_back(make_pair(string("lineid"), toString(lineId)));
CInterfaceGroup *pKeysLine = NULL;
pKeysLine = pIM->createGroupInstance (TEMPLATE_KEYS_GROUP, pParent->getId(), vParams);
pKeysLine = CWidgetManager::getInstance()->getParser()->createGroupInstance (TEMPLATE_KEYS_GROUP, pParent->getId(), vParams);
if (pKeysLine == NULL) return;
// Put name
@ -424,7 +424,7 @@ void CModalContainerEditCmd::create(const std::string &name, bool bDefKey, bool
vArgs.push_back(pair<string,string>("db_disp_1p",DbComboDisp1P));
vArgs.push_back(pair<string,string>("db_disp_2p",DbComboDisp2P));
Win = dynamic_cast<CGroupContainer*>(pIM->createGroupInstance(TEMPLATE_EDITCMD, "ui:interface", vArgs));
Win = dynamic_cast<CGroupContainer*>( CWidgetManager::getInstance()->getParser()->createGroupInstance(TEMPLATE_EDITCMD, "ui:interface", vArgs));
if (Win == NULL)
{
nlwarning ("cannot create %s", name.c_str());

View file

@ -802,7 +802,7 @@ void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName)
vector< pair<string, string> > vParams;
vParams.push_back(pair<string,string>("id", "c"+toString(cmdNb)));
CInterfaceGroup *pNewCmd = pIM->createGroupInstance(TEMPLATE_NEWMACRO_COMMAND, pParent->getId(), vParams);
CInterfaceGroup *pNewCmd = CWidgetManager::getInstance()->getParser()->createGroupInstance(TEMPLATE_NEWMACRO_COMMAND, pParent->getId(), vParams);
if (pNewCmd == NULL) return;
CViewText *pVT = dynamic_cast<CViewText*>(pNewCmd->getView(TEMPLATE_NEWMACRO_COMMAND_TEXT));
@ -969,7 +969,7 @@ void addMacroLine (CGroupList *pParent, uint macNb, const CMacroCmd &macro)
vector< pair<string, string> > vParams;
vParams.push_back(pair<string,string>("id", "m"+toString(macNb)));
CInterfaceGroup *pNewMacro = pIM->createGroupInstance(TEMPLATE_MACRO_ELT, pParent->getId(), vParams);
CInterfaceGroup *pNewMacro = CWidgetManager::getInstance()->getParser()->createGroupInstance(TEMPLATE_MACRO_ELT, pParent->getId(), vParams);
if (pNewMacro == NULL) return;
CViewText *pVT = dynamic_cast<CViewText*>(pNewMacro->getView(TEMPLATE_MACRO_ELT_TEXT));

View file

@ -674,10 +674,10 @@ void CHugeListObs::updateUIItemPage(uint index)
// If price of current selected item has changed, repercute it
if (sheet == CDBCtrlSheet::getCurrSelection())
{
string ls = im->getDefine("item_price_1");
string ms = im->getDefine("item_price_2");
string bs = im->getDefine("item_price_3");
string vbs = im->getDefine("item_price_4");
string ls = CWidgetManager::getInstance()->getParser()->getDefine("item_price_1");
string ms = CWidgetManager::getInstance()->getParser()->getDefine("item_price_2");
string bs = CWidgetManager::getInstance()->getParser()->getDefine("item_price_3");
string vbs = CWidgetManager::getInstance()->getParser()->getDefine("item_price_4");
setPriceInDB(currItem.Price, ls, ms, bs, vbs);
}
}

View file

@ -0,0 +1,526 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "parser_modules.h"
#include "nel/gui/view_text.h"
#include "nel/gui/interface_group.h"
#include "nel/gui/group_list.h"
#include "interface_ddx.h"
#include "macrocmd_manager.h"
#include "../commands.h"
#include "interface_3d_scene.h"
#include "nel/misc/i_xml.h"
using namespace NLMISC;
CIF3DSceneParser::CIF3DSceneParser()
{
parsingStage |= ( Resolved | GroupChildren );
}
CIF3DSceneParser::~CIF3DSceneParser()
{
}
bool CIF3DSceneParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
CInterface3DScene *pScene;
CXMLAutoPtr ptr;
pScene = new CInterface3DScene(CViewBase::TCtorParam());
// parse the group attributes
if (!pScene->parse(cur,parentGroup))
{
delete pScene;
// todo hulud interface syntax error
nlinfo ("cannot parse 3d scene attributes");
return false;
}
if (parentGroup)
{
CGroupList *pList = dynamic_cast<CGroupList*>(parentGroup);
if (pList != NULL)
pList->addChild (pScene);
else
parentGroup->addGroup (pScene);
}
else
{
std::string tmp = "no parent for "+pScene->getId();
// todo hulud interface syntax error
nlinfo (tmp.c_str());
delete pScene;
return false;
}
return true;
}
CIFDDXParser::CIFDDXParser()
{
parsingStage |= ( Resolved | GroupChildren );
}
CIFDDXParser::~CIFDDXParser()
{
}
bool CIFDDXParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
CInterfaceDDX *pDDX = NULL;
pDDX = new CInterfaceDDX;
if (pDDX)
{
if (!pDDX->parse(cur,parentGroup))
{
delete pDDX;
return false;
}
return true;
}
return false;
}
CActionCategoryParser::CActionCategoryParser()
{
parsingStage |= Unresolved;
}
CActionCategoryParser::~CActionCategoryParser()
{
}
bool CActionCategoryParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
// The category
CCategory category;
// Name
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"name" ));
if (ptr)
category.Name = (const char*)ptr;
// Localized string
ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" );
if (ptr)
category.LocalizedName = (const char*)ptr;
// macroisable (per category)
ptr = (char*) xmlGetProp( cur, (xmlChar*)"macroisable" );
if (ptr)
category.Macroisable= CInterfaceElement::convertBool(ptr);
// Count number of action
uint ns = CIXml::countChildren(cur, "action");
category.BaseActions.resize( ns );
std::string actionCategoryContext = "game";
ptr = (char*) xmlGetProp( cur, (xmlChar*)"contexts" );
if (ptr)
actionCategoryContext = (const char *) ptr;
uint actionIndex = 0;
xmlNodePtr actionNode = CIXml::getFirstChildNode(cur, "action");
if (actionNode)
{
do
{
// The action
CBaseAction &action = category.BaseActions[actionIndex];
// list of contexts in which this action is valid
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"contexts" );
if (ptr)
action.Contexts = (const char *) ptr;
else
action.Contexts = actionCategoryContext; // inherit from action category
// Repeat flag
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"repeat" );
if (ptr)
fromString((const char*)ptr, action.Repeat);
// KeyDown flag
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"keydown" );
if (ptr)
fromString((const char*)ptr, action.KeyDown);
// KeyUp flag
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"keyup" );
if (ptr)
fromString((const char*)ptr, action.KeyUp);
// WaitForServer flag (wait an answer from server before continuing)
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"waitforserver" );
if (ptr)
fromString((const char*)ptr, action.WaitForServer);
// Action name
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"name" );
if (ptr)
action.Name = (const char*)ptr;
// Action localized name
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"hardtext" );
if (ptr)
action.LocalizedName = (const char*)ptr;
// macroisable (per action)
action.Macroisable= true;
ptr = (char*) xmlGetProp( actionNode, (xmlChar*)"macroisable" );
if (ptr)
action.Macroisable = CInterfaceElement::convertBool(ptr);
// Read the parameters
action.Parameters.resize (CIXml::countChildren(actionNode, "parameter"));
uint parameterIndex = 0;
xmlNodePtr paramNode = CIXml::getFirstChildNode(actionNode, "parameter");
if (paramNode)
{
do
{
// The parameter
CBaseAction::CParameter &parameter = action.Parameters[parameterIndex];
// Parameter type
ptr = (char*) xmlGetProp( paramNode, (xmlChar*)"type" );
if (ptr)
{
sint32 tType;
fromString((const char*)ptr, tType);
parameter.Type = (CBaseAction::CParameter::TType)tType;
}
// Parameter name
ptr = (char*) xmlGetProp( paramNode, (xmlChar*)"name" );
if (ptr)
parameter.Name = (const char*)ptr;
// Parameter localized name
ptr = (char*) xmlGetProp( paramNode, (xmlChar*)"hardtext" );
if (ptr)
parameter.LocalizedName = (const char*)ptr;
// Default value
ptr = (char*) xmlGetProp( paramNode, (xmlChar*)"value" );
if (ptr)
parameter.DefaultValue = (const char*)ptr;
// Visible flag
//ptr = (char*) xmlGetProp( paramNode, (xmlChar*)"visible" );
//if (ptr)
// fromString((const char*)ptr, parameter.Visible);
// Parse instance
xmlNodePtr instanceNode = CIXml::getFirstChildNode(paramNode, "instance");
if (instanceNode)
{
do
{
if (!parser->parseInstance(instanceNode))
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseActionCategory> cannot create instance from template");
}
}
while((instanceNode = CIXml::getNextChildNode(instanceNode, "instance")));
}
parameter.Values.resize (CIXml::countChildren(paramNode, "value"));
uint valueIndex = 0;
xmlNodePtr valueNode = CIXml::getFirstChildNode(paramNode, "value");
if (valueNode)
{
do
{
// The value
CBaseAction::CParameter::CValue &value = parameter.Values[valueIndex];
// Value
ptr = (char*) xmlGetProp( valueNode, (xmlChar*)"value" );
if (ptr)
value.Value = (const char*)ptr;
// list of contexts in which this value is valid
ptr = (char*) xmlGetProp( valueNode, (xmlChar*)"contexts" );
if (ptr) value.Contexts = (const char*) ptr;
else value.Contexts = action.Contexts; // inherit context from action
// Localized value
ptr = (char*) xmlGetProp( valueNode, (xmlChar*)"hardtext" );
if (ptr)
value.LocalizedValue = (const char*)ptr;
valueIndex++;
}
while((valueNode = CIXml::getNextChildNode(valueNode, "value")));
}
parameterIndex++;
}
while((paramNode = CIXml::getNextChildNode(paramNode, "parameter")));
}
// Next action
actionIndex++;
}
while((actionNode = CIXml::getNextChildNode(actionNode, "action")));
}
// Add this category to the action manager
CActionsManager *actionManager = ActionsContext.getActionsManager (category.Name);
if (actionManager)
{
// They want to display debug shortcut in final version
#if FINAL_VERSION
if ((category.Name != "debug") || ClientCfg.AllowDebugCommands)
#else // FINAL_VERSION
if (1)
#endif // FINAL_VERSION
{
actionManager->removeCategory (category.Name);
actionManager->addCategory (category);
}
else
{
// Remove thoses actions from the manager
CAHManager *pAHFM = CAHManager::getInstance();
uint i;
for (i=0; i<category.BaseActions.size(); i++)
{
CAHManager::TFactoryMap::iterator ite = pAHFM->FactoryMap.find (category.BaseActions[i].Name);
if (ite != pAHFM->FactoryMap.end())
{
IActionHandler *ah = ite->second;
pAHFM->FactoryMap.erase (ite);
pAHFM->NameMap.erase (ah);
}
}
}
}
return true;
}
CCommandParser::CCommandParser()
{
parsingStage |= Unresolved;
}
CCommandParser::~CCommandParser()
{
}
bool CCommandParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
// Parse the key
bool ret = false;
// Localized string
CXMLAutoPtr ptrName((const char*) xmlGetProp( cur, (xmlChar*)"name" ));
if (ptrName)
{
// Does the action exist ?
std::string name = ptrName;
if (!ICommand::exists (name) || (CUserCommand::CommandMap.find(name) != CUserCommand::CommandMap.end()))
{
// Get the action
CXMLAutoPtr ptrAction((const char*) xmlGetProp( cur, (xmlChar*)"action" ));
if (ptrAction)
{
// Get the params
CXMLAutoPtr ptrParams((const char*) xmlGetProp( cur, (xmlChar*)"params" ));
if (ptrParams)
{
CUserCommand::createCommand (ptrName, ptrAction, ptrParams);
// if prop "ctrlchar" is declared with false, then disable ctrlchar for this command
CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"ctrlchar" ));
if( (const char*)prop && (CInterfaceElement::convertBool((const char*)prop)==false) )
ICommand::enableControlCharForCommand(ptrName, false);
// Done
ret = true;
}
}
else
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseCommand> No action for command : %s", (const char*)ptrName);
}
}
}
else
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseCommand> No name for a key");
}
return ret;
}
CKeyParser::CKeyParser()
{
parsingStage |= Unresolved;
}
CKeyParser::~CKeyParser()
{
}
bool CKeyParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
// Parse the key
bool ret = false;
// Localized string
TKey key;
CXMLAutoPtr ptrKey((const char*) xmlGetProp( cur, (xmlChar*)"name" ));
if (ptrKey)
{
bool isNA = std::string((const char*)ptrKey) == std::string("N/A");
// Get the key from the string
key = CEventKey::getKeyFromString ((const char*)ptrKey);
if (key != KeyCount || isNA)
{
// Get the action
CXMLAutoPtr ptrAction((const char*) xmlGetProp( cur, (xmlChar*)"action" ));
if (ptrAction)
{
// Get the params
CXMLAutoPtr ptrParams((const char*) xmlGetProp( cur, (xmlChar*)"params" ));
// Get the modifiers
bool shift=false;
bool ctrl=false;
bool menu=false;
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"shift" ));
if (ptr)
fromString((const char*)ptr, shift);
ptr = (char*) xmlGetProp( cur, (xmlChar*)"ctrl" );
if (ptr)
fromString((const char*)ptr, ctrl);
ptr = (char*) xmlGetProp( cur, (xmlChar*)"menu" );
if (ptr)
fromString((const char*)ptr, menu);
// Repeat flag
bool repeat=false;
ptr = (char*) xmlGetProp( cur, (xmlChar*)"repeat" );
if (ptr)
fromString((const char*)ptr, repeat);
// Get the context
CXMLAutoPtr ptrContext((const char*) xmlGetProp( cur, (xmlChar*)"context" ));
std::string context = (const char*)ptrContext?(const char*)ptrContext:"";
// Add the action
CCombo combo;
combo.init(key, (TKeyButton)((shift?shiftKeyButton:noKeyButton)|(ctrl?ctrlKeyButton:noKeyButton)|(menu?altKeyButton:noKeyButton)));
::CAction::CName actionName ((const char*)ptrAction, ptrParams?(const char*)ptrParams:"");
// Get the actions context manager
CActionsManager *actionManager = ActionsContext.getActionsManager(context);
if (actionManager)
{
bool canAdd= true;
// for keys.xml, don't replace already defined keys
if( parser->getDefine("key_def_no_replace")=="1" )
{
// if this combo key is already used for any action,
// or if this action is already bound to any key
if(isNA || actionManager->isComboAssociated(combo) || actionManager->isActionAssociated(actionName))
// don't replace
canAdd= false;
}
// add/replace the combo?
if(canAdd)
{
actionManager->addCombo(actionName, combo);
::CAction *action = actionManager->getAction(actionName);
if (action && repeat) action->Repeat = true;
}
// if the action is to be shown in the Key interface
if( parser->getDefine("key_def_force_display")=="1" )
actionManager->forceDisplayForAction(actionName, true);
}
// Done
ret = true;
}
else
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseKey> No action for key : %s", (const char*)ptrKey);
}
}
else
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseKey> Unknown key : %s", (const char*)ptrKey);
}
}
else
{
// todo hulud interface syntax error
nlwarning("<CInterfaceParser::parseKey> No name for a key");
}
return ret;
}
CMacroParser::CMacroParser()
{
parsingStage |= Unresolved;
}
CMacroParser::~CMacroParser()
{
}
bool CMacroParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup )
{
H_AUTO(parseMacro)
CMacroCmd cmd;
if (cmd.readFrom(cur))
CMacroCmdManager::getInstance()->addMacro(cmd);
else
return false;
return true;
}

View file

@ -0,0 +1,79 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PARSER_MODULES_H
#define PARSER_MODULES_H
#include "nel/gui/interface_parser.h"
using namespace NLGUI;
class CIF3DSceneParser : public CInterfaceParser::IParserModule
{
public:
CIF3DSceneParser();
~CIF3DSceneParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
class CIFDDXParser : public CInterfaceParser::IParserModule
{
public:
CIFDDXParser();
~CIFDDXParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
class CActionCategoryParser : public CInterfaceParser::IParserModule
{
public:
CActionCategoryParser();
~CActionCategoryParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
class CCommandParser : public CInterfaceParser::IParserModule
{
public:
CCommandParser();
~CCommandParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
class CKeyParser : public CInterfaceParser::IParserModule
{
public:
CKeyParser();
~CKeyParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
class CMacroParser : public CInterfaceParser::IParserModule
{
public:
CMacroParser();
~CMacroParser();
bool parse( xmlNodePtr cur, CInterfaceGroup *parentGroup );
};
#endif

View file

@ -1029,7 +1029,7 @@ class CHandlerChatGroupFilter : public IActionHandler
CCtrlTabButton *pTabButton= dynamic_cast<CCtrlTabButton*>(pCaller);
if(pTabButton)
{
CRGBA stdColor= CRGBA::stringToRGBA(pIM->getDefine("chat_group_tab_color_normal").c_str());
CRGBA stdColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_normal").c_str());
pTabButton->setTextColorNormal(stdColor);
}
}
@ -2815,7 +2815,7 @@ static CInterfaceGroup *createMenuCheckBox(const std::string &onclickL, const st
params[1].second = paramsL;
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *ig = im->createGroupInstance("menu_checkbox", "", params, sizeof(params) / sizeof(params[0]));
CInterfaceGroup *ig = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_checkbox", "", params, sizeof(params) / sizeof(params[0]));
if (!ig) return NULL;
CCtrlBaseButton *cb = dynamic_cast<CCtrlBaseButton *>(ig->getCtrl("b"));
if (!cb) return NULL;

View file

@ -86,7 +86,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha
{
baseId = fatherContainer->getId() + ":list";
}
CInterfaceGroup *mainIg = im->createGroupInstance(desc.BaseContainerTemplateName, baseId, baseContainerParams);
CInterfaceGroup *mainIg = CWidgetManager::getInstance()->getParser()->createGroupInstance(desc.BaseContainerTemplateName, baseId, baseContainerParams);
// must attach group to hierarchy before we can use it
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(mainIg);
if (!gc) return false;
@ -361,7 +361,7 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/)
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *group = im->createGroupInstance(templateName, "ui:interface", properties, false);
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, "ui:interface", properties, false);
if (!group) return -1;
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(group);
if (!gc)

View file

@ -210,7 +210,7 @@ void createOptionalCatUI()
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine = pIM->createGroupInstance("t_cat", GROUP_LIST_CAT, params);
CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_cat", GROUP_LIST_CAT, params);
if (pNewLine != NULL)
{
CViewText *pVT = dynamic_cast<CViewText*>(pNewLine->getView("name"));
@ -1086,7 +1086,7 @@ void initShardDisplay()
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine =pIM->createGroupInstance("t_shard", GROUP_LIST_SHARD, params);
CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_shard", GROUP_LIST_SHARD, params);
if (pNewLine != NULL)
{
CViewText *pVT = dynamic_cast<CViewText*>(pNewLine->getView("name"));

View file

@ -1520,7 +1520,7 @@ bool mainLoop()
CSessionBrowserImpl::getInstance().init(CLuaManager::getInstance().getLuaState());
}
CInterfaceManager::getInstance()->executeLuaScript("game:onMainLoopBegin()");
CLuaManager::getInstance().executeLuaScript("game:onMainLoopBegin()");
if (StartInitTime != 0)
@ -1782,7 +1782,7 @@ bool mainLoop()
if (group)
group->updateAllLinks();
// send a msg to lua for specific ui update
pIM->executeLuaScript("game:onInGameDbInitialized()");
CLuaManager::getInstance().executeLuaScript("game:onInGameDbInitialized()");
}
}
@ -2896,7 +2896,7 @@ bool mainLoop()
// This code must remain at the very end of the main loop.
if(LoginSM.getCurrentState() == CLoginStateMachine::st_enter_far_tp_main_loop)
{
CInterfaceManager::getInstance()->executeLuaScript("game:onFarTpStart()");
CLuaManager::getInstance().executeLuaScript("game:onFarTpStart()");
// Will loop the network until the end of the relogging process
FarTP.farTPmainLoop();
@ -2974,7 +2974,7 @@ bool mainLoop()
lastConnectionState = CNetworkConnection::Connected;
connectionState = NetMngr.getConnectionState();
CInterfaceManager::getInstance()->executeLuaScript("game:onFarTpEnd()");
CLuaManager::getInstance().executeLuaScript("game:onFarTpEnd()");
}
} // end of main loop
@ -2982,7 +2982,7 @@ bool mainLoop()
CInterfaceManager *im = CInterfaceManager::getInstance();
if (CLuaManager::getInstance().getLuaState())
{
CInterfaceManager::getInstance()->executeLuaScript("game:onMainLoopEnd()");
CLuaManager::getInstance().executeLuaScript("game:onMainLoopEnd()");
}
// Stop Running Profiles (kick result)
@ -4550,7 +4550,7 @@ void displayDebugClusters()
void inGamePatchUncompleteWarning()
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->executeLuaScript("bgdownloader:inGamePatchUncompleteWarning()");
CLuaManager::getInstance().executeLuaScript("bgdownloader:inGamePatchUncompleteWarning()");
/*
CInterfaceManager *im = CInterfaceManager::getInstance();
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:bg_downloader"));

View file

@ -808,10 +808,10 @@ void getSeedsFromDB(CSeeds &dest)
CInterfaceManager *im =CInterfaceManager::getInstance();
nlctassert(sizeof(CSeeds::TUInt) == 4); // excpect that the number of each seed type is encoded on 32 bits
// if this assert at compile, change the following code
string ls = im->getDefine("money_1");
string ms = im->getDefine("money_2");
string bs = im->getDefine("money_3");
string vbs = im->getDefine("money_4");
string ls = CWidgetManager::getInstance()->getParser()->getDefine("money_1");
string ms = CWidgetManager::getInstance()->getParser()->getDefine("money_2");
string bs = CWidgetManager::getInstance()->getParser()->getDefine("money_3");
string vbs = CWidgetManager::getInstance()->getParser()->getDefine("money_4");
dest = CSeeds(NLGUI::CDBManager::getInstance()->getDbProp(ls)->getValue32(),
NLGUI::CDBManager::getInstance()->getDbProp(ms)->getValue32(),

View file

@ -1183,8 +1183,7 @@ string CUserControls::modeStr() const
void CUserControls::execActionCursorPos(bool rightClick, bool dblClick)
{
// Check there is no interface under the cursor.
CInterfaceManager *IM = CInterfaceManager::getInstance();
if(IM->isMouseOverWindow())
if( CWidgetManager::getInstance()->isMouseOverWindow())
return;
// Update the cursor.
ContextCur.check();

View file

@ -893,7 +893,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u
// for now, '&' are removed by server so use another format until a special msg is made
if (strFindReplace(finalString, ucstring("<R2_INVITE>"), ucstring()))
{
CInterfaceManager::getInstance()->executeLuaScript("RingAccessPoint:forceRefresh()");
CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()");
}
@ -1704,8 +1704,7 @@ void impulseTeamInvitation(NLMISC::CBitMemStream &impulse)
impulse.serial(textID);
if (PermanentlyBanned) return;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->executeLuaScript("game:onTeamInvation("+toString(textID)+")", 0);
CLuaManager::getInstance().executeLuaScript("game:onTeamInvation("+toString(textID)+")", 0);
}// impulseTeamInvitation //
//-----------------------------------------------
@ -3336,7 +3335,7 @@ private:
pGC->setActive(true);
// must set the text by hand
CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("server_message_box_content_view_text")));
CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text")));
if(vt)
vt->setTextFormatTaged(contentStr);

View file

@ -428,7 +428,7 @@ void CDisplayerVisual::onPostRender()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
const char *iconTemplateName = "r2ed_bad_pos_icon";
// if the in scene 'stop' window wasn't created, then create it now
CInterfaceGroup *group = pIM->createGroupInstance (iconTemplateName , "ui:interface", NULL, 0);
CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance (iconTemplateName , "ui:interface", NULL, 0);
if (group)
{
_IconInScene = dynamic_cast<CGroupInScene *>(group);

View file

@ -1647,7 +1647,7 @@ void CEditor::waitScenarioScreen()
{
setMode(GoingToEditionMode);
}
getUI().hideAllWindows();
CWidgetManager::getInstance()->hideAllWindows();
CInterfaceGroup *waitScreen = dynamic_cast<CInterfaceGroup *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_connecting"));
if (waitScreen)
{
@ -2231,7 +2231,7 @@ void CEditor::loadStandardUI()
ClientCfg.R2EDEnabled = false;
loadUIConfig("");
ClientCfg.R2EDEnabled = true;
getUI().updateAllLocalisedElements();
CWidgetManager::getInstance()->updateAllLocalisedElements();
}
// *********************************************************************************************************
@ -2708,7 +2708,7 @@ void CEditor::init(TMode initialMode, TAccessMode accessMode)
{
CVerboseClock clock("Update of localized elements");
getUI().updateAllLocalisedElements();
CWidgetManager::getInstance()->updateAllLocalisedElements();
}
}
@ -2733,7 +2733,7 @@ uint CEditor::getMaxNumPlotItems()
{
//H_AUTO(R2_CEditor_getMaxNumPlotItems)
uint ret;
fromString(getUI().getDefine("r2ed_max_num_plot_item_sheets"), ret);
fromString( CWidgetManager::getInstance()->getParser()->getDefine("r2ed_max_num_plot_item_sheets"), ret);
return ret;
}
@ -3942,7 +3942,7 @@ void CEditor::release()
saveCurrentKeySet();
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();
_EntityCustomSelectBoxMap.clear();
@ -7646,8 +7646,7 @@ class CAHR2FreezeUnfreezeBotObjects : public IActionHandler
{
virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->executeLuaScript("r2:freezeUnfreezeBotObjects()");
CLuaManager::getInstance().executeLuaScript("r2:freezeUnfreezeBotObjects()");
}
};
REGISTER_ACTION_HANDLER(CAHR2FreezeUnfreezeBotObjects, "r2ed_freeze_unfreeze_botobjects");

View file

@ -727,7 +727,7 @@ void CTool::captureMouse()
UserControls.captureMouse();
CWidgetManager::getInstance()->enableMouseHandling(false);
}
getUI().setContextHelpActive(false);
CWidgetManager::getInstance()->setContextHelpActive(false);
_MouseCaptured = true;
}
@ -738,7 +738,7 @@ void CTool::releaseMouse()
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
UserControls.releaseMouse();
CWidgetManager::getInstance()->enableMouseHandling(true);
getUI().setContextHelpActive(true);
CWidgetManager::getInstance()->setContextHelpActive(true);
_MouseCaptured = false;
}

View file

@ -114,7 +114,7 @@ void CToolCreateEntity::commit(const NLMISC::CVector &createPosition, float crea
if (!getEditor().verifyRoomLeft(0, 1))
{
getUI().executeLuaScript("r2:checkStaticQuota(1)");
CLuaManager::getInstance().executeLuaScript("r2:checkStaticQuota(1)");
return;
}
setContextHelp(CI18N::get("uiR2EDDrawArrayContextHelp"));

View file

@ -241,7 +241,7 @@ void releaseMainLoopReselect()
ActionsContext.removeAllCombos();
EditActions.releaseAllKeyNoRunning();
Actions.releaseAllKeyNoRunning();
pIM->removeAllTemplates();
CWidgetManager::getInstance()->getParser()->removeAllTemplates();
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);

View file

@ -300,6 +300,7 @@ void releaseClientTime()
// updateClientTime :
//
//-----------------------------------------------
CWidgetManager::SInterfaceTimes times;
void updateClientTime()
{
@ -382,7 +383,6 @@ void updateClientTime()
NetMngr.startReplay();
#endif
CWidgetManager::SInterfaceTimes times;
times.lastFrameMs = T0;
times.thisFrameMs = T1;
times.frameDiffMs = DT64;

View file

@ -1662,7 +1662,7 @@ void CUserEntity::moveToAction(CEntityCL *ent)
break;
// Outpost
case CUserEntity::Outpost:
IM->executeLuaScript("game:outpostBCOpenStateWindow()", 0);
CLuaManager::getInstance().executeLuaScript("game:outpostBCOpenStateWindow()", 0);
break;
// BuildTotem
case CUserEntity::BuildTotem: