mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 05:10:25 +08:00
project: upgrade AvaloniaUI to 12.0.0
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
Submodule depends/AvaloniaEdit updated: 1e6f595ff0...8e02900934
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Fonts;
|
||||
@@ -151,8 +150,6 @@ namespace SourceGit
|
||||
else
|
||||
Models.CommitGraph.SetDefaultPens(overrides.GraphPenThickness);
|
||||
|
||||
Native.OS.UseMicaOnWindows11 = overrides.UseMicaOnWindows11;
|
||||
|
||||
app.Resources.MergedDictionaries.Add(resDic);
|
||||
app._themeOverrides = resDic;
|
||||
}
|
||||
@@ -251,8 +248,6 @@ namespace SourceGit
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
BindingPlugins.DataValidators.RemoveAt(0);
|
||||
|
||||
// Disable tooltip if window is not active.
|
||||
ToolTip.ToolTipOpeningEvent.AddClassHandler<Control>((c, e) =>
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace SourceGit.Models
|
||||
public Dictionary<string, Color> BasicColors { get; set; } = new Dictionary<string, Color>();
|
||||
public double GraphPenThickness { get; set; } = 2;
|
||||
public double OpacityForNotMergedCommits { get; set; } = 0.5;
|
||||
public bool UseMicaOnWindows11 { get; set; } = true;
|
||||
public List<Color> GraphColors { get; set; } = new List<Color>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Runtime.Versioning;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace SourceGit.Native
|
||||
{
|
||||
@@ -22,13 +21,13 @@ namespace SourceGit.Native
|
||||
{
|
||||
if (OS.UseSystemWindowFrame)
|
||||
{
|
||||
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
|
||||
window.ExtendClientAreaToDecorationsHint = false;
|
||||
window.WindowDecorations = WindowDecorations.Full;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
window.ExtendClientAreaToDecorationsHint = true;
|
||||
window.WindowDecorations = WindowDecorations.None;
|
||||
window.Classes.Add("custom_window_frame");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Runtime.Versioning;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace SourceGit.Native
|
||||
{
|
||||
@@ -40,8 +39,8 @@ namespace SourceGit.Native
|
||||
|
||||
public void SetupWindow(Window window)
|
||||
{
|
||||
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
|
||||
window.ExtendClientAreaToDecorationsHint = true;
|
||||
window.WindowDecorations = WindowDecorations.Full;
|
||||
}
|
||||
|
||||
public string GetDataDir()
|
||||
|
||||
@@ -108,12 +108,6 @@ namespace SourceGit.Native
|
||||
set;
|
||||
} = string.Empty;
|
||||
|
||||
public static bool UseMicaOnWindows11
|
||||
{
|
||||
get => OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) && _enableMicaOnWindows11;
|
||||
set => _enableMicaOnWindows11 = value;
|
||||
}
|
||||
|
||||
public static bool UseSystemWindowFrame
|
||||
{
|
||||
get => OperatingSystem.IsLinux() && _enableSystemWindowFrame;
|
||||
@@ -330,6 +324,5 @@ namespace SourceGit.Native
|
||||
private static IBackend _backend = null;
|
||||
private static string _gitExecutable = string.Empty;
|
||||
private static bool _enableSystemWindowFrame = false;
|
||||
private static bool _enableMicaOnWindows11 = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,26 +9,12 @@ using System.Text.Json;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace SourceGit.Native
|
||||
{
|
||||
[SupportedOSPlatform("windows")]
|
||||
internal class Windows : OS.IBackend
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MARGINS
|
||||
{
|
||||
public int cxLeftWidth;
|
||||
public int cxRightWidth;
|
||||
public int cyTopHeight;
|
||||
public int cyBottomHeight;
|
||||
}
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
|
||||
|
||||
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
||||
private static extern bool PathFindOnPath([In, Out] StringBuilder pszFile, [In] string[] ppszOtherDirs);
|
||||
|
||||
@@ -43,19 +29,13 @@ namespace SourceGit.Native
|
||||
|
||||
public void SetupApp(AppBuilder builder)
|
||||
{
|
||||
// Fix drop shadow issue on Windows 10
|
||||
if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000))
|
||||
{
|
||||
Window.WindowStateProperty.Changed.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
|
||||
Control.LoadedEvent.AddClassHandler<Window>((w, _) => FixWindowFrameOnWin10(w));
|
||||
}
|
||||
// Do nothing for now.
|
||||
}
|
||||
|
||||
public void SetupWindow(Window window)
|
||||
{
|
||||
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
window.WindowDecorations = WindowDecorations.BorderOnly;
|
||||
window.ExtendClientAreaToDecorationsHint = true;
|
||||
window.BorderThickness = new Thickness(1);
|
||||
}
|
||||
|
||||
public string GetDataDir()
|
||||
@@ -212,21 +192,6 @@ namespace SourceGit.Native
|
||||
}
|
||||
|
||||
#region HELPER_METHODS
|
||||
private void FixWindowFrameOnWin10(Window w)
|
||||
{
|
||||
// Schedule the DWM frame extension to run in the next render frame
|
||||
// to ensure proper timing with the window initialization sequence
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
var platformHandle = w.TryGetPlatformHandle();
|
||||
if (platformHandle == null)
|
||||
return;
|
||||
|
||||
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
|
||||
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
|
||||
}, DispatcherPriority.Render);
|
||||
}
|
||||
|
||||
private List<Models.ExternalTool.LaunchOption> GenerateVSProjectLaunchOptions(string path)
|
||||
{
|
||||
var root = new DirectoryInfo(path);
|
||||
|
||||
@@ -19,45 +19,39 @@
|
||||
</Style.Resources>
|
||||
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.WindowBorder}"/>
|
||||
<Setter Property="SystemDecorations" Value="Full"/>
|
||||
<Setter Property="WindowDecorations" Value="Full"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ClipToBounds="True">
|
||||
<Border Margin="{TemplateBinding Padding}">
|
||||
<VisualLayerManager>
|
||||
<LayoutTransformControl>
|
||||
<LayoutTransformControl.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"
|
||||
ScaleY="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"/>
|
||||
</LayoutTransformControl.LayoutTransform>
|
||||
|
||||
<Border>
|
||||
<ContentPresenter Name="PART_ContentPresenter"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</LayoutTransformControl>
|
||||
</VisualLayerManager>
|
||||
</Border>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<Panel>
|
||||
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
|
||||
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
|
||||
<Panel Background="Transparent" Margin="{TemplateBinding WindowDecorationMargin}" />
|
||||
<VisualLayerManager Name="PART_VisualLayerManager">
|
||||
<LayoutTransformControl>
|
||||
<LayoutTransformControl.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"
|
||||
ScaleY="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"/>
|
||||
</LayoutTransformControl.LayoutTransform>
|
||||
|
||||
<ContentPresenter Name="PART_ContentPresenter"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</LayoutTransformControl>
|
||||
</VisualLayerManager>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Window.custom_window_frame">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="SystemDecorations" Value="None"/>
|
||||
<Setter Property="WindowDecorations" Value="None"/>
|
||||
<Setter Property="Padding" Value="12"/>
|
||||
<Setter Property="CornerRadius" Value="8"/>
|
||||
|
||||
@@ -129,28 +123,25 @@
|
||||
Tag="{x:Static WindowEdge.SouthEast}"/>
|
||||
|
||||
<Grid Margin="{TemplateBinding Padding}" Effect="drop-shadow(0 0 12 #A0000000)">
|
||||
<Border x:Name="PART_ContentRoot"
|
||||
Background="{DynamicResource Brush.Window}"
|
||||
BorderBrush="{DynamicResource Brush.WindowBorder}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<VisualLayerManager>
|
||||
<Panel>
|
||||
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
|
||||
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
|
||||
<Panel Background="Transparent" Margin="{TemplateBinding WindowDecorationMargin}" />
|
||||
<VisualLayerManager Name="PART_VisualLayerManager">
|
||||
<LayoutTransformControl>
|
||||
<LayoutTransformControl.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"
|
||||
ScaleY="{Binding Source={x:Static vm:Preferences.Instance}, Path=Zoom, Mode=OneWay}"/>
|
||||
</LayoutTransformControl.LayoutTransform>
|
||||
|
||||
<Border CornerRadius="{TemplateBinding CornerRadius}" ClipToBounds="True">
|
||||
<ContentPresenter Name="PART_ContentPresenter"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
|
||||
<ContentPresenter Name="PART_ContentPresenter"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</LayoutTransformControl>
|
||||
</VisualLayerManager>
|
||||
</Border>
|
||||
</Panel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
@@ -1442,7 +1433,7 @@
|
||||
Padding="10">
|
||||
<Grid RowDefinitions="Auto,Auto">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBox Watermark="{x:Static ae:SR.SearchLabel}"
|
||||
<TextBox PlaceholderText="{x:Static ae:SR.SearchLabel}"
|
||||
Name="PART_searchTextBox"
|
||||
Width="265" Height="28"
|
||||
Margin="0,0,0,0"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
@@ -47,12 +47,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.13" />
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.13" Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="Avalonia" Version="12.0.1" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="12.0.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="12.0.1" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.1" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.1" />
|
||||
<PackageReference Include="Azure.AI.OpenAI" Version="2.9.0-beta.1" />
|
||||
<PackageReference Include="BitMiracle.LibTiff.NET" Version="2.4.660" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
@@ -68,3 +67,4 @@
|
||||
<TrimmerRootAssembly Include="Avalonia.Themes.Fluent" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
@@ -46,7 +46,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Remote.URL.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Remote.URL.Placeholder}"
|
||||
Text="{Binding Url, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
@@ -70,7 +70,7 @@
|
||||
Height="28"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
Text="{Binding SSHKey, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.RepositoryURL}"
|
||||
PlaceholderText="{DynamicResource Text.RepositoryURL}"
|
||||
Text="{Binding Url, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
@@ -49,7 +49,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
|
||||
Text="{Binding RelativePath, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Path, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.AddWorktree.Location.Placeholder}">
|
||||
PlaceholderText="{DynamicResource Text.AddWorktree.Location.Placeholder}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="SelectLocation">
|
||||
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
|
||||
@@ -58,7 +58,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding SelectedBranch, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.AddWorktree.Name.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.AddWorktree.Name.Placeholder}"
|
||||
IsEnabled="{Binding CreateNewBranch, Mode=OneWay}"
|
||||
IsVisible="{Binding CreateNewBranch, Mode=OneWay}"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
x:Name="TxtPatchFile"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Apply.File.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Apply.File.Placeholder}"
|
||||
Text="{Binding PatchFile, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectPatchFile">
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
x:Name="TxtSaveFile"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Archive.File.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Archive.File.Placeholder}"
|
||||
Text="{Binding SaveFile, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectOutputFile">
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
@@ -39,12 +40,9 @@ namespace SourceGit.Views
|
||||
{
|
||||
RenderOptions.SetBitmapInterpolationMode(this, BitmapInterpolationMode.HighQuality);
|
||||
|
||||
this.Bind(UseGitHubStyleAvatarProperty, new Binding()
|
||||
{
|
||||
Mode = BindingMode.OneWay,
|
||||
Source = ViewModels.Preferences.Instance,
|
||||
Path = "UseGitHubStyleAvatar"
|
||||
});
|
||||
Bind(UseGitHubStyleAvatarProperty, CompiledBinding.Create<ViewModels.Preferences, bool>(
|
||||
vm => vm.UseGitHubStyleAvatar,
|
||||
source: ViewModels.Preferences.Instance));
|
||||
}
|
||||
|
||||
public override void Render(DrawingContext context)
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public BlameCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
FileListBox.AddHandler(ListBox.KeyDownEvent, OnFileListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFileListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.BlameCommandPalette vm)
|
||||
{
|
||||
this.ShowWindow(vm.Launch());
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.BlameCommandPalette vm)
|
||||
|
||||
@@ -107,8 +107,7 @@
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
ItemsSource="{TemplateBinding VisibleBranches, Mode=OneWay}"
|
||||
SelectedItem="{TemplateBinding SelectedBranch, Mode=TwoWay}"
|
||||
KeyDown="OnDropDownListKeyDown">
|
||||
SelectedItem="{TemplateBinding SelectedBranch, Mode=TwoWay}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Vertical"/>
|
||||
|
||||
@@ -136,7 +136,12 @@ namespace SourceGit.Views
|
||||
private void OnPopupOpened(object sender, EventArgs e)
|
||||
{
|
||||
var listBox = _popup?.Child?.FindDescendantOfType<ListBox>();
|
||||
listBox?.Focus();
|
||||
if (listBox != null)
|
||||
{
|
||||
listBox.RemoveHandler(ListBox.KeyDownEvent, OnDropDownListKeyDown);
|
||||
listBox.AddHandler(ListBox.KeyDownEvent, OnDropDownListKeyDown, handledEventsToo: true);
|
||||
listBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPopupClosed(object sender, EventArgs e)
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace SourceGit.Views
|
||||
if (DataContext is not Models.Branch branch)
|
||||
break;
|
||||
|
||||
if (e.Root is not PopupRoot { Parent: Popup { Parent: Border owner } })
|
||||
if (e.RootVisual is not PopupRoot { Parent: Popup { Parent: Border owner } })
|
||||
break;
|
||||
|
||||
var tree = owner.FindAncestorOfType<BranchTree>();
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
x:Class="SourceGit.Views.CaptionButtons"
|
||||
x:Name="ThisControl">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Classes="caption_button" Click="MinimizeWindow" Win32Properties.NonClientHitTestResult="MinButton" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Button Classes="caption_button" Click="MinimizeWindow" WindowDecorationProperties.ElementRole="MinimizeButton" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Path Width="11" Height="11" Margin="0,2,0,0" Data="{StaticResource Icons.Window.Minimize}"/>
|
||||
</Button>
|
||||
<Button Classes="caption_button max_or_restore_btn" Win32Properties.NonClientHitTestResult="MaxButton" Click="MaximizeOrRestoreWindow" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Button Classes="caption_button max_or_restore_btn" Click="MaximizeOrRestoreWindow" WindowDecorationProperties.ElementRole="MaximizeButton" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Path Width="10" Height="10" Margin="0,4,0,0"/>
|
||||
</Button>
|
||||
<Button Classes="caption_button" Win32Properties.NonClientHitTestResult="Close" Click="CloseWindow">
|
||||
<Button Classes="caption_button" Click="CloseWindow" WindowDecorationProperties.ElementRole="CloseButton">
|
||||
<Path Width="9" Height="9" Margin="0,4,2,0" Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
@@ -23,7 +22,7 @@ namespace SourceGit.Views
|
||||
|
||||
private void MinimizeWindow(object _, RoutedEventArgs e)
|
||||
{
|
||||
var window = this.FindAncestorOfType<Window>();
|
||||
var window = TopLevel.GetTopLevel(this) as Window;
|
||||
if (window != null)
|
||||
window.WindowState = WindowState.Minimized;
|
||||
|
||||
@@ -32,7 +31,7 @@ namespace SourceGit.Views
|
||||
|
||||
private void MaximizeOrRestoreWindow(object _, RoutedEventArgs e)
|
||||
{
|
||||
var window = this.FindAncestorOfType<Window>();
|
||||
var window = TopLevel.GetTopLevel(this) as Window;
|
||||
if (window != null)
|
||||
window.WindowState = window.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
||||
|
||||
@@ -41,7 +40,7 @@ namespace SourceGit.Views
|
||||
|
||||
private void CloseWindow(object _, RoutedEventArgs e)
|
||||
{
|
||||
var window = this.FindAncestorOfType<Window>();
|
||||
var window = TopLevel.GetTopLevel(this) as Window;
|
||||
window?.Close();
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
@@ -44,9 +44,6 @@ namespace SourceGit.Views
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e.Handled && e.Key != Key.Space && e.Key != Key.Enter)
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.RepositoryURL}"
|
||||
PlaceholderText="{DynamicResource Text.RepositoryURL}"
|
||||
Text="{Binding Url, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public CheckoutCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
BranchListBox.AddHandler(ListBox.KeyDownEvent, OnBranchListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override async void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnBranchListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.CheckoutCommandPalette vm)
|
||||
{
|
||||
await vm.ExecAsync();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.CheckoutCommandPalette vm)
|
||||
|
||||
@@ -84,25 +84,6 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
||||
if (change.Property == WindowStateProperty && OperatingSystem.IsWindows())
|
||||
{
|
||||
if (WindowState == WindowState.Maximized)
|
||||
{
|
||||
BorderThickness = new Thickness(0);
|
||||
Padding = new Thickness(8, 6, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
BorderThickness = new Thickness(1);
|
||||
Padding = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
x:Name="TxtSshKey"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
Text="{Binding SSHKey, Mode=TwoWay}"
|
||||
IsVisible="{Binding UseSSH}">
|
||||
<TextBox.InnerLeftContent>
|
||||
@@ -90,7 +90,7 @@
|
||||
<TextBox Grid.Row="3" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Clone.LocalName.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Clone.LocalName.Placeholder}"
|
||||
Text="{Binding Local, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
@@ -100,7 +100,7 @@
|
||||
<TextBox Grid.Row="4" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Clone.AdditionalParam.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Clone.AdditionalParam.Placeholder}"
|
||||
Text="{Binding ExtraArgs, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
PlaceholderText="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
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}"/>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.IO;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
@@ -115,13 +115,8 @@ namespace SourceGit.Views
|
||||
if (_inlines.Count == 0)
|
||||
return;
|
||||
|
||||
var ro = new RenderOptions()
|
||||
{
|
||||
TextRenderingMode = TextRenderingMode.SubpixelAntialias,
|
||||
EdgeMode = EdgeMode.Antialias
|
||||
};
|
||||
|
||||
using (context.PushRenderOptions(ro))
|
||||
using (context.PushRenderOptions(new() { EdgeMode = EdgeMode.Antialias }))
|
||||
using (context.PushTextOptions(new() { TextRenderingMode = TextRenderingMode.Antialias }))
|
||||
{
|
||||
var height = Bounds.Height;
|
||||
var width = Bounds.Width;
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
PlaceholderText="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchFilter, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="14" Height="14" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Search}"/>
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public CompareCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
RefsListBox.AddHandler(ListBox.KeyDownEvent, OnRefsListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRefsListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.CompareCommandPalette vm)
|
||||
{
|
||||
this.ShowWindow(vm.Launch());
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.CompareCommandPalette vm)
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace SourceGit.Views
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Optional}"
|
||||
PlaceholderText="{DynamicResource Text.Optional}"
|
||||
Text="{Binding Scope, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
@@ -115,7 +115,7 @@
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Top"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Optional}"
|
||||
PlaceholderText="{DynamicResource Text.Optional}"
|
||||
Text="{Binding Detail, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
@@ -132,7 +132,7 @@
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Top"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Optional}"
|
||||
PlaceholderText="{DynamicResource Text.Optional}"
|
||||
Text="{Binding BreakingChanges, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0"
|
||||
@@ -143,7 +143,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Optional}"
|
||||
PlaceholderText="{DynamicResource Text.Optional}"
|
||||
Text="{Binding ClosedIssue, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.CreateBranch.Name.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.CreateBranch.Name.Placeholder}"/>
|
||||
|
||||
<Border Grid.Row="2" Grid.Column="0"
|
||||
Height="32"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Text="{Binding TagName, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.CreateTag.Name.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.CreateTag.Name.Placeholder}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
@@ -77,7 +77,7 @@
|
||||
AcceptsReturn="True" AcceptsTab="False"
|
||||
VerticalAlignment="Center" VerticalContentAlignment="Top"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.CreateTag.Message.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.CreateTag.Message.Placeholder}"
|
||||
Text="{Binding Message, Mode=TwoWay}"
|
||||
IsVisible="{Binding Annotated}"
|
||||
Tag="{Binding Source={x:Static v:StealHotKey.Enter}}"/>
|
||||
|
||||
@@ -48,19 +48,13 @@ namespace SourceGit.Views
|
||||
|
||||
public DateTimePresenter()
|
||||
{
|
||||
Bind(Use24HoursProperty, new Binding()
|
||||
{
|
||||
Mode = BindingMode.OneWay,
|
||||
Source = ViewModels.Preferences.Instance,
|
||||
Path = "Use24Hours"
|
||||
});
|
||||
Bind(Use24HoursProperty, CompiledBinding.Create<ViewModels.Preferences, bool>(
|
||||
vm => vm.Use24Hours,
|
||||
source: ViewModels.Preferences.Instance));
|
||||
|
||||
Bind(DateTimeFormatProperty, new Binding()
|
||||
{
|
||||
Mode = BindingMode.OneWay,
|
||||
Source = ViewModels.Preferences.Instance,
|
||||
Path = "DateTimeFormat"
|
||||
});
|
||||
Bind(DateTimeFormatProperty, CompiledBinding.Create<ViewModels.Preferences, int>(
|
||||
vm => vm.DateTimeFormat,
|
||||
source: ViewModels.Preferences.Instance));
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Remote.Name.Placeholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
@@ -45,7 +45,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Remote.URL.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Remote.URL.Placeholder}"
|
||||
Text="{Binding Url, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
@@ -69,7 +69,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.SSHKey.Placeholder}"
|
||||
Text="{Binding SSHKey, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="12" Height="12"
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
Height="28"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{Binding Placeholder, Mode=OneWay}"
|
||||
PlaceholderText="{Binding Placeholder, Mode=OneWay}"
|
||||
Text="{Binding Text, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
@@ -108,7 +108,7 @@
|
||||
<TextBox Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{Binding Placeholder, Mode=OneWay}"
|
||||
PlaceholderText="{Binding Placeholder, Mode=OneWay}"
|
||||
Text="{Binding Path, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectPath">
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public ExecuteCustomActionCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
ActionListBox.AddHandler(ListBox.KeyDownEvent, OnActionListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override async void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnActionListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.ExecuteCustomActionCommandPalette vm)
|
||||
{
|
||||
await vm.ExecAsync();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.ExecuteCustomActionCommandPalette vm)
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public FileHistoryCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
FileListBox.AddHandler(ListBox.KeyDownEvent, OnFileListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFileListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.FileHistoryCommandPalette vm)
|
||||
{
|
||||
this.ShowWindow(vm.Launch());
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.FileHistoryCommandPalette vm)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.GitFlow.StartPlaceholder}"
|
||||
PlaceholderText="{DynamicResource Text.GitFlow.StartPlaceholder}"
|
||||
Text="{Binding Name, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
Background="Transparent"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||
KeyDown="OnListKeyDown">
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
|
||||
@@ -15,10 +15,12 @@ namespace SourceGit.Views
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
RevisionList.AddHandler(ListBox.KeyDownEvent, OnRevisionListKeyDown, handledEventsToo: true);
|
||||
RevisionList.Focus();
|
||||
}
|
||||
|
||||
private void OnListKeyDown(object sender, KeyEventArgs e)
|
||||
private void OnRevisionListKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e is not { Key: Key.Enter, KeyModifiers: KeyModifiers.None })
|
||||
return;
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Optional}"
|
||||
PlaceholderText="{DynamicResource Text.Optional}"
|
||||
Text="{Binding TagPrefix, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,32,32,*,Auto">
|
||||
<!-- Bottom border -->
|
||||
<Border Grid.Column="0" Grid.ColumnSpan="5"
|
||||
x:Name="TitleBarBG"
|
||||
Background="{DynamicResource Brush.TitleBar}"
|
||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||
DoubleTapped="MaximizeOrRestoreWindow"
|
||||
PointerPressed="BeginMoveWindow"/>
|
||||
|
||||
@@ -4,9 +4,7 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml.MarkupExtensions;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
@@ -48,7 +46,6 @@ namespace SourceGit.Views
|
||||
{
|
||||
HasLeftCaptionButton = true;
|
||||
CaptionHeight = new GridLength(34);
|
||||
ExtendClientAreaChromeHints |= ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
else if (UseSystemWindowFrame)
|
||||
{
|
||||
@@ -62,17 +59,6 @@ namespace SourceGit.Views
|
||||
InitializeComponent();
|
||||
PositionChanged += OnPositionChanged;
|
||||
|
||||
if (Native.OS.UseMicaOnWindows11)
|
||||
{
|
||||
Background = Brushes.Transparent;
|
||||
TransparencyLevelHint = [WindowTransparencyLevel.Mica];
|
||||
TitleBarBG.Background = Brushes.Transparent;
|
||||
}
|
||||
else
|
||||
{
|
||||
TitleBarBG.Bind(BackgroundProperty, new DynamicResourceExtension("Brush.TitleBar"));
|
||||
}
|
||||
|
||||
var layout = ViewModels.Preferences.Instance.Layout;
|
||||
Width = layout.LauncherWidth;
|
||||
Height = layout.LauncherHeight;
|
||||
@@ -111,9 +97,7 @@ namespace SourceGit.Views
|
||||
base.OnOpened(e);
|
||||
|
||||
var preferences = ViewModels.Preferences.Instance;
|
||||
var state = preferences.Layout.LauncherWindowState;
|
||||
if (state == WindowState.Maximized || state == WindowState.FullScreen)
|
||||
WindowState = WindowState.Maximized;
|
||||
WindowState = preferences.Layout.LauncherWindowState;
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
|
||||
@@ -60,61 +60,62 @@
|
||||
<Grid RowDefinitions="Auto,Auto,*" Width="560" HorizontalAlignment="Center">
|
||||
<!-- Popup -->
|
||||
<Border Grid.Row="0"
|
||||
Margin="6,0"
|
||||
Padding="6,0,6,6"
|
||||
Background="Transparent"
|
||||
Effect="drop-shadow(0 0 8 #8F000000)"
|
||||
CornerRadius="0,0,8,8"
|
||||
ClipToBounds="True"
|
||||
IsVisible="{Binding Popup, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<ContentControl x:Name="PopupPanel" Content="{Binding Popup}" Background="{DynamicResource Brush.Popup}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="vm:Popup">
|
||||
<StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}">
|
||||
<!-- Popup Widget -->
|
||||
<ContentControl Margin="8,16,8,8"
|
||||
Content="{Binding}"
|
||||
IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<ContentControl.DataTemplates>
|
||||
<v:PopupDataTemplates/>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
<Border CornerRadius="0,0,8,8" ClipToBounds="True">
|
||||
<ContentControl x:Name="PopupPanel" Content="{Binding Popup}" Background="{DynamicResource Brush.Popup}">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="vm:Popup">
|
||||
<StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}">
|
||||
<!-- Popup Widget -->
|
||||
<ContentControl Margin="8,16,8,8"
|
||||
Content="{Binding}"
|
||||
IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<ContentControl.DataTemplates>
|
||||
<v:PopupDataTemplates/>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
<!-- Options -->
|
||||
<StackPanel Margin="8,4,8,8"
|
||||
Height="32"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<Button Width="0" Height="0"
|
||||
Click="OnPopupSureByHotKey"
|
||||
HotKey="Enter"
|
||||
Focusable="False"/>
|
||||
<Button Classes="flat primary"
|
||||
Width="100" Height="28"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{DynamicResource Text.Sure}"
|
||||
Click="OnPopupSure"
|
||||
ToolTip.Tip="Enter"/>
|
||||
<Button Classes="flat"
|
||||
Width="100" Height="28"
|
||||
Margin="8,0,0,0"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{DynamicResource Text.Cancel}"
|
||||
Click="OnPopupCancel"
|
||||
ToolTip.Tip="ESC"/>
|
||||
<!-- Options -->
|
||||
<StackPanel Margin="8,4,8,8"
|
||||
Height="32"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
|
||||
<Button Width="0" Height="0"
|
||||
Click="OnPopupSureByHotKey"
|
||||
HotKey="Enter"
|
||||
Focusable="False"/>
|
||||
<Button Classes="flat primary"
|
||||
Width="100" Height="28"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{DynamicResource Text.Sure}"
|
||||
Click="OnPopupSure"
|
||||
ToolTip.Tip="Enter"/>
|
||||
<Button Classes="flat"
|
||||
Width="100" Height="28"
|
||||
Margin="8,0,0,0"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{DynamicResource Text.Cancel}"
|
||||
Click="OnPopupCancel"
|
||||
ToolTip.Tip="ESC"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Running -->
|
||||
<v:PopupRunningStatus Margin="12,8"
|
||||
Description="{Binding ProgressDescription}"
|
||||
IsVisible="{Binding InProgress}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Running -->
|
||||
<v:PopupRunningStatus Margin="12,8"
|
||||
Description="{Binding ProgressDescription}"
|
||||
IsVisible="{Binding InProgress}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<!-- Notifications Clear Button -->
|
||||
|
||||
@@ -14,7 +14,10 @@ namespace SourceGit.Views
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
FilterTextBox.Focus(NavigationMethod.Directional);
|
||||
PageListBox.AddHandler(ListBox.KeyDownEvent, OnListBoxKeyDown, handledEventsToo: true);
|
||||
RepoListBox.AddHandler(ListBox.KeyDownEvent, OnListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -98,6 +101,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.LauncherPagesCommandPalette vm)
|
||||
{
|
||||
vm.OpenOrSwitchTo();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.LauncherPagesCommandPalette vm)
|
||||
|
||||
@@ -209,24 +209,23 @@ namespace SourceGit.Views
|
||||
}
|
||||
else
|
||||
{
|
||||
_pressedTab = true;
|
||||
_pressedTabEvent = e;
|
||||
_startDragTab = false;
|
||||
_pressedTabPosition = e.GetPosition(border);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPointerReleasedTab(object _1, PointerReleasedEventArgs _2)
|
||||
{
|
||||
_pressedTab = false;
|
||||
_pressedTabEvent = null;
|
||||
_startDragTab = false;
|
||||
}
|
||||
|
||||
private async void OnPointerMovedOverTab(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (_pressedTab && !_startDragTab && sender is Border { DataContext: ViewModels.LauncherPage page } border)
|
||||
if (_pressedTabEvent != null && !_startDragTab && sender is Border { DataContext: ViewModels.LauncherPage page } border)
|
||||
{
|
||||
var delta = e.GetPosition(border) - _pressedTabPosition;
|
||||
var delta = e.GetPosition(border) - _pressedTabEvent.GetPosition(border);
|
||||
var sizeSquired = delta.X * delta.X + delta.Y * delta.Y;
|
||||
if (sizeSquired < 64)
|
||||
return;
|
||||
@@ -235,7 +234,7 @@ namespace SourceGit.Views
|
||||
|
||||
var data = new DataTransfer();
|
||||
data.Add(DataTransferItem.Create(_dndMainTabFormat, page.Node.Id));
|
||||
await DragDrop.DoDragDropAsync(e, data, DragDropEffects.Move);
|
||||
await DragDrop.DoDragDropAsync(_pressedTabEvent, data, DragDropEffects.Move);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
@@ -269,7 +268,7 @@ namespace SourceGit.Views
|
||||
|
||||
launcher.MoveTab(target, to);
|
||||
|
||||
_pressedTab = false;
|
||||
_pressedTabEvent = null;
|
||||
_startDragTab = false;
|
||||
e.Handled = true;
|
||||
}
|
||||
@@ -393,8 +392,7 @@ namespace SourceGit.Views
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private bool _pressedTab = false;
|
||||
private Point _pressedTabPosition = new();
|
||||
private PointerPressedEventArgs _pressedTabEvent = null;
|
||||
private bool _startDragTab = false;
|
||||
private readonly DataFormat<string> _dndMainTabFormat = DataFormat.CreateStringApplicationFormat("sourcegit-dnd-main-tab");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public MergeCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
BranchListBox.AddHandler(ListBox.KeyDownEvent, OnBranchListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBranchListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.MergeCommandPalette vm)
|
||||
{
|
||||
vm.Launch();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.MergeCommandPalette vm)
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace SourceGit.Views
|
||||
if (_scrollViewer != null)
|
||||
{
|
||||
_scrollViewer.ScrollChanged += OnTextViewScrollChanged;
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, new Binding("ScrollOffset", BindingMode.OneWay));
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, CompiledBinding.Create<ViewModels.MergeConflictEditor, Vector>(vm => vm.ScrollOffset));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
|
||||
Text="{Binding MoveTo, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SourceGit.Views
|
||||
public OpenFileCommandPalette()
|
||||
{
|
||||
InitializeComponent();
|
||||
FileListBox.AddHandler(ListBox.KeyDownEvent, OnFileListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -51,6 +52,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFileListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.OpenFileCommandPalette vm)
|
||||
{
|
||||
vm.Launch();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.OpenFileCommandPalette vm)
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #ThisControl.DefaultUser, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preferences.Git.User.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.Preferences.Git.User.Placeholder}"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preferences.Git.Email}"
|
||||
@@ -360,7 +360,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #ThisControl.DefaultEmail, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preferences.Git.Email.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.Preferences.Git.Email.Placeholder}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preferences.Git.CRLF}"
|
||||
@@ -463,7 +463,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #ThisControl.GPGExecutableFile, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preferences.GPG.Path.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Preferences.GPG.Path.Placeholder}"
|
||||
IsVisible="{Binding #ThisControl.GPGFormat.NeedFindProgram}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectGPGExecutable">
|
||||
@@ -480,7 +480,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding #ThisControl.GPGUserKey, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preferences.GPG.UserKey.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.Preferences.GPG.UserKey.Placeholder}"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Preferences.GPG.CommitEnabled}"
|
||||
@@ -615,7 +615,7 @@
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Text="{Binding ExternalMergeToolPath, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Preferences.DiffMerge.Path.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Preferences.DiffMerge.Path.Placeholder}"
|
||||
IsVisible="{Binding ExternalMergeToolType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" Width="30" Height="30" Click="SelectExternalMergeTool">
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Name, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.RenameBranch.Name.Placeholder}"/>
|
||||
PlaceholderText="{DynamicResource Text.RenameBranch.Name.Placeholder}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Watermark="{DynamicResource Text.Repository.Filter}"
|
||||
PlaceholderText="{DynamicResource Text.Repository.Filter}"
|
||||
Text="{Binding Filter, Mode=TwoWay}"
|
||||
VerticalContentAlignment="Center">
|
||||
<TextBox.InnerLeftContent>
|
||||
@@ -514,7 +514,7 @@
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
CornerRadius="12"
|
||||
Watermark="{DynamicResource Text.Repository.Search}"
|
||||
PlaceholderText="{DynamicResource Text.Repository.Search}"
|
||||
Text="{Binding SearchCommitContext.Filter, Mode=TwoWay}"
|
||||
VerticalContentAlignment="Center"
|
||||
KeyDown="OnSearchKeyDown">
|
||||
|
||||
@@ -14,7 +14,9 @@ namespace SourceGit.Views
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
FilterTextBox.Focus(NavigationMethod.Directional);
|
||||
CmdListBox.AddHandler(ListBox.KeyDownEvent, OnCmdListBoxKeyDown, handledEventsToo: true);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
@@ -58,6 +60,15 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCmdListBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is ViewModels.RepositoryCommandPalette vm)
|
||||
{
|
||||
vm.Exec();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.RepositoryCommandPalette vm)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Configure.User.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Configure.User.Placeholder}"
|
||||
Text="{Binding UserName, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
@@ -62,7 +62,7 @@
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Configure.Email.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Configure.Email.Placeholder}"
|
||||
Text="{Binding UserEmail, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
@@ -127,7 +127,7 @@
|
||||
<TextBox Grid.Row="4" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Configure.Proxy.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Configure.Proxy.Placeholder}"
|
||||
Text="{Binding HttpProxy, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
<Button Classes="icon_button" IsVisible="{Binding HttpProxy, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Command="{Binding ClearHttpProxy}">
|
||||
@@ -143,7 +143,7 @@
|
||||
<TextBox Grid.Row="5" Grid.Column="1"
|
||||
Height="28"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.Preferences.GPG.UserKey.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Preferences.GPG.UserKey.Placeholder}"
|
||||
Text="{Binding GPGUserSigningKey, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="0"
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace SourceGit.Views
|
||||
|
||||
RenderOptions.SetBitmapInterpolationMode(menu, BitmapInterpolationMode.HighQuality);
|
||||
RenderOptions.SetEdgeMode(menu, EdgeMode.Antialias);
|
||||
RenderOptions.SetTextRenderingMode(menu, TextRenderingMode.Antialias);
|
||||
TextOptions.SetTextOptions(menu, new TextOptions() { TextRenderingMode = TextRenderingMode.Antialias });
|
||||
|
||||
var explore = new MenuItem();
|
||||
explore.Header = App.Text("Repository.Explore");
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
PlaceholderText="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchFilter, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="14" Height="14" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Search}"/>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Files.Search}"
|
||||
PlaceholderText="{DynamicResource Text.CommitDetail.Files.Search}"
|
||||
Text="{Binding RevisionFileSearchFilter, Mode=TwoWay}"
|
||||
KeyDown="OnSearchBoxKeyDown"
|
||||
TextChanged="OnSearchBoxTextChanged">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
Height="26"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="3"
|
||||
Watermark="{DynamicResource Text.SetSubmoduleBranch.New.Tip}"
|
||||
PlaceholderText="{DynamicResource Text.SetSubmoduleBranch.New.Tip}"
|
||||
Text="{Binding ChangeTo, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
Margin="0,4,0,0"
|
||||
CornerRadius="3"
|
||||
Text="{Binding Message, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Stash.Message.Placeholder}"
|
||||
PlaceholderText="{DynamicResource Text.Stash.Message.Placeholder}"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="False"
|
||||
VerticalContentAlignment="Top"
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="Transparent"
|
||||
CornerRadius="4"
|
||||
Watermark="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
PlaceholderText="{DynamicResource Text.CommitDetail.Changes.Search}"
|
||||
Text="{Binding SearchFilter, Mode=TwoWay}">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="14" Height="14" Margin="4,0,0,0" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Search}"/>
|
||||
|
||||
@@ -911,7 +911,7 @@ namespace SourceGit.Views
|
||||
_scrollViewer = this.FindDescendantOfType<ScrollViewer>();
|
||||
if (_scrollViewer != null)
|
||||
{
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, new Binding("ScrollOffset", BindingMode.TwoWay));
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, CompiledBinding.Create<ViewModels.TextDiffContext, Vector>(vm => vm.ScrollOffset, mode: BindingMode.TwoWay));
|
||||
_scrollViewer.ScrollChanged += OnTextViewScrollChanged;
|
||||
}
|
||||
}
|
||||
@@ -1097,7 +1097,7 @@ namespace SourceGit.Views
|
||||
if (_scrollViewer != null)
|
||||
{
|
||||
_scrollViewer.ScrollChanged += OnTextViewScrollChanged;
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, new Binding("ScrollOffset", BindingMode.OneWay));
|
||||
_scrollViewer.Bind(ScrollViewer.OffsetProperty, CompiledBinding.Create<ViewModels.TextDiffContext, Vector>(vm => vm.ScrollOffset));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
BorderBrush="{DynamicResource Brush.Border0}"
|
||||
BorderThickness="1"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
Watermark="{DynamicResource Text.Welcome.Search}"
|
||||
PlaceholderText="{DynamicResource Text.Welcome.Search}"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding SearchFilter, Mode=TwoWay}">
|
||||
<TextBox.Styles>
|
||||
|
||||
@@ -205,29 +205,29 @@ namespace SourceGit.Views
|
||||
{
|
||||
if (e.GetCurrentPoint(sender as Visual).Properties.IsLeftButtonPressed)
|
||||
{
|
||||
_pressedTreeNode = true;
|
||||
_pressTreeNodeEvent = e;
|
||||
_startDragTreeNode = false;
|
||||
_pressedTreeNodePosition = e.GetPosition(sender as Grid);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pressedTreeNode = false;
|
||||
_pressTreeNodeEvent = null;
|
||||
_startDragTreeNode = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPointerReleasedOnTreeNode(object _1, PointerReleasedEventArgs _2)
|
||||
{
|
||||
_pressedTreeNode = false;
|
||||
_pressTreeNodeEvent = null;
|
||||
_startDragTreeNode = false;
|
||||
}
|
||||
|
||||
private async void OnPointerMovedOverTreeNode(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (_pressedTreeNode && !_startDragTreeNode &&
|
||||
if (_pressTreeNodeEvent != null &&
|
||||
!_startDragTreeNode &&
|
||||
sender is Grid { DataContext: ViewModels.RepositoryNode node } grid)
|
||||
{
|
||||
var delta = e.GetPosition(grid) - _pressedTreeNodePosition;
|
||||
var delta = e.GetPosition(grid) - _pressTreeNodeEvent.GetPosition(grid);
|
||||
var sizeSquired = delta.X * delta.X + delta.Y * delta.Y;
|
||||
if (sizeSquired < 64)
|
||||
return;
|
||||
@@ -236,13 +236,13 @@ namespace SourceGit.Views
|
||||
|
||||
var data = new DataTransfer();
|
||||
data.Add(DataTransferItem.Create(_dndRepoNode, node.Id));
|
||||
await DragDrop.DoDragDropAsync(e, data, DragDropEffects.Move);
|
||||
await DragDrop.DoDragDropAsync(_pressTreeNodeEvent, data, DragDropEffects.Move);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTreeViewLostFocus(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
_pressedTreeNode = false;
|
||||
_pressTreeNodeEvent = null;
|
||||
_startDragTreeNode = false;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace SourceGit.Views
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
}
|
||||
|
||||
_pressedTreeNode = false;
|
||||
_pressTreeNodeEvent = null;
|
||||
_startDragTreeNode = false;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace SourceGit.Views
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
}
|
||||
|
||||
_pressedTreeNode = false;
|
||||
_pressTreeNodeEvent = null;
|
||||
_startDragTreeNode = false;
|
||||
}
|
||||
|
||||
@@ -365,8 +365,7 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private bool _pressedTreeNode = false;
|
||||
private Point _pressedTreeNodePosition = new Point();
|
||||
private PointerPressedEventArgs _pressTreeNodeEvent = null;
|
||||
private bool _startDragTreeNode = false;
|
||||
private readonly DataFormat<string> _dndRepoNode = DataFormat.CreateStringApplicationFormat("sourcegit-dnd-repo-node");
|
||||
private CancellationTokenSource _cancellation = new CancellationTokenSource();
|
||||
|
||||
Reference in New Issue
Block a user