mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
code_review: PR #431
* move resources and styles for macOS caption button to `CaptionButtonsMacOS` because it is never used by others and should not been changed * add `IsCloseButtonOnly` property to `CaptionButtons` and `CaptionButtonsMacOS` and replace the controls in windows
This commit is contained in:
parent
e3ee07be70
commit
e19d025572
25 changed files with 269 additions and 339 deletions
|
@ -429,85 +429,6 @@
|
|||
<Setter Property="Stroke" Value="Red"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.caption_button_macos">
|
||||
<Setter Property="Width" Value="24"/>
|
||||
<Setter Property="Height" Value="24"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos:nth-child(1)">
|
||||
<Setter Property="Margin" Value="6,0,0,0"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos Ellipse">
|
||||
<Setter Property="Width" Value="14"/>
|
||||
<Setter Property="Height" Value="14"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="StrokeThickness" Value=".5"/>
|
||||
<Setter Property="Stroke" Value="#40000000"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.close Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Close}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.minimize Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Minimize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.maximize Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Maximize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.close:pressed Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.ClosePressed}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.minimize:pressed Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizePressed}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.maximize:pressed Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizePressed}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos Path">
|
||||
<Setter Property="Width" Value="8"/>
|
||||
<Setter Property="Height" Value="8"/>
|
||||
<Setter Property="Stretch" Value="Fill"/>
|
||||
<Setter Property="Fill" Value="Black"/>
|
||||
<Setter Property="IsVisible" Value="False"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.close Path">
|
||||
<Setter Property="Width" Value="6"/>
|
||||
<Setter Property="Height" Value="6"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.CloseFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Close}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.minimize Path">
|
||||
<Setter Property="Width" Value="8"/>
|
||||
<Setter Property="Height" Value="2"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizeFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Minimize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.maximize Path">
|
||||
<Setter Property="Width" Value="6"/>
|
||||
<Setter Property="Height" Value="6"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizeFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Maximize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.close:pressed Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.ClosePressedFG}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.minimize:pressed Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizePressedFG}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos.maximize:pressed Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizePressedFG}"/>
|
||||
</Style>
|
||||
<Style Selector="Grid.caption_button_box:pointerover Button.caption_button_macos Path">
|
||||
<Setter Property="IsVisible" Value="True"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
<Style Selector="Button.caption_button_macos:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.caption_button">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
|
|
|
@ -2,18 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Color x:Key="Color.MacOS.Close">#FFED6A5E</Color>
|
||||
<Color x:Key="Color.MacOS.CloseFG">#FF69110A</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressed">#FFB24F46</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressedFG">#FF2E0402</Color>
|
||||
<Color x:Key="Color.MacOS.Minimize">#FFF4BF4F</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizeFG">#FF8F591D</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressed">#FFB78F3A</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressedFG">#FF522A0A</Color>
|
||||
<Color x:Key="Color.MacOS.Maximize">#FF61C554</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizeFG">#FF296017</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressed">#FF48943F</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressedFG">#FF102F07</Color>
|
||||
<Color x:Key="Color.Window">#FFF0F5F9</Color>
|
||||
<Color x:Key="Color.WindowBorder">#00000000</Color>
|
||||
<Color x:Key="Color.TitleBar">#FFCFDEEA</Color>
|
||||
|
@ -46,18 +34,6 @@
|
|||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Color x:Key="Color.MacOS.Close">#FFED6A5E</Color>
|
||||
<Color x:Key="Color.MacOS.CloseFG">#FF8C1A10</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressed">#FFF09389</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressedFG">#FF69120A</Color>
|
||||
<Color x:Key="Color.MacOS.Minimize">#FFF4BF4F</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizeFG">#FF8F591D</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressed">#FFFBEB74</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressedFG">#FF705F1B</Color>
|
||||
<Color x:Key="Color.MacOS.Maximize">#FF61C554</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizeFG">#FF296017</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressed">#FF86F37F</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressedFG">#FF2C681A</Color>
|
||||
<Color x:Key="Color.Window">#FF252525</Color>
|
||||
<Color x:Key="Color.WindowBorder">#FF444444</Color>
|
||||
<Color x:Key="Color.TitleBar">#FF1F1F1F</Color>
|
||||
|
@ -89,19 +65,7 @@
|
|||
<Color x:Key="Color.Link">#4DAAFC</Color>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Close" Color="{DynamicResource Color.MacOS.Close}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.CloseFG" Color="{DynamicResource Color.MacOS.CloseFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.ClosePressed" Color="{DynamicResource Color.MacOS.ClosePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.ClosePressedFG" Color="{DynamicResource Color.MacOS.ClosePressedFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Minimize" Color="{DynamicResource Color.MacOS.Minimize}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizeFG" Color="{DynamicResource Color.MacOS.MinimizeFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizePressed" Color="{DynamicResource Color.MacOS.MinimizePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizePressedFG" Color="{DynamicResource Color.MacOS.MinimizePressedFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Maximize" Color="{DynamicResource Color.MacOS.Maximize}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizeFG" Color="{DynamicResource Color.MacOS.MaximizeFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizePressed" Color="{DynamicResource Color.MacOS.MaximizePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizePressedFG" Color="{DynamicResource Color.MacOS.MaximizePressedFG}"/>
|
||||
|
||||
<SolidColorBrush x:Key="Brush.Window" Color="{DynamicResource Color.Window}"/>
|
||||
<SolidColorBrush x:Key="Brush.WindowBorder" Color="{DynamicResource Color.WindowBorder}"/>
|
||||
<SolidColorBrush x:Key="Brush.TitleBar" Color="{DynamicResource Color.TitleBar}"/>
|
||||
|
|
|
@ -24,28 +24,21 @@
|
|||
Margin="10,0,0,0"
|
||||
Data="{StaticResource Icons.Info}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.About}"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*">
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System.Reflection;
|
||||
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -28,11 +26,6 @@ namespace SourceGit.Views
|
|||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnVisitAvaloniaUI(object _, PointerPressedEventArgs e)
|
||||
{
|
||||
Native.OS.OpenBrowser("https://www.avaloniaui.net/");
|
||||
|
|
|
@ -24,15 +24,11 @@
|
|||
Margin="10,0,0,0"
|
||||
Data="{StaticResource Icons.Password}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -40,12 +36,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="0,16" Orientation="Vertical">
|
||||
|
|
|
@ -28,14 +28,10 @@
|
|||
Data="{StaticResource Icons.File.Ignore}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -43,12 +39,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Unchanged Files -->
|
||||
|
|
|
@ -16,11 +16,6 @@ namespace SourceGit.Views
|
|||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnRemoveButtonClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.AssumeUnchangedManager vm && sender is Button button)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
|
@ -6,6 +7,15 @@ namespace SourceGit.Views
|
|||
{
|
||||
public partial class CaptionButtons : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<bool> IsCloseButtonOnlyProperty =
|
||||
AvaloniaProperty.Register<CaptionButtons, bool>(nameof(IsCloseButtonOnly));
|
||||
|
||||
public bool IsCloseButtonOnly
|
||||
{
|
||||
get => GetValue(IsCloseButtonOnlyProperty);
|
||||
set => SetValue(IsCloseButtonOnlyProperty, value);
|
||||
}
|
||||
|
||||
public CaptionButtons()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -3,22 +3,152 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.CaptionButtonsMacOS">
|
||||
x:Class="SourceGit.Views.CaptionButtonsMacOS"
|
||||
x:Name="ThisControl">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Color x:Key="Color.MacOS.Close">#FFED6A5E</Color>
|
||||
<Color x:Key="Color.MacOS.CloseFG">#FF69110A</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressed">#FFB24F46</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressedFG">#FF2E0402</Color>
|
||||
<Color x:Key="Color.MacOS.Minimize">#FFF4BF4F</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizeFG">#FF8F591D</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressed">#FFB78F3A</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressedFG">#FF522A0A</Color>
|
||||
<Color x:Key="Color.MacOS.Maximize">#FF61C554</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizeFG">#FF296017</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressed">#FF48943F</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressedFG">#FF102F07</Color>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Color x:Key="Color.MacOS.Close">#FFED6A5E</Color>
|
||||
<Color x:Key="Color.MacOS.CloseFG">#FF8C1A10</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressed">#FFF09389</Color>
|
||||
<Color x:Key="Color.MacOS.ClosePressedFG">#FF69120A</Color>
|
||||
<Color x:Key="Color.MacOS.Minimize">#FFF4BF4F</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizeFG">#FF8F591D</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressed">#FFFBEB74</Color>
|
||||
<Color x:Key="Color.MacOS.MinimizePressedFG">#FF705F1B</Color>
|
||||
<Color x:Key="Color.MacOS.Maximize">#FF61C554</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizeFG">#FF296017</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressed">#FF86F37F</Color>
|
||||
<Color x:Key="Color.MacOS.MaximizePressedFG">#FF2C681A</Color>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Close" Color="{DynamicResource Color.MacOS.Close}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.CloseFG" Color="{DynamicResource Color.MacOS.CloseFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.ClosePressed" Color="{DynamicResource Color.MacOS.ClosePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.ClosePressedFG" Color="{DynamicResource Color.MacOS.ClosePressedFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Minimize" Color="{DynamicResource Color.MacOS.Minimize}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizeFG" Color="{DynamicResource Color.MacOS.MinimizeFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizePressed" Color="{DynamicResource Color.MacOS.MinimizePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MinimizePressedFG" Color="{DynamicResource Color.MacOS.MinimizePressedFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.Maximize" Color="{DynamicResource Color.MacOS.Maximize}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizeFG" Color="{DynamicResource Color.MacOS.MaximizeFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizePressed" Color="{DynamicResource Color.MacOS.MaximizePressed}"/>
|
||||
<SolidColorBrush x:Key="Brush.MacOS.MaximizePressedFG" Color="{DynamicResource Color.MacOS.MaximizePressedFG}"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Width" Value="24"/>
|
||||
<Setter Property="Height" Value="24"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style Selector="Button /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button>Grid>Ellipse">
|
||||
<Setter Property="Width" Value="14"/>
|
||||
<Setter Property="Height" Value="14"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="StrokeThickness" Value=".5"/>
|
||||
<Setter Property="Stroke" Value="#40000000"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.close>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Close}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.minimize>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Minimize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.maximize>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.Maximize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.close:pressed>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.ClosePressed}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.minimize:pressed>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizePressed}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.maximize:pressed>Grid>Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizePressed}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button>Grid>Path">
|
||||
<Setter Property="Stretch" Value="Fill"/>
|
||||
<Setter Property="Fill" Value="Black"/>
|
||||
<Setter Property="IsVisible" Value="False"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style Selector="Button.close>Grid>Path">
|
||||
<Setter Property="Width" Value="6"/>
|
||||
<Setter Property="Height" Value="6"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.CloseFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Close}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.minimize>Grid>Path">
|
||||
<Setter Property="Width" Value="8"/>
|
||||
<Setter Property="Height" Value="2"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizeFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Minimize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.maximize>Grid>Path">
|
||||
<Setter Property="Width" Value="6"/>
|
||||
<Setter Property="Height" Value="6"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizeFG}"/>
|
||||
<Setter Property="Data" Value="{StaticResource Icons.MacOS.Maximize}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.close:pressed>Grid>Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.ClosePressedFG}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.minimize:pressed>Grid>Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MinimizePressedFG}"/>
|
||||
</Style>
|
||||
<Style Selector="Button.maximize:pressed>Grid>Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource Brush.MacOS.MaximizePressedFG}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Grid.caption_button_box:pointerover>StackPanel>Button>Grid>Path">
|
||||
<Setter Property="IsVisible" Value="True"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<Grid Classes="caption_button_box">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow" Margin="10,0,0,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="8,0,0,0">
|
||||
<Button Classes="close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Button Classes="caption_button_macos minimize" Click="MinimizeWindow">
|
||||
<Button Classes="minimize" Click="MinimizeWindow" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Button Classes="caption_button_macos maximize" Click="MaximizeOrRestoreWindow">
|
||||
<Button Classes="maximize" Click="MaximizeOrRestoreWindow" IsVisible="{Binding !#ThisControl.IsCloseButtonOnly}">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
|
@ -6,6 +7,15 @@ namespace SourceGit.Views
|
|||
{
|
||||
public partial class CaptionButtonsMacOS : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<bool> IsCloseButtonOnlyProperty =
|
||||
AvaloniaProperty.Register<CaptionButtonsMacOS, bool>(nameof(IsCloseButtonOnly));
|
||||
|
||||
public bool IsCloseButtonOnly
|
||||
{
|
||||
get => GetValue(IsCloseButtonOnlyProperty);
|
||||
set => SetValue(IsCloseButtonOnlyProperty, value);
|
||||
}
|
||||
|
||||
public CaptionButtonsMacOS()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -32,9 +42,7 @@ namespace SourceGit.Views
|
|||
private void CloseWindow(object _, RoutedEventArgs e)
|
||||
{
|
||||
var window = this.FindAncestorOfType<Window>();
|
||||
if (window != null)
|
||||
window.Close();
|
||||
|
||||
window?.Close();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,10 @@
|
|||
Data="{StaticResource Icons.Info}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -40,12 +36,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="0,16" Orientation="Vertical">
|
||||
|
|
|
@ -27,14 +27,10 @@
|
|||
Data="{StaticResource Icons.Hotkeys}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -42,12 +38,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Body -->
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -14,10 +13,5 @@ namespace SourceGit.Views
|
|||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,14 +28,10 @@
|
|||
Data="{StaticResource Icons.InteractiveRebase}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -43,12 +39,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Operation Information -->
|
||||
|
|
|
@ -27,14 +27,10 @@
|
|||
Data="{StaticResource Icons.Lock}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -42,12 +38,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Locked Files -->
|
||||
|
|
|
@ -16,11 +16,6 @@ namespace SourceGit.Views
|
|||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnUnlockButtonClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.LFSLocks vm && sender is Button button)
|
||||
|
|
|
@ -29,14 +29,10 @@
|
|||
Margin="10,0,0,0"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -44,9 +40,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2" Classes="caption_button" Click="CloseWindow" IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Body -->
|
||||
|
|
|
@ -125,12 +125,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
|
||||
private void BeginMoveWindow(object _, PointerPressedEventArgs e)
|
||||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
var config = new Commands.Config(null).ListAll();
|
||||
SetIfChanged(config, "user.name", DefaultUser);
|
||||
|
@ -143,8 +138,13 @@ namespace SourceGit.Views
|
|||
|
||||
if (!GPGFormat.Value.Equals("ssh", StringComparison.Ordinal))
|
||||
SetIfChanged(config, $"gpg.{GPGFormat.Value}.program", GPGExecutableFile);
|
||||
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
Close();
|
||||
private void BeginMoveWindow(object _, PointerPressedEventArgs e)
|
||||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private async void SelectThemeOverrideFile(object _, RoutedEventArgs e)
|
||||
|
|
|
@ -27,15 +27,11 @@
|
|||
Data="{StaticResource Icons.Settings}"
|
||||
Margin="10,0,0,0"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -43,9 +39,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2" Classes="caption_button" Click="CloseWindow" IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Body -->
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -10,15 +10,15 @@ namespace SourceGit.Views
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.RepositoryConfigure)?.Save();
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
private void BeginMoveWindow(object _, PointerPressedEventArgs e)
|
||||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
(DataContext as ViewModels.RepositoryConfigure)?.Save();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,10 @@
|
|||
Data="{StaticResource Icons.SoftwareUpdate}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -44,12 +40,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Body -->
|
||||
|
|
|
@ -26,14 +26,10 @@
|
|||
Data="{StaticResource Icons.Edit}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -41,12 +37,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="8">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia.Input;
|
||||
|
@ -33,22 +34,25 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
App.Quit(_exitCode);
|
||||
}
|
||||
|
||||
private void BeginMoveWindow(object _, PointerPressedEventArgs e)
|
||||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
App.Quit(-1);
|
||||
}
|
||||
|
||||
private void SaveAndClose(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
File.WriteAllText(_file, Editor.Text);
|
||||
App.Quit(0);
|
||||
_exitCode = 0;
|
||||
Close();
|
||||
}
|
||||
|
||||
private readonly string _file;
|
||||
private int _exitCode = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,14 +27,10 @@
|
|||
Data="{StaticResource Icons.Statistics}"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
|
||||
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
|
||||
<Button Classes="caption_button_macos close" Click="CloseWindow">
|
||||
<Grid>
|
||||
<Ellipse/>
|
||||
<Path/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<v:CaptionButtonsMacOS Grid.Column="0"
|
||||
Margin="0,2,0,0"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform False, macOS=True}"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Classes="bold"
|
||||
|
@ -42,12 +38,9 @@
|
|||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="caption_button"
|
||||
Click="CloseWindow"
|
||||
IsVisible="{OnPlatform True, macOS=False}">
|
||||
<Path Data="{StaticResource Icons.Window.Close}"/>
|
||||
</Button>
|
||||
<v:CaptionButtons Grid.Column="2"
|
||||
IsCloseButtonOnly="True"
|
||||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- View mode switcher -->
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Globalization;
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace SourceGit.Views
|
||||
|
@ -227,10 +226,5 @@ namespace SourceGit.Views
|
|||
{
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseWindow(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue