sourcegit/src/Views/Widgets/DiffViewer.xaml

148 lines
8.2 KiB
XML

<UserControl x:Class="SourceGit.Views.Widgets.DiffViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
Background="{DynamicResource Brush.Window}"
d:DesignHeight="450" d:DesignWidth="800"
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<UserControl.Resources>
<Style x:Key="Style.DataGridRow.DiffViewer" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="RequestBringIntoView" Handler="OnTextDiffBringIntoView"/>
</Style>
</UserControl.Resources>
<Border BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1">
<Grid x:Name="body">
<Grid.RowDefinitions>
<RowDefinition Height="26"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Tool Bar -->
<Border x:Name="toolbar" Grid.Row="0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1">
<Grid Margin="8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" x:Name="orgFileNamePanel" Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icon.File}"/>
<TextBlock x:Name="txtOrgFileName" Margin="4,0,0,0"/>
<TextBlock Margin="8,0" Text="→"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icon.File}"/>
<TextBlock x:Name="txtFileName" Margin="4,0"/>
<controls:Loading x:Name="loading" Width="10" Height="10" Visibility="Collapsed"/>
</StackPanel>
<StackPanel Grid.Column="2" x:Name="toolbarOptions" Orientation="Horizontal">
<controls:IconButton
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Down}"
ToolTip="{DynamicResource Text.Diff.Next}"
Click="GotoNextChange"/>
<controls:IconButton
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Up}"
ToolTip="{DynamicResource Text.Diff.Prev}"
Click="GotoPrevChange"/>
<ToggleButton
Width="14" Height="14"
Margin="4,0"
Style="{StaticResource Style.ToggleButton.SplitDirection}"
Foreground="{DynamicResource Brush.FG1}"
ToolTip="{DynamicResource Text.Diff.Mode}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.UseCombinedDiff, Mode=TwoWay}"
Checked="OnDiffViewModeChanged" Unchecked="OnDiffViewModeChanged"/>
<controls:IconButton
Width="14" Height="14"
Margin="4,0,0,0"
Icon="{StaticResource Icon.DiffWith}"
ToolTip="{DynamicResource Text.Diff.UseMerger}"
Click="OpenWithMerger"/>
</StackPanel>
</Grid>
</Border>
<Grid x:Name="textDiff" Grid.Row="1" Background="{DynamicResource Brush.Contents}" SizeChanged="OnTextDiffSizeChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
<Border x:Name="sizeChange" Grid.Row="1" Background="{DynamicResource Brush.Contents}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<TextBlock
x:Name="txtSizeChangeTitle"
Text="{DynamicResource Text.Diff.Binary}"
Margin="0,0,0,32"
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
HorizontalAlignment="Center"/>
<Path
x:Name="iconSizeChange"
Width="64" Height="64"
Data="{StaticResource Icon.Binary}"
Fill="{DynamicResource Brush.FG2}"/>
<Grid Margin="0,16,0,0" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Text.Diff.Binary.Old}" Foreground="{DynamicResource Brush.FG2}" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="0" Grid.Column="2" x:Name="txtOldSize" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Text.Diff.Binary.New}" Foreground="{DynamicResource Brush.FG2}" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="txtNewSize" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
</Grid>
</StackPanel>
</Border>
<Border x:Name="noChange" Grid.Row="1" Background="{DynamicResource Brush.Contents}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Check}" Fill="{DynamicResource Brush.FG2}"/>
<TextBlock
Margin="0,16,0,0"
Text="{DynamicResource Text.Diff.NoChange}"
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
<Border x:Name="mask" Grid.Row="0" Grid.RowSpan="2" Background="{DynamicResource Brush.Window}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Diff}" Fill="{DynamicResource Brush.FG2}"/>
<TextBlock
Margin="0,16,0,0"
Text="{DynamicResource Text.Diff.Welcome}"
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
</Grid>
</Border>
</UserControl>