2024-02-05 23:08:37 -08: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"
|
|
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
2024-03-04 05:23:17 -08:00
|
|
|
x:Class="SourceGit.Views.TextDiffView"
|
2024-06-04 05:19:49 -07:00
|
|
|
x:Name="ThisControl"
|
2024-03-04 05:23:17 -08:00
|
|
|
Background="{DynamicResource Brush.Contents}">
|
2024-07-17 01:56:16 -07:00
|
|
|
<Grid>
|
|
|
|
<ContentControl x:Name="Editor">
|
|
|
|
<ContentControl.DataTemplates>
|
|
|
|
<DataTemplate DataType="m:TextDiff">
|
|
|
|
<v:CombinedTextDiffPresenter FileName="{Binding File}"
|
2024-02-05 23:08:37 -08:00
|
|
|
Foreground="{DynamicResource Brush.FG1}"
|
2024-06-12 06:12:45 -07:00
|
|
|
LineBrush="{DynamicResource Brush.Border2}"
|
|
|
|
EmptyContentBackground="{DynamicResource Brush.Diff.EmptyBG}"
|
|
|
|
AddedContentBackground="{DynamicResource Brush.Diff.AddedBG}"
|
|
|
|
DeletedContentBackground="{DynamicResource Brush.Diff.DeletedBG}"
|
|
|
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
|
|
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
|
|
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
2024-08-19 02:14:41 -07:00
|
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
2024-06-12 06:12:45 -07:00
|
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
2024-06-19 02:33:34 -07:00
|
|
|
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
2024-06-19 03:15:32 -07:00
|
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
2024-07-18 20:01:31 -07:00
|
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
2024-07-18 01:16:58 -07:00
|
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
2024-07-17 01:56:16 -07:00
|
|
|
</DataTemplate>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-07-17 01:56:16 -07:00
|
|
|
<DataTemplate DataType="vm:TwoSideTextDiff">
|
|
|
|
<Grid ColumnDefinitions="*,1,*">
|
|
|
|
<v:SingleSideTextDiffPresenter Grid.Column="0"
|
|
|
|
IsOld="True"
|
|
|
|
FileName="{Binding File}"
|
|
|
|
Foreground="{DynamicResource Brush.FG1}"
|
|
|
|
LineBrush="{DynamicResource Brush.Border2}"
|
|
|
|
EmptyContentBackground="{DynamicResource Brush.Diff.EmptyBG}"
|
|
|
|
AddedContentBackground="{DynamicResource Brush.Diff.AddedBG}"
|
|
|
|
DeletedContentBackground="{DynamicResource Brush.Diff.DeletedBG}"
|
|
|
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
|
|
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
|
|
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
2024-08-19 02:14:41 -07:00
|
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
2024-07-17 01:56:16 -07:00
|
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
2024-09-17 07:26:35 -07:00
|
|
|
WordWrap="False"
|
2024-07-17 01:56:16 -07:00
|
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
2024-07-18 20:01:31 -07:00
|
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
2024-07-18 01:16:58 -07:00
|
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-07-17 01:56:16 -07:00
|
|
|
<Rectangle Grid.Column="1" Fill="{DynamicResource Brush.Border2}" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
|
|
|
|
|
|
|
|
<v:SingleSideTextDiffPresenter Grid.Column="2"
|
|
|
|
IsOld="False"
|
|
|
|
FileName="{Binding File}"
|
|
|
|
Foreground="{DynamicResource Brush.FG1}"
|
|
|
|
LineBrush="{DynamicResource Brush.Border2}"
|
|
|
|
EmptyContentBackground="{DynamicResource Brush.Diff.EmptyBG}"
|
|
|
|
AddedContentBackground="{DynamicResource Brush.Diff.AddedBG}"
|
|
|
|
DeletedContentBackground="{DynamicResource Brush.Diff.DeletedBG}"
|
|
|
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
|
|
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
|
|
|
IndicatorForeground="{DynamicResource Brush.FG2}"
|
2024-08-19 02:14:41 -07:00
|
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
2024-07-17 01:56:16 -07:00
|
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
2024-09-17 07:26:35 -07:00
|
|
|
WordWrap="False"
|
2024-07-17 01:56:16 -07:00
|
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
2024-07-18 20:01:31 -07:00
|
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
2024-07-18 01:16:58 -07:00
|
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
2024-07-17 01:56:16 -07:00
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
|
|
|
|
|
|
|
<StackPanel x:Name="Popup" IsVisible="False" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Effect="drop-shadow(0 0 6 #40000000)">
|
|
|
|
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Stage}" Click="OnStageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
|
|
|
|
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Unstage}" Click="OnUnstageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange, Converter={x:Static BoolConverters.Not}}"/>
|
2024-07-30 21:04:29 -07:00
|
|
|
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Discard}" Margin="8,0,0,0" Click="OnDiscardChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
|
2024-07-17 01:56:16 -07:00
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
2024-02-05 23:08:37 -08:00
|
|
|
</UserControl>
|