CHANGED: #1471 Moved the stuff I moved to NELGUI library, under the NLGUI namespace.

--HG--
branch : gui-refactoring
hg/feature/sse2
dfighter1985 13 years ago
parent 5a2a89b4fc
commit f769f6fb0c

@ -19,8 +19,9 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
using namespace NLGUI;
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
namespace NLMISC namespace NLMISC
{ {
@ -29,6 +30,9 @@ namespace NLMISC
class CRGBA; class CRGBA;
} }
namespace NLGUI
{
class CReflectable; class CReflectable;
class CReflectedProperty; class CReflectedProperty;
@ -57,12 +61,6 @@ public:
} }
}; };
// ***************************************************************************
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
// *************************************************************************** // ***************************************************************************
/** /**
* Define Functions to export from C to LUA * Define Functions to export from C to LUA
@ -128,34 +126,26 @@ public:
private: private:
static void registerBasics(CLuaState &ls); static void registerBasics(CLuaState &ls);
static void registerIHM(CLuaState &ls); static void registerIHM(CLuaState &ls);
static void createLuaEnumTable(CLuaState &ls, const std::string &str); static void createLuaEnumTable(CLuaState &ls, const std::string &str);
/// \name Exported Functions //////////////////////////////////////////// Exported functions //////////////////////////////////////////////////////
// @{
// LUA exported Functions with luabind
static uint32 getLocalTime(); static uint32 getLocalTime();
static double getPreciseLocalTime(); static double getPreciseLocalTime();
static std::string findReplaceAll(const std::string &str, const std::string &search, const std::string &replace); static std::string findReplaceAll(const std::string &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace); static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace);
// just for ease of use
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace); static ucstring findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace); static ucstring findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace); static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace);
// @} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function export tools
// Function to forward lua call to C++ to a 'lua method' exported from a reflected object
static int luaMethodCall(lua_State *ls); static int luaMethodCall(lua_State *ls);
}; };
}
#endif // NL_LUA_IHM_H #endif // NL_LUA_IHM_H

@ -22,7 +22,6 @@
namespace NLGUI namespace NLGUI
{ {
class CLuaState; class CLuaState;
}
/// Provides a single global access point to the Lua state, and related stuff. :( /// Provides a single global access point to the Lua state, and related stuff. :(
class CLuaManager class CLuaManager
@ -53,5 +52,6 @@ private:
NLMISC::CSmartPtr< NLGUI::CLuaState > luaState; NLMISC::CSmartPtr< NLGUI::CLuaState > luaState;
}; };
}
#endif #endif

@ -20,11 +20,10 @@
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
//
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
using namespace NLGUI;
namespace NLGUI
{
class CLuaEnumeration; class CLuaEnumeration;
@ -298,4 +297,7 @@ public:
bool operator()(const char *lhs, const char *rhs) const { return lhs < rhs; } bool operator()(const char *lhs, const char *rhs) const { return lhs < rhs; }
}; };
}
#endif #endif

@ -14,22 +14,17 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_REFLECT_H #ifndef CL_REFLECT_H
#define CL_REFLECT_H #define CL_REFLECT_H
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/gui/lua_object.h" #include "nel/gui/lua_object.h"
//
#include <string> #include <string>
class CReflectable;
namespace NLGUI namespace NLGUI
{ {
class CReflectable;
class CLuaState; class CLuaState;
}
struct CClassInfo; struct CClassInfo;
/** A property of a reflectable object /** A property of a reflectable object
@ -367,5 +362,7 @@ private:
}; };
}
#endif #endif

@ -16,7 +16,6 @@
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
using namespace NLGUI;
#include <algorithm> #include <algorithm>
@ -92,6 +91,9 @@ std::ostream &operator<<(std::ostream &str, const ucstring &value)
return str << value.toString(); return str << value.toString();
} }
namespace NLGUI
{
struct CMiscFunctions struct CMiscFunctions
{ {
static std::string fileLookup(const std::string &fileName) static std::string fileLookup(const std::string &fileName)
@ -220,6 +222,8 @@ CLuaState * ELuaIHMException::getLuaState()
return CLuaManager::getInstance().getLuaState(); return CLuaManager::getInstance().getLuaState();
} }
}
// *************************************************************************** // ***************************************************************************
#define LUA_REGISTER_BASIC(_type_) \ #define LUA_REGISTER_BASIC(_type_) \
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \ luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
@ -252,6 +256,9 @@ namespace luabind
} }
} }
namespace NLGUI
{
// *************************************************************************** // ***************************************************************************
void CLuaIHM::registerBasics(CLuaState &ls) void CLuaIHM::registerBasics(CLuaState &ls)
{ {
@ -928,4 +935,4 @@ void CLuaIHM::getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &de
} }
} }
}

@ -18,6 +18,9 @@
#include "nel/gui/lua_manager.h" #include "nel/gui/lua_manager.h"
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
namespace NLGUI
{
bool CLuaManager::debugLua = false; bool CLuaManager::debugLua = false;
CLuaManager* CLuaManager::instance = NULL; CLuaManager* CLuaManager::instance = NULL;
@ -32,3 +35,5 @@ CLuaManager::~CLuaManager()
} }
}

@ -14,18 +14,12 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
//#include "stdpch.h"
#include "nel/gui/lua_object.h" #include "nel/gui/lua_object.h"
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
//#include "lua_ihm_ryzom.h"
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
using namespace NLGUI;
//
//#include "interface_manager.h"
//////////////// namespace NLGUI
// CLuaObject // {
////////////////
// ************************************************* // *************************************************
CLuaObject::CLuaObject(CLuaState &state, const char *id) CLuaObject::CLuaObject(CLuaState &state, const char *id)
@ -654,3 +648,4 @@ void CLuaEnumeration::next()
} }
} }
}

@ -17,6 +17,8 @@
#include "nel/gui/reflect.h" #include "nel/gui/reflect.h"
namespace NLGUI
{
// Yoyo: Act like a singleton, else registerClass may crash. // Yoyo: Act like a singleton, else registerClass may crash.
CReflectSystem::TClassMap *CReflectSystem::_ClassMap= NULL; CReflectSystem::TClassMap *CReflectSystem::_ClassMap= NULL;
@ -128,9 +130,12 @@ const CReflectedProperty *CReflectable::getReflectedProperty(const std::string &
return CReflectSystem::getProperty(this->getReflectedClassName(), propertyName, dspWarning); return CReflectSystem::getProperty(this->getReflectedClassName(), propertyName, dspWarning);
} }
}
#include "nel/gui/lua_manager.h" #include "nel/gui/lua_manager.h"
namespace NLGUI
{
CReflectableRefPtrTarget::~CReflectableRefPtrTarget() CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
{ {
CLuaState *lua= CLuaManager::getInstance().getLuaState(); CLuaState *lua= CLuaManager::getInstance().getLuaState();
@ -189,3 +194,5 @@ const CReflectedProperty *CReflectableLuaRef::getProp(const char *luaStringPtr)
ci.LuaStrToProp[luaStringPtr] = lip; ci.LuaStrToProp[luaStringPtr] = lip;
return prop; return prop;
} }
}

@ -23,7 +23,13 @@ namespace NLMISC
class CVector2f; class CVector2f;
} }
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
using namespace NLGUI;
class CDecal; class CDecal;
// TODO nico : this would fit nicely in the particle system animation system (would be more flexible) // TODO nico : this would fit nicely in the particle system animation system (would be more flexible)

@ -25,6 +25,8 @@
#include "interface_property.h" #include "interface_property.h"
#include "nel/gui/reflect.h" #include "nel/gui/reflect.h"
using namespace NLGUI;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class CInterfaceGroup; class CInterfaceGroup;

@ -22,12 +22,20 @@
#include "nel/misc/cdb_branch.h" #include "nel/misc/cdb_branch.h"
#include "nel/misc/cdb_branch_observing_handler.h" #include "nel/misc/cdb_branch_observing_handler.h"
class CInterfaceElement; namespace NLGUI
{
class CReflectedProperty; class CReflectedProperty;
}
class CInterfaceElement;
class CInterfaceExprValue; class CInterfaceExprValue;
class CInterfaceGroup; class CInterfaceGroup;
class CInterfaceExprNode; class CInterfaceExprNode;
using namespace NLGUI;
/** A link in an interface. /** A link in an interface.
* A link is an object that can read one or several values from the database, that can evaluate an expression * A link is an object that can read one or several values from the database, that can evaluate an expression
* on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to * on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to

@ -3,10 +3,12 @@
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
using namespace NLGUI;
class CLuaIHMRyzom class CLuaIHMRyzom
{ {
public: public:
static void RegisterRyzomFunctions( NLGUI::CLuaState &ls ); static void RegisterRyzomFunctions( CLuaState &ls );
private: private:
static void createLuaEnumTable(CLuaState &ls, const std::string &str); static void createLuaEnumTable(CLuaState &ls, const std::string &str);

@ -21,8 +21,10 @@
#include "nel/misc/class_registry.h" #include "nel/misc/class_registry.h"
#include "../interface_v3/interface_element.h" #include "../interface_v3/interface_element.h"
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
namespace R2 namespace R2
{ {

@ -21,7 +21,12 @@
#include "nel/gui/lua_object.h" #include "nel/gui/lua_object.h"
#include <map> #include <map>
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
using namespace NLGUI;
namespace R2 namespace R2
{ {

@ -20,8 +20,10 @@
namespace NLGUI namespace NLGUI
{ {
class CLuaState; class CLuaState;
}
class CLuaString; class CLuaString;
}
using namespace NLGUI;
namespace R2 namespace R2
{ {

@ -24,8 +24,12 @@
#include "../interface_v3/group_map.h" #include "../interface_v3/group_map.h"
class CEntityCL; namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
class CEntityCL;
class CCtrlPolygon; class CCtrlPolygon;
namespace R2 namespace R2

@ -29,8 +29,9 @@ class CInterfaceManager;
namespace NLGUI namespace NLGUI
{ {
class CEventDescriptor; class CEventDescriptor;
}
class CLuaObject; class CLuaObject;
}
class CGroupMap; class CGroupMap;
namespace NLMISC namespace NLMISC

@ -25,8 +25,10 @@
class CEntity; class CEntity;
class CEntityCL; class CEntityCL;
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
namespace R2 namespace R2
{ {

@ -22,8 +22,11 @@
#include "nel/gui/lua_object.h" #include "nel/gui/lua_object.h"
class CEntity; class CEntity;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2 namespace R2
{ {

@ -25,8 +25,10 @@
#include "displayer_visual_entity.h" #include "displayer_visual_entity.h"
class CEntity; class CEntity;
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
namespace R2 namespace R2
{ {

@ -25,8 +25,10 @@
class CEntity; class CEntity;
namespace NLGUI
{
class CLuaObject; class CLuaObject;
}
namespace R2 namespace R2
{ {

Loading…
Cancel
Save