summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-30 21:31:03 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-30 21:31:03 +0000
commitce1c33a2c65a605929c5fcc7c075c76c3b27ea68 (patch)
treee756063cb1323cca57afb78270745abba6a1c6a3 /plugins
parentfce279191e7b00a56ff5ca0e81dbb1a3fcee354f (diff)
MirLua: removed duplicate code
git-svn-id: http://svn.miranda-ng.org/main/trunk@14464 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/src/m_clist.cpp38
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp2
-rw-r--r--plugins/MirLua/src/m_genmenu.h9
-rw-r--r--plugins/MirLua/src/stdafx.h3
4 files changed, 11 insertions, 41 deletions
diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp
index bc22237776..9e52c700ed 100644
--- a/plugins/MirLua/src/m_clist.cpp
+++ b/plugins/MirLua/src/m_clist.cpp
@@ -1,43 +1,5 @@
#include "stdafx.h"
-static void MakeMenuItem(lua_State *L, CMenuItem &mi)
-{
- mi.hLangpack = hScriptsLangpack;
-
- lua_pushstring(L, "Flags");
- lua_gettable(L, -2);
- mi.flags = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- if (!(mi.flags & CMIF_UNICODE))
- mi.flags |= CMIF_UNICODE;
-
- lua_pushstring(L, "Name");
- lua_gettable(L, -2);
- mi.name.t = mir_utf8decodeT((char*)luaL_checkstring(L, -1));
- lua_pop(L, 1);
-
- lua_pushstring(L, "Position");
- lua_gettable(L, -2);
- mi.position = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- lua_pushstring(L, "Icon");
- lua_gettable(L, -2);
- mi.hIcolibItem = (HANDLE)lua_touserdata(L, -1);
- lua_pop(L, 1);
-
- lua_pushstring(L, "Service");
- lua_gettable(L, -2);
- mi.pszService = (char*)lua_tostring(L, -1);
- lua_pop(L, 1);
-
- lua_pushstring(L, "Parent");
- lua_gettable(L, -2);
- mi.root = (HGENMENU)lua_touserdata(L, -1);
- lua_pop(L, 1);
-}
-
static int lua_AddMainMenuItem(lua_State *L)
{
if (lua_type(L, 1) != LUA_TTABLE)
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index a5f2ccc6d1..41e30c3a67 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-static void MakeMenuItem(lua_State *L, CMenuItem &mi)
+void MakeMenuItem(lua_State *L, CMenuItem &mi)
{
mi.hLangpack = hScriptsLangpack;
diff --git a/plugins/MirLua/src/m_genmenu.h b/plugins/MirLua/src/m_genmenu.h
new file mode 100644
index 0000000000..69ddff6215
--- /dev/null
+++ b/plugins/MirLua/src/m_genmenu.h
@@ -0,0 +1,9 @@
+#ifndef _LUA_M_GENMENU_H_
+#define _LUA_M_GENMENU_H_
+
+#define MLUA_GENMENU "m_genmenu"
+LUAMOD_API int (luaopen_m_genmenu)(lua_State *L);
+
+void MakeMenuItem(lua_State *L, CMenuItem &mi);
+
+#endif //_LUA_CONSOLE_H_ \ No newline at end of file
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index b540a208be..6c1f2ad98e 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -71,8 +71,7 @@ LUAMOD_API int (luaopen_m_database)(lua_State *L);
#define MLUA_ICOLIB "m_icolib"
LUAMOD_API int (luaopen_m_icolib)(lua_State *L);
-#define MLUA_GENMENU "m_genmenu"
-LUAMOD_API int (luaopen_m_genmenu)(lua_State *L);
+#include "m_genmenu.h"
#define MLUA_MSGBUTTONSBAR "m_msg_buttonsbar"
LUAMOD_API int (luaopen_m_msg_buttonsbar)(lua_State *L);