partly implemented control panel window

svn path=/trunk/; revision=5885
This commit is contained in:
Martin Fuchs 2003-08-27 21:07:33 +00:00
parent f97528ca2d
commit 49f689ef95
16 changed files with 88 additions and 47 deletions

View file

@ -26,4 +26,6 @@
implemented context menus for task bar implemented context menus for task bar
tool tips for quick launch bar tool tips for quick launch bar
24.08.2003 m. fuchs added reactos logo to startmenu 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

View file

@ -88,14 +88,15 @@ void explorer_show_frame(HWND hwndDesktop, int cmdshow)
g_Globals._prescan_nodes = false; g_Globals._prescan_nodes = false;
// create main window // 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 // Open the first child window after initializing the whole application
PostMessage(g_Globals._hMainWnd, PM_OPEN_WINDOW, 0, 0); PostMessage(hwndFrame, PM_OPEN_WINDOW, 0, 0);
} }

View file

@ -21,6 +21,7 @@
#define IDS_CONNECTIONS 17 #define IDS_CONNECTIONS 17
#define IDS_DRIVES 18 #define IDS_DRIVES 18
#define IDS_SEARCH_COMPUTER 19 #define IDS_SEARCH_COMPUTER 19
#define IDS_SETTINGS_WND 20
#define IDI_REACTOS 100 #define IDI_REACTOS 100
#define IDI_EXPLORER 101 #define IDI_EXPLORER 101
#define IDI_STARTMENU 102 #define IDI_STARTMENU 102

View file

@ -107,6 +107,7 @@ BEGIN
IDS_CONNECTIONS "Conecþii" IDS_CONNECTIONS "Conecþii"
IDS_DRIVES "Discuri" IDS_DRIVES "Discuri"
IDS_SEARCH_COMPUTER "Search Computer..." IDS_SEARCH_COMPUTER "Search Computer..."
IDS_SETTINGS_WND "Settings Window"
END END
#endif // Romanian resources #endif // Romanian resources
@ -365,6 +366,7 @@ BEGIN
IDS_CONNECTIONS "Verbindungen" IDS_CONNECTIONS "Verbindungen"
IDS_DRIVES "Verzeichnisse" IDS_DRIVES "Verzeichnisse"
IDS_SEARCH_COMPUTER "Suche Computer..." IDS_SEARCH_COMPUTER "Suche Computer..."
IDS_SETTINGS_WND "Einstellungen-Fenster"
END END
#endif // German (Germany) resources #endif // German (Germany) resources
@ -574,6 +576,7 @@ BEGIN
IDS_CONNECTIONS "Connections" IDS_CONNECTIONS "Connections"
IDS_DRIVES "Drives" IDS_DRIVES "Drives"
IDS_SEARCH_COMPUTER "Search Computer..." IDS_SEARCH_COMPUTER "Search Computer..."
IDS_SETTINGS_WND "Settings Window"
END END
#endif // English (U.S.) resources #endif // English (U.S.) resources

View file

@ -56,12 +56,12 @@ FileChildWndInfo::FileChildWndInfo(LPCTSTR path)
ShellChildWndInfo::ShellChildWndInfo(LPCTSTR path, const ShellPath& root_shell_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; _etype = ET_SHELL;
_path = path; _path = path;
_shell_path = path;
_root_shell_path = root_shell_path;
} }

View file

