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"
|
|
|
|
xmlns:c="using:SourceGit.Converters"
|
|
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
|
|
x:Class="SourceGit.Views.Histories"
|
|
|
|
x:DataType="vm:Histories">
|
2024-03-26 00:18:34 -07:00
|
|
|
<v:LayoutableGrid RowDefinitions="*,3,*" ColumnDefinitions="*,3,*"
|
2024-02-05 23:08:37 -08:00
|
|
|
UseHorizontal="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories}">
|
|
|
|
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
|
2024-07-14 00:55:15 -07:00
|
|
|
<DataGrid x:Name="CommitDataGrid"
|
2024-02-18 23:30:10 -08:00
|
|
|
Background="{DynamicResource Brush.Contents}"
|
|
|
|
ItemsSource="{Binding Commits}"
|
|
|
|
SelectionMode="Extended"
|
|
|
|
SelectedItem="{Binding AutoSelectedCommit, Mode=OneWay}"
|
|
|
|
CanUserReorderColumns="False"
|
2024-07-09 01:29:41 -07:00
|
|
|
CanUserResizeColumns="True"
|
2024-02-18 23:30:10 -08:00
|
|
|
CanUserSortColumns="False"
|
|
|
|
IsReadOnly="True"
|
2024-07-09 01:29:41 -07:00
|
|
|
HeadersVisibility="Column"
|
2024-02-18 23:30:10 -08:00
|
|
|
Focusable="False"
|
2024-06-06 05:25:16 -07:00
|
|
|
RowHeight="28"
|
2024-07-09 04:15:02 -07:00
|
|
|
ColumnHeaderHeight="24"
|
2024-02-18 23:30:10 -08:00
|
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
|
|
VerticalScrollBarVisibility="Auto"
|
2024-08-05 19:04:08 -07:00
|
|
|
ClipboardCopyMode="None"
|
2024-02-18 23:30:10 -08:00
|
|
|
LayoutUpdated="OnCommitDataGridLayoutUpdated"
|
|
|
|
SelectionChanged="OnCommitDataGridSelectionChanged"
|
2024-07-29 20:47:58 -07:00
|
|
|
ContextRequested="OnCommitDataGridContextRequested"
|
2024-08-05 19:04:08 -07:00
|
|
|
DoubleTapped="OnCommitDataGridDoubleTapped"
|
|
|
|
KeyDown="OnCommitDataGridKeyDown">
|
2024-07-09 01:29:41 -07:00
|
|
|
<DataGrid.Styles>
|
|
|
|
<Style Selector="DataGridColumnHeader">
|
2024-07-09 04:15:02 -07:00
|
|
|
<Setter Property="MinHeight" Value="24"/>
|
2024-07-27 20:10:43 -07:00
|
|
|
<Setter Property="Margin" Value="0"/>
|
|
|
|
<Setter Property="Padding" Value="0"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border Background="{DynamicResource Brush.Window}"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
2024-07-23 00:14:30 -07:00
|
|
|
BorderThickness="0,0,1,1">
|
|
|
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
2024-07-27 20:10:43 -07:00
|
|
|
Content="{TemplateBinding Content}"
|
|
|
|
HorizontalAlignment="Center"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
</DataGrid.Styles>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<DataGrid.Columns>
|
2024-07-09 01:29:41 -07:00
|
|
|
<DataGridTemplateColumn Width="*" CanUserResize="True">
|
|
|
|
<DataGridTemplateColumn.Header>
|
2024-07-09 01:42:07 -07:00
|
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.GraphAndSubject}"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
|
|
<Border Margin="{Binding Margin}">
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="2,0,0,0">
|
2024-08-09 00:17:04 -07:00
|
|
|
<v:CommitStatusIndicator CurrentBranch="{Binding $parent[v:Histories].CurrentBranch}"
|
|
|
|
AheadBrush="{DynamicResource Brush.Accent}"
|
|
|
|
BehindBrush="{DynamicResource Brush.FG1}"
|
|
|
|
VerticalAlignment="Center"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-07-25 00:31:16 -07:00
|
|
|
<v:CommitRefsPresenter IsVisible="{Binding HasDecorators}"
|
|
|
|
IconBackground="{DynamicResource Brush.DecoratorIconBG}"
|
|
|
|
IconForeground="{DynamicResource Brush.DecoratorIcon}"
|
|
|
|
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
|
|
|
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
|
|
|
LabelForeground="{DynamicResource Brush.DecoratorFG}"
|
|
|
|
FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}"
|
|
|
|
FontSize="10"
|
|
|
|
VerticalAlignment="Center"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-08-13 00:58:34 -07:00
|
|
|
<TextBlock Classes="primary"
|
|
|
|
Text="{Binding Subject}"
|
|
|
|
Opacity="{Binding Opacity}"
|
|
|
|
FontWeight="{Binding FontWeight}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</StackPanel>
|
|
|
|
</Border>
|
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
2024-07-09 01:29:41 -07:00
|
|
|
<DataGridTemplateColumn CanUserResize="True" Width="120">
|
|
|
|
<DataGridTemplateColumn.Header>
|
2024-07-09 01:42:07 -07:00
|
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.Author}"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
2024-07-09 01:29:41 -07:00
|
|
|
<Grid ColumnDefinitions="Auto,*" Margin="8,0">
|
|
|
|
<v:Avatar Grid.Column="0"
|
|
|
|
Width="16" Height="16"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
IsHitTestVisible="False"
|
|
|
|
User="{Binding Author}"
|
2024-07-17 19:46:39 -07:00
|
|
|
Opacity="{Binding Opacity}"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
<TextBlock Grid.Column="1"
|
2024-07-29 05:48:04 -07:00
|
|
|
Classes="primary"
|
2024-07-09 01:29:41 -07:00
|
|
|
Text="{Binding Author.Name}"
|
|
|
|
Margin="8,0,0,0"
|
2024-07-17 19:46:39 -07:00
|
|
|
Opacity="{Binding Opacity}"
|
|
|
|
FontWeight="{Binding FontWeight}"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
</Grid>
|
2024-02-05 23:08:37 -08:00
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
2024-07-09 01:29:41 -07:00
|
|
|
<DataGridTemplateColumn CanUserResize="False" MinWidth="96">
|
|
|
|
<DataGridTemplateColumn.Header>
|
2024-07-09 01:42:07 -07:00
|
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.SHA}"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
2024-07-29 05:48:04 -07:00
|
|
|
<TextBlock Classes="primary"
|
2024-03-04 23:53:38 -08:00
|
|
|
Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
2024-07-09 01:29:41 -07:00
|
|
|
Margin="8,0"
|
|
|
|
HorizontalAlignment="Center"
|
2024-07-17 19:46:39 -07:00
|
|
|
Opacity="{Binding Opacity}"
|
|
|
|
FontWeight="{Binding FontWeight}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
2024-07-09 01:29:41 -07:00
|
|
|
<DataGridTemplateColumn CanUserResize="False" MinWidth="156">
|
|
|
|
<DataGridTemplateColumn.Header>
|
2024-07-15 20:15:41 -07:00
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
<ToggleButton Classes="time_display_mode"
|
|
|
|
Width="10" Height="10"
|
|
|
|
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=DisplayTimeAsPeriodInHistories, Mode=TwoWay}"/>
|
2024-07-27 20:10:43 -07:00
|
|
|
<TextBlock Classes="table_header" Margin="6,0,0,0" Text="{DynamicResource Text.Histories.Header.Time}"/>
|
2024-07-15 20:15:41 -07:00
|
|
|
</StackPanel>
|
|
|
|
|
2024-07-09 01:29:41 -07:00
|
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
2024-07-29 05:48:04 -07:00
|
|
|
<v:CommitTimeTextBlock Classes="primary"
|
2024-07-15 20:15:41 -07:00
|
|
|
Margin="8,0"
|
|
|
|
HorizontalAlignment="Center"
|
2024-07-17 19:46:39 -07:00
|
|
|
Opacity="{Binding Opacity}"
|
|
|
|
FontWeight="{Binding FontWeight}"
|
2024-07-15 20:15:41 -07:00
|
|
|
Timestamp="{Binding CommitterTime}"
|
|
|
|
ShowAsDateTime="{Binding Source={x:Static vm:Preference.Instance}, Path=!DisplayTimeAsPeriodInHistories}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
</DataGrid.Columns>
|
|
|
|
</DataGrid>
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
<v:CommitGraph x:Name="CommitGraph"
|
2024-02-05 23:08:37 -08:00
|
|
|
Graph="{Binding Graph}"
|
2024-04-17 01:16:11 -07:00
|
|
|
DotBrush="{DynamicResource Brush.Contents}"
|
2024-02-05 23:08:37 -08:00
|
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
|
|
|
IsHitTestVisible="False"
|
|
|
|
ClipToBounds="True"/>
|
|
|
|
|
2024-05-30 01:12:28 -07:00
|
|
|
<!-- Fix memory leak -->
|
|
|
|
<v:LoadingIcon Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
|
|
|
|
MinWidth="1" MinHeight="1"
|
2024-02-18 23:30:10 -08:00
|
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
2024-03-26 00:18:34 -07:00
|
|
|
Background="{DynamicResource Brush.Window}"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-07-29 00:07:41 -07:00
|
|
|
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
|
|
|
|
<ContentControl>
|
|
|
|
<ContentControl.Content>
|
|
|
|
<Binding Path="DetailContext">
|
|
|
|
<Binding.TargetNullValue>
|
|
|
|
<Path Width="128" Height="128"
|
|
|
|
Data="{StaticResource Icons.Detail}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
</Binding.TargetNullValue>
|
|
|
|
</Binding>
|
|
|
|
</ContentControl.Content>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<ContentControl.DataTemplates>
|
|
|
|
<DataTemplate DataType="vm:CommitDetail">
|
|
|
|
<v:CommitDetail/>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="vm:RevisionCompare">
|
|
|
|
<v:RevisionCompare/>
|
|
|
|
</DataTemplate>
|
|
|
|
|
2024-07-23 20:44:13 -07:00
|
|
|
<DataTemplate DataType="x:Int32">
|
2024-07-29 00:07:41 -07:00
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
|
|
<Path Width="128" Height="128"
|
|
|
|
Data="{StaticResource Icons.Detail}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Fill="{DynamicResource Brush.FG2}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-07-29 00:07:41 -07:00
|
|
|
<TextBlock HorizontalAlignment="Center"
|
|
|
|
Margin="0,16"
|
|
|
|
FontSize="24" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
Text="{Binding Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='Histories.Selected'}"/>
|
|
|
|
</StackPanel>
|
2024-02-05 23:08:37 -08:00
|
|
|
</DataTemplate>
|
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
2024-07-29 00:07:41 -07:00
|
|
|
</Border>
|
2024-02-05 23:08:37 -08:00
|
|
|
</v:LayoutableGrid>
|
|
|
|
</UserControl>
|