mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[REGEDIT] Fix tree view popup menu issues
Move the tree view popup menu code from the childwindow to the framewindow. CORE-16887
This commit is contained in:
parent
309e9c13e1
commit
c832112771
|
@ -24,7 +24,7 @@ ChildWnd* g_pChildWnd;
|
||||||
static int last_split;
|
static int last_split;
|
||||||
HBITMAP SizingPattern = 0;
|
HBITMAP SizingPattern = 0;
|
||||||
HBRUSH SizingBrush = 0;
|
HBRUSH SizingBrush = 0;
|
||||||
static WCHAR Suggestions[256];
|
WCHAR Suggestions[256];
|
||||||
|
|
||||||
extern LPCWSTR get_root_key_name(HKEY hRootKey)
|
extern LPCWSTR get_root_key_name(HKEY hRootKey)
|
||||||
{
|
{
|
||||||
|
@ -129,99 +129,6 @@ static void finish_splitbar(HWND hWnd, int x)
|
||||||
ReleaseCapture();
|
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
|
* 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);
|
PostMessageW(g_pChildWnd->hAddressBarWnd, WM_KEYUP, VK_RETURN, 0);
|
||||||
}
|
}
|
||||||
|
break; //goto def;
|
||||||
if (!ChildWnd_CmdWndProc(hWnd, message, wParam, lParam))
|
|
||||||
{
|
|
||||||
goto def;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
if (LOWORD(lParam) == HTCLIENT)
|
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;
|
break;
|
||||||
|
|
|
@ -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 */
|
static BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
|
||||||
|
|
||||||
|
extern WCHAR Suggestions[256];
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Local module support methods
|
* Local module support methods
|
||||||
*/
|
*/
|
||||||
|
@ -1257,6 +1258,38 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
case ID_EDIT_NEW_KEY:
|
case ID_EDIT_NEW_KEY:
|
||||||
CreateNewKey(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
|
CreateNewKey(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
|
||||||
break;
|
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:
|
default:
|
||||||
if ((LOWORD(wParam) >= ID_FAVORITES_MIN) && (LOWORD(wParam) <= ID_FAVORITES_MAX))
|
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);
|
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
|
else
|
||||||
{
|
{
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue