Files
FluentTerminal/FluentTerminal.App/Views/MainPage.xaml
T
Aleksandar Pesic 17c0a3b438 Menu items now honor "Open new terminals as" settings (#594)
* Added icon to "Recent >" menu item.

* Refactored app menu implementation, and implemented keyboard accelerators. Still doesn't work though.

* Few things fixed, but still doesn't work.

* Clicking menu items works.

* Fixing an issue with resources.

* New menu binding implemented. Still doesn't work though.

* Menu displayed properly, except for "Settings".

* Menu works, but it doesn't refresh.

* Works. But needs to be polished.

* All known issues with the new app menu solved.

* Significantly simplifying app menu binding.

* Removing some obsolete classes.

* Menu binding mechanism additionally optimized for performances.

* Removing unused translations.

* Further refactoring app menu binding, in order to make it more general.

* Renaming menu items in order to make them usable for both new tab and new window commands.

* Changing menu item keyboard accelerators based on new tab / window settings.

* Menu item keyboard accelerators are dynamically changing with chainging terminals in new tabs/windows option.

* New tab / window settings honored for top level menu items.

* New window mechanism simplified. Terminal-launching code refactored to be more readable. A bug with "SSH Info" fixed.

* Merging the latest changed.

* Fixing some after-merge issues.

* Minor refactoring.

* Minor refactoring.

* Default profile menu item now contains the profile name. Still doesn't update though.

* Default profile name in the menu item now updates.

* Reverting translations back to the correct (the latest) version.

* Undoing translation changes from the last commit. I've made these by mistake.
2019-11-27 20:48:10 +01:00

112 lines
5.6 KiB
XML

<Page
x:Class="FluentTerminal.App.Views.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:FluentTerminal.App.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:FluentTerminal.App.Views"
RequestedTheme="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay, Converter={StaticResource BackgroundToApplicationThemeConverter}}"
mc:Ignorable="d"
KeyDown="MainPage_OnKeyDown">
<Page.Resources>
<converters:TerminalViewModelToViewConverter x:Key="TerminalViewModelToViewConverter" />
<converters:AppMenuViewModelToFlyoutMenuConverter x:Key="AppMenuViewModelToFlyoutMenuConverter"/>
</Page.Resources>
<Grid x:Name="Root">
<Grid.Background>
<AcrylicBrush
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay}"
TintColor="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay}"
TintOpacity="{x:Bind ViewModel.BackgroundOpacity, Mode=OneWay}"
TintTransitionDuration="{x:Bind NoDuration}" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle x:Name="TitleBar" Fill="Transparent" />
<Grid
x:Name="TitleBarContents"
Height="{Binding CoreTitleBarHeight, Mode=OneWay}"
Margin="{Binding CoreTitleBarPadding, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Style="{StaticResource TitleBarButtonStyle}"
Flyout="{x:Bind ViewModel.MenuViewModel, Mode=OneWay, Converter={StaticResource AppMenuViewModelToFlyoutMenuConverter}}">
<Button.Content>
<Viewbox Width="16" Height="16">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE700;" />
</Viewbox>
</Button.Content>
</Button>
<TextBlock
Grid.Column="1"
Margin="12,8,12,0"
IsHitTestVisible="False"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.WindowTitle, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap"
Visibility="{x:Bind ViewModel.ShowTabsOnTop, Mode=OneWay, Converter={StaticResource FalseToVisibleConverter}}" />
<Rectangle
x:Name="TabDropArea"
Grid.Column="1"
HorizontalAlignment="Stretch"
AllowDrop="True"
DragEnter="TabDropArea_DragEnter"
Drop="TabDropArea_Drop"
Fill="LightGray"
Opacity="0.2"
Visibility="{x:Bind DraggingHappensFromAnotherWindow, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<views:TabBar
x:Name="TopTabBar"
Grid.Column="1"
HorizontalAlignment="Left"
AddCommand="{x:Bind ViewModel.AddDefaultTabCommand}"
ItemsSource="{x:Bind ViewModel.Terminals, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedTerminal, Mode=TwoWay}"
TabDraggedOutside="TabBar_TabDraggedOutside"
TabDraggingChanged="TabBar_TabDraggingChanged"
TabDraggingCompleted="TabBar_TabDraggingCompleted"
TabWindowChanged="TabView_Drop"
Visibility="{x:Bind ViewModel.ShowTabsOnTop, Mode=OneWay}" />
</Grid>
<ContentControl
x:Name="TerminalContainer"
Grid.Row="1"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{x:Bind ViewModel.SelectedTerminal, Mode=OneWay, Converter={StaticResource TerminalViewModelToViewConverter}}" />
<Rectangle
Grid.Row="1"
Fill="LightGray"
Opacity="0.01"
Visibility="{x:Bind DraggingHappens, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<Rectangle
Grid.Row="2"
HorizontalAlignment="Stretch"
AllowDrop="True"
DragEnter="TabDropArea_DragEnter"
Drop="TabDropArea_Drop"
Fill="LightGray"
Opacity="0.2"
Visibility="{x:Bind DraggingHappensFromAnotherWindow, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<views:TabBar
x:Name="BottomTabBar"
Grid.Row="2"
HorizontalAlignment="Left"
AddCommand="{x:Bind ViewModel.AddDefaultTabCommand}"
ItemsSource="{x:Bind ViewModel.Terminals, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedTerminal, Mode=TwoWay}"
TabDraggedOutside="TabBar_TabDraggedOutside"
TabDraggingChanged="TabBar_TabDraggingChanged"
TabDraggingCompleted="TabBar_TabDraggingCompleted"
TabWindowChanged="TabView_Drop"
Visibility="{x:Bind ViewModel.ShowTabsOnBottom, Mode=OneWay}" />
</Grid>
</Page>