summaryrefslogtreecommitdiff
path: root/src/modules/skin
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-20 19:57:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-20 19:57:53 +0000
commit386ee5dd838eb988a48109e5de2a0d11e74531b7 (patch)
tree2d7240365933d268563b8610560fa83acc168700 /src/modules/skin
parent24b2f3a4471593fd115ba3eb2c1282d3b52edf7b (diff)
fix for list sorting in the hot keys' editor
git-svn-id: http://svn.miranda-ng.org/main/trunk@502 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/skin')
-rw-r--r--src/modules/skin/hotkeys.cpp34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp
index 6408bcda7d..2d2fd77be0 100644
--- a/src/modules/skin/hotkeys.cpp
+++ b/src/modules/skin/hotkeys.cpp
@@ -568,20 +568,6 @@ static void sttOptionsDeleteHotkey(HWND hwndList, int idx, THotkeyItem *item)
item->rootHotkey->OptChanged = TRUE;
}
-static int sttAlphaSort(const THotkeyItem *p1, const THotkeyItem *p2)
-{
- int res;
- if (res = lstrcmp(p1->getSection(), p2->getSection()))
- return res;
- if (res = lstrcmp(p1->getDescr(), p2->getDescr()))
- return res;
- if (!p1->rootHotkey && p2->rootHotkey)
- return -1;
- if (p1->rootHotkey && !p2->rootHotkey)
- return 1;
- return 0;
-}
-
static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
TCHAR title1[256] = {0}, title2[256] = {0};
@@ -617,7 +603,12 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP
return res;
return 1;
}
- return sttAlphaSort(item1, item2);
+
+ if (res = lstrcmp(item1->getSection(), item2->getSection())) return res;
+ if (res = lstrcmp(item1->getDescr(), item2->getDescr())) return res;
+ if (!item1->rootHotkey && item2->rootHotkey) return -1;
+ if (item1->rootHotkey && !item2->rootHotkey) return 1;
+ return 0;
}
static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item)
@@ -703,19 +694,14 @@ static void sttBuildHotkeyList(HWND hwndList)
int i, nItems=0;
ListView_DeleteAllItems(hwndList);
- // create the temporary list with language-dependent sort order
- LIST<THotkeyItem> tmpList(hotkeys.getCount(), sttAlphaSort);
- for (i = 0; i < hotkeys.getCount(); i++)
- tmpList.insert( hotkeys[i] );
-
- for (i = 0; i < tmpList.getCount(); i++) {
+ for (i = 0; i < hotkeys.getCount(); i++) {
LVITEM lvi = {0};
- THotkeyItem *item = tmpList[i];
+ THotkeyItem *item = hotkeys[i];
if (item->OptDeleted)
continue;
- if ( !i || lstrcmp(item->ptszSection, tmpList[i-1]->ptszSection)) {
+ if ( !i || lstrcmp(item->ptszSection, hotkeys[i-1]->ptszSection)) {
lvi.mask = LVIF_TEXT|LVIF_PARAM;
lvi.iItem = nItems++;
lvi.iSubItem = 0;
@@ -739,6 +725,8 @@ static void sttBuildHotkeyList(HWND hwndList)
ListView_InsertItem(hwndList, &lvi);
sttOptionsSetupItem(hwndList, nItems-1, item);
}
+
+ ListView_SortItemsEx(hwndList, sttOptionsSortList, (LPARAM)hwndList);
}
static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey)