diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-09-18 18:32:11 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-09-18 18:32:11 +0300 |
commit | 4ff621a080e28e971180b91789acb8ae6ce4937f (patch) | |
tree | c3d5d1aa9aa35bdcc4d1c8eb8c299b383b99fb02 /UVtools.WPF | |
parent | 6ff9fee77c9ecbd808fa8e615c1e55437cb26ac1 (diff) |
v3.6.5v3.6.5
- **UI:**
- (Add) Groups to convert menu
- (Improvement) Re-arrange convert menu order
- (Fix) Settings: Open file dialog filter dropdown width
- **PrusaSlicer:**
- (Add) AnyCubic Photon D2
- (Add) Creality Halot Ray CL925
- (Add) Elegoo Saturn 8K
- (Add) Uniformation GKtwo
- (Add) Nova3D Whale3 Pro
- (Add) Phrozen Sonic Mighty 8K
- (Add) AnyCubic Photon D2 (.dl2p) compatibility to AnyCubic file format
- (Fix) Hide "Debug tools" from "Help" menu
Diffstat (limited to 'UVtools.WPF')
-rw-r--r-- | UVtools.WPF/MainWindow.axaml | 1 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml.cs | 68 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 | ||||
-rw-r--r-- | UVtools.WPF/Windows/SettingsWindow.axaml.cs | 2 |
4 files changed, 47 insertions, 26 deletions
diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml index 9d8ef54..8a08362 100644 --- a/UVtools.WPF/MainWindow.axaml +++ b/UVtools.WPF/MainWindow.axaml @@ -233,6 +233,7 @@ <Separator IsVisible="{Binding IsDebug}"/> <MenuItem Header="_Debug tools" + IsVisible="{Binding IsDebug}" i:MenuItem.Icon="fa-solid fa-bug-slash"> <MenuItem Header="Throw exception" diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 9c6588e..50daf79 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -128,9 +128,9 @@ public partial class MainWindow : WindowEx private uint _savesCount; private bool _canSave; private readonly MenuItem _menuFileSendTo; - private MenuItem[] _menuFileOpenRecentItems; - private MenuItem[] _menuFileSendToItems; - private MenuItem[] _menuFileConvertItems; + private IEnumerable<MenuItem> _menuFileOpenRecentItems; + private IEnumerable<MenuItem> _menuFileSendToItems; + private IEnumerable<MenuItem> _menuFileConvertItems; private PointerEventArgs _globalPointerEventArgs; private PointerPoint _globalPointerPoint; @@ -229,19 +229,19 @@ public partial class MainWindow : WindowEx set => RaiseAndSetIfChanged(ref _canSave, value); } - public MenuItem[] MenuFileOpenRecentItems + public IEnumerable<MenuItem> MenuFileOpenRecentItems { get => _menuFileOpenRecentItems; set => RaiseAndSetIfChanged(ref _menuFileOpenRecentItems, value); } - public MenuItem[] MenuFileSendToItems + public IEnumerable<MenuItem> MenuFileSendToItems { get => _menuFileSendToItems; set => RaiseAndSetIfChanged(ref _menuFileSendToItems, value); } - public MenuItem[] MenuFileConvertItems + public IEnumerable<MenuItem> MenuFileConvertItems { get => _menuFileConvertItems; set => RaiseAndSetIfChanged(ref _menuFileConvertItems, value); @@ -454,7 +454,7 @@ public partial class MainWindow : WindowEx } - MenuFileSendToItems = menuItems.ToArray(); + MenuFileSendToItems = menuItems; _menuFileSendTo.IsVisible = _menuFileSendTo.IsEnabled = menuItems.Count > 0; }; } @@ -1061,9 +1061,9 @@ public partial class MainWindow : WindowEx ClearROIAndMask(); if(!Settings.Tools.LastUsedSettingsKeepOnCloseFile) OperationSessionManager.Instance.Clear(); - if(_menuFileOpenRecentItems.Length > 0) + if(_menuFileOpenRecentItems.Any()) { - _menuFileOpenRecentItems[0].IsEnabled = true; // Re-enable last file + _menuFileOpenRecentItems.First().IsEnabled = true; // Re-enable last file } ResetDataContext(); @@ -1560,9 +1560,36 @@ public partial class MainWindow : WindowEx if (SlicerFile is not ImageFile && SlicerFile.DecodeType == FileFormat.FileDecodeType.Full) { List<MenuItem> menuItems = new(); + + var convertMenu = new Dictionary<string, List<MenuItem>>(); + foreach (var fileFormat in FileFormat.AvailableFormats) { if(fileFormat is ImageFile) continue; + + List<MenuItem> parentMenu; + if (string.IsNullOrWhiteSpace(fileFormat.ConvertMenuGroup)) + { + parentMenu = menuItems; + } + else + { + if (!convertMenu.TryGetValue(fileFormat.ConvertMenuGroup, out parentMenu)) + { + parentMenu = new List<MenuItem>(); + + var subMenuItem = new MenuItem + { + Header = fileFormat.ConvertMenuGroup, + Tag = fileFormat.ConvertMenuGroup, + }; + menuItems.Add(subMenuItem); + + convertMenu.TryAdd(fileFormat.ConvertMenuGroup, parentMenu); + } + } + + foreach (var fileExtension in fileFormat.FileExtensions) { if(!fileExtension.IsVisibleOnConvertMenu) continue; @@ -1575,24 +1602,17 @@ public partial class MainWindow : WindowEx menuItem.Tapped += ConvertToOnTapped; - menuItems.Add(menuItem); + parentMenu.Add(menuItem); } - /*string extensions = fileFormat.FileExtensions.Length > 0 - ? $" ({fileFormat.GetFileExtensions()})" - : string.Empty; - - var menuItem = new MenuItem - { - Header = fileFormat.GetType().Name.Replace("File", extensions), - Tag = fileFormat - }; - - menuItem.Tapped += ConvertToOnTapped; + } - menuItems.Add(menuItem);*/ + foreach (var menuItem in menuItems) + { + if (menuItem.Tag is not string group) continue; + menuItem.Items = convertMenu[group]; } - MenuFileConvertItems = menuItems.ToArray(); + MenuFileConvertItems = menuItems; } foreach (var menuItem in new[] { MenuTools, MenuCalibration, LayerActionsMenu }) @@ -2215,7 +2235,7 @@ public partial class MainWindow : WindowEx item.Click += MenuFileOpenRecentItemOnClick; } - MenuFileOpenRecentItems = items.ToArray(); + MenuFileOpenRecentItems = items; } private void RemoveRecentFile(string file) diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index b01e5f0..0f48620 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>3.6.4</Version> + <Version>3.6.5</Version> <Platforms>AnyCPU;x64</Platforms> <PackageIcon>UVtools.png</PackageIcon> <PackageReadmeFile>README.md</PackageReadmeFile> diff --git a/UVtools.WPF/Windows/SettingsWindow.axaml.cs b/UVtools.WPF/Windows/SettingsWindow.axaml.cs index 7aadc2f..e39e938 100644 --- a/UVtools.WPF/Windows/SettingsWindow.axaml.cs +++ b/UVtools.WPF/Windows/SettingsWindow.axaml.cs @@ -67,7 +67,7 @@ public class SettingsWindow : WindowEx var fileFormats = new List<string> { - FileFormat.AllSlicerFiles.Replace("*", string.Empty) + "All slicer files" }; fileFormats.AddRange(from format in FileFormat.AvailableFormats from extension in format.FileExtensions where extension.IsVisibleOnFileFilters select $"{extension.Description} (.{extension.Extension})"); FileOpenDialogFilters = fileFormats.ToArray(); |