mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
221 lines
11 KiB
XML
221 lines
11 KiB
XML
<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">
|
|
<v:LayoutableGrid RowDefinitions="*,3,*" ColumnDefinitions="*,3,*"
|
|
UseHorizontal="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories}">
|
|
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
|
|
<DataGrid x:Name="CommitDataGrid"
|
|
Background="{DynamicResource Brush.Contents}"
|
|
ItemsSource="{Binding Commits}"
|
|
SelectionMode="Extended"
|
|
SelectedItem="{Binding AutoSelectedCommit, Mode=OneWay}"
|
|
CanUserReorderColumns="False"
|
|
CanUserResizeColumns="True"
|
|
CanUserSortColumns="False"
|
|
IsReadOnly="True"
|
|
HeadersVisibility="Column"
|
|
Focusable="False"
|
|
RowHeight="28"
|
|
ColumnHeaderHeight="24"
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto"
|
|
ClipboardCopyMode="None"
|
|
LayoutUpdated="OnCommitDataGridLayoutUpdated"
|
|
SelectionChanged="OnCommitDataGridSelectionChanged"
|
|
ContextRequested="OnCommitDataGridContextRequested"
|
|
DoubleTapped="OnCommitDataGridDoubleTapped"
|
|
KeyDown="OnCommitDataGridKeyDown">
|
|
<DataGrid.Styles>
|
|
<Style Selector="DataGridColumnHeader">
|
|
<Setter Property="MinHeight" Value="24"/>
|
|
<Setter Property="Margin" Value="0"/>
|
|
<Setter Property="Padding" Value="0"/>
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Background="{DynamicResource Brush.Window}"
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
BorderThickness="0,0,1,1">
|
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
Content="{TemplateBinding Content}"
|
|
HorizontalAlignment="Center"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
</DataGrid.Styles>
|
|
|
|
<DataGrid.Columns>
|
|
<DataGridTemplateColumn Width="*" CanUserResize="True">
|
|
<DataGridTemplateColumn.Header>
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.GraphAndSubject}"/>
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
<Border Margin="{Binding Margin}">
|
|
<StackPanel Orientation="Horizontal" Margin="2,0,0,0">
|
|
<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}"/>
|
|
|
|
<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"/>
|
|
|
|
<v:CommitSubjectPresenter Classes="primary"
|
|
Subject="{Binding Subject}"
|
|
IssueTrackerRules="{Binding $parent[v:Histories].IssueTrackerRules}"
|
|
Opacity="{Binding Opacity}"
|
|
FontWeight="{Binding FontWeight}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn CanUserResize="True" Width="120">
|
|
<DataGridTemplateColumn.Header>
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.Author}"/>
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
<Grid ColumnDefinitions="Auto,*" Margin="8,0">
|
|
<v:Avatar Grid.Column="0"
|
|
Width="16" Height="16"
|
|
VerticalAlignment="Center"
|
|
IsHitTestVisible="False"
|
|
User="{Binding Author}"
|
|
Opacity="{Binding Opacity}"/>
|
|
<TextBlock Grid.Column="1"
|
|
Classes="primary"
|
|
Text="{Binding Author.Name}"
|
|
Margin="8,0,0,0"
|
|
Opacity="{Binding Opacity}"
|
|
FontWeight="{Binding FontWeight}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn CanUserResize="False" MinWidth="96">
|
|
<DataGridTemplateColumn.Header>
|
|
<TextBlock Classes="table_header" Text="{DynamicResource Text.Histories.Header.SHA}"/>
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
<TextBlock Classes="primary"
|
|
Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
|
Margin="8,0"
|
|
HorizontalAlignment="Center"
|
|
Opacity="{Binding Opacity}"
|
|
FontWeight="{Binding FontWeight}"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn CanUserResize="False" MinWidth="156">
|
|
<DataGridTemplateColumn.Header>
|
|
<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="6,0,0,0" Text="{DynamicResource Text.Histories.Header.Time}"/>
|
|
</StackPanel>
|
|
|
|
</DataGridTemplateColumn.Header>
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
<v:CommitTimeTextBlock Classes="primary"
|
|
Margin="8,0"
|
|
HorizontalAlignment="Center"
|
|
Opacity="{Binding Opacity}"
|
|
FontWeight="{Binding FontWeight}"
|
|
Timestamp="{Binding CommitterTime}"
|
|
ShowAsDateTime="{Binding Source={x:Static vm:Preference.Instance}, Path=!DisplayTimeAsPeriodInHistories}"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
|
|
<v:CommitGraph x:Name="CommitGraph"
|
|
Graph="{Binding Graph}"
|
|
DotBrush="{DynamicResource Brush.Contents}"
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
|
IsHitTestVisible="False"
|
|
ClipToBounds="True"/>
|
|
|
|
<!-- Fix memory leak -->
|
|
<v:LoadingIcon Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/>
|
|
</Grid>
|
|
|
|
<GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
|
|
MinWidth="1" MinHeight="1"
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
|
Background="{DynamicResource Brush.Window}"
|
|
BorderBrush="{DynamicResource Brush.Border0}"/>
|
|
|
|
<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>
|
|
|
|
<ContentControl.DataTemplates>
|
|
<DataTemplate DataType="vm:CommitDetail">
|
|
<v:CommitDetail/>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate DataType="vm:RevisionCompare">
|
|
<v:RevisionCompare/>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate DataType="x:Int32">
|
|
<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 Converter={x:Static c:StringConverters.FormatByResourceKey}, ConverterParameter='Histories.Selected'}"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ContentControl.DataTemplates>
|
|
</ContentControl>
|
|
</Border>
|
|
</v:LayoutableGrid>
|
|
</UserControl>
|