Commit a9bae962 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

regedit: Sort each of top level branches separately.

parent a3f36a04
...@@ -461,6 +461,17 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -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) ...@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment