mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-29 16:14:59 +00:00
code_style: move platform dependent code to initialize window to namespace SourceGit.Native
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
c62b4a031f
commit
ef4b639f8e
9 changed files with 41 additions and 68 deletions
|
@ -3,7 +3,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -11,7 +10,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
public bool UseSystemWindowFrame
|
||||
{
|
||||
get => OperatingSystem.IsLinux() && ViewModels.Preferences.Instance.UseSystemWindowFrame;
|
||||
get => Native.OS.UseSystemWindowFrame;
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(Window);
|
||||
|
@ -19,33 +18,6 @@ namespace SourceGit.Views
|
|||
public ChromelessWindow()
|
||||
{
|
||||
Focusable = true;
|
||||
|
||||
if (OperatingSystem.IsLinux())
|
||||
{
|
||||
if (UseSystemWindowFrame)
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
|
||||
ExtendClientAreaToDecorationsHint = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
Classes.Add("custom_window_frame");
|
||||
}
|
||||
}
|
||||
else if (OperatingSystem.IsWindows())
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
Classes.Add("fix_maximized_padding");
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
}
|
||||
|
||||
Native.OS.SetupForWindow(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<v:LauncherTabBar Grid.Column="2" Height="30" Margin="0,0,16,0" VerticalAlignment="Bottom"/>
|
||||
|
||||
<!-- Caption Buttons (Windows/Linux)-->
|
||||
<Border Grid.Column="3" Margin="16,0,0,0" IsVisible="{Binding #ThisControl.IsRightCaptionButtonsVisible}">
|
||||
<Border Grid.Column="3" Margin="16,0,0,0" IsVisible="{Binding #ThisControl.HasRightCaptionButton}">
|
||||
<v:CaptionButtons Height="30" VerticalAlignment="Top"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
@ -29,14 +29,9 @@ namespace SourceGit.Views
|
|||
set => SetValue(HasLeftCaptionButtonProperty, value);
|
||||
}
|
||||
|
||||
public bool IsRightCaptionButtonsVisible
|
||||
public bool HasRightCaptionButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (OperatingSystem.IsLinux())
|
||||
return !ViewModels.Preferences.Instance.UseSystemWindowFrame;
|
||||
return OperatingSystem.IsWindows();
|
||||
}
|
||||
get => OperatingSystem.IsWindows() || !Native.OS.UseSystemWindowFrame;
|
||||
}
|
||||
|
||||
public Launcher()
|
||||
|
@ -52,8 +47,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
HasLeftCaptionButton = true;
|
||||
CaptionHeight = new GridLength(34);
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome |
|
||||
ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
else if (UseSystemWindowFrame)
|
||||
{
|
||||
|
|
|
@ -129,23 +129,23 @@
|
|||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.General.ShowAuthorTime}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowAuthorTimeInGraph, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding ShowAuthorTimeInGraph, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.General.ShowTagsInGraph}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowTagsInGraph, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding ShowTagsInGraph, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="7" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.General.ShowChildren}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowChildren, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding ShowChildren, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="8" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.General.Check4UpdatesOnStartup}"
|
||||
IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=Check4UpdatesOnStartup, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding Check4UpdatesOnStartup, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
@ -257,12 +257,12 @@
|
|||
<CheckBox Grid.Row="7" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Appearance.UseFixedTabWidth}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseFixedTabWidth, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding UseFixedTabWidth, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="8" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Appearance.UseNativeWindowFrame}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=UseSystemWindowFrame, Mode=OneTime}"
|
||||
IsChecked="{Binding UseSystemWindowFrame, Mode=OneTime}"
|
||||
IsVisible="{OnPlatform False, Linux=True}"
|
||||
IsCheckedChanged="OnUseNativeWindowFrameChanged"/>
|
||||
</Grid>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue