Represent inheritance in Settings UI (#8919)

## Summary of the Pull Request
Introduces the `SettingContainer`. `SettingContainer` is used to wrap a setting in the settings UI and provide the following functionality:
- a reset button next to the header
- tooltips and automation properties for the setting being wrapped
- a comment stating if you are currently overriding a setting

## References
[Spec - Inheritance in Settings UI](https://github.com/microsoft/terminal/blob/main/doc/specs/%231564%20-%20Settings%20UI/cascading-settings.md)
#8804 - removes the ambiguity of leaving a setting blank
#6800 - Settings UI Epic
#8899 - Automation properties for Settings UI
#8768 - Keyboard Navigation

## PR Checklist
* [X] Closes #8804

## Detailed Description of the Pull Request / Additional comments
A few highlights in this PR:
- CommonResources.xaml:
  - we need to merge the SettingContainerStyle.xaml in there. Otherwise, XAML doesn't merge these files properly and can't apply the template.
- Profiles.cpp:
  - view model checks if the starting directory and background image were reset, to determine which value to show when unchecking the special value
  - `Profiles::OnNavigatedTo()` needs a property changed handler to update its own "Current<Setting>" and update the UI properly
- Profiles.xaml:
  - basically wrapped all of the settings we want to be inheritable in there
  - `Binding` is used instead of `x:Bind` in some places because `x:Bind` can't find the parent `SettingContainer` and gives you a compiler error.
- Resources.resw:
  - had to set the "HeaderText" and "HelpText" on each setting container. Does a decent localization burden, unfortunately.
- `SettingContainer` files
  - This operates by creating a template and applying that template over other settings. This allows you to inject the existing controls inside of this. This means that we need to provide our UIElements names and access/modify them via `OnApplyTemplate`
  - We had to remove the header from each individual control, and have `SettingContainer` be in charge of it. This allows us to add the reset button in there.
  - Due to the problem mentioned earlier about CommonResources.xaml, we can't reference anything from CommonResources.xaml.
  - Using `DependencyProperty` to let us set a few properties in the XML files. Particularly, `Has<Setting>` and `Clear<Setting>` are what do all the heavy lifting of interacting with the inheritance model.

## Demo
![Inheritance Demo](https://user-images.githubusercontent.com/11050425/106192086-92a56680-6160-11eb-838c-4ec0beb54965.gif)

## Validation Steps Performed
- Verified correct binding behavior with the following generic setting controls:
  - radio buttons
  - toggle switch
  - text block
  - slider
  - settings with browse buttons
  - the background image alignment control
  - controls with special check boxes (starting directory and background image)

## Next Steps
- The automation properties have been verified using NVDA. This is a part of resolving #8899.
- The override text is currently "Overrides a setting". According to #8269, we actually want to add a hyperlink in there that navigates to the parent profile object. This will be a follow-up task as it requires settings model changes.
This commit is contained in:
Carlos Zamora 2021-02-08 10:04:43 -08:00 committed by GitHub
parent 3230b18020
commit 3b7b200b59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1000 additions and 604 deletions

View file

@ -1,4 +1,6 @@
<UserControl
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information. -->
<UserControl
x:Class="Microsoft.Terminal.TerminalControl.TermControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

View file

@ -1,19 +1,20 @@
<ResourceDictionary
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
<!--Merge SettingContainerStyle here to give every page access to the SettingContainer-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="SettingContainerStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<x:Double x:Key="StandardIconSize">14.0</x:Double>
<Thickness x:Key="StandardIndentMargin">13,0,0,0</Thickness>
<Thickness x:Key="StandardControlMargin">0,24,0,0</Thickness>
<x:Double x:Key="StandardBoxMinWidth">250</x:Double>
<!-- This is for easier transition to the SettingsContainer control.
The SettingsContainer will wrap a setting with inheritance UI.-->
<Style x:Key="SettingContainerStyle" TargetType="ContentPresenter">
<Setter Property="Margin" Value="{StaticResource StandardControlMargin}"/>
</Style>
<!-- This is for styling the entire items control used on the
color schemes page-->
<Style x:Key="ItemsControlStyle" TargetType="ItemsControl">
@ -44,11 +45,6 @@
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!--Used to create a header for a control-->
<Style x:Key="CustomSettingHeaderStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<!--Used for disclaimers-->
<Style x:Key="DisclaimerStyle" TargetType="TextBlock">
<Setter Property="FontStyle" Value="Italic"/>
@ -110,10 +106,6 @@
<Setter Property="Margin" Value="5,0,0,0"/>
</Style>
<Style x:Key="SliderHeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource CustomSettingHeaderStyle}">
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style x:Key="CustomSliderControlGridStyle" TargetType="Grid">
<Setter Property="Width" Value="{StaticResource StandardBoxMinWidth}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>

View file

@ -25,51 +25,44 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Theme-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<muxc:RadioButtons x:Uid="Globals_Theme"
SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}"
<local:SettingContainer x:Uid="Globals_Theme"
Margin="0">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}"
ItemsSource="{x:Bind ThemeList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Always show tabs-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_AlwaysShowTabs"
IsOn="{x:Bind State.Globals.AlwaysShowTabs, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_AlwaysShowTabs">
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysShowTabs, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Show Titlebar-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_ShowTitlebar"
IsOn="{x:Bind State.Globals.ShowTabsInTitlebar, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_ShowTitlebar">
<ToggleSwitch IsOn="{x:Bind State.Globals.ShowTabsInTitlebar, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Show Title in Titlebar-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_ShowTitleInTitlebar"
IsOn="{x:Bind State.Globals.ShowTitleInTitlebar, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_ShowTitleInTitlebar">
<ToggleSwitch IsOn="{x:Bind State.Globals.ShowTitleInTitlebar, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Always on Top-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_AlwaysOnTop"
IsOn="{x:Bind State.Globals.AlwaysOnTop, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_AlwaysOnTop">
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysOnTop, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Tab Width Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Globals_TabWidthMode"
SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}"
<local:SettingContainer x:Uid="Globals_TabWidthMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}"
ItemsSource="{x:Bind TabWidthModeList, Mode=OneWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Disable Animations-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_DisableAnimations"
IsOn="{x:Bind State.Globals.DisableAnimations, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_DisableAnimations">
<ToggleSwitch IsOn="{x:Bind State.Globals.DisableAnimations, Mode=TwoWay}"/>
</local:SettingContainer>
</StackPanel>
</ScrollViewer>
</Page>

View file

@ -15,50 +15,45 @@ the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:DataType="local:EnumEntry" x:Key="EnumRadioButtonTemplate">
<RadioButton Content="{x:Bind EnumName, Mode=OneWay}"/>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
<ScrollViewer>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Copy On Select-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<ToggleSwitch x:Uid="Globals_CopyOnSelect"
IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_CopyOnSelect"
Margin="0">
<ToggleSwitch IsOn="{x:Bind State.Globals.CopyOnSelect, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Copy Format-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Globals_CopyFormat"
ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
<local:SettingContainer x:Uid="Globals_CopyFormat">
<muxc:RadioButtons ItemsSource="{x:Bind CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCopyFormat, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Word Delimiters-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<TextBox x:Uid="Globals_WordDelimiters"
Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}"
<local:SettingContainer x:Uid="Globals_WordDelimiters">
<TextBox Text="{x:Bind State.Globals.WordDelimiters, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Snap On Resize-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_SnapToGridOnResize"
IsOn="{x:Bind State.Globals.SnapToGridOnResize, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_SnapToGridOnResize">
<ToggleSwitch IsOn="{x:Bind State.Globals.SnapToGridOnResize, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Tab Switcher Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Globals_TabSwitcherMode"
SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}"
<local:SettingContainer x:Uid="Globals_TabSwitcherMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}"
ItemsSource="{x:Bind TabSwitcherModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
</StackPanel>
</ScrollViewer>
</Page>

View file

@ -33,13 +33,12 @@ the MIT License. See LICENSE in the project root for license information. -->
<StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Default Profile-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<ComboBox x:Uid="Globals_DefaultProfile"
x:Name="DefaultProfile"
ItemsSource="{x:Bind State.Settings.AllProfiles, Mode=OneWay}"
SelectedItem="{x:Bind CurrentDefaultProfile, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<local:SettingContainer x:Uid="Globals_DefaultProfile"
Margin="0">
<ComboBox x:Name="DefaultProfile"
ItemsSource="{x:Bind State.Settings.AllProfiles, Mode=OneWay}"
SelectedItem="{x:Bind CurrentDefaultProfile, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="SettingsModel:Profile">
<Grid HorizontalAlignment="Stretch" ColumnSpacing="8">
@ -66,42 +65,38 @@ the MIT License. See LICENSE in the project root for license information. -->
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</ContentPresenter>
</local:SettingContainer>
<!--Start on User Login-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_StartOnUserLogin"
IsOn="{x:Bind State.Settings.GlobalSettings.StartOnUserLogin, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_StartOnUserLogin">
<ToggleSwitch IsOn="{x:Bind State.Settings.GlobalSettings.StartOnUserLogin, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Launch Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Globals_LaunchMode"
SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}"
ItemsSource="{x:Bind LaunchModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_LaunchMode">
<muxc:RadioButtons SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}"
ItemsSource="{x:Bind LaunchModeList}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</local:SettingContainer>
</StackPanel>
<!--Launch Size-->
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!--Header-->
<TextBlock x:Uid="Globals_LaunchSize"
Style="{StaticResource SubtitleTextBlockStyle}"/>
Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Columns-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<muxc:NumberBox x:Uid="Globals_InitialCols"
Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_InitialCols"
Margin="0">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialCols, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
</local:SettingContainer>
<!--Rows-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:NumberBox x:Uid="Globals_InitialRows"
Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_InitialRows">
<muxc:NumberBox Value="{x:Bind State.Settings.GlobalSettings.InitialRows, Mode=TwoWay}"
Style="{StaticResource LaunchSizeNumberBoxStyle}"/>
</local:SettingContainer>
</StackPanel>
</StackPanel>
</ScrollViewer>

