From f5b35d3db2dc182f6c8675311143f9d7eb1ac3b4 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 13 Jun 2024 11:54:10 +0800 Subject: [PATCH] refactor: replace all window with custom ChromelessWindow --- src/Converters/WindowStateConverters.cs | 34 ------ src/Resources/Styles.axaml | 123 ++++++++++++++++++++++ src/Views/About.axaml | 50 ++++----- src/Views/About.axaml.cs | 3 +- src/Views/AssumeUnchangedManager.axaml | 46 ++++---- src/Views/AssumeUnchangedManager.axaml.cs | 2 +- src/Views/Blame.axaml | 109 ++++--------------- src/Views/Blame.axaml.cs | 18 +--- src/Views/BranchCompare.axaml | 109 ++++--------------- src/Views/BranchCompare.axaml.cs | 13 +-- src/Views/ChromelessWindow.cs | 54 ++++++++++ src/Views/FileHistories.axaml | 105 ++++-------------- src/Views/FileHistories.axaml.cs | 18 +--- src/Views/Hotkeys.axaml | 43 +++----- src/Views/Hotkeys.axaml.cs | 3 +- src/Views/Launcher.axaml | 123 +++++----------------- src/Views/Launcher.axaml.cs | 45 ++++---- src/Views/Preference.axaml | 54 ++++------ src/Views/Preference.axaml.cs | 3 +- src/Views/SelfUpdate.axaml | 47 ++++----- src/Views/SelfUpdate.axaml.cs | 2 +- src/Views/Statistics.axaml | 57 ++++------ src/Views/Statistics.axaml.cs | 2 +- 23 files changed, 414 insertions(+), 649 deletions(-) delete mode 100644 src/Converters/WindowStateConverters.cs create mode 100644 src/Views/ChromelessWindow.cs diff --git a/src/Converters/WindowStateConverters.cs b/src/Converters/WindowStateConverters.cs deleted file mode 100644 index 05f0b1cd..00000000 --- a/src/Converters/WindowStateConverters.cs +++ /dev/null @@ -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 ToContentMargin = - new FuncValueConverter(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 ToTitleBarHeight = - new FuncValueConverter(state => - { - if (state == WindowState.Maximized) - return new GridLength(OperatingSystem.IsMacOS() ? 34 : 30); - else - return new GridLength(38); - }); - - public static readonly FuncValueConverter IsNormal = - new FuncValueConverter(state => state == WindowState.Normal); - } -} diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 114ac72d..219187cf 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -18,6 +18,129 @@ + + + + + + + + + + + + + +