diff options
-rw-r--r-- | indra/newview/llluamanager.cpp | 18 | ||||
-rw-r--r-- | indra/newview/lluilistener.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 4 |
3 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp index edfd5c3cad..b251ebb6d5 100644 --- a/indra/newview/llluamanager.cpp +++ b/indra/newview/llluamanager.cpp @@ -38,6 +38,7 @@ #include "llviewermenu.h" #include "llviewermenufile.h" #include "llviewerwindow.h" +#include "lluilistener.h" #include <boost/algorithm/string/replace.hpp> @@ -52,6 +53,9 @@ extern "C" #pragma comment(lib, "liblua54.a") #endif +// FIXME extremely hacky way to get to the UI Listener framework. There's almost certainly a cleaner way. +extern LLUIListener sUIListener; + int lua_printWarning(lua_State *L) { std::string msg(lua_tostring(L, 1)); @@ -163,6 +167,18 @@ int lua_env_setting_event(lua_State *L) return 1; } +int lua_run_ui_command(lua_State *L) +{ + std::string func_name = lua_tostring(L,1); + LL_WARNS("LUA") << "running ui func " << func_name << LL_ENDL; + LLSD event; + event["function"] = func_name; + event["parameter"] = LLSD(); + sUIListener.call(event); + + return 1; +} + bool checkLua(lua_State *L, int r, std::string &error_msg) { if (r != LUA_OK) @@ -194,6 +210,8 @@ void initLUA(lua_State *L) lua_register(L, "env_setting_event", lua_env_setting_event); lua_register(L, "set_debug_setting_bool", lua_set_debug_setting_bool); + + lua_register(L, "run_ui_command", lua_run_ui_command); } void LLLUAmanager::runScriptFile(const std::string &filename, script_finished_fn cb) diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h index 08724024dc..e53984dae2 100644 --- a/indra/newview/lluilistener.h +++ b/indra/newview/lluilistener.h @@ -39,7 +39,8 @@ class LLUIListener: public LLEventAPI public: LLUIListener(); -private: +// FIXME These fields are intended to be private, changed here to support very hacky code in llluamanager.cpp +public: void call(const LLSD& event) const; void getValue(const LLSD&event) const; }; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 240fa15685..50ce213f20 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -171,6 +171,8 @@ extern BOOL gShaderProfileFrame; // Globals // +LLUIListener sUIListener; + LLMenuBarGL *gMenuBarView = NULL; LLViewerMenuHolderGL *gMenuHolder = NULL; LLMenuGL *gPopupMenuView = NULL; @@ -348,8 +350,6 @@ public: static LLMenuParcelObserver* gMenuParcelObserver = NULL; -static LLUIListener sUIListener; - LLMenuParcelObserver::LLMenuParcelObserver() { LLViewerParcelMgr::getInstance()->addObserver(this); |