mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
ux: more flex layout for left siderbar groups
This commit is contained in:
parent
3ce580b682
commit
8faa8c7378
4 changed files with 480 additions and 394 deletions
|
@ -24,7 +24,6 @@ namespace SourceGit.ViewModels
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public BranchTreeNodeType Type { get; set; }
|
public BranchTreeNodeType Type { get; set; }
|
||||||
public object Backend { get; set; }
|
public object Backend { get; set; }
|
||||||
public bool IsExpanded { get; set; }
|
|
||||||
public bool IsFiltered { get; set; }
|
public bool IsFiltered { get; set; }
|
||||||
public List<BranchTreeNode> Children { get; set; } = new List<BranchTreeNode>();
|
public List<BranchTreeNode> Children { get; set; } = new List<BranchTreeNode>();
|
||||||
|
|
||||||
|
@ -69,6 +68,12 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _isSelected, value);
|
set => SetProperty(ref _isSelected, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsExpanded
|
||||||
|
{
|
||||||
|
get => _isExpanded;
|
||||||
|
set => SetProperty(ref _isExpanded, value);
|
||||||
|
}
|
||||||
|
|
||||||
public string Tooltip
|
public string Tooltip
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -108,7 +113,9 @@ namespace SourceGit.ViewModels
|
||||||
child.UpdateCornerRadius(ref prev);
|
child.UpdateCornerRadius(ref prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _isSelected = false;
|
private bool _isSelected = false;
|
||||||
|
private bool _isExpanded = false;
|
||||||
private CornerRadius _cornerRadius = new CornerRadius(DEFAULT_CORNER);
|
private CornerRadius _cornerRadius = new CornerRadius(DEFAULT_CORNER);
|
||||||
|
|
||||||
public class Builder
|
public class Builder
|
||||||
|
|
|
@ -271,6 +271,18 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _searchedCommits, value);
|
set => SetProperty(ref _searchedCommits, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsLocalBranchGroupExpanded
|
||||||
|
{
|
||||||
|
get => _isLocalBranchGroupExpanded;
|
||||||
|
set => SetProperty(ref _isLocalBranchGroupExpanded, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRemoteGroupExpanded
|
||||||
|
{
|
||||||
|
get => _isRemoteGroupExpanded;
|
||||||
|
set => SetProperty(ref _isRemoteGroupExpanded, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsTagGroupExpanded
|
public bool IsTagGroupExpanded
|
||||||
{
|
{
|
||||||
get => _isTagGroupExpanded;
|
get => _isTagGroupExpanded;
|
||||||
|
@ -355,14 +367,7 @@ namespace SourceGit.ViewModels
|
||||||
_histories = null;
|
_histories = null;
|
||||||
_workingCopy = null;
|
_workingCopy = null;
|
||||||
_stashesPage = null;
|
_stashesPage = null;
|
||||||
_isSearching = false;
|
|
||||||
_searchCommitFilter = string.Empty;
|
|
||||||
|
|
||||||
_isTagGroupExpanded = false;
|
|
||||||
_isSubmoduleGroupExpanded = false;
|
|
||||||
|
|
||||||
_inProgressContext = null;
|
_inProgressContext = null;
|
||||||
_hasUnsolvedConflicts = false;
|
|
||||||
|
|
||||||
_remotes.Clear();
|
_remotes.Clear();
|
||||||
_branches.Clear();
|
_branches.Clear();
|
||||||
|
@ -1941,6 +1946,8 @@ namespace SourceGit.ViewModels
|
||||||
private string _searchCommitFilter = string.Empty;
|
private string _searchCommitFilter = string.Empty;
|
||||||
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
||||||
|
|
||||||
|
private bool _isLocalBranchGroupExpanded = true;
|
||||||
|
private bool _isRemoteGroupExpanded = false;
|
||||||
private bool _isTagGroupExpanded = false;
|
private bool _isTagGroupExpanded = false;
|
||||||
private bool _isSubmoduleGroupExpanded = false;
|
private bool _isSubmoduleGroupExpanded = false;
|
||||||
private bool _isWorktreeGroupExpanded = false;
|
private bool _isWorktreeGroupExpanded = false;
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Dashboard -->
|
<!-- Dashboard -->
|
||||||
<Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,28,Auto,28,*,28,Auto,28,Auto,28,Auto" IsVisible="{Binding !IsSearching}">
|
<Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,*" IsVisible="{Binding !IsSearching}">
|
||||||
<!-- Page Switcher for Right Panel -->
|
<!-- Page Switcher for Right Panel -->
|
||||||
<Border Grid.Row="0" Margin="8,0,4,0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" CornerRadius="6">
|
<Border Grid.Row="0" Margin="8,0,4,0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}" CornerRadius="6">
|
||||||
<Border CornerRadius="6" ClipToBounds="True">
|
<Border CornerRadius="6" ClipToBounds="True">
|
||||||
|
@ -231,402 +231,409 @@
|
||||||
</TextBox.InnerRightContent>
|
</TextBox.InnerRightContent>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<!-- Local Branches -->
|
<Grid Grid.Row="2" RowDefinitions="28,Auto,28,Auto,28,Auto,28,Auto,28,Auto" LayoutUpdated="OnDashboardLayoutUpdated">
|
||||||
<TextBlock Grid.Row="2" Classes="group_header_label" Text="{DynamicResource Text.Repository.LocalBranches}"/>
|
<!-- Local Branches -->
|
||||||
<TreeView Grid.Row="3"
|
<ToggleButton Grid.Row="0" Classes="group_expander" IsChecked="{Binding IsLocalBranchGroupExpanded, Mode=TwoWay}">
|
||||||
x:Name="localBranchTree"
|
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.LocalBranches}"/>
|
||||||
MaxHeight="400"
|
</ToggleButton>
|
||||||
Margin="8,0,4,0"
|
<TreeView Grid.Row="1"
|
||||||
SelectionMode="Multiple"
|
x:Name="localBranchTree"
|
||||||
ItemsSource="{Binding LocalBranchTrees}"
|
Margin="8,0,4,0"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
SelectionMode="Multiple"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
ItemsSource="{Binding LocalBranchTrees}"
|
||||||
ContextRequested="OnLocalBranchContextMenuRequested"
|
IsVisible="{Binding IsLocalBranchGroupExpanded}"
|
||||||
SelectionChanged="OnLocalBranchTreeSelectionChanged">
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
<TreeView.Styles>
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
<Style Selector="TreeViewItem" x:DataType="vm:BranchTreeNode">
|
ContextRequested="OnLocalBranchContextMenuRequested"
|
||||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
SelectionChanged="OnLocalBranchTreeSelectionChanged">
|
||||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
|
<TreeView.Styles>
|
||||||
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
<Style Selector="TreeViewItem" x:DataType="vm:BranchTreeNode">
|
||||||
</Style>
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||||
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
|
||||||
|
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="Grid.repository_leftpanel TreeViewItem /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
<Style Selector="Grid.repository_leftpanel TreeViewItem /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
<Setter Property="Opacity" Value=".65"/>
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Grid.repository_leftpanel TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
<Style Selector="Grid.repository_leftpanel TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
<Setter Property="Opacity" Value="1"/>
|
<Setter Property="Opacity" Value="1"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
<Setter Property="Opacity" Value=".65"/>
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
<Setter Property="Opacity" Value=".8"/>
|
<Setter Property="Opacity" Value=".8"/>
|
||||||
</Style>
|
</Style>
|
||||||
</TreeView.Styles>
|
</TreeView.Styles>
|
||||||
<TreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
||||||
<Grid Height="24" ColumnDefinitions="20,*,Auto,Auto" Background="Transparent" DoubleTapped="OnDoubleTappedBranchNode" ToolTip.Tip="{Binding Tooltip}">
|
<Grid Height="24" ColumnDefinitions="20,*,Auto,Auto" Background="Transparent" DoubleTapped="OnDoubleTappedBranchNode" ToolTip.Tip="{Binding Tooltip}">
|
||||||
<Path Grid.Column="0" Classes="folder_icon" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,1,0,0" IsVisible="{Binding IsFolder}"/>
|
<Path Grid.Column="0" Classes="folder_icon" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,1,0,0" IsVisible="{Binding IsFolder}"/>
|
||||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,2,0,0" Data="{StaticResource Icons.Check}" IsVisible="{Binding IsCurrent}" VerticalAlignment="Center"/>
|
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,2,0,0" Data="{StaticResource Icons.Check}" IsVisible="{Binding IsCurrent}" VerticalAlignment="Center"/>
|
||||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="2,0,0,0" Data="{StaticResource Icons.Branch}" VerticalAlignment="Center">
|
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="2,0,0,0" Data="{StaticResource Icons.Branch}" VerticalAlignment="Center">
|
||||||
<Path.IsVisible>
|
<Path.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="!IsFolder"/>
|
<Binding Path="!IsFolder"/>
|
||||||
<Binding Path="!IsCurrent"/>
|
<Binding Path="!IsCurrent"/>
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Path.IsVisible>
|
</Path.IsVisible>
|
||||||
</Path>
|
</Path>
|
||||||
|
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Text="{Binding Name}"
|
Text="{Binding Name}"
|
||||||
Classes="monospace"
|
Classes="monospace"
|
||||||
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.BoldIfTrue}}"/>
|
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.BoldIfTrue}}"/>
|
||||||
|
|
||||||
<Border Grid.Column="2" Margin="8,0" Height="18" CornerRadius="9" VerticalAlignment="Center" Background="{DynamicResource Brush.Badge}" IsVisible="{Binding IsUpstreamTrackStatusVisible}">
|
<Border Grid.Column="2" Margin="8,0" Height="18" CornerRadius="9" VerticalAlignment="Center" Background="{DynamicResource Brush.Badge}" IsVisible="{Binding IsUpstreamTrackStatusVisible}">
|
||||||
<TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding UpstreamTrackStatus}" Foreground="{DynamicResource Brush.BadgeFG}"/>
|
<TextBlock Classes="monospace" FontSize="10" HorizontalAlignment="Center" Margin="9,0" Text="{Binding UpstreamTrackStatus}" Foreground="{DynamicResource Brush.BadgeFG}"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<ToggleButton Grid.Column="3"
|
<ToggleButton Grid.Column="3"
|
||||||
Classes="filter"
|
Classes="filter"
|
||||||
Margin="0,0,8,0"
|
|
||||||
Background="Transparent"
|
|
||||||
IsVisible="{Binding IsBranch}"
|
|
||||||
Checked="OnToggleFilter"
|
|
||||||
Unchecked="OnToggleFilter"
|
|
||||||
IsChecked="{Binding IsFiltered}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
|
||||||
</Grid>
|
|
||||||
</TreeDataTemplate>
|
|
||||||
</TreeView.ItemTemplate>
|
|
||||||
</TreeView>
|
|
||||||
|
|
||||||
<!-- Remotes -->
|
|
||||||
<Grid Grid.Row="4" ColumnDefinitions="*,Auto">
|
|
||||||
<TextBlock Grid.Column="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.Remotes}"/>
|
|
||||||
<Button Grid.Column="1" Classes="icon_button" Width="14" Margin="8,0" Command="{Binding AddRemote}" ToolTip.Tip="{DynamicResource Text.Repository.Remotes.Add}">
|
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Remote.Add}"/>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
<TreeView Grid.Row="5"
|
|
||||||
x:Name="remoteBranchTree"
|
|
||||||
Margin="8,0,4,0"
|
|
||||||
SelectionMode="Multiple"
|
|
||||||
ItemsSource="{Binding RemoteBranchTrees}"
|
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
||||||
ContextRequested="OnRemoteBranchContextMenuRequested"
|
|
||||||
SelectionChanged="OnRemoteBranchTreeSelectionChanged">
|
|
||||||
<TreeView.Styles>
|
|
||||||
<Style Selector="TreeViewItem" x:DataType="vm:BranchTreeNode">
|
|
||||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
|
||||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
|
|
||||||
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="Grid.repository_leftpanel TreeViewItem /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
<Setter Property="Opacity" Value=".65"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
<Setter Property="Opacity" Value="1"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="Opacity" Value=".65"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="Opacity" Value=".8"/>
|
|
||||||
</Style>
|
|
||||||
</TreeView.Styles>
|
|
||||||
|
|
||||||
<TreeView.ItemTemplate>
|
|
||||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
|
||||||
<Grid Height="24" ColumnDefinitions="20,*,Auto" Background="Transparent" DoubleTapped="OnDoubleTappedBranchNode" ToolTip.Tip="{Binding Tooltip}">
|
|
||||||
<Path Grid.Column="0" Classes="folder_icon" Width="10" Height="10" HorizontalAlignment="Left" Margin="0,2,0,0" IsVisible="{Binding IsFolder}" VerticalAlignment="Center"/>
|
|
||||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,2,0,0" Data="{StaticResource Icons.Remote}" IsVisible="{Binding IsRemote}" VerticalAlignment="Center"/>
|
|
||||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="2,0,0,0" Data="{StaticResource Icons.Branch}" IsVisible="{Binding IsBranch}" VerticalAlignment="Center"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Classes="monospace"/>
|
|
||||||
|
|
||||||
<ToggleButton Grid.Column="2"
|
|
||||||
Classes="filter"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Background="Transparent"
|
|
||||||
Checked="OnToggleFilter"
|
|
||||||
Unchecked="OnToggleFilter"
|
|
||||||
IsVisible="{Binding IsBranch}"
|
|
||||||
IsChecked="{Binding IsFiltered}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
|
||||||
</Grid>
|
|
||||||
</TreeDataTemplate>
|
|
||||||
</TreeView.ItemTemplate>
|
|
||||||
</TreeView>
|
|
||||||
|
|
||||||
<!-- Tags -->
|
|
||||||
<ToggleButton Grid.Row="6" Classes="group_expander" IsChecked="{Binding IsTagGroupExpanded, Mode=TwoWay}">
|
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
|
||||||
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Tags}"/>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Tags, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
|
||||||
<Button Grid.Column="2" Classes="icon_button" Width="14" Margin="8,0" Command="{Binding CreateNewTag}" ToolTip.Tip="{DynamicResource Text.Repository.Tags.Add}">
|
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Tag.Add}"/>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</ToggleButton>
|
|
||||||
<DataGrid Grid.Row="7"
|
|
||||||
x:Name="tagsList"
|
|
||||||
Margin="8,0,4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
ItemsSource="{Binding VisibleTags}"
|
|
||||||
SelectionMode="Single"
|
|
||||||
CanUserReorderColumns="False"
|
|
||||||
CanUserResizeColumns="False"
|
|
||||||
CanUserSortColumns="False"
|
|
||||||
IsReadOnly="True"
|
|
||||||
HeadersVisibility="None"
|
|
||||||
Focusable="False"
|
|
||||||
RowHeight="24"
|
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
IsVisible="{Binding IsTagGroupExpanded, Mode=OneWay}"
|
|
||||||
SelectionChanged="OnTagDataGridSelectionChanged"
|
|
||||||
ContextRequested="OnTagContextRequested"
|
|
||||||
PropertyChanged="OnTagPropertyChanged">
|
|
||||||
<DataGrid.Styles>
|
|
||||||
<Style Selector="DataGridRow">
|
|
||||||
<Setter Property="CornerRadius" Value="4" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="Grid.repository_leftpanel DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
<Setter Property="Opacity" Value=".5"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
<Setter Property="Opacity" Value="1"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="Opacity" Value=".65"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="Opacity" Value=".8"/>
|
|
||||||
</Style>
|
|
||||||
</DataGrid.Styles>
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTemplateColumn Header="ICON">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate x:DataType="{x:Type m:Tag}">
|
|
||||||
<Path Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Tag}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="*" Header="NAME">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate x:DataType="{x:Type m:Tag}">
|
|
||||||
<TextBlock Text="{Binding Name}" Classes="monospace" TextTrimming="CharacterEllipsis" />
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTemplateColumn Header="FILTER">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate x:DataType="{x:Type m:Tag}">
|
|
||||||
<ToggleButton Classes="filter"
|
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
|
IsVisible="{Binding IsBranch}"
|
||||||
Checked="OnToggleFilter"
|
Checked="OnToggleFilter"
|
||||||
Unchecked="OnToggleFilter"
|
Unchecked="OnToggleFilter"
|
||||||
IsChecked="{Binding IsFiltered}"
|
IsChecked="{Binding IsFiltered}"
|
||||||
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
||||||
</DataTemplate>
|
</Grid>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</TreeDataTemplate>
|
||||||
</DataGridTemplateColumn>
|
</TreeView.ItemTemplate>
|
||||||
</DataGrid.Columns>
|
</TreeView>
|
||||||
</DataGrid>
|
|
||||||
|
|
||||||
<!-- Submodules -->
|
<!-- Remotes -->
|
||||||
<ToggleButton Grid.Row="8" Classes="group_expander" IsChecked="{Binding IsSubmoduleGroupExpanded, Mode=TwoWay}">
|
<ToggleButton Grid.Row="2" Classes="group_expander" IsChecked="{Binding IsRemoteGroupExpanded, Mode=TwoWay}">
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Submodules}"/>
|
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Remotes}"/>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Submodules, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
<Button Grid.Column="1" Classes="icon_button" Width="14" Margin="8,0" Command="{Binding AddRemote}" ToolTip.Tip="{DynamicResource Text.Repository.Remotes.Add}">
|
||||||
<Button Grid.Column="2"
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Remote.Add}"/>
|
||||||
Classes="icon_button"
|
</Button>
|
||||||
Width="14"
|
</Grid>
|
||||||
Margin="8,0"
|
</ToggleButton>
|
||||||
Command="{Binding UpdateSubmodules}"
|
<TreeView Grid.Row="3"
|
||||||
IsVisible="{Binding Submodules, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"
|
x:Name="remoteBranchTree"
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.Submodules.Update}">
|
Margin="8,0,4,0"
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Loading}"/>
|
SelectionMode="Multiple"
|
||||||
</Button>
|
ItemsSource="{Binding RemoteBranchTrees}"
|
||||||
<Button Grid.Column="3"
|
IsVisible="{Binding IsRemoteGroupExpanded}"
|
||||||
Classes="icon_button"
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
Width="14"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
Margin="0,0,8,0"
|
ContextRequested="OnRemoteBranchContextMenuRequested"
|
||||||
Command="{Binding AddSubmodule}"
|
SelectionChanged="OnRemoteBranchTreeSelectionChanged">
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.Submodules.Add}">
|
<TreeView.Styles>
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Submodule.Add}"/>
|
<Style Selector="TreeViewItem" x:DataType="vm:BranchTreeNode">
|
||||||
</Button>
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||||
</Grid>
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
|
||||||
</ToggleButton>
|
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
||||||
<DataGrid Grid.Row="9"
|
</Style>
|
||||||
MaxHeight="200"
|
|
||||||
Margin="8,0,4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
ItemsSource="{Binding Submodules}"
|
|
||||||
SelectionMode="Single"
|
|
||||||
CanUserReorderColumns="False"
|
|
||||||
CanUserResizeColumns="False"
|
|
||||||
CanUserSortColumns="False"
|
|
||||||
IsReadOnly="True"
|
|
||||||
HeadersVisibility="None"
|
|
||||||
Focusable="False"
|
|
||||||
RowHeight="26"
|
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
ContextRequested="OnSubmoduleContextRequested"
|
|
||||||
DoubleTapped="OnDoubleTappedSubmodule"
|
|
||||||
IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">
|
|
||||||
<DataGrid.Styles>
|
|
||||||
<Style Selector="DataGridRow">
|
|
||||||
<Setter Property="CornerRadius" Value="4" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
<Style Selector="Grid.repository_leftpanel TreeViewItem /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
</Style>
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot:pointerover Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".8"/>
|
||||||
|
</Style>
|
||||||
|
</TreeView.Styles>
|
||||||
|
|
||||||
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
<TreeView.ItemTemplate>
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
||||||
</Style>
|
<Grid Height="24" ColumnDefinitions="20,*,Auto" Background="Transparent" DoubleTapped="OnDoubleTappedBranchNode" ToolTip.Tip="{Binding Tooltip}">
|
||||||
|
<Path Grid.Column="0" Classes="folder_icon" Width="10" Height="10" HorizontalAlignment="Left" Margin="0,2,0,0" IsVisible="{Binding IsFolder}" VerticalAlignment="Center"/>
|
||||||
|
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="0,2,0,0" Data="{StaticResource Icons.Remote}" IsVisible="{Binding IsRemote}" VerticalAlignment="Center"/>
|
||||||
|
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Margin="2,0,0,0" Data="{StaticResource Icons.Branch}" IsVisible="{Binding IsBranch}" VerticalAlignment="Center"/>
|
||||||
|
|
||||||
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
<TextBlock Grid.Column="1" Text="{Binding Name}" Classes="monospace"/>
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
</Style>
|
|
||||||
</DataGrid.Styles>
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
<ToggleButton Grid.Column="2"
|
||||||
<DataGridTemplateColumn Header="ICON">
|
Classes="filter"
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
Margin="0,0,8,0"
|
||||||
<DataTemplate>
|
Background="Transparent"
|
||||||
<Path Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Submodule}"/>
|
Checked="OnToggleFilter"
|
||||||
</DataTemplate>
|
Unchecked="OnToggleFilter"
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
IsVisible="{Binding IsBranch}"
|
||||||
</DataGridTemplateColumn>
|
IsChecked="{Binding IsFiltered}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
||||||
|
</Grid>
|
||||||
|
</TreeDataTemplate>
|
||||||
|
</TreeView.ItemTemplate>
|
||||||
|
</TreeView>
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="*" Header="NAME">
|
<!-- Tags -->
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<ToggleButton Grid.Row="4" Classes="group_expander" IsChecked="{Binding IsTagGroupExpanded, Mode=TwoWay}">
|
||||||
<DataTemplate>
|
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||||
<Border Padding="0,0,4,0">
|
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Tags}"/>
|
||||||
<TextBlock Text="{Binding}" ClipToBounds="True" Classes="monospace" TextTrimming="CharacterEllipsis"/>
|
<TextBlock Grid.Column="1" Text="{Binding Tags, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
||||||
</Border>
|
<Button Grid.Column="2" Classes="icon_button" Width="14" Margin="8,0" Command="{Binding CreateNewTag}" ToolTip.Tip="{DynamicResource Text.Repository.Tags.Add}">
|
||||||
</DataTemplate>
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Tag.Add}"/>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</Button>
|
||||||
</DataGridTemplateColumn>
|
</Grid>
|
||||||
</DataGrid.Columns>
|
</ToggleButton>
|
||||||
</DataGrid>
|
<DataGrid Grid.Row="5"
|
||||||
|
x:Name="tagsList"
|
||||||
|
Margin="8,0,4,0"
|
||||||
|
Background="Transparent"
|
||||||
|
ItemsSource="{Binding VisibleTags}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False"
|
||||||
|
CanUserSortColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
HeadersVisibility="None"
|
||||||
|
Focusable="False"
|
||||||
|
RowHeight="24"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
IsVisible="{Binding IsTagGroupExpanded, Mode=OneWay}"
|
||||||
|
SelectionChanged="OnTagDataGridSelectionChanged"
|
||||||
|
ContextRequested="OnTagContextRequested">
|
||||||
|
<DataGrid.Styles>
|
||||||
|
<Style Selector="DataGridRow">
|
||||||
|
<Setter Property="CornerRadius" Value="4" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<!-- Worktrees -->
|
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
||||||
<ToggleButton Grid.Row="10" Classes="group_expander" IsChecked="{Binding IsWorktreeGroupExpanded, Mode=TwoWay}">
|
<Setter Property="ClipToBounds" Value="True" />
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
</Style>
|
||||||
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Worktrees}"/>
|
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Worktrees, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Classes="icon_button"
|
|
||||||
Width="14"
|
|
||||||
Margin="8,0"
|
|
||||||
Command="{Binding PruneWorktrees}"
|
|
||||||
IsVisible="{Binding Worktrees, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.Worktrees.Prune}">
|
|
||||||
<Path x:Name="icon" Width="12" Height="12" Data="{StaticResource Icons.Loading}"/>
|
|
||||||
</Button>
|
|
||||||
<Button Grid.Column="3"
|
|
||||||
Classes="icon_button"
|
|
||||||
Width="14"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding AddWorktree}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.Worktrees.Add}">
|
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Worktree.Add}"/>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</ToggleButton>
|
|
||||||
<DataGrid Grid.Row="11"
|
|
||||||
MaxHeight="200"
|
|
||||||
Margin="8,0,4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
ItemsSource="{Binding Worktrees}"
|
|
||||||
SelectionMode="Single"
|
|
||||||
CanUserReorderColumns="False"
|
|
||||||
CanUserResizeColumns="False"
|
|
||||||
CanUserSortColumns="False"
|
|
||||||
IsReadOnly="True"
|
|
||||||
HeadersVisibility="None"
|
|
||||||
Focusable="False"
|
|
||||||
RowHeight="26"
|
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
ContextRequested="OnWorktreeContextRequested"
|
|
||||||
DoubleTapped="OnDoubleTappedWorktree"
|
|
||||||
IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}">
|
|
||||||
<DataGrid.Styles>
|
|
||||||
<Style Selector="DataGridRow">
|
|
||||||
<Setter Property="CornerRadius" Value="4" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
<Style Selector="Grid.repository_leftpanel DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
</Style>
|
<Setter Property="Opacity" Value=".5"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected:pointerover /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".8"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Styles>
|
||||||
|
|
||||||
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
<DataGrid.Columns>
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
<DataGridTemplateColumn Header="ICON">
|
||||||
</Style>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate x:DataType="{x:Type m:Tag}">
|
||||||
|
<Path Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Tag}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
<DataGridTemplateColumn Width="*" Header="NAME">
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
</Style>
|
<DataTemplate x:DataType="{x:Type m:Tag}">
|
||||||
</DataGrid.Styles>
|
<TextBlock Text="{Binding Name}" Classes="monospace" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
<DataGrid.Columns>
|
<DataGridTemplateColumn Header="FILTER">
|
||||||
<DataGridTemplateColumn Header="ICON">
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate x:DataType="{x:Type m:Tag}">
|
||||||
<DataTemplate>
|
<ToggleButton Classes="filter"
|
||||||
<Path Width="10" Height="10" Margin="8,0,0,0" Data="{StaticResource Icons.Worktree}"/>
|
Margin="0,0,8,0"
|
||||||
</DataTemplate>
|
Background="Transparent"
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
Checked="OnToggleFilter"
|
||||||
</DataGridTemplateColumn>
|
Unchecked="OnToggleFilter"
|
||||||
|
IsChecked="{Binding IsFiltered}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="*" Header="FullPath">
|
<!-- Submodules -->
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<ToggleButton Grid.Row="6" Classes="group_expander" IsChecked="{Binding IsSubmoduleGroupExpanded, Mode=TwoWay}">
|
||||||
<DataTemplate>
|
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
||||||
<TextBlock Classes="monospace" Margin="8,0,0,0" TextTrimming="CharacterEllipsis">
|
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Submodules}"/>
|
||||||
<Run Text="{Binding FullPath}"/>
|
<TextBlock Grid.Column="1" Text="{Binding Submodules, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
||||||
<Run Text="{Binding Name}" Foreground="{DynamicResource Brush.FG2}"/>
|
<Button Grid.Column="2"
|
||||||
</TextBlock>
|
Classes="icon_button"
|
||||||
</DataTemplate>
|
Width="14"
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
Margin="8,0"
|
||||||
</DataGridTemplateColumn>
|
Command="{Binding UpdateSubmodules}"
|
||||||
|
IsVisible="{Binding Submodules, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Repository.Submodules.Update}">
|
||||||
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Loading}"/>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Classes="icon_button"
|
||||||
|
Width="14"
|
||||||
|
Margin="0,0,8,0"
|
||||||
|
Command="{Binding AddSubmodule}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Repository.Submodules.Add}">
|
||||||
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Submodule.Add}"/>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</ToggleButton>
|
||||||
|
<DataGrid Grid.Row="7"
|
||||||
|
x:Name="submoduleList"
|
||||||
|
MaxHeight="200"
|
||||||
|
Margin="8,0,4,0"
|
||||||
|
Background="Transparent"
|
||||||
|
ItemsSource="{Binding Submodules}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False"
|
||||||
|
CanUserSortColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
HeadersVisibility="None"
|
||||||
|
Focusable="False"
|
||||||
|
RowHeight="26"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
ContextRequested="OnSubmoduleContextRequested"
|
||||||
|
DoubleTapped="OnDoubleTappedSubmodule"
|
||||||
|
IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">
|
||||||
|
<DataGrid.Styles>
|
||||||
|
<Style Selector="DataGridRow">
|
||||||
|
<Setter Property="CornerRadius" Value="4" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<DataGridTemplateColumn Header="FullPath">
|
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<Setter Property="ClipToBounds" Value="True" />
|
||||||
<DataTemplate>
|
</Style>
|
||||||
<Path Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Lock}" Fill="{DynamicResource Brush.FG2}" IsVisible="{Binding IsLocked}"/>
|
|
||||||
</DataTemplate>
|
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
</DataGridTemplateColumn>
|
</Style>
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Styles>
|
||||||
|
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Header="ICON">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Path Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Submodule}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="*" Header="NAME">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Padding="0,0,4,0">
|
||||||
|
<TextBlock Text="{Binding}" ClipToBounds="True" Classes="monospace" TextTrimming="CharacterEllipsis"/>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<!-- Worktrees -->
|
||||||
|
<ToggleButton Grid.Row="8" Classes="group_expander" IsChecked="{Binding IsWorktreeGroupExpanded, Mode=TwoWay}">
|
||||||
|
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
|
||||||
|
<TextBlock Grid.Column="0" Classes="group_header_label" Margin="0" Text="{DynamicResource Text.Repository.Worktrees}"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Worktrees, Converter={x:Static c:ListConverters.ToCount}}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Classes="icon_button"
|
||||||
|
Width="14"
|
||||||
|
Margin="8,0"
|
||||||
|
Command="{Binding PruneWorktrees}"
|
||||||
|
IsVisible="{Binding Worktrees, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Repository.Worktrees.Prune}">
|
||||||
|
<Path x:Name="icon" Width="12" Height="12" Data="{StaticResource Icons.Loading}"/>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Classes="icon_button"
|
||||||
|
Width="14"
|
||||||
|
Margin="0,0,8,0"
|
||||||
|
Command="{Binding AddWorktree}"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Repository.Worktrees.Add}">
|
||||||
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Worktree.Add}"/>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</ToggleButton>
|
||||||
|
<DataGrid Grid.Row="9"
|
||||||
|
x:Name="worktreeList"
|
||||||
|
Margin="8,0,4,0"
|
||||||
|
Background="Transparent"
|
||||||
|
ItemsSource="{Binding Worktrees}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False"
|
||||||
|
CanUserSortColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
HeadersVisibility="None"
|
||||||
|
Focusable="False"
|
||||||
|
RowHeight="26"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
ContextRequested="OnWorktreeContextRequested"
|
||||||
|
DoubleTapped="OnDoubleTappedWorktree"
|
||||||
|
IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}">
|
||||||
|
<DataGrid.Styles>
|
||||||
|
<Style Selector="DataGridRow">
|
||||||
|
<Setter Property="CornerRadius" Value="4" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
||||||
|
<Setter Property="ClipToBounds" Value="True" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Styles>
|
||||||
|
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Header="ICON">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Path Width="10" Height="10" Margin="8,0,0,0" Data="{StaticResource Icons.Worktree}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="*" Header="FullPath">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Classes="monospace" Margin="8,0,0,0" TextTrimming="CharacterEllipsis">
|
||||||
|
<Run Text="{Binding FullPath}"/>
|
||||||
|
<Run Text="{Binding Name}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
|
</TextBlock>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Header="FullPath">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Path Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Lock}" Fill="{DynamicResource Brush.FG2}" IsVisible="{Binding IsLocked}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Commit Search Panel -->
|
<!-- Commit Search Panel -->
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
|
using AvaloniaEdit.Utils;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
|
@ -280,18 +281,6 @@ namespace SourceGit.Views
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTagPropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Property == DataGrid.ItemsSourceProperty && DataContext is ViewModels.Repository vm)
|
|
||||||
{
|
|
||||||
if (vm.VisibleTags == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var desiredHeight = tagsList.RowHeight * vm.VisibleTags.Count;
|
|
||||||
tagsList.Height = Math.Min(200, desiredHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnToggleFilter(object sender, RoutedEventArgs e)
|
private void OnToggleFilter(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is ToggleButton toggle)
|
if (sender is ToggleButton toggle)
|
||||||
|
@ -379,5 +368,81 @@ namespace SourceGit.Views
|
||||||
outs.Add(b);
|
outs.Add(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDashboardLayoutUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var vm = DataContext as ViewModels.Repository;
|
||||||
|
if (vm == null || vm.Settings == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var grid = sender as Grid;
|
||||||
|
if (grid == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var leftHeight = grid.Bounds.Height - 28.0 * 5;
|
||||||
|
if (vm.IsTagGroupExpanded)
|
||||||
|
{
|
||||||
|
var desiredHeight = Math.Min(200.0, tagsList.RowHeight * vm.VisibleTags.Count);
|
||||||
|
leftHeight -= desiredHeight;
|
||||||
|
if (!tagsList.Height.IsClose(desiredHeight))
|
||||||
|
tagsList.Height = desiredHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vm.IsSubmoduleGroupExpanded)
|
||||||
|
{
|
||||||
|
var desiredHeight = Math.Min(200.0, submoduleList.RowHeight * vm.Submodules.Count);
|
||||||
|
leftHeight -= desiredHeight;
|
||||||
|
if (!submoduleList.Height.IsClose(desiredHeight))
|
||||||
|
submoduleList.Height = desiredHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vm.IsWorktreeGroupExpanded)
|
||||||
|
{
|
||||||
|
var desiredHeight = Math.Min(200.0, worktreeList.RowHeight * vm.Worktrees.Count);
|
||||||
|
leftHeight -= desiredHeight;
|
||||||
|
if (!worktreeList.Height.IsClose(desiredHeight))
|
||||||
|
worktreeList.Height = desiredHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
var desiredLocalBranchHeight = GetTreeRowsCount(vm.LocalBranchTrees) * 24;
|
||||||
|
var desiredRemoteHeight = GetTreeRowsCount(vm.RemoteBranchTrees) * 24;
|
||||||
|
|
||||||
|
if (!vm.IsRemoteGroupExpanded)
|
||||||
|
{
|
||||||
|
if (vm.IsLocalBranchGroupExpanded)
|
||||||
|
{
|
||||||
|
var localBranchHeight = Math.Min(leftHeight, desiredLocalBranchHeight);
|
||||||
|
localBranchTree.Height = localBranchHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (vm.IsLocalBranchGroupExpanded)
|
||||||
|
{
|
||||||
|
var localBranchHeight = Math.Min(leftHeight * 0.5, desiredLocalBranchHeight);
|
||||||
|
if (!localBranchTree.Height.IsClose(localBranchHeight))
|
||||||
|
localBranchTree.Height = localBranchHeight;
|
||||||
|
|
||||||
|
leftHeight -= localBranchHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
var remoteHeight = Math.Min(leftHeight, desiredRemoteHeight);
|
||||||
|
if (!remoteBranchTree.Height.IsClose(remoteHeight))
|
||||||
|
remoteBranchTree.Height = remoteHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetTreeRowsCount(List<ViewModels.BranchTreeNode> nodes)
|
||||||
|
{
|
||||||
|
int count = nodes.Count;
|
||||||
|
|
||||||
|
foreach (var node in nodes)
|
||||||
|
{
|
||||||
|
if (!node.IsBranch && node.IsExpanded)
|
||||||
|
count += GetTreeRowsCount(node.Children);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue