Files
FluentTerminal/FluentTerminal.App/Views/TerminalView.xaml
T
RhavoX 56ed197b02 Fix for a crash in search popup. (#817)
The crash occured because the popup is treated like the mainwindow and the main window grabs keypresses. Because of this a paste command can be executed on the main window when attempting to paste into the search box (when ctrl-c is used as a paste binding).
Adding an empty binding for copy and paste resolves this. Additionally it was required to prevent the terminal view from handling paste requests to prevent pasting to searchbox and terminal at the same time.
2020-07-18 10:28:52 +02:00

159 lines
6.9 KiB
XML

<UserControl
x:Class="FluentTerminal.App.Views.TerminalView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:actions="using:FluentTerminal.App.Actions"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:FluentTerminal.App.Views"
d:DesignHeight="300"
d:DesignWidth="600"
mc:Ignorable="d">
<Grid>
<Grid x:Name="TerminalContainer" />
<views:OverlayView x:Name="MessageOverlay" />
<controls:DropShadowPanel
Height="64"
Margin="12"
HorizontalAlignment="Right"
VerticalAlignment="Top"
ShadowOpacity="0.5"
Visibility="{x:Bind ViewModel.ShowSearchPanel, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}"
Color="Black">
<StackPanel
Padding="6"
Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}"
CornerRadius="4"
Orientation="Horizontal">
<Viewbox
Width="16"
Height="16"
Margin="6,0,0,0">
<SymbolIcon Symbol="Find" />
</Viewbox>
<TextBox
Name="SearchTextBox"
x:Uid="SearchTextBox"
Width="200"
Margin="6,0,6,0"
Background="Transparent"
BorderThickness="0"
IsTabStop="True"
KeyUp="OnSearchTextBoxKeyUp"
PlaceholderText="Enter search term"
Text="{x:Bind ViewModel.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
GotFocus="SearchTextBox_GotFocus"
LostFocus="SearchTextBox_LostFocus">
<Interactivity:Interaction.Behaviors>
<Core:DataTriggerBehavior Binding="{x:Bind ViewModel.ShowSearchPanel, Mode=OneWay}" Value="true">
<actions:FocusAction />
</Core:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</TextBox>
<ToggleButton
x:Uid="SearchCaseSensitive"
Background="Transparent"
IsChecked="{x:Bind ViewModel.SearchMatchCase, Mode=TwoWay}"
ToolTipService.ToolTip="Case sensitive">
<Viewbox Width="16" Height="16">
<TextBlock Text="Aa" />
</Viewbox>
</ToggleButton>
<ToggleButton
x:Uid="SearchWholeWord"
Margin="2,0,2,0"
Background="Transparent"
IsChecked="{x:Bind ViewModel.SearchWholeWord, Mode=TwoWay}"
ToolTipService.ToolTip="Whole word">
<Viewbox Width="16" Height="16">
<TextBlock Text="Ab" TextDecorations="Underline" />
</Viewbox>
</ToggleButton>
<ToggleButton
x:Uid="SearchWithRegex"
Background="Transparent"
IsChecked="{x:Bind ViewModel.SearchWithRegex, Mode=TwoWay}"
ToolTipService.ToolTip="Regex">
<Viewbox Width="16" Height="16">
<TextBlock Text=".*" />
</Viewbox>
</ToggleButton>
<Button
Name="PreviousButton"
x:Uid="FindPrevious"
Margin="6,0,0,0"
Background="Transparent"
Command="{x:Bind ViewModel.FindPreviousCommand}"
ToolTipService.ToolTip="Find previous">
<Button.Content>
<Viewbox Width="16" Height="16">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE971;" />
</Viewbox>
</Button.Content>
</Button>
<Button
x:Uid="FindNext"
Margin="0,0,6,0"
Background="Transparent"
Command="{x:Bind ViewModel.FindNextCommand}"
ToolTipService.ToolTip="Find next">
<Button.Content>
<Viewbox Width="16" Height="16">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE972;" />
</Viewbox>
</Button.Content>
</Button>
<Button
x:Uid="CloseSearchPanel"
Background="Transparent"
Command="{x:Bind ViewModel.CloseSearchPanelCommand}"
ToolTipService.ToolTip="Close search panel">
<Button.Content>
<Viewbox Width="16" Height="16">
<SymbolIcon Symbol="Cancel" />
</Viewbox>
</Button.Content>
</Button>
</StackPanel>
</controls:DropShadowPanel>
<controls:DropShadowPanel
Margin="12"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
ShadowOpacity="0.5"
Visibility="{x:Bind ViewModel.HasExitedWithError, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}"
Color="Black">
<StackPanel
Padding="6"
CornerRadius="4"
Orientation="Horizontal">
<StackPanel.Background>
<SolidColorBrush Color="{ThemeResource SystemAccentColor}" />
</StackPanel.Background>
<TextBlock
x:Uid="SessionDisconnected"
Margin="6,0,24,0"
VerticalAlignment="Center"
Text="Session disconnected" />
<Button
x:Uid="RestartSession"
Margin="0,0,6,0"
Command="{x:Bind ViewModel.ReconnectTabCommand, Mode=OneWay}"
Content="Restart"
IsEnabled="{x:Bind ViewModel.HasExitedWithError, Mode=OneWay}" />
<Button Command="{x:Bind ViewModel.CloseCommand, Mode=OneWay}" Content="{x:Bind Converter={StaticResource I18NConverter}, ConverterParameter=Close}" />
</StackPanel>
</controls:DropShadowPanel>
</Grid>
</UserControl>