diff --git a/src/cascadia/TerminalApp/Profile.cpp b/src/cascadia/TerminalApp/Profile.cpp index 28a9897fc7f..c69f7759dc4 100644 --- a/src/cascadia/TerminalApp/Profile.cpp +++ b/src/cascadia/TerminalApp/Profile.cpp @@ -183,6 +183,7 @@ TerminalSettings Profile::CreateTerminalSettings(const std::unordered_map - @@ -117,27 +117,48 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Match Case - The tooltip text for CaseSensitivityButton + The tooltip text for the case sensitivity button on the search box control. - + Close - The tooltip text for CloseButton + The tooltip text for the close button on the search box control. - + Find Up - The tooltip text for GoBackward Button + The tooltip text for the search backward button. - + Find Down - The tooltip text for GoForward Button + The tooltip text for the search forward button. - + Find... - The placeholder text in the search dialog TextBox + The placeholder text in the search box control. Copy path to file + The displayed caption for dragging a file onto a terminal. + + + Case Sensitivity + The name of the case sensitivity button on the search box control for accessibility. + + + Search Forward + The name of the search forward button for accessibility. + + + Search Backward + The name of the search backward button for accessibility. + + + Search Text + The name of the text box on the search box control for accessibility. + + + terminal + The type of control that the terminal ahderes to. Used to identify how a user can interact with this kind of control. - + \ No newline at end of file diff --git a/src/cascadia/TerminalControl/SearchBoxControl.xaml b/src/cascadia/TerminalControl/SearchBoxControl.xaml index 08a0bd5ef44..2bf71326451 100644 --- a/src/cascadia/TerminalControl/SearchBoxControl.xaml +++ b/src/cascadia/TerminalControl/SearchBoxControl.xaml @@ -153,29 +153,44 @@ - + - + - - + - diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index d141855dc56..72bb372c79f 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1606,6 +1606,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation return hstr; } + hstring TermControl::GetProfileName() const + { + return _settings.ProfileName(); + } + // Method Description: // - Given a copy-able selection, get the selected text from the buffer and send it to the // Windows Clipboard (CascadiaWin32:main.cpp). diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index ffa7fb67971..0fcc63cde4d 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -61,6 +61,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation winrt::fire_and_forget UpdateSettings(Settings::IControlSettings newSettings); hstring Title(); + hstring GetProfileName() const; bool CopySelectionToClipboard(bool trimTrailingWhitespace); void PasteTextFromClipboard(); diff --git a/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp b/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp index 27a7b885579..f50ba2ac6de 100644 --- a/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp +++ b/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp @@ -3,6 +3,7 @@ #include "pch.h" #include +#include #include "TermControlAutomationPeer.h" #include "TermControl.h" #include "TermControlAutomationPeer.g.cpp" @@ -77,7 +78,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation }); } - winrt::hstring TermControlAutomationPeer::GetClassNameCore() const + hstring TermControlAutomationPeer::GetClassNameCore() const { return L"TermControl"; } @@ -87,13 +88,12 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation return AutomationControlType::Text; } - winrt::hstring TermControlAutomationPeer::GetLocalizedControlTypeCore() const + hstring TermControlAutomationPeer::GetLocalizedControlTypeCore() const { - // TODO GitHub #2142: Localize string - return L"TerminalControl"; + return RS_(L"TerminalControl_ControlType"); } - winrt::Windows::Foundation::IInspectable TermControlAutomationPeer::GetPatternCore(PatternInterface patternInterface) const + Windows::Foundation::IInspectable TermControlAutomationPeer::GetPatternCore(PatternInterface patternInterface) const { switch (patternInterface) { @@ -105,15 +105,41 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } } + AutomationOrientation TermControlAutomationPeer::GetOrientationCore() const + { + return AutomationOrientation::Vertical; + } + + hstring TermControlAutomationPeer::GetNameCore() const + { + // fallback to title if profile name is empty + auto profileName = _termControl->GetProfileName(); + if (profileName.empty()) + { + return _termControl->Title(); + } + return profileName; + } + + hstring TermControlAutomationPeer::GetHelpTextCore() const + { + return _termControl->Title(); + } + + AutomationLiveSetting TermControlAutomationPeer::GetLiveSettingCore() const + { + return AutomationLiveSetting::Polite; + } + #pragma region ITextProvider - winrt::com_array TermControlAutomationPeer::GetSelection() + com_array TermControlAutomationPeer::GetSelection() { SAFEARRAY* pReturnVal; THROW_IF_FAILED(_uiaProvider->GetSelection(&pReturnVal)); return WrapArrayOfTextRangeProviders(pReturnVal); } - winrt::com_array TermControlAutomationPeer::GetVisibleRanges() + com_array TermControlAutomationPeer::GetVisibleRanges() { SAFEARRAY* pReturnVal; THROW_IF_FAILED(_uiaProvider->GetVisibleRanges(&pReturnVal)); @@ -152,7 +178,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation return xutr.as(); } - Windows::UI::Xaml::Automation::SupportedTextSelection TermControlAutomationPeer::SupportedTextSelection() + XamlAutomation::SupportedTextSelection TermControlAutomationPeer::SupportedTextSelection() { UIA::SupportedTextSelection returnVal; THROW_IF_FAILED(_uiaProvider->get_SupportedTextSelection(&returnVal)); @@ -214,7 +240,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation // - SAFEARRAY of UIA::UiaTextRange (ITextRangeProviders) // Return Value: // - com_array of Xaml Wrapped UiaTextRange (ITextRangeProviders) - winrt::com_array TermControlAutomationPeer::WrapArrayOfTextRangeProviders(SAFEARRAY* textRanges) + com_array TermControlAutomationPeer::WrapArrayOfTextRangeProviders(SAFEARRAY* textRanges) { // transfer ownership of UiaTextRanges to this new vector auto providers = SafeArrayToOwningVector<::Microsoft::Terminal::TermControlUiaTextRange>(textRanges); @@ -225,11 +251,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation auto parentProvider = this->ProviderFromPeer(*this); for (int i = 0; i < count; i++) { - auto xutr = winrt::make_self(providers[i].detach(), parentProvider); + auto xutr = make_self(providers[i].detach(), parentProvider); vec.emplace_back(xutr.as()); } - winrt::com_array result{ vec }; + com_array result{ vec }; return result; } diff --git a/src/cascadia/TerminalControl/TermControlAutomationPeer.h b/src/cascadia/TerminalControl/TermControlAutomationPeer.h index bf3a95b360c..56e12e56b4d 100644 --- a/src/cascadia/TerminalControl/TermControlAutomationPeer.h +++ b/src/cascadia/TerminalControl/TermControlAutomationPeer.h @@ -39,12 +39,18 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation ::Microsoft::Console::Types::IControlAccessibilityInfo { public: - TermControlAutomationPeer(winrt::Microsoft::Terminal::TerminalControl::implementation::TermControl* owner); + TermControlAutomationPeer(Microsoft::Terminal::TerminalControl::implementation::TermControl* owner); - winrt::hstring GetClassNameCore() const; - winrt::Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() const; - winrt::hstring GetLocalizedControlTypeCore() const; - winrt::Windows::Foundation::IInspectable GetPatternCore(winrt::Windows::UI::Xaml::Automation::Peers::PatternInterface patternInterface) const; +#pragma region FrameworkElementAutomationPeer + hstring GetClassNameCore() const; + Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() const; + hstring GetLocalizedControlTypeCore() const; + Windows::Foundation::IInspectable GetPatternCore(Windows::UI::Xaml::Automation::Peers::PatternInterface patternInterface) const; + Windows::UI::Xaml::Automation::Peers::AutomationOrientation GetOrientationCore() const; + hstring GetNameCore() const; + hstring GetHelpTextCore() const; + Windows::UI::Xaml::Automation::Peers::AutomationLiveSetting GetLiveSettingCore() const; +#pragma endregion #pragma region IUiaEventDispatcher void SignalSelectionChanged() override; @@ -55,8 +61,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation #pragma region ITextProvider Pattern Windows::UI::Xaml::Automation::Provider::ITextRangeProvider RangeFromPoint(Windows::Foundation::Point screenLocation); Windows::UI::Xaml::Automation::Provider::ITextRangeProvider RangeFromChild(Windows::UI::Xaml::Automation::Provider::IRawElementProviderSimple childElement); - winrt::com_array GetVisibleRanges(); - winrt::com_array GetSelection(); + com_array GetVisibleRanges(); + com_array GetSelection(); Windows::UI::Xaml::Automation::SupportedTextSelection SupportedTextSelection(); Windows::UI::Xaml::Automation::Provider::ITextRangeProvider DocumentRange(); #pragma endregion diff --git a/src/cascadia/TerminalControl/TerminalControl.vcxproj.filters b/src/cascadia/TerminalControl/TerminalControl.vcxproj.filters index 3a9cb6eab60..d90f6304cae 100644 --- a/src/cascadia/TerminalControl/TerminalControl.vcxproj.filters +++ b/src/cascadia/TerminalControl/TerminalControl.vcxproj.filters @@ -18,6 +18,7 @@ + @@ -26,12 +27,12 @@ - + @@ -43,4 +44,9 @@ + + + Resources + + diff --git a/src/cascadia/TerminalSettings/IControlSettings.idl b/src/cascadia/TerminalSettings/IControlSettings.idl index afb6b2e45d0..12400ad9d9b 100644 --- a/src/cascadia/TerminalSettings/IControlSettings.idl +++ b/src/cascadia/TerminalSettings/IControlSettings.idl @@ -26,6 +26,8 @@ namespace Microsoft.Terminal.Settings // for specifically the control. interface IControlSettings requires Microsoft.Terminal.Settings.ICoreSettings { + String ProfileName; + Boolean UseAcrylic; Double TintOpacity; ScrollbarState ScrollState; diff --git a/src/cascadia/TerminalSettings/TerminalSettings.cpp b/src/cascadia/TerminalSettings/TerminalSettings.cpp index d20eb352def..46fe1b45d36 100644 --- a/src/cascadia/TerminalSettings/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettings/TerminalSettings.cpp @@ -28,6 +28,7 @@ namespace winrt::Microsoft::Terminal::Settings::implementation _cursorHeight{ DEFAULT_CURSOR_HEIGHT }, _wordDelimiters{ DEFAULT_WORD_DELIMITERS }, _copyOnSelect{ false }, + _profileName{}, _useAcrylic{ false }, _tintOpacity{ 0.5 }, _padding{ DEFAULT_PADDING }, @@ -196,6 +197,16 @@ namespace winrt::Microsoft::Terminal::Settings::implementation _copyOnSelect = value; } + void TerminalSettings::ProfileName(hstring const& value) + { + _profileName = value; + } + + hstring TerminalSettings::ProfileName() + { + return _profileName; + } + bool TerminalSettings::UseAcrylic() noexcept { return _useAcrylic; diff --git a/src/cascadia/TerminalSettings/terminalsettings.h b/src/cascadia/TerminalSettings/terminalsettings.h index a4b4098f16b..e78fa00901e 100644 --- a/src/cascadia/TerminalSettings/terminalsettings.h +++ b/src/cascadia/TerminalSettings/terminalsettings.h @@ -55,6 +55,8 @@ namespace winrt::Microsoft::Terminal::Settings::implementation void CopyOnSelect(bool value) noexcept; // ------------------------ End of Core Settings ----------------------- + hstring ProfileName(); + void ProfileName(hstring const& value); bool UseAcrylic() noexcept; void UseAcrylic(bool value) noexcept; double TintOpacity() noexcept; @@ -120,6 +122,7 @@ namespace winrt::Microsoft::Terminal::Settings::implementation uint32_t _cursorHeight; hstring _wordDelimiters; + hstring _profileName; bool _useAcrylic; double _tintOpacity; hstring _fontFace;