Skip to content

Commit

Permalink
Crashing attempt like microsoft#10046
Browse files Browse the repository at this point in the history
  • Loading branch information
mpela81 committed Nov 18, 2023
1 parent 376737e commit d4d6966
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 37 deletions.
12 changes: 6 additions & 6 deletions src/cascadia/TerminalApp/CommandPalette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<ColumnDefinition Width="24" />
<!-- icon -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
Expand All @@ -52,7 +52,7 @@
</Grid.ColumnDefinitions>

<ContentPresenter Grid.Column="0"
Width="16"
Width="24"
Height="16"
Content="{x:Bind Item.ResolvedIcon, Mode=OneWay}" />

Expand Down Expand Up @@ -92,7 +92,7 @@
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<ColumnDefinition Width="24" />
<!-- icon -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
Expand All @@ -103,7 +103,7 @@
</Grid.ColumnDefinitions>

<ContentPresenter Grid.Column="0"
Width="16"
Width="24"
Height="16"
Content="{x:Bind Item.ResolvedIcon, Mode=OneWay}" />

Expand Down Expand Up @@ -150,7 +150,7 @@
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16" />
<ColumnDefinition Width="24" />
<!-- icon / progress -->
<ColumnDefinition Width="Auto" />
<!-- command label -->
Expand All @@ -173,7 +173,7 @@
Value="{x:Bind Item.(local:TabPaletteItem.TabStatus).ProgressValue, Mode=OneWay}" />

<ContentPresenter Grid.Column="0"
Width="16"
Width="24"
Height="16"
Content="{x:Bind Item.ResolvedIcon, Mode=OneWay}" />

Expand Down
4 changes: 2 additions & 2 deletions src/cascadia/TerminalSettingsEditor/AddProfile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@

<Grid.ColumnDefinitions>
<!-- icon -->
<ColumnDefinition Width="16" />
<ColumnDefinition Width="Auto" />
<!-- profile name -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<IconSourceElement Grid.Column="0"
Width="16"
Width="24"
Height="16"
IconSource="{x:Bind Icon, Converter={StaticResource IconSourceConverter}}" />

Expand Down
9 changes: 7 additions & 2 deletions src/cascadia/TerminalSettingsEditor/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
// found the one that was selected before the refresh
SettingsNav().SelectedItem(item);
//NavigationBreadcrumbIcon().IconSource(menuItem.Icon().);
_Navigate(*stringTag, crumb->SubPage());
return;
}
Expand Down Expand Up @@ -532,9 +533,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
addProfileItem.Content(box_value(RS_(L"Nav_AddNewProfile/Content")));
addProfileItem.Tag(box_value(addProfileTag));

FontIcon icon;
// Wrap this icon up in a IconSourceElement, so we can bind to it in the
// Header above the Pivot.
IconSourceElement icon;
FontIconSource fontIcon;
// This is the "Add" symbol
icon.Glyph(L"\xE710");
fontIcon.Glyph(L"\xE710");
icon.IconSource(fontIcon);
addProfileItem.Icon(icon);

_menuItemSource.Append(addProfileItem);
Expand Down
96 changes: 70 additions & 26 deletions src/cascadia/TerminalSettingsEditor/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,67 +77,103 @@
</ResourceDictionary>
</muxc:NavigationView.Resources>
<muxc:NavigationView.Header>
<muxc:BreadcrumbBar x:Name="NavigationBreadcrumbBar"
MaxWidth="{StaticResource StandardControlMaxWidth}"
ItemClicked="BreadcrumbBar_ItemClicked"
ItemsSource="{x:Bind Breadcrumbs}">
<muxc:BreadcrumbBar.ItemTemplate>
<DataTemplate x:DataType="local:Breadcrumb">
<TextBlock Text="{x:Bind Label}" />
</DataTemplate>
</muxc:BreadcrumbBar.ItemTemplate>
<muxc:BreadcrumbBar.Resources>
<ResourceDictionary>
<x:Double x:Key="BreadcrumbBarItemThemeFontSize">28</x:Double>
<Thickness x:Key="BreadcrumbBarChevronPadding">11,4,12,0</Thickness>
<FontWeight x:Key="BreadcrumbBarItemFontWeight">SemiBold</FontWeight>
<x:Double x:Key="BreadcrumbBarChevronFontSize">16</x:Double>
</ResourceDictionary>
</muxc:BreadcrumbBar.Resources>
</muxc:BreadcrumbBar>
<StackPanel Orientation="Horizontal">
<!--
This height is taken from NavigationViewTitleHeaderContentControlTextStyle's
FontSize. Our icons may or may not be font icons, so we want to make sure to clamp them to this size.
IconSource="{Binding ElementName=SettingsNav, Path=SelectedItem.Icon.IconSource, Mode=OneWay}"
-->
<IconSourceElement x:Name="NavigationBreadcrumbIcon"
Height="28"
Margin="{ThemeResource NavigationViewHeaderMargin}"
/>

<muxc:BreadcrumbBar x:Name="NavigationBreadcrumbBar"
MaxWidth="{StaticResource StandardControlMaxWidth}"
ItemClicked="BreadcrumbBar_ItemClicked"
ItemsSource="{x:Bind Breadcrumbs}">
<muxc:BreadcrumbBar.ItemTemplate>
<DataTemplate x:DataType="local:Breadcrumb">
<TextBlock Text="{x:Bind Label}" />
</DataTemplate>
</muxc:BreadcrumbBar.ItemTemplate>
<muxc:BreadcrumbBar.Resources>
<ResourceDictionary>
<x:Double x:Key="BreadcrumbBarItemThemeFontSize">28</x:Double>
<Thickness x:Key="BreadcrumbBarChevronPadding">11,4,12,0</Thickness>
<FontWeight x:Key="BreadcrumbBarItemFontWeight">SemiBold</FontWeight>
<x:Double x:Key="BreadcrumbBarChevronFontSize">16</x:Double>
</ResourceDictionary>
</muxc:BreadcrumbBar.Resources>
</muxc:BreadcrumbBar>
</StackPanel>
</muxc:NavigationView.Header>

<muxc:NavigationView.MenuItems>

<muxc:NavigationViewItem x:Uid="Nav_Launch"
Tag="Launch_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7B5;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE7B5;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Interaction"
Tag="Interaction_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7C9;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE7C9;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Appearance"
Tag="GlobalAppearance_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE771;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE771;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_ColorSchemes"
Tag="ColorSchemes_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE790;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE790;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Rendering"
Tag="Rendering_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7F8;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE7F8;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

<muxc:NavigationViewItem x:Uid="Nav_Actions"
Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE765;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE765;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

Expand All @@ -147,7 +183,11 @@
x:Uid="Nav_ProfileDefaults"
Tag="GlobalProfile_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81E;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE81E;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>

Expand All @@ -160,7 +200,11 @@
KeyDown="OpenJsonKeyDown"
Tapped="OpenJsonTapped">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE713;" />
<IconSourceElement>
<IconSourceElement.IconSource>
<FontIconSource Glyph="&#xE713;" />
</IconSourceElement.IconSource>
</IconSourceElement>
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.FooterMenuItems>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsModel/IconPathConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Note: you _do_ need to manually set the font here.
icon.FontFamily(winrt::Windows::UI::Xaml::Media::FontFamily{ L"Segoe UI" });
}
icon.FontSize(12);

icon.Glyph(iconPath);
iconSource = icon;
}
Expand Down

0 comments on commit d4d6966

Please sign in to comment.