2024-03-20 00:36:10 -07:00
|
|
|
<UserControl xmlns="https://github.com/avaloniaui"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:m="using:SourceGit.Models"
|
|
|
|
xmlns:vm="using:SourceGit.ViewModels"
|
|
|
|
xmlns:v="using:SourceGit.Views"
|
|
|
|
xmlns:c="using:SourceGit.Converters"
|
|
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
|
|
x:Class="SourceGit.Views.DiffView"
|
|
|
|
x:DataType="vm:DiffContext">
|
|
|
|
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" Background="{DynamicResource Brush.Window}">
|
|
|
|
<Grid RowDefinitions="26,*">
|
|
|
|
<!-- Toolbar -->
|
|
|
|
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border2}">
|
2024-04-13 21:27:09 -07:00
|
|
|
<Grid ColumnDefinitions="Auto,Auto,*,Auto">
|
|
|
|
<!-- File Icon -->
|
|
|
|
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.File}" Margin="8,0,0,0"/>
|
|
|
|
|
|
|
|
<!-- File Mode Change -->
|
|
|
|
<Border Grid.Column="1"
|
|
|
|
Margin="4,0,0,0"
|
|
|
|
Height="18"
|
|
|
|
CornerRadius="4"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Background="{DynamicResource Brush.Badge}"
|
|
|
|
IsVisible="{Binding FileModeChange, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.FileModeChanged}">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" FontSize="10" HorizontalAlignment="Center" Margin="4,0" Text="{Binding FileModeChange}" Foreground="{DynamicResource Brush.BadgeFG}"/>
|
2024-04-13 21:27:09 -07:00
|
|
|
</Border>
|
|
|
|
|
|
|
|
<!-- Title -->
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Grid.Column="2" Classes="primary" Margin="4,0,0,0" Text="{Binding Title}" FontSize="11" TextTrimming="CharacterEllipsis"/>
|
2024-04-13 21:27:09 -07:00
|
|
|
|
|
|
|
<!-- Toolbar Buttons -->
|
|
|
|
<StackPanel Grid.Column="3" Margin="8,0,0,0" Orientation="Horizontal" VerticalAlignment="Center">
|
2024-06-25 02:46:15 -07:00
|
|
|
<Button Classes="icon_button"
|
|
|
|
Width="32"
|
|
|
|
Command="{Binding IncrUnified}"
|
|
|
|
IsVisible="{Binding IsTextDiff}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.Incr}">
|
2024-05-26 19:29:15 -07:00
|
|
|
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Lines.Incr}"/>
|
|
|
|
</Button>
|
|
|
|
|
2024-06-25 02:46:15 -07:00
|
|
|
<Button Classes="icon_button"
|
|
|
|
Width="32"
|
|
|
|
Command="{Binding DecrUnified}"
|
|
|
|
IsVisible="{Binding IsTextDiff}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.Decr}"
|
|
|
|
IsEnabled="{Binding Source={x:Static vm:Preference.Instance}, Path=DiffViewVisualLineNumbers, Converter={x:Static c:IntConverters.IsGreaterThanFour}}">
|
2024-05-26 19:29:15 -07:00
|
|
|
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Lines.Decr}"/>
|
|
|
|
</Button>
|
2024-06-04 05:19:49 -07:00
|
|
|
|
2024-03-20 05:17:20 -07:00
|
|
|
<ToggleButton Classes="line_path"
|
|
|
|
Width="32" Height="18"
|
|
|
|
Background="Transparent"
|
|
|
|
Padding="9,6"
|
|
|
|
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting, Mode=TwoWay}"
|
2024-04-13 21:27:09 -07:00
|
|
|
IsVisible="{Binding IsTextDiff}"
|
2024-03-20 05:17:20 -07:00
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.SyntaxHighlight}">
|
|
|
|
<Path Width="13" Height="13" Data="{StaticResource Icons.SyntaxHighlight}" Margin="0,3,0,0"/>
|
|
|
|
</ToggleButton>
|
|
|
|
|
2024-06-04 05:19:49 -07:00
|
|
|
<ToggleButton Classes="line_path"
|
|
|
|
Width="32" Height="18"
|
|
|
|
Background="Transparent"
|
|
|
|
Padding="9,6"
|
|
|
|
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap, Mode=TwoWay}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.ToggleWordWrap}">
|
2024-07-03 23:12:39 -07:00
|
|
|
<ToggleButton.IsVisible>
|
|
|
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
|
|
|
<Binding Path="IsTextDiff"/>
|
|
|
|
<Binding Source="{x:Static vm:Preference.Instance}" Path="UseSideBySideDiff" Mode="OneWay" Converter="{x:Static BoolConverters.Not}"/>
|
|
|
|
</MultiBinding>
|
|
|
|
</ToggleButton.IsVisible>
|
|
|
|
|
2024-06-04 05:19:49 -07:00
|
|
|
<Path Width="12" Height="12" Data="{StaticResource Icons.WordWrap}" Margin="0,2,0,0"/>
|
|
|
|
</ToggleButton>
|
|
|
|
|
2024-06-19 03:15:32 -07:00
|
|
|
<ToggleButton Classes="line_path"
|
|
|
|
Width="32"
|
|
|
|
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView, Mode=TwoWay}"
|
|
|
|
IsVisible="{Binding IsTextDiff}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.ShowHiddenSymbols}">
|
|
|
|
<Path Width="11" Height="11" Stretch="Uniform" Data="{StaticResource Icons.Whitespace}" Margin="0,1,0,0"/>
|
|
|
|
</ToggleButton>
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
<ToggleButton Classes="line_path"
|
|
|
|
Width="32" Height="18"
|
|
|
|
Background="Transparent"
|
|
|
|
Padding="9,6"
|
|
|
|
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=TwoWay}"
|
2024-04-13 21:27:09 -07:00
|
|
|
IsVisible="{Binding IsTextDiff}"
|
2024-03-20 00:36:10 -07:00
|
|
|
ToolTip.Tip="{DynamicResource Text.Diff.SideBySide}">
|
2024-03-20 20:16:34 -07:00
|
|
|
<Path Width="12" Height="12" Data="{StaticResource Icons.LayoutHorizontal}" Margin="0,2,0,0"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</ToggleButton>
|
2024-04-13 21:27:09 -07:00
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
<Button Classes="icon_button" Width="32" Command="{Binding OpenExternalMergeTool}" ToolTip.Tip="{DynamicResource Text.Diff.UseMerger}">
|
|
|
|
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.OpenWith}"/>
|
|
|
|
</Button>
|
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
<!-- Diff Contents -->
|
|
|
|
<ContentControl Grid.Row="1" Content="{Binding Content}">
|
|
|
|
<ContentControl.DataTemplates>
|
|
|
|
<!-- Binary Diff -->
|
|
|
|
<DataTemplate DataType="m:BinaryDiff">
|
|
|
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
|
|
|
<TextBlock Text="{DynamicResource Text.Diff.Binary}"
|
|
|
|
Margin="0,0,0,32"
|
|
|
|
FontSize="18" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
HorizontalAlignment="Center"/>
|
|
|
|
<Path Width="64" Height="64" Data="{StaticResource Icons.Binary}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<Grid Margin="0,16,0,0" HorizontalAlignment="Center" RowDefinitions="32,32" ColumnDefinitions="Auto,Auto,Auto">
|
|
|
|
<Border Grid.Row="0" Grid.Column="0" Height="16" Background="{DynamicResource Brush.Badge}" CornerRadius="8" VerticalAlignment="Center">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.Old}" Margin="8,0" FontSize="10" Foreground="{DynamicResource Brush.BadgeFG}"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Border>
|
|
|
|
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Grid.Row="0" Grid.Column="1" Classes="primary" Text="{Binding OldSize}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontSize="16" Margin="8,0"/>
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="2" Classes="primary" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" FontSize="16"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
<Border Grid.Row="1" Grid.Column="0" Height="16" Background="Green" CornerRadius="8" VerticalAlignment="Center">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.New}" Margin="8,0" FontSize="10"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Border>
|
|
|
|
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Grid.Row="1" Grid.Column="1" Classes="primary" Text="{Binding NewSize}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontSize="16" Margin="8,0"/>
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="2" Classes="primary" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" FontSize="16"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Grid>
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<!-- LFS Diff -->
|
|
|
|
<DataTemplate DataType="m:LFSDiff">
|
|
|
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
|
|
|
<TextBlock Text="{DynamicResource Text.Diff.LFS}"
|
|
|
|
Margin="0,0,0,32"
|
|
|
|
FontSize="18" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
HorizontalAlignment="Center"/>
|
|
|
|
<Path Width="64" Height="64" Data="{StaticResource Icons.LFS}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<Grid Margin="0,16,0,0" HorizontalAlignment="Center" RowDefinitions="32,32" ColumnDefinitions="Auto,Auto,Auto">
|
|
|
|
<Border Grid.Row="0" Grid.Column="0" Height="16" Background="{DynamicResource Brush.Badge}" CornerRadius="8" VerticalAlignment="Center">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.Old}" Margin="8,0" FontSize="10" Foreground="{DynamicResource Brush.BadgeFG}"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Border>
|
|
|
|
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Grid.Row="0" Grid.Column="1" Classes="primary" Text="{Binding Old.Size}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontSize="16" Margin="8,0"/>
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="2" Classes="primary" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" FontSize="16"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
<Border Grid.Row="1" Grid.Column="0" Height="16" Background="Green" CornerRadius="8" VerticalAlignment="Center">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.New}" Margin="8,0" FontSize="10"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Border>
|
|
|
|
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Grid.Row="1" Grid.Column="1" Classes="primary" Text="{Binding New.Size}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontSize="16" Margin="8,0"/>
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="2" Classes="primary" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" FontSize="16"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</Grid>
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
|
2024-05-28 21:50:26 -07:00
|
|
|
<!-- Submodule Diff -->
|
|
|
|
<DataTemplate DataType="m:SubmoduleDiff">
|
|
|
|
<Grid Background="{DynamicResource Brush.Contents}" RowDefinitions="Auto,*">
|
|
|
|
<TextBlock Grid.Row="0"
|
|
|
|
Text="{DynamicResource Text.Diff.Submodule}"
|
|
|
|
Margin="8,8,8,8"
|
|
|
|
FontSize="18" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
HorizontalAlignment="Center"/>
|
|
|
|
|
|
|
|
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
|
|
|
<StackPanel Orientation="Vertical" Margin="8,0">
|
|
|
|
<Border IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNotNull}}">
|
|
|
|
<ContentControl Content="{Binding Old}">
|
|
|
|
<ContentControl.DataTemplates>
|
2024-06-18 23:24:49 -07:00
|
|
|
<DataTemplate DataType="m:RevisionSubmodule">
|
2024-05-28 21:50:26 -07:00
|
|
|
<Border Margin="0,0,0,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}" Background="{DynamicResource Brush.Window}">
|
2024-06-08 06:13:59 -07:00
|
|
|
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" CanNavigate="False" Content="{Binding Commit}" Message="{Binding FullMessage}"/>
|
2024-05-28 21:50:26 -07:00
|
|
|
</Border>
|
|
|
|
</DataTemplate>
|
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
<Border Height="16" HorizontalAlignment="Center" Background="Green" CornerRadius="8" IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNull}}">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Submodule.New}" Margin="8,0" FontSize="10"/>
|
2024-05-28 21:50:26 -07:00
|
|
|
</Border>
|
|
|
|
|
|
|
|
<Path Width="16" Height="16" Data="{StaticResource Icons.DoubleDown}" HorizontalAlignment="Center" IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
|
|
|
|
|
|
|
<Border Margin="0,8,0,0" BorderThickness="1" BorderBrush="Green" Background="{DynamicResource Brush.Window}">
|
2024-06-08 06:13:59 -07:00
|
|
|
<v:CommitBaseInfo MaxHeight="256" Margin="0,0,0,4" CanNavigate="False" Content="{Binding New.Commit}" Message="{Binding New.FullMessage}"/>
|
2024-05-28 21:50:26 -07:00
|
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
|
2024-03-27 06:38:38 -07:00
|
|
|
<!-- Image Diff -->
|
|
|
|
<DataTemplate DataType="m:ImageDiff">
|
2024-06-21 02:48:19 -07:00
|
|
|
<v:ImageDiffView/>
|
2024-03-27 06:38:38 -07:00
|
|
|
</DataTemplate>
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
<!-- Text Diff -->
|
|
|
|
<DataTemplate DataType="m:TextDiff">
|
2024-06-12 06:12:45 -07:00
|
|
|
<v:TextDiffView UseSideBySideDiff="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSideBySideDiff, Mode=OneWay}"/>
|
2024-03-20 00:36:10 -07:00
|
|
|
</DataTemplate>
|
2024-03-21 06:24:53 -07:00
|
|
|
|
2024-06-08 06:13:59 -07:00
|
|
|
<!-- Empty or only EOL changes -->
|
2024-03-21 06:24:53 -07:00
|
|
|
<DataTemplate DataType="m:NoOrEOLChange">
|
|
|
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
|
|
|
<Path Width="64" Height="64" Data="{StaticResource Icons.Check}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<TextBlock Margin="0,16,0,0"
|
|
|
|
Text="{DynamicResource Text.Diff.NoChange}"
|
|
|
|
FontSize="18" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
HorizontalAlignment="Center"/>
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
2024-03-20 00:36:10 -07:00
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
|
|
|
</Grid>
|
|
|
|
</Border>
|
|
|
|
</UserControl>
|