mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
The 2 implementations can now be switched
Added a bool property DiffView.UseChangeBlocks. It's not bound from UI yet, but could be used for runtime switching between the two different implementations of prev/next change. The buttons are now using the OnGoto[Prev|Next]Change Click-handler, regardless of implementation.
This commit is contained in:
parent
52550fe53e
commit
b72f701324
1 changed files with 32 additions and 14 deletions
|
@ -11,30 +11,48 @@ namespace SourceGit.Views
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UseChangeBlocks { get; set; } = true;
|
||||||
|
|
||||||
private void OnGotoPrevChange(object _, RoutedEventArgs e)
|
private void OnGotoPrevChange(object _, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
if (UseChangeBlocks)
|
||||||
if (textDiff == null)
|
{
|
||||||
return;
|
if (DataContext is ViewModels.DiffContext diffCtx)
|
||||||
|
diffCtx.PrevChange();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
||||||
|
if (textDiff == null)
|
||||||
|
return;
|
||||||
|
|
||||||
textDiff.GotoPrevChange();
|
textDiff.GotoPrevChange();
|
||||||
if (textDiff is SingleSideTextDiffPresenter presenter)
|
if (textDiff is SingleSideTextDiffPresenter presenter)
|
||||||
presenter.ForceSyncScrollOffset();
|
presenter.ForceSyncScrollOffset();
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGotoNextChange(object _, RoutedEventArgs e)
|
private void OnGotoNextChange(object _, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
if (UseChangeBlocks)
|
||||||
if (textDiff == null)
|
{
|
||||||
return;
|
if (DataContext is ViewModels.DiffContext diffCtx)
|
||||||
|
diffCtx.NextChange();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var textDiff = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
||||||
|
if (textDiff == null)
|
||||||
|
return;
|
||||||
|
|
||||||
textDiff.GotoNextChange();
|
textDiff.GotoNextChange();
|
||||||
if (textDiff is SingleSideTextDiffPresenter presenter)
|
if (textDiff is SingleSideTextDiffPresenter presenter)
|
||||||
presenter.ForceSyncScrollOffset();
|
presenter.ForceSyncScrollOffset();
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue