mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-30 16:44:59 +00:00
Merge branch 'develop' into feature/allowing_to_checkout_commit
This commit is contained in:
commit
db9ca5ba25
56 changed files with 822 additions and 283 deletions
|
@ -70,7 +70,7 @@
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,8,32,8">
|
||||
<StackPanel Height="48" Orientation="Horizontal">
|
||||
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
|
||||
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent1}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||
<TextBlock Classes="monospace" Margin="8,0" Text="{Binding Version}" FontSize="12" Foreground="White"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
@ -82,19 +82,19 @@
|
|||
<StackPanel Orientation="Vertical" Margin="0,24,0,0">
|
||||
<StackPanel Orientation="Horizontal" Height="18">
|
||||
<TextBlock Text="{DynamicResource Text.About.BuildWith}" />
|
||||
<TextBlock Text="Avalonia UI" Cursor="Hand" Foreground="{DynamicResource Brush.Accent1}" TextDecorations="Underline" PointerPressed="OnVisitAvaloniaUI"/>
|
||||
<TextBlock Text="Avalonia UI" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitAvaloniaUI"/>
|
||||
<TextBlock Text=" & " />
|
||||
<TextBlock Text="AvaloniaEdit" Cursor="Hand" Foreground="{DynamicResource Brush.Accent1}" TextDecorations="Underline" PointerPressed="OnVisitAvaloniaEdit"/>
|
||||
<TextBlock Text="AvaloniaEdit" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitAvaloniaEdit"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
|
||||
<TextBlock Text="{DynamicResource Text.About.Fonts}" />
|
||||
<TextBlock Text="JetBrains Mono" Cursor="Hand" Foreground="{DynamicResource Brush.Accent1}" TextDecorations="Underline" PointerPressed="OnVisitJetBrainsMonoFont"/>
|
||||
<TextBlock Text="JetBrains Mono" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitJetBrainsMonoFont"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
|
||||
<TextBlock Text="{DynamicResource Text.About.SourceCode}" />
|
||||
<TextBlock Text="Github" Cursor="Hand" Foreground="{DynamicResource Brush.Accent1}" TextDecorations="Underline" PointerPressed="OnVisitSourceCode"/>
|
||||
<TextBlock Text="Github" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitSourceCode"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
|
|
@ -299,7 +299,8 @@ namespace SourceGit.Views
|
|||
|
||||
var menu = new ContextMenu();
|
||||
menu.Items.Add(copy);
|
||||
menu.Open(TextArea.TextView);
|
||||
|
||||
TextArea.TextView.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
Height="26"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchChangeFilter, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True">
|
||||
Text="{Binding SearchChangeFilter, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="14" Height="14" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Search}"/>
|
||||
</TextBox.InnerLeftContent>
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var detail = DataContext as ViewModels.CommitDetail;
|
||||
var menu = detail.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change);
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -39,7 +39,7 @@ namespace SourceGit.Views
|
|||
if (node != null && !node.IsFolder)
|
||||
{
|
||||
var menu = detail.CreateChangeContextMenu(node.Backend as Models.Change);
|
||||
menu.Open(view);
|
||||
view.OpenContextMenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var menu = detail.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change);
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
26
src/Views/ContextMenuExtension.cs
Normal file
26
src/Views/ContextMenuExtension.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public static class ContextMenuExtension
|
||||
{
|
||||
public static void OpenContextMenu(this Control control, ContextMenu menu)
|
||||
{
|
||||
if (menu == null) return;
|
||||
|
||||
menu.PlacementTarget = control;
|
||||
menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic.
|
||||
|
||||
control.ContextMenu = menu;
|
||||
control.ContextMenu.Open();
|
||||
}
|
||||
|
||||
private static void OnContextMenuClosing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (sender is ContextMenu menu && menu.PlacementTarget != null)
|
||||
menu.PlacementTarget.ContextMenu = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -62,10 +62,15 @@
|
|||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
|
||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.StashAndReply}"
|
||||
GroupName="LocalChanges"
|
||||
IsChecked="{Binding AutoStash, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.StashAndReaply}}"/>
|
||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.Discard}"
|
||||
GroupName="LocalChanges"
|
||||
Margin="8,0,0,0"/>
|
||||
Margin="8,0,0,0"
|
||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.Discard}}"/>
|
||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
||||
GroupName="LocalChanges"
|
||||
Margin="8,0,0,0"
|
||||
IsChecked="{Binding PreAction, Mode=TwoWay, Converter={x:Static c:EnumConverters.Equals}, ConverterParameter={x:Static vm:BeforeCreateBranchAction.DoNothing}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.CreateTag}"/>
|
||||
<Grid Margin="0,16,8,0" RowDefinitions="32,32,64" ColumnDefinitions="150,*">
|
||||
<Grid Margin="0,16,8,0" RowDefinitions="32,32,32,Auto,Auto,32" ColumnDefinitions="150,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -49,16 +49,41 @@
|
|||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
Text="{DynamicResource Text.CreateTag.Type}"/>
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
|
||||
<RadioButton Content="{DynamicResource Text.CreateTag.Type.Annotated}"
|
||||
GroupName="TagKind"
|
||||
IsChecked="{Binding Annotated, Mode=TwoWay}"/>
|
||||
<RadioButton Content="{DynamicResource Text.CreateTag.Type.Lightweight}"
|
||||
GroupName="TagKind"
|
||||
Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||
Margin="0,6,8,0"
|
||||
Text="{DynamicResource Text.CreateTag.Message}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
Height="56"
|
||||
Text="{DynamicResource Text.CreateTag.Message}"
|
||||
IsVisible="{Binding Annotated}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1"
|
||||
Height="64"
|
||||
AcceptsReturn="True" AcceptsTab="False"
|
||||
VerticalAlignment="Center" VerticalContentAlignment="Top"
|
||||
CornerRadius="2"
|
||||
Watermark="{DynamicResource Text.CreateTag.Message.Placeholder}"
|
||||
Text="{Binding Message, Mode=TwoWay}"/>
|
||||
Text="{Binding Message, Mode=TwoWay}"
|
||||
IsVisible="{Binding Annotated}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Height="32" Margin="0,4,0,0"
|
||||
Content="{DynamicResource Text.CreateTag.GPGSign}"
|
||||
IsChecked="{Binding SignTag, Mode=TwoWay}"
|
||||
IsVisible="{Binding Annotated}"/>
|
||||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.CreateTag.PushToAllRemotes}"
|
||||
IsChecked="{Binding PushToAllRemotes, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
82
src/Views/DeleteMultipleBranches.axaml
Normal file
82
src/Views/DeleteMultipleBranches.axaml
Normal file
|
@ -0,0 +1,82 @@
|
|||
<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: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.DeleteMultipleBranches"
|
||||
x:DataType="vm:DeleteMultipleBranches">
|
||||
<StackPanel Orientation="Vertical" Margin="8,0">
|
||||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.DeleteMultiBranch}" />
|
||||
|
||||
<Border Margin="4,16,0,0"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource Brush.Border1}"
|
||||
CornerRadius="4"
|
||||
Padding="4">
|
||||
<DataGrid MaxHeight="200"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding Targets}"
|
||||
SelectionMode="Single"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
IsReadOnly="True"
|
||||
HeadersVisibility="None"
|
||||
Focusable="False"
|
||||
RowHeight="26"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<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="4,0,8,0" Data="{StaticResource Icons.Branch}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Width="*" Header="NAME">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={x:Static c:BranchConverters.ToName}}" ClipToBounds="True"
|
||||
Classes="monospace" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="4,8,0,0"
|
||||
Text="{DynamicResource Text.DeleteMultiBranch.Tip}"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{DynamicResource Brush.FG2}"
|
||||
FontStyle="Italic" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
13
src/Views/DeleteMultipleBranches.axaml.cs
Normal file
13
src/Views/DeleteMultipleBranches.axaml.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Avalonia.Controls;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public partial class DeleteMultipleBranches : UserControl
|
||||
{
|
||||
public DeleteMultipleBranches()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<StackPanel Orientation="Vertical" Margin="8,0">
|
||||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.Remote.AddTitle}"/>
|
||||
Text="{DynamicResource Text.Remote.EditTitle}"/>
|
||||
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto" ColumnDefinitions="150,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
|
|
|
@ -300,7 +300,7 @@ namespace SourceGit.Views
|
|||
if (DataContext is ViewModels.Histories histories)
|
||||
{
|
||||
var menu = histories.MakeContextMenu();
|
||||
menu?.Open(sender as Control);
|
||||
(sender as Control)?.OpenContextMenu(menu);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
<ProgressBar Margin="0,8,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsIndeterminate="True"
|
||||
Background="{DynamicResource Brush.FG2}" Foreground="{DynamicResource Brush.Accent1}"
|
||||
Background="{DynamicResource Brush.FG2}" Foreground="{DynamicResource Brush.Accent}"
|
||||
Minimum="0" Maximum="100"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
|
|
@ -396,17 +396,10 @@
|
|||
|
||||
<Grid Margin="8" RowDefinitions="32,32,32" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preference.GPG.Enabled}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,16,0"/>
|
||||
<CheckBox Grid.Row="0" Grid.Column="1"
|
||||
IsChecked="{Binding #me.EnableGPGSigning, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preference.GPG.Path}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,16,0"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #me.GPGExecutableFile, Mode=TwoWay}">
|
||||
|
@ -417,15 +410,19 @@
|
|||
</TextBox.InnerRightContent>
|
||||
</TextBox>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preference.GPG.UserKey}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,16,0"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #me.GPGUserKey, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preference.GPG.UserKey.Placeholder}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Preference.GPG.Enabled}"
|
||||
IsChecked="{Binding #me.EnableGPGSigning, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
|
|
@ -207,10 +207,17 @@ namespace SourceGit.Views
|
|||
|
||||
private async void SelectGPGExecutable(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var pattern = OperatingSystem.IsWindows() ? "gpg.exe" : "gpg";
|
||||
var patterns = new List<string>();
|
||||
if (OperatingSystem.IsWindows())
|
||||
patterns.Add("gpg.exe");
|
||||
else if (OperatingSystem.IsLinux())
|
||||
patterns.AddRange(new string[] { "gpg", "gpg2" });
|
||||
else
|
||||
patterns.Add("gpg");
|
||||
|
||||
var options = new FilePickerOpenOptions()
|
||||
{
|
||||
FileTypeFilter = [new FilePickerFileType("GPG Executable") { Patterns = [pattern] }],
|
||||
FileTypeFilter = [new FilePickerFileType("GPG Executable") { Patterns = patterns }],
|
||||
AllowMultiple = false,
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
Classes="bold"
|
||||
Text="{DynamicResource Text.Push.Title}"/>
|
||||
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32" ColumnDefinitions="150,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="150,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -73,10 +73,14 @@
|
|||
</ComboBox>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Push.Tracking}"
|
||||
IsChecked="{Binding Tracking, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Push.WithAllTags}"
|
||||
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Push.Force}"
|
||||
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.PushTag}"/>
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32" ColumnDefinitions="150,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="150,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -31,7 +31,8 @@
|
|||
Height="28" Padding="8,0"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
ItemsSource="{Binding Remotes}"
|
||||
SelectedItem="{Binding SelectedRemote, Mode=TwoWay}">
|
||||
SelectedItem="{Binding SelectedRemote, Mode=TwoWay}"
|
||||
IsEnabled="{Binding !PushAllRemotes}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="{x:Type m:Remote}">
|
||||
<StackPanel Orientation="Horizontal" Height="20" VerticalAlignment="Center">
|
||||
|
@ -41,6 +42,10 @@
|
|||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Content="{DynamicResource Text.PushTag.PushAllRemotes}"
|
||||
IsChecked="{Binding PushAllRemotes, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Left Normal Mode -->
|
||||
<Grid Grid.Column="0" RowDefinitions="28,Auto,5,28,28,Auto,28,*,28,Auto,28,Auto" Margin="0,0,0,4" IsVisible="{Binding !IsSearching}">
|
||||
<Grid Grid.Column="0" Classes="repository_leftpanel" RowDefinitions="28,Auto,5,28,28,Auto,28,*,28,Auto,28,Auto" Margin="0,0,0,4" IsVisible="{Binding !IsSearching}">
|
||||
<!-- WorkingCopy -->
|
||||
<TextBlock Grid.Row="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.Workspace}"/>
|
||||
<ListBox Grid.Row="1" Classes="page_switcher" Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}">
|
||||
|
@ -119,14 +119,14 @@
|
|||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBoxItem Height="28" Padding="0">
|
||||
<ListBoxItem Height="28">
|
||||
<Grid Margin="16,0,0,0" Height="28" ColumnDefinitions="20,*">
|
||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Data="{StaticResource Icons.Histories}"/>
|
||||
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Histories}"/>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
|
||||
<ListBoxItem Height="28" Padding="0">
|
||||
<ListBoxItem Height="28">
|
||||
<Grid Margin="16,0,0,0" Height="28" ColumnDefinitions="20,*,Auto">
|
||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Data="{StaticResource Icons.Send}"/>
|
||||
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.WorkingCopy}"/>
|
||||
|
@ -142,7 +142,7 @@
|
|||
</Grid>
|
||||
</ListBoxItem>
|
||||
|
||||
<ListBoxItem Height="28" Padding="0">
|
||||
<ListBoxItem Height="28">
|
||||
<Grid Margin="16,0,0,0" Height="28" ColumnDefinitions="20,*,Auto">
|
||||
<Path Grid.Column="0" Width="12" Height="12" HorizontalAlignment="Left" Data="{StaticResource Icons.Stashes}"/>
|
||||
<TextBlock Grid.Column="1" Classes="monospace" Text="{DynamicResource Text.Stashes}"/>
|
||||
|
@ -198,19 +198,31 @@
|
|||
<TreeView Grid.Row="5"
|
||||
x:Name="localBranchTree"
|
||||
MaxHeight="400"
|
||||
Margin="4,0,2,0"
|
||||
SelectionMode="Multiple"
|
||||
ItemsSource="{Binding LocalBranchTrees}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
LostFocus="OnLocalBranchTreeLostFocus"
|
||||
ContextRequested="OnLocalBranchContextMenuRequested"
|
||||
SelectionChanged="OnLocalBranchTreeSelectionChanged">
|
||||
<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:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||
</Style>
|
||||
</TreeView.Styles>
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
||||
<Grid Height="24" ColumnDefinitions="20,*,Auto,Auto" Background="Transparent" ContextRequested="OnLocalBranchContextMenuRequested" DoubleTapped="OnDoubleTappedLocalBranchNode">
|
||||
<Grid Height="24" ColumnDefinitions="20,*,Auto,Auto" Background="Transparent" DoubleTapped="OnDoubleTappedLocalBranchNode">
|
||||
<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="2,0,0,0" Data="{StaticResource Icons.Branch}" VerticalAlignment="Center">
|
||||
|
@ -250,20 +262,32 @@
|
|||
</Grid>
|
||||
<TreeView Grid.Row="7"
|
||||
x:Name="remoteBranchTree"
|
||||
Margin="4,0,2,0"
|
||||
SelectionMode="Multiple"
|
||||
ItemsSource="{Binding RemoteBranchTrees}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
LostFocus="OnRemoteBranchTreeLostFocus"
|
||||
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:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Grid.repository_leftpanel:focus-within TreeViewItem:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||
</Style>
|
||||
</TreeView.Styles>
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}" x:DataType="{x:Type vm:BranchTreeNode}">
|
||||
<Grid Height="24" ColumnDefinitions="20,*,Auto" Background="Transparent" ContextRequested="OnRemoteBranchContextMenuRequested">
|
||||
<Grid Height="24" ColumnDefinitions="20,*,Auto" Background="Transparent">
|
||||
<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"/>
|
||||
|
@ -294,7 +318,9 @@
|
|||
</Grid>
|
||||
</ToggleButton>
|
||||
<DataGrid Grid.Row="9"
|
||||
x:Name="tagsList"
|
||||
MaxHeight="200"
|
||||
Margin="4,0,2,0"
|
||||
Background="Transparent"
|
||||
ItemsSource="{Binding Tags}"
|
||||
SelectionMode="Single"
|
||||
|
@ -307,10 +333,27 @@
|
|||
RowHeight="24"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
LostFocus="OnTagDataGridLostFocus"
|
||||
IsVisible="{Binding IsTagGroupExpanded, Mode=OneWay}"
|
||||
SelectionChanged="OnTagDataGridSelectionChanged"
|
||||
ContextRequested="OnTagContextRequested">
|
||||
<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:selected /template/ Rectangle#BackgroundRectangle">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
||||
</Style>
|
||||
</DataGrid.Styles>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header="ICON">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
|
@ -364,6 +407,7 @@
|
|||
</ToggleButton>
|
||||
<DataGrid Grid.Row="11"
|
||||
MaxHeight="200"
|
||||
Margin="4,0,6,0"
|
||||
Background="Transparent"
|
||||
ItemsSource="{Binding Submodules}"
|
||||
SelectionMode="Single"
|
||||
|
@ -378,6 +422,24 @@
|
|||
VerticalScrollBarVisibility="Auto"
|
||||
ContextRequested="OnSubmoduleContextRequested"
|
||||
IsVisible="{Binding IsSubmoduleGroupExpanded, 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>
|
||||
|
@ -390,7 +452,7 @@
|
|||
<DataGridTemplateColumn Width="*" Header="NAME">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Classes="monospace"/>
|
||||
<TextBlock Text="{Binding}" ClipToBounds="True" Classes="monospace"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
@ -408,6 +470,7 @@
|
|||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.Repository.SearchTip}"
|
||||
Text="{Binding SearchCommitFilter, Mode=TwoWay}"
|
||||
VerticalContentAlignment="Center"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia;
|
||||
|
@ -6,6 +7,7 @@ using Avalonia.Controls;
|
|||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -66,56 +68,47 @@ namespace SourceGit.Views
|
|||
if (sender is Button button && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForExternalTools();
|
||||
if (menu != null)
|
||||
{
|
||||
menu.Open(button);
|
||||
e.Handled = true;
|
||||
}
|
||||
button.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLocalBranchTreeLostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is TreeView tree)
|
||||
tree.UnselectAll();
|
||||
}
|
||||
|
||||
private void OnRemoteBranchTreeLostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is TreeView tree)
|
||||
tree.UnselectAll();
|
||||
}
|
||||
|
||||
private void OnTagDataGridLostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is DataGrid datagrid)
|
||||
datagrid.SelectedItem = null;
|
||||
}
|
||||
|
||||
private void OnLocalBranchTreeSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender is TreeView tree && tree.SelectedItem != null)
|
||||
if (sender is TreeView tree && tree.SelectedItem != null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
remoteBranchTree.UnselectAll();
|
||||
tagsList.SelectedItem = null;
|
||||
|
||||
var node = tree.SelectedItem as ViewModels.BranchTreeNode;
|
||||
if (node.IsBranch && DataContext is ViewModels.Repository repo)
|
||||
ViewModels.BranchTreeNode prev = null;
|
||||
foreach (var node in repo.LocalBranchTrees)
|
||||
node.UpdateCornerRadius(ref prev);
|
||||
|
||||
if (tree.SelectedItems.Count == 1)
|
||||
{
|
||||
repo.NavigateToCommit((node.Backend as Models.Branch).Head);
|
||||
var node = tree.SelectedItem as ViewModels.BranchTreeNode;
|
||||
if (node.IsBranch)
|
||||
repo.NavigateToCommit((node.Backend as Models.Branch).Head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRemoteBranchTreeSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender is TreeView tree && tree.SelectedItem != null)
|
||||
if (sender is TreeView tree && tree.SelectedItem != null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
localBranchTree.UnselectAll();
|
||||
tagsList.SelectedItem = null;
|
||||
|
||||
var node = tree.SelectedItem as ViewModels.BranchTreeNode;
|
||||
if (node.IsBranch && DataContext is ViewModels.Repository repo)
|
||||
ViewModels.BranchTreeNode prev = null;
|
||||
foreach (var node in repo.RemoteBranchTrees)
|
||||
node.UpdateCornerRadius(ref prev);
|
||||
|
||||
if (tree.SelectedItems.Count == 1)
|
||||
{
|
||||
repo.NavigateToCommit((node.Backend as Models.Branch).Head);
|
||||
var node = tree.SelectedItem as ViewModels.BranchTreeNode;
|
||||
if (node.IsBranch)
|
||||
repo.NavigateToCommit((node.Backend as Models.Branch).Head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,11 +117,12 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (sender is DataGrid datagrid && datagrid.SelectedItem != null)
|
||||
{
|
||||
localBranchTree.UnselectAll();
|
||||
remoteBranchTree.UnselectAll();
|
||||
|
||||
var tag = datagrid.SelectedItem as Models.Tag;
|
||||
if (DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
repo.NavigateToCommit(tag.SHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,9 +130,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var grid = sender as Grid;
|
||||
if (e.Property == IsVisibleProperty && grid.IsVisible)
|
||||
{
|
||||
txtSearchCommitsBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSearchKeyDown(object sender, KeyEventArgs e)
|
||||
|
@ -146,9 +138,8 @@ namespace SourceGit.Views
|
|||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
repo.StartSearchCommits();
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
@ -174,9 +165,7 @@ namespace SourceGit.Views
|
|||
if (toggle.DataContext is ViewModels.BranchTreeNode node)
|
||||
{
|
||||
if (node.IsBranch)
|
||||
{
|
||||
filter = (node.Backend as Models.Branch).FullName;
|
||||
}
|
||||
}
|
||||
else if (toggle.DataContext is Models.Tag tag)
|
||||
{
|
||||
|
@ -195,16 +184,43 @@ namespace SourceGit.Views
|
|||
private void OnLocalBranchContextMenuRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
remoteBranchTree.UnselectAll();
|
||||
tagsList.SelectedItem = null;
|
||||
|
||||
if (sender is Grid grid && grid.DataContext is ViewModels.BranchTreeNode node)
|
||||
var repo = DataContext as ViewModels.Repository;
|
||||
var tree = sender as TreeView;
|
||||
if (tree.SelectedItems.Count == 0)
|
||||
{
|
||||
if (node.IsBranch && DataContext is ViewModels.Repository repo)
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var branches = new List<Models.Branch>();
|
||||
foreach (var item in tree.SelectedItems)
|
||||
CollectBranchesFromNode(branches, item as ViewModels.BranchTreeNode);
|
||||
|
||||
if (branches.Count == 1)
|
||||
{
|
||||
var item = (e.Source as Control)?.FindAncestorOfType<TreeViewItem>(true);
|
||||
if (item != null)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForLocalBranch(node.Backend as Models.Branch);
|
||||
if (menu != null)
|
||||
menu.Open(grid);
|
||||
var menu = repo.CreateContextMenuForLocalBranch(branches[0]);
|
||||
item.OpenContextMenu(menu);
|
||||
}
|
||||
}
|
||||
else if (branches.Count > 1 && branches.Find(x => x.IsCurrent) == null)
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
var deleteMulti = new MenuItem();
|
||||
deleteMulti.Header = App.Text("BranchCM.DeleteMultiBranches", branches.Count);
|
||||
deleteMulti.Icon = App.CreateMenuIcon("Icons.Clear");
|
||||
deleteMulti.Click += (_, ev) =>
|
||||
{
|
||||
repo.DeleteMultipleBranches(branches, true);
|
||||
ev.Handled = true;
|
||||
};
|
||||
menu.Items.Add(deleteMulti);
|
||||
tree.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -212,22 +228,60 @@ namespace SourceGit.Views
|
|||
private void OnRemoteBranchContextMenuRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
localBranchTree.UnselectAll();
|
||||
|
||||
if (sender is Grid grid && grid.DataContext is ViewModels.BranchTreeNode node && DataContext is ViewModels.Repository repo)
|
||||
tagsList.SelectedItem = null;
|
||||
|
||||
var repo = DataContext as ViewModels.Repository;
|
||||
var tree = sender as TreeView;
|
||||
if (tree.SelectedItems.Count == 0)
|
||||
{
|
||||
if (node.IsRemote)
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (tree.SelectedItems.Count == 1)
|
||||
{
|
||||
var node = tree.SelectedItem as ViewModels.BranchTreeNode;
|
||||
if (node != null && node.IsRemote)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForRemote(node.Backend as Models.Remote);
|
||||
if (menu != null)
|
||||
menu.Open(grid);
|
||||
var item = (e.Source as Control)?.FindAncestorOfType<TreeViewItem>(true);
|
||||
if (item != null && item.DataContext == node)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForRemote(node.Backend as Models.Remote);
|
||||
item.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
else if (node.IsBranch)
|
||||
}
|
||||
|
||||
var branches = new List<Models.Branch>();
|
||||
foreach (var item in tree.SelectedItems)
|
||||
CollectBranchesFromNode(branches, item as ViewModels.BranchTreeNode);
|
||||
|
||||
if (branches.Count == 1)
|
||||
{
|
||||
var item = (e.Source as Control)?.FindAncestorOfType<TreeViewItem>(true);
|
||||
if (item != null)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForRemoteBranch(node.Backend as Models.Branch);
|
||||
if (menu != null)
|
||||
menu.Open(grid);
|
||||
var menu = repo.CreateContextMenuForRemoteBranch(branches[0]);
|
||||
item.OpenContextMenu(menu);
|
||||
}
|
||||
}
|
||||
else if (branches.Count > 1)
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
var deleteMulti = new MenuItem();
|
||||
deleteMulti.Header = App.Text("BranchCM.DeleteMultiBranches", branches.Count);
|
||||
deleteMulti.Icon = App.CreateMenuIcon("Icons.Clear");
|
||||
deleteMulti.Click += (_, ev) =>
|
||||
{
|
||||
repo.DeleteMultipleBranches(branches, false);
|
||||
ev.Handled = true;
|
||||
};
|
||||
menu.Items.Add(deleteMulti);
|
||||
tree.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -238,8 +292,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var tag = datagrid.SelectedItem as Models.Tag;
|
||||
var menu = repo.CreateContextMenuForTag(tag);
|
||||
if (menu != null)
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -251,8 +304,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var submodule = datagrid.SelectedItem as string;
|
||||
var menu = repo.CreateContextMenuForSubmodule(submodule);
|
||||
if (menu != null)
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -263,8 +315,7 @@ namespace SourceGit.Views
|
|||
if (DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var menu = repo.CreateContextMenuForGitFlow();
|
||||
if (menu != null)
|
||||
menu.Open(sender as Button);
|
||||
(sender as Control)?.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -313,5 +364,23 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void CollectBranchesFromNode(List<Models.Branch> outs, ViewModels.BranchTreeNode node)
|
||||
{
|
||||
if (node == null || node.IsRemote)
|
||||
return;
|
||||
|
||||
if (node.IsFolder)
|
||||
{
|
||||
foreach (var child in node.Children)
|
||||
CollectBranchesFromNode(outs, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
var b = node.Backend as Models.Branch;
|
||||
if (b != null && !outs.Contains(b))
|
||||
outs.Add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,23 +47,18 @@
|
|||
Text="{Binding HttpProxy, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
Text="{DynamicResource Text.Preference.GPG.Enabled}"/>
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
x:Name="chkGPGSigningEnabled"
|
||||
IsChecked="{Binding GPGSigningEnabled, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
Text="{DynamicResource Text.Preference.GPG.UserKey}"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1"
|
||||
<TextBox Grid.Row="3" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Preference.GPG.UserKey.Placeholder}"
|
||||
Text="{Binding GPGUserSigningKey, Mode=TwoWay}"
|
||||
IsEnabled="{Binding #chkGPGSigningEnabled.IsChecked}"/>
|
||||
Text="{Binding GPGUserSigningKey, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Preference.GPG.Enabled}"
|
||||
IsChecked="{Binding GPGSigningEnabled, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
Height="26"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchFilter, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var compare = DataContext as ViewModels.RevisionCompare;
|
||||
var menu = compare.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change);
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -40,7 +40,7 @@ namespace SourceGit.Views
|
|||
if (node != null && !node.IsFolder)
|
||||
{
|
||||
var menu = compare.CreateChangeContextMenu(node.Backend as Models.Change);
|
||||
menu.Open(view);
|
||||
view.OpenContextMenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
Height="26"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchFileFilter, Mode=TwoWay}"
|
||||
v:AutoFocusBehaviour.IsEnabled="True">
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Files.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>
|
||||
|
|
|
@ -198,7 +198,8 @@ namespace SourceGit.Views
|
|||
|
||||
var menu = new ContextMenu();
|
||||
menu.Items.Add(copy);
|
||||
menu.Open(TextArea.TextView);
|
||||
|
||||
TextArea.TextView.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
@ -219,7 +220,7 @@ namespace SourceGit.Views
|
|||
if (!node.IsFolder)
|
||||
{
|
||||
var menu = detail.CreateRevisionFileContextMenu(node.Backend as Models.Object);
|
||||
menu.Open(sender as Control);
|
||||
(sender as Control)?.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,8">
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green"/>
|
||||
<TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.SelfUpdate.Available}"/>
|
||||
<Border Margin="4,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent1}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||
<Border Margin="4,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||
<TextBlock Classes="monospace" Margin="8,0" Text="{Binding TagName}" FontSize="12" Foreground="White"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
|
|
@ -172,7 +172,7 @@
|
|||
<v:Chart Grid.Column="1"
|
||||
Margin="16,0,0,0"
|
||||
LineBrush="{DynamicResource Brush.Border1}"
|
||||
ShapeBrush="{DynamicResource Brush.Accent1}"
|
||||
ShapeBrush="{DynamicResource Brush.Accent}"
|
||||
Samples="{Binding Samples}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
|
|
@ -137,6 +137,9 @@ namespace SourceGit.Views
|
|||
var width = textView.Bounds.Width;
|
||||
foreach (var line in textView.VisualLines)
|
||||
{
|
||||
if (line.FirstDocumentLine == null)
|
||||
continue;
|
||||
|
||||
var index = line.FirstDocumentLine.LineNumber;
|
||||
if (index > _editor.DiffData.Lines.Count)
|
||||
break;
|
||||
|
@ -320,7 +323,8 @@ namespace SourceGit.Views
|
|||
};
|
||||
|
||||
menu.Items.Add(copy);
|
||||
menu.Open(TextArea.TextView);
|
||||
|
||||
TextArea.TextView.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
@ -516,6 +520,9 @@ namespace SourceGit.Views
|
|||
var infos = _editor.IsOld ? _editor.DiffData.Old : _editor.DiffData.New;
|
||||
foreach (var line in textView.VisualLines)
|
||||
{
|
||||
if (line.FirstDocumentLine == null)
|
||||
continue;
|
||||
|
||||
var index = line.FirstDocumentLine.LineNumber;
|
||||
if (index > infos.Count)
|
||||
break;
|
||||
|
@ -731,7 +738,8 @@ namespace SourceGit.Views
|
|||
};
|
||||
|
||||
menu.Items.Add(copy);
|
||||
menu.Open(TextArea.TextView);
|
||||
|
||||
TextArea.TextView.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace SourceGit.Views
|
|||
if (sender is Grid grid && DataContext is ViewModels.Welcome vm)
|
||||
{
|
||||
var menu = vm.CreateContextMenu(grid.DataContext as ViewModels.RepositoryNode);
|
||||
menu?.Open(grid);
|
||||
grid.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
(DataContext as ViewModels.Welcome).InitRepository(path);
|
||||
(DataContext as ViewModels.Welcome).InitRepository(path, parent);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ namespace SourceGit.Views
|
|||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
var repo = ViewModels.Preference.AddRepository(root, gitDir);
|
||||
var node = ViewModels.Preference.FindOrAddNodeByRepositoryPath(repo.FullPath, parent);
|
||||
var node = ViewModels.Preference.FindOrAddNodeByRepositoryPath(repo.FullPath, parent, true);
|
||||
launcher.OpenRepositoryInTab(node, page);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -205,8 +205,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var menu = vm.CreateContextMenuForUnstagedChanges(selected);
|
||||
if (menu != null)
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -225,8 +224,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var menu = vm.CreateContextMenuForUnstagedChanges(selected);
|
||||
if (menu != null)
|
||||
menu.Open(tree);
|
||||
tree.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -245,8 +243,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var menu = vm.CreateContextMenuForStagedChanges(selected);
|
||||
if (menu != null)
|
||||
menu.Open(datagrid);
|
||||
datagrid.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -265,8 +262,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
var menu = vm.CreateContextMenuForStagedChanges(selected);
|
||||
if (menu != null)
|
||||
menu.Open(tree);
|
||||
tree.OpenContextMenu(menu);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
@ -331,7 +327,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var menu = vm.CreateContextMenuForCommitMessages();
|
||||
menu.Placement = PlacementMode.TopEdgeAlignedLeft;
|
||||
menu.Open(button);
|
||||
button.OpenContextMenu(menu);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue