Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Regedit child window |
| 3 | * |
| 4 | * Copyright (C) 2002 Robert Dickenson <robd@reactos.org> |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ |
| 22 | #include <windows.h> |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 23 | #include <commctrl.h> |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 24 | #include <tchar.h> |
| 25 | #include <stdio.h> |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 26 | |
| 27 | #include "main.h" |
| 28 | |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 29 | #include "wine/debug.h" |
| 30 | #include "wine/unicode.h" |
| 31 | |
| 32 | WINE_DEFAULT_DEBUG_CHANNEL(regedit); |
| 33 | |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 34 | ChildWnd* g_pChildWnd; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 35 | |
| 36 | /******************************************************************************* |
| 37 | * Local module support methods |
| 38 | */ |
| 39 | |
Krzysztof Foltman | 83edf20 | 2005-09-26 09:57:56 +0000 | [diff] [blame] | 40 | LPCTSTR GetRootKeyName(HKEY hRootKey) |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 41 | { |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 42 | if (hRootKey == HKEY_CLASSES_ROOT) return _T("HKEY_CLASSES_ROOT"); |
| 43 | if (hRootKey == HKEY_CURRENT_USER) return _T("HKEY_CURRENT_USER"); |
| 44 | if (hRootKey == HKEY_LOCAL_MACHINE) return _T("HKEY_LOCAL_MACHINE"); |
| 45 | if (hRootKey == HKEY_USERS) return _T("HKEY_USERS"); |
| 46 | if (hRootKey == HKEY_CURRENT_CONFIG) return _T("HKEY_CURRENT_CONFIG"); |
Robert Reif | cddb03e | 2004-07-08 20:14:10 +0000 | [diff] [blame] | 47 | if (hRootKey == HKEY_DYN_DATA) return _T("HKEY_DYN_DATA"); |
Krzysztof Foltman | 83edf20 | 2005-09-26 09:57:56 +0000 | [diff] [blame] | 48 | return _T("UNKNOWN HKEY, PLEASE REPORT"); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | static void draw_splitbar(HWND hWnd, int x) |
| 52 | { |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 53 | RECT rt; |
| 54 | HDC hdc = GetDC(hWnd); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 55 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 56 | GetClientRect(hWnd, &rt); |
| 57 | rt.left = x - SPLIT_WIDTH/2; |
| 58 | rt.right = x + SPLIT_WIDTH/2+1; |
| 59 | InvertRect(hdc, &rt); |
| 60 | ReleaseDC(hWnd, hdc); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy) |
| 64 | { |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 65 | HDWP hdwp = BeginDeferWindowPos(2); |
| 66 | RECT rt = {0, 0, cx, cy}; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 67 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 68 | cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 69 | DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); |
| 70 | DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 71 | EndDeferWindowPos(hdwp); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | static void OnPaint(HWND hWnd) |
| 75 | { |
| 76 | PAINTSTRUCT ps; |
| 77 | RECT rt; |
| 78 | HDC hdc; |
| 79 | |
| 80 | GetClientRect(hWnd, &rt); |
| 81 | hdc = BeginPaint(hWnd, &ps); |
Filip Navara | d4baf37 | 2003-12-05 00:09:54 +0000 | [diff] [blame] | 82 | FillRect(ps.hdc, &rt, GetSysColorBrush(COLOR_BTNFACE)); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 83 | EndPaint(hWnd, &ps); |
| 84 | } |
| 85 | |
Krzysztof Foltman | 83edf20 | 2005-09-26 09:57:56 +0000 | [diff] [blame] | 86 | static LPTSTR CombinePaths(LPCTSTR pPaths[], int nPaths) { |
| 87 | int i, len, pos; |
| 88 | LPTSTR combined; |
| 89 | for (i=0, len=0; i<nPaths; i++) { |
| 90 | if (pPaths[i] && *pPaths[i]) { |
| 91 | len += lstrlen(pPaths[i])+1; |
Robert Shearman | 75eae13 | 2005-03-21 11:23:40 +0000 | [diff] [blame] | 92 | } |
| 93 | } |
Krzysztof Foltman | 83edf20 | 2005-09-26 09:57:56 +0000 | [diff] [blame] | 94 | combined = HeapAlloc(GetProcessHeap(), 0, len * sizeof(TCHAR)); |
| 95 | *combined = '\0'; |
| 96 | for (i=0, pos=0; i<nPaths; i++) { |
| 97 | if (pPaths[i] && *pPaths[i]) { |
| 98 | int llen = _tcslen(pPaths[i]); |
| 99 | if (!*combined) |
| 100 | _tcscpy(combined, pPaths[i]); |
| 101 | else { |
| 102 | combined[pos++] = (TCHAR)'\\'; |
| 103 | _tcscpy(combined+pos, pPaths[i]); |
| 104 | } |
| 105 | pos += llen; |
| 106 | } |
Robert Shearman | 75eae13 | 2005-03-21 11:23:40 +0000 | [diff] [blame] | 107 | } |
Krzysztof Foltman | 83edf20 | 2005-09-26 09:57:56 +0000 | [diff] [blame] | 108 | return combined; |
| 109 | } |
| 110 | |
| 111 | LPTSTR GetItemFullPath(HWND hwndTV, HTREEITEM hItem, BOOL bFull) { |
| 112 | LPCTSTR parts[3] = {_T(""), _T(""), _T("")}; |
| 113 | TCHAR text[260]; |
| 114 | HKEY hRootKey = NULL; |
| 115 | if (!hItem) |
| 116 | hItem = TreeView_GetSelection(hwndTV); |
| 117 | parts[2] = GetItemPath(hwndTV, hItem, &hRootKey); |
| 118 | if (!parts[2]) |
| 119 | parts[2] = _T(""); |
| 120 | if (!bFull && !hRootKey && !*parts[2]) |
| 121 | return NULL; |
| 122 | if (hRootKey) |
| 123 | parts[1] = GetRootKeyName(hRootKey); |
| 124 | if (bFull) { |
| 125 | DWORD dwSize = sizeof(text)/sizeof(TCHAR); |
| 126 | GetComputerName(text, &dwSize); |
| 127 | parts[0] = text; |
| 128 | } |
| 129 | return CombinePaths(parts, 3); |
| 130 | } |
| 131 | |
| 132 | static void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BOOL bRefreshLV) |
| 133 | { |
| 134 | if (bRefreshLV) { |
| 135 | LPCTSTR keyPath; |
| 136 | HKEY hRootKey = NULL; |
| 137 | keyPath = GetItemPath(hwndTV, hItem, &hRootKey); |
| 138 | RefreshListView(hwndLV, hRootKey, keyPath, NULL); |
| 139 | } |
| 140 | UpdateStatusBar(); |
Robert Shearman | 75eae13 | 2005-03-21 11:23:40 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 143 | /******************************************************************************* |
| 144 | * |
| 145 | * FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) |
| 146 | * |
| 147 | * PURPOSE: Processes WM_COMMAND messages for the main frame window. |
| 148 | * |
| 149 | */ |
| 150 | |
| 151 | static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 152 | { |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 153 | ChildWnd* pChildWnd = g_pChildWnd; |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 154 | switch (LOWORD(wParam)) { |
| 155 | /* Parse the menu selections: */ |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 156 | case ID_REGISTRY_EXIT: |
| 157 | DestroyWindow(hWnd); |
| 158 | break; |
| 159 | case ID_VIEW_REFRESH: |
Crestez Leonard | 94ce244 | 2005-01-10 16:03:22 +0000 | [diff] [blame] | 160 | WINE_TRACE("Is this ever called or is it just dead code?\n"); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 161 | /* TODO */ |
| 162 | break; |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 163 | case ID_SWITCH_PANELS: |
| 164 | pChildWnd->nFocusPanel = !pChildWnd->nFocusPanel; |
| 165 | SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd); |
| 166 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 167 | default: |
| 168 | return FALSE; |
| 169 | } |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 170 | return TRUE; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /******************************************************************************* |
| 174 | * |
| 175 | * FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG) |
| 176 | * |
| 177 | * PURPOSE: Processes messages for the child windows. |
| 178 | * |
| 179 | * WM_COMMAND - process the application menu |
| 180 | * WM_PAINT - Paint the main window |
| 181 | * WM_DESTROY - post a quit message and return |
| 182 | * |
| 183 | */ |
| 184 | LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 185 | { |
| 186 | static int last_split; |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 187 | ChildWnd* pChildWnd = g_pChildWnd; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 188 | |
| 189 | switch (message) { |
| 190 | case WM_CREATE: |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 191 | g_pChildWnd = pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd)); |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 192 | if (!pChildWnd) return 0; |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 193 | _tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 194 | pChildWnd->nSplitPos = 250; |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 195 | pChildWnd->hWnd = hWnd; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 196 | pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW); |
| 197 | pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/); |
Robert Shearman | ac37f4c | 2006-01-05 12:18:43 +0100 | [diff] [blame] | 198 | pChildWnd->nFocusPanel = 1; |
Thomas Weidenmueller | 7285f46 | 2004-01-16 21:20:54 +0000 | [diff] [blame] | 199 | SetFocus(pChildWnd->hTreeWnd); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 200 | break; |
| 201 | case WM_COMMAND: |
| 202 | if (!_CmdWndProc(hWnd, message, wParam, lParam)) { |
| 203 | goto def; |
| 204 | } |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 205 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 206 | case WM_PAINT: |
| 207 | OnPaint(hWnd); |
| 208 | return 0; |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 209 | case WM_SETCURSOR: |
| 210 | if (LOWORD(lParam) == HTCLIENT) { |
| 211 | POINT pt; |
| 212 | GetCursorPos(&pt); |
| 213 | ScreenToClient(hWnd, &pt); |
| 214 | if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) { |
| 215 | SetCursor(LoadCursor(0, IDC_SIZEWE)); |
| 216 | return TRUE; |
| 217 | } |
| 218 | } |
| 219 | goto def; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 220 | case WM_DESTROY: |
Dimitrie O. Paun | 1661453 | 2003-12-12 04:08:59 +0000 | [diff] [blame] | 221 | HeapFree(GetProcessHeap(), 0, pChildWnd); |
| 222 | pChildWnd = NULL; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 223 | PostQuitMessage(0); |
| 224 | break; |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 225 | case WM_LBUTTONDOWN: { |
| 226 | RECT rt; |
| 227 | int x = LOWORD(lParam); |
| 228 | GetClientRect(hWnd, &rt); |
| 229 | if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) { |
| 230 | last_split = pChildWnd->nSplitPos; |
| 231 | draw_splitbar(hWnd, last_split); |
| 232 | SetCapture(hWnd); |
| 233 | } |
| 234 | break; |
| 235 | } |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 236 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 237 | case WM_LBUTTONUP: |
| 238 | if (GetCapture() == hWnd) { |
| 239 | RECT rt; |
| 240 | int x = LOWORD(lParam); |
| 241 | draw_splitbar(hWnd, last_split); |
| 242 | last_split = -1; |
| 243 | GetClientRect(hWnd, &rt); |
| 244 | pChildWnd->nSplitPos = x; |
| 245 | ResizeWnd(pChildWnd, rt.right, rt.bottom); |
| 246 | ReleaseCapture(); |
| 247 | } |
| 248 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 249 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 250 | case WM_CAPTURECHANGED: |
| 251 | if (GetCapture()==hWnd && last_split>=0) |
| 252 | draw_splitbar(hWnd, last_split); |
| 253 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 254 | |
| 255 | case WM_KEYDOWN: |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 256 | if (wParam == VK_ESCAPE) |
| 257 | if (GetCapture() == hWnd) { |
| 258 | RECT rt; |
| 259 | draw_splitbar(hWnd, last_split); |
| 260 | GetClientRect(hWnd, &rt); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 261 | ResizeWnd(pChildWnd, rt.right, rt.bottom); |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 262 | last_split = -1; |
| 263 | ReleaseCapture(); |
| 264 | SetCursor(LoadCursor(0, IDC_ARROW)); |
| 265 | } |
| 266 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 267 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 268 | case WM_MOUSEMOVE: |
| 269 | if (GetCapture() == hWnd) { |
| 270 | RECT rt; |
| 271 | int x = LOWORD(lParam); |
| 272 | HDC hdc = GetDC(hWnd); |
| 273 | GetClientRect(hWnd, &rt); |
| 274 | rt.left = last_split-SPLIT_WIDTH/2; |
| 275 | rt.right = last_split+SPLIT_WIDTH/2+1; |
| 276 | InvertRect(hdc, &rt); |
| 277 | last_split = x; |
| 278 | rt.left = x-SPLIT_WIDTH/2; |
| 279 | rt.right = x+SPLIT_WIDTH/2+1; |
| 280 | InvertRect(hdc, &rt); |
| 281 | ReleaseDC(hWnd, hdc); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 282 | } |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 283 | break; |
| 284 | |
| 285 | case WM_SETFOCUS: |
| 286 | if (pChildWnd != NULL) { |
| 287 | SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd); |
| 288 | } |
| 289 | break; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 290 | |
| 291 | case WM_TIMER: |
| 292 | break; |
| 293 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 294 | case WM_NOTIFY: |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 295 | if ((int)wParam == TREE_WINDOW) { |
| 296 | switch (((LPNMHDR)lParam)->code) { |
| 297 | case TVN_ITEMEXPANDING: |
| 298 | return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam); |
Robert Shearman | 75eae13 | 2005-03-21 11:23:40 +0000 | [diff] [blame] | 299 | case TVN_SELCHANGED: |
| 300 | OnTreeSelectionChanged(pChildWnd->hTreeWnd, pChildWnd->hListWnd, |
| 301 | ((NMTREEVIEW *)lParam)->itemNew.hItem, TRUE); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 302 | break; |
Thomas Weidenmueller | 7285f46 | 2004-01-16 21:20:54 +0000 | [diff] [blame] | 303 | case NM_SETFOCUS: |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 304 | pChildWnd->nFocusPanel = 0; |
Thomas Weidenmueller | 7285f46 | 2004-01-16 21:20:54 +0000 | [diff] [blame] | 305 | break; |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 306 | case NM_RCLICK: { |
| 307 | POINT pt; |
| 308 | GetCursorPos(&pt); |
| 309 | TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), |
| 310 | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL); |
| 311 | break; |
| 312 | } |
Dimitrie O. Paun | fb1845d | 2004-03-15 20:19:38 +0000 | [diff] [blame] | 313 | case TVN_ENDLABELEDIT: { |
| 314 | HKEY hRootKey; |
| 315 | LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam; |
| 316 | LPCTSTR path = GetItemPath(pChildWnd->hTreeWnd, 0, &hRootKey); |
| 317 | BOOL res = RenameKey(hWnd, hRootKey, path, dispInfo->item.pszText); |
| 318 | if (res) { |
| 319 | TVITEMEX item; |
| 320 | item.mask = TVIF_HANDLE | TVIF_TEXT; |
| 321 | item.hItem = TreeView_GetSelection(pChildWnd->hTreeWnd); |
| 322 | item.pszText = dispInfo->item.pszText; |
Mike McCormack | d8bc687 | 2006-03-03 12:28:43 +0900 | [diff] [blame] | 323 | SendMessage( pChildWnd->hTreeWnd, TVM_SETITEMW, 0, (LPARAM)&item ); |
Dimitrie O. Paun | fb1845d | 2004-03-15 20:19:38 +0000 | [diff] [blame] | 324 | } |
| 325 | return res; |
| 326 | } |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 327 | default: |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 328 | return 0; /* goto def; */ |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 329 | } |
| 330 | } else |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 331 | if ((int)wParam == LIST_WINDOW) { |
Thomas Weidenmueller | 7285f46 | 2004-01-16 21:20:54 +0000 | [diff] [blame] | 332 | if (((LPNMHDR)lParam)->code == NM_SETFOCUS) { |
Krzysztof Foltman | b2d8cd3 | 2004-05-04 02:55:28 +0000 | [diff] [blame] | 333 | pChildWnd->nFocusPanel = 1; |
| 334 | } else if (!SendMessage(pChildWnd->hListWnd, WM_NOTIFY_REFLECT, wParam, lParam)) { |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 335 | goto def; |
| 336 | } |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 337 | } |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 338 | break; |
| 339 | |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 340 | case WM_SIZE: |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 341 | if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) { |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 342 | ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam)); |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 343 | } |
| 344 | /* fall through */ |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 345 | default: def: |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 346 | return DefWindowProc(hWnd, message, wParam, lParam); |
Dimitrie O. Paun | 58c185e | 2003-12-08 22:48:07 +0000 | [diff] [blame] | 347 | } |
| 348 | return 0; |
Alexandre Julliard | f752b124 | 2003-08-07 03:10:13 +0000 | [diff] [blame] | 349 | } |