regedit: Sort each of top level branches separately.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-02-17 18:09:53 +03:00 committed by Alexandre Julliard
parent a3f36a045f
commit a9bae9629c
1 changed files with 12 additions and 1 deletions

View File

@ -461,6 +461,17 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
return TRUE; return TRUE;
} }
static void treeview_sort_item(HWND hWnd, HTREEITEM item)
{
HTREEITEM child = (HTREEITEM)SendMessageW(hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)item);
while (child != NULL) {
treeview_sort_item(hWnd, child);
child = (HTREEITEM)SendMessageW(hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)child);
}
SendMessageW(hWnd, TVM_SORTCHILDREN, 0, (LPARAM)item);
}
BOOL RefreshTreeView(HWND hwndTV) BOOL RefreshTreeView(HWND hwndTV)
{ {
HTREEITEM hItem; HTREEITEM hItem;
@ -477,12 +488,12 @@ BOOL RefreshTreeView(HWND hwndTV)
hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot); hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot);
while (hItem) { while (hItem) {
RefreshTreeItem(hwndTV, hItem); RefreshTreeItem(hwndTV, hItem);
treeview_sort_item(hwndTV, hItem);
hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);
} }
SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0); SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
InvalidateRect(hwndTV, NULL, FALSE); InvalidateRect(hwndTV, NULL, FALSE);
SendMessageW(hwndTV, TVM_SORTCHILDREN, TRUE, (LPARAM)hSelectedItem);
SetCursor(hcursorOld); SetCursor(hcursorOld);
/* We reselect the currently selected node, this will prompt a refresh of the listview. */ /* We reselect the currently selected node, this will prompt a refresh of the listview. */