View file

@ -89,6 +89,9 @@
<ClInclude Include="Rendering.h">
<DependentUpon>Rendering.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="SettingContainer.h">
<DependentUpon>SettingContainer.idl</DependentUpon>
</ClInclude>
<ClInclude Include="Utils.h" />
</ItemGroup>
<!-- ========================= XAML files ======================== -->
@ -117,6 +120,9 @@
<Page Include="Rendering.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="SettingContainerStyle.xaml">
<Type>DefaultStyle</Type>
</Page>
</ItemGroup>
<!-- ========================= Cpp Files ======================== -->
<ItemGroup>
@ -174,6 +180,9 @@
<ClCompile Include="Rendering.cpp">
<DependentUpon>Rendering.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="SettingContainer.cpp">
<DependentUpon>SettingContainer.idl</DependentUpon>
</ClCompile>
<ClCompile Include="Utils.cpp" />
</ItemGroup>
<!-- ========================= idl Files ======================== -->
@ -207,6 +216,9 @@
<DependentUpon>Profiles.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="SettingContainer.idl">
<SubType>Code</SubType>
</Midl>
</ItemGroup>
<!-- ========================= Misc Files ======================== -->
<ItemGroup>

View file

@ -11,6 +11,7 @@
using namespace winrt::Windows::UI::Text;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Controls;
using namespace winrt::Windows::UI::Xaml::Data;
using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::Foundation::Collections;
@ -39,19 +40,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// box, prevent it from ever being changed again.
//
// We do the same for the starting directory path
PropertyChanged([this](auto&&, const Data::PropertyChangedEventArgs& args) {
if (args.PropertyName() == L"BackgroundImagePath")
PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
const auto viewModelProperty{ args.PropertyName() };
if (viewModelProperty == L"BackgroundImagePath")
{
_NotifyChanges(L"UseDesktopBGImage", L"BackgroundImageSettingsVisible");
}
else if (args.PropertyName() == L"IsBaseLayer")
else if (viewModelProperty == L"IsBaseLayer")
{
_NotifyChanges(L"BackgroundImageSettingsVisible");
}
else if (args.PropertyName() == L"StartingDirectory")
else if (viewModelProperty == L"StartingDirectory")
{
_NotifyChanges(L"UseParentProcessDirectory");
_NotifyChanges(L"UseCustomStartingDirectory");
_NotifyChanges(L"UseParentProcessDirectory", L"UseCustomStartingDirectory");
}
});
@ -114,7 +115,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
BackgroundImagePath(L"desktopWallpaper");
}
else
else if (HasBackgroundImagePath())
{
// Restore the path we had previously cached. This might be the
// empty string.
@ -151,7 +152,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
StartingDirectory(L"");
}
else
else if (HasStartingDirectory())
{
// Restore the path we had previously cached as long as it wasn't empty
// If it was empty, set the starting directory to %USERPROFILE%
@ -207,8 +208,20 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_BIAlignmentButtons.at(7) = BIAlign_Bottom();
_BIAlignmentButtons.at(8) = BIAlign_BottomRight();
Profile_Padding().Text(RS_(L"Profile_Padding/Header"));
ToolTipService::SetToolTip(Padding_Presenter(), box_value(RS_(L"Profile_Padding/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip")));
// apply automation properties to more complex setting controls
for (const auto& biButton : _BIAlignmentButtons)
{
const auto tooltip{ ToolTipService::GetToolTip(biButton) };
Automation::AutomationProperties::SetName(biButton, unbox_value<hstring>(tooltip));
}
const auto startingDirCheckboxTooltip{ ToolTipService::GetToolTip(StartingDirectoryUseParentCheckbox()) };
Automation::AutomationProperties::SetFullDescription(StartingDirectoryUseParentCheckbox(), unbox_value<hstring>(startingDirCheckboxTooltip));
const auto backgroundImgCheckboxTooltip{ ToolTipService::GetToolTip(UseDesktopImageCheckBox()) };
Automation::AutomationProperties::SetFullDescription(UseDesktopImageCheckBox(), unbox_value<hstring>(backgroundImgCheckboxTooltip));
Automation::AutomationProperties::SetName(DeleteButton(), RS_(L"Profile_DeleteButton/Text"));
}
void Profiles::OnNavigatedTo(const NavigationEventArgs& e)
@ -248,10 +261,60 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
StartingDirectoryUseParentCheckbox().IsChecked(true);
}
// Subscribe to some changes in the view model
// These changes should force us to update our own set of "Current<Setting>" members,
// and propagate those changes to the UI
_ViewModelChangedRevoker = _State.Profile().PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) {
const auto settingName{ args.PropertyName() };
if (settingName == L"CursorShape")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentCursorShape" });
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"IsVintageCursor" });
}
else if (settingName == L"BackgroundImageStretchMode")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentBackgroundImageStretchMode" });
}
else if (settingName == L"AntialiasingMode")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentAntiAliasingMode" });
}
else if (settingName == L"CloseOnExit")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentCloseOnExitMode" });
}
else if (settingName == L"BellStyle")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentBellStyle" });
}
else if (settingName == L"ScrollState")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentScrollState" });
}
else if (settingName == L"FontWeight")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentFontWeight" });
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"IsCustomFontWeight" });
}
else if (settingName == L"ColorSchemeName")
{
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentColorScheme" });
}
else if (settingName == L"BackgroundImageAlignment")
{
_UpdateBIAlignmentControl(static_cast<int32_t>(_State.Profile().BackgroundImageAlignment()));
}
});
// Navigate to the pivot in the provided navigation state
ProfilesPivot().SelectedIndex(static_cast<int>(_State.LastActivePivot()));
}
void Profiles::OnNavigatedFrom(const NavigationEventArgs& /*e*/)
{
_ViewModelChangedRevoker.revoke();
}
ColorScheme Profiles::CurrentColorScheme()
{
const auto schemeName{ _State.Profile().ColorSchemeName() };
@ -374,7 +437,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// So the TwoWay binding doesn't update on the State --> Slider direction
FontWeightSlider().Value(weight);
}
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"IsCustomFontWeight" });
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"IsCustomFontWeight" });
}
}
@ -388,25 +451,30 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles::BIAlignment_Click(IInspectable const& sender, RoutedEventArgs const& /*e*/)
{
if (const auto& button{ sender.try_as<Windows::UI::Xaml::Controls::Primitives::ToggleButton>() })
if (const auto& button{ sender.try_as<Primitives::ToggleButton>() })
{
if (const auto& tag{ button.Tag().try_as<int32_t>() })
{
// Update the Profile's value
// Update the Profile's value and the control
_State.Profile().BackgroundImageAlignment(static_cast<ConvergedAlignment>(*tag));
// reset all of the buttons to unchecked, except for the one that was clicked
for (const auto& biButton : _BIAlignmentButtons)
{
biButton.IsChecked(biButton == button);
}
_UpdateBIAlignmentControl(*tag);
}
}
}
void Profiles::CursorShape_Changed(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
// Method Description:
// - Resets all of the buttons to unchecked, and checks the one with the provided tag
// Arguments:
// - val - the background image alignment (ConvergedAlignment) that we want to represent in the control
void Profiles::_UpdateBIAlignmentControl(const int32_t val)
{
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"IsVintageCursor" });
for (const auto& biButton : _BIAlignmentButtons)
{
if (const auto& biButtonAlignment{ biButton.Tag().try_as<int32_t>() })
{
biButton.IsChecked(biButtonAlignment == val);
}
}
}
bool Profiles::IsVintageCursor() const
@ -415,7 +483,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
void Profiles::Pivot_SelectionChanged(Windows::Foundation::IInspectable const& /*sender*/,
Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
RoutedEventArgs const& /*e*/)
{
_State.LastActivePivot(static_cast<Editor::ProfilesPivots>(ProfilesPivot().SelectedIndex()));
}

View file

