From 4fe421c3aaab1a83e1d1c1fc01197030631e18c5 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Mon, 26 Aug 2024 16:15:28 -0700 Subject: [PATCH 01/17] Implement ColorRef and ColorPickerViewModel --- .../ColorPickerViewModel.cpp | 104 ++++++++++++++++++ .../ColorPickerViewModel.h | 51 +++++++++ .../ColorPickerViewModel.idl | 32 ++++++ ...Microsoft.Terminal.Settings.Editor.vcxproj | 9 ++ 4 files changed, 196 insertions(+) create mode 100644 src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h create mode 100644 src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp new file mode 100644 index 00000000000..7d6062109cd --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "ColorPickerViewModel.h" + +#include "ColorRef.g.cpp" +#include "ColorPickerViewModel.g.cpp" + +using namespace winrt::Microsoft::Terminal::Settings::Model; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + ColorRef::ColorRef(const Windows::UI::Color& color) : + _Color{ color }, + _Type{ ColorType::RGB } + { + } + + ColorRef::ColorRef(const Editor::ColorType type) : + _Type{ type } + { + } + + ColorRef::ColorRef(const Core::Color& color) : + _Color{ color }, + _Type{ ColorType::RGB } + { + } + + hstring ColorRef::ToString() + { + // TODO CARLOS: Localize! + switch (_Type) + { + case ColorType::RGB: + return hstring{ _Color.ToHexString(true) }; + case ColorType::TerminalBackground: + return { L"Terminal Background" }; + case ColorType::Accent: + return { L"Accent Color" }; + case ColorType::MoreColors: + return { L"More Colors..." }; + default: + // TODO CARLOS: this shouldn't exist + return { L"Unknown" }; + } + } + + Windows::UI::Color ColorRef::Color() const + { + switch (_Type) + { + case ColorType::TerminalBackground: + // TODO CARLOS: get the current background and return it here + return Windows::UI::Colors::Black(); + case ColorType::Accent: + // TODO CARLOS: get the current accent color and return it here + // we need to get the resource dictionary and "res.Lookup(accentColorKey)" + //static const auto accentColorKey{ winrt::box_value(L"SystemAccentColor") }; + return Windows::UI::Colors::Blue(); + default: + return _Color; + } + } + + void ColorRef::Color(const Windows::UI::Color& value) + { + _Color = value; + _Type = ColorType::RGB; + } + + ColorPickerViewModel::ColorPickerViewModel(const Model::Profile& profile, const Model::CascadiaSettings& settings) : + _profile{ profile }, + _settings{ settings }, + _colorList{ nullptr } + { + } + + Windows::Foundation::Collections::IObservableVector ColorPickerViewModel::ColorList() + { + if (!_colorList) + { + _RefreshColorList(); + } + return _colorList; + } + + void ColorPickerViewModel::_RefreshColorList() + { + // TODO CARLOS: we're using default appearance and dark CS here, + // they should be parameters to the constructor, probably + const auto schemeName = _profile.DefaultAppearance().DarkColorSchemeName(); + const auto scheme = _settings.GlobalSettings().ColorSchemes().Lookup(schemeName); + + const auto schemeTable = scheme.Table(); + auto colorList = single_threaded_observable_vector(); + for (const auto& color : schemeTable) + { + colorList.Append(winrt::make(color)); + } + _colorList = colorList; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h new file mode 100644 index 00000000000..1dc62bd66c6 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "ColorRef.g.h" +#include "ColorPickerViewModel.g.h" +#include "Utils.h" +#include "ViewModelHelpers.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct ColorRef : ColorRefT + { + ColorRef(const Windows::UI::Color& color); + ColorRef(const Editor::ColorType type); + ColorRef(const Core::Color& color); + + hstring ToString(); + + hstring Name() { return ToString(); }; + + Windows::UI::Color Color() const; + void Color(const Windows::UI::Color& value); + + WINRT_PROPERTY(Editor::ColorType, Type); + + private: + til::color _Color; + }; + + struct ColorPickerViewModel : ColorPickerViewModelT, ViewModelHelper + { + public: + ColorPickerViewModel(const Model::Profile& profile, const Model::CascadiaSettings& settings); + + Windows::Foundation::Collections::IObservableVector ColorList(); + WINRT_PROPERTY(Editor::ColorRef, CurrentColor, nullptr); + + private: + Model::Profile _profile; + Model::CascadiaSettings _settings; + Windows::Foundation::Collections::IObservableVector _colorList; + + void _RefreshColorList(); + }; +}; + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl new file mode 100644 index 00000000000..54c753fd307 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + enum ColorType + { + RGB, + Accent, + TerminalBackground, + MoreColors + }; + + // TODO CARLOS: add Windows.UI.Xaml.Data.INotifyPropertyChanged + [default_interface] + runtimeclass ColorRef : Windows.Foundation.IStringable + { + String Name { get; }; + + ColorType Type { get; }; + Windows.UI.Color Color { get; }; + } + + [default_interface] + runtimeclass ColorPickerViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged + { + //ColorPickerViewModel(Microsoft.Terminal.Settings.Model.Profile profile, Microsoft.Terminal.Settings.Model.CascadiaSettings settings); + ColorRef CurrentColor; + + IObservableVector ColorList { get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj index 836ec79a904..3ce4930afb1 100644 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj @@ -82,6 +82,10 @@ ActionsViewModel.idl Code + + ColorPickerViewModel.idl + Code + ColorSchemeViewModel.idl Code @@ -225,6 +229,10 @@ ActionsViewModel.idl Code + + ColorPickerViewModel.idl + Code + ColorSchemeViewModel.idl Code @@ -320,6 +328,7 @@ + From 15922b7ce0b7f6763eb7da48c613ac73472afbf1 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 27 Aug 2024 11:07:23 -0700 Subject: [PATCH 02/17] [broken] Add nullable color expanders to SUI --- .../TerminalSettingsEditor/Appearances.h | 4 + .../TerminalSettingsEditor/Appearances.idl | 5 + .../TerminalSettingsEditor/Appearances.xaml | 313 ++++++++++-------- .../TerminalSettingsEditor/ProfileViewModel.h | 4 - .../ProfileViewModel.idl | 4 - .../TerminalSettingsEditor/Profiles_Base.xaml | 11 + .../Resources/en-US/Resources.resw | 20 ++ 7 files changed, 221 insertions(+), 140 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.h b/src/cascadia/TerminalSettingsEditor/Appearances.h index 27a58073a8f..69e7af224f5 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.h +++ b/src/cascadia/TerminalSettingsEditor/Appearances.h @@ -147,6 +147,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation OBSERVABLE_PROJECTED_SETTING(_appearance, BackgroundImageAlignment); OBSERVABLE_PROJECTED_SETTING(_appearance, IntenseTextStyle); OBSERVABLE_PROJECTED_SETTING(_appearance, AdjustIndistinguishableColors); + OBSERVABLE_PROJECTED_SETTING(_appearance, Foreground); + OBSERVABLE_PROJECTED_SETTING(_appearance, Background); + OBSERVABLE_PROJECTED_SETTING(_appearance, SelectionBackground); + OBSERVABLE_PROJECTED_SETTING(_appearance, CursorColor); WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector, SchemesList, _propertyChangedHandlers, nullptr); private: diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.idl b/src/cascadia/TerminalSettingsEditor/Appearances.idl index 0907e5f8f3d..5214027df3e 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.idl +++ b/src/cascadia/TerminalSettingsEditor/Appearances.idl @@ -77,6 +77,11 @@ namespace Microsoft.Terminal.Settings.Editor OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Settings.Model.ConvergedAlignment, BackgroundImageAlignment); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Settings.Model.IntenseStyle, IntenseTextStyle); OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Core.AdjustTextMode, AdjustIndistinguishableColors); + + OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference, Foreground); + OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference, Background); + OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference, SelectionBackground); + OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference, CursorColor); } [default_interface] runtimeclass Appearances : Windows.UI.Xaml.Controls.UserControl, Windows.UI.Xaml.Data.INotifyPropertyChanged diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.xaml b/src/cascadia/TerminalSettingsEditor/Appearances.xaml index a3f643c53c3..3e90d3b05f6 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.xaml +++ b/src/cascadia/TerminalSettingsEditor/Appearances.xaml @@ -69,138 +69,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h index f0ce84f1f05..bff87b0a59a 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.h @@ -104,10 +104,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation OBSERVABLE_PROJECTED_SETTING(_profile, Commandline); OBSERVABLE_PROJECTED_SETTING(_profile, StartingDirectory); OBSERVABLE_PROJECTED_SETTING(_profile, AntialiasingMode); - OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), Foreground); - OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), Background); - OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), SelectionBackground); - OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), CursorColor); OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), Opacity); OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), UseAcrylic); OBSERVABLE_PROJECTED_SETTING(_profile, HistorySize); diff --git a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl index c0bc407c7ae..b33593bc94f 100644 --- a/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl @@ -97,10 +97,6 @@ namespace Microsoft.Terminal.Settings.Editor OBSERVABLE_PROJECTED_PROFILE_SETTING(String, Commandline); OBSERVABLE_PROJECTED_PROFILE_SETTING(String, StartingDirectory); OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.TextAntialiasingMode, AntialiasingMode); - OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.IReference, Foreground); - OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.IReference, Background); - OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.IReference, SelectionBackground); - OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.IReference, CursorColor); OBSERVABLE_PROJECTED_PROFILE_SETTING(Int32, HistorySize); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, SnapOnInput); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AltGrAliasing); diff --git a/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml b/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml index 1b676718ecb..6abb05c6977 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml @@ -137,6 +137,17 @@ Text="{x:Bind Profile.TabTitle, Mode=TwoWay}" /> + + + + + Non-monospace fonts: This is a label that is followed by a list of proportional fonts. + + Color + Header for a group of settings that control the color of the text. + + + Tab color + Header for a control to determine the color of the tab. + + + Foreground + Header for a control to determine the foreground color of text. + + + Background + Header for a control to determine the background color of text. + + + Selection background + Header for a control to determine the background color of selected text. + \ No newline at end of file From 153d97e1d11d0b24d1d67644591776770e68b5c8 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 27 Aug 2024 16:05:31 -0700 Subject: [PATCH 03/17] Add previews for nullable color expanders --- .../TerminalSettingsEditor/Appearances.xaml | 40 ++++++----- .../ColorPickerViewModel.cpp | 38 ++++++++++ .../ColorPickerViewModel.h | 20 ++++++ .../ColorPickerViewModel.idl | 10 +++ .../CommonResources.xaml | 30 ++++++++ .../TerminalSettingsEditor/Profiles_Base.xaml | 7 +- .../Resources/en-US/Resources.resw | 14 +++- .../SettingContainer.cpp | 14 +++- .../TerminalSettingsEditor/SettingContainer.h | 3 +- .../SettingContainer.idl | 5 +- .../SettingContainerStyle.xaml | 70 ++++++++++++++++--- src/cascadia/UIHelpers/Converters.h | 4 +- 12 files changed, 218 insertions(+), 37 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.xaml b/src/cascadia/TerminalSettingsEditor/Appearances.xaml index 3e90d3b05f6..391dd6c0d3e 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.xaml +++ b/src/cascadia/TerminalSettingsEditor/Appearances.xaml @@ -264,7 +264,7 @@ - + @@ -400,37 +400,40 @@ - + - + Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}"> + - + - + x:Uid="Profile_Background" + ClearSettingValue="{x:Bind Appearance.ClearBackground}" + CurrentValue="{x:Bind Appearance.Background, Mode=OneWay}" + CurrentValueTemplate="{StaticResource ColorPreviewTemplate}" + HasSettingValue="{x:Bind Appearance.HasBackground, Mode=OneWay}" + SettingOverrideSource="{x:Bind Appearance.BackgroundOverrideSource, Mode=OneWay}" + Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}"> + - + - + Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}"> + @@ -473,15 +476,16 @@ - + - + Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}"> + diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp index 7d6062109cd..58be0c369f6 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.cpp @@ -6,11 +6,49 @@ #include "ColorRef.g.cpp" #include "ColorPickerViewModel.g.cpp" +#include "TerminalColorToBrushConverter.g.cpp" +#include "TerminalColorToStringConverter.g.cpp" using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { + + Windows::Foundation::IInspectable TerminalColorToBrushConverter::Convert(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& /*targetType*/, Windows::Foundation::IInspectable const& /*parameter*/, hstring const& /*language*/) + { + if (const auto termColor = value.as>()) + { + Windows::UI::Color color{ + .A = 255, + .R = termColor.Value().R, + .G = termColor.Value().G, + .B = termColor.Value().B + }; + return Microsoft::Terminal::UI::Converters::ColorToBrush(color); + } + return nullptr; + } + + Windows::Foundation::IInspectable TerminalColorToBrushConverter::ConvertBack(Windows::Foundation::IInspectable const& /*value*/, Windows::UI::Xaml::Interop::TypeName const& /*targetType*/, Windows::Foundation::IInspectable const& /*parameter*/, hstring const& /*language*/) + { + throw hresult_not_implemented(); + } + + Windows::Foundation::IInspectable TerminalColorToStringConverter::Convert(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& /*targetType*/, Windows::Foundation::IInspectable const& /*parameter*/, hstring const& /*language*/) + { + if (const auto maybeColor = value.as>()) + { + const auto color = maybeColor.Value(); + return winrt::box_value(fmt::format(FMT_COMPILE(L"#{:02X}{:02X}{:02X}"), color.R, color.G, color.B)); + } + return nullptr; + } + + Windows::Foundation::IInspectable TerminalColorToStringConverter::ConvertBack(Windows::Foundation::IInspectable const& /*value*/, Windows::UI::Xaml::Interop::TypeName const& /*targetType*/, Windows::Foundation::IInspectable const& /*parameter*/, hstring const& /*language*/) + { + throw hresult_not_implemented(); + } + ColorRef::ColorRef(const Windows::UI::Color& color) : _Color{ color }, _Type{ ColorType::RGB } diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h index 1dc62bd66c6..16708860015 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.h @@ -5,11 +5,29 @@ #include "ColorRef.g.h" #include "ColorPickerViewModel.g.h" +#include "TerminalColorToBrushConverter.g.h" +#include "TerminalColorToStringConverter.g.h" #include "Utils.h" #include "ViewModelHelpers.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { + struct TerminalColorToBrushConverter : TerminalColorToBrushConverterT + { + TerminalColorToBrushConverter() = default; + + Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& targetType, Windows::Foundation::IInspectable const& parameter, hstring const& language); + Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& targetType, Windows::Foundation::IInspectable const& parameter, hstring const& language); + }; + + struct TerminalColorToStringConverter : TerminalColorToStringConverterT + { + TerminalColorToStringConverter() = default; + + Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& targetType, Windows::Foundation::IInspectable const& parameter, hstring const& language); + Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& targetType, Windows::Foundation::IInspectable const& parameter, hstring const& language); + }; + struct ColorRef : ColorRefT { ColorRef(const Windows::UI::Color& color); @@ -48,4 +66,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation { + BASIC_FACTORY(TerminalColorToBrushConverter); + BASIC_FACTORY(TerminalColorToStringConverter); } diff --git a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl index 54c753fd307..c43e595b984 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl +++ b/src/cascadia/TerminalSettingsEditor/ColorPickerViewModel.idl @@ -3,6 +3,16 @@ namespace Microsoft.Terminal.Settings.Editor { + runtimeclass TerminalColorToBrushConverter : [default] Windows.UI.Xaml.Data.IValueConverter + { + TerminalColorToBrushConverter(); + } + + runtimeclass TerminalColorToStringConverter : [default] Windows.UI.Xaml.Data.IValueConverter + { + TerminalColorToStringConverter(); + } + enum ColorType { RGB, diff --git a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml index 509e1782c29..491e75540df 100644 --- a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml +++ b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml @@ -4,6 +4,7 @@ --> @@ -60,6 +61,9 @@ + + + Firebrick 14.0 @@ -68,6 +72,32 @@ 250 1000 + + + + + + + + + + + + + - + Style="{StaticResource ExpanderSettingContainerStyleWithComplexPreview}"> + diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index 1dac4e679d3..e39f82399ca 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -1839,7 +1839,7 @@ Non-monospace fonts: This is a label that is followed by a list of proportional fonts. - + Color Header for a group of settings that control the color of the text. @@ -1859,4 +1859,16 @@ Selection background Header for a control to determine the background color of selected text. + + Color + Header for a control to determine the color of the cursor. + + + Overrides the foreground color from the color scheme. + A description for what the "foreground" setting does. Presented near "Profile_Foreground". + + + Overrides the background color from the color scheme. + A description for what the "background" setting does. Presented near "Profile_Background". + \ No newline at end of file diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp index 8a32fbacb31..85b4ae30064 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp +++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp @@ -13,6 +13,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation DependencyProperty SettingContainer::_HeaderProperty{ nullptr }; DependencyProperty SettingContainer::_HelpTextProperty{ nullptr }; DependencyProperty SettingContainer::_CurrentValueProperty{ nullptr }; + DependencyProperty SettingContainer::_CurrentValueTemplateProperty{ nullptr }; DependencyProperty SettingContainer::_HasSettingValueProperty{ nullptr }; DependencyProperty SettingContainer::_SettingOverrideSourceProperty{ nullptr }; DependencyProperty SettingContainer::_StartExpandedProperty{ nullptr }; @@ -50,9 +51,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _CurrentValueProperty = DependencyProperty::Register( L"CurrentValue", - xaml_typename(), + xaml_typename(), xaml_typename(), - PropertyMetadata{ box_value(L"") }); + PropertyMetadata{ nullptr }); + } + if (!_CurrentValueTemplateProperty) + { + _CurrentValueTemplateProperty = + DependencyProperty::Register( + L"CurrentValueTemplate", + xaml_typename(), + xaml_typename(), + PropertyMetadata{ nullptr }); } if (!_HasSettingValueProperty) { diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.h b/src/cascadia/TerminalSettingsEditor/SettingContainer.h index 9fcb2d24efa..711dcca62df 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainer.h +++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.h @@ -35,7 +35,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, Header); DEPENDENCY_PROPERTY(hstring, HelpText); - DEPENDENCY_PROPERTY(hstring, CurrentValue); + DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, CurrentValue); + DEPENDENCY_PROPERTY(Windows::UI::Xaml::DataTemplate, CurrentValueTemplate); DEPENDENCY_PROPERTY(bool, HasSettingValue); DEPENDENCY_PROPERTY(bool, StartExpanded); DEPENDENCY_PROPERTY(IInspectable, SettingOverrideSource); diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.idl b/src/cascadia/TerminalSettingsEditor/SettingContainer.idl index 8b5fd0eba95..0d2d0d4011f 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainer.idl +++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.idl @@ -15,9 +15,12 @@ namespace Microsoft.Terminal.Settings.Editor String HelpText; static Windows.UI.Xaml.DependencyProperty HelpTextProperty { get; }; - String CurrentValue; + IInspectable CurrentValue; static Windows.UI.Xaml.DependencyProperty CurrentValueProperty { get; }; + Windows.UI.Xaml.DataTemplate CurrentValueTemplate; + static Windows.UI.Xaml.DependencyProperty CurrentValueTemplateProperty { get; }; + Boolean HasSettingValue; static Windows.UI.Xaml.DependencyProperty HasSettingValueProperty { get; }; diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml b/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml index 0e12e7d3de7..6e27bd09fb2 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml +++ b/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml @@ -169,6 +169,16 @@ + + + + + + + + + - +