diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-02-15 17:09:42 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-02-15 17:09:42 +0000 |
commit | 06c13fcc7c6c9b7b8448e550568c5993dbd96628 (patch) | |
tree | 8ba39163ab86765cfeed6b8d73d528ee6dd9bd33 /plugins/MirLua/src/mlua_options.cpp | |
parent | a7967e3364a0b5528433de65cfbb743c57625e72 (diff) |
MirLua: returned ability to reload single script
git-svn-id: http://svn.miranda-ng.org/main/trunk@16282 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_options.cpp')
-rw-r--r-- | plugins/MirLua/src/mlua_options.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index da62cef1d1..2303e6ece3 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -61,10 +61,12 @@ void CLuaOptions::LoadScripts() {
CMLuaScript *script = g_mLua->Scripts[i];
TCHAR *fileName = NEWTSTR_ALLOCA(script->GetFileName());
- int iItem = m_scripts.AddItem(fileName, -1, (LPARAM)script);
+ int iIcon = script->GetStatus() == CMLuaScript::Loaded ? 0 : 1;
+ int iItem = m_scripts.AddItem(fileName, iIcon, (LPARAM)script);
if (db_get_b(NULL, MODULE, _T2A(fileName), 1))
m_scripts.SetCheckState(iItem, TRUE);
- m_scripts.SetItem(iItem, 1, TranslateT("Open"), 0);
+ m_scripts.SetItem(iItem, 1, TranslateT("Open"), 2);
+ m_scripts.SetItem(iItem, 2, TranslateT("Reload"), 3);
}
}
@@ -75,15 +77,19 @@ void CLuaOptions::OnInitDialog() m_scripts.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_INFOTIP);
HIMAGELIST hImageList = m_scripts.CreateImageList(LVSIL_SMALL);
+ ImageList_AddIcon(hImageList, GetIcon(IDI_LOADED));
+ ImageList_AddIcon(hImageList, GetIcon(IDI_FAILED));
ImageList_AddIcon(hImageList, GetIcon(IDI_OPEN));
+ ImageList_AddIcon(hImageList, GetIcon(IDI_RELOAD));
TCHAR scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARST(MIRLUA_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
mir_sntprintf(header, _T("%s (%s)"), TranslateT("Common scripts"), relativeScriptDir);
- m_scripts.AddColumn(0, _T("Script"), 420);
+ m_scripts.AddColumn(0, _T("Script"), 380);
m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
+ m_scripts.AddColumn(2, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
LoadScripts();
@@ -140,8 +146,23 @@ void CLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt) CMLuaScript* script = (CMLuaScript*)lvi.lParam;
- if (lvi.iSubItem == 1)
+ switch (lvi.iSubItem)
+ {
+ case 1:
ShellExecute(m_hwnd, _T("Open"), script->GetFilePath(), NULL, NULL, SW_SHOWNORMAL);
+ break;
+
+ case 2:
+ //m_scripts.DeleteItem(evt->nmlvia->iItem);
+ script->Unload();
+ script->Load();
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 0;
+ lvi.iImage = script->GetStatus() == CMLuaScript::Loaded ? 0 : 1;
+ ListView_SetItem(m_scripts.GetHwnd(), &lvi);
+ m_scripts.Update(evt->nmlvia->iItem);
+ break;
+ }
mir_free(lvi.pszText);
}
|