mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
345 lines
20 KiB
Text
345 lines
20 KiB
Text
|
<UserControl x:Class="SourceGit.Views.Widgets.CommitDetail"
|
||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||
|
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
||
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||
|
mc:Ignorable="d"
|
||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||
|
<UserControl.Resources>
|
||
|
<Style x:Key="Style.DataGridRow.TextPreview" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||
|
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
||
|
</Style>
|
||
|
<converters:PureFileName x:Key="PureFileName"/>
|
||
|
</UserControl.Resources>
|
||
|
|
||
|
<TabControl>
|
||
|
<TabItem Header="{StaticResource Text.CommitViewer.Info}">
|
||
|
<Grid>
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
<RowDefinition Height="*"/>
|
||
|
</Grid.RowDefinitions>
|
||
|
|
||
|
<!-- Author & Committer -->
|
||
|
<Grid Grid.Row="0" Margin="0,8">
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="96"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
<ColumnDefinition Width="96"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<!-- Author Avatar -->
|
||
|
<controls:Avatar
|
||
|
Grid.Column="0"
|
||
|
x:Name="avatarAuthor"
|
||
|
Width="64" Height="64"
|
||
|
HorizontalAlignment="Right"/>
|
||
|
|
||
|
<!-- Author Info -->
|
||
|
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
||
|
<TextBlock Text="{StaticResource Text.CommitViewer.Info.Author}" Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<StackPanel Orientation="Horizontal" Margin="0,12,0,8">
|
||
|
<controls:TextEdit x:Name="txtAuthorName" IsReadOnly="True" BorderThickness="0"/>
|
||
|
<controls:TextEdit x:Name="txtAuthorEmail" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0"/>
|
||
|
</StackPanel>
|
||
|
<controls:TextEdit x:Name="txtAuthorTime" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
|
||
|
</StackPanel>
|
||
|
|
||
|
<!-- Committer Avatar -->
|
||
|
<controls:Avatar
|
||
|
Grid.Column="2"
|
||
|
x:Name="avatarCommitter"
|
||
|
Width="64" Height="64"
|
||
|
HorizontalAlignment="Right"/>
|
||
|
|
||
|
<!-- Committer Info -->
|
||
|
<StackPanel x:Name="committerInfoPanel" Grid.Column="3" Margin="16,0,8,0" Orientation="Vertical">
|
||
|
<TextBlock Text="{StaticResource Text.CommitViewer.Info.Committer}" Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<StackPanel Orientation="Horizontal" Margin="0,12,0,6">
|
||
|
<controls:TextEdit x:Name="txtCommitterName" IsReadOnly="True" BorderThickness="0"/>
|
||
|
<controls:TextEdit x:Name="txtCommitterEmail" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0"/>
|
||
|
</StackPanel>
|
||
|
<controls:TextEdit x:Name="txtCommitterTime" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
|
||
|
</StackPanel>
|
||
|
</Grid>
|
||
|
|
||
|
<!-- Line -->
|
||
|
<Rectangle Grid.Row="1" Height="1" Margin="8" Fill="{StaticResource Brush.Border2}" VerticalAlignment="Center"/>
|
||
|
|
||
|
<!-- Base Information -->
|
||
|
<Grid Grid.Row="2">
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
<RowDefinition Height="Auto" x:Name="rowParents"/>
|
||
|
<RowDefinition Height="Auto" x:Name="rowRefs"/>
|
||
|
<RowDefinition Height="Auto"/>
|
||
|
</Grid.RowDefinitions>
|
||
|
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="96"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<!-- SHA -->
|
||
|
<TextBlock
|
||
|
Grid.Row="0" Grid.Column="0"
|
||
|
HorizontalAlignment="Right"
|
||
|
Text="{StaticResource Text.CommitViewer.Info.SHA}"
|
||
|
Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<controls:TextEdit
|
||
|
Grid.Row="0" Grid.Column="1"
|
||
|
Height="24"
|
||
|
x:Name="txtSHA"
|
||
|
IsReadOnly="True"
|
||
|
BorderThickness="0"
|
||
|
FontFamily="Consolas"
|
||
|
Margin="11,0,0,0"/>
|
||
|
|
||
|
<!-- PARENTS -->
|
||
|
<TextBlock
|
||
|
Grid.Row="1" Grid.Column="0"
|
||
|
HorizontalAlignment="Right"
|
||
|
Text="{StaticResource Text.CommitViewer.Info.Parents}"
|
||
|
Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<ItemsControl Grid.Row="1" Grid.Column="1" x:Name="listParents" Height="24" Margin="13,0,0,0">
|
||
|
<ItemsControl.ItemsPanel>
|
||
|
<ItemsPanelTemplate>
|
||
|
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||
|
</ItemsPanelTemplate>
|
||
|
</ItemsControl.ItemsPanel>
|
||
|
|
||
|
<ItemsControl.ItemTemplate>
|
||
|
<DataTemplate>
|
||
|
<TextBlock Margin="0,0,8,0" FontFamily="Consolas">
|
||
|
<Hyperlink RequestNavigate="OnNavigateParent" NavigateUri="{Binding .}" ToolTip="{StaticResource Text.Goto}">
|
||
|
<Run Text="{Binding .}"/>
|
||
|
</Hyperlink>
|
||
|
</TextBlock>
|
||
|
</DataTemplate>
|
||
|
</ItemsControl.ItemTemplate>
|
||
|
</ItemsControl>
|
||
|
|
||
|
<!-- REFS -->
|
||
|
<TextBlock
|
||
|
Grid.Row="2" Grid.Column="0"
|
||
|
HorizontalAlignment="Right"
|
||
|
Text="{StaticResource Text.CommitViewer.Info.Refs}"
|
||
|
Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<ItemsControl Grid.Row="2" Grid.Column="1" x:Name="listRefs" Height="24" Margin="11,0,0,0">
|
||
|
<ItemsControl.ItemsPanel>
|
||
|
<ItemsPanelTemplate>
|
||
|
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||
|
</ItemsPanelTemplate>
|
||
|
</ItemsControl.ItemsPanel>
|
||
|
|
||
|
<ItemsControl.ItemTemplate>
|
||
|
<DataTemplate DataType="{x:Type models:Decorator}">
|
||
|
<StackPanel Orientation="Horizontal" Height="16" Margin="2,0">
|
||
|
<Border Background="{StaticResource Brush.Decorator}">
|
||
|
<Path x:Name="Icon" Margin="4,0" Width="8" Height="8" Data="{StaticResource Icon.Branch}"/>
|
||
|
</Border>
|
||
|
|
||
|
<Border x:Name="Color" Background="#FFFFB835">
|
||
|
<TextBlock Text="{Binding Name}" FontSize="11" Margin="4,0" Foreground="Black"/>
|
||
|
</Border>
|
||
|
</StackPanel>
|
||
|
|
||
|
<DataTemplate.Triggers>
|
||
|
<DataTrigger Binding="{Binding Type}" Value="{x:Static models:DecoratorType.CurrentBranchHead}">
|
||
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Check}"/>
|
||
|
</DataTrigger>
|
||
|
<DataTrigger Binding="{Binding Type}" Value="{x:Static models:DecoratorType.RemoteBranchHead}">
|
||
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Remote}"/>
|
||
|
</DataTrigger>
|
||
|
<DataTrigger Binding="{Binding Type}" Value="{x:Static models:DecoratorType.Tag}">
|
||
|
<Setter TargetName="Color" Property="Background" Value="#FF02C302"/>
|
||
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Tag}"/>
|
||
|
</DataTrigger>
|
||
|
</DataTemplate.Triggers>
|
||
|
</DataTemplate>
|
||
|
</ItemsControl.ItemTemplate>
|
||
|
</ItemsControl>
|
||
|
|
||
|
<!-- Message -->
|
||
|
<TextBlock
|
||
|
Grid.Row="3" Grid.Column="0"
|
||
|
Margin="0,4,0,0"
|
||
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||
|
Text="{StaticResource Text.CommitViewer.Info.Message}"
|
||
|
Foreground="{StaticResource Brush.FG2}"/>
|
||
|
<controls:TextEdit
|
||
|
Grid.Row="3" Grid.Column="1"
|
||
|
x:Name="txtMessage"
|
||
|
IsReadOnly="true"
|
||
|
FontFamily="Consolas"
|
||
|
BorderThickness="0"
|
||
|
TextWrapping="Wrap"
|
||
|
Margin="11,5,16,0"
|
||
|
VerticalAlignment="Top"/>
|
||
|
</Grid>
|
||
|
|
||
|
<!-- Line -->
|
||
|
<Rectangle Grid.Row="3" Height="1" Margin="8" Fill="{StaticResource Brush.Border2}" VerticalAlignment="Center"/>
|
||
|
|
||
|
<!-- Change List -->
|
||
|
<Grid Grid.Row="4">
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="96"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<TextBlock
|
||
|
Grid.Column="0"
|
||
|
Margin="0,4,0,0"
|
||
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||
|
Text="{StaticResource Text.CommitViewer.Info.Changed}"
|
||
|
Foreground="{StaticResource Brush.FG2}"/>
|
||
|
|
||
|
<DataGrid
|
||
|
Grid.Column="1"
|
||
|
x:Name="changeList"
|
||
|
RowHeight="24"
|
||
|
Margin="11,0,0,2">
|
||
|
<DataGrid.RowStyle>
|
||
|
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow.TextPreview}">
|
||
|
<EventSetter Event="ContextMenuOpening" Handler="OnChangeListContextMenuOpening"/>
|
||
|
</Style>
|
||
|
</DataGrid.RowStyle>
|
||
|
<DataGrid.Columns>
|
||
|
<DataGridTemplateColumn Width="22" IsReadOnly="True">
|
||
|
<DataGridTemplateColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<controls:ChangeStatusIcon Width="14" Height="14" IsLocalChange="False" Change="{Binding}"/>
|
||
|
</DataTemplate>
|
||
|
</DataGridTemplateColumn.CellTemplate>
|
||
|
</DataGridTemplateColumn>
|
||
|
<DataGridTemplateColumn Width="*" IsReadOnly="True">
|
||
|
<DataGridTemplateColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<TextBlock FontFamily="Consolas" Margin="2,0,0,0" Text="{Binding Path}"/>
|
||
|
</DataTemplate>
|
||
|
</DataGridTemplateColumn.CellTemplate>
|
||
|
</DataGridTemplateColumn>
|
||
|
</DataGrid.Columns>
|
||
|
</DataGrid>
|
||
|
</Grid>
|
||
|
</Grid>
|
||
|
</TabItem>
|
||
|
|
||
|
<!-- Change Details -->
|
||
|
<TabItem Header="{StaticResource Text.CommitViewer.Changes}">
|
||
|
<widgets:CommitChanges x:Name="changeContainer"/>
|
||
|
</TabItem>
|
||
|
|
||
|
<!-- Revision Files -->
|
||
|
<TabItem Header="{StaticResource Text.CommitViewer.Files}">
|
||
|
<Grid>
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="400"/>
|
||
|
<ColumnDefinition Width="1"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<Border Grid.Column="0" Background="{StaticResource Brush.Contents}" BorderBrush="{StaticResource Brush.Border2}" BorderThickness="1">
|
||
|
<controls:Tree
|
||
|
x:Name="treeFiles"
|
||
|
FontFamily="Consolas"
|
||
|
SelectionChanged="OnFilesSelectionChanged"
|
||
|
ContextMenuOpening="OnFilesContextMenuOpening">
|
||
|
<controls:Tree.ItemTemplate>
|
||
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||
|
<StackPanel Orientation="Horizontal" Height="24">
|
||
|
<Path x:Name="Icon" Width="14" Height="14" Data="{StaticResource Icon.File}"/>
|
||
|
<TextBlock Margin="6,0,0,0" FontSize="11" Text="{Binding Path, Converter={StaticResource PureFileName}}"/>
|
||
|
</StackPanel>
|
||
|
|
||
|
<HierarchicalDataTemplate.Triggers>
|
||
|
<DataTrigger Binding="{Binding IsFolder}" Value="True">
|
||
|
<Setter TargetName="Icon" Property="Fill" Value="Goldenrod"/>
|
||
|
<Setter TargetName="Icon" Property="Opacity" Value="1"/>
|
||
|
</DataTrigger>
|
||
|
<MultiDataTrigger>
|
||
|
<MultiDataTrigger.Conditions>
|
||
|
<Condition Binding="{Binding IsFolder}" Value="True"/>
|
||
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}, Path=IsExpanded}" Value="False"/>
|
||
|
</MultiDataTrigger.Conditions>
|
||
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
|
||
|
</MultiDataTrigger>
|
||
|
<MultiDataTrigger>
|
||
|
<MultiDataTrigger.Conditions>
|
||
|
<Condition Binding="{Binding IsFolder}" Value="True"/>
|
||
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}, Path=IsExpanded}" Value="True"/>
|
||
|
</MultiDataTrigger.Conditions>
|
||
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
||
|
</MultiDataTrigger>
|
||
|
</HierarchicalDataTemplate.Triggers>
|
||
|
</HierarchicalDataTemplate>
|
||
|
</controls:Tree.ItemTemplate>
|
||
|
</controls:Tree>
|
||
|
</Border>
|
||
|
|
||
|
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="Transparent"/>
|
||
|
|
||
|
<Border Grid.Column="2" BorderBrush="{StaticResource Brush.Border2}" BorderThickness="1" Margin="2,0">
|
||
|
<Grid>
|
||
|
<Grid x:Name="layerTextPreview" Visibility="Collapsed" SizeChanged="OnTextPreviewSizeChanged">
|
||
|
<DataGrid
|
||
|
x:Name="txtPreviewData"
|
||
|
FontFamily="Consolas"
|
||
|
RowHeight="16"
|
||
|
RowStyle="{StaticResource Style.DataGridRow.TextPreview}"
|
||
|
FrozenColumnCount="1"
|
||
|
ContextMenuOpening="OnTextPreviewContextMenuOpening"
|
||
|
SelectionMode="Extended"
|
||
|
SelectionUnit="FullRow">
|
||
|
<DataGrid.Columns>
|
||
|
<DataGridTextColumn Binding="{Binding Number}" ElementStyle="{StaticResource Style.TextBlock.LineNumber}"/>
|
||
|
<DataGridTextColumn Binding="{Binding Data}" ElementStyle="{StaticResource Style.TextBlock.LineContent}"/>
|
||
|
</DataGrid.Columns>
|
||
|
</DataGrid>
|
||
|
|
||
|
<Rectangle x:Name="txtPreviewSplitter" Width="1" Fill="{StaticResource Brush.Border2}" HorizontalAlignment="Left"/>
|
||
|
</Grid>
|
||
|
|
||
|
<ScrollViewer
|
||
|
x:Name="layerImagePreview"
|
||
|
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
|
||
|
Visibility="Collapsed">
|
||
|
<Image
|
||
|
x:Name="imgPreviewData"
|
||
|
Width="Auto" Height="Auto"
|
||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||
|
</ScrollViewer>
|
||
|
|
||
|
<StackPanel
|
||
|
x:Name="layerRevisionPreview"
|
||
|
Orientation="Vertical"
|
||
|
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||
|
Visibility="Collapsed">
|
||
|
<Path x:Name="iconRevisionPreview" Width="64" Height="64" Data="{StaticResource Icon.Submodule}" Fill="{StaticResource Brush.FG2}"/>
|
||
|
<TextBlock x:Name="txtRevisionPreview" Margin="0,16,0,0" FontFamily="Consolas" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
|
||
|
</StackPanel>
|
||
|
|
||
|
<StackPanel
|
||
|
x:Name="layerBinaryPreview"
|
||
|
Orientation="Vertical"
|
||
|
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||
|
Visibility="Collapsed">
|
||
|
<Path Width="64" Height="64" Data="{StaticResource Icon.Error}" Fill="{StaticResource Brush.FG2}"/>
|
||
|
<TextBlock Margin="0,16,0,0" Text="{StaticResource Text.BinaryNotSupported}" FontFamily="Consolas" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
|
||
|
</StackPanel>
|
||
|
</Grid>
|
||
|
</Border>
|
||
|
</Grid>
|
||
|
</TabItem>
|
||
|
</TabControl>
|
||
|
</UserControl>
|