Skip to content

Commit

Permalink
(Improvement) Use icons instead UTF-8 character for buttons with drop…
Browse files Browse the repository at this point in the history
…-down menus
  • Loading branch information
sn4k3 committed Jan 18, 2024
1 parent a7302c5 commit 848d3e3
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 267 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
- (Improvement) Goo: On encode image do not use gradient compression when going from grey to black or white
- (Change) PZR: Disable gradient compression for this file format as it corrupt layer for Phrozen Sonic Mini 8K S (#776, #810, #814)
- (Fix) Thumbnail text generation and for partial open files
- (Add) Title bar: Display the loaded file size and re-arrange the last operation run time to the right
- (Improvement) Re-arrange some items on `File` and `Help` menu
- (Fix) Layer actions - Import layer(s): Unable to process image files (#815)
- (Fix) PCB Exposure: Draw circles using ellipses in order to use non-square pixels (#822)
- **UI:**
- (Add) Title bar: Display the loaded file size and re-arrange the last operation run time to the right
- (Improvement) Re-arrange some items on `File` and `Help` menu
- (Improvement) Use icons instead UTF-8 character for buttons with drop-down menus
- **Tools:**
- (Fix) Layer actions - Import layer(s): Unable to process image files (#815)
- (Fix) PCB Exposure: Draw circles using ellipses in order to use non-square pixels (#822)
- (Fix) PrusaSlicer Printer: "Elegoo Mars 4" is wrongly named, renamed to "Elegoo Mars 4 DLP" and added the corresponding "Elegoo Mars 4"
- (Upgrade) .NET from 6.0.25 to 6.0.26
- (Upgrade) AvaloniaUI from 11.0.6 to 11.0.7 (Fixes #803, #812)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ The fastest way to compile the project is by run the `build/compile.bat`, howeve
1. Install the [.NET 6.0 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) if not included on previous installation
1. Install the [Avalonia for Visual Studio](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS):
1. Install the Wix Toolset: (Required only for MSI build, **optional**)
- `dotnet tool install --global wix --version 4.0.0`
- `dotnet tool install --global wix`
- [Visual Studio HeatWave extension](https://www.firegiant.com/wix/heatwave)
1. Open UVtools.sln
1. Build
Expand Down
31 changes: 31 additions & 0 deletions UVtools.CAD/UVtools_fb_cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions UVtools.UI/Assets/Styles/Styles.axaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uac="clr-namespace:UVtools.AvaloniaControls;assembly=UVtools.AvaloniaControls">
xmlns:uac="clr-namespace:UVtools.AvaloniaControls;assembly=UVtools.AvaloniaControls"
xmlns:controls="clr-namespace:UVtools.UI.Controls">

<Design.PreviewWith>
<Border Padding="20"></Border>
</Design.PreviewWith>

<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary x:Key="Themes">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="GroupBoxHeaderBackground" Color="LightBlue" />
Expand Down Expand Up @@ -367,5 +368,13 @@
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Cursor" Value="Hand" />
</Style>


<Style Selector="SplitButton /template/ Border">
<Setter Property="IsVisible" Value="False" />
</Style>

<Style Selector="ToggleSplitButton, SplitButton, controls|SplitButtonWithIcon, controls|ToggleSplitButtonWithIcon">
<Setter Property="Padding" Value="8,5,5,6" />
</Style>

</Styles>
20 changes: 19 additions & 1 deletion UVtools.UI/Controls/DropDownButtonWithIcon.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Layout;
using System;

Expand All @@ -10,6 +10,15 @@ public class DropDownButtonWithIcon : DropDownButton
{
protected override Type StyleKeyOverride => typeof(DropDownButton);

public static readonly StyledProperty<bool> OpenFlyoutWithRightClickProperty =
AvaloniaProperty.Register<SplitButtonWithIcon, bool>(nameof(OpenFlyoutWithRightClick), defaultValue: true);

public bool OpenFlyoutWithRightClick
{
get => GetValue(OpenFlyoutWithRightClickProperty);
set => SetValue(OpenFlyoutWithRightClickProperty, value);
}

public static readonly StyledProperty<string?> TextProperty =
ButtonWithIcon.TextProperty.AddOwner<DropDownButtonWithIcon>();

Expand Down Expand Up @@ -61,6 +70,15 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
}
}

protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
base.OnPointerReleased(e);
if (e.InitialPressMouseButton == MouseButton.Right && OpenFlyoutWithRightClick)
{
OpenFlyout();
}
}

public Projektanker.Icons.Avalonia.Icon MakeIcon()
{
return new Projektanker.Icons.Avalonia.Icon { Value = Icon };
Expand Down
18 changes: 18 additions & 0 deletions UVtools.UI/Controls/SplitButtonWithIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
using Avalonia.Controls;
using Avalonia.Layout;
using System;
using Avalonia.Input;

namespace UVtools.UI.Controls;

public class SplitButtonWithIcon : SplitButton
{
protected override Type StyleKeyOverride => typeof(SplitButton);

public static readonly StyledProperty<bool> OpenFlyoutWithRightClickProperty =
AvaloniaProperty.Register<SplitButtonWithIcon, bool>(nameof(OpenFlyoutWithRightClick), defaultValue: true);

public bool OpenFlyoutWithRightClick
{
get => GetValue(OpenFlyoutWithRightClickProperty);
set => SetValue(OpenFlyoutWithRightClickProperty, value);
}

public static readonly StyledProperty<string?> TextProperty =
ButtonWithIcon.TextProperty.AddOwner<SplitButtonWithIcon>();
Expand Down Expand Up @@ -61,6 +70,15 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
}
}

protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
base.OnPointerReleased(e);
if (e.InitialPressMouseButton == MouseButton.Right && OpenFlyoutWithRightClick)
{
OpenFlyout();
}
}

public Projektanker.Icons.Avalonia.Icon MakeIcon()
{
return new Projektanker.Icons.Avalonia.Icon { Value = Icon };
Expand Down
21 changes: 20 additions & 1 deletion UVtools.UI/Controls/ToggleSplitButtonWithIcon.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Layout;

namespace UVtools.UI.Controls;

public class ToggleSplitButtonWithIcon : ToggleSplitButton
{
public static readonly StyledProperty<bool> OpenFlyoutWithRightClickProperty =
AvaloniaProperty.Register<SplitButtonWithIcon, bool>(nameof(OpenFlyoutWithRightClick), defaultValue: true);

public bool OpenFlyoutWithRightClick
{
get => GetValue(OpenFlyoutWithRightClickProperty);
set => SetValue(OpenFlyoutWithRightClickProperty, value);
}

public static readonly StyledProperty<string?> TextProperty =
ButtonWithIcon.TextProperty.AddOwner<ToggleSplitButtonWithIcon>();

Expand Down Expand Up @@ -58,6 +67,16 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
}
}

protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
base.OnPointerReleased(e);
if (e.InitialPressMouseButton == MouseButton.Right && OpenFlyoutWithRightClick)
{

OpenFlyout();
}
}

public Projektanker.Icons.Avalonia.Icon MakeIcon()
{
return new Projektanker.Icons.Avalonia.Icon { Value = Icon };
Expand Down
2 changes: 1 addition & 1 deletion UVtools.UI/MainWindow.LayerPreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ private async void LayerImageBox_KeyUp(object? sender, KeyEventArgs e)
operation.SelectCurrentLayer(ActualLayer);
layerRange = $"in the current {ActualLayer} layer";
}

if (await this.MessageBoxQuestion($"Are you sure you want to keep only the selected region/mask(s) {layerRange}?",
"Keep only selected region/mask(s)?") != MessageButtonResult.Yes) return;
await RunOperation(operation);
Expand Down
Loading

0 comments on commit 848d3e3

Please sign in to comment.