mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
207 lines
12 KiB
XML
207 lines
12 KiB
XML
<UserControl x:Class="SourceGit.Views.Widgets.Histories"
|
|
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">
|
|
<Grid x:Name="layout">
|
|
<Grid.Resources>
|
|
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
<converters:InverseBool x:Key="InverseBool"/>
|
|
</Grid.Resources>
|
|
|
|
<Border x:Name="commitListPanel" Background="{DynamicResource Brush.Contents}">
|
|
<Grid ClipToBounds="True">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- SearchBar -->
|
|
<Grid Grid.Row="0" x:Name="searchBar" Margin="0,-32,0,0">
|
|
<controls:TextEdit
|
|
x:Name="txtSearch"
|
|
Margin="4" Padding="0,0,22,0"
|
|
Height="24"
|
|
Placeholder="{DynamicResource Text.Histories.Search}"
|
|
PreviewKeyDown="OnSearchPreviewKeyDown"/>
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="8,0">
|
|
<controls:IconButton
|
|
Click="ClearSearch"
|
|
Width="14" Height="14"
|
|
Icon="{StaticResource Icon.Clear}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
ToolTip="{DynamicResource Text.Histories.SearchClear}"/>
|
|
<controls:IconButton
|
|
Click="HideSearch"
|
|
Width="14" Height="14" Margin="6,0,0,0"
|
|
Icon="{StaticResource Icon.Up}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
ToolTip="{DynamicResource Text.Close}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<!-- Commit DataGrid -->
|
|
<DataGrid
|
|
Grid.Row="1"
|
|
x:Name="commitList"
|
|
RowHeight="24"
|
|
SelectionUnit="FullRow"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
ScrollViewer.ScrollChanged="OnCommitListScrolled"
|
|
SelectionChanged="OnCommitSelectionChanged"
|
|
KeyUp="OnCommitListKeyUp">
|
|
<DataGrid.Columns>
|
|
<DataGridTemplateColumn x:Name="graphColumn" Width="*" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal" Margin="{Binding Margin}">
|
|
<ItemsControl ItemsSource="{Binding Decorators}" Visibility="{Binding HasDecorators, Converter={StaticResource BoolToCollapsed}}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel 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="{DynamicResource Brush.Decorator}">
|
|
<Path x:Name="Icon" Margin="4,0" Width="8" Height="8" Data="{StaticResource Icon.Branch}" Fill="{DynamicResource Brush.DecoratorIcon}"/>
|
|
</Border>
|
|
|
|
<Border x:Name="Color" Background="#FFFFB835">
|
|
<TextBlock Text="{Binding Name}" FontSize="8pt" 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>
|
|
|
|
<TextBlock Text="{Binding Subject}" FontSize="13" Margin="2,0,0,0"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="32" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<controls:Avatar
|
|
Width="16" Height="16"
|
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
Email="{Binding Committer.Email}"
|
|
FallbackLabel="{Binding Committer.Name}"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="80" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Committer.Name}" Margin="0,0,8,0"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="72" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding ShortSHA}"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="140" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Committer.Time}" HorizontalAlignment="Right" Margin="0,0,4,0"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
</DataGrid.Columns>
|
|
|
|
<DataGrid.RowStyle>
|
|
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
|
<EventSetter Event="ContextMenuOpening" Handler="OnCommitContextMenuOpening"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsMerged}" Value="False">
|
|
<Setter Property="Opacity" Value=".5"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</DataGrid.RowStyle>
|
|
</DataGrid>
|
|
|
|
<!-- Commit Graph -->
|
|
<controls:CommitGraph Grid.Row="1" x:Name="graph" Width="{Binding ElementName=graphColumn, Path=ActualWidth}" HorizontalAlignment="Left"/>
|
|
|
|
<!-- Loading Tip -->
|
|
<controls:Loading Grid.Row="1" Width="48" Height="48" x:Name="loading" Visibility="Collapsed" Opacity=".4"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<GridSplitter x:Name="splitter" Background="{DynamicResource Brush.Border0}"/>
|
|
|
|
<Grid x:Name="inspector">
|
|
|
|
<!-- Commit Detail -->
|
|
<widgets:CommitDetail x:Name="commitDetail"/>
|
|
|
|
<!-- Differents Between Two Revisions -->
|
|
<widgets:RevisionCompare x:Name="revisionCompare"/>
|
|
|
|
<!-- Mask -->
|
|
<Border x:Name="mask" Background="{DynamicResource Brush.Window}">
|
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".25">
|
|
<Path Width="128" Height="128" Data="{StaticResource Icon.Detail}"/>
|
|
|
|
<TextBlock
|
|
x:Name="txtCounter"
|
|
Margin="0,16"
|
|
FontSize="24" FontWeight="UltraBold"
|
|
HorizontalAlignment="Center"
|
|
Text="{DynamicResource Text.Histories.Guide}"/>
|
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
|
<TextBlock Text="{DynamicResource Text.Histories.Guide_1}" FontSize="14" Margin="0,2"/>
|
|
<TextBlock Text="{DynamicResource Text.Histories.Guide_2}" FontSize="14" Margin="0,2"/>
|
|
<TextBlock Text="{DynamicResource Text.Histories.Guide_3}" FontSize="14" Margin="0,2"/>
|
|
<TextBlock Text="{DynamicResource Text.Histories.Guide_4}" FontSize="14" Margin="0,2"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Right Top Button -->
|
|
<ToggleButton
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Top"
|
|
Style="{StaticResource Style.ToggleButton.SplitDirection}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
Width="16" Height="16"
|
|
Margin="0,6,8,0"
|
|
ToolTip="{DynamicResource Text.Histories.DisplayMode}"
|
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.MoveCommitInfoRight, Mode=TwoWay, Converter={StaticResource InverseBool}}"
|
|
Checked="ChangeOrientation" Unchecked="ChangeOrientation"/>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|