diff options
-rw-r--r-- | plugins/ExternalAPI/m_lua.h | 43 | ||||
-rw-r--r-- | plugins/MirLua/Modules/m_toptoolbar/m_toptoolbar.vcxproj | 28 | ||||
-rw-r--r-- | plugins/MirLua/Modules/m_toptoolbar/src/main.cpp (renamed from plugins/MirLua/src/m_toptoolbar.cpp) | 18 | ||||
-rw-r--r-- | plugins/MirLua/Modules/m_toptoolbar/src/stdafx.cxx | 1 | ||||
-rw-r--r-- | plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h | 16 | ||||
-rw-r--r-- | plugins/MirLua/src/m_toptoolbar.h | 9 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua.cpp | 1 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_module_loader.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_utils.cpp | 37 | ||||
-rw-r--r-- | plugins/MirLua/src/stdafx.h | 6 |
10 files changed, 90 insertions, 71 deletions
diff --git a/plugins/ExternalAPI/m_lua.h b/plugins/ExternalAPI/m_lua.h new file mode 100644 index 0000000000..6bf0ccc051 --- /dev/null +++ b/plugins/ExternalAPI/m_lua.h @@ -0,0 +1,43 @@ +#ifndef _M_LUA_H_
+#define _M_LUA_H_
+
+#include <lua.hpp>
+
+static __inline WPARAM luaM_towparam(lua_State *L, int idx)
+{
+ switch (lua_type(L, idx))
+ {
+ case LUA_TBOOLEAN:
+ return lua_toboolean(L, idx);
+ case LUA_TNUMBER:
+ return lua_tonumber(L, idx);
+ case LUA_TSTRING:
+ return (WPARAM)lua_tostring(L, idx);
+ break;
+ case LUA_TUSERDATA:
+ case LUA_TLIGHTUSERDATA:
+ return (WPARAM)lua_touserdata(L, idx);
+ default:
+ return NULL;
+ }
+}
+
+static __inline LPARAM luaM_tolparam(lua_State *L, int idx)
+{
+ switch (lua_type(L, idx))
+ {
+ case LUA_TBOOLEAN:
+ return lua_toboolean(L, idx);
+ case LUA_TNUMBER:
+ return lua_tonumber(L, idx);
+ case LUA_TSTRING:
+ return (LPARAM)lua_tostring(L, idx);
+ case LUA_TUSERDATA:
+ case LUA_TLIGHTUSERDATA:
+ return (LPARAM)lua_touserdata(L, idx);
+ default:
+ return NULL;
+ }
+}
+
+#endif //_M_LUA_H_
diff --git a/plugins/MirLua/Modules/m_toptoolbar/m_toptoolbar.vcxproj b/plugins/MirLua/Modules/m_toptoolbar/m_toptoolbar.vcxproj new file mode 100644 index 0000000000..e05f3c25a9 --- /dev/null +++ b/plugins/MirLua/Modules/m_toptoolbar/m_toptoolbar.vcxproj @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>m_toptoolbar</ProjectName>
+ <ProjectGuid>{277E433F-7D71-4247-8AAA-CC5FB1AA7A67}</ProjectGuid>
+ </PropertyGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(ProjectDir)..\module.props" />
+ </ImportGroup>
+</Project>
diff --git a/plugins/MirLua/src/m_toptoolbar.cpp b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp index 310243e734..6e488ca8c7 100644 --- a/plugins/MirLua/src/m_toptoolbar.cpp +++ b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp @@ -1,16 +1,6 @@ #include "stdafx.h"
-static LIST<void> TBButtons(1, PtrKeySortT);
-
-void KillModuleTTBButton()
-{
- while (TBButtons.getCount())
- {
- HANDLE hTTButton = TBButtons[0];
- ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- TBButtons.remove(0);
- }
-}
+int hLangpack;
static TTBButton* MakeTBButton(lua_State *L)
{
@@ -79,9 +69,6 @@ static int lua_AddButton(lua_State *L) HANDLE res = ::TopToolbar_AddButton(tbb);
lua_pushlightuserdata(L, res);
- if (res != INVALID_HANDLE_VALUE)
- TBButtons.insert(res);
-
mir_free(tbb->name);
mir_free(tbb->pszTooltipUp);
mir_free(tbb->pszTooltipDn);
@@ -97,9 +84,6 @@ static int lua_RemoveButton(lua_State *L) INT_PTR res = ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
lua_pushinteger(L, res);
- if (!res)
- TBButtons.remove(hTTButton);
-
return 1;
}
diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.cxx b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.cxx new file mode 100644 index 0000000000..fd4f341c7b --- /dev/null +++ b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.cxx @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h new file mode 100644 index 0000000000..b45173f207 --- /dev/null +++ b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h @@ -0,0 +1,16 @@ +#ifndef _COMMON_H_
+#define _COMMON_H_
+
+#include <windows.h>
+
+#include <m_lua.h>
+#include <m_core.h>
+#include <m_utils.h>
+#include <m_toptoolbar.h>
+
+#define MLUA_TOPTOOLBAR "m_toptoolbar"
+LUAMOD_API int (luaopen_m_toptoolbar)(lua_State *L);
+
+void KillModuleTTBButton();
+
+#endif //_COMMON_H_
\ No newline at end of file diff --git a/plugins/MirLua/src/m_toptoolbar.h b/plugins/MirLua/src/m_toptoolbar.h deleted file mode 100644 index 945fde68a3..0000000000 --- a/plugins/MirLua/src/m_toptoolbar.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _LUA_M_TOPTOOLBAR_H_
-#define _LUA_M_TOPTOOLBAR_H_
-
-#define MLUA_TOPTOOLBAR "m_toptoolbar"
-LUAMOD_API int (luaopen_m_toptoolbar)(lua_State *L);
-
-void KillModuleTTBButton();
-
-#endif //_LUA_M_TOPTOOLBAR_H_
\ No newline at end of file diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 9aab05a3a6..8c0d99d689 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -72,7 +72,6 @@ void CMLua::Unload() }
KillModuleScheduleTasks();
- KillModuleTTBButton();
KillModuleIcons(hMLuaLangpack);
KillModuleSounds(hMLuaLangpack);
diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp index ef0c7572e3..fb54e33573 100644 --- a/plugins/MirLua/src/mlua_module_loader.cpp +++ b/plugins/MirLua/src/mlua_module_loader.cpp @@ -37,8 +37,6 @@ void CLuaModuleLoader::LoadModules() Preload(MLUA_PROTOCOLS, luaopen_m_protocols);
Preload(MLUA_SCHEDULE, luaopen_m_schedule);
Preload(MLUA_SOUNDS, luaopen_m_sounds);
- // regirter delay loading of other modules
- Preload(MLUA_TOPTOOLBAR, luaopen_m_toptoolbar);
}
void CLuaModuleLoader::Load(lua_State *L)
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 8a69605b32..7bd46d4db2 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -121,43 +121,6 @@ bool luaM_toboolean(lua_State *L, int idx) return lua_toboolean(L, idx) > 0;
}
-WPARAM luaM_towparam(lua_State *L, int idx)
-{
- switch (lua_type(L, idx))
- {
- case LUA_TBOOLEAN:
- return lua_toboolean(L, idx);
- case LUA_TNUMBER:
- return lua_tonumber(L, idx);
- case LUA_TSTRING:
- return (WPARAM)lua_tostring(L, idx);
- break;
- case LUA_TUSERDATA:
- case LUA_TLIGHTUSERDATA:
- return (WPARAM)lua_touserdata(L, idx);
- default:
- return NULL;
- }
-}
-
-LPARAM luaM_tolparam(lua_State *L, int idx)
-{
- switch (lua_type(L, idx))
- {
- case LUA_TBOOLEAN:
- return lua_toboolean(L, idx);
- case LUA_TNUMBER:
- return lua_tonumber(L, idx);
- case LUA_TSTRING:
- return (LPARAM)lua_tostring(L, idx);
- case LUA_TUSERDATA:
- case LUA_TLIGHTUSERDATA:
- return (LPARAM)lua_touserdata(L, idx);
- default:
- return NULL;
- }
-}
-
int luaM_totable(lua_State *L)
{
const char *tname = luaL_checkstring(L, 2);
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index a6c84dd1e8..32e1d27506 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -33,7 +33,7 @@ #include <m_popup.h>
#include <m_toptoolbar.h>
-#include <lua.hpp>
+#include <m_lua.h>
#include "version.h"
#include "resource.h"
@@ -95,8 +95,6 @@ LUAMOD_API int (luaopen_m_message)(lua_State *L); #define MLUA_SOUNDS "m_sounds"
LUAMOD_API int (luaopen_m_sounds)(lua_State *L);
-#include "m_toptoolbar.h"
-
/* utils */
extern HANDLE hNetlib;
@@ -116,8 +114,6 @@ int luaM_ptr2number(lua_State *L); int luaM_totable(lua_State *L);
bool luaM_toboolean(lua_State *L, int idx);
-WPARAM luaM_towparam(lua_State *L, int idx);
-LPARAM luaM_tolparam(lua_State *L, int idx);
void InitIcons();
HICON GetIcon(int iconId);
|