2021-04-30 00:33:26 -07:00
|
|
|
<UserControl x:Class="SourceGit.Views.Widgets.RevisionFiles"
|
|
|
|
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"
|
|
|
|
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>
|
|
|
|
|
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="400"/>
|
|
|
|
<ColumnDefinition Width="1"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
2021-07-20 01:26:10 -07:00
|
|
|
<Border Grid.Column="0" Background="{DynamicResource Brush.Contents}" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1">
|
2021-08-04 22:44:25 -07:00
|
|
|
<controls:Tree x:Name="treeFiles" SelectionChanged="OnFilesSelectionChanged" ContextMenuOpening="OnFilesContextMenuOpening">
|
2021-04-30 00:33:26 -07:00
|
|
|
<controls:Tree.ItemTemplate>
|
|
|
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
|
|
|
<StackPanel Orientation="Horizontal" Height="24">
|
|
|
|
<Path x:Name="Icon" Width="14" Height="14" Data="{StaticResource Icon.File}"/>
|
2021-08-04 22:44:25 -07:00
|
|
|
<TextBlock Margin="6,0,0,0" Text="{Binding Path, Converter={StaticResource PureFileName}}"/>
|
2021-04-30 00:33:26 -07:00
|
|
|
</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"/>
|
|
|
|
|
2021-07-20 01:26:10 -07:00
|
|
|
<Border Grid.Column="2" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Margin="2,0">
|
2021-04-30 00:33:26 -07:00
|
|
|
<Grid>
|
|
|
|
<Grid x:Name="layerTextPreview" Visibility="Collapsed" SizeChanged="OnTextPreviewSizeChanged">
|
|
|
|
<DataGrid
|
|
|
|
x:Name="txtPreviewData"
|
|
|
|
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>
|
|
|
|
|
2021-07-20 01:26:10 -07:00
|
|
|
<Rectangle x:Name="txtPreviewSplitter" Width="1" Fill="{DynamicResource Brush.Border2}" HorizontalAlignment="Left"/>
|
2021-04-30 00:33:26 -07:00
|
|
|
</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">
|
2021-07-20 01:26:10 -07:00
|
|
|
<Path x:Name="iconRevisionPreview" Width="64" Height="64" Data="{StaticResource Icon.Submodule}" Fill="{DynamicResource Brush.FG2}"/>
|
2021-08-04 22:44:25 -07:00
|
|
|
<TextBlock x:Name="txtRevisionPreview" Margin="0,16,0,0" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
2021-04-30 00:33:26 -07:00
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<StackPanel
|
|
|
|
x:Name="layerBinaryPreview"
|
|
|
|
Orientation="Vertical"
|
|
|
|
VerticalAlignment="Center" HorizontalAlignment="Center"
|
|
|
|
Visibility="Collapsed">
|
2021-07-20 01:26:10 -07:00
|
|
|
<Path Width="64" Height="64" Data="{StaticResource Icon.Error}" Fill="{DynamicResource Brush.FG2}"/>
|
2021-08-04 22:44:25 -07:00
|
|
|
<TextBlock Margin="0,16,0,0" Text="{DynamicResource Text.BinaryNotSupported}" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
2021-04-30 00:33:26 -07:00
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|