From f7deec4b5c4e133fb72d561c9753533c040d44c0 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 27 Sep 2003 13:15:02 +0000 Subject: [PATCH] moved start menu entries for control panel, etc. into new settings submenu svn path=/trunk/; revision=6163 --- .../subsys/system/explorer/doc/changes.txt | 1 + .../subsys/system/explorer/explorer_intres.h | 5 +- .../subsys/system/explorer/explorer_intres.rc | 17 +- .../system/explorer/taskbar/desktopbar.h | 5 +- .../system/explorer/taskbar/startmenu.cpp | 158 +++++++++++------- .../system/explorer/taskbar/startmenu.h | 22 ++- 6 files changed, 135 insertions(+), 73 deletions(-) diff --git a/reactos/subsys/system/explorer/doc/changes.txt b/reactos/subsys/system/explorer/doc/changes.txt index 649fad2e1a9..81f48463cef 100644 --- a/reactos/subsys/system/explorer/doc/changes.txt +++ b/reactos/subsys/system/explorer/doc/changes.txt @@ -34,3 +34,4 @@ 30.09.2003 m. fuchs compatibility to building as Winelib application 10.09.2003 m. fuchs compatibility changes for correct desktop windows size on Windows NT 19.09.2003 m. fuchs compatibility changes for correct start menu subentries on Windows 9x +27.09.2003 m. fuchs moved start menu entries for control panel, etc. into new settings submenu diff --git a/reactos/subsys/system/explorer/explorer_intres.h b/reactos/subsys/system/explorer/explorer_intres.h index 13cbc763660..0e3e9226ab5 100644 --- a/reactos/subsys/system/explorer/explorer_intres.h +++ b/reactos/subsys/system/explorer/explorer_intres.h @@ -21,8 +21,9 @@ #define IDS_CONNECTIONS 17 #define IDS_DRIVES 18 #define IDS_SEARCH_COMPUTER 19 -#define IDS_SETTINGS_WND 20 -#define IDS_PRINTERS 21 +#define IDS_SETTINGS_MENU 20 +#define IDS_CONTROL_PANEL 21 +#define IDS_PRINTERS 22 #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 4a14abb133f..8e2008f0131 100644 --- a/reactos/subsys/system/explorer/explorer_intres.rc +++ b/reactos/subsys/system/explorer/explorer_intres.rc @@ -108,8 +108,9 @@ BEGIN IDS_CONNECTIONS "Conecții" IDS_DRIVES "Discuri" IDS_SEARCH_COMPUTER "Search Computer..." - IDS_SETTINGS_WND "Control Panel" + IDS_SETTINGS_MENU "Settings Menu" IDS_PRINTERS "Printers" + IDS_CONTROL_PANEL "Control Panel" END #endif // Romanian resources @@ -142,8 +143,8 @@ IDB_LOGOV BITMAP DISCARDABLE "res/logov.bmp" IDA_EXPLORER ACCELERATORS DISCARDABLE BEGIN - 0x58, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT - 0x53, ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, + "X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT + "S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, NOINVERT END @@ -365,11 +366,12 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Netzwerk" - IDS_CONNECTIONS "Verbindungen" + IDS_CONNECTIONS "Netzwerk-Verbindungen" IDS_DRIVES "Verzeichnisse" IDS_SEARCH_COMPUTER "Suche Computer..." - IDS_SETTINGS_WND "Systemsteuerung" + IDS_SETTINGS_MENU "Einstellungen-Menu" IDS_PRINTERS "Drucker" + IDS_CONTROL_PANEL "Systemsteuerung" END #endif // German (Germany) resources @@ -577,11 +579,12 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_NETWORK "Network" - IDS_CONNECTIONS "Connections" + IDS_CONNECTIONS "Network Connections" IDS_DRIVES "Drives" IDS_SEARCH_COMPUTER "Search Computer..." - IDS_SETTINGS_WND "Control Panel" + IDS_SETTINGS_MENU "Settings Menu" IDS_PRINTERS "Printers" + IDS_CONTROL_PANEL "Control Panel" END #endif // English (U.S.) resources diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.h b/reactos/subsys/system/explorer/taskbar/desktopbar.h index 9433e08da61..f7ed8a46d33 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.h +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.h @@ -53,8 +53,9 @@ #define IDC_NETWORK 0x100E #define IDC_CONNECTIONS 0x100F #define IDC_DRIVES 0x1010 -#define IDC_SETTINGS_WND 0x1011 -#define IDC_PRINTERS 0x1012 +#define IDC_SETTINGS_MENU 0x1011 +#define IDC_CONTROL_PANEL 0x1012 +#define IDC_PRINTERS 0x1013 #define IDC_FIRST_MENU 0x3000 diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index 2580750ca8a..2c4e1d863c3 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -103,19 +103,18 @@ LRESULT StartMenu::Init(LPCREATESTRUCT pcs) return 1; // create buttons for registered entries in _entries - if (_entries.empty()) { - AddButton(ResString(IDS_EMPTY), 0, false, (UINT)-1, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW|WS_DISABLED); - } else { - for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) { - const StartMenuEntry& sme = it->second; - bool hasSubmenu = false; + for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) { + const StartMenuEntry& sme = it->second; + bool hasSubmenu = false; - if (sme._entry && (sme._entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) - hasSubmenu = true; + if (sme._entry && (sme._entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) + hasSubmenu = true; - AddButton(sme._title, sme._hIcon, hasSubmenu, it->first); - } + AddButton(sme._title, sme._hIcon, hasSubmenu, it->first); } + + if (!GetWindow(_hwnd, GW_CHILD)) + AddButton(ResString(IDS_EMPTY), 0, false, (UINT)-1, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW|WS_DISABLED); } catch(COMException& e) { HandleException(e, pcs->hwndParent); // destroys the start menu window while switching focus } @@ -366,29 +365,9 @@ bool StartMenu::CloseOtherSubmenus(int id) } -void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, CREATORFUNC creator) +void StartMenu::CreateSubmenu(int id, CREATORFUNC creator) { - // Only open one submenu at a time. - if (!CloseOtherSubmenus(id)) - return; - - HWND btn = GetDlgItem(_hwnd, id); - int x, y; - - if (btn) { - WindowRect pos(btn); - - x = pos.right-3; // Submenus should overlap their parent a bit. - y = pos.top+STARTMENU_LINE_HEIGHT-3; - } else { - WindowRect pos(_hwnd); - - x = pos.right-3; - y = pos.top; - } - - _submenu_id = id; - _submenu = StartMenu::Create(x, y, new_folders, _hwnd, creator); + CreateSubmenu(id, StartMenuFolders(), creator); } void StartMenu::CreateSubmenu(int id, int folder_id, CREATORFUNC creator) @@ -427,6 +406,31 @@ void StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, CREATORFUN CreateSubmenu(id, new_folders, creator); } +void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, CREATORFUNC creator) +{ + // Only open one submenu at a time. + if (!CloseOtherSubmenus(id)) + return; + + HWND btn = GetDlgItem(_hwnd, id); + int x, y; + + if (btn) { + WindowRect pos(btn); + + x = pos.right-3; // Submenus should overlap their parent a bit. + y = pos.top+STARTMENU_LINE_HEIGHT-3; + } else { + WindowRect pos(_hwnd); + + x = pos.right-3; + y = pos.top; + } + + _submenu_id = id; + _submenu = StartMenu::Create(x, y, new_folders, _hwnd, creator); +} + void StartMenu::ActivateEntry(int id, ShellEntry* entry) { @@ -641,22 +645,16 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs) if (super::Init(pcs)) return 1; - AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), false, IDC_EXPLORE); - AddSeparator(); // insert hard coded start entries AddButton(ResString(IDS_PROGRAMS), 0, true, IDC_PROGRAMS); - AddButton(ResString(IDS_FAVORITES), 0, true, IDC_FAVORITES); AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS); AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT); + AddButton(ResString(IDS_FAVORITES), 0, true, IDC_FAVORITES); AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS); - AddButton(ResString(IDS_PRINTERS), 0, true, IDC_PRINTERS); - 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); - AddButton(ResString(IDS_CONNECTIONS), 0, true, IDC_CONNECTIONS); AddButton(ResString(IDS_SEARCH), 0, false, IDC_SEARCH); AddButton(ResString(IDS_SEARCH_COMPUTER),0,false, IDC_SEARCH_COMPUTER); AddButton(ResString(IDS_START_HELP), 0, false, IDC_START_HELP); @@ -671,6 +669,14 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs) } +void StartMenuRoot::AddEntries() +{ + super::AddEntries(); + + AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), false, IDC_EXPLORE); +} + + LRESULT StartMenuRoot::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) { switch(nmsg) { @@ -726,40 +732,23 @@ int StartMenuRoot::Command(int id, int code) CreateSubmenu(id, CSIDL_RECENT, STARTMENU_CREATOR(RecentStartMenu)); break; - case IDC_SETTINGS: - CreateSubmenu(id, CSIDL_CONTROLS); - break; - - case IDC_PRINTERS: - CreateSubmenu(id, CSIDL_PRINTERS, CSIDL_PRINTHOOD); - break; - - case IDC_SETTINGS_WND: - CloseStartMenu(id); - MainFrame::Create(_T("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), FALSE); - break; - case IDC_FAVORITES: CreateSubmenu(id, CSIDL_FAVORITES); break; - case IDC_ADMIN: - CreateSubmenu(id, CSIDL_COMMON_ADMINTOOLS, CSIDL_ADMINTOOLS); - break; - case IDC_NETWORK: CreateSubmenu(id, CSIDL_NETWORK); break; - case IDC_CONNECTIONS: - CreateSubmenu(id, CSIDL_CONNECTIONS); - break; - case IDC_DRIVES: //TODO: exclude removeable drives CreateSubmenu(id, CSIDL_DRIVES); break; + case IDC_SETTINGS: + CreateSubmenu(id, STARTMENU_CREATOR(SettingsMenu)); + break; + case IDC_SEARCH: ShowSearchDialog(); break; @@ -847,6 +836,55 @@ void StartMenuRoot::ShowSearchComputer() } +SettingsMenu::SettingsMenu(HWND hwnd, const StartMenuFolders& info) + : super(hwnd, info) +{ +} + +void SettingsMenu::AddEntries() +{ + super::AddEntries(); + + // insert hard coded start entries + AddButton(ResString(IDS_SETTINGS_MENU), 0, true, IDC_SETTINGS_MENU); + AddButton(ResString(IDS_PRINTERS), 0, true, IDC_PRINTERS); + AddButton(ResString(IDS_CONTROL_PANEL), 0, false, IDC_CONTROL_PANEL); + AddButton(ResString(IDS_ADMIN), 0, true, IDC_ADMIN); + AddButton(ResString(IDS_CONNECTIONS), 0, true, IDC_CONNECTIONS); +} + +int SettingsMenu::Command(int id, int code) +{ + switch(id) { + case IDC_SETTINGS_MENU: + CreateSubmenu(id, CSIDL_CONTROLS); + break; + + case IDC_PRINTERS: + CreateSubmenu(id, CSIDL_PRINTERS, CSIDL_PRINTHOOD); + break; + + case IDC_CONTROL_PANEL: + CloseStartMenu(id); + MainFrame::Create(_T("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), FALSE); + break; + + case IDC_ADMIN: + CreateSubmenu(id, CSIDL_COMMON_ADMINTOOLS, CSIDL_ADMINTOOLS); + break; + + case IDC_CONNECTIONS: + CreateSubmenu(id, CSIDL_CONNECTIONS); + break; + + default: + return super::Command(id, code); + } + + return 0; +} + + RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuFolders& info) : super(hwnd, info) { diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.h b/reactos/subsys/system/explorer/taskbar/startmenu.h index 5b07f723499..b5b99db076f 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.h +++ b/reactos/subsys/system/explorer/taskbar/startmenu.h @@ -169,9 +169,10 @@ protected: void AddSeparator(); bool CloseOtherSubmenus(int id); - void CreateSubmenu(int id, const StartMenuFolders& new_folders, CREATORFUNC creator=s_def_creator); - void CreateSubmenu(int id, int folder1, int folder2, CREATORFUNC creator=s_def_creator); + void CreateSubmenu(int id, CREATORFUNC creator=s_def_creator); void CreateSubmenu(int id, int folder, CREATORFUNC creator=s_def_creator); + void CreateSubmenu(int id, int folder1, int folder2, CREATORFUNC creator=s_def_creator); + void CreateSubmenu(int id, const StartMenuFolders& new_folders, CREATORFUNC creator=s_def_creator); void ActivateEntry(int id, ShellEntry* entry); void CloseStartMenu(int id=0); }; @@ -211,6 +212,8 @@ struct StartMenuRoot : public StartMenu protected: LRESULT Init(LPCREATESTRUCT pcs); LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); + + void AddEntries(); int Command(int id, int code); static void ShowLaunchDialog(HWND hwndDesktopBar); @@ -223,6 +226,21 @@ protected: }; + // Settings sub-start menu +struct SettingsMenu : public StartMenu +{ + typedef StartMenu super; + + SettingsMenu(HWND hwnd, const StartMenuFolders& info); + + void TrackStartmenu(); + +protected: + void AddEntries(); + int Command(int id, int code); +}; + + struct RecentStartMenu : public StartMenu { typedef StartMenu super;