From 973445eeffbd60a71f5fe8687721ac7a43d04d36 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 31 Jan 2004 17:09:19 +0000 Subject: [PATCH] re-activate already open shell/ntobj child windows instead of opening new windows svn path=/trunk/; revision=7941 --- reactos/subsys/system/explorer/explorer.h | 4 +++- .../subsys/system/explorer/shell/mainframe.cpp | 18 ++++++++++++++++-- .../system/explorer/shell/shellbrowser.cpp | 5 ++++- .../system/explorer/shell/shellbrowser.h | 2 ++ .../system/explorer/taskbar/quicklaunch.h | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/reactos/subsys/system/explorer/explorer.h b/reactos/subsys/system/explorer/explorer.h index 92df868a6ae..8370d489e75 100644 --- a/reactos/subsys/system/explorer/explorer.h +++ b/reactos/subsys/system/explorer/explorer.h @@ -44,7 +44,9 @@ #define PM_GET_FILEWND_PTR (WM_APP+0x05) -#define PM_GET_CONTROLWINDOW (WM_APP+0x06) +#define PM_GET_SHELLBROWSER_PTR (WM_APP+0x06) + +#define PM_GET_CONTROLWINDOW (WM_APP+0x16) #define PM_RESIZE_CHILDREN (WM_APP+0x17) #define PM_GET_WIDTH (WM_APP+0x18) diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 8c3a64f9e1f..2c8e7eed440 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -523,6 +523,9 @@ int MainFrame::Command(int id, int code) break;} case ID_DRIVE_NTOBJ_NS: { + if (activate_fs_window(TEXT("NTOBJ"))) + break; + #ifndef _NO_MDI FileChildWindow::create(_hmdiclient, NtObjChildWndInfo(TEXT("\\"))); #else @@ -533,10 +536,8 @@ int MainFrame::Command(int id, int code) case ID_DRIVE_DESKTOP: { TCHAR path[MAX_PATH]; - /*TODO if (activate_fs_window(TEXT("Desktop"))) break; - */ GetCurrentDirectory(MAX_PATH, path); @@ -769,6 +770,19 @@ bool MainFrame::activate_fs_window(LPCTSTR filesys) return true; } + } else { + ShellBrowserChild* shell_child = (ShellBrowserChild*) SendMessage(child_wnd, PM_GET_SHELLBROWSER_PTR, 0, 0); + + if (shell_child) { + if (!lstrcmpi(shell_child->get_root()._fs, filesys)) { + SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0); + + if (IsMinimized(child_wnd)) + ShowWindow(child_wnd, SW_SHOWNORMAL); + + return true; + } + } } } diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.cpp b/reactos/subsys/system/explorer/shell/shellbrowser.cpp index 2d93855d5d8..2465d915ec4 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.cpp +++ b/reactos/subsys/system/explorer/shell/shellbrowser.cpp @@ -117,7 +117,7 @@ void ShellBrowserChild::InitializeTree() _root._drive_type = DRIVE_UNKNOWN; lstrcpy(_root._volname, root_name); // most of the time "Desktop" _root._fs_flags = 0; - lstrcpy(_root._fs, TEXT("Shell")); + lstrcpy(_root._fs, TEXT("Desktop")); //@@ _root._entry->read_tree(shell_info._root_shell_path.get_folder(), info._shell_path, SORT_NAME/*_sortOrder*/); @@ -406,6 +406,9 @@ LRESULT ShellBrowserChild::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) case WM_GETISHELLBROWSER: // for Registry Explorer Plugin return (LRESULT)static_cast(this); + case PM_GET_SHELLBROWSER_PTR: + return (LRESULT)this; + case PM_DISPATCH_COMMAND: { switch(LOWORD(wparam)) { case ID_WINDOW_NEW: {CONTEXT("ShellBrowserChild PM_DISPATCH_COMMAND ID_WINDOW_NEW"); diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.h b/reactos/subsys/system/explorer/shell/shellbrowser.h index 5cfe04cd81c..2a224724faf 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.h +++ b/reactos/subsys/system/explorer/shell/shellbrowser.h @@ -101,6 +101,8 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl return E_NOTIMPL; } + const Root& get_root() const {return _root;} + protected: Root _root; diff --git a/reactos/subsys/system/explorer/taskbar/quicklaunch.h b/reactos/subsys/system/explorer/taskbar/quicklaunch.h index 10ef42c30d2..b9bedf5b1ab 100644 --- a/reactos/subsys/system/explorer/taskbar/quicklaunch.h +++ b/reactos/subsys/system/explorer/taskbar/quicklaunch.h @@ -31,7 +31,7 @@ #define IDW_QUICKLAUNCHBAR 101 -#define PM_REFRESH (WM_APP+0x16) +#define PM_REFRESH (WM_APP+0x1B) #define IDC_FIRST_QUICK_ID 0x4000