@ -130,6 +130,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Profiles();
void OnNavigatedTo(const Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
void OnNavigatedFrom(const Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
Model::ColorScheme CurrentColorScheme();
void CurrentColorScheme(const Model::ColorScheme& val);
@ -140,12 +141,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
fire_and_forget Icon_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void BIAlignment_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void DeleteConfirmation_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void UseParentProcessDirectory_Check(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void UseParentProcessDirectory_Uncheck(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void Pivot_SelectionChanged(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
// CursorShape visibility logic
void CursorShape_Changed(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
bool IsVintageCursor() const;
// manually bind FontWeight
@ -166,9 +164,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
GETSET_BINDABLE_ENUM_SETTING(ScrollState, Microsoft::Terminal::TerminalControl::ScrollbarState, State().Profile, ScrollState);
private:
void _UpdateBIAlignmentControl(const int32_t val);
Windows::Foundation::Collections::IMap<uint16_t, Microsoft::Terminal::Settings::Editor::EnumEntry> _FontWeightMap;
Editor::EnumEntry _CustomFontWeight{ nullptr };
std::array<Windows::UI::Xaml::Controls::Primitives::ToggleButton, 9> _BIAlignmentButtons;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _ViewModelChangedRevoker;
};
};

View file

@ -59,140 +59,143 @@ the MIT License. See LICENSE in the project root for license information. -->
<PivotItem x:Uid="Profile_General">
<ScrollViewer>
<StackPanel Style="{StaticResource PivotStackStyle}">
<!--Name-->
<ContentPresenter Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
Style="{StaticResource SettingContainerStyle}"
Margin="0,0,0,24">
<TextBox x:Uid="Profile_Name"
Text="{x:Bind State.Profile.Name, Mode=TwoWay}"
<!--NOTE: Has/Clear is not bound because we don't want the reset button & override text to appear.
Additionally, the JSON stubs generated by auto-generated profiles come with a name,
so the name will always be overridden.-->
<local:SettingContainer x:Uid="Profile_Name"
Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
Margin="0,0,0,24">
<TextBox Text="{x:Bind State.Profile.Name, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Commandline-->
<ContentPresenter Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
Style="{StaticResource SettingContainerStyle}"
Margin="0,0,0,24">
<local:SettingContainer x:Uid="Profile_Commandline"
x:Name="CommandlineContainer"
HasSettingValue="{x:Bind State.Profile.HasCommandline, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearCommandline}"
Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
Margin="0,0,0,24">
<StackPanel Orientation="Horizontal">
<TextBox x:Uid="Profile_Commandline"
x:Name="Commandline"
Text="{x:Bind State.Profile.Commandline, Mode=TwoWay}"
<TextBox Text="{x:Bind State.Profile.Commandline, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
<Button x:Uid="Profile_CommandlineBrowse"
Click="Commandline_Click"
Style="{StaticResource BrowseButtonStyle}"/>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
<!--Starting Directory-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<local:SettingContainer x:Uid="Profile_StartingDirectory"
x:Name="StartingDirectoryContainer"
HasSettingValue="{x:Bind State.Profile.HasStartingDirectory, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearStartingDirectory}"
Margin="0">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBox x:Uid="Profile_StartingDirectory"
x:Name="StartingDirectory"
Text="{x:Bind State.Profile.StartingDirectory, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"
IsEnabled="{x:Bind State.Profile.UseCustomStartingDirectory, Mode=OneWay}"/>
<TextBox Text="{x:Bind State.Profile.StartingDirectory, Mode=TwoWay}"
IsEnabled="{x:Bind State.Profile.UseCustomStartingDirectory, Mode=OneWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
<Button x:Uid="Profile_StartingDirectoryBrowse"
x:Name="StartingDirectoryBrowse"
Click="StartingDirectory_Click"
IsEnabled="{x:Bind State.Profile.UseCustomStartingDirectory, Mode=OneWay}"
Style="{StaticResource BrowseButtonStyle}"/>
x:Name="StartingDirectoryBrowse"
Click="StartingDirectory_Click"
IsEnabled="{x:Bind State.Profile.UseCustomStartingDirectory, Mode=OneWay}"
Style="{StaticResource BrowseButtonStyle}"/>
</StackPanel>
<CheckBox x:Uid="Profile_StartingDirectoryUseParentCheckbox"
x:Name="StartingDirectoryUseParentCheckbox"
IsChecked="{x:Bind State.Profile.UseParentProcessDirectory, Mode=TwoWay}"/>
x:Name="StartingDirectoryUseParentCheckbox"
IsChecked="{x:Bind State.Profile.UseParentProcessDirectory, Mode=TwoWay}"/>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
<!--Icon-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<local:SettingContainer x:Uid="Profile_Icon"
HasSettingValue="{x:Bind State.Profile.HasIcon, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearIcon}">
<StackPanel Orientation="Horizontal">
<TextBox x:Uid="Profile_Icon"
x:Name="Icon"
Text="{x:Bind State.Profile.Icon, Mode=TwoWay}"
<TextBox Text="{x:Bind State.Profile.Icon, Mode=TwoWay}"
FontFamily="Segoe UI, Segoe MDL2 Assets"
Style="{StaticResource TextBoxSettingStyle}"/>
<Button x:Uid="Profile_IconBrowse"
Click="Icon_Click"
Style="{StaticResource BrowseButtonStyle}"/>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
<!--Tab Title-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<TextBox x:Uid="Profile_TabTitle"
Text="{x:Bind State.Profile.TabTitle, Mode=TwoWay}"
<local:SettingContainer x:Uid="Profile_TabTitle"
HasSettingValue="{x:Bind State.Profile.HasTabTitle, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearTabTitle}">
<TextBox Text="{x:Bind State.Profile.TabTitle, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Hidden-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
<ToggleSwitch x:Uid="Profile_Hidden"
IsOn="{x:Bind State.Profile.Hidden, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_Hidden"
Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
<ToggleSwitch IsOn="{x:Bind State.Profile.Hidden, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Delete Button-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<StackPanel Visibility="{x:Bind State.Profile.IsBaseLayer, Mode=OneWay, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
<Button IsEnabled="{x:Bind State.Profile.CanDeleteProfile}"
<StackPanel Margin="{StaticResource StandardControlMargin}">
<Button x:Name="DeleteButton"
IsEnabled="{x:Bind State.Profile.CanDeleteProfile}"
Style="{StaticResource DeleteButtonStyle}">
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonForeground" Color="{ThemeResource SystemColorButtonTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemColorHighlightTextColor}"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE74D;"
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonBackground" Color="Firebrick"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#C23232"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#A21212"/>
<SolidColorBrush x:Key="ButtonForeground" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="White"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="White"/>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/>
<SolidColorBrush x:Key="ButtonForeground" Color="{ThemeResource SystemColorButtonTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/>
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemColorHighlightTextColor}"/>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE74D;"
FontSize="{StaticResource StandardIconSize}"/>
<TextBlock x:Uid="Profile_DeleteButton"
<TextBlock x:Uid="Profile_DeleteButton"
Margin="10,0,0,0"/>
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Profile_DeleteConfirmationMessage"
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Profile_DeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}"/>
<Button x:Uid="Profile_DeleteConfirmationButton"
<Button x:Uid="Profile_DeleteConfirmationButton"
Click="DeleteConfirmation_Click"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<TextBlock x:Name="DeleteButtonDisclaimer"
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<TextBlock x:Name="DeleteButtonDisclaimer"
Style="{StaticResource DisclaimerStyle}"
VerticalAlignment="Center"/>
</StackPanel>
</ContentPresenter>
</StackPanel>
</StackPanel>
</ScrollViewer>
</PivotItem>
@ -206,77 +209,83 @@ the MIT License. See LICENSE in the project root for license information. -->
<TextBlock x:Uid="Profile_TextHeader" Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Color Scheme-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<ComboBox x:Uid="Profile_ColorScheme"
ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentColorScheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<local:SettingContainer x:Uid="Profile_ColorScheme"
HasSettingValue="{x:Bind State.Profile.HasColorSchemeName, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearColorSchemeName}"
Margin="0">
<ComboBox ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentColorScheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:ColorScheme">
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</ContentPresenter>
</local:SettingContainer>
<!--Font Face-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<TextBox x:Uid="Profile_FontFace"
Text="{x:Bind State.Profile.FontFace, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_FontFace"
HasSettingValue="{x:Bind State.Profile.HasFontFace, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearFontFace}">
<TextBox Text="{x:Bind State.Profile.FontFace, Mode=TwoWay}"
Style="{StaticResource TextBoxSettingStyle}"/>
</local:SettingContainer>
<!--Font Size-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:NumberBox x:Uid="Profile_FontSize"
Value="{x:Bind State.Profile.FontSize, Mode=TwoWay}"
Style="{StaticResource NumberBoxSettingStyle}"
AcceptsExpression="False"
Minimum="1"
Maximum="128"
SmallChange="1"
LargeChange="10"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_FontSize"
HasSettingValue="{x:Bind State.Profile.HasFontSize, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearFontSize}">
<muxc:NumberBox Value="{x:Bind State.Profile.FontSize, Mode=TwoWay}"
Style="{StaticResource NumberBoxSettingStyle}"
AcceptsExpression="False"
Minimum="1"
Maximum="128"
SmallChange="1"
LargeChange="10"/>
</local:SettingContainer>
<!--Font Weight-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<local:SettingContainer x:Uid="Profile_FontWeight"
x:Name="FontWeightContainer"
HasSettingValue="{x:Bind State.Profile.HasFontWeight, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearFontWeight}">
<StackPanel>
<ComboBox x:Uid="Profile_FontWeight"
x:Name="FontWeightComboBox"
ItemsSource="{x:Bind FontWeightList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentFontWeight, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumComboBoxItemTemplate}"
Style="{StaticResource ComboBoxSettingStyle}"/>
<ComboBox x:Name="FontWeightComboBox"
ItemsSource="{x:Bind FontWeightList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentFontWeight, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumComboBoxItemTemplate}"
Style="{StaticResource ComboBoxSettingStyle}"/>
<!--Custom Font Weight Control-->
<Grid Margin="0,10,0,0"
Visibility="{x:Bind IsCustomFontWeight, Mode=OneWay}"
Style="{StaticResource CustomSliderControlGridStyle}">
Visibility="{x:Bind IsCustomFontWeight, Mode=OneWay}"
Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="FontWeightSlider"
Grid.Column="0"
Minimum="0" Maximum="1000"
TickFrequency="50" TickPlacement="Outside"
Value="{x:Bind State.Profile.FontWeight,
Converter={StaticResource FontWeightConverter},
Mode=TwoWay}"/>
Grid.Column="0"
Minimum="0" Maximum="1000"
TickFrequency="50" TickPlacement="Outside"
Value="{x:Bind State.Profile.FontWeight,
Converter={StaticResource FontWeightConverter},
Mode=TwoWay}"/>
<TextBlock Grid.Column="1"
Text="{Binding ElementName=FontWeightSlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"
Margin="10,0,0,0"/>
Text="{Binding ElementName=FontWeightSlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"
Margin="10,0,0,0"/>
</Grid>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
<!--Retro Terminal Effect-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Profile_RetroTerminalEffect"
IsOn="{x:Bind State.Profile.RetroTerminalEffect, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_RetroTerminalEffect"
HasSettingValue="{x:Bind State.Profile.HasRetroTerminalEffect, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearRetroTerminalEffect}">
<ToggleSwitch IsOn="{x:Bind State.Profile.RetroTerminalEffect, Mode=TwoWay}"/>
</local:SettingContainer>
</StackPanel>
<!--Grouping: Cursor-->
@ -284,24 +293,25 @@ the MIT License. See LICENSE in the project root for license information. -->
<TextBlock x:Uid="Profile_CursorHeader" Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Cursor Shape-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<muxc:RadioButtons x:Uid="Profile_CursorShape"
ItemsSource="{x:Bind CursorShapeList, Mode=OneWay}"
<local:SettingContainer x:Uid="Profile_CursorShape"
HasSettingValue="{x:Bind State.Profile.HasCursorShape, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearCursorShape}"
Margin="0">
<muxc:RadioButtons ItemsSource="{x:Bind CursorShapeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCursorShape, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
SelectionChanged="CursorShape_Changed"/>
</ContentPresenter>
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</local:SettingContainer>
<!--Cursor Height-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind IsVintageCursor, Mode=OneWay}">
<muxc:NumberBox x:Uid="Profile_CursorHeight"
Value="{x:Bind State.Profile.CursorHeight, Mode=TwoWay}"
<local:SettingContainer x:Uid="Profile_CursorHeight"
HasSettingValue="{x:Bind State.Profile.HasCursorHeight, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearCursorHeight}"
Visibility="{x:Bind IsVintageCursor, Mode=OneWay}">
<muxc:NumberBox Value="{x:Bind State.Profile.CursorHeight, Mode=TwoWay}"
Style="{StaticResource NumberBoxSettingStyle}"
SmallChange="1"
LargeChange="10"/>
</ContentPresenter>
</local:SettingContainer>
</StackPanel>
<!--Grouping: Background-->
@ -309,212 +319,210 @@ the MIT License. See LICENSE in the project root for license information. -->
<TextBlock x:Uid="Profile_BackgroundHeader" Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Background Image-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<local:SettingContainer x:Uid="Profile_BackgroundImage"
x:Name="BackgroundImageContainer"
HasSettingValue="{x:Bind State.Profile.HasBackgroundImagePath, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearBackgroundImagePath}"
Margin="0">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBox x:Uid="Profile_BackgroundImage"
x:Name="BackgroundImage"
Text="{x:Bind State.Profile.BackgroundImagePath, Mode=TwoWay, Converter={StaticResource DesktopWallpaperToEmptyStringConverter}}"
IsEnabled="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsNotDesktopConverter}}"
Style="{StaticResource TextBoxSettingStyle}"/>
<TextBox Text="{x:Bind State.Profile.BackgroundImagePath, Mode=TwoWay, Converter={StaticResource DesktopWallpaperToEmptyStringConverter}}"
IsEnabled="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsNotDesktopConverter}}"
Style="{StaticResource TextBoxSettingStyle}"/>
<Button x:Uid="Profile_BackgroundImageBrowse"
Click="BackgroundImage_Click"
IsEnabled="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsNotDesktopConverter}}"
Style="{StaticResource BrowseButtonStyle}"/>
Click="BackgroundImage_Click"
IsEnabled="{x:Bind State.Profile.BackgroundImagePath, Mode=OneWay, Converter={StaticResource StringIsNotDesktopConverter}}"
Style="{StaticResource BrowseButtonStyle}"/>
</StackPanel>
<CheckBox x:Uid="Profile_UseDesktopImage"
x:Name="UseDesktopImageCheckBox"
IsChecked="{x:Bind State.Profile.UseDesktopBGImage, Mode=TwoWay}"/>
x:Name="UseDesktopImageCheckBox"
IsChecked="{x:Bind State.Profile.UseDesktopBGImage, Mode=TwoWay}"/>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
<!--Background Image Stretch Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<muxc:RadioButtons x:Uid="Profile_BackgroundImageStretchMode"
ItemsSource="{x:Bind BackgroundImageStretchModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBackgroundImageStretchMode, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_BackgroundImageStretchMode"
HasSettingValue="{x:Bind State.Profile.HasBackgroundImageStretchMode, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearBackgroundImageStretchMode}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<muxc:RadioButtons ItemsSource="{x:Bind BackgroundImageStretchModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBackgroundImageStretchMode, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</local:SettingContainer>
<!--Background Image Alignment-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<StackPanel HorizontalAlignment="Left">
<TextBlock x:Uid="Profile_BackgroundImageAlignment"
Style="{StaticResource CustomSettingHeaderStyle}"
ToolTipService.Placement="Mouse"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<local:SettingContainer x:Uid="Profile_BackgroundImageAlignment"
HasSettingValue="{x:Bind State.Profile.HasBackgroundImageAlignment, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearBackgroundImageAlignment}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<Grid HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="ToggleButton" BasedOn="{StaticResource DefaultToggleButtonStyle}">
<Setter Property="Margin" Value="2"/>
<Setter Property="Width" Value="40"/>
<Setter Property="Height" Value="40"/>
<Setter Property="ToolTipService.Placement" Value="Mouse"/>
</Style>
</Grid.Resources>
<Grid.Resources>
<Style TargetType="ToggleButton" BasedOn="{StaticResource DefaultToggleButtonStyle}">
<Setter Property="Margin" Value="2"/>
<Setter Property="Width" Value="40"/>
<Setter Property="Height" Value="40"/>
<Setter Property="ToolTipService.Placement" Value="Mouse"/>
</Style>
</Grid.Resources>
<!--Top Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTopLeft"
<!--Top Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTopLeft"
x:Name="BIAlign_TopLeft"
Grid.Row="0" Grid.Column="0"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Left (0x01)-->
<x:Int32>17</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE744;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="90"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTop"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Left (0x01)-->
<x:Int32>17</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE744;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="90"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTop"
x:Name="BIAlign_Top"
Grid.Row="0" Grid.Column="1"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Center (0x00)-->
<x:Int32>16</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE745;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="180"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTopRight"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Center (0x00)-->
<x:Int32>16</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE745;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="180"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentTopRight"
x:Name="BIAlign_TopRight"
Grid.Row="0" Grid.Column="2"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Right (0x02)-->
<x:Int32>18</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA5F;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="270"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x10) | Horizontal_Right (0x02)-->
<x:Int32>18</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA5F;" RenderTransformOrigin="0.5,0.5">
<FontIcon.RenderTransform>
<RotateTransform Angle="270"/>
</FontIcon.RenderTransform>
</FontIcon>
</ToggleButton.Content>
</ToggleButton>
<!--Middle Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentLeft"
<!--Middle Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentLeft"
x:Name="BIAlign_Left"
Grid.Row="1" Grid.Column="0"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Left (0x01)-->
<x:Int32>1</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE746;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentCenter"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Left (0x01)-->
<x:Int32>1</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE746;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentCenter"
x:Name="BIAlign_Center"
Grid.Row="1" Grid.Column="1"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Center (0x00)-->
<x:Int32>0</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xF16E;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentRight"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Center (0x00)-->
<x:Int32>0</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xF16E;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentRight"
x:Name="BIAlign_Right"
Grid.Row="1" Grid.Column="2"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Right (0x02)-->
<x:Int32>2</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA61;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Center (0x00) | Horizontal_Right (0x02)-->
<x:Int32>2</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA61;"/>
</ToggleButton.Content>
</ToggleButton>
<!--Bottom Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottomLeft"
<!--Bottom Row-->
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottomLeft"
x:Name="BIAlign_BottomLeft"
Grid.Row="2" Grid.Column="0"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Bottom (0x20) | Horizontal_Left (0x01)-->
<x:Int32>33</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE744;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottom"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Bottom (0x20) | Horizontal_Left (0x01)-->
<x:Int32>33</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE744;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottom"
x:Name="BIAlign_Bottom"
Grid.Row="2" Grid.Column="1"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Bottom (0x20) | Horizontal_Center (0x00)-->
<x:Int32>32</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE745;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottomRight"
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Bottom (0x20) | Horizontal_Center (0x00)-->
<x:Int32>32</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE745;"/>
</ToggleButton.Content>
</ToggleButton>
<ToggleButton x:Uid="Profile_BackgroundImageAlignmentBottomRight"
x:Name="BIAlign_BottomRight"
Grid.Row="2" Grid.Column="2"
Click="BIAlignment_Click">
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x20) | Horizontal_Right (0x02)-->
<x:Int32>34</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA5F;"/>
</ToggleButton.Content>
</ToggleButton>
</Grid>
</StackPanel>
</ContentPresenter>
<ToggleButton.Tag>
<!--ConvergedAlignment: Vertical_Top (0x20) | Horizontal_Right (0x02)-->
<x:Int32>34</x:Int32>
</ToggleButton.Tag>
<ToggleButton.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xEA5F;"/>
</ToggleButton.Content>
</ToggleButton>
</Grid>
</local:SettingContainer>
<!--Background Image Opacity-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<StackPanel>
<TextBlock x:Uid="Profile_BackgroundImageOpacity"
Style="{StaticResource SliderHeaderStyle}"/>
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="BIOpacitySlider"
<local:SettingContainer x:Uid="Profile_BackgroundImageOpacity"
x:Name="BackgroundImageOpacityContainer"
HasSettingValue="{x:Bind State.Profile.HasBackgroundImageOpacity, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearBackgroundImageOpacity}"
Visibility="{x:Bind State.Profile.BackgroundImageSettingsVisible, Mode=OneWay}">
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="BIOpacitySlider"
Grid.Column="0"
Value="{x:Bind State.Profile.BackgroundImageOpacity, Converter={StaticResource PercentageConverter}, Mode=TwoWay}"/>
<TextBlock Grid.Column="1"
<TextBlock Grid.Column="1"
Text="{Binding ElementName=BIOpacitySlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"/>
</Grid>
</StackPanel>
</ContentPresenter>
</Grid>
</local:SettingContainer>
</StackPanel>
<!--Grouping: Acrylic-->
@ -522,33 +530,35 @@ the MIT License. See LICENSE in the project root for license information. -->
<TextBlock x:Uid="Profile_AcrylicHeader" Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Use Acrylic-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<ToggleSwitch x:Uid="Profile_UseAcrylic"
x:Name="UseAcrylicToggleSwitch"
<local:SettingContainer x:Uid="Profile_UseAcrylic"
HasSettingValue="{x:Bind State.Profile.HasUseAcrylic, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearUseAcrylic}"
Margin="0">
<ToggleSwitch x:Name="UseAcrylicToggleSwitch"
IsOn="{x:Bind State.Profile.UseAcrylic, Mode=TwoWay}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Acrylic Opacity-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Visibility="{Binding ElementName=UseAcrylicToggleSwitch, Path=IsOn, Mode=OneWay}">
<local:SettingContainer x:Uid="Profile_AcrylicOpacity"
x:Name="AcrylicOpacityContainer"
HasSettingValue="{x:Bind State.Profile.HasAcrylicOpacity, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearAcrylicOpacity}"
Visibility="{Binding ElementName=UseAcrylicToggleSwitch, Path=IsOn, Mode=OneWay}">
<StackPanel x:Name="AcrylicOpacityControl">
<TextBlock x:Uid="Profile_AcrylicOpacity"
Style="{StaticResource SliderHeaderStyle}"/>
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="AcrylicOpacitySlider"
Grid.Column="0"
Value="{x:Bind State.Profile.AcrylicOpacity, Converter={StaticResource PercentageConverter}, Mode=TwoWay}"/>
Grid.Column="0"
Value="{x:Bind State.Profile.AcrylicOpacity, Converter={StaticResource PercentageConverter}, Mode=TwoWay}"/>
<TextBlock Grid.Column="1"
Text="{Binding ElementName=AcrylicOpacitySlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"/>
Text="{Binding ElementName=AcrylicOpacitySlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"/>
</Grid>
</StackPanel>
</ContentPresenter>
</local:SettingContainer>
</StackPanel>
<!--Grouping: Window-->
@ -556,34 +566,32 @@ the MIT License. See LICENSE in the project root for license information. -->
<TextBlock x:Uid="Profile_WindowHeader" Style="{StaticResource SubtitleTextBlockStyle}"/>
<!--Padding-->
<ContentPresenter x:Name="Padding_Presenter"
Style="{StaticResource SettingContainerStyle}"
Margin="0">
<StackPanel x:Name="PaddingControl">
<TextBlock x:Name="Profile_Padding"
Style="{StaticResource SliderHeaderStyle}"/>
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="PaddingSlider"
<local:SettingContainer x:Uid="Profile_Padding"
HasSettingValue="{x:Bind State.Profile.HasPadding, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearPadding}"
Margin="0">
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Slider x:Name="PaddingSlider"
Grid.Column="0"
Value="{x:Bind State.Profile.Padding, Converter={StaticResource PaddingConverter}, Mode=TwoWay}"/>
<TextBlock Grid.Column="1"
<TextBlock Grid.Column="1"
Text="{Binding ElementName=PaddingSlider, Path=Value, Mode=OneWay}"
Style="{StaticResource SliderValueLabelStyle}"/>
</Grid>
</StackPanel>
</ContentPresenter>
</Grid>
</local:SettingContainer>
<!--Scrollbar Visibility-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Profile_ScrollbarVisibility"
ItemsSource="{x:Bind ScrollStateList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentScrollState, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_ScrollbarVisibility"
HasSettingValue="{x:Bind State.Profile.HasScrollState, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearScrollState}">
<muxc:RadioButtons ItemsSource="{x:Bind ScrollStateList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentScrollState, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</local:SettingContainer>
</StackPanel>
</StackPanel>
</ScrollViewer>
@ -594,56 +602,63 @@ the MIT License. See LICENSE in the project root for license information. -->
<ScrollViewer>
<StackPanel Style="{StaticResource PivotStackStyle}">
<!--Suppress Application Title-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}"
Margin="0">
<ToggleSwitch x:Uid="Profile_SuppressApplicationTitle"
IsOn="{x:Bind State.Profile.SuppressApplicationTitle, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_SuppressApplicationTitle"
HasSettingValue="{x:Bind State.Profile.HasSuppressApplicationTitle, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearSuppressApplicationTitle}"
Margin="0">
<ToggleSwitch IsOn="{x:Bind State.Profile.SuppressApplicationTitle, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Antialiasing Mode-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Profile_AntialiasingMode"
ItemsSource="{x:Bind AntiAliasingModeList, Mode=OneWay}"
<local:SettingContainer x:Uid="Profile_AntialiasingMode"
HasSettingValue="{x:Bind State.Profile.HasAntialiasingMode, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearAntialiasingMode}">
<muxc:RadioButtons ItemsSource="{x:Bind AntiAliasingModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentAntiAliasingMode, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
<!--AltGr Aliasing-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Profile_AltGrAliasing"
IsOn="{x:Bind State.Profile.AltGrAliasing, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_AltGrAliasing"
HasSettingValue="{x:Bind State.Profile.HasAltGrAliasing, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearAltGrAliasing}">
<ToggleSwitch IsOn="{x:Bind State.Profile.AltGrAliasing, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Snap On Input-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Profile_SnapOnInput"
IsOn="{x:Bind State.Profile.SnapOnInput, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Profile_SnapOnInput"
HasSettingValue="{x:Bind State.Profile.HasSnapOnInput, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearSnapOnInput}">
<ToggleSwitch IsOn="{x:Bind State.Profile.SnapOnInput, Mode=TwoWay}"/>
</local:SettingContainer>
<!--History Size-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:NumberBox x:Uid="Profile_HistorySize"
Value="{x:Bind State.Profile.HistorySize, Mode=TwoWay}"
<local:SettingContainer x:Uid="Profile_HistorySize"
HasSettingValue="{x:Bind State.Profile.HasHistorySize, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearHistorySize}">
<muxc:NumberBox Value="{x:Bind State.Profile.HistorySize, Mode=TwoWay}"
Style="{StaticResource NumberBoxSettingStyle}"
SmallChange="10"
LargeChange="100"/>
</ContentPresenter>
</local:SettingContainer>
<!--Close On Exit-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Profile_CloseOnExit"
ItemsSource="{x:Bind CloseOnExitModeList, Mode=OneWay}"
<local:SettingContainer x:Uid="Profile_CloseOnExit"
HasSettingValue="{x:Bind State.Profile.HasCloseOnExit, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearCloseOnExit}">
<muxc:RadioButtons ItemsSource="{x:Bind CloseOnExitModeList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentCloseOnExitMode, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
<!--Bell Style-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<muxc:RadioButtons x:Uid="Profile_BellStyle"
ItemsSource="{x:Bind BellStyleList, Mode=OneWay}"
<local:SettingContainer x:Uid="Profile_BellStyle"
HasSettingValue="{x:Bind State.Profile.HasBellStyle, Mode=OneWay}"
ClearSettingValue="{x:Bind State.Profile.ClearBellStyle}">
<muxc:RadioButtons ItemsSource="{x:Bind BellStyleList, Mode=OneWay}"
SelectedItem="{x:Bind CurrentBellStyle, Mode=TwoWay}"
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"/>
</ContentPresenter>
</local:SettingContainer>
</StackPanel>
</ScrollViewer>
</PivotItem>