@ -211,13 +211,22 @@ LRESULT MainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
return (LPARAM)&_menu_info; return (LPARAM)&_menu_info;
case PM_OPEN_WINDOW: { 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 if (lparam) {
GetCurrentDirectory(MAX_PATH, path); // 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 // 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.showCmd = SW_SHOWMAXIMIZED;
create_info._pos.rcNormalPosition.left = 0; create_info._pos.rcNormalPosition.left = 0;

View file

@ -48,8 +48,9 @@ static LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
} }
ShellBrowserChild::ShellBrowserChild(HWND hwnd) ShellBrowserChild::ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info)
: super(hwnd) : super(hwnd),
_create_info(info)
{ {
_pShellView = NULL; _pShellView = NULL;
_pDropTarget = NULL; _pDropTarget = NULL;
@ -91,7 +92,7 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs)
_hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0); _hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0);
if (_left_hwnd) { if (_left_hwnd) {
InitializeTree(/*ShellChildWndInfo(TEXT("C:\\"),DesktopFolder())*/); //@@ GetCurrentDirectory() InitializeTree();
InitDragDrop(); 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_SetImageList(_left_hwnd, _himlSmall, TVSIL_NORMAL);
TreeView_SetScrollTime(_left_hwnd, 100); TreeView_SetScrollTime(_left_hwnd, 100);
const String& root_name = Desktop().get_name(_create_info._root_shell_path);
_root._drive_type = DRIVE_UNKNOWN; _root._drive_type = DRIVE_UNKNOWN;
lstrcpy(_root._volname, TEXT("Desktop")); lstrcpy(_root._volname, root_name); // most of the time "Desktop"
_root._fs_flags = 0; _root._fs_flags = 0;
lstrcpy(_root._fs, TEXT("Shell")); lstrcpy(_root._fs, TEXT("Shell"));
//@@ _root._entry->read_tree(shell_info._root_shell_path.get_folder(), info._shell_path, SORT_NAME/*_sortOrder*/); //@@ _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() /* TODO:
_root._entry = new ShellDirectory(Desktop(), DesktopFolder(), _hwnd); 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(); _root._entry->read_directory();
/* already filled by ShellDirectory constructor /* already filled by ShellDirectory constructor

View file

@ -33,13 +33,14 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl
{ {
typedef ChildWindow super; typedef ChildWindow super;
ShellBrowserChild(HWND hwnd); ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info);
~ShellBrowserChild(); ~ShellBrowserChild();
static ShellBrowserChild* create(HWND hmdiclient, const FileChildWndInfo& info) static ShellBrowserChild* create(HWND hmdiclient, const FileChildWndInfo& info)
{ {
#ifndef _NO_MDI #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 #else
//TODO: SDI implementation //TODO: SDI implementation
#endif #endif
@ -102,9 +103,10 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl
STDMETHOD(OnDefaultCommand)(IShellView* ppshv); STDMETHOD(OnDefaultCommand)(IShellView* ppshv);
protected: protected:
Root _root; Root _root;
WindowHandle _hWndFrame; WindowHandle _hWndFrame;
ShellChildWndInfo _create_info;
IShellView* _pShellView; // current hosted shellview IShellView* _pShellView; // current hosted shellview
HIMAGELIST _himlSmall; // list HIMAGELIST _himlSmall; // list

View file

@ -47,17 +47,17 @@ protected:
struct ShellDirectory : public ShellEntry, public Directory 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), : ShellEntry(shell_path),
_folder(shell_root, shell_path), _folder(root_folder, shell_path),
_hwnd(hwnd) _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; _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
_shell_attribs = SFGAO_FOLDER; _shell_attribs = SFGAO_FOLDER;
ShellFolder folder(shell_root, shell_path); ShellFolder subfolder(root_folder, shell_path);
IShellFolder* pFolder = folder; IShellFolder* pFolder = subfolder;
pFolder->AddRef(); pFolder->AddRef();
_path = pFolder; _path = pFolder;
} }

View file

@ -498,23 +498,18 @@ int startup( int argc, char *argv[] )
/* Perform the ops by order, stopping if one fails, skipping if necessary */ /* Perform the ops by order, stopping if one fails, skipping if necessary */
/* Shachar: Sorry for the perl syntax */ /* Shachar: Sorry for the perl syntax */
res=(ops.ntonly || !ops.preboot || wininit())&& res=(ops.ntonly || !ops.preboot || wininit()) &&
(ops.w9xonly || !ops.preboot || pendingRename()) && (ops.w9xonly || !ops.preboot || pendingRename()) &&
(ops.ntonly || !ops.prelogin || (ops.ntonly || !ops.prelogin ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE )) &&
TRUE, FALSE )) &&
(ops.ntonly || !ops.prelogin || !ops.startup || (ops.ntonly || !ops.prelogin || !ops.startup ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE )) &&
FALSE, FALSE )) &&
(!ops.postlogin || (!ops.postlogin ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE )) &&
TRUE, TRUE )) &&
(!ops.postlogin || !ops.startup || (!ops.postlogin || !ops.startup ||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE )) &&
FALSE, FALSE )) &&
(!ops.postlogin || !ops.startup || (!ops.postlogin || !ops.startup ||
ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE ));
FALSE, FALSE ));
printf("Operation done\n"); printf("Operation done\n");

View file

