summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-15 15:57:54 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-15 15:57:54 +0000
commit037aeccee0e9986784ad07bef4ad4ebc8a30d58d (patch)
tree10f21a0c12056dde36e6851f292d015b03d2858d
parentd7c8421febc417a767fe74afa3a4a22c9bc55b70 (diff)
MirLua: added m_options module
git-svn-id: http://svn.miranda-ng.org/main/trunk@16978 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/MirLua/src/mlua_module_loader.cpp1
-rw-r--r--plugins/MirLua/src/mlua_options.cpp1
-rw-r--r--plugins/MirLua/src/mlua_options.h1
-rw-r--r--plugins/MirLua/src/mlua_script.cpp11
-rw-r--r--plugins/MirLua/src/mlua_script.h5
-rw-r--r--plugins/MirLua/src/resource.h4
-rw-r--r--plugins/MirLua/src/stdafx.h3
7 files changed, 19 insertions, 7 deletions
diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp
index ad4141f0fa..c7e64a5b0a 100644
--- a/plugins/MirLua/src/mlua_module_loader.cpp
+++ b/plugins/MirLua/src/mlua_module_loader.cpp
@@ -34,6 +34,7 @@ void CMLuaModuleLoader::LoadModules()
Preload(MLUA_GENMENU, luaopen_m_genmenu);
Preload(MLUA_HOTKEYS, luaopen_m_hotkeys);
Preload(MLUA_MESSAGE, luaopen_m_message);
+ Preload(MLUA_OPTIONS, luaopen_m_options);
Preload(MLUA_PROTOCOLS, luaopen_m_protocols);
Preload(MLUA_SOUNDS, luaopen_m_sounds);
}
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp
index 0a21f37c46..72bde7761f 100644
--- a/plugins/MirLua/src/mlua_options.cpp
+++ b/plugins/MirLua/src/mlua_options.cpp
@@ -159,6 +159,7 @@ void CMLuaOptions::OnReload(CCtrlBase*)
int CMLuaOptions::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
+ odp.hInstance = g_hInstance;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.ptszGroup = LPGENT("Services");
odp.ptszTitle = _T("Lua");
diff --git a/plugins/MirLua/src/mlua_options.h b/plugins/MirLua/src/mlua_options.h
index d78c1a1066..624a1eefaa 100644
--- a/plugins/MirLua/src/mlua_options.h
+++ b/plugins/MirLua/src/mlua_options.h
@@ -15,7 +15,6 @@ public:
CCallback<TEventInfo> OnClick;
};
-
class CMLuaOptions : public CPluginDlgBase
{
private:
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp
index 5f43d7fbda..9676f36192 100644
--- a/plugins/MirLua/src/mlua_script.cpp
+++ b/plugins/MirLua/src/mlua_script.cpp
@@ -26,7 +26,7 @@ CMLuaScript::~CMLuaScript()
mir_free(moduleName);
}
-bool CMLuaScript::GetScriptEnviroment(lua_State *L)
+bool CMLuaScript::GetEnviroment(lua_State *L)
{
lua_Debug ar;
if (lua_getstack(L, 1, &ar) == 0 || lua_getinfo(L, "f", &ar) == 0 || lua_iscfunction(L, -1))
@@ -47,7 +47,7 @@ bool CMLuaScript::GetScriptEnviroment(lua_State *L)
CMLuaScript* CMLuaScript::GetScriptFromEnviroment(lua_State *L)
{
- if (!GetScriptEnviroment(L))
+ if (!GetEnviroment(L))
return NULL;
lua_getfield(L, -1, SCRIPT);
@@ -61,11 +61,16 @@ int CMLuaScript::GetScriptIdFromEnviroment(lua_State *L)
{
CMLuaScript *script = GetScriptFromEnviroment(L);
if (script != NULL)
- return script->id;
+ return script->GetId();
return hMLuaLangpack;
}
+int CMLuaScript::GetId() const
+{
+ return id;
+}
+
const char* CMLuaScript::GetModuleName() const
{
return moduleName;
diff --git a/plugins/MirLua/src/mlua_script.h b/plugins/MirLua/src/mlua_script.h
index 8f03d5fcb0..2abb2d215a 100644
--- a/plugins/MirLua/src/mlua_script.h
+++ b/plugins/MirLua/src/mlua_script.h
@@ -21,14 +21,17 @@ private:
TCHAR filePath[MAX_PATH];
Status status;
+ static bool GetEnviroment(lua_State *L);
+
public:
CMLuaScript(lua_State *L, const TCHAR *path);
~CMLuaScript();
- static bool GetScriptEnviroment(lua_State *L);
static CMLuaScript* GetScriptFromEnviroment(lua_State *L);
static int GetScriptIdFromEnviroment(lua_State *L);
+ int GetId() const;
+
const char* GetModuleName() const;
const TCHAR* GetFilePath() const;
diff --git a/plugins/MirLua/src/resource.h b/plugins/MirLua/src/resource.h
index 9ed73fc420..b83d89d368 100644
--- a/plugins/MirLua/src/resource.h
+++ b/plugins/MirLua/src/resource.h
@@ -6,9 +6,9 @@
#define IDI_SCRIPT 100
#define IDI_OPEN 105
#define IDD_OPTIONS 106
+#define IDD_SCRIPTOPTIONSPAGE 107
#define IDI_RELOAD 108
#define IDI_FAILED 109
-#define IDI_ICON2 110
#define IDI_LOADED 110
#define IDC_SCRIPTS 1011
#define IDC_RELOAD 1012
@@ -21,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1015
+#define _APS_NEXT_CONTROL_VALUE 1016
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index 3ced6ea10a..8b4852b8d6 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -89,6 +89,9 @@ LUAMOD_API int (luaopen_m_hotkeys)(lua_State *L);
#define MLUA_MESSAGE "m_message"
LUAMOD_API int (luaopen_m_message)(lua_State *L);
+#define MLUA_OPTIONS "m_options"
+LUAMOD_API int (luaopen_m_options)(lua_State *L);
+
#include "m_protocols.h"
#define MLUA_SOUNDS "m_sounds"