View file

@ -4,6 +4,7 @@ the MIT License. See LICENSE in the project root for license information. -->
x:Class="Microsoft.Terminal.Settings.Editor.Rendering"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@ -22,16 +23,14 @@ the MIT License. See LICENSE in the project root for license information. -->
Style="{StaticResource DisclaimerStyle}"/>
<!--Force Full Repaint-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_ForceFullRepaint"
IsOn="{x:Bind State.Globals.ForceFullRepaintRendering, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_ForceFullRepaint">
<ToggleSwitch IsOn="{x:Bind State.Globals.ForceFullRepaintRendering, Mode=TwoWay}"/>
</local:SettingContainer>
<!--Software Rendering-->
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
<ToggleSwitch x:Uid="Globals_SoftwareRendering"
IsOn="{x:Bind State.Globals.SoftwareRendering, Mode=TwoWay}"/>
</ContentPresenter>
<local:SettingContainer x:Uid="Globals_SoftwareRendering">
<ToggleSwitch IsOn="{x:Bind State.Globals.SoftwareRendering, Mode=TwoWay}"/>
</local:SettingContainer>
</StackPanel>
</ScrollViewer>
</Page>

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@ -180,13 +180,13 @@
<data name="Globals_AlwaysShowTabs.Header" xml:space="preserve">
<value>Always show tabs</value>
</data>
<data name="Globals_AlwaysShowTabs.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_AlwaysShowTabs.HelpText" xml:space="preserve">
<value>When unchecked, the tab bar will appear when a new tab is created.</value>
</data>
<data name="Globals_CopyFormatting.Content" xml:space="preserve">
<value>Copy formatting</value>
</data>
<data name="Globals_CopyFormatting.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_CopyFormatting.HelpText" xml:space="preserve">
<value>When checked, the color and font formatting of selected text is also copied to your clipboard. When unchecked, only plain text is copied to your clipboard.</value>
</data>
<data name="Globals_CopyOnSelect.Header" xml:space="preserve">
@ -195,31 +195,31 @@
<data name="Globals_DefaultProfile.Header" xml:space="preserve">
<value>Default profile</value>
</data>
<data name="Globals_DefaultProfile.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_DefaultProfile.HelpText" xml:space="preserve">
<value>Profile that opens when clicking the '+' icon or by typing the new tab key binding.</value>
</data>
<data name="Globals_ForceFullRepaint.Header" xml:space="preserve">
<value>Redraw entire screen when display updates</value>
</data>
<data name="Globals_ForceFullRepaint.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_ForceFullRepaint.HelpText" xml:space="preserve">
<value>When unchecked, the terminal will render only the updates to the screen between frames.</value>
</data>
<data name="Globals_InitialCols.Header" xml:space="preserve">
<value>Columns</value>
</data>
<data name="Globals_InitialCols.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_InitialCols.HelpText" xml:space="preserve">
<value>The number of columns displayed in the window upon first load. Measured in characters.</value>
</data>
<data name="Globals_InitialRows.Header" xml:space="preserve">
<value>Rows</value>
</data>
<data name="Globals_InitialRows.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_InitialRows.HelpText" xml:space="preserve">
<value>The number of rows displayed in the window upon first load. Measured in characters.</value>
</data>
<data name="Globals_LaunchMode.Header" xml:space="preserve">
<value>Launch mode</value>
</data>
<data name="Globals_LaunchMode.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_LaunchMode.HelpText" xml:space="preserve">
<value>How the terminal will appear on launch. Focus will hide the tabs and title bar.</value>
<comment>'Focus' must match &lt;Globals_LaunchModeFocus.Content&gt;.</comment>
</data>
@ -238,43 +238,43 @@
<data name="Globals_ShowTitlebar.Header" xml:space="preserve">
<value>Hide the title bar (requires relaunch)</value>
</data>
<data name="Globals_ShowTitlebar.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_ShowTitlebar.HelpText" xml:space="preserve">
<value>When unchecked, the title bar will appear above the tabs.</value>
</data>
<data name="Globals_ShowTitleInTitlebar.Header" xml:space="preserve">
<value>Use active terminal title as application title</value>
</data>
<data name="Globals_ShowTitleInTitlebar.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_ShowTitleInTitlebar.HelpText" xml:space="preserve">
<value>When unchecked, the title bar will be 'Windows Terminal'.</value>
</data>
<data name="Globals_SnapToGridOnResize.Header" xml:space="preserve">
<value>Snap window resizing to character grid</value>
</data>
<data name="Globals_SnapToGridOnResize.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_SnapToGridOnResize.HelpText" xml:space="preserve">
<value>When unchecked, the window will resize smoothly.</value>
</data>
<data name="Globals_SoftwareRendering.Header" xml:space="preserve">
<value>Use software rendering</value>
</data>
<data name="Globals_SoftwareRendering.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_SoftwareRendering.HelpText" xml:space="preserve">
<value>When checked, the terminal will use the software renderer (a.k.a. WARP) instead of the hardware one.</value>
</data>
<data name="Globals_StartOnUserLogin.Header" xml:space="preserve">
<value>Launch on machine startup</value>
</data>
<data name="Globals_StartOnUserLogin.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_StartOnUserLogin.HelpText" xml:space="preserve">
<value>When checked, this enables the launch of Windows Terminal at machine startup.</value>
</data>
<data name="Globals_AlwaysOnTop.Header" xml:space="preserve">
<value>Always on top</value>
</data>
<data name="Globals_AlwaysOnTop.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_AlwaysOnTop.HelpText" xml:space="preserve">
<value>Windows Terminal will always be the topmost window on the desktop.</value>
</data>
<data name="Globals_TabWidthMode.Header" xml:space="preserve">
<value>Tab width mode</value>
</data>
<data name="Globals_TabWidthMode.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_TabWidthMode.HelpText" xml:space="preserve">
<value>Compact will shrink unfocused tabs to the size of the icon.</value>
<comment>'Compact' must match the value for &lt;Globals_TabWidthModeCompact.Content&gt;.</comment>
</data>
@ -290,7 +290,7 @@
<data name="Globals_Theme.Header" xml:space="preserve">
<value>Theme</value>
</data>
<data name="Globals_Theme.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_Theme.HelpText" xml:space="preserve">
<value>Sets the theme of the application.</value>
</data>
<data name="Globals_ThemeDark.Content" xml:space="preserve">
@ -305,7 +305,7 @@
<data name="Globals_WordDelimiters.Header" xml:space="preserve">
<value>Word delimiters</value>
</data>
<data name="Globals_WordDelimiters.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_WordDelimiters.HelpText" xml:space="preserve">
<value>Symbols used to define boundaries between words.</value>
</data>
<data name="Nav_Appearance.Content" xml:space="preserve">
@ -329,10 +329,10 @@
<data name="Nav_Rendering.Content" xml:space="preserve">
<value>Rendering</value>
</data>
<data name="Profile_AcrylicOpacity.Text" xml:space="preserve">
<data name="Profile_AcrylicOpacity.Header" xml:space="preserve">
<value>Acrylic opacity</value>
</data>
<data name="Profile_AcrylicOpacity.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_AcrylicOpacity.HelpText" xml:space="preserve">
<value>Sets the transparency of the window.</value>
</data>
<data name="Profile_Advanced.Header" xml:space="preserve">
@ -341,13 +341,13 @@
<data name="Profile_AltGrAliasing.Header" xml:space="preserve">
<value>AltGr aliasing</value>
</data>
<data name="Profile_AltGrAliasing.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_AltGrAliasing.HelpText" xml:space="preserve">
<value>By default Windows treats Ctrl+Alt as an alias for AltGr. When unchecked, this behavior will be disabled.</value>
</data>
<data name="Profile_AntialiasingMode.Header" xml:space="preserve">
<value>Text antialiasing (requires relaunch)</value>
</data>
<data name="Profile_AntialiasingMode.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_AntialiasingMode.HelpText" xml:space="preserve">
<value>Controls how text is antialiased in the renderer.</value>
</data>
<data name="Profile_AntialiasingModeAliased.Content" xml:space="preserve">
@ -362,22 +362,16 @@
<data name="Profile_Appearance.Header" xml:space="preserve">
<value>Appearance</value>
</data>
<data name="Profile_BackgroundColor.Header" xml:space="preserve">
<value>Background color</value>
</data>
<data name="Profile_BackgroundColorToolTip.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Sets the background color of the text. Overrides the background from the color scheme.</value>
</data>
<data name="Profile_BackgroundImage.Header" xml:space="preserve">
<value>Background image path</value>
</data>
<data name="Profile_BackgroundImage.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_BackgroundImage.HelpText" xml:space="preserve">
<value>File location of the image used in the background of the window.</value>
</data>
<data name="Profile_BackgroundImageAlignment.Text" xml:space="preserve">
<data name="Profile_BackgroundImageAlignment.Header" xml:space="preserve">
<value>Background image alignment</value>
</data>
<data name="Profile_BackgroundImageAlignment.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_BackgroundImageAlignment.HelpText" xml:space="preserve">
<value>Sets how the background image aligns to the boundaries of the window.</value>
</data>
<data name="Profile_BackgroundImageAlignmentBottom.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
@ -419,16 +413,16 @@
<data name="Profile_BackgroundImageBrowse.Content" xml:space="preserve">
<value>Browse...</value>
</data>
<data name="Profile_BackgroundImageOpacity.Text" xml:space="preserve">
<data name="Profile_BackgroundImageOpacity.Header" xml:space="preserve">
<value>Background image opacity</value>
</data>
<data name="Profile_BackgroundImageOpacity.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_BackgroundImageOpacity.HelpText" xml:space="preserve">
<value>Sets the transparency of the background image.</value>
</data>
<data name="Profile_BackgroundImageStretchMode.Header" xml:space="preserve">
<value>Background image stretch mode</value>
</data>
<data name="Profile_BackgroundImageStretchMode.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_BackgroundImageStretchMode.HelpText" xml:space="preserve">
<value>Sets how the background image is resized to fill the window.</value>
</data>
<data name="Profile_BackgroundImageStretchModeFill.Content" xml:space="preserve">
@ -458,28 +452,22 @@
<data name="Profile_ColorScheme.Header" xml:space="preserve">
<value>Color scheme</value>
</data>
<data name="Profile_ColorScheme.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_ColorScheme.HelpText" xml:space="preserve">
<value>Name of the color scheme to use.</value>
</data>
<data name="Profile_Commandline.Header" xml:space="preserve">
<value>Command line</value>
</data>
<data name="Profile_Commandline.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_Commandline.HelpText" xml:space="preserve">
<value>Executable used in the profile.</value>
</data>
<data name="Profile_CommandlineBrowse.Content" xml:space="preserve">
<value>Browse...</value>
</data>
<data name="Profile_CursorColor.Header" xml:space="preserve">
<value>Cursor color</value>
</data>
<data name="Profile_CursorColorToolTip.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Sets the color of the cursor. Overrides the cursor color from the color scheme.</value>
</data>
<data name="Profile_CursorHeight.Header" xml:space="preserve">
<value>Cursor height</value>
</data>
<data name="Profile_CursorHeight.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_CursorHeight.HelpText" xml:space="preserve">
<value>Sets the percentage height of the cursor starting from the bottom. Only works with the vintage cursor shape.</value>
</data>
<data name="Profile_CursorShape.Header" xml:space="preserve">
@ -512,46 +500,40 @@
<data name="Profile_FontFace.Header" xml:space="preserve">
<value>Font face</value>
</data>
<data name="Profile_FontFace.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_FontFace.HelpText" xml:space="preserve">
<value>Name of the font face used in the profile.</value>
</data>
<data name="Profile_FontSize.Header" xml:space="preserve">
<value>Font size</value>
</data>
<data name="Profile_FontSize.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_FontSize.HelpText" xml:space="preserve">
<value>Size of the font in points.</value>
</data>
<data name="Profile_FontWeight.Header" xml:space="preserve">
<value>Font weight</value>
</data>
<data name="Profile_FontWeight.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_FontWeight.HelpText" xml:space="preserve">
<value>Sets the weight (lightness or heaviness of the strokes) for the given font.</value>
</data>
<data name="Profile_ForegroundColor.Header" xml:space="preserve">
<value>Foreground color</value>
</data>
<data name="Profile_ForegroundColorToolTip.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Sets the text color. Overrides the foreground from the color scheme.</value>
</data>
<data name="Profile_General.Header" xml:space="preserve">
<value>General</value>
</data>
<data name="Profile_Hidden.Header" xml:space="preserve">
<value>Hide profile from dropdown</value>
</data>
<data name="Profile_Hidden.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_Hidden.HelpText" xml:space="preserve">
<value>If checked, the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamically generated profiles, while leaving them in your settings file.</value>
</data>
<data name="Profile_HistorySize.Header" xml:space="preserve">
<value>History size</value>
</data>
<data name="Profile_HistorySize.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_HistorySize.HelpText" xml:space="preserve">
<value>The number of lines above the ones displayed in the window you can scroll back to.</value>
</data>
<data name="Profile_Icon.Header" xml:space="preserve">
<value>Icon</value>
</data>
<data name="Profile_Icon.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_Icon.HelpText" xml:space="preserve">
<value>Emoji or image file location of the icon used in the profile.</value>
</data>
<data name="Profile_IconBrowse.Content" xml:space="preserve">
@ -560,13 +542,13 @@
<data name="Profile_Padding.Header" xml:space="preserve">
<value>Padding</value>
</data>
<data name="Profile_Padding.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_Padding.HelpText" xml:space="preserve">
<value>Sets the padding around the text within the window.</value>
</data>
<data name="Profile_RetroTerminalEffect.Header" xml:space="preserve">
<value>Retro terminal effects</value>
</data>
<data name="Profile_RetroTerminalEffect.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_RetroTerminalEffect.HelpText" xml:space="preserve">
<value>When checked, enables retro terminal effects such as glowing text and scan lines.</value>
</data>
<data name="Profile_ScrollbarVisibility.Header" xml:space="preserve">
@ -578,19 +560,13 @@
<data name="Profile_ScrollbarVisibilityVisible.Content" xml:space="preserve">
<value>Visible</value>
</data>
<data name="Profile_SelectionBackgroundColor.Header" xml:space="preserve">
<value>Selection background color</value>
</data>
<data name="Profile_SelectionBackgroundColorToolTip.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Sets the background color of selected text. Overrides the selection background set in the color scheme.</value>
</data>
<data name="Profile_SnapOnInput.Header" xml:space="preserve">
<value>Scroll to input when typing</value>
</data>
<data name="Profile_StartingDirectory.Header" xml:space="preserve">
<value>Starting directory</value>
</data>
<data name="Profile_StartingDirectory.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_StartingDirectory.HelpText" xml:space="preserve">
<value>The directory the profile starts in when it is loaded.</value>
</data>
<data name="Profile_StartingDirectoryBrowse.Content" xml:space="preserve">
@ -605,19 +581,19 @@
<data name="Profile_SuppressApplicationTitle.Header" xml:space="preserve">
<value>Suppress title changes</value>
</data>
<data name="Profile_SuppressApplicationTitle.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_SuppressApplicationTitle.HelpText" xml:space="preserve">
<value>Use the tab title to override the default title of the tab and suppress any title change messages from the application.</value>
</data>
<data name="Profile_TabTitle.Header" xml:space="preserve">
<value>Tab title</value>
</data>
<data name="Profile_TabTitle.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_TabTitle.HelpText" xml:space="preserve">
<value>Replaces the profile name as the title to pass to the shell on startup.</value>
</data>
<data name="Profile_UseAcrylic.Header" xml:space="preserve">
<value>Enable acrylic</value>
</data>
<data name="Profile_UseAcrylic.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_UseAcrylic.HelpText" xml:space="preserve">
<value>Applies a translucent texture to the background of the window.</value>
</data>
<data name="Profile_UseDesktopImage.Content" xml:space="preserve">
@ -654,7 +630,7 @@
<data name="Profile_BellStyle.Header" xml:space="preserve">
<value>Bell notification style</value>
</data>
<data name="Profile_BellStyle.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_BellStyle.HelpText" xml:space="preserve">
<value>Controls what happens when the application emits a BEL character.</value>
<comment>"Audible" and "None" must match the values for Profile_BellStyleAudible.Content and Profile_BellStyleNone.Content respectively.</comment>
</data>
@ -738,7 +714,7 @@
<data name="Profile_DeleteButton.Text" xml:space="preserve">
<value>Delete profile</value>
</data>
<data name="Profile_Name.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Profile_Name.HelpText" xml:space="preserve">
<value>The name of the profile that appears in the dropdown.</value>
</data>
<data name="Profile_Name.Header" xml:space="preserve">
@ -802,7 +778,7 @@
<data name="Globals_TabSwitcherMode.Header" xml:space="preserve">
<value>Tab switcher interface style</value>
</data>
<data name="Globals_TabSwitcherMode.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_TabSwitcherMode.HelpText" xml:space="preserve">
<value>Defines the terminal behavior when switching tabs with the keyboard.</value>
</data>
<data name="Globals_TabSwitcherModeMru.Content" xml:space="preserve">
@ -817,7 +793,7 @@
<data name="Globals_CopyFormat.Header" xml:space="preserve">
<value>Text format when copying</value>
</data>
<data name="Globals_CopyFormat.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<data name="Globals_CopyFormat.HelpText" xml:space="preserve">
<value>Defines the type of formatting in which selected text is copied to your clipboard.</value>
</data>
<data name="Globals_CopyFormatNone.Content" xml:space="preserve">
@ -838,4 +814,15 @@
<data name="ColorScheme_RenameErrorTip.Title" xml:space="preserve">
<value>This color scheme name is already in use.</value>
</data>
<data name="SettingContainer_OverrideIntro" xml:space="preserve">
<value>This overrides the value in {}.</value>
<comment>"{}" is the object being overridden. Generally, it will be the name of another profile.</comment>
</data>
<data name="SettingContainer_ResetButtonHelpText" xml:space="preserve">
<value>Reset</value>
</data>
<data name="SettingContainer_OverrideTarget" xml:space="preserve">
<value>a lower layer</value>
<comment>This is the object of "SettingContainer_OverrideIntro".</comment>
</data>
</root>

