diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 2d4519aec39..1418b3ec698 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -334,4 +334,51 @@ Command Prompt This is the name of "Command Prompt", as localized in Windows. The localization here should match the one in the Windows product for "Command Prompt" + + OK + Close Button Text + + + Default Keybindings + + + + Change Focus: + + + + Quit: + + + + Close Pane: + + + + Copy: + + + + Find: + + + + Paste: + + + + Resize Pane: + + + + Split Pane: + + + + Keybindings + + + Keybindings + + diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 98d28d6b23a..7a764fd0761 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -235,6 +235,18 @@ namespace winrt::TerminalApp::implementation _showDialogHandlers(*this, FindName(L"AboutDialog").try_as()); } + + // Method Description: + // - Show a dialog with Shortcuts information. Displays the app's default keybindings + void TerminalPage::_ShowShortcutsDialog() + { + const auto title = RS_(L"KeybindingsTitle", titleKey); + const auto buttonText = RS_(L"Ok"); + WUX::Controls::ContentDialog dialog; + dialog.CloseButtonText(buttonText); + _showDialogHandlers(*this, dialog); + } + winrt::hstring TerminalPage::ApplicationDisplayName() { if (const auto appLogic{ implementation::AppLogic::Current() }) @@ -381,6 +393,18 @@ namespace winrt::TerminalApp::implementation { _SetAcceleratorForMenuItem(settingsItem, settingsKeyChord); } + + // Create the shortcuts button. + auto shortcutsFlyout = WUX::Controls::MenuFlyoutItem{}; + shortcutsFlyout.Text(RS_(L"ShortcutsMenuItem")); + + WUX::Controls::FontIcon shortcutsIcon{}; + shortcutsIcon.Glyph(L"\xE765"); + shortcutsIcon.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" }); + shortcutsFlyout.Icon(shortcutsIcon); + + shortcutsFlyout.Click({ this, &TerminalPage::_ShortcutsButtonOnClick }); + newTabFlyout.Items().Append(shortcutsFlyout); // Create the feedback button. auto feedbackFlyout = WUX::Controls::MenuFlyoutItem{}; @@ -649,6 +673,19 @@ namespace winrt::TerminalApp::implementation _LaunchSettings(altPressed); } + // Method Description: + // - Called when the shortcuts button is clicked. See _ShowShortcutsDialog for more info. + // Arguments: + // - + // Return Value: + // - + void TerminalPage::_ShortcutsButtonOnClick(const IInspectable&, + const RoutedEventArgs&) + { + _ShowShortcutsDialog(); + } + + // Method Description: // - Called when the feedback button is clicked. Launches github in your // default browser, navigated to the "issues" page of the Terminal repo. diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 2f6523a6672..ac17bab84ea 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -97,6 +97,7 @@ namespace winrt::TerminalApp::implementation winrt::fire_and_forget _ProcessStartupActions(); void _ShowAboutDialog(); + void _ShowShortcutsDialog(); void _ShowCloseWarningDialog(); void _CreateNewTabFlyout(); @@ -106,6 +107,7 @@ namespace winrt::TerminalApp::implementation winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _CreateConnectionFromSettings(GUID profileGuid, winrt::Microsoft::Terminal::Settings::TerminalSettings settings); void _SettingsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); + void _ShortcutsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); void _FeedbackButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs); void _CloseWarningPrimaryButtonOnClick(Windows::UI::Xaml::Controls::ContentDialog sender, Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs eventArgs); diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml index 7e813884368..1e06cd7ca20 100644 --- a/src/cascadia/TerminalApp/TerminalPage.xaml +++ b/src/cascadia/TerminalApp/TerminalPage.xaml @@ -53,5 +53,32 @@ the MIT License. See LICENSE in the project root for license information. --> DefaultButton="Primary" PrimaryButtonClick="_CloseWarningPrimaryButtonOnClick"> + + + + + + + + + + + + + + + + + + + + + + +