@ -53,6 +53,7 @@
#define IDC_NETWORK 0x100E #define IDC_NETWORK 0x100E
#define IDC_CONNECTIONS 0x100F #define IDC_CONNECTIONS 0x100F
#define IDC_DRIVES 0x1010 #define IDC_DRIVES 0x1010
#define IDC_SETTINGS_WND 0x1011
#define IDC_FIRST_MENU 0x3000 #define IDC_FIRST_MENU 0x3000

View file

@ -578,6 +578,7 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS); AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS);
AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT); AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT);
AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS); 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_ADMIN), 0, true, IDC_ADMIN);
AddButton(ResString(IDS_DRIVES), 0, true, IDC_DRIVES); AddButton(ResString(IDS_DRIVES), 0, true, IDC_DRIVES);
AddButton(ResString(IDS_NETWORK), 0, true, IDC_NETWORK); AddButton(ResString(IDS_NETWORK), 0, true, IDC_NETWORK);
@ -655,6 +656,13 @@ int StartMenuRoot::Command(int id, int code)
CreateSubmenu(id, CSIDL_CONTROLS); CreateSubmenu(id, CSIDL_CONTROLS);
break; 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: case IDC_FAVORITES:
CreateSubmenu(id, CSIDL_FAVORITES); CreateSubmenu(id, CSIDL_FAVORITES);
break; break;

View file

@ -227,8 +227,14 @@ String ShellFolder::get_name(LPCITEMIDLIST pidl, SHGDNF flags) const
TCHAR buffer[MAX_PATH]; TCHAR buffer[MAX_PATH];
StrRet strret; StrRet strret;
CheckError(((IShellFolder*)*const_cast<ShellFolder*>(this))->GetDisplayNameOf(pidl, flags, &strret)); HRESULT hr = ((IShellFolder*)*const_cast<ShellFolder*>(this))->GetDisplayNameOf(pidl, flags, &strret);
strret.GetString(pidl->mkid, buffer, MAX_PATH);
if (hr == S_OK)
strret.GetString(pidl->mkid, buffer, MAX_PATH);
else {
CheckError(hr);
*buffer = _T('\0');
}
return buffer; return buffer;
} }

View file

@ -382,7 +382,7 @@ struct ShellFolder : public IShellFolderPtr // IShellFolderPtr uses intrinsic ex
ShellFolder(LPCITEMIDLIST pidl); ShellFolder(LPCITEMIDLIST pidl);
void attach(IShellFolder* parent, 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() bool empty() const {return !operator bool();} //NOTE: see SIfacePtr::empty()
}; };
@ -597,6 +597,11 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
return ShellFolder(_p); 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 // convert an item id list from relative to absolute (=relative to the desktop) format
LPITEMIDLIST create_absolute_pidl(LPCITEMIDLIST parent_pidl, HWND hwnd) const LPITEMIDLIST create_absolute_pidl(LPCITEMIDLIST parent_pidl, HWND hwnd) const

View file

@ -144,7 +144,10 @@ Window* Window::get_window(HWND hwnd)
CREATORFUNC window_creator = s_window_creator; CREATORFUNC window_creator = s_window_creator;
s_window_creator = NULL; 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; 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; MDICREATESTRUCT mcs;
@ -258,7 +261,7 @@ ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC
mcs.style = 0; mcs.style = 0;
mcs.lParam = 0; mcs.lParam = 0;
return static_cast<ChildWindow*>(create_mdi_child(hmdiclient, mcs, creator)); return static_cast<ChildWindow*>(create_mdi_child(hmdiclient, mcs, creator, info));
} }

View file

@ -80,6 +80,7 @@ struct Window : public WindowHandle
typedef Window* (*CREATORFUNC)(HWND, const void*); typedef Window* (*CREATORFUNC)(HWND, const void*);
typedef Window* (*CREATORFUNC_NO_INFO)(HWND);
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, static HWND Create(CREATORFUNC creator, DWORD dwExStyle,
LPCTSTR lpClassName, LPCTSTR lpWindowName, LPCTSTR lpClassName, LPCTSTR lpWindowName,
@ -254,7 +255,7 @@ struct ChildWindow : public Window
ChildWindow(HWND hwnd); ChildWindow(HWND hwnd);
static ChildWindow* create(HWND hmdiclient, const RECT& rect, 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: protected:
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);