View file

@ -0,0 +1,183 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "SettingContainer.h"
#include "SettingContainer.g.cpp"
#include "LibraryResources.h"
using namespace winrt::Windows::UI::Xaml;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
DependencyProperty SettingContainer::_HeaderProperty{ nullptr };
DependencyProperty SettingContainer::_HelpTextProperty{ nullptr };
DependencyProperty SettingContainer::_HasSettingValueProperty{ nullptr };
SettingContainer::SettingContainer()
{
_InitializeProperties();
}
void SettingContainer::_InitializeProperties()
{
// Initialize any SettingContainer dependency properties here.
// This performs a lazy load on these properties, instead of
// initializing them when the DLL loads.
if (!_HeaderProperty)
{
_HeaderProperty =
DependencyProperty::Register(
L"Header",
xaml_typename<IInspectable>(),
xaml_typename<Editor::SettingContainer>(),
PropertyMetadata{ nullptr });
}
if (!_HelpTextProperty)
{
_HelpTextProperty =
DependencyProperty::Register(
L"HelpText",
xaml_typename<hstring>(),
xaml_typename<Editor::SettingContainer>(),
PropertyMetadata{ box_value(L"") });
}
if (!_HasSettingValueProperty)
{
_HasSettingValueProperty =
DependencyProperty::Register(
L"HasSettingValue",
xaml_typename<bool>(),
xaml_typename<Editor::SettingContainer>(),
PropertyMetadata{ box_value(false), PropertyChangedCallback{ &SettingContainer::_OnHasSettingValueChanged } });
}
}
void SettingContainer::_OnHasSettingValueChanged(DependencyObject const& d, DependencyPropertyChangedEventArgs const& args)
{
const auto& obj{ d.try_as<Editor::SettingContainer>() };
const auto& newVal{ unbox_value<bool>(args.NewValue()) };
// update visibility for reset button
if (const auto& resetButton{ obj.GetTemplateChild(L"ResetButton") })
{
if (const auto& elem{ resetButton.try_as<UIElement>() })
{
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed);
}
}
// update visibility for override message
if (const auto& overrideMsg{ obj.GetTemplateChild(L"OverrideMessage") })
{
if (const auto& elem{ overrideMsg.try_as<UIElement>() })
{
elem.Visibility(newVal ? Visibility::Visible : Visibility::Collapsed);
}
}
}
void SettingContainer::OnApplyTemplate()
{
// This message is only populated if `HasSettingValue` is true.
const auto& overrideMsg{ _GenerateOverrideMessageText() };
if (const auto& child{ GetTemplateChild(L"ResetButton") })
{
if (const auto& button{ child.try_as<Controls::Button>() })
{
// Apply click handler for the reset button.
// When clicked, we dispatch the bound ClearSettingValue event,
// resulting in inheriting the setting value from the parent.
button.Click([=](auto&&, auto&&) {
_ClearSettingValueHandlers(*this, nullptr);
// move the focus to the child control
if (const auto& content{ Content() })
{
if (const auto& control{ content.try_as<Controls::Control>() })
{
control.Focus(FocusState::Programmatic);
return;
}
else if (const auto& panel{ content.try_as<Controls::Panel>() })
{
for (const auto& panelChild : panel.Children())
{
if (const auto& panelControl{ panelChild.try_as<Controls::Control>() })
{
panelControl.Focus(FocusState::Programmatic);
return;
}
}
}
// if we get here, we didn't find something to reasonably focus to.
}
});
// apply tooltip and name (automation property)
const auto& name{ RS_(L"SettingContainer_ResetButtonHelpText") };
Controls::ToolTipService::SetToolTip(child, box_value(name));
Automation::AutomationProperties::SetName(child, name);
Automation::AutomationProperties::SetHelpText(child, overrideMsg);
// initialize visibility for reset button
button.Visibility(HasSettingValue() ? Visibility::Visible : Visibility::Collapsed);
}
}
if (const auto& child{ GetTemplateChild(L"OverrideMessage") })
{
if (const auto& tb{ child.try_as<Controls::TextBlock>() })
{
if (!overrideMsg.empty())
{
// Create the override message
// TODO GH#6800: the override target will be replaced with hyperlink/text directing the user to another profile.
tb.Text(overrideMsg);
// initialize visibility for reset button
tb.Visibility(Visibility::Visible);
}
else
{
// we have no message to render
tb.Visibility(Visibility::Collapsed);
}
}
}
if (const auto& content{ Content() })
{
if (const auto& obj{ content.try_as<DependencyObject>() })
{
// apply header text as name (automation property)
if (const auto& header{ Header() })
{
const auto headerText{ header.try_as<hstring>() };
if (headerText && !headerText->empty())
{
Automation::AutomationProperties::SetName(obj, *headerText);
}
}
// apply help text as tooltip and full description (automation property)
const auto& helpText{ HelpText() };
if (!helpText.empty())
{
Controls::ToolTipService::SetToolTip(obj, box_value(helpText));
Automation::AutomationProperties::SetFullDescription(obj, helpText);
}
}
}
}
hstring SettingContainer::_GenerateOverrideMessageText()
{
if (HasSettingValue())
{
return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideIntro") }, RS_(L"SettingContainer_OverrideTarget")) };
}
return {};
}
}

