From 49f689ef953520c31d199c7e151d2b0afddd1abc Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 27 Aug 2003 21:07:33 +0000 Subject: [PATCH] partly implemented control panel window svn path=/trunk/; revision=5885 --- .../subsys/system/explorer/doc/changes.txt | 4 +++- reactos/subsys/system/explorer/explorer.cpp | 11 +++++----- .../subsys/system/explorer/explorer_intres.h | 1 + .../subsys/system/explorer/explorer_intres.rc | 3 +++ .../system/explorer/shell/filechild.cpp | 6 +++--- .../system/explorer/shell/mainframe.cpp | 17 ++++++++++++---- .../system/explorer/shell/shellbrowser.cpp | 20 +++++++++++-------- .../system/explorer/shell/shellbrowser.h | 8 +++++--- .../subsys/system/explorer/shell/shellfs.h | 10 +++++----- .../subsys/system/explorer/shell/startup.c | 17 ++++++---------- .../system/explorer/taskbar/desktopbar.h | 1 + .../system/explorer/taskbar/startmenu.cpp | 8 ++++++++ .../system/explorer/utility/shellclasses.cpp | 10 ++++++++-- .../system/explorer/utility/shellclasses.h | 7 ++++++- .../subsys/system/explorer/utility/window.cpp | 9 ++++++--- .../subsys/system/explorer/utility/window.h | 3 ++- 16 files changed, 88 insertions(+), 47 deletions(-) diff --git a/reactos/subsys/system/explorer/doc/changes.txt b/reactos/subsys/system/explorer/doc/changes.txt index 7dbbdc1fd6a..09c24d248f7 100644 --- a/reactos/subsys/system/explorer/doc/changes.txt +++ b/reactos/subsys/system/explorer/doc/changes.txt @@ -26,4 +26,6 @@ implemented context menus for task bar tool tips for quick launch bar 24.08.2003 m. fuchs added reactos logo to startmenu - Added romanian translation of Ciobanu Alexander + added romanian translation of Ciobanu Alexander +26.08.2003 m. fuchs implemented tooltips and launching of date/time control panel applet for clock display +27.08.2003 m. fuchs partly implemented control panel window diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index ed352d5e761..8e3c39999af 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -88,14 +88,15 @@ void explorer_show_frame(HWND hwndDesktop, int cmdshow) g_Globals._prescan_nodes = false; // create main window - g_Globals._hMainWnd = MainFrame::Create(); + HWND hwndFrame = MainFrame::Create(); - ShowWindow(g_Globals._hMainWnd, cmdshow); + g_Globals._hMainWnd = hwndFrame; - UpdateWindow(g_Globals._hMainWnd); + ShowWindow(hwndFrame, cmdshow); + UpdateWindow(hwndFrame); - // Open the first child window after initialiszing the whole application - PostMessage(g_Globals._hMainWnd, PM_OPEN_WINDOW, 0, 0); + // Open the first child window after initializing the whole application + PostMessage(hwndFrame, PM_OPEN_WINDOW, 0, 0); } diff --git a/reactos/subsys/system/explorer/explorer_intres.h b/reactos/subsys/system/explorer/explorer_intres.h index 881004684ea..6c70e573023 100644 --- a/reactos/subsys/system/explorer/explorer_intres.h +++ b/reactos/subsys/system/explorer/explorer_intres.h @@ -21,6 +21,7 @@ #define IDS_CONNECTIONS 17 #define IDS_DRIVES 18 #define IDS_SEARCH_COMPUTER 19 +#define IDS_SETTINGS_WND 20 #define IDI_REACTOS 100 #define IDI_EXPLORER 101 #define IDI_STARTMENU 102 diff --git a/reactos/subsys/system/explorer/explorer_intres.rc b/reactos/subsys/system/explorer/explorer_intres.rc index 5d38b9549d9..7953c017cb3 100644 --- a/reactos/subsys/system/explorer/explorer_intres.rc +++ b/reactos/subsys/system/explorer/explorer_intres.rc @@ -107,6 +107,7 @@ BEGIN IDS_CONNECTIONS "Conecții" IDS_DRIVES "Discuri" IDS_SEARCH_COMPUTER "Search Computer..." + IDS_SETTINGS_WND "Settings Window" END #endif // Romanian resources @@ -365,6 +366,7 @@ BEGIN IDS_CONNECTIONS "Verbindungen" IDS_DRIVES "Verzeichnisse" IDS_SEARCH_COMPUTER "Suche Computer..." + IDS_SETTINGS_WND "Einstellungen-Fenster" END #endif // German (Germany) resources @@ -574,6 +576,7 @@ BEGIN IDS_CONNECTIONS "Connections" IDS_DRIVES "Drives" IDS_SEARCH_COMPUTER "Search Computer..." + IDS_SETTINGS_WND "Settings Window" END #endif // English (U.S.) resources diff --git a/reactos/subsys/system/explorer/shell/filechild.cpp b/reactos/subsys/system/explorer/shell/filechild.cpp index 21a23bedeef..8606ca39597 100644 --- a/reactos/subsys/system/explorer/shell/filechild.cpp +++ b/reactos/subsys/system/explorer/shell/filechild.cpp @@ -56,12 +56,12 @@ FileChildWndInfo::FileChildWndInfo(LPCTSTR path) ShellChildWndInfo::ShellChildWndInfo(LPCTSTR path, const ShellPath& root_shell_path) - : FileChildWndInfo(path) + : FileChildWndInfo(path), + _shell_path(path), + _root_shell_path(root_shell_path) { _etype = ET_SHELL; _path = path; - _shell_path = path; - _root_shell_path = root_shell_path; } diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 9aa67328677..da9a1f42768 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -211,13 +211,22 @@ LRESULT MainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) return (LPARAM)&_menu_info; case PM_OPEN_WINDOW: { - TCHAR path[MAX_PATH]; + TCHAR buffer[MAX_PATH]; + LPCTSTR path; + ShellPath shell_path = DesktopFolder(); - //TODO: read paths and window placements from registry - GetCurrentDirectory(MAX_PATH, path); + if (lparam) { + // take over path from lparam + path = (LPCTSTR)lparam; + shell_path = path; // creates as "rooted" window + } else { + //TODO: read paths and window placements from registry + GetCurrentDirectory(MAX_PATH, buffer); + path = buffer; + } // Shell Namespace as default view - ShellChildWndInfo create_info(path, DesktopFolder()); + ShellChildWndInfo create_info(path, shell_path); create_info._pos.showCmd = SW_SHOWMAXIMIZED; create_info._pos.rcNormalPosition.left = 0; diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.cpp b/reactos/subsys/system/explorer/shell/shellbrowser.cpp index 7ae2cbd3f9e..0519989d48f 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.cpp +++ b/reactos/subsys/system/explorer/shell/shellbrowser.cpp @@ -48,8 +48,9 @@ static LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem) } -ShellBrowserChild::ShellBrowserChild(HWND hwnd) - : super(hwnd) +ShellBrowserChild::ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info) + : super(hwnd), + _create_info(info) { _pShellView = NULL; _pDropTarget = NULL; @@ -91,7 +92,7 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs) _hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0); if (_left_hwnd) { - InitializeTree(/*ShellChildWndInfo(TEXT("C:\\"),DesktopFolder())*/); //@@ GetCurrentDirectory() + InitializeTree(); InitDragDrop(); } @@ -100,22 +101,25 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs) } -void ShellBrowserChild::InitializeTree(/*const FileChildWndInfo& info*/) +void ShellBrowserChild::InitializeTree() { TreeView_SetImageList(_left_hwnd, _himlSmall, TVSIL_NORMAL); TreeView_SetScrollTime(_left_hwnd, 100); + const String& root_name = Desktop().get_name(_create_info._root_shell_path); _root._drive_type = DRIVE_UNKNOWN; - lstrcpy(_root._volname, TEXT("Desktop")); + lstrcpy(_root._volname, root_name); // most of the time "Desktop" _root._fs_flags = 0; lstrcpy(_root._fs, TEXT("Shell")); - //@@ _root._entry->read_tree(shell_info._root_shell_path.get_folder(), info._shell_path, SORT_NAME/*_sortOrder*/); - //@@ should call read_tree() here; see FileChildWindow::FileChildWindow() - _root._entry = new ShellDirectory(Desktop(), DesktopFolder(), _hwnd); +/* TODO: + we should call read_tree() here to iterate through the hierarchy and open all folders from shell_info._root_shell_path to shell_info._shell_path + -> see FileChildWindow::FileChildWindow() +*/ + _root._entry = new ShellDirectory(Desktop(), _create_info._root_shell_path, _hwnd); _root._entry->read_directory(); /* already filled by ShellDirectory constructor diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.h b/reactos/subsys/system/explorer/shell/shellbrowser.h index f6f6b0404e1..3dfab0b8fc6 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.h +++ b/reactos/subsys/system/explorer/shell/shellbrowser.h @@ -33,13 +33,14 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl { typedef ChildWindow super; - ShellBrowserChild(HWND hwnd); + ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info); ~ShellBrowserChild(); static ShellBrowserChild* create(HWND hmdiclient, const FileChildWndInfo& info) { #ifndef _NO_MDI - ChildWindow* child = ChildWindow::create(hmdiclient, info._pos.rcNormalPosition, WINDOW_CREATOR(ShellBrowserChild), CLASSNAME_CHILDWND); + ChildWindow* child = ChildWindow::create(hmdiclient, info._pos.rcNormalPosition, + WINDOW_CREATOR_INFO(ShellBrowserChild,ShellChildWndInfo), CLASSNAME_CHILDWND, NULL, &info); #else //TODO: SDI implementation #endif @@ -102,9 +103,10 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl STDMETHOD(OnDefaultCommand)(IShellView* ppshv); protected: - Root _root; + Root _root; WindowHandle _hWndFrame; + ShellChildWndInfo _create_info; IShellView* _pShellView; // current hosted shellview HIMAGELIST _himlSmall; // list diff --git a/reactos/subsys/system/explorer/shell/shellfs.h b/reactos/subsys/system/explorer/shell/shellfs.h index c146eb8a532..9229dddbf81 100644 --- a/reactos/subsys/system/explorer/shell/shellfs.h +++ b/reactos/subsys/system/explorer/shell/shellfs.h @@ -47,17 +47,17 @@ protected: struct ShellDirectory : public ShellEntry, public Directory { - ShellDirectory(IShellFolder* shell_root, const ShellPath& shell_path, HWND hwnd) + ShellDirectory(ShellFolder& root_folder, const ShellPath& shell_path, HWND hwnd) : ShellEntry(shell_path), - _folder(shell_root, shell_path), + _folder(root_folder, shell_path), _hwnd(hwnd) { - lstrcpy(_data.cFileName, ShellFolder(shell_root).get_name(shell_path)); + lstrcpy(_data.cFileName, root_folder.get_name(shell_path)); _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; _shell_attribs = SFGAO_FOLDER; - ShellFolder folder(shell_root, shell_path); - IShellFolder* pFolder = folder; + ShellFolder subfolder(root_folder, shell_path); + IShellFolder* pFolder = subfolder; pFolder->AddRef(); _path = pFolder; } diff --git a/reactos/subsys/system/explorer/shell/startup.c b/reactos/subsys/system/explorer/shell/startup.c index c3a921a007f..9498e0bc937 100644 --- a/reactos/subsys/system/explorer/shell/startup.c +++ b/reactos/subsys/system/explorer/shell/startup.c @@ -498,23 +498,18 @@ int startup( int argc, char *argv[] ) /* Perform the ops by order, stopping if one fails, skipping if necessary */ /* Shachar: Sorry for the perl syntax */ - res=(ops.ntonly || !ops.preboot || wininit())&& + res=(ops.ntonly || !ops.preboot || wininit()) && (ops.w9xonly || !ops.preboot || pendingRename()) && (ops.ntonly || !ops.prelogin || - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], - TRUE, FALSE )) && + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE )) && (ops.ntonly || !ops.prelogin || !ops.startup || - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], - FALSE, FALSE )) && + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE )) && (!ops.postlogin || - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], - TRUE, TRUE )) && + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE )) && (!ops.postlogin || !ops.startup || - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], - FALSE, FALSE )) && + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE )) && (!ops.postlogin || !ops.startup || - ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], - FALSE, FALSE )); + ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE )); printf("Operation done\n"); diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.h b/reactos/subsys/system/explorer/taskbar/desktopbar.h index 063cb6e9fc6..47bb4a9ed4d 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.h +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.h @@ -53,6 +53,7 @@ #define IDC_NETWORK 0x100E #define IDC_CONNECTIONS 0x100F #define IDC_DRIVES 0x1010 +#define IDC_SETTINGS_WND 0x1011 #define IDC_FIRST_MENU 0x3000 diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index 51d2812d2eb..f1e281ffd3a 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -578,6 +578,7 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs) AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS); AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT); AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS); + AddButton(ResString(IDS_SETTINGS_WND), 0, false, IDC_SETTINGS_WND); AddButton(ResString(IDS_ADMIN), 0, true, IDC_ADMIN); AddButton(ResString(IDS_DRIVES), 0, true, IDC_DRIVES); AddButton(ResString(IDS_NETWORK), 0, true, IDC_NETWORK); @@ -655,6 +656,13 @@ int StartMenuRoot::Command(int id, int code) CreateSubmenu(id, CSIDL_CONTROLS); break; + case IDC_SETTINGS_WND: { //TODO: make more object oriented, e.g introduce a class CabinetWindow + CloseStartMenu(id); + HWND hwndFrame = MainFrame::Create(); + ShowWindow(hwndFrame, SW_SHOW); + SendMessage(hwndFrame, PM_OPEN_WINDOW, 0, (LPARAM)_T("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}")); + break;} + case IDC_FAVORITES: CreateSubmenu(id, CSIDL_FAVORITES); break; diff --git a/reactos/subsys/system/explorer/utility/shellclasses.cpp b/reactos/subsys/system/explorer/utility/shellclasses.cpp index b3405df25d5..aa6d929eda2 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.cpp +++ b/reactos/subsys/system/explorer/utility/shellclasses.cpp @@ -227,8 +227,14 @@ String ShellFolder::get_name(LPCITEMIDLIST pidl, SHGDNF flags) const TCHAR buffer[MAX_PATH]; StrRet strret; - CheckError(((IShellFolder*)*const_cast(this))->GetDisplayNameOf(pidl, flags, &strret)); - strret.GetString(pidl->mkid, buffer, MAX_PATH); + HRESULT hr = ((IShellFolder*)*const_cast(this))->GetDisplayNameOf(pidl, flags, &strret); + + if (hr == S_OK) + strret.GetString(pidl->mkid, buffer, MAX_PATH); + else { + CheckError(hr); + *buffer = _T('\0'); + } return buffer; } diff --git a/reactos/subsys/system/explorer/utility/shellclasses.h b/reactos/subsys/system/explorer/utility/shellclasses.h index be6959c5b01..a1b68967456 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.h +++ b/reactos/subsys/system/explorer/utility/shellclasses.h @@ -382,7 +382,7 @@ struct ShellFolder : public IShellFolderPtr // IShellFolderPtr uses intrinsic ex ShellFolder(LPCITEMIDLIST pidl); void attach(IShellFolder* parent, LPCITEMIDLIST pidl); - String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const; + String get_name(LPCITEMIDLIST pidl=NULL, SHGDNF flags=SHGDN_NORMAL) const; bool empty() const {return !operator bool();} //NOTE: see SIfacePtr::empty() }; @@ -597,6 +597,11 @@ struct ShellPath : public SShellPtr return ShellFolder(_p); } + ShellFolder get_folder(IShellFolder* parent) + { + return ShellFolder(parent, _p); + } + // convert an item id list from relative to absolute (=relative to the desktop) format LPITEMIDLIST create_absolute_pidl(LPCITEMIDLIST parent_pidl, HWND hwnd) const diff --git a/reactos/subsys/system/explorer/utility/window.cpp b/reactos/subsys/system/explorer/utility/window.cpp index c63391c4d79..1bf343fe30d 100644 --- a/reactos/subsys/system/explorer/utility/window.cpp +++ b/reactos/subsys/system/explorer/utility/window.cpp @@ -144,7 +144,10 @@ Window* Window::get_window(HWND hwnd) CREATORFUNC window_creator = s_window_creator; s_window_creator = NULL; - wnd = window_creator(hwnd, info); + if (info) + wnd = window_creator(hwnd, info); + else + wnd = CREATORFUNC_NO_INFO(window_creator)(hwnd); } return wnd; @@ -244,7 +247,7 @@ ChildWindow::ChildWindow(HWND hwnd) } -ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC creator, LPCTSTR classname, LPCTSTR title) +ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC creator, LPCTSTR classname, LPCTSTR title, const void* info) { MDICREATESTRUCT mcs; @@ -258,7 +261,7 @@ ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC mcs.style = 0; mcs.lParam = 0; - return static_cast(create_mdi_child(hmdiclient, mcs, creator)); + return static_cast(create_mdi_child(hmdiclient, mcs, creator, info)); } diff --git a/reactos/subsys/system/explorer/utility/window.h b/reactos/subsys/system/explorer/utility/window.h index 58653a9e959..f17abd69fd0 100644 --- a/reactos/subsys/system/explorer/utility/window.h +++ b/reactos/subsys/system/explorer/utility/window.h @@ -80,6 +80,7 @@ struct Window : public WindowHandle typedef Window* (*CREATORFUNC)(HWND, const void*); + typedef Window* (*CREATORFUNC_NO_INFO)(HWND); static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, @@ -254,7 +255,7 @@ struct ChildWindow : public Window ChildWindow(HWND hwnd); static ChildWindow* create(HWND hmdiclient, const RECT& rect, - CREATORFUNC creator, LPCTSTR classname, LPCTSTR title=NULL); + CREATORFUNC creator, LPCTSTR classname, LPCTSTR title=NULL, const void* info=NULL); protected: LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);