sourcegit/src/Views/Widgets/DiffViewer.xaml

140 lines
7.6 KiB
Text
Raw Normal View History

2021-04-29 05:05:55 -07:00
<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"
d:DesignHeight="450" d:DesignWidth="800">
<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="{StaticResource Brush.Border2}" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="26"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Tool Bar -->
<Border x:Name="toolbar" Grid.Row="0" BorderBrush="{StaticResource 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" FontFamily="Consolas"/>
<TextBlock Margin="8,0" Text="→" FontFamily="Consolas"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icon.File}"/>
<TextBlock x:Name="txtFileName" Margin="4,0" FontFamily="Consolas"/>
<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="{StaticResource Text.Diff.Next}"
Click="GotoNextChange"/>
<controls:IconButton
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Up}"
ToolTip="{StaticResource Text.Diff.Prev}"
Click="GotoPrevChange"/>
<ToggleButton
Width="14" Height="14"
Margin="4,0,0,0"
Style="{StaticResource Style.ToggleButton.SplitDirection}"
Foreground="{StaticResource Brush.FG1}"
ToolTip="{StaticResource Text.Diff.Mode}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.UseCombinedDiff, Mode=TwoWay}"
Checked="OnDiffViewModeChanged" Unchecked="OnDiffViewModeChanged"/>
</StackPanel>
</Grid>
</Border>
<Grid x:Name="textDiff" Grid.Row="1" SizeChanged="OnTextDiffSizeChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
<Border x:Name="sizeChange" Grid.Row="1">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" TextElement.FontFamily="Consolas">
<TextBlock
x:Name="txtSizeChangeTitle"
Text="{StaticResource Text.Diff.Binary}"
Margin="0,0,0,32"
FontSize="18" FontWeight="UltraBold"
Foreground="{StaticResource Brush.FG2}"
HorizontalAlignment="Center"/>
<Path
x:Name="iconSizeChange"
Width="64" Height="64"
Data="{StaticResource Icon.Binary}"
Fill="{StaticResource 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="{StaticResource Text.Diff.Binary.Old}" Foreground="{StaticResource Brush.FG2}" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="0" Grid.Column="2" x:Name="txtOldSize" Foreground="{StaticResource Brush.FG2}" HorizontalAlignment="Right" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{StaticResource Text.Diff.Binary.New}" Foreground="{StaticResource Brush.FG2}" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="txtNewSize" Foreground="{StaticResource Brush.FG2}" HorizontalAlignment="Right" TextElement.FontSize="18" TextElement.FontWeight="UltraBold"/>
</Grid>
</StackPanel>
</Border>
<Border x:Name="noChange" Grid.Row="1">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Check}" Fill="{StaticResource Brush.FG2}"/>
<TextBlock
Margin="0,16,0,0"
Text="{StaticResource Text.Diff.NoChange}"
FontSize="18" FontWeight="UltraBold"
Foreground="{StaticResource Brush.FG2}"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
<Border x:Name="mask" Grid.Row="0" Grid.RowSpan="2">
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Diff}" Fill="{StaticResource Brush.FG2}"/>
<TextBlock
Margin="0,16,0,0"
Text="{StaticResource Text.Diff.Welcome}"
FontSize="18" FontWeight="UltraBold"
Foreground="{StaticResource Brush.FG2}"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
</Grid>
</Border>
</UserControl>