View file

@ -0,0 +1,68 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- SettingContainer
Abstract:
- This is a XAML container that wraps settings in the Settings UI.
It interacts with the inheritance logic from the TerminalSettingsModel
and represents it in the Settings UI.
Author(s):
- Carlos Zamora - January 2021
--*/
#pragma once
#include "SettingContainer.g.h"
#include "Utils.h"
// This macro defines a dependency property for a WinRT class.
// Use this in your class' header file after declaring it in the idl.
// Remember to register your dependency property in the respective cpp file.
#define DEPENDENCY_PROPERTY(type, name) \
public: \
static winrt::Windows::UI::Xaml::DependencyProperty name##Property() \
{ \
return _##name##Property; \
} \
type name() const \
{ \
return winrt::unbox_value<type>(GetValue(_##name##Property)); \
} \
void name(type const& value) \
{ \
SetValue(_##name##Property, winrt::box_value(value)); \
} \
\
private: \
static winrt::Windows::UI::Xaml::DependencyProperty _##name##Property;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct SettingContainer : SettingContainerT<SettingContainer>
{
public:
SettingContainer();
void OnApplyTemplate();
DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, Header);
DEPENDENCY_PROPERTY(hstring, HelpText);
DEPENDENCY_PROPERTY(bool, HasSettingValue);
TYPED_EVENT(ClearSettingValue, Editor::SettingContainer, Windows::Foundation::IInspectable);
private:
static void _InitializeProperties();
static void _OnHasSettingValueChanged(Windows::UI::Xaml::DependencyObject const& d, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& e);
hstring _GenerateOverrideMessageText();
};
}
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(SettingContainer);
}

View file

@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Terminal.Settings.Editor
{
[default_interface] runtimeclass SettingContainer : Windows.UI.Xaml.Controls.ContentControl
{
SettingContainer();
IInspectable Header;
static Windows.UI.Xaml.DependencyProperty HeaderProperty { get; };
String HelpText;
static Windows.UI.Xaml.DependencyProperty HelpTextProperty { get; };
Boolean HasSettingValue;
static Windows.UI.Xaml.DependencyProperty HasSettingValueProperty { get; };
event Windows.Foundation.TypedEventHandler<SettingContainer, Object> ClearSettingValue;
};
}

View file

@ -0,0 +1,64 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Style x:Key="SettingContainerHeaderStyle" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<Style x:Key="SettingContainerResetButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="Height" Value="19"/>
<Setter Property="Width" Value="19"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="SettingContainerFontIconStyle" TargetType="FontIcon">
<Setter Property="Foreground" Value="{StaticResource SystemAccentColor}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
</Style>
<Style x:Key="SettingContainerOverrideTextStyle" TargetType="TextBlock">
<Setter Property="FontStyle" Value="Italic"/>
</Style>
<Style TargetType="local:SettingContainer">
<Setter Property="Margin" Value="0,24,0,0"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:SettingContainer">
<StackPanel>
<!--Header space-->
<StackPanel Style="{StaticResource SettingContainerHeaderStyle}">
<TextBlock Text="{TemplateBinding Header}"/>
<Button x:Name="ResetButton"
Style="{StaticResource SettingContainerResetButtonStyle}">
<FontIcon Glyph="&#xE845;"
Style="{StaticResource SettingContainerFontIconStyle}"/>
</Button>
</StackPanel>
<!--This is where the actual setting control will go-->
<ContentPresenter Content="{TemplateBinding Content}"/>
<!--The text displayed when a setting is being overridden-->
<TextBlock x:Name="OverrideMessage"
Style="{StaticResource SettingContainerOverrideTextStyle}"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View file

@ -59,7 +59,7 @@ public: \
_BASE_OBSERVABLE_PROJECTED_SETTING(target, name) \
void Clear##name() \
{ \
const auto hadValue{ target.Has##Name() }; \
const auto hadValue{ target.Has##name() }; \
target.Clear##name(); \
if (hadValue) \
{ \

View file

@ -37,6 +37,7 @@
#include <winrt/Windows.UI.Input.h>
#include <winrt/Windows.UI.Popups.h>
#include <winrt/Windows.UI.Xaml.h>
#include <winrt/Windows.UI.Xaml.Automation.h>
#include <winrt/Windows.UI.Xaml.Controls.h>
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
#include <winrt/Windows.UI.Xaml.Data.h>