mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 18:35:00 +00:00
parent
0ea4021a64
commit
ee4d8a6a0e
4 changed files with 182 additions and 130 deletions
|
@ -4,6 +4,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
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.Blame"
|
||||
x:DataType="vm:Blame"
|
||||
|
@ -43,22 +44,44 @@
|
|||
|
||||
<!-- File -->
|
||||
<Border Grid.Row="1" Padding="8,0" >
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"/>
|
||||
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<Button Classes="icon_button"
|
||||
IsEnabled="{Binding CanMoveBack}"
|
||||
Width="28"
|
||||
Click="HistoryBack">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||
</Button>
|
||||
<Button Classes="icon_button"
|
||||
IsEnabled="{Binding CanMoveForward}"
|
||||
Width="28"
|
||||
Click="HistoryForward">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Data="{StaticResource Icons.TriangleRight}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto,400">
|
||||
<Path Grid.Column="0"
|
||||
Width="14" Height="14"
|
||||
Data="{StaticResource Icons.File}"/>
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Margin="4,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding FilePath, Mode=OneWay}"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="icon_button"
|
||||
IsEnabled="{Binding CanBack}"
|
||||
Width="28"
|
||||
Command="{Binding Back}">
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||
</Button>
|
||||
|
||||
<Button Grid.Column="3"
|
||||
Classes="icon_button"
|
||||
IsEnabled="{Binding CanForward}"
|
||||
Width="28"
|
||||
Command="{Binding Forward}">
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.TriangleRight}"/>
|
||||
</Button>
|
||||
|
||||
<Border Grid.Column="4" Background="#40000000" CornerRadius="3" Padding="4,0" Margin="0,2">
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
FontWeight="Bold"
|
||||
Margin="0,0,6,0"
|
||||
Text="{Binding Revision.SHA, Converter={x:Static c:StringConverters.ToShortSHA}, Mode=OneWay}"/>
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding Revision.Subject}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
|
|
@ -224,9 +224,7 @@ namespace SourceGit.Views
|
|||
if (rect.Contains(pos))
|
||||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.NavigateToCommit(info.CommitSHA, true);
|
||||
}
|
||||
blame.NavigateToCommit(info.CommitSHA);
|
||||
|
||||
e.Handled = true;
|
||||
break;
|
||||
|
@ -433,8 +431,6 @@ namespace SourceGit.Views
|
|||
public Blame()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AddHandler(PointerReleasedEvent, MouseUpHandler, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
|
@ -443,30 +439,22 @@ namespace SourceGit.Views
|
|||
GC.Collect();
|
||||
}
|
||||
|
||||
private void HistoryBack(object _, RoutedEventArgs e)
|
||||
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.Back();
|
||||
}
|
||||
}
|
||||
private void HistoryForward(object _, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
blame.Forward();
|
||||
}
|
||||
}
|
||||
base.OnPointerReleased(e);
|
||||
|
||||
private void MouseUpHandler(object sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
if (e.InitialPressMouseButton == MouseButton.XButton1)
|
||||
if (!e.Handled && DataContext is ViewModels.Blame blame)
|
||||
{
|
||||
HistoryBack(null, null);
|
||||
}
|
||||
else if (e.InitialPressMouseButton == MouseButton.XButton2)
|
||||
{
|
||||
HistoryForward(null, null);
|
||||
if (e.InitialPressMouseButton == MouseButton.XButton1)
|
||||
{
|
||||
blame.Back();
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.InitialPressMouseButton == MouseButton.XButton2)
|
||||
{
|
||||
blame.Forward();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue