2024-02-05 23:08:37 -08:00
|
|
|
<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:ae="using:AvaloniaEdit"
|
|
|
|
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.RevisionFiles"
|
|
|
|
x:DataType="vm:CommitDetail">
|
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="256" MinWidth="200" MaxWidth="480"/>
|
|
|
|
<ColumnDefinition Width="1"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
<Grid Grid.Column="0" RowDefinitions="26,*">
|
|
|
|
<!-- Search -->
|
2024-03-11 03:54:12 -07:00
|
|
|
<TextBox Grid.Row="0"
|
|
|
|
FontSize="12"
|
|
|
|
Height="26"
|
|
|
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
|
|
|
Background="Transparent"
|
|
|
|
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
|
|
|
Text="{Binding SearchFileFilter, Mode=TwoWay}">
|
|
|
|
<TextBox.InnerLeftContent>
|
|
|
|
<Path Width="14" Height="14" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Search}"/>
|
|
|
|
</TextBox.InnerLeftContent>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-03-11 03:54:12 -07:00
|
|
|
<TextBox.InnerRightContent>
|
|
|
|
<Button Classes="icon_button"
|
|
|
|
IsVisible="{Binding SearchFileFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
|
|
|
Command="{Binding ClearSearchFileFilter}">
|
|
|
|
<Path Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Clear}"/>
|
|
|
|
</Button>
|
|
|
|
</TextBox.InnerRightContent>
|
|
|
|
</TextBox>
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
<!-- File Tree -->
|
|
|
|
<Border Grid.Row="1" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}">
|
|
|
|
<TreeView Grid.Row="5"
|
|
|
|
ItemsSource="{Binding RevisionFilesTree}"
|
|
|
|
SelectedItem="{Binding SelectedRevisionFileNode, Mode=TwoWay}"
|
|
|
|
AutoScrollToSelectedItem="True"
|
|
|
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
|
|
ContextRequested="OnTreeViewContextRequested">
|
|
|
|
<TreeView.Styles>
|
|
|
|
<Style Selector="TreeViewItem" x:DataType="vm:FileTreeNode">
|
|
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
|
|
|
</Style>
|
|
|
|
</TreeView.Styles>
|
|
|
|
|
|
|
|
<TreeView.ItemTemplate>
|
|
|
|
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:FileTreeNode}">
|
|
|
|
<Grid Height="24" ColumnDefinitions="Auto,*">
|
|
|
|
<Path Grid.Column="0" Classes="folder_icon" Width="14" Height="14" Margin="0,2,0,0" IsVisible="{Binding IsFolder}" Fill="Goldenrod" VerticalAlignment="Center"/>
|
|
|
|
<Path Grid.Column="0" Width="14" Height="14" IsVisible="{Binding !IsFolder}" Data="{StaticResource Icons.File}" VerticalAlignment="Center"/>
|
2024-03-04 23:53:38 -08:00
|
|
|
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}}" FontSize="12" Margin="6,0,0,0"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Grid>
|
|
|
|
</TreeDataTemplate>
|
|
|
|
</TreeView.ItemTemplate>
|
|
|
|
</TreeView>
|
|
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<GridSplitter Grid.Column="1"
|
|
|
|
Width="1" MinWidth=".5"
|
|
|
|
HorizontalAlignment="Center" VerticalAlignment="Stretch"
|
|
|
|
Background="Transparent"/>
|
|
|
|
|
|
|
|
<!-- File Content Viewer -->
|
|
|
|
<Grid Grid.Column="2" Margin="4,0,0,0">
|
|
|
|
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
|
|
|
<ContentControl Content="{Binding ViewRevisionFileContent}">
|
|
|
|
<ContentControl.DataTemplates>
|
|
|
|
<DataTemplate DataType="m:RevisionBinaryFile">
|
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
|
|
<Path Width="64" Height="64" Data="{StaticResource Icons.Error}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<TextBlock Margin="0,16,0,0" Text="{DynamicResource Text.BinaryNotSupported}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
2024-03-13 20:59:56 -07:00
|
|
|
<StackPanel Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
|
|
|
|
<TextBlock Classes="monospace" Text="{Binding Size}" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
<TextBlock Text="{DynamicResource Text.Bytes}" Margin="8,0,0,0" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
</StackPanel>
|
2024-02-05 23:08:37 -08:00
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="m:RevisionTextFile">
|
2024-03-21 03:02:06 -07:00
|
|
|
<v:RevisionTextFileView FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont, Converter={x:Static c:StringConverters.ToFontFamily}}" FontSize="12" Background="{DynamicResource Brush.Contents}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="m:RevisionLFSObject">
|
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
|
|
<TextBlock Text="{DynamicResource Text.CommitDetail.Files.LFS}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
<Path Width="64" Height="64" Margin="0,24,0,0" Data="{StaticResource Icons.LFS}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<SelectableTextBlock Margin="0,16,0,0" Text="{Binding Object.Oid}" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
<StackPanel Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
|
2024-03-04 23:53:38 -08:00
|
|
|
<TextBlock Classes="monospace" Text="{Binding Object.Size}" Foreground="{DynamicResource Brush.FG2}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
<TextBlock Text="{DynamicResource Text.Bytes}" Margin="8,0,0,0" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
</StackPanel>
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<DataTemplate DataType="m:RevisionSubmodule">
|
|
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
|
|
<TextBlock Text="{DynamicResource Text.CommitDetail.Files.Submodule}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
<Path Width="64" Height="64" Margin="0,16,0,0" Data="{StaticResource Icons.Submodule}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
<SelectableTextBlock Margin="0,16,0,0" Text="{Binding SHA}" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
</ContentControl.DataTemplates>
|
|
|
|
</ContentControl>
|
|
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|