sourcegit/src/Views/Widgets/DiffViewer.xaml

149 lines
8.2 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"
2021-07-29 22:41:17 -07:00
Background="{DynamicResource Brush.Window}"
d:DesignHeight="450" d:DesignWidth="800"
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
2021-04-29 05:05:55 -07:00
<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">
2021-04-29 05:05:55 -07:00
<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">
2021-04-29 05:05:55 -07:00
<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}"/>
2021-08-04 22:44:25 -07:00
<TextBlock x:Name="txtOrgFileName" Margin="4,0,0,0"/>
<TextBlock Margin="8,0" Text="→"/>
2021-04-29 05:05:55 -07:00
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icon.File}"/>
2021-08-04 22:44:25 -07:00
<TextBlock x:Name="txtFileName" Margin="4,0"/>
2021-04-29 05:05:55 -07:00
<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}"
2021-04-29 05:05:55 -07:00
Click="GotoNextChange"/>
2021-04-29 05:05:55 -07:00
<controls:IconButton
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Up}"
ToolTip="{DynamicResource Text.Diff.Prev}"
2021-04-29 05:05:55 -07:00
Click="GotoPrevChange"/>
<ToggleButton
Width="14" Height="14"
Margin="4,0"
2021-04-29 05:05:55 -07:00
Style="{StaticResource Style.ToggleButton.SplitDirection}"
Foreground="{DynamicResource Brush.FG1}"
ToolTip="{DynamicResource Text.Diff.Mode}"
2021-04-29 05:05:55 -07:00
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"/>
2021-04-29 05:05:55 -07:00
</StackPanel>
</Grid>
</Border>
2021-07-29 22:41:17 -07:00
<Grid x:Name="textDiff" Grid.Row="1" Background="{DynamicResource Brush.Contents}" SizeChanged="OnTextDiffSizeChanged">
2021-04-29 05:05:55 -07:00
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
<Border x:Name="sizeChange" Grid.Row="1" Background="{DynamicResource Brush.Contents}">
2021-08-04 22:44:25 -07:00
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
2021-04-29 05:05:55 -07:00
<TextBlock
x:Name="txtSizeChangeTitle"
Text="{DynamicResource Text.Diff.Binary}"
2021-04-29 05:05:55 -07:00
Margin="0,0,0,32"
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
HorizontalAlignment="Center"/>
<Path
x:Name="iconSizeChange"
Width="64" Height="64"
Data="{StaticResource Icon.Binary}"
Fill="{DynamicResource Brush.FG2}"/>
2021-04-29 05:05:55 -07:00
<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"/>
2021-04-29 05:05:55 -07:00
</Grid>
</StackPanel>
</Border>
<Border x:Name="noChange" Grid.Row="1" Background="{DynamicResource Brush.Contents}">
2021-04-29 05:05:55 -07:00
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Check}" Fill="{DynamicResource Brush.FG2}"/>
2021-04-29 05:05:55 -07:00
<TextBlock
Margin="0,16,0,0"
Text="{DynamicResource Text.Diff.NoChange}"
2021-04-29 05:05:55 -07:00
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
2021-07-29 22:41:17 -07:00
<Border x:Name="mask" Grid.Row="0" Grid.RowSpan="2" Background="{DynamicResource Brush.Window}">
2021-04-29 05:05:55 -07:00
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<Path Width="64" Height="64" Data="{StaticResource Icon.Diff}" Fill="{DynamicResource Brush.FG2}"/>
2021-04-29 05:05:55 -07:00
<TextBlock
Margin="0,16,0,0"
Text="{DynamicResource Text.Diff.Welcome}"
2021-08-04 22:44:25 -07:00
FontSize="18" FontWeight="UltraBold"
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
</Grid>
</Border>
</UserControl>