Commit 75eae135 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Always display path in status bar.

parent 77da3d2d
......@@ -83,6 +83,35 @@ static void OnPaint(HWND hWnd)
EndPaint(hWnd, &ps);
}
void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BOOL bRefreshLV)
{
LPCTSTR keyPath, rootName;
LPTSTR fullPath;
HKEY hRootKey;
keyPath = GetItemPath(hwndTV, hItem, &hRootKey);
if (keyPath) {
if (bRefreshLV)
RefreshListView(hwndLV, hRootKey, keyPath, NULL);
rootName = get_root_key_name(hRootKey);
fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
if (fullPath) {
_stprintf(fullPath, "%s\\%s", rootName, keyPath);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
HeapFree(GetProcessHeap(), 0, fullPath);
}
}
else {
/* else the computer icon is being selected, so display computer name */
TCHAR text[260];
DWORD size;
size = sizeof(text)/sizeof(TCHAR);
GetComputerName(text, &size);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
}
}
/*******************************************************************************
*
* FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
......@@ -238,23 +267,9 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
switch (((LPNMHDR)lParam)->code) {
case TVN_ITEMEXPANDING:
return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
case TVN_SELCHANGED: {
LPCTSTR keyPath, rootName;
LPTSTR fullPath;
HKEY hRootKey;
keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
if (keyPath) {
RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath, NULL);
rootName = get_root_key_name(hRootKey);
fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
if (fullPath) {
_stprintf(fullPath, "%s\\%s", rootName, keyPath);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
HeapFree(GetProcessHeap(), 0, fullPath);
}
}
}
case TVN_SELCHANGED:
OnTreeSelectionChanged(pChildWnd->hTreeWnd, pChildWnd->hListWnd,
((NMTREEVIEW *)lParam)->itemNew.hItem, TRUE);
break;
case NM_SETFOCUS:
pChildWnd->nFocusPanel = 0;
......
......@@ -121,16 +121,16 @@ void SetupStatusBar(HWND hWnd, BOOL bResize)
if (bResize)
SendMessage(hStatusBar, WM_SIZE, 0, 0);
SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
UpdateStatusBar();
}
void UpdateStatusBar(void)
{
TCHAR text[260];
DWORD size;
size = sizeof(text)/sizeof(TCHAR);
GetComputerName(text, &size);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
/* real updating of status bar happens in the treeview selection
* change handler, so fake a selection change to it, but don't
* refresh the listview or the current selection will change */
OnTreeSelectionChanged(g_pChildWnd->hTreeWnd, g_pChildWnd->hListWnd,
TreeView_GetSelection(g_pChildWnd->hTreeWnd), FALSE);
}
static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
......
......@@ -103,6 +103,7 @@ extern BOOL IsDefaultValue(HWND hwndLV, int i);
extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
extern BOOL RefreshTreeView(HWND hWndTV);
extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
extern void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BOOL bRefreshLV);
extern LPCTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
extern BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPTSTR name);
......
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