diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-26 16:07:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-26 16:07:59 +0000 |
commit | 03641e5604df02401380428a5382def79a266704 (patch) | |
tree | 157acaebf8c1045e1ceb7da24de90f641d1bd365 /src | |
parent | aaf3d972a3b32623f7e2984382adc5ca633bb280 (diff) |
forced sorting order for plugins' options
git-svn-id: http://svn.miranda-ng.org/main/trunk@2085 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index db6f257aca..7a7956a5da 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -52,7 +52,6 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA* fd, TCHAR* path, WPARAM, LPARAM l {
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\Plugins\\%s"), path, fd->cFileName);
- HINSTANCE hInst = GetModuleHandle(buf);
CharLower(fd->cFileName);
@@ -63,14 +62,14 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA* fd, TCHAR* path, WPARAM, LPARAM l int isdb = hasMuuid(pi, miid_database);
PluginListItemData* dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData));
- dat->hInst = hInst;
_tcsncpy(dat->fileName, fd->cFileName, SIZEOF(dat->fileName));
+
+ HINSTANCE hInst = dat->hInst = GetModuleHandle(buf);
HWND hwndList = (HWND)lParam;
LVITEM it = { 0 };
it.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
it.iImage = (pi.pluginInfo->flags & 1) ? 0 : 1;
- it.iItem = 100000; // add to the end
it.lParam = (LPARAM)dat;
int iRow = ListView_InsertItem(hwndList, &it);
if (isPluginOnWhiteList(fd->cFileName))
@@ -229,6 +228,15 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP return CallWindowProc(wnProc, hwnd, msg, wParam, lParam);
}
+static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM lParamSort)
+{
+ HWND hwndList = (HWND)lParamSort;
+ TCHAR tszFile1[MAX_PATH], tszFile2[MAX_PATH];
+ ListView_GetItemText(hwndList, i1, 2, tszFile1, SIZEOF(tszFile1));
+ ListView_GetItemText(hwndList, i2, 2, tszFile2, SIZEOF(tszFile2));
+ return _tcscmp(tszFile1, tszFile2); // always sorting backwards
+}
+
INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -287,6 +295,8 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar w = ListView_GetColumnWidth(hwndList, 3);
if (w > max)
ListView_SetColumnWidth(hwndList, 3, max);
+
+ ListView_SortItems(hwndList, SortPlugins, (LPARAM)hwndDlg);
}
return TRUE;
|