Changes to regedit:

* Fixed updating tree view when renaming a key
* Fixed a tree view refresh bug
* Proper updating of the tree view when deleting keys

svn path=/trunk/; revision=29309
This commit is contained in:
Gregor Brunmar 2007-09-30 13:31:44 +00:00
parent 67dadefc81
commit 1a98d2a214
3 changed files with 18 additions and 13 deletions

View file

@ -522,7 +522,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
HKEY hRootKey;
HKEY hKey = NULL;
LPNMTVDISPINFO ptvdi;
LONG lResult = ERROR_SUCCESS;
LONG lResult = TRUE;
TCHAR szBuffer[MAX_PATH];
ptvdi = (LPNMTVDISPINFO) lParam;
@ -533,13 +533,14 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
keyPath = GetItemPath(pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
if (RegOpenKeyEx(hRootKey, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
lResult = REG_OPENED_EXISTING_KEY;
lResult = FALSE;
RegCloseKey(hKey);
(void)TreeView_EditLabel(pChildWnd->hTreeWnd, ptvdi->item.hItem);
}
else
{
lResult = RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText);
if (RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText) != ERROR_SUCCESS)
lResult = FALSE;
}
return lResult;
}

View file

@ -949,7 +949,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MessageBeep(MB_ICONHAND);
} else
if (DeleteKey(hWnd, hKeyRoot, keyPath))
{
DeleteNode(g_pChildWnd->hTreeWnd, 0);
RefreshTreeView(g_pChildWnd->hTreeWnd);
}
}
break;
case ID_EDIT_NEW_STRINGVALUE:

View file

@ -218,6 +218,16 @@ BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
pszNodes[dwActualSize] = '\0';
}
/* Now go through all the children in the tree, and check if any have to be removed. */
childItem = TreeView_GetChild(hwndTV, hItem);
while (childItem) {
HTREEITEM nextItem = TreeView_GetNextSibling(hwndTV, childItem);
if (RefreshTreeItem(hwndTV, childItem) == FALSE) {
(void)TreeView_DeleteItem(hwndTV, childItem);
}
childItem = nextItem;
}
/* Now go through all the children in the registry, and check if any have to be added. */
bAddedAny = FALSE;
for (dwIndex = 0; dwIndex < dwCount; dwIndex++) {
@ -258,15 +268,6 @@ BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
if (bAddedAny)
SendMessage(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM) hItem);
/* Now go through all the children in the tree, and check if any have to be removed. */
childItem = TreeView_GetChild(hwndTV, hItem);
while (childItem) {
HTREEITEM nextItem = TreeView_GetNextSibling(hwndTV, childItem);
if (RefreshTreeItem(hwndTV, childItem) == FALSE) {
(void)TreeView_DeleteItem(hwndTV, childItem);
}
childItem = nextItem;
}
bSuccess = TRUE;
done: