mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-30 08:34:59 +00:00
code_review: PR #652
* update localization for zh_CN and zh_TW * change the icon for `Icons.Lines.All` * reorder diff view toolbar buttons * move private methods after protected Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
8d4afafd2d
commit
6209326fe0
5 changed files with 42 additions and 39 deletions
|
@ -34,16 +34,6 @@
|
|||
|
||||
<!-- Toolbar Buttons -->
|
||||
<StackPanel Grid.Column="3" Margin="8,0,0,0" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<ToggleButton Classes="line_path"
|
||||
Width="32" Height="18"
|
||||
Background="Transparent"
|
||||
Padding="9,6"
|
||||
Command="{Binding ToggleFullTextDiff}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseFullTextDiff, Mode=OneWay}"
|
||||
IsVisible="{Binding IsTextDiff}"
|
||||
ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.All}">
|
||||
<Path Width="13" Height="13" Data="{StaticResource Icons.Lines.All}" Margin="0,3,0,0"/>
|
||||
</ToggleButton>
|
||||
<Button Classes="icon_button"
|
||||
Width="32"
|
||||
Command="{Binding IncrUnified}"
|
||||
|
@ -68,6 +58,17 @@
|
|||
</Button.IsEnabled>
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Lines.Decr}"/>
|
||||
</Button>
|
||||
|
||||
<ToggleButton Classes="line_path"
|
||||
Width="32" Height="18"
|
||||
Background="Transparent"
|
||||
Padding="9,6"
|
||||
Command="{Binding ToggleFullTextDiff}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseFullTextDiff, Mode=OneWay}"
|
||||
IsVisible="{Binding IsTextDiff}"
|
||||
ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.All}">
|
||||
<Path Width="13" Height="13" Data="{StaticResource Icons.Lines.All}" Margin="0,3,0,0"/>
|
||||
</ToggleButton>
|
||||
|
||||
<ToggleButton Classes="line_path"
|
||||
Width="32" Height="18"
|
||||
|
|
|
@ -1241,34 +1241,6 @@ namespace SourceGit.Views
|
|||
set => SetValue(EnableChunkSelectionProperty, value);
|
||||
}
|
||||
|
||||
private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true)
|
||||
{
|
||||
if (SelectedChunk != null)
|
||||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
|
||||
if (diff == null)
|
||||
{
|
||||
Editor.Content = null;
|
||||
GC.Collect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (UseSideBySideDiff)
|
||||
{
|
||||
var previousContent = Editor.Content as ViewModels.TwoSideTextDiff;
|
||||
Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!keepScrollOffset)
|
||||
diff.ScrollOffset = Vector.Zero;
|
||||
Editor.Content = diff;
|
||||
}
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
static TextDiffView()
|
||||
{
|
||||
UseSideBySideDiffProperty.Changed.AddClassHandler<TextDiffView>((v, _) =>
|
||||
|
@ -1316,6 +1288,34 @@ namespace SourceGit.Views
|
|||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
}
|
||||
|
||||
private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true)
|
||||
{
|
||||
if (SelectedChunk != null)
|
||||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
|
||||
if (diff == null)
|
||||
{
|
||||
Editor.Content = null;
|
||||
GC.Collect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (UseSideBySideDiff)
|
||||
{
|
||||
var previousContent = Editor.Content as ViewModels.TwoSideTextDiff;
|
||||
Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!keepScrollOffset)
|
||||
diff.ScrollOffset = Vector.Zero;
|
||||
Editor.Content = diff;
|
||||
}
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
private void OnStageChunk(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
var chunk = SelectedChunk;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue