summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_options.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-16 15:58:53 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-16 15:58:53 +0000
commit35205b9114784ff8f9f40b04f9ec8e14a250e467 (patch)
treeae8cde6b6c520e9131a980577a2ec594218ecda6 /plugins/MirLua/src/mlua_options.cpp
parent6dc20e70f308daee742372a7978c1f65668186f3 (diff)
oops
git-svn-id: http://svn.miranda-ng.org/main/trunk@14208 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_options.cpp')
-rw-r--r--plugins/MirLua/src/mlua_options.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp
index 1a93789f52..dae408ea64 100644
--- a/plugins/MirLua/src/mlua_options.cpp
+++ b/plugins/MirLua/src/mlua_options.cpp
@@ -44,6 +44,8 @@ void CLuaOptions::OnInitDialog()
{
CDlgBase::OnInitDialog();
+ m_scripts.SetExtendedListViewStyle(LVS_EX_CHECKBOXES);
+
m_scripts.EnableGroupView(TRUE);
m_scripts.AddGroup(0, TranslateT("Common scripts"));
m_scripts.AddGroup(1, TranslateT("Custom scripts"));
@@ -64,7 +66,9 @@ void CLuaOptions::OnInitDialog()
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
- m_scripts.AddItem(fd.cFileName, -1, NULL, 0);
+ int iItem = m_scripts.AddItem(fd.cFileName, -1, NULL, 0);
+ if (db_get_b(NULL, MODULE, _T2A(fd.cFileName), 1))
+ m_scripts.SetCheckState(iItem, TRUE);
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -84,4 +88,40 @@ void CLuaOptions::OnInitDialog()
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
+}
+
+INT_PTR CLuaOptions::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmHdr = (LPNMHDR)lParam;
+ if (lpnmHdr->idFrom == m_scripts.GetCtrlId() && lpnmHdr->code == LVN_ITEMCHANGED)
+ {
+ LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
+ if (pnmv->uChanged & LVIF_STATE && pnmv->uNewState & LVIS_STATEIMAGEMASK)
+ {
+ NotifyChange();
+ }
+ }
+ }
+ break;
+ }
+
+ return CDlgBase::DlgProc(msg, wParam, lParam);
+}
+
+void CLuaOptions::OnApply()
+{
+ int count = m_scripts.GetItemCount();
+ for (int iItem = 0; iItem < count; iItem++)
+ {
+ TCHAR fileName[MAX_PATH];
+ m_scripts.GetItemText(iItem, 0, fileName, SIZEOF(fileName));
+ if (!m_scripts.GetCheckState(iItem))
+ db_set_b(NULL, MODULE, _T2A(fileName), 0);
+ else
+ db_unset(NULL, MODULE, _T2A(fileName));
+ }
} \ No newline at end of file