diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MirLua/src/m_icolib.cpp | 7 | ||||
-rw-r--r-- | plugins/MirLua/src/m_sound.cpp | 48 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_module_loader.cpp | 3 | ||||
-rw-r--r-- | plugins/MirLua/src/stdafx.h | 8 |
4 files changed, 61 insertions, 5 deletions
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index 30146cd503..5b2a5b23a3 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -2,7 +2,7 @@ static int lua_AddIcon(lua_State *L)
{
- const char* name = luaL_checkstring(L, 1);
+ const char *name = luaL_checkstring(L, 1);
ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
@@ -25,7 +25,7 @@ static int lua_AddIcon(lua_State *L) static int lua_GetIcon(lua_State *L)
{
- const char* name = luaL_checkstring(L, 1);
+ const char *name = luaL_checkstring(L, 1);
HANDLE res = ::IcoLib_GetIconHandle(name);
lua_pushlightuserdata(L, res);
@@ -52,8 +52,11 @@ static int lua_RemoveIcon(lua_State *L) static luaL_Reg icolibApi[] =
{
{ "AddIcon", lua_AddIcon },
+ { "Add", lua_AddIcon },
{ "GetIcon", lua_GetIcon },
+ { "Get", lua_GetIcon },
{ "RemoveIcon", lua_RemoveIcon },
+ { "Remove", lua_RemoveIcon },
{ NULL, NULL }
};
diff --git a/plugins/MirLua/src/m_sound.cpp b/plugins/MirLua/src/m_sound.cpp new file mode 100644 index 0000000000..00b3bdf963 --- /dev/null +++ b/plugins/MirLua/src/m_sound.cpp @@ -0,0 +1,48 @@ +#include "stdafx.h"
+
+static int lua_Add(lua_State *L)
+{
+ ptrA name(mir_utf8decodeA(luaL_checkstring(L, 1)));
+ ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
+ ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
+
+ TCHAR filePath[MAX_PATH];
+ GetModuleFileName(g_hInstance, filePath, _countof(filePath));
+
+ SKINSOUNDDESCEX ssd = { sizeof(SKINSOUNDDESCEX) };
+ ssd.pszName = name;
+ ssd.dwFlags = SSDF_TCHAR;
+ ssd.ptszDescription = description;
+ ssd.ptszSection = section;
+ ssd.ptszDefaultFile = filePath;
+
+ INT_PTR res = ::CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd);
+ lua_pushnumber(L, res);
+
+ return 1;
+}
+
+static int lua_Play(lua_State *L)
+{
+ const char *name = luaL_checkstring(L, 1);
+
+ INT_PTR res = SkinPlaySound(name);
+ lua_pushnumber(L, res);
+
+ return 1;
+}
+
+static luaL_Reg soundApi[] =
+{
+ { "Add", lua_Add },
+ { "Play", lua_Play },
+
+ { NULL, NULL }
+};
+
+LUAMOD_API int luaopen_m_sound(lua_State *L)
+{
+ luaL_newlib(L, soundApi);
+
+ return 1;
+}
diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp index a40f24b7ab..e6fc4e2251 100644 --- a/plugins/MirLua/src/mlua_module_loader.cpp +++ b/plugins/MirLua/src/mlua_module_loader.cpp @@ -16,7 +16,6 @@ void CLuaModuleLoader::LoadModules() {
// regirter delay loading of miranda modules
PreloadModule(MLUA_CORE, luaopen_m_core);
- PreloadModule(MLUA_SCHEDULE, luaopen_m_schedule);
PreloadModule(MLUA_CLIST, luaopen_m_clist);
PreloadModule(MLUA_DATABASE, luaopen_m_database);
PreloadModule(MLUA_ICOLIB, luaopen_m_icolib);
@@ -26,6 +25,8 @@ void CLuaModuleLoader::LoadModules() PreloadModule(MLUA_MSGBUTTONSBAR, luaopen_m_msg_buttonsbar);
PreloadModule(MLUA_POPUP, luaopen_m_popup);
PreloadModule(MLUA_PROTOCOLS, luaopen_m_protocols);
+ PreloadModule(MLUA_SCHEDULE, luaopen_m_schedule);
+ PreloadModule(MLUA_SOUND, luaopen_m_sound);
PreloadModule(MLUA_TOPTOOLBAR, luaopen_m_toptoolbar);
PreloadModule(MLUA_VARIABLES, luaopen_m_variables);
PreloadModule(MLUA_WINDOWS, luaopen_m_windows);
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index 1c1677a2bd..3eb5c82241 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -22,6 +22,7 @@ #include <m_clist.h>
#include <m_hotkeys.h>
#include <m_icolib.h>
+#include <m_skin.h>
#include <m_message.h>
#include <m_chat.h>
#include <m_protocols.h>
@@ -72,8 +73,6 @@ extern HANDLE hNetlib; #define MLUA_CORE "m_core"
LUAMOD_API int (luaopen_m_core)(lua_State *L);
-#include "m_schedule.h"
-
#define MLUA_CLIST "m_clist"
LUAMOD_API int (luaopen_m_clist)(lua_State *L);
@@ -98,6 +97,11 @@ LUAMOD_API int (luaopen_m_popup)(lua_State *L); #include "m_protocols.h"
+#include "m_schedule.h"
+
+#define MLUA_SOUND "m_sound"
+LUAMOD_API int (luaopen_m_sound)(lua_State *L);
+
#include "m_toptoolbar.h"
#define MLUA_VARIABLES "m_variables"
|