CHANGED: Merged the latest changes of gui-refactoring branch
--HG-- branch : gsoc2012-gui-editorhg/feature/sse2
commit
818af41685
@ -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
|
@ -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 ¶ms ) 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
|
@ -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 ¶ms ) 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
|
||||||
|
|
@ -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 ¶ms );
|
||||||
|
// from ParamBlock, and a paramList (skip the 0th), build params.
|
||||||
|
void buildParams( const std::vector< std::string > ¶mList, std::string ¶ms ) const;
|
||||||
|
|
||||||
|
void buildCondBlock( const std::string ¶ms );
|
||||||
|
|
||||||
|
void buildCond( const std::vector< std::string > ¶mList, 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
|
||||||
|
|
@ -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];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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 ¶ms )
|
||||||
|
{
|
||||||
|
buildBlocks( params, ParamBlocks );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProcAction::buildParams( const std::vector< std::string > ¶mList, std::string ¶ms ) const
|
||||||
|
{
|
||||||
|
eval( paramList, ParamBlocks, params );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProcAction::buildCondBlock( const std::string ¶ms )
|
||||||
|
{
|
||||||
|
buildBlocks( params, CondBlocks );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProcAction::buildCond( const std::vector< std::string > ¶mList, std::string ¶ms ) 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -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];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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 ¶ms ) 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 ¶ms);
|
|
||||||
// from ParamBlock, and a paramList (skip the 0th), build params.
|
|
||||||
void buildParams (const std::vector<std::string> ¶mList, std::string ¶ms) const;
|
|
||||||
|
|
||||||
void buildCondBlock (const std::string ¶ms);
|
|
||||||
|
|
||||||
void buildCond (const std::vector<std::string> ¶mList, 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
|
|
@ -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 ¶meter = 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;
|
||||||
|
}
|
||||||
|
|
@ -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
|
Loading…
Reference in New Issue