mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
212 lines
12 KiB
XML
212 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"/>
|
|
</Grid.Resources>
|
|
|
|
<Border x:Name="commitListPanel" Background="{StaticResource 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="{StaticResource 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="{StaticResource Brush.FG2}"
|
|
ToolTip="{StaticResource Text.Histories.SearchClear}"/>
|
|
<controls:IconButton
|
|
Click="HideSearch"
|
|
Width="14" Height="14" Margin="6,0,0,0"
|
|
Icon="{StaticResource Icon.Up}"
|
|
Foreground="{StaticResource Brush.FG2}"
|
|
ToolTip="{StaticResource 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="{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>
|
|
|
|
<TextBlock Text="{Binding Subject}" 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="Auto" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Committer.Name}" Margin="0,0,8,0"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="64" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding ShortSHA}"/>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTemplateColumn Width="128" IsReadOnly="True">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Committer.Time}"/>
|
|
</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="{StaticResource 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="{StaticResource Brush.Window}">
|
|
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Opacity=".25">
|
|
<Path Width="128" Height="128" Data="{StaticResource Icon.Detail}"/>
|
|
<TextBlock x:Name="txtCounter" Visibility="Hidden" FontFamily="Consolas" Margin="0,16,0,0" FontSize="24" FontWeight="UltraBold" HorizontalAlignment="Center"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Right Top Button -->
|
|
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,6,0,0" Orientation="Horizontal">
|
|
<ToggleButton
|
|
Style="{StaticResource Style.ToggleButton.SplitDirection}"
|
|
Foreground="{StaticResource Brush.FG2}"
|
|
Width="14" Height="14"
|
|
ToolTip="{StaticResource Text.Histories.DisplayMode}"
|
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.MoveCommitInfoRight, Mode=TwoWay}"
|
|
Checked="ChangeOrientation" Unchecked="ChangeOrientation"/>
|
|
|
|
<controls:IconButton
|
|
Margin="8,0"
|
|
Width="16" Height="16"
|
|
ToolTip="{StaticResource Text.Histories.Guide}"
|
|
Icon="{StaticResource Icon.Help}"
|
|
Opacity=".4"
|
|
Click="OpenGuide"/>
|
|
|
|
<Popup x:Name="popupGuide" IsOpen="False" StaysOpen="False" Placement="Bottom">
|
|
<Border Background="{StaticResource Brush.Popup}" BorderThickness="1" BorderBrush="{StaticResource Brush.Border2}">
|
|
<StackPanel Orientation="Vertical" TextElement.FontFamily="Consolas" Margin="8">
|
|
<Label Content="{StaticResource Text.Histories.Guide}" FontWeight="Bold" FontSize="14" Margin="0,0,0,8"/>
|
|
<Label Content="{StaticResource Text.Histories.Guide_1}"/>
|
|
<Label Content="{StaticResource Text.Histories.Guide_2}"/>
|
|
<Label Content="{StaticResource Text.Histories.Guide_3}"/>
|
|
<Label Content="{StaticResource Text.Histories.Guide_4}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</Popup>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|