summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-25 09:23:44 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-25 09:23:44 +0000
commit6613345b8d2a3aaf95cb1947863496bb91bdebc4 (patch)
treeca3b389dd3417b6017f8bc2eed7462b1c7d251cc /plugins
parent4a06760bfa858838bd71219c9e2541ab71b34126 (diff)
MirLua: added open button in script list
git-svn-id: http://svn.miranda-ng.org/main/trunk@14373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/MirLua.vcxproj4
-rw-r--r--plugins/MirLua/res/open.icobin0 -> 1150 bytes
-rw-r--r--plugins/MirLua/res/resource.rc3
-rw-r--r--plugins/MirLua/src/mlua_options.cpp51
-rw-r--r--plugins/MirLua/src/mlua_options.h20
-rw-r--r--plugins/MirLua/src/resource.h6
6 files changed, 72 insertions, 12 deletions
diff --git a/plugins/MirLua/MirLua.vcxproj b/plugins/MirLua/MirLua.vcxproj
index fe790d27e8..342893c008 100644
--- a/plugins/MirLua/MirLua.vcxproj
+++ b/plugins/MirLua/MirLua.vcxproj
@@ -35,8 +35,6 @@
<ClCompile Include="src\lua\*.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- </ItemGroup>
- <ItemGroup>
- <None Include="res\icon.ico" />
+ <None Include="res\*.ico" />
</ItemGroup>
</Project>
diff --git a/plugins/MirLua/res/open.ico b/plugins/MirLua/res/open.ico
new file mode 100644
index 0000000000..ad561b5af2
--- /dev/null
+++ b/plugins/MirLua/res/open.ico
Binary files differ
diff --git a/plugins/MirLua/res/resource.rc b/plugins/MirLua/res/resource.rc
index 25fa2d9766..460294cf4d 100644
--- a/plugins/MirLua/res/resource.rc
+++ b/plugins/MirLua/res/resource.rc
@@ -63,6 +63,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON "icon.ico"
+IDI_OPEN ICON "open.ico"
/////////////////////////////////////////////////////////////////////////////
//
@@ -74,7 +75,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_SCRIPTS,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,0,0,310,220
+ CONTROL "",IDC_SCRIPTS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,0,0,310,220
PUSHBUTTON "Reload all",IDC_RELOAD,234,224,76,14
END
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp
index bd8234ed9a..9c59e246e3 100644
--- a/plugins/MirLua/src/mlua_options.cpp
+++ b/plugins/MirLua/src/mlua_options.cpp
@@ -1,9 +1,28 @@
#include "stdafx.h"
+CCtrlScriptList::CCtrlScriptList(CDlgBase* dlg, int ctrlId)
+ : CCtrlListView(dlg, ctrlId)
+{
+}
+
+BOOL CCtrlScriptList::OnNotify(int idCtrl, NMHDR *pnmh)
+{
+ if (pnmh->code == NM_CLICK)
+ {
+ TEventInfo evt = { this, pnmh };
+ OnClick(&evt);
+ return TRUE;
+ }
+ return CCtrlListView::OnNotify(idCtrl, pnmh);
+}
+
+/****************************************/
+
CLuaOptions::CLuaOptions(int idDialog) : CDlgBase(g_hInstance, idDialog),
m_scripts(this, IDC_SCRIPTS), isScriptListInit(false),
m_reload(this, IDC_RELOAD)
{
+ m_scripts.OnClick = Callback(this, &CLuaOptions::OnScriptListClick);
m_reload.OnClick = Callback(this, &CLuaOptions::OnReload);
}
@@ -45,6 +64,7 @@ void CLuaOptions::LoadScripts(const TCHAR *scriptDir, int iGroup)
int iItem = m_scripts.AddItem(fd.cFileName, -1, NULL, iGroup);
if (db_get_b(NULL, MODULE, _T2A(fd.cFileName), 1))
m_scripts.SetCheckState(iItem, TRUE);
+ m_scripts.SetItem(iItem, 1, _T(""), 0);
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -71,9 +91,14 @@ void CLuaOptions::OnInitDialog()
{
CDlgBase::OnInitDialog();
- m_scripts.SetExtendedListViewStyle(LVS_EX_CHECKBOXES | LVS_EX_INFOTIP);
+ m_scripts.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_INFOTIP);
m_scripts.EnableGroupView(TRUE);
- m_scripts.AddColumn(0, _T("Script"), 300);
+ m_scripts.AddColumn(0, _T("Script"), 440);
+ m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
+
+ HIMAGELIST hImageList = m_scripts.CreateImageList(LVSIL_SMALL);
+ HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPEN));
+ ImageList_AddIcon(hImageList, icon);
LoadScripts();
@@ -117,6 +142,28 @@ INT_PTR CLuaOptions::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return CDlgBase::DlgProc(msg, wParam, lParam);
}
+void CLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt)
+{
+ LVITEM lvi = { 0 };
+ lvi.iItem = evt->nmlvia->iItem;
+ if (lvi.iItem == -1) return;
+ lvi.pszText = (LPTSTR)mir_calloc(MAX_PATH * sizeof(TCHAR));
+ lvi.cchTextMax = MAX_PATH;
+ lvi.mask = LVIF_GROUPID | LVIF_TEXT;
+ evt->treeviewctrl->GetItem(&lvi);
+ lvi.iSubItem = evt->nmlvia->iSubItem;
+ if (lvi.iSubItem == 1)
+ {
+ TCHAR path[MAX_PATH];
+ if (lvi.iGroupId == 0)
+ FoldersGetCustomPathT(g_hCommonFolderPath, path, _countof(path), VARST(COMMON_SCRIPTS_PATHT));
+ else
+ FoldersGetCustomPathT(g_hCustomFolderPath, path, _countof(path), VARST(CUSTOM_SCRIPTS_PATHT));
+ ShellExecute(m_hwnd, NULL, lvi.pszText, NULL, path, SW_SHOWNORMAL);
+ }
+ mir_free(lvi.pszText);
+}
+
void CLuaOptions::OnReload(CCtrlBase*)
{
isScriptListInit = false;
diff --git a/plugins/MirLua/src/mlua_options.h b/plugins/MirLua/src/mlua_options.h
index 4972656260..f6fd0db164 100644
--- a/plugins/MirLua/src/mlua_options.h
+++ b/plugins/MirLua/src/mlua_options.h
@@ -1,11 +1,26 @@
#ifndef _LUA_OPTIONS_H_
#define _LUA_OPTIONS_H_
+class CCtrlScriptList : public CCtrlListView
+{
+private:
+ typedef CCtrlListView CSuper;
+
+protected:
+ BOOL OnNotify(int idCtrl, NMHDR *pnmh);
+
+public:
+ CCtrlScriptList(CDlgBase* dlg, int ctrlId);
+
+ CCallback<TEventInfo> OnClick;
+};
+
+
class CLuaOptions : public CDlgBase
{
private:
bool isScriptListInit;
- CCtrlListView m_scripts;
+ CCtrlScriptList m_scripts;
CCtrlButton m_reload;
void LoadScripts(const TCHAR *scriptDir, int iGroup = -1);
@@ -15,6 +30,7 @@ protected:
void OnInitDialog();
void OnApply();
+ void OnScriptListClick(CCtrlListView::TEventInfo *evt);
void OnReload(CCtrlBase*);
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
@@ -33,7 +49,7 @@ public:
ctrl.CreateDbLink(new CMOptionLink<T>(option));
}
- static CDlgBase *CreateOptionsPage() { return new CLuaOptions(IDD_OPTIONS_MAIN); }
+ static CDlgBase *CreateOptionsPage() { return new CLuaOptions(IDD_OPTIONS); }
};
#endif //_LUA_OPTIONS_H_ \ No newline at end of file
diff --git a/plugins/MirLua/src/resource.h b/plugins/MirLua/src/resource.h
index 612051cbad..6e93d57ad5 100644
--- a/plugins/MirLua/src/resource.h
+++ b/plugins/MirLua/src/resource.h
@@ -3,18 +3,16 @@
// Used by d:\Projects\MirandaNG\plugins\MirLua\res\resource.rc
//
#define IDI_ICON 100
-#define IDD_OPTIONS_MAIN 106
+#define IDI_OPEN 105
#define IDD_OPTIONS 106
-#define IDC_LIST1 1011
#define IDC_SCRIPTS 1011
-#define IDC_BUTTON1 1012
#define IDC_RELOAD 1012
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101