summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-03 16:41:26 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-03 16:41:26 +0300
commit9c11d6918afda6c9b326a794d25f65496ced081a (patch)
treeb80ab9210894bdd17e7ec3613cde05d1a212dba4
parentd687d3e285bf203c0594b1f7cc64a8bf7a27c93b (diff)
we don't pretend that we have more than one g_plugin ...
-rw-r--r--plugins/MirLua/src/options.cpp15
-rw-r--r--plugins/MirLua/src/options.h8
-rw-r--r--plugins/MirLua/src/plugin.cpp4
3 files changed, 11 insertions, 16 deletions
diff --git a/plugins/MirLua/src/options.cpp b/plugins/MirLua/src/options.cpp
index 8eac5798e0..d596906321 100644
--- a/plugins/MirLua/src/options.cpp
+++ b/plugins/MirLua/src/options.cpp
@@ -1,8 +1,7 @@
#include "stdafx.h"
-CMLuaOptionsMain::CMLuaOptionsMain(CMPlugin &plugin) :
- CDlgBase(plugin, IDD_OPTIONSMAIN),
- m_plugin(plugin),
+CMLuaOptionsMain::CMLuaOptionsMain() :
+ CDlgBase(g_plugin, IDD_OPTIONSMAIN),
m_popupOnError(this, IDC_POPUPONERROR),
m_popupOnObsolete(this, IDC_POPUPONOBSOLETE),
m_scriptsList(this, IDC_SCRIPTS),
@@ -31,7 +30,7 @@ static int ScriptStatusToIcon(ScriptStatus status)
void CMLuaOptionsMain::LoadScripts()
{
- for (auto &script : m_plugin.m_scripts.rev_iter()) {
+ for (auto &script : g_plugin.m_scripts.rev_iter()) {
int iIcon = ScriptStatusToIcon(script->GetStatus());
int iItem = m_scriptsList.AddItem(script->GetName(), iIcon, (LPARAM)script);
m_scriptsList.SetCheckState(iItem, script->IsEnabled());
@@ -134,21 +133,21 @@ void CMLuaOptionsMain::OnReload(CCtrlBase*)
{
m_scriptsList.SetSilent(true);
m_scriptsList.DeleteAllItems();
- m_plugin.ReloadLuaScripts();
+ g_plugin.ReloadLuaScripts();
LoadScripts();
m_scriptsList.SetSilent(false);
}
/***********************************************/
-CMLuaEvaluateOptions::CMLuaEvaluateOptions(CMPlugin &plugin)
- : CDlgBase(plugin, IDD_OPTIONSEVALUATE),
+CMLuaEvaluateOptions::CMLuaEvaluateOptions() :
+ CDlgBase(g_plugin, IDD_OPTIONSEVALUATE),
m_script(this, IDC_SCRIPTTEXT),
m_result(this, IDC_SCRIPTRESULT),
m_autoEval(this, IDC_AUTOEVAL),
m_evaluate(this, IDC_EVALUATE)
{
- this->L = lua_newthread(plugin.L);
+ this->L = lua_newthread(g_plugin.L);
threadRef = luaL_ref(L, LUA_REGISTRYINDEX);
CreateLink(m_autoEval, "AutoEval", DBVT_BYTE, 0);
diff --git a/plugins/MirLua/src/options.h b/plugins/MirLua/src/options.h
index f109f4f83d..3e942e73a2 100644
--- a/plugins/MirLua/src/options.h
+++ b/plugins/MirLua/src/options.h
@@ -2,9 +2,6 @@
class CMLuaOptionsMain : public CDlgBase
{
-private:
- CMPlugin &m_plugin;
-
CCtrlCheck m_popupOnError;
CCtrlCheck m_popupOnObsolete;
@@ -21,14 +18,13 @@ protected:
void OnReload(CCtrlBase*);
public:
- CMLuaOptionsMain(CMPlugin &plugin);
+ CMLuaOptionsMain();
};
/***********************************************/
class CMLuaEvaluateOptions : public CDlgBase
{
-private:
lua_State *L = nullptr;
int threadRef = 0;
@@ -46,6 +42,6 @@ protected:
void OnEvaluate(CCtrlBase*);
public:
- CMLuaEvaluateOptions(CMPlugin &plugin);
+ CMLuaEvaluateOptions();
~CMLuaEvaluateOptions();
};
diff --git a/plugins/MirLua/src/plugin.cpp b/plugins/MirLua/src/plugin.cpp
index 3ca4a9524e..70cd628fab 100644
--- a/plugins/MirLua/src/plugin.cpp
+++ b/plugins/MirLua/src/plugin.cpp
@@ -99,11 +99,11 @@ int CMPlugin::OnOptionsInit(WPARAM wParam, LPARAM)
odp.szTitle.w = L"Lua";
odp.szTab.w = LPGENW("Scripts");
- odp.pDialog = new CMLuaOptionsMain(*this);
+ odp.pDialog = new CMLuaOptionsMain();
g_plugin.addOptions(wParam, &odp);
odp.szTab.w = LPGENW("Evaluate");
- odp.pDialog = new CMLuaEvaluateOptions(*this);
+ odp.pDialog = new CMLuaEvaluateOptions();
g_plugin.addOptions(wParam, &odp);
return 0;