diff --git a/Explorer++/Explorer++/CoreInterface.h b/Explorer++/Explorer++/CoreInterface.h index b9325ded73..5b2b9923f5 100644 --- a/Explorer++/Explorer++/CoreInterface.h +++ b/Explorer++/Explorer++/CoreInterface.h @@ -56,6 +56,8 @@ __interface IExplorerplusplus void OpenFileItem(PCIDLIST_ABSOLUTE pidlItem, const TCHAR *szParameters); HMENU BuildViewsMenu(); + + HMENU BuildCommandPromptOptionsMenu(); bool CanCreate() const; BOOL CanCut() const; @@ -80,4 +82,4 @@ __interface IExplorerplusplus boost::signals2::connection AddTabsInitializedObserver(const TabsInitializedSignal::slot_type &observer); boost::signals2::connection AddMainMenuPreShowObserver(const MainMenuPreShowSignal::slot_type &observer); boost::signals2::connection AddToolbarContextMenuObserver(const ToolbarContextMenuSignal::slot_type &observer); -}; \ No newline at end of file +}; diff --git a/Explorer++/Explorer++/Explorer++.h b/Explorer++/Explorer++/Explorer++.h index 0107dd1007..a36da7bc0a 100644 --- a/Explorer++/Explorer++/Explorer++.h +++ b/Explorer++/Explorer++/Explorer++.h @@ -494,6 +494,7 @@ class Explorerplusplus : const MainMenuPreShowSignal::slot_type &observer) override; HMENU BuildViewsMenu() override; void AddViewModesToMenu(HMENU menu); + HMENU BuildCommandPromptOptionsMenu(); /* Miscellaneous. */ void CreateStatusBar(void); @@ -639,4 +640,4 @@ class Explorerplusplus : HTREEITEM m_hTVMButtonItem; BOOL m_blockNextListViewSelection; -}; \ No newline at end of file +}; diff --git a/Explorer++/Explorer++/Explorer++.rc b/Explorer++/Explorer++/Explorer++.rc index 471f957c27..ea6f40c32a 100644 Binary files a/Explorer++/Explorer++/Explorer++.rc and b/Explorer++/Explorer++/Explorer++.rc differ diff --git a/Explorer++/Explorer++/Initialization.cpp b/Explorer++/Explorer++/Initialization.cpp index ab04027afc..0e35d3c4b0 100644 --- a/Explorer++/Explorer++/Initialization.cpp +++ b/Explorer++/Explorer++/Initialization.cpp @@ -135,4 +135,10 @@ void Explorerplusplus::AddViewModesToMenu(HMENU menu) mii.dwTypeData = szText; InsertMenuItem(menu, IDM_VIEW_PLACEHOLDER, FALSE, &mii); } -} \ No newline at end of file +} + +HMENU Explorerplusplus::BuildCommandPromptOptionsMenu() +{ + HMENU commandPromptOptionsMenu = GetSubMenu(LoadMenu(m_hLanguageModule, MAKEINTRESOURCE(IDR_COMMAND_PROMPT_OPTIONS_MENU)), 0); + return commandPromptOptionsMenu; +} diff --git a/Explorer++/Explorer++/MainToolbar.cpp b/Explorer++/Explorer++/MainToolbar.cpp index fdee0b10a1..36ec8aeae8 100644 --- a/Explorer++/Explorer++/MainToolbar.cpp +++ b/Explorer++/Explorer++/MainToolbar.cpp @@ -378,6 +378,9 @@ BYTE MainToolbar::LookupToolbarButtonExtraStyles(ToolbarButton button) const case ToolbarButton::Views: return BTNS_DROPDOWN; + case ToolbarButton::OpenCommandPrompt: + return BTNS_DROPDOWN; + default: return 0; } @@ -672,6 +675,12 @@ LRESULT MainToolbar::OnTbnDropDown(const NMTOOLBAR *nmtb) return TBDDRET_DEFAULT; } + else if (nmtb->iItem == ToolbarButton::OpenCommandPrompt) + { + ShowToolbarCommandPromptDropdown(); + + return TBDDRET_DEFAULT; + } return TBDDRET_NODEFAULT; } @@ -786,6 +795,29 @@ void MainToolbar::CreateViewsMenu(POINT *ptOrigin) 0, m_hwnd, nullptr); } +void MainToolbar::ShowToolbarCommandPromptDropdown() +{ + POINT ptOrigin; + RECT rcButton; + + SendMessage(m_hwnd, TB_GETRECT, (WPARAM)ToolbarButton::OpenCommandPrompt, (LPARAM)&rcButton); + + ptOrigin.x = rcButton.left; + ptOrigin.y = rcButton.bottom; + + ClientToScreen(m_hwnd, &ptOrigin); + + CreateCommandPromptOptionsMenu(&ptOrigin); +} + +void MainToolbar::CreateCommandPromptOptionsMenu(POINT* ptOrigin) +{ + HMENU commandPromptOptionsMenu = m_pexpp->BuildCommandPromptOptionsMenu(); + + TrackPopupMenu(commandPromptOptionsMenu, TPM_LEFTALIGN, ptOrigin->x, ptOrigin->y, + 0, m_hwnd, NULL); +} + // For some of the buttons on the toolbar, their state depends on an item from // the application configuration, rather than the properties of the current tab // or file selection. @@ -897,4 +929,4 @@ void MainToolbarPersistentSettings::SaveXMLSettings(IXMLDOMDocument *pXMLDom, IX index++; } -} \ No newline at end of file +} diff --git a/Explorer++/Explorer++/MainToolbar.h b/Explorer++/Explorer++/MainToolbar.h index d79e53f3d1..40f6570958 100644 --- a/Explorer++/Explorer++/MainToolbar.h +++ b/Explorer++/Explorer++/MainToolbar.h @@ -93,6 +93,8 @@ class MainToolbar : public BaseWindow void ShowHistoryMenu(HistoryType historyType, const POINT &pt); void ShowToolbarViewsDropdown(); void CreateViewsMenu(POINT *ptOrigin); + void ShowToolbarCommandPromptDropdown(); + void CreateCommandPromptOptionsMenu(POINT* ptOrigin); void OnTabSelected(const Tab &tab); void OnNavigationCompleted(const Tab &tab); @@ -118,4 +120,4 @@ class MainToolbar : public BaseWindow std::vector m_windowSubclasses; std::vector m_connections; -}; \ No newline at end of file +}; diff --git a/Explorer++/Explorer++/MainWndSwitch.cpp b/Explorer++/Explorer++/MainWndSwitch.cpp index 04551c7610..1e54527756 100644 --- a/Explorer++/Explorer++/MainWndSwitch.cpp +++ b/Explorer++/Explorer++/MainWndSwitch.cpp @@ -354,6 +354,7 @@ LRESULT Explorerplusplus::HandleMenuOrAccelerator(HWND hwnd, WPARAM wParam) StartCommandPrompt(m_CurrentDirectory, false); break; + case IDM_COMMAND_PROMPT_DROPDOWN_AS_ADMIN: case IDM_FILE_OPENCOMMANDPROMPTADMINISTRATOR: StartCommandPrompt(m_CurrentDirectory, true); break; @@ -1644,4 +1645,4 @@ LRESULT CALLBACK Explorerplusplus::NotifyHandler(HWND hwnd, UINT msg, WPARAM wPa } return DefWindowProc(hwnd, msg, wParam, lParam); -} \ No newline at end of file +} diff --git a/Explorer++/Explorer++/resource.h b/Explorer++/Explorer++/resource.h index d9888a4e38..9c9a1c099c 100644 --- a/Explorer++/Explorer++/resource.h +++ b/Explorer++/Explorer++/resource.h @@ -31,6 +31,7 @@ #define IDD_SETDEFAULTCOLUMNS 187 #define IDR_VIEWS_MENU 195 #define IDR_TOOLBAR_MENU 196 +#define IDR_COMMAND_PROMPT_OPTIONS_MENU 197 #define IDD_RENAMETAB 213 #define IDD_EDITAPPLICATIONBUTTON 216 #define IDR_APPLICATIONTOOLBAR_MENU 217 @@ -909,6 +910,7 @@ #define IDM_VIEW_DETAILS 60005 #define IDM_VIEW_LARGEICONS 60007 #define IDM_VIEW_EXTRALARGEICONS 60008 +#define IDM_COMMAND_PROMPT_DROPDOWN_AS_ADMIN 60009 // Next default values for new objects //