summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-02-17 16:24:34 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-02-17 16:24:34 +0000
commit939e01edacc5746bc9c6501721f270751a9be10d (patch)
tree9ee488e72880dcfca349cff9fa173095f222ee58 /plugins/MirLua/src
parent962a3d06bbd73aa7bb46eb8ae3e65c31a1902d5d (diff)
MirLua: m_popup moved to separate lua library
git-svn-id: http://svn.miranda-ng.org/main/trunk@16293 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src')
-rw-r--r--plugins/MirLua/src/m_popup.cpp129
-rw-r--r--plugins/MirLua/src/mlua_module_loader.cpp1
-rw-r--r--plugins/MirLua/src/stdafx.h3
3 files changed, 0 insertions, 133 deletions
diff --git a/plugins/MirLua/src/m_popup.cpp b/plugins/MirLua/src/m_popup.cpp
deleted file mode 100644
index c99ea7c146..0000000000
--- a/plugins/MirLua/src/m_popup.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-#include "stdafx.h"
-
-static POPUPDATAT* MakePopupData(lua_State *L)
-{
- POPUPDATAT *ppd = (POPUPDATAT*)mir_calloc(sizeof(POPUPDATAT));
-
- lua_getfield(L, -1, "ContactName");
- mir_tstrcpy(ppd->lptzContactName, ptrT(mir_utf8decodeT(lua_tostring(L, -1))));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Text");
- mir_tstrcpy(ppd->lptzText, ptrT(mir_utf8decodeT(luaL_checkstring(L, -1))));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "hContact");
- ppd->lchContact = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "ColorBack");
- ppd->colorBack = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "ColorText");
- ppd->colorText = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Seconds");
- ppd->iSeconds = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- return ppd;
-}
-
-static int lua_AddPopup(lua_State *L)
-{
- if (lua_type(L, 1) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
-
- mir_ptr<POPUPDATAT> ppd(MakePopupData(L));
-
- INT_PTR res = ::CallService(MS_POPUP_ADDPOPUPT, (WPARAM)ppd, 0);
- lua_pushinteger(L, res);
-
- return 1;
-}
-
-static POPUPDATA2* MakePopupData2(lua_State *L)
-{
- POPUPDATA2 *ppd = (POPUPDATA2*)mir_calloc(sizeof(POPUPDATA2));
- ppd->cbSize = sizeof(POPUPDATA2);
-
- lua_getfield(L, -1, "Flags");
- ppd->flags = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- if (!(ppd->flags & PU2_TCHAR))
- ppd->flags |= PU2_TCHAR;
-
- lua_getfield(L, -1, "Title");
- ppd->lptzTitle = mir_utf8decodeT(lua_tostring(L, -1));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Text");
- ppd->lptzText = mir_utf8decodeT(luaL_checkstring(L, -1));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "hContact");
- ppd->lchContact = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "ColorBack");
- ppd->colorBack = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "ColorText");
- ppd->colorText = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "hEvent");
- ppd->lchEvent = lua_touserdata(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Timestamp");
- ppd->dwTimestamp = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Timeout");
- ppd->iSeconds = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- return ppd;
-}
-
-static int lua_AddPopup2(lua_State *L)
-{
- if (lua_type(L, 1) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
-
- mir_ptr<POPUPDATA2> ppd(MakePopupData2(L));
-
- INT_PTR res = ::CallService(MS_POPUP_ADDPOPUP2, (WPARAM)ppd, 0);
- lua_pushinteger(L, res);
-
- mir_free(ppd->lptzTitle);
- mir_free(ppd->lptzText);
-
- return 1;
-}
-
-static luaL_Reg popupApi[] =
-{
- { "AddPopup", lua_AddPopup },
- { "AddPopup2", lua_AddPopup2 },
-
- { NULL, NULL }
-};
-
-LUAMOD_API int luaopen_m_popup(lua_State *L)
-{
- luaL_newlib(L, popupApi);
-
- return 1;
-}
diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp
index 18137a6868..33068165ab 100644
--- a/plugins/MirLua/src/mlua_module_loader.cpp
+++ b/plugins/MirLua/src/mlua_module_loader.cpp
@@ -39,7 +39,6 @@ void CLuaModuleLoader::LoadModules()
Preload(MLUA_SOUNDS, luaopen_m_sounds);
// regirter delay loading of other modules
Preload(MLUA_MSGBUTTONSBAR, luaopen_m_msg_buttonsbar);
- Preload(MLUA_POPUP, luaopen_m_popup);
Preload(MLUA_TOPTOOLBAR, luaopen_m_toptoolbar);
}
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index 82c6e97b29..7e6f966375 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -88,9 +88,6 @@ LUAMOD_API int (luaopen_m_message)(lua_State *L);
#include "m_msg_buttonsbar.h"
-#define MLUA_POPUP "m_popup"
-LUAMOD_API int (luaopen_m_popup)(lua_State *L);
-
#include "m_protocols.h"
#include "m_schedule.h"