Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI for adding, renaming, and deleting a color scheme #8403

Merged
121 commits merged into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from 106 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
9493ca0
Add a Settings UI Prototype (#7370)
carlos-zamora Sep 17, 2020
51ba054
Convert TerminalSettingsEditor into a DLL (#7675)
leonMSFT Sep 22, 2020
a305c0d
Add a Settings UI Prototype (#7370)
carlos-zamora Sep 17, 2020
91d2148
Convert TerminalSettingsEditor into a DLL (#7675)
leonMSFT Sep 22, 2020
b87f6d6
Merge branch 'feature/settings-ui' of github.com:microsoft/terminal i…
leonMSFT Sep 24, 2020
bde5d5e
Add functionality to open the Settings UI tab through openSettings (#…
leonMSFT Oct 6, 2020
09677fd
merging from master
leonMSFT Oct 7, 2020
29578d3
Add settings UI string localization (#7833)
cinnamon-msft Oct 9, 2020
e002752
Merge branch 'master' into feature/settings-ui
carlos-zamora Oct 12, 2020
0ce05b5
Merge branch 'master' into feature/settings-ui
carlos-zamora Oct 16, 2020
c14824e
Add save button to settings UI (#7949)
cinnamon-msft Oct 16, 2020
8213cf1
Make sure TSE pulls in the wildcard resource targets (#7967)
DHowett Oct 19, 2020
788e685
Merge remote-tracking branch 'origin/master' into HEAD
DHowett Oct 19, 2020
b0b5fc1
Replace ObjectModel references in SUI (#7970)
leonMSFT Oct 21, 2020
f5e9d95
merge from master
leonMSFT Oct 21, 2020
3b04ba9
Add scrollviewers to settings UI (#7998)
cinnamon-msft Oct 22, 2020
44d16b8
Add localization to settings tab (#8012)
cinnamon-msft Oct 22, 2020
8a10d29
Update settings UI navigation icons (#8013)
cinnamon-msft Oct 22, 2020
d3d128d
Merge remote-tracking branch 'origin/master' into HEAD
DHowett Oct 22, 2020
52b0915
Merge remote-tracking branch 'origin/main' into HEAD
DHowett Oct 23, 2020
15b4565
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Oct 27, 2020
1ef9f13
Hook up the Settings UI ColorSchemes page (#8049)
leonMSFT Oct 27, 2020
9c4d77a
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Oct 27, 2020
b757e82
Fix build for broken merge in 15b4565c7
DHowett Oct 27, 2020
22805bd
Fix spacing on profile advanced page (#8065)
cinnamon-msft Oct 27, 2020
78545a0
Merge branch 'main' into feature/settings-ui
carlos-zamora Oct 28, 2020
1a36ca6
Merge branch 'main' into feature/settings-ui
carlos-zamora Oct 28, 2020
e2dcd16
Hide incomplete settings UI features (#8078)
cinnamon-msft Oct 28, 2020
9fc79d5
Hook up the Settings UI JSON button (#8059)
leonMSFT Oct 28, 2020
60b154b
Change save to apply in SUI (#8082)
cinnamon-msft Oct 28, 2020
c8fd30e
Fix the Settings UI Color Pickers (#8079)
leonMSFT Oct 28, 2020
96cbbb7
Add border to footer in SUI (#8083)
cinnamon-msft Oct 28, 2020
666e179
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Oct 29, 2020
18ac211
Fix showTabsInTitlebar SUI logic (#8088)
cinnamon-msft Oct 29, 2020
81ca24b
Make ITab an unsealed runtimeclass (#8053)
carlos-zamora Oct 29, 2020
6f56738
Make all nav items top level and remove addprofile (#8089)
cinnamon-msft Oct 30, 2020
c0bca31
Add missing settings to Settings UI (#8116)
carlos-zamora Oct 30, 2020
314baf9
Remove dead SUI files (#8119)
carlos-zamora Oct 30, 2020
aef3336
Update SUI nav for profiles (#8118)
cinnamon-msft Oct 30, 2020
a9dbe8f
Remove code to navigate to home page on SUI launch (#8134)
leonMSFT Nov 3, 2020
a8d52c1
Introduce a way to bind an Enum setting for the Settings UI (#8086)
leonMSFT Nov 3, 2020
140784f
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 3, 2020
644f732
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 4, 2020
a6eb2da
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 4, 2020
c58321a
Renormalize TSE Resources.resw to CRLF
DHowett Nov 4, 2020
7c992c2
Change reset button to discard changes (#8139)
cinnamon-msft Nov 4, 2020
36b2e29
Bind default profile global setting (#8136)
carlos-zamora Nov 4, 2020
48ad994
List all profiles in the SUI Navigation View (#8149)
leonMSFT Nov 5, 2020
f1af7ab
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 6, 2020
41d6cdd
Introduce Page parameters to SUI (#8165)
carlos-zamora Nov 6, 2020
ffa2252
Include icons in SUI DefaultProfile dropdown (#8174)
carlos-zamora Nov 6, 2020
851fb02
Merge branch 'main' into feature/settings-ui
carlos-zamora Nov 10, 2020
c731b0f
Merge branch 'main' into feature/settings-ui
carlos-zamora Nov 17, 2020
f80ee27
fix build: remove deleted function call
carlos-zamora Nov 17, 2020
5ca0db1
Polish layout for Settings UI (#8266)
carlos-zamora Nov 18, 2020
79a99bd
Merge branch 'main' into feature/settings-ui
carlos-zamora Nov 18, 2020
3cf7552
Remove dead code; Add default icon; Rename Base Layer (#8347)
carlos-zamora Nov 23, 2020
ddc4593
Merge remote-tracking branch 'origin/main' into feature/settings-ui
carlos-zamora Nov 23, 2020
1a224cc
Add new BellStyle localization
carlos-zamora Nov 24, 2020
05d1a7b
Implement UI for Rename/Delete
carlos-zamora Nov 24, 2020
36fef26
Implement ColorScheme Add/Rename/Delete
carlos-zamora Nov 25, 2020
0943ef8
address simple PR feedback
carlos-zamora Nov 26, 2020
f9fc986
Propagate IslandWindow's HWND into any component that needs it (#8391)
DHowett Nov 30, 2020
879ed1b
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 30, 2020
cbcda1a
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Nov 30, 2020
62aa0ce
Bind Profile Color Schemes (#8388)
carlos-zamora Dec 1, 2020
2f747a7
Hook up the Save and Reset buttons (#8348)
carlos-zamora Dec 1, 2020
5770d23
Bind Launch Mode/Size, BI Opacity, Opacity, and FontWeight (#8219)
carlos-zamora Dec 3, 2020
540fbb3
Merge branch 'main' into feature/settings-ui
carlos-zamora Dec 3, 2020
16ca947
Merge branch 'feature/settings-ui' into dev/cazamor/sui/rename-and-de…
carlos-zamora Dec 3, 2020
6e41aec
Color Schemes - Delete Button
carlos-zamora Dec 4, 2020
1a11ae0
Add font fallback to profile.icon
carlos-zamora Dec 4, 2020
722bf70
Bind visibility and value for Cursor Height
carlos-zamora Dec 4, 2020
4e3b6e4
Move ScrollbarVisibility to Appearance (below Padding)
carlos-zamora Dec 4, 2020
0dedf38
Merge remote-tracking branch 'origin/main' into feature/settings-ui
DHowett Dec 5, 2020
9ff3a45
Add tooltip to 'open json' button
carlos-zamora Dec 5, 2020
812c36c
Fix dangling ReapplyCompactTabSize from merge
DHowett Dec 5, 2020
af17c59
Update TSE to Microsoft.UI.Xaml 2.5 stable
DHowett Dec 5, 2020
bac748e
polish styling for Startup page
carlos-zamora Dec 7, 2020
ada4a0b
polish styling for Interaction page
carlos-zamora Dec 7, 2020
a20138c
polish styling for Appearance page
carlos-zamora Dec 7, 2020
9daf48e
polish styling for Color Schemes page
carlos-zamora Dec 7, 2020
0635849
polish styling for Rendering page
carlos-zamora Dec 7, 2020
1ce0e55
polish CommonResources (propagate changes)
carlos-zamora Dec 8, 2020
443f515
address Niksa PR comments
carlos-zamora Dec 8, 2020
b6874f6
Merge branch 'feature/settings-ui' of https://github.com/microsoft/Te…
carlos-zamora Dec 8, 2020
a030056
Merge branch 'main' into feature/settings-ui
carlos-zamora Dec 9, 2020
93158e7
Add groupings to profile page (#8516)
cinnamon-msft Dec 9, 2020
58c81ff
Bind BackgroundImageAlignment to Settings UI (#8313)
carlos-zamora Dec 9, 2020
3a38333
add 'locked' to settings.json & defaults.json
carlos-zamora Dec 9, 2020
106c1e3
address Griese PR comments
carlos-zamora Dec 9, 2020
7133d05
Merge branch 'feature/settings-ui' into dev/cazamor/sui/rename-and-de…
carlos-zamora Dec 9, 2020
91dc221
Merge branch 'main' into feature/settings-ui
carlos-zamora Dec 10, 2020
67249d9
actually fix the merge conflict...
carlos-zamora Dec 10, 2020
b38df24
Merge remote-tracking branch 'origin/main' into feature/settings-ui
carlos-zamora Dec 10, 2020
f2379e6
Merge remote-tracking branch 'origin/main' into feature/settings-ui
carlos-zamora Dec 10, 2020
69693f6
resolve second merge marker
DHowett Dec 10, 2020
d676103
Fix SwitchToTab build break (#8545)
carlos-zamora Dec 10, 2020
f829d5a
Fix crash on json change
carlos-zamora Dec 10, 2020
6bdedbe
Merge branch 'feature/settings-ui' into dev/cazamor/sui/rename-and-de…
carlos-zamora Dec 10, 2020
7315977
finalize UI for Color Schemes page
carlos-zamora Dec 10, 2020
e6a69fd
Merge branch 'feature/settings-ui' into dev/cazamor/sui/bind-launch-mode
carlos-zamora Dec 12, 2020
8165371
finalize CS renaming + style Profile delete btn
carlos-zamora Dec 14, 2020
a24e49f
hook-up 'delete profile' btn
carlos-zamora Dec 14, 2020
937a6d1
prevent deletion of CMD + Windows Pwsh
carlos-zamora Dec 14, 2020
8953246
prevent deletion of in-box schemes
carlos-zamora Dec 14, 2020
98377fa
polish content dialog theming and logic
carlos-zamora Dec 15, 2020
c240d76
add delete button disclaimer
carlos-zamora Dec 16, 2020
ac6c951
add base layer disclaimer and delete button visibility logic
carlos-zamora Dec 16, 2020
9204c88
change delete profile architecture to be event based
carlos-zamora Dec 16, 2020
2846605
bugfix: refresh the combobox on rename
carlos-zamora Dec 16, 2020
f7bb0fb
replace rename ContentDialog with TextBox
carlos-zamora Dec 17, 2020
516a047
address PR comments; add tooltips to rename buttons
carlos-zamora Dec 17, 2020
a3d6695
add confirmation dialog to delete buttons
carlos-zamora Dec 17, 2020
cc8dec1
apply changes from design review w/ cinnamon
carlos-zamora Dec 17, 2020
dd2ef1c
address Dustin's PR comments
carlos-zamora Dec 17, 2020
a2ebc74
move and wrap disclaimer
carlos-zamora Dec 17, 2020
541f46c
manually hide CS delete flyout
carlos-zamora Dec 17, 2020
fd8db96
accept enter for CS rename
carlos-zamora Dec 17, 2020
4436762
reduce standard min width to prevent cropping on resize
carlos-zamora Dec 17, 2020
556be58
fix Profile page scrolling bug
carlos-zamora Dec 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 79 additions & 4 deletions src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using namespace winrt;
using namespace winrt::Windows::UI;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Windows::UI::Xaml::Controls;
using namespace winrt::Windows::UI::Xaml::Media;
Expand Down Expand Up @@ -38,8 +39,20 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
RS_(L"ColorScheme_BrightWhite/Header")
};

static const std::set<std::wstring> InBoxSchemes = {
L"Campbell",
L"Campbell Powershell",
L"Vintage",
L"One Half Dark",
L"One Half Light",
L"Solarized Dark",
L"Solarized Light",
L"Tango Dark",
L"Tango Light"
};

ColorSchemes::ColorSchemes() :
_ColorSchemeList{ single_threaded_observable_vector<hstring>() },
_ColorSchemeList{ single_threaded_observable_vector<Model::ColorScheme>() },
_CurrentColorTable{ single_threaded_observable_vector<Editor::ColorTableEntry>() }
{
InitializeComponent();
Expand Down Expand Up @@ -73,10 +86,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
SelectionChangedEventArgs const& args)
{
// Update the color scheme this page is modifying
auto str = winrt::unbox_value<hstring>(args.AddedItems().GetAt(0));
auto colorScheme = _State.Globals().ColorSchemes().Lookup(str);
const auto colorScheme{ args.AddedItems().GetAt(0).try_as<Model::ColorScheme>() };
CurrentColorScheme(colorScheme);
_UpdateColorTable(colorScheme);
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"CanDeleteCurrentScheme" });
}

// Function Description:
Expand All @@ -92,7 +105,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
const auto& colorSchemeMap{ _State.Globals().ColorSchemes() };
for (const auto& pair : colorSchemeMap)
{
_ColorSchemeList.Append(pair.Key());
_ColorSchemeList.Append(pair.Value());
}
}

Expand Down Expand Up @@ -120,6 +133,68 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}

bool ColorSchemes::CanDeleteCurrentScheme() const
{
if (const auto scheme{ CurrentColorScheme() })
{
// Only allow this color scheme to be deleted if it's not provided in-box
const std::wstring myName{ scheme.Name() };
return InBoxSchemes.find(myName) == InBoxSchemes.end();
}
return false;
}

void ColorSchemes::Delete_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
{
const auto schemeName{ CurrentColorScheme().Name() };
_State.Globals().RemoveColorScheme(schemeName);

const auto removedSchemeIndex{ ColorSchemeComboBox().SelectedIndex() };
if (static_cast<uint32_t>(removedSchemeIndex) < _ColorSchemeList.Size() - 1)
{
// select same index
ColorSchemeComboBox().SelectedIndex(removedSchemeIndex + 1);
}
else
{
// select last color scheme (avoid out of bounds error)
ColorSchemeComboBox().SelectedIndex(removedSchemeIndex - 1);
}
_ColorSchemeList.RemoveAt(removedSchemeIndex);
}

void ColorSchemes::AddNew_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
{
// Give the new scheme a distinct name
const hstring schemeName{ fmt::format(L"Color Scheme {}", _State.Globals().ColorSchemes().Size() + 1) };
Model::ColorScheme scheme{ schemeName };

// Add the new color scheme
_State.Globals().AddColorScheme(scheme);

// Update current page
_ColorSchemeList.Append(scheme);
ColorSchemeComboBox().SelectedItem(scheme);
}

void ColorSchemes::Rename_Click(IInspectable const& sender, RoutedEventArgs const& /*e*/)
{
const auto schemeName{ CurrentColorScheme().Name() };
const hstring title{ fmt::format(std::wstring_view{ RS_(L"ColorScheme_RenameDialog/Title") }, schemeName) };

auto dialog{ FindName(L"RenameDialog").try_as<ContentDialog>() };
dialog.Title(winrt::box_value(title));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like an x:Uid exploded and left shrapnel everywhere. What happened?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it's because you wanted to format the color scheme name into it. Sure, fine.

dialog.XamlRoot(sender.as<UIElement>().XamlRoot());
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved

NameBox().Text(schemeName);
dialog.ShowAsync(ContentDialogPlacement::Popup);
}

void ColorSchemes::RenameConfirm_Click(IInspectable const& /*sender*/, ContentDialogButtonClickEventArgs const& /*e*/)
{
CurrentColorScheme().Name(NameBox().Text());
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
}

// Function Description:
// - Updates the currently modifiable color table based on the given current color scheme.
// Arguments:
Expand Down
8 changes: 7 additions & 1 deletion src/cascadia/TerminalSettingsEditor/ColorSchemes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

void ColorSchemeSelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& args);
void ColorPickerChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::ColorChangedEventArgs const& args);
void Delete_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
void AddNew_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
void Rename_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
void RenameConfirm_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs const& e);

bool CanDeleteCurrentScheme() const;

GETSET_PROPERTY(Editor::ColorSchemesPageNavigationState, State, nullptr);
GETSET_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::ColorTableEntry>, CurrentColorTable, nullptr);
GETSET_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::hstring>, ColorSchemeList, nullptr);
GETSET_PROPERTY(Windows::Foundation::Collections::IObservableVector<Model::ColorScheme>, ColorSchemeList, nullptr);

WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
OBSERVABLE_GETSET_PROPERTY(winrt::Microsoft::Terminal::Settings::Model::ColorScheme, CurrentColorScheme, _PropertyChangedHandlers, nullptr);
Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalSettingsEditor/ColorSchemes.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ namespace Microsoft.Terminal.Settings.Editor
ColorSchemes();
ColorSchemesPageNavigationState State { get; };

Boolean CanDeleteCurrentScheme { get; };
Microsoft.Terminal.Settings.Model.ColorScheme CurrentColorScheme { get; };
Windows.Foundation.Collections.IObservableVector<ColorTableEntry> CurrentColorTable;
Windows.Foundation.Collections.IObservableVector<String> ColorSchemeList { get; };
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Model.ColorScheme> ColorSchemeList { get; };
}

[default_interface] runtimeclass ColorTableEntry : Windows.UI.Xaml.Data.INotifyPropertyChanged
Expand Down
124 changes: 107 additions & 17 deletions src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ the MIT License. See LICENSE in the project root for license information. -->
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:model="using:Microsoft.Terminal.Settings.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Expand All @@ -15,8 +16,8 @@ the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary Source="CommonResources.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Thickness x:Key="ColorSchemesStandardControlMargin">10,0,0,20</Thickness>
<Thickness x:Key="ColorSchemesStandardControlMargin">0,0,10,20</Thickness>

<Style x:Key="ColorStackPanelStyle" TargetType="StackPanel">
<Setter Property="Margin" Value="{StaticResource ColorSchemesStandardControlMargin}"/>
<Setter Property="Height" Value="59"/>
Expand Down Expand Up @@ -46,28 +47,59 @@ the MIT License. See LICENSE in the project root for license information. -->
</Page.Resources>

<ScrollViewer>
<Grid>
<Grid Margin="{StaticResource StandardIndentMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" MaxWidth="480"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>

<!--Select a color scheme-->
<ComboBox x:Name="ColorSchemeComboBox"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
SelectedIndex="0"
ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectionChanged="ColorSchemeSelectionChanged"
Style="{StaticResource ComboBoxSettingStyle}"
Margin="{StaticResource ColorSchemesStandardControlMargin}"/>

<!-- Color Table -->
<!--Select Color and Add New Button-->
<StackPanel Orientation="Horizontal"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{StaticResource StandardControlSpacing}">
<ComboBox x:Name="ColorSchemeComboBox"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
SelectedIndex="0"
ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}"
SelectionChanged="ColorSchemeSelectionChanged"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:ColorScheme">
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

<!--Rename Button-->
<Button x:Uid="ColorScheme_Rename"
Style="{StaticResource BrowseButtonStyle}"
Click="Rename_Click">
<FontIcon Glyph="&#xE8AC;"/>
</Button>

<!--Add new button-->
<Button Click="AddNew_Click"
Style="{StaticResource BrowseButtonStyle}">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE710;"
FontSize="15"/>
<TextBlock x:Uid="ColorScheme_AddNewButton"
Margin="10,0,0,0"
FontSize="15"/>
</StackPanel>
</Button>
</StackPanel>

<!-- Color Table (Left Column)-->
<ItemsControl x:Name="ColorTableControl"
ItemsSource="{x:Bind CurrentColorTable, Mode=OneWay}"
Grid.Row="1"
Expand Down Expand Up @@ -98,8 +130,8 @@ the MIT License. See LICENSE in the project root for license information. -->
</ItemsControl.ItemTemplate>
</ItemsControl>

<!-- Additional Colors -->
<ItemsControl Grid.Row="2"
<!-- Additional Colors (Right Column) -->
<ItemsControl Grid.Row="1"
Grid.Column="1">
<StackPanel Style="{StaticResource ColorStackPanelStyle}">
<TextBlock x:Uid="ColorScheme_Foreground"
Expand Down Expand Up @@ -149,6 +181,64 @@ the MIT License. See LICENSE in the project root for license information. -->
</Button>
</StackPanel>
</ItemsControl>

<!--Delete Button-->
<Button Grid.Row="2"
Grid.Column="0"
Click="Delete_Click"
Style="{StaticResource BaseButtonStyle}"
Margin="{StaticResource StandardControlSpacing}"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}">
<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 StandardFontSize}"/>
<TextBlock x:Uid="ColorScheme_DeleteButton"
FontSize="{StaticResource StandardFontSize}"
Margin="10,0,0,0"/>
</StackPanel>
</Button.Content>
</Button>

<ContentDialog x:Load="False"
x:Uid="ColorScheme_RenameDialog"
x:Name="RenameDialog"
DefaultButton="Primary"
PrimaryButtonClick="RenameConfirm_Click">
<TextBox x:Uid="ColorScheme_Name"
x:Name="NameBox"
Style="{StaticResource TextBoxSettingStyle}"/>
</ContentDialog>
</Grid>
</ScrollViewer>
</Page>
4 changes: 2 additions & 2 deletions src/cascadia/TerminalSettingsEditor/CommonResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

<x:Double x:Key="StandardFontSize">15.0</x:Double>
<Thickness x:Key="StandardIndentMargin">20,0,0,0</Thickness>
<Thickness x:Key="StandardControlSpacing">0,0,0,20</Thickness>
<x:Double x:Key="StandardBoxMinWidth">300</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="Padding" Value="0,0,0,20"/>
<Setter Property="Padding" Value="{StaticResource StandardControlSpacing}"/>
</Style>

<!--Used to stack a group of settings-->
Expand Down Expand Up @@ -105,5 +106,4 @@
<Setter Property="Width" Value="300"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>

</ResourceDictionary>
Loading