Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux title & compile patch #96

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TuneLab/TuneLab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<LangVersion>latest</LangVersion>
<Version>1.5.6</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions TuneLab/UI/MainWindow/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="0" x:Name="MenuBar" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal"/>
<StackPanel Grid.Column="1" IsHitTestVisible="False" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="{Binding $parent[Window].Title}" x:Name="TitleLabel" FontSize="12" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" x:Name="TitleBar" IsHitTestVisible="False" VerticalAlignment="Center" Orientation="Horizontal"/>
<StackPanel Grid.Column="2" x:Name="WindowControl" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal"/>
</Grid>

Expand Down
18 changes: 12 additions & 6 deletions TuneLab/UI/MainWindow/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public partial class MainWindow : Window
{
private PlatformID platform;
private bool isCloseConfirm;
private TextBlock TitleLabel;
private Button maximizeButton;
private ButtonContent maximizeIconContent = new() { Item = new IconItem() { Icon = Assets.WindowRestore }, ColorSet = new() { Color = Style.TEXT_LIGHT.Opacity(0.6) } };

Expand All @@ -43,6 +44,9 @@ public MainWindow()
Background = Style.BACK.ToBrush();
Content.Margin = new(1, 0);

TitleLabel = new() { Text="", FontSize=12, VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, Foreground = Style.TEXT_LIGHT.ToBrush()};
TitleLabel.Bind(TextBlock.TextProperty, new Avalonia.Data.Binding{Path="Title",Source=this});

var binimizeButton = new Button() { Width = 48, Height = 40 }
.AddContent(new() { Item = new BorderItem() { CornerRadius = 0 }, ColorSet = new() { HoveredColor = Colors.White.Opacity(0.2), PressedColor = Colors.White.Opacity(0.2) } })
.AddContent(new() { Item = new IconItem() { Icon = Assets.WindowMin }, ColorSet = new() { Color = Style.TEXT_LIGHT.Opacity(0.7) } });
Expand All @@ -58,14 +62,16 @@ public MainWindow()
.AddContent(new() { Item = new IconItem() { Icon = Assets.WindowClose }, ColorSet = new() { Color = Style.TEXT_LIGHT.Opacity(0.7) } });
closeButton.Clicked += () => Close();

WindowControl.Children.Add(binimizeButton);
WindowControl.Children.Add(maximizeButton);
WindowControl.Children.Add(closeButton);

bool UseSystemTitle = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux); //Is Only Linux have double title case X11?
if(!UseSystemTitle){
WindowControl.Children.Add(binimizeButton);
WindowControl.Children.Add(maximizeButton);
WindowControl.Children.Add(closeButton);
TitleBar.Children.Add(TitleLabel);
}

this.AttachWindowStateHandler();

TitleLabel.Foreground = Style.TEXT_LIGHT.ToBrush();

mEditor = new Editor();
mEditor.Document.ProjectNameChanged.Subscribe(UpdateTitle);
mEditor.Document.StatusChanged += UpdateTitle;
Expand Down
Loading