Hugh McMaster : regedit: Update the listview path when renaming a treeview node.
Alexandre Julliard
julliard at winehq.org
Wed Jul 12 15:37:26 CDT 2017
Module: wine
Branch: master
Commit: 7d0f2deca303468ed67582caa2a0fa56d4eb4cba
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d0f2deca303468ed67582caa2a0fa56d4eb4cba
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Wed Jul 12 11:08:54 2017 +0000
regedit: Update the listview path when renaming a treeview node.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/regedit/childwnd.c | 1 +
programs/regedit/listview.c | 19 +++++++++++++------
programs/regedit/main.h | 1 +
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 37f4261..2a646ef 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -466,6 +466,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
fullPath = GetPathFullPath(g_pChildWnd->hTreeWnd, path);
SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
HeapFree(GetProcessHeap(), 0, fullPath);
+ update_listview_path(path);
HeapFree(GetProcessHeap(), 0, path);
}
SetWindowLongPtrW(g_pChildWnd->hTreeWnd, GWLP_USERDATA, 0);
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c
index dc3152d..9e271ad 100644
--- a/programs/regedit/listview.c
+++ b/programs/regedit/listview.c
@@ -91,6 +91,17 @@ LPCWSTR GetValueName(HWND hwndLV)
return g_valueName;
}
+BOOL update_listview_path(const WCHAR *path)
+{
+ HeapFree(GetProcessHeap(), 0, g_currentPath);
+
+ g_currentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path) + 1) * sizeof(WCHAR));
+ if (!g_currentPath) return FALSE;
+ lstrcpyW(g_currentPath, path);
+
+ return TRUE;
+}
+
/* convert '\0' separated string list into ',' separated string list */
static void MakeMULTISZDisplayable(LPWSTR multi)
{
@@ -557,12 +568,8 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highli
SendMessageW(hwndLV, LVM_SORTITEMS, (WPARAM)hwndLV, (LPARAM)CompareFunc);
g_currentRootKey = hKeyRoot;
- if (keyPath != g_currentPath) {
- HeapFree(GetProcessHeap(), 0, g_currentPath);
- g_currentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(keyPath) + 1) * sizeof(WCHAR));
- if (!g_currentPath) goto done;
- lstrcpyW(g_currentPath, keyPath);
- }
+ if (keyPath != g_currentPath && !update_listview_path(keyPath))
+ goto done;
result = TRUE;
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index 5331189..f3fbf86 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -117,6 +117,7 @@ extern void SetupStatusBar(HWND hWnd, BOOL bResize);
extern void UpdateStatusBar(void);
/* listview.c */
+extern BOOL update_listview_path(const WCHAR *path);
extern void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD size);
extern int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int pos);
extern HWND CreateListView(HWND hwndParent, UINT id);
More information about the wine-cvs
mailing list