https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c83211277131a19e6c9a5…
commit c83211277131a19e6c9a5ceb81f855a86c3be159
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Apr 19 15:12:59 2020 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Apr 19 15:14:44 2020 +0200
[REGEDIT] Fix tree view popup menu issues
Move the tree view popup menu code from the childwindow to the framewindow.
CORE-16887
---
base/applications/regedit/childwnd.c | 104 +----------------------------------
base/applications/regedit/framewnd.c | 45 +++++++++++++++
2 files changed, 48 insertions(+), 101 deletions(-)
diff --git a/base/applications/regedit/childwnd.c b/base/applications/regedit/childwnd.c
index 4cbd30d6b2c..e5c2788da15 100644
--- a/base/applications/regedit/childwnd.c
+++ b/base/applications/regedit/childwnd.c
@@ -24,7 +24,7 @@ ChildWnd* g_pChildWnd;
static int last_split;
HBITMAP SizingPattern = 0;
HBRUSH SizingBrush = 0;
-static WCHAR Suggestions[256];
+WCHAR Suggestions[256];
extern LPCWSTR get_root_key_name(HKEY hRootKey)
{
@@ -129,99 +129,6 @@ static void finish_splitbar(HWND hWnd, int x)
ReleaseCapture();
}
-/*******************************************************************************
- *
- * FUNCTION: ChildWnd_CmdWndProc(HWND, unsigned, WORD, LONG)
- *
- * PURPOSE: Processes WM_COMMAND messages for the main frame window.
- *
- */
-
-static BOOL ChildWnd_CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- HTREEITEM hSelection;
- HKEY hRootKey;
- LPCWSTR keyPath, s;
- WORD wID = LOWORD(wParam);
-
- UNREFERENCED_PARAMETER(message);
-
- switch (wID)
- {
- /* Parse the menu selections: */
- case ID_REGISTRY_EXIT:
- DestroyWindow(hWnd);
- break;
- case ID_VIEW_REFRESH:
- /* TODO */
- break;
- case ID_TREE_EXPANDBRANCH:
- TreeView_Expand(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND);
- break;
- case ID_TREE_COLLAPSEBRANCH:
- TreeView_Expand(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE);
- break;
- case ID_TREE_RENAME:
- SetFocus(g_pChildWnd->hTreeWnd);
- TreeView_EditLabel(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd));
- break;
- case ID_TREE_DELETE:
- hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
- keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
-
- if (keyPath == 0 || *keyPath == 0)
- {
- MessageBeep(MB_ICONHAND);
- }
- else if (DeleteKey(hWnd, hRootKey, keyPath))
- DeleteNode(g_pChildWnd->hTreeWnd, 0);
- break;
- case ID_TREE_EXPORT:
- ExportRegistryFile(g_pChildWnd->hTreeWnd);
- break;
- case ID_TREE_PERMISSIONS:
- hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
- keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
- RegKeyEditPermissions(hWnd, hRootKey, NULL, keyPath);
- break;
- case ID_EDIT_FIND:
- FindDialog(hWnd);
- break;
- case ID_EDIT_COPYKEYNAME:
- hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
- keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
- CopyKeyName(hWnd, hRootKey, keyPath);
- break;
- case ID_EDIT_NEW_KEY:
- CreateNewKey(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd));
- break;
- case ID_EDIT_NEW_STRINGVALUE:
- case ID_EDIT_NEW_BINARYVALUE:
- case ID_EDIT_NEW_DWORDVALUE:
- SendMessageW(hFrameWnd, WM_COMMAND, wParam, lParam);
- break;
- case ID_SWITCH_PANELS:
- g_pChildWnd->nFocusPanel = !g_pChildWnd->nFocusPanel;
- SetFocus(g_pChildWnd->nFocusPanel? g_pChildWnd->hListWnd:
g_pChildWnd->hTreeWnd);
- break;
- default:
- if ((wID >= ID_TREE_SUGGESTION_MIN) && (wID <=
ID_TREE_SUGGESTION_MAX))
- {
- s = Suggestions;
- while(wID > ID_TREE_SUGGESTION_MIN)
- {
- if (*s)
- s += wcslen(s) + 1;
- wID--;
- }
- SelectNode(g_pChildWnd->hTreeWnd, s);
- break;
- }
- return FALSE;
- }
- return TRUE;
-}
-
/*******************************************************************************
*
* Key suggestion
@@ -454,12 +361,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lPa
{
PostMessageW(g_pChildWnd->hAddressBarWnd, WM_KEYUP, VK_RETURN, 0);
}
-
- if (!ChildWnd_CmdWndProc(hWnd, message, wParam, lParam))
- {
- goto def;
- }
- break;
+ break; //goto def;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT)
{
@@ -828,7 +730,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lPa
}
}
}
- TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0,
g_pChildWnd->hWnd, NULL);
+ TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0,
hFrameWnd/*g_pChildWnd->hWnd*/, NULL);
}
}
break;
diff --git a/base/applications/regedit/framewnd.c b/base/applications/regedit/framewnd.c
index 00df7aff513..9fa92ec30e2 100644
--- a/base/applications/regedit/framewnd.c
+++ b/base/applications/regedit/framewnd.c
@@ -34,6 +34,7 @@ static WCHAR s_szFavoritesRegKey[] =
L"Software\\Microsoft\\Windows\\CurrentVers
static BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
+extern WCHAR Suggestions[256];
/*******************************************************************************
* Local module support methods
*/
@@ -1257,6 +1258,38 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
case ID_EDIT_NEW_KEY:
CreateNewKey(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd));
break;
+
+ case ID_TREE_EXPANDBRANCH:
+ TreeView_Expand(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND);
+ break;
+ case ID_TREE_COLLAPSEBRANCH:
+ TreeView_Expand(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE);
+ break;
+ case ID_TREE_RENAME:
+ SetFocus(g_pChildWnd->hTreeWnd);
+ TreeView_EditLabel(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd));
+ break;
+ case ID_TREE_DELETE:
+ keyPath = GetItemPath(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), &hKeyRoot);
+ if (keyPath == 0 || *keyPath == 0)
+ {
+ MessageBeep(MB_ICONHAND);
+ }
+ else if (DeleteKey(hWnd, hKeyRoot, keyPath))
+ DeleteNode(g_pChildWnd->hTreeWnd, 0);
+ break;
+ case ID_TREE_EXPORT:
+ ExportRegistryFile(g_pChildWnd->hTreeWnd);
+ break;
+ case ID_TREE_PERMISSIONS:
+ keyPath = GetItemPath(g_pChildWnd->hTreeWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), &hKeyRoot);
+ RegKeyEditPermissions(hWnd, hKeyRoot, NULL, keyPath);
+ break;
+ case ID_SWITCH_PANELS:
+ g_pChildWnd->nFocusPanel = !g_pChildWnd->nFocusPanel;
+ SetFocus(g_pChildWnd->nFocusPanel? g_pChildWnd->hListWnd:
g_pChildWnd->hTreeWnd);
+ break;
+
default:
if ((LOWORD(wParam) >= ID_FAVORITES_MIN) && (LOWORD(wParam) <=
ID_FAVORITES_MAX))
{
@@ -1278,6 +1311,18 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
ChooseFavorite(szFavorite);
}
}
+ else if ((LOWORD(wParam) >= ID_TREE_SUGGESTION_MIN) && (LOWORD(wParam)
<= ID_TREE_SUGGESTION_MAX))
+ {
+ WORD wID = LOWORD(wParam);
+ LPCWSTR s = Suggestions;
+ while(wID > ID_TREE_SUGGESTION_MIN)
+ {
+ if (*s)
+ s += wcslen(s) + 1;
+ wID--;
+ }
+ SelectNode(g_pChildWnd->hTreeWnd, s);
+ }
else
{
result = FALSE;