mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
refactor: replace all window with custom ChromelessWindow
This commit is contained in:
parent
68061f82b1
commit
f5b35d3db2
23 changed files with 414 additions and 649 deletions
|
@ -1,34 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
|
|
||||||
namespace SourceGit.Converters
|
|
||||||
{
|
|
||||||
public static class WindowStateConverters
|
|
||||||
{
|
|
||||||
public static readonly FuncValueConverter<WindowState, Thickness> ToContentMargin =
|
|
||||||
new FuncValueConverter<WindowState, Thickness>(state =>
|
|
||||||
{
|
|
||||||
if (OperatingSystem.IsWindows() && state == WindowState.Maximized)
|
|
||||||
return new Thickness(6);
|
|
||||||
else if (OperatingSystem.IsLinux() && state != WindowState.Maximized)
|
|
||||||
return new Thickness(6);
|
|
||||||
else
|
|
||||||
return new Thickness(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
public static readonly FuncValueConverter<WindowState, GridLength> ToTitleBarHeight =
|
|
||||||
new FuncValueConverter<WindowState, GridLength>(state =>
|
|
||||||
{
|
|
||||||
if (state == WindowState.Maximized)
|
|
||||||
return new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
|
|
||||||
else
|
|
||||||
return new GridLength(38);
|
|
||||||
});
|
|
||||||
|
|
||||||
public static readonly FuncValueConverter<WindowState, bool> IsNormal =
|
|
||||||
new FuncValueConverter<WindowState, bool>(state => state == WindowState.Normal);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,6 +18,129 @@
|
||||||
<Setter Property="HideDelay" Value="0:0:0.2"/>
|
<Setter Property="HideDelay" Value="0:0:0.2"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
|
||||||
|
<Setter Property="ExtendClientAreaChromeHints" Value="NoChrome"/>
|
||||||
|
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True"/>
|
||||||
|
<Setter Property="SystemDecorations" Value="Full"/>
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window[WindowState=Maximized]">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="6"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window.custom_window_frame">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="ExtendClientAreaChromeHints" Value="Default"/>
|
||||||
|
<Setter Property="ExtendClientAreaToDecorationsHint" Value="False"/>
|
||||||
|
<Setter Property="SystemDecorations" Value="None"/>
|
||||||
|
<Setter Property="Padding" Value="12"/>
|
||||||
|
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Border x:Name="PART_ContentRoot"
|
||||||
|
Background="{DynamicResource Brush.Window}"
|
||||||
|
BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
|
BorderThickness="1"
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
|
CornerRadius="8"
|
||||||
|
Effect="drop-shadow(0 0 12 #90000000)"
|
||||||
|
ClipToBounds="True">
|
||||||
|
<VisualLayerManager>
|
||||||
|
<ContentPresenter Name="PART_ContentPresenter"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
</VisualLayerManager>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Grid x:Name="PART_ResizeBorderContainer" Margin="{TemplateBinding Padding}" IsHitTestVisible="True">
|
||||||
|
<Border x:Name="PART_BorderTopLeft"
|
||||||
|
Width="4" Height="4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Cursor="TopLeftCorner"
|
||||||
|
Tag="{x:Static WindowEdge.NorthWest}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderTop"
|
||||||
|
Height="4" Margin="4,0"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
||||||
|
Cursor="TopSide"
|
||||||
|
Tag="{x:Static WindowEdge.North}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderTopRight"
|
||||||
|
Width="4" Height="4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
|
Cursor="TopRightCorner"
|
||||||
|
Tag="{x:Static WindowEdge.NorthEast}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderLeft"
|
||||||
|
Width="4" Margin="0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
||||||
|
Cursor="LeftSide"
|
||||||
|
Tag="{x:Static WindowEdge.West}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderRight"
|
||||||
|
Width="4" Margin="0,4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Right" VerticalAlignment="Stretch"
|
||||||
|
Cursor="RightSide"
|
||||||
|
Tag="{x:Static WindowEdge.East}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderBottomLeft"
|
||||||
|
Width="4" Height="4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
||||||
|
Cursor="BottomLeftCorner"
|
||||||
|
Tag="{x:Static WindowEdge.SouthWest}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderBottom"
|
||||||
|
Height="4" Margin="4,0"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
||||||
|
Cursor="BottomSide"
|
||||||
|
Tag="{x:Static WindowEdge.South}"/>
|
||||||
|
|
||||||
|
<Border x:Name="PART_BorderBottomRight"
|
||||||
|
Width="4" Height="4"
|
||||||
|
Background="Transparent"
|
||||||
|
HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||||
|
Cursor="BottomRightCorner"
|
||||||
|
Tag="{x:Static WindowEdge.SouthEast}"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window.custom_window_frame[WindowState=Maximized]">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window.custom_window_frame[WindowState=Maximized] /template/ Border#PART_ContentRoot">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window.custom_window_frame[WindowState=Maximized] /template/ Grid#PART_ResizeBorderContainer">
|
||||||
|
<Setter Property="IsVisible" Value="False"/>
|
||||||
|
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Window.custom_window_frame[CanResize=False] /template/ Grid#PART_ResizeBorderContainer">
|
||||||
|
<Setter Property="IsVisible" Value="False"/>
|
||||||
|
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="ContentPresenter">
|
<Style Selector="ContentPresenter">
|
||||||
<Setter Property="FontFamily" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFont}"/>
|
<Setter Property="FontFamily" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFont}"/>
|
||||||
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize}"/>
|
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize}"/>
|
||||||
|
|
|
@ -1,35 +1,25 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.About"
|
x:Class="SourceGit.Views.About"
|
||||||
x:DataType="v:About"
|
x:DataType="v:About"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.About}"
|
Title="{DynamicResource Text.About}"
|
||||||
Background="Transparent"
|
SizeToContent="WidthAndHeight"
|
||||||
SizeToContent="WidthAndHeight"
|
CanResize="False"
|
||||||
CanResize="False"
|
WindowStartupLocation="CenterScreen">
|
||||||
WindowStartupLocation="CenterScreen"
|
<Grid RowDefinitions="Auto,*">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,*" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
Background="{DynamicResource Brush.TitleBar}"
|
Background="{DynamicResource Brush.TitleBar}"
|
||||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
PointerPressed="BeginMoveWindow"/>
|
PointerPressed="BeginMoveWindow"/>
|
||||||
|
|
||||||
<Path Grid.Column="0"
|
<Path Grid.Column="0"
|
||||||
Width="14" Height="14"
|
Width="14" Height="14"
|
||||||
Margin="10,0,0,0"
|
Margin="10,0,0,0"
|
||||||
|
@ -59,7 +49,7 @@
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*" Background="{DynamicResource Brush.Window}">
|
<Grid Grid.Row="1" ColumnDefinitions="Auto,*">
|
||||||
<Image Grid.Column="0"
|
<Image Grid.Column="0"
|
||||||
Width="200" Height="200"
|
Width="200" Height="200"
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
|
@ -67,7 +57,7 @@
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,8,32,8">
|
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,8,32,8">
|
||||||
<StackPanel Height="48" Orientation="Horizontal">
|
<StackPanel Height="48" Orientation="Horizontal">
|
||||||
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
|
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
|
||||||
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||||
|
@ -91,7 +81,7 @@
|
||||||
<TextBlock Text="{DynamicResource Text.About.Fonts}" />
|
<TextBlock Text="{DynamicResource Text.About.Fonts}" />
|
||||||
<TextBlock Text="JetBrains Mono" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitJetBrainsMonoFont"/>
|
<TextBlock Text="JetBrains Mono" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitJetBrainsMonoFont"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
|
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
|
||||||
<TextBlock Text="{DynamicResource Text.About.SourceCode}" />
|
<TextBlock Text="{DynamicResource Text.About.SourceCode}" />
|
||||||
<TextBlock Text="Github" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitSourceCode"/>
|
<TextBlock Text="Github" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitSourceCode"/>
|
||||||
|
@ -100,4 +90,4 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class About : Window
|
public partial class About : ChromelessWindow
|
||||||
{
|
{
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,29 +1,19 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.AssumeUnchangedManager"
|
x:Class="SourceGit.Views.AssumeUnchangedManager"
|
||||||
x:DataType="vm:AssumeUnchangedManager"
|
x:DataType="vm:AssumeUnchangedManager"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.AssumeUnchanged}"
|
Title="{DynamicResource Text.AssumeUnchanged}"
|
||||||
Background="Transparent"
|
Width="600" Height="400"
|
||||||
Width="600" Height="400"
|
CanResize="False"
|
||||||
CanResize="False"
|
WindowStartupLocation="CenterOwner">
|
||||||
WindowStartupLocation="CenterOwner"
|
<Grid RowDefinitions="Auto,*">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,*" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
|
@ -61,7 +51,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Unchanged Files -->
|
<!-- Unchanged Files -->
|
||||||
<Grid Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Grid Grid.Row="1">
|
||||||
<DataGrid Margin="8"
|
<DataGrid Margin="8"
|
||||||
Background="{DynamicResource Brush.Contents}"
|
Background="{DynamicResource Brush.Contents}"
|
||||||
ItemsSource="{Binding Files}"
|
ItemsSource="{Binding Files}"
|
||||||
|
@ -110,4 +100,4 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -4,7 +4,7 @@ using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class AssumeUnchangedManager : Window
|
public partial class AssumeUnchangedManager : ChromelessWindow
|
||||||
{
|
{
|
||||||
public AssumeUnchangedManager()
|
public AssumeUnchangedManager()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,36 +1,26 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.Blame"
|
x:Class="SourceGit.Views.Blame"
|
||||||
x:Name="me"
|
x:Name="me"
|
||||||
x:DataType="vm:Blame"
|
x:DataType="vm:Blame"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.Blame}"
|
Title="{DynamicResource Text.Blame}"
|
||||||
Background="Transparent"
|
WindowStartupLocation="CenterOwner"
|
||||||
WindowStartupLocation="CenterOwner"
|
MinWidth="1280" MinHeight="720">
|
||||||
MinWidth="1280" MinHeight="720"
|
<Grid>
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="24"/>
|
<RowDefinition Height="24"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="3"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
||||||
<!-- Bottom border -->
|
<!-- Bottom border -->
|
||||||
|
@ -58,12 +48,12 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- File -->
|
<!-- File -->
|
||||||
<Border Grid.Row="1" Padding="8,0" Background="{DynamicResource Brush.Window}">
|
<Border Grid.Row="1" Padding="8,0">
|
||||||
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"/>
|
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<Grid Grid.Row="2" Background="{DynamicResource Brush.Window}">
|
<Grid Grid.Row="2">
|
||||||
<!-- Blame View -->
|
<!-- Blame View -->
|
||||||
<v:BlameTextEditor HorizontalScrollBarVisibility="Auto"
|
<v:BlameTextEditor HorizontalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto"
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
@ -86,64 +76,5 @@
|
||||||
<!-- Loading -->
|
<!-- Loading -->
|
||||||
<v:LoadingIcon Width="48" Height="48" IsVisible="{Binding Data, Converter={x:Static ObjectConverters.IsNull}}"/>
|
<v:LoadingIcon Width="48" Height="48" IsVisible="{Binding Data, Converter={x:Static ObjectConverters.IsNull}}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Custom window sizer for Linux -->
|
|
||||||
<Grid Grid.Row="0" Grid.RowSpan="3" IsVisible="{OnPlatform False, Linux=True}" IsHitTestVisible="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.IsNormal}}">
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
|
||||||
Cursor="TopLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
|
||||||
Cursor="TopSide"
|
|
||||||
Tag="{x:Static WindowEdge.North}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
|
||||||
Cursor="TopRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
|
||||||
Cursor="LeftSide"
|
|
||||||
Tag="{x:Static WindowEdge.West}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Stretch"
|
|
||||||
Cursor="RightSide"
|
|
||||||
Tag="{x:Static WindowEdge.East}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomSide"
|
|
||||||
Tag="{x:Static WindowEdge.South}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -319,7 +319,7 @@ namespace SourceGit.Views
|
||||||
private TextMate.Installation _textMate = null;
|
private TextMate.Installation _textMate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Blame : Window
|
public partial class Blame : ChromelessWindow
|
||||||
{
|
{
|
||||||
public Blame()
|
public Blame()
|
||||||
{
|
{
|
||||||
|
@ -334,25 +334,11 @@ namespace SourceGit.Views
|
||||||
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
|
||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
WindowState = WindowState.Maximized;
|
WindowState = WindowState.Maximized;
|
||||||
}
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CustomResizeWindow(object sender, PointerPressedEventArgs e)
|
e.Handled = true;
|
||||||
{
|
|
||||||
if (sender is Border border)
|
|
||||||
{
|
|
||||||
if (border.Tag is WindowEdge edge)
|
|
||||||
{
|
|
||||||
BeginResizeDrag(edge, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||||
|
|
|
@ -1,36 +1,26 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.BranchCompare"
|
x:Class="SourceGit.Views.BranchCompare"
|
||||||
x:DataType="vm:BranchCompare"
|
x:DataType="vm:BranchCompare"
|
||||||
x:Name="me"
|
x:Name="me"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.BranchCompare}"
|
Title="{DynamicResource Text.BranchCompare}"
|
||||||
Background="Transparent"
|
MinWidth="1280" MinHeight="720"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner">
|
||||||
MinWidth="1280" MinHeight="720"
|
<Grid>
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="64"/>
|
<RowDefinition Height="64"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="3"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
||||||
<!-- Bottom border -->
|
<!-- Bottom border -->
|
||||||
|
@ -58,7 +48,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Compare Targets -->
|
<!-- Compare Targets -->
|
||||||
<Border Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Border Grid.Row="1">
|
||||||
<Grid Margin="48,8,48,8" ColumnDefinitions="*,48,*">
|
<Grid Margin="48,8,48,8" ColumnDefinitions="*,48,*">
|
||||||
<Border Grid.Column="0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}" CornerRadius="4" Padding="4">
|
<Border Grid.Column="0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}" CornerRadius="4" Padding="4">
|
||||||
<Grid RowDefinitions="Auto,*">
|
<Grid RowDefinitions="Auto,*">
|
||||||
|
@ -103,7 +93,7 @@
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Changes -->
|
<!-- Changes -->
|
||||||
<Border Grid.Row="2" Background="{DynamicResource Brush.Window}">
|
<Border Grid.Row="2">
|
||||||
<Grid Margin="8,0,8,8">
|
<Grid Margin="8,0,8,8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="256" MinWidth="200" MaxWidth="480"/>
|
<ColumnDefinition Width="256" MinWidth="200" MaxWidth="480"/>
|
||||||
|
@ -177,64 +167,5 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Custom window sizer for Linux -->
|
|
||||||
<Grid Grid.Row="0" Grid.RowSpan="3" IsVisible="{OnPlatform False, Linux=True}" IsHitTestVisible="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.IsNormal}}">
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
|
||||||
Cursor="TopLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
|
||||||
Cursor="TopSide"
|
|
||||||
Tag="{x:Static WindowEdge.North}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
|
||||||
Cursor="TopRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
|
||||||
Cursor="LeftSide"
|
|
||||||
Tag="{x:Static WindowEdge.West}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Stretch"
|
|
||||||
Cursor="RightSide"
|
|
||||||
Tag="{x:Static WindowEdge.East}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomSide"
|
|
||||||
Tag="{x:Static WindowEdge.South}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -3,7 +3,7 @@ using Avalonia.Input;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class BranchCompare : Window
|
public partial class BranchCompare : ChromelessWindow
|
||||||
{
|
{
|
||||||
public BranchCompare()
|
public BranchCompare()
|
||||||
{
|
{
|
||||||
|
@ -20,17 +20,6 @@ namespace SourceGit.Views
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CustomResizeWindow(object sender, PointerPressedEventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is Border border)
|
|
||||||
{
|
|
||||||
if (border.Tag is WindowEdge edge)
|
|
||||||
{
|
|
||||||
BeginResizeDrag(edge, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
BeginMoveDrag(e);
|
BeginMoveDrag(e);
|
||||||
|
|
54
src/Views/ChromelessWindow.cs
Normal file
54
src/Views/ChromelessWindow.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Primitives;
|
||||||
|
using Avalonia.Input;
|
||||||
|
|
||||||
|
namespace SourceGit.Views
|
||||||
|
{
|
||||||
|
public class ChromelessWindow : Window
|
||||||
|
{
|
||||||
|
protected override Type StyleKeyOverride => typeof(Window);
|
||||||
|
|
||||||
|
public ChromelessWindow()
|
||||||
|
{
|
||||||
|
if (OperatingSystem.IsLinux())
|
||||||
|
Classes.Add("custom_window_frame");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate(e);
|
||||||
|
|
||||||
|
if (Classes.Contains("custom_window_frame") && CanResize)
|
||||||
|
{
|
||||||
|
string[] borderNames = [
|
||||||
|
"PART_BorderTopLeft",
|
||||||
|
"PART_BorderTop",
|
||||||
|
"PART_BorderTopRight",
|
||||||
|
"PART_BorderLeft",
|
||||||
|
"PART_BorderRight",
|
||||||
|
"PART_BorderBottomLeft",
|
||||||
|
"PART_BorderBottom",
|
||||||
|
"PART_BorderBottomRight",
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach (var name in borderNames)
|
||||||
|
{
|
||||||
|
var border = e.NameScope.Find<Border>(name);
|
||||||
|
if (border != null)
|
||||||
|
{
|
||||||
|
border.PointerPressed -= OnWindowBorderPointerPressed;
|
||||||
|
border.PointerPressed += OnWindowBorderPointerPressed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWindowBorderPointerPressed(object sender, PointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Border border && border.Tag is WindowEdge edge)
|
||||||
|
BeginResizeDrag(edge, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,34 +1,24 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.FileHistories"
|
x:Class="SourceGit.Views.FileHistories"
|
||||||
x:DataType="vm:FileHistories"
|
x:DataType="vm:FileHistories"
|
||||||
x:Name="me"
|
x:Name="me"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.FileHistory}"
|
Title="{DynamicResource Text.FileHistory}"
|
||||||
Background="Transparent"
|
MinWidth="1280" MinHeight="720">
|
||||||
MinWidth="1280" MinHeight="720"
|
<Grid>
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
|
||||||
<!-- Bottom border -->
|
<!-- Bottom border -->
|
||||||
|
@ -56,7 +46,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<Grid Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/>
|
<ColumnDefinition Width="300" MinWidth="300" MaxWidth="600"/>
|
||||||
<ColumnDefinition Width="4"/>
|
<ColumnDefinition Width="4"/>
|
||||||
|
@ -143,64 +133,5 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Custom window sizer for Linux -->
|
|
||||||
<Grid Grid.Row="0" Grid.RowSpan="2" IsVisible="{OnPlatform False, Linux=True}" IsHitTestVisible="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.IsNormal}}">
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
|
||||||
Cursor="TopLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
|
||||||
Cursor="TopSide"
|
|
||||||
Tag="{x:Static WindowEdge.North}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
|
||||||
Cursor="TopRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
|
||||||
Cursor="LeftSide"
|
|
||||||
Tag="{x:Static WindowEdge.West}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Stretch"
|
|
||||||
Cursor="RightSide"
|
|
||||||
Tag="{x:Static WindowEdge.East}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomSide"
|
|
||||||
Tag="{x:Static WindowEdge.South}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -3,7 +3,7 @@ using Avalonia.Input;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class FileHistories : Window
|
public partial class FileHistories : ChromelessWindow
|
||||||
{
|
{
|
||||||
public FileHistories()
|
public FileHistories()
|
||||||
{
|
{
|
||||||
|
@ -13,25 +13,11 @@ namespace SourceGit.Views
|
||||||
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
|
||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
WindowState = WindowState.Maximized;
|
WindowState = WindowState.Maximized;
|
||||||
}
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CustomResizeWindow(object sender, PointerPressedEventArgs e)
|
e.Handled = true;
|
||||||
{
|
|
||||||
if (sender is Border border)
|
|
||||||
{
|
|
||||||
if (border.Tag is WindowEdge edge)
|
|
||||||
{
|
|
||||||
BeginResizeDrag(edge, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||||
|
|
|
@ -1,27 +1,18 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
xmlns:v="using:SourceGit.Views"
|
||||||
x:Class="SourceGit.Views.Hotkeys"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
Icon="/App.ico"
|
x:Class="SourceGit.Views.Hotkeys"
|
||||||
Title="{DynamicResource Text.Hotkeys}"
|
Icon="/App.ico"
|
||||||
Background="Transparent"
|
Title="{DynamicResource Text.Hotkeys}"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
CanResize="False"
|
CanResize="False"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
<Grid RowDefinitions="Auto,*">
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,*" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
|
@ -59,7 +50,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<Border Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Border Grid.Row="1">
|
||||||
<StackPanel Orientation="Vertical" Margin="16,8,16,16">
|
<StackPanel Orientation="Vertical" Margin="16,8,16,16">
|
||||||
<TextBlock Text="{DynamicResource Text.Hotkeys.Global}"
|
<TextBlock Text="{DynamicResource Text.Hotkeys.Global}"
|
||||||
Foreground="{DynamicResource Brush.FG2}"
|
Foreground="{DynamicResource Brush.FG2}"
|
||||||
|
@ -135,4 +126,4 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class Hotkeys : Window
|
public partial class Hotkeys : ChromelessWindow
|
||||||
{
|
{
|
||||||
public Hotkeys()
|
public Hotkeys()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,50 +1,36 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:s="using:SourceGit"
|
xmlns:s="using:SourceGit"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.Launcher"
|
x:Class="SourceGit.Views.Launcher"
|
||||||
x:DataType="vm:Launcher"
|
x:DataType="vm:Launcher"
|
||||||
x:Name="me"
|
x:Name="me"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="SourceGit"
|
Title="SourceGit"
|
||||||
Background="Transparent"
|
MinWidth="1280" MinHeight="720"
|
||||||
MinWidth="1280" MinHeight="720"
|
Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWidth, Mode=TwoWay}"
|
||||||
Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWidth, Mode=TwoWay}"
|
Height="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherHeight, Mode=TwoWay}"
|
||||||
Height="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherHeight, Mode=TwoWay}"
|
WindowState="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWindowState, Mode=TwoWay}"
|
||||||
WindowState="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWindowState, Mode=TwoWay}"
|
WindowStartupLocation="CenterScreen">
|
||||||
WindowStartupLocation="CenterScreen"
|
<Grid>
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Window.Resources>
|
|
||||||
<SolidColorBrush x:Key="SystemControlErrorTextForegroundBrush" Color="Red"/>
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToTitleBarHeight}}"/>
|
<RowDefinition Height="{Binding #me.TitleBarHeight}"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- Custom TitleBar -->
|
<!-- Custom TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
|
||||||
<!-- Bottom border -->
|
<!-- Bottom border -->
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
Background="{DynamicResource Brush.TitleBar}"
|
Background="{DynamicResource Brush.TitleBar}"
|
||||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
DoubleTapped="MaximizeOrRestoreWindow"
|
DoubleTapped="OnTitleBarDoubleTapped"
|
||||||
PointerPressed="BeginMoveWindow"/>
|
PointerPressed="BeginMoveWindow"/>
|
||||||
|
|
||||||
<!-- Caption Buttons (macOS) -->
|
<!-- Caption Buttons (macOS) -->
|
||||||
|
@ -97,7 +83,7 @@
|
||||||
x:Name="launcherTabsScroller"
|
x:Name="launcherTabsScroller"
|
||||||
HorizontalScrollBarVisibility="Hidden"
|
HorizontalScrollBarVisibility="Hidden"
|
||||||
VerticalScrollBarVisibility="Disabled"
|
VerticalScrollBarVisibility="Disabled"
|
||||||
DoubleTapped="MaximizeOrRestoreWindow"
|
DoubleTapped="OnTitleBarDoubleTapped"
|
||||||
PointerPressed="BeginMoveWindow"
|
PointerPressed="BeginMoveWindow"
|
||||||
PointerWheelChanged="ScrollTabs"
|
PointerWheelChanged="ScrollTabs"
|
||||||
ScrollChanged="OnTabsScrollChanged">
|
ScrollChanged="OnTabsScrollChanged">
|
||||||
|
@ -366,64 +352,5 @@
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Custom window sizer for Linux -->
|
|
||||||
<Grid Grid.Row="0" Grid.RowSpan="2" IsVisible="{OnPlatform False, Linux=True}" IsHitTestVisible="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.IsNormal}}">
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
|
||||||
Cursor="TopLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
|
||||||
Cursor="TopSide"
|
|
||||||
Tag="{x:Static WindowEdge.North}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
|
||||||
Cursor="TopRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.NorthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
|
||||||
Cursor="LeftSide"
|
|
||||||
Tag="{x:Static WindowEdge.West}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Margin="0,4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Stretch"
|
|
||||||
Cursor="RightSide"
|
|
||||||
Tag="{x:Static WindowEdge.East}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomLeftCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthWest}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Height="4" Margin="4,0"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomSide"
|
|
||||||
Tag="{x:Static WindowEdge.South}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
|
|
||||||
<Border Width="4" Height="4"
|
|
||||||
Background="Transparent"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
|
||||||
Cursor="BottomRightCorner"
|
|
||||||
Tag="{x:Static WindowEdge.SouthEast}"
|
|
||||||
PointerPressed="CustomResizeWindow"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -7,8 +7,17 @@ using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class Launcher : Window, Models.INotificationReceiver
|
public partial class Launcher : ChromelessWindow, Models.INotificationReceiver
|
||||||
{
|
{
|
||||||
|
public static readonly StyledProperty<GridLength> TitleBarHeightProperty =
|
||||||
|
AvaloniaProperty.Register<Launcher, GridLength>(nameof(TitleBarHeight), new GridLength(38, GridUnitType.Pixel));
|
||||||
|
|
||||||
|
public GridLength TitleBarHeight
|
||||||
|
{
|
||||||
|
get => GetValue(TitleBarHeightProperty);
|
||||||
|
set => SetValue(TitleBarHeightProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Launcher()
|
public Launcher()
|
||||||
{
|
{
|
||||||
DataContext = new ViewModels.Launcher();
|
DataContext = new ViewModels.Launcher();
|
||||||
|
@ -34,6 +43,20 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||||
|
{
|
||||||
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
|
if (change.Property == WindowStateProperty)
|
||||||
|
{
|
||||||
|
var state = (WindowState)change.NewValue;
|
||||||
|
if (state == WindowState.Maximized)
|
||||||
|
SetCurrentValue(TitleBarHeightProperty, new GridLength(OperatingSystem.IsMacOS() ? 34 : 30));
|
||||||
|
else
|
||||||
|
SetCurrentValue(TitleBarHeightProperty, new GridLength(38, GridUnitType.Pixel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
var vm = DataContext as ViewModels.Launcher;
|
var vm = DataContext as ViewModels.Launcher;
|
||||||
|
@ -136,36 +159,20 @@ namespace SourceGit.Views
|
||||||
base.OnClosing(e);
|
base.OnClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
private void OnTitleBarDoubleTapped(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
|
||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
WindowState = WindowState.Maximized;
|
WindowState = WindowState.Maximized;
|
||||||
}
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CustomResizeWindow(object sender, PointerPressedEventArgs e)
|
e.Handled = true;
|
||||||
{
|
|
||||||
if (sender is Border border)
|
|
||||||
{
|
|
||||||
if (border.Tag is WindowEdge edge)
|
|
||||||
{
|
|
||||||
BeginResizeDrag(edge, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ClickCount != 2)
|
if (e.ClickCount != 2)
|
||||||
{
|
|
||||||
BeginMoveDrag(e);
|
BeginMoveDrag(e);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScrollTabs(object sender, PointerWheelEventArgs e)
|
private void ScrollTabs(object sender, PointerWheelEventArgs e)
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
xmlns:ac="using:Avalonia.Controls.Converters"
|
xmlns:ac="using:Avalonia.Controls.Converters"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.Preference"
|
x:Class="SourceGit.Views.Preference"
|
||||||
x:DataType="vm:Preference"
|
x:DataType="vm:Preference"
|
||||||
x:Name="me"
|
x:Name="me"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.Preference}"
|
Title="{DynamicResource Text.Preference}"
|
||||||
Background="Transparent"
|
Width="600" SizeToContent="Height"
|
||||||
Width="600" SizeToContent="Height"
|
CanResize="False"
|
||||||
CanResize="False"
|
WindowStartupLocation="CenterScreen">
|
||||||
WindowStartupLocation="CenterScreen"
|
<Grid RowDefinitions="Auto,Auto">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,Auto" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
|
@ -62,7 +52,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<Border Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Border Grid.Row="1">
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem>
|
<TabItem>
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
|
@ -553,4 +543,4 @@
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
@ -14,7 +13,7 @@ using Avalonia.Threading;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class Preference : Window
|
public partial class Preference : ChromelessWindow
|
||||||
{
|
{
|
||||||
public AvaloniaList<FontFamily> InstalledFonts
|
public AvaloniaList<FontFamily> InstalledFonts
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,29 +1,20 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
x:Class="SourceGit.Views.SelfUpdate"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:DataType="vm:SelfUpdate"
|
x:Class="SourceGit.Views.SelfUpdate"
|
||||||
Title="{DynamicResource Text.SelfUpdate.Title}"
|
x:DataType="vm:SelfUpdate"
|
||||||
Icon="/App.ico"
|
Title="{DynamicResource Text.SelfUpdate.Title}"
|
||||||
Background="Transparent"
|
Icon="/App.ico"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
CanResize="False"
|
CanResize="False"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
<Grid RowDefinitions="Auto,*">
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,*" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
|
@ -61,7 +52,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<Grid Grid.Row="1" Background="{DynamicResource Brush.Window}">
|
<Grid Grid.Row="1">
|
||||||
<ContentControl Content="{Binding Data}">
|
<ContentControl Content="{Binding Data}">
|
||||||
<ContentControl.DataTemplates>
|
<ContentControl.DataTemplates>
|
||||||
<DataTemplate DataType="m:Version">
|
<DataTemplate DataType="m:Version">
|
||||||
|
@ -150,4 +141,4 @@
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -4,7 +4,7 @@ using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class SelfUpdate : Window
|
public partial class SelfUpdate : ChromelessWindow
|
||||||
{
|
{
|
||||||
public SelfUpdate()
|
public SelfUpdate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,40 +1,25 @@
|
||||||
<Window xmlns="https://github.com/avaloniaui"
|
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:m="using:SourceGit.Models"
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.Statistics"
|
x:Class="SourceGit.Views.Statistics"
|
||||||
x:DataType="vm:Statistics"
|
x:DataType="vm:Statistics"
|
||||||
Title="{DynamicResource Text.Statistics}"
|
Title="{DynamicResource Text.Statistics}"
|
||||||
Background="Transparent"
|
Width="800" Height="450"
|
||||||
Width="800" Height="450"
|
WindowStartupLocation="CenterOwner"
|
||||||
WindowStartupLocation="CenterOwner"
|
CanResize="False">
|
||||||
CanResize="False"
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
ExtendClientAreaToDecorationsHint="True"
|
|
||||||
ExtendClientAreaChromeHints="NoChrome"
|
|
||||||
SystemDecorations="{OnPlatform Full, Linux=None}">
|
|
||||||
<Grid RowDefinitions="Auto,Auto,*" Margin="{OnPlatform 0, Linux=6}">
|
|
||||||
<!-- Custom window shadow for Linux -->
|
|
||||||
<Border Grid.Row="0" Grid.RowSpan="3"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
Effect="drop-shadow(0 0 6 #A0000000)"
|
|
||||||
IsVisible="{OnPlatform False, Linux=True}"/>
|
|
||||||
|
|
||||||
<!-- Window BG -->
|
|
||||||
<Border Grid.Row="1" Grid.RowSpan="2"
|
|
||||||
Background="{DynamicResource Brush.Window}"
|
|
||||||
IsVisible="{OnPlatform True, Linux=False}"/>
|
|
||||||
|
|
||||||
<!-- Title bar -->
|
<!-- Title bar -->
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
|
||||||
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
<Border Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
Background="{DynamicResource Brush.TitleBar}"
|
Background="{DynamicResource Brush.TitleBar}"
|
||||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
PointerPressed="BeginMoveWindow"/>
|
PointerPressed="BeginMoveWindow"/>
|
||||||
|
|
||||||
<Path Grid.Column="0"
|
<Path Grid.Column="0"
|
||||||
Width="14" Height="14"
|
Width="14" Height="14"
|
||||||
Margin="10,0,0,0"
|
Margin="10,0,0,0"
|
||||||
|
@ -166,23 +151,23 @@
|
||||||
<TextBlock Classes="monospace" Text="{Binding Total}" FontSize="11" Margin="4,0,0,0"/>
|
<TextBlock Classes="monospace" Text="{Binding Total}" FontSize="11" Margin="4,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Graph -->
|
<!-- Graph -->
|
||||||
<v:Chart Grid.Column="1"
|
<v:Chart Grid.Column="1"
|
||||||
Margin="16,0,0,0"
|
Margin="16,0,0,0"
|
||||||
LineBrush="{DynamicResource Brush.Border1}"
|
LineBrush="{DynamicResource Brush.Border1}"
|
||||||
ShapeBrush="{DynamicResource Brush.Accent}"
|
ShapeBrush="{DynamicResource Brush.Accent}"
|
||||||
Samples="{Binding Samples}"/>
|
Samples="{Binding Samples}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ContentControl.DataTemplates>
|
</ContentControl.DataTemplates>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
|
|
||||||
<!-- Loading Mask -->
|
<!-- Loading Mask -->
|
||||||
<v:LoadingIcon Grid.Row="2"
|
<v:LoadingIcon Grid.Row="2"
|
||||||
Width="48" Height="48"
|
Width="48" Height="48"
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
IsVisible="{Binding IsLoading}"/>
|
IsVisible="{Binding IsLoading}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</v:ChromelessWindow>
|
||||||
|
|
|
@ -226,7 +226,7 @@ namespace SourceGit.Views
|
||||||
private int _lastHitIdx = -1;
|
private int _lastHitIdx = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Statistics : Window
|
public partial class Statistics : ChromelessWindow
|
||||||
{
|
{
|
||||||
public Statistics()
|
public Statistics()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue