mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-27 21:27:19 -08:00
934d784d40
* disable line wrap in side-by-side diff mode
83 lines
6.6 KiB
XML
83 lines
6.6 KiB
XML
<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"
|
|
x:Class="SourceGit.Views.TextDiffView"
|
|
x:Name="ThisControl"
|
|
Background="{DynamicResource Brush.Contents}">
|
|
<Grid>
|
|
<ContentControl x:Name="Editor">
|
|
<ContentControl.DataTemplates>
|
|
<DataTemplate DataType="m:TextDiff">
|
|
<v:CombinedTextDiffPresenter 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}"
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
|
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
|
</DataTemplate>
|
|
|
|
<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}"
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
|
WordWrap="False"
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
|
|
|
<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}"
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
|
WordWrap="False"
|
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
|
EnableChunkSelection="{Binding #ThisControl.EnableChunkSelection}"
|
|
SelectedChunk="{Binding #ThisControl.SelectedChunk, Mode=TwoWay}"/>
|
|
</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}}"/>
|
|
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Discard}" Margin="8,0,0,0" Click="OnDiscardChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</UserControl>
|