Chardonnay UI bug fixes and improvements
- Theme changes do not require restart - Fix some text appearing black in dark mode - Fix dialog boxes not appearing correctly on Windows - Fix queue vertical scroll bar overlapping items
This commit is contained in:
parent
68cfae1d58
commit
4170dcc1d5
@ -2,6 +2,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:LibationAvalonia"
|
||||
xmlns:controls="using:LibationAvalonia.Controls"
|
||||
xmlns:dialogs="using:LibationAvalonia.Dialogs"
|
||||
x:Class="LibationAvalonia.App"
|
||||
Name="Libation">
|
||||
|
||||
@ -12,6 +13,10 @@
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ControlTheme x:Key="{x:Type TextBlock}" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</ControlTheme>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<SolidColorBrush x:Key="SeriesEntryGridBackgroundBrush" Opacity="0.3" Color="#abffab" />
|
||||
@ -81,6 +86,60 @@
|
||||
<!-- It's called AutoHide, but this is really the mouseover shrink/expand. -->
|
||||
<Setter Property="AllowAutoHide" Value="false"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="dialogs|DialogWindow">
|
||||
<Style Selector="^[UseCustomTitleBar=false]">
|
||||
<Setter Property="SystemDecorations" Value="Full"/>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<ContentPresenter Background="{DynamicResource SystemControlBackgroundAltHighBrush}" Content="{TemplateBinding Content}" />
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style Selector="^[UseCustomTitleBar=true]">
|
||||
<Setter Property="SystemDecorations" Value="BorderOnly"/>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel Background="{DynamicResource SystemControlBackgroundAltHighBrush}">
|
||||
<Grid RowDefinitions="30,*">
|
||||
<Border Name="DialogWindowTitleBorder" Margin="5,0" Background="{DynamicResource SystemAltMediumColor}">
|
||||
<Border.Styles>
|
||||
<Style Selector="Button#DialogCloseButton">
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
</Style>
|
||||
<Style Selector="^ Path">
|
||||
<Setter Property="Fill" Value="{DynamicResource IconFill}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Border.Styles>
|
||||
|
||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||
|
||||
<Path Name="DialogWindowTitleIcon" Margin="3,5,0,5" Fill="{DynamicResource IconFill}" Stretch="Uniform" Data="{StaticResource LibationGlassIcon}"/>
|
||||
|
||||
<TextBlock Name="DialogWindowTitleTextBlock" Margin="8,0,0,0" VerticalAlignment="Center" FontWeight="DemiBold" FontSize="12" Grid.Column="1" Text="{TemplateBinding Title}" />
|
||||
|
||||
<Button Name="DialogCloseButton" Grid.Column="2">
|
||||
<Path Fill="{DynamicResource SystemControlBackgroundBaseLowBrush}" VerticalAlignment="Center" Stretch="Uniform" RenderTransform="{StaticResource Rotate45Transform}" Data="{StaticResource CancelButtonIcon}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Path Stroke="{DynamicResource SystemBaseMediumLowColor}" StrokeThickness="1" VerticalAlignment="Bottom" Stretch="Fill" Data="M0,0 L1,0" />
|
||||
<ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}" />
|
||||
</Grid>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
</Application.Styles>
|
||||
|
||||
<NativeMenu.Menu>
|
||||
|
||||
@ -91,6 +91,32 @@
|
||||
S 192,128 147,147
|
||||
</StreamGeometry>
|
||||
|
||||
<StreamGeometry x:Key="LibationGlassIcon">
|
||||
M262,8
|
||||
h-117
|
||||
a 192,200 0 0 0 -36,82
|
||||
a 222,334 41 0 0 138,236
|
||||
v158
|
||||
h-81
|
||||
a 16,16 0 0 0 0,32
|
||||
h192
|
||||
a 16 16 0 0 0 0,-32
|
||||
h-81
|
||||
v-158
|
||||
a 222,334 -41 0 0 138,-236
|
||||
a 192,200 0 0 0 -36,-82
|
||||
h-117
|
||||
m-99,30
|
||||
a 192,200 0 0 0 -26,95
|
||||
a 187.5,334 35 0 0 125,159
|
||||
a 187.5,334 -35 0 0 125,-159
|
||||
a 192,200 0 0 0 -26,-95
|
||||
h-198
|
||||
M158,136
|
||||
a 168,305 35 0 0 104,136
|
||||
a 168,305 -35 0 0 104,-136
|
||||
</StreamGeometry>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
</Styles>
|
||||
|
||||
@ -166,16 +166,7 @@
|
||||
MinWidth="80"
|
||||
SelectedItem="{CompiledBinding ThemeVariant, Mode=TwoWay}"
|
||||
ItemsSource="{CompiledBinding Themes}"/>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{CompiledBinding SelectionChanged}"
|
||||
Text="Theme change takes effect on restart"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using LibationFileManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,19 +11,98 @@ namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
public bool SaveAndRestorePosition { get; set; } = true;
|
||||
public Control ControlToFocusOnShow { get; set; }
|
||||
protected override Type StyleKeyOverride => typeof(DialogWindow);
|
||||
|
||||
public static readonly StyledProperty<bool> UseCustomTitleBarProperty =
|
||||
AvaloniaProperty.Register<DialogWindow, bool>(nameof(UseCustomTitleBar));
|
||||
|
||||
public bool UseCustomTitleBar
|
||||
{
|
||||
get { return GetValue(UseCustomTitleBarProperty); }
|
||||
set { SetValue(UseCustomTitleBarProperty, value); }
|
||||
}
|
||||
|
||||
public DialogWindow()
|
||||
{
|
||||
this.HideMinMaxBtns();
|
||||
this.KeyDown += DialogWindow_KeyDown;
|
||||
this.Initialized += DialogWindow_Initialized;
|
||||
this.Opened += DialogWindow_Opened;
|
||||
this.Closing += DialogWindow_Closing;
|
||||
KeyDown += DialogWindow_KeyDown;
|
||||
Initialized += DialogWindow_Initialized;
|
||||
Opened += DialogWindow_Opened;
|
||||
Closing += DialogWindow_Closing;
|
||||
|
||||
UseCustomTitleBar = Configuration.IsWindows;
|
||||
}
|
||||
|
||||
private bool fixedMinHeight = false;
|
||||
private bool fixedMaxHeight = false;
|
||||
private bool fixedHeight = false;
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
const int customTitleBarHeight = 30;
|
||||
if (UseCustomTitleBar)
|
||||
{
|
||||
if (change.Property == MinHeightProperty && !fixedMinHeight)
|
||||
{
|
||||
fixedMinHeight = true;
|
||||
MinHeight += customTitleBarHeight;
|
||||
fixedMinHeight = false;
|
||||
}
|
||||
if (change.Property == MaxHeightProperty && !fixedMaxHeight)
|
||||
{
|
||||
fixedMaxHeight = true;
|
||||
MaxHeight += customTitleBarHeight;
|
||||
fixedMaxHeight = false;
|
||||
}
|
||||
if (change.Property == HeightProperty && !fixedHeight)
|
||||
{
|
||||
fixedHeight = true;
|
||||
Height += customTitleBarHeight;
|
||||
fixedHeight = false;
|
||||
}
|
||||
}
|
||||
base.OnPropertyChanged(change);
|
||||
}
|
||||
|
||||
public DialogWindow(bool saveAndRestorePosition) : this()
|
||||
{
|
||||
SaveAndRestorePosition = saveAndRestorePosition;
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
|
||||
if (!UseCustomTitleBar)
|
||||
return;
|
||||
|
||||
var closeButton = e.NameScope.Find<Button>("DialogCloseButton");
|
||||
var border = e.NameScope.Get<Border>("DialogWindowTitleBorder");
|
||||
var titleBlock = e.NameScope.Get<TextBlock>("DialogWindowTitleTextBlock");
|
||||
var icon = e.NameScope.Get<Avalonia.Controls.Shapes.Path>("DialogWindowTitleIcon");
|
||||
|
||||
closeButton.Click += CloseButton_Click;
|
||||
border.PointerPressed += Border_PointerPressed;
|
||||
icon.IsVisible = Icon != null;
|
||||
|
||||
if (MinHeight == MaxHeight && MinWidth == MaxWidth)
|
||||
{
|
||||
CanResize = false;
|
||||
border.Margin = new Thickness(0);
|
||||
icon.Margin = new Thickness(8, 5, 0, 5);
|
||||
}
|
||||
}
|
||||
|
||||
private void Border_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
|
||||
{
|
||||
if (e.GetCurrentPoint(null).Properties.IsLeftButtonPressed)
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
CancelAndClose();
|
||||
}
|
||||
|
||||
private void DialogWindow_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
|
||||
@ -25,7 +25,6 @@ namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.HideMinMaxBtns();
|
||||
ControlToFocusOnShow = this.FindControl<Button>(nameof(ImportButton));
|
||||
|
||||
LoadAccounts();
|
||||
|
||||
@ -12,8 +12,6 @@ namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.HideMinMaxBtns();
|
||||
|
||||
StringFields = @"
|
||||
Search for wizard of oz:
|
||||
title:oz
|
||||
|
||||
@ -109,23 +109,5 @@ namespace LibationAvalonia
|
||||
public int Width;
|
||||
public bool IsMaximized;
|
||||
}
|
||||
|
||||
public static void HideMinMaxBtns(this Window form)
|
||||
{
|
||||
if (Design.IsDesignMode || !Configuration.IsWindows || form.TryGetPlatformHandle() is not IPlatformHandle handle)
|
||||
return;
|
||||
|
||||
var currentStyle = GetWindowLong(handle.Handle, GWL_STYLE);
|
||||
|
||||
SetWindowLong(handle.Handle, GWL_STYLE, currentStyle & ~WS_MAXIMIZEBOX & ~WS_MINIMIZEBOX);
|
||||
}
|
||||
|
||||
const long WS_MINIMIZEBOX = 0x00020000L;
|
||||
const long WS_MAXIMIZEBOX = 0x10000L;
|
||||
const int GWL_STYLE = -16;
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetWindowLong")]
|
||||
static extern long GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||
static extern int SetWindowLong(IntPtr hWnd, int nIndex, long dwNewLong);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,8 +165,6 @@ Libation.
|
||||
|
||||
var dialog = new MessageBoxWindow(saveAndRestorePosition);
|
||||
|
||||
dialog.HideMinMaxBtns();
|
||||
|
||||
var vm = new MessageBoxViewModel(message, caption, buttons, icon, defaultButton);
|
||||
dialog.DataContext = vm;
|
||||
dialog.ControlToFocusOnShow = dialog.FindControl<Control>(defaultButton.ToString());
|
||||
@ -190,11 +188,13 @@ Libation.
|
||||
|
||||
tbx.Height = tbx.DesiredSize.Height;
|
||||
tbx.Width = tbx.DesiredSize.Width;
|
||||
dialog.MinHeight = vm.FormHeightFromTboxHeight((int)tbx.DesiredSize.Height);
|
||||
|
||||
var absoluteHeight = vm.FormHeightFromTboxHeight((int)tbx.DesiredSize.Height);
|
||||
dialog.MinHeight = absoluteHeight;
|
||||
dialog.MinWidth = vm.FormWidthFromTboxWidth((int)tbx.DesiredSize.Width);
|
||||
dialog.MaxHeight = dialog.MinHeight;
|
||||
dialog.MaxHeight = absoluteHeight;
|
||||
dialog.MaxWidth = dialog.MinWidth;
|
||||
dialog.Height = dialog.MinHeight;
|
||||
dialog.Height = absoluteHeight;
|
||||
dialog.Width = dialog.MinWidth;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@ -101,11 +101,14 @@ namespace LibationAvalonia.ViewModels.Settings
|
||||
set
|
||||
{
|
||||
this.RaiseAndSetIfChanged(ref themeVariant, value);
|
||||
|
||||
SelectionChanged = ThemeVariant != initialThemeVariant;
|
||||
this.RaisePropertyChanged(nameof(SelectionChanged));
|
||||
App.Current.RequestedThemeVariant = themeVariant switch
|
||||
{
|
||||
nameof(Avalonia.Styling.ThemeVariant.Dark) => Avalonia.Styling.ThemeVariant.Dark,
|
||||
nameof(Avalonia.Styling.ThemeVariant.Light) => Avalonia.Styling.ThemeVariant.Light,
|
||||
// "System"
|
||||
_ => Avalonia.Styling.ThemeVariant.Default
|
||||
};
|
||||
}
|
||||
}
|
||||
public bool SelectionChanged { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
xmlns:views="clr-namespace:LibationAvalonia.Views"
|
||||
xmlns:viewModels="clr-namespace:LibationAvalonia.ViewModels"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="850"
|
||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="650"
|
||||
x:Class="LibationAvalonia.Views.ProcessQueueControl">
|
||||
|
||||
<UserControl.Resources>
|
||||
@ -39,7 +39,8 @@
|
||||
<ScrollViewer
|
||||
Name="scroller"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
AllowAutoHide="False">
|
||||
<ItemsRepeater IsVisible="True"
|
||||
Grid.Column="0"
|
||||
Name="repeater"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user