diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h
index 92e73775f..032884437 100644
--- a/code/nel/include/nel/gui/interface_parser.h
+++ b/code/nel/include/nel/gui/interface_parser.h
@@ -48,7 +48,6 @@ namespace NLGUI
* \date 2002
*/
- // this is the base class for CInterfaceManager
class CInterfaceParser : public IParser
{
@@ -168,8 +167,8 @@ namespace NLGUI
/// \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);
+ bool isDefineExist(const std::string &id) const;
+ void setDefine(const std::string &id, const std::string &value);
// @}
/// \name Dynamic links mgt
diff --git a/code/nel/include/nel/gui/parser.h b/code/nel/include/nel/gui/parser.h
new file mode 100644
index 000000000..5adfd0691
--- /dev/null
+++ b/code/nel/include/nel/gui/parser.h
@@ -0,0 +1,72 @@
+// Ryzom - MMORPG Framework
+// 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 .
+
+
+#ifndef PARSER_H
+#define PARSER_H
+
+#include
+#include
+#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
+
diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h
index e716816b5..8410bcc4a 100644
--- a/code/nel/include/nel/gui/widget_manager.h
+++ b/code/nel/include/nel/gui/widget_manager.h
@@ -28,6 +28,7 @@
#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
{
@@ -46,23 +47,6 @@ namespace NLGUI
class CInterfaceAnim;
class CProcedure;
- 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 ¶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;
- };
-
/// Manages the GUI widgets
class CWidgetManager{
@@ -483,13 +467,15 @@ namespace NLGUI
void setProcedureAction( const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms );
const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; }
-
- static IParser *parser;
+ IParser* getParser() const{ return parser; }
+
private:
CWidgetManager();
~CWidgetManager();
+ IParser *parser;
+
static CWidgetManager *instance;
std::vector< SMasterGroup > _MasterGroups;
std::vector< SModalWndInfo > _ModalStack;
diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp
index 3e6d82ed9..2f0ad8f68 100644
--- a/code/nel/src/gui/group_html.cpp
+++ b/code/nel/src/gui/group_html.cpp
@@ -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 ("want_return", multiLine?"true":"false"));
templateParams.push_back (std::pair ("enter_recover_focus", "false"));
templateParams.push_back (std::pair ("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 > templateParams;
templateParams.push_back (std::pair ("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;igetProcedureAction(procName, i, procAh, procParams))
+ if( CWidgetManager::getInstance()->getParser()->getProcedureAction(procName, i, procAh, procParams))
{
// recurs proc if needed!
if (actionLaunchUrlRecurs(procAh, procParams, url))
diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp
index 6fbd586fd..603356055 100644
--- a/code/nel/src/gui/group_menu.cpp
+++ b/code/nel/src/gui/group_menu.cpp
@@ -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);
diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp
index 4baa32ab1..3257e3160 100644
--- a/code/nel/src/gui/group_table.cpp
+++ b/code/nel/src/gui/group_table.cpp
@@ -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" );
diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp
index beb150f99..0149b739b 100644
--- a/code/nel/src/gui/interface_element.cpp
+++ b/code/nel/src/gui/interface_element.cpp
@@ -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");
diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp
index ac8842b81..72d1de1d7 100644
--- a/code/nel/src/gui/interface_group.cpp
+++ b/code/nel/src/gui/interface_group.cpp
@@ -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;
}
diff --git a/code/nel/src/gui/parser.cpp b/code/nel/src/gui/parser.cpp
new file mode 100644
index 000000000..7874e43a5
--- /dev/null
+++ b/code/nel/src/gui/parser.cpp
@@ -0,0 +1,39 @@
+// Ryzom - MMORPG Framework
+// 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 .
+
+
+#include "nel/misc/rgba.h"
+#include