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"
|
|
|
|
LayoutUpdated="OnCommitDataGridLayoutUpdated"
|
|
|
|
SelectionChanged="OnCommitDataGridSelectionChanged"
|
|
|
|
ContextRequested="OnCommitDataGridContextRequested">
|
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-09 01:29:41 -07:00
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border Background="{DynamicResource Brush.Window}"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
|
|
BorderThickness="0,0,0,1">
|
|
|
|
<Grid ColumnDefinitions="*,1">
|
2024-07-22 20:45:54 -07:00
|
|
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
|
|
Grid.Column="0"
|
|
|
|
Margin="4,0"
|
|
|
|
Content="{TemplateBinding Content}"
|
|
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
|
|
HorizontalContentAlignment="Center"/>
|
2024-07-09 01:29:41 -07:00
|
|
|
|
|
|
|
<Rectangle Name="VerticalSeparator"
|
|
|
|
Grid.Column="1"
|
|
|
|
Width="1"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Fill="{DynamicResource Brush.Border0}"
|
|
|
|
IsVisible="{TemplateBinding AreSeparatorsVisible}" />
|
|
|
|
</Grid>
|
|
|
|
</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-07-18 19:08:11 -07:00
|
|
|
<Ellipse Width="5" Height="5"
|
|
|
|
Margin="0,0,4,0"
|
|
|
|
Fill="{DynamicResource Brush.Accent}"
|
|
|
|
IsVisible="{Binding CanPushToUpstream}"/>
|
|
|
|
|
|
|
|
<Ellipse Width="5" Height="5"
|
|
|
|
Margin="0,0,4,0"
|
|
|
|
Fill="{DynamicResource Brush.FG1}"
|
|
|
|
IsVisible="{Binding CanPullFromUpstream}"/>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<ItemsControl ItemsSource="{Binding Decorators}" IsVisible="{Binding HasDecorators}">
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type m:Decorator}">
|
|
|
|
<Border Height="16" Margin="0,0,4,0" CornerRadius="2" ClipToBounds="True">
|
|
|
|
<StackPanel Orientation="Horizontal">
|
2024-07-01 01:27:22 -07:00
|
|
|
<Border Background="{DynamicResource Brush.DecoratorIconBG}" Width="16">
|
2024-03-24 19:27:07 -07:00
|
|
|
<Path Width="8" Height="8"
|
|
|
|
Stretch="Uniform"
|
|
|
|
Data="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToIcon}}"
|
|
|
|
Fill="{DynamicResource Brush.DecoratorIcon}"
|
|
|
|
VerticalAlignment="Center"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Border>
|
|
|
|
<Border Background="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToBackground}}">
|
2024-04-02 05:42:17 -07:00
|
|
|
<TextBlock Classes="monospace"
|
|
|
|
Text="{Binding Name}"
|
|
|
|
FontSize="10"
|
|
|
|
Margin="4,0"
|
2024-07-01 05:27:59 -07:00
|
|
|
Foreground="{DynamicResource Brush.DecoratorFG}"
|
2024-04-02 05:42:17 -07:00
|
|
|
FontWeight="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToFontWeight}}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
|
|
</Border>
|
|
|
|
</DataTemplate>
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
</ItemsControl>
|
|
|
|
|
2024-04-01 03:11:22 -07:00
|
|
|
<TextBlock Classes="monospace"
|
2024-06-06 21:31:10 -07:00
|
|
|
Text="{Binding Subject}"
|
2024-07-17 19:46:39 -07:00
|
|
|
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"
|
|
|
|
Classes="monospace"
|
|
|
|
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-03-04 23:53:38 -08:00
|
|
|
<TextBlock Classes="monospace"
|
|
|
|
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}"/>
|
|
|
|
<TextBlock Classes="table_header" Margin="4,0,0,0" Text="{DynamicResource Text.Histories.Header.Time}"/>
|
|
|
|
</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-15 20:15:41 -07:00
|
|
|
<v:CommitTimeTextBlock Classes="monospace"
|
|
|
|
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
|
|
|
|
|
|
|
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
|
|
|
|
<Border Background="{DynamicResource Brush.Window}">
|
|
|
|
<Path Width="128" Height="128"
|
|
|
|
Data="{StaticResource Icons.Detail}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
<ContentControl Content="{Binding DetailContext}">
|
|
|
|
<ContentControl.DataTemplates>
|
|
|
|
<DataTemplate DataType="vm:CommitDetail">
|
|
|
|
<v:CommitDetail/>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="vm:RevisionCompare">
|
|
|
|
<v:RevisionCompare/>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="vm:CountSelectedCommits">
|
|
|
|
<Grid Background="{DynamicResource Brush.Window}">
|
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
|
|
<Path Width="128" Height="128"
|
|
|
|
Data="{StaticResource Icons.Detail}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
|
|
|
|
<TextBlock HorizontalAlignment="Center"
|
|
|
|
Margin="0,16"
|
|
|
|
FontSize="24" FontWeight="Bold"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
Text="{Binding Count, Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='Histories.Selected'}"/>
|
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
|
|
|
</Grid>
|
|
|
|
</v:LayoutableGrid>
|
|
|
|
</UserControl>
|