Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Address review feedback: scope PR to interactive crop tool
smjrifle2fa8616aa6be
diff --git a/src/Filee.App/App.axaml.cs b/src/Filee.App/App.axaml.csindex 512626a9..ba48ba9c 100644--- a/src/Filee.App/App.axaml.cs+++ b/src/Filee.App/App.axaml.cs@@ -72,7 +72,7 @@ public partial class App : Applicationvar triggers = AppHost.Get<TriggerService>();var radial = AppHost.Get<RadialController>();var platform = AppHost.Get<IPlatformServices>();- triggers.DragStarted += (_, e) => radial.ShowForDrag(e.X, e.Y, e.Gesture);+ triggers.DragStarted += (_, e) => radial.ShowForDrag(e.X, e.Y);triggers.DragEnded += (_, _) => radial.OnDragGestureEnded();triggers.SelectionGesture += async (_, e) =>{diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex 7972800c..821af720 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -57,9 +57,6 @@"donut.empty": "Drag presets here","donut.same_format": "Same format","donut.group_caption": "Group of {0}",- "donut.more": "More →",- "donut.back": "← Back",- "donut.nav_hint": "Page {0} of {1}","toast.converting": "{0} → {1}","toast.done": "Done",@@ -132,13 +129,12 @@"profile.fonts": "Fonts","profile.data": "Data","profile.models": "3D models",- "profile.utility": "Quick Tools","profile.mixed": "Mixed files","preset.crop": "Crop",- "crop.title": "Crop","crop.save": "Crop & Save","crop.reset": "Reset",+ "crop.skip": "Skip","crop.aspect_title": "Aspect:","crop.aspect_free": "Free","crop.aspect_original": "Original",@@ -323,7 +319,6 @@"toolbar.size": "Size","toolbar.hole": "Hole","toolbar.opacity": "Opacity",- "toolbar.max_slices_page": "Slices/page","toolbar.new_preset": "New preset","toolbar.new_group": "New group","group.editor_title": "Group",diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.jsonindex 7c94e83e..88e4ec75 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -57,9 +57,6 @@"donut.empty": "프리셋을 끌어다 놓으세요","donut.same_format": "같은 형식","donut.group_caption": "묶음 · {0}개",- "donut.more": "더보기 →",- "donut.back": "← 이전",- "donut.nav_hint": "페이지 {0}/{1}","toast.converting": "{0} → {1}","toast.done": "완료",@@ -132,13 +129,12 @@"profile.fonts": "글꼴","profile.data": "데이터","profile.models": "3D 모델",- "profile.utility": "빠른 도구","profile.mixed": "혼합 파일","preset.crop": "자르기",- "crop.title": "자르기","crop.save": "자르기 및 저장","crop.reset": "초기화",+ "crop.skip": "건너뛰기","crop.aspect_title": "비율:","crop.aspect_free": "자유","crop.aspect_original": "원본",@@ -323,7 +319,6 @@"toolbar.size": "크기","toolbar.hole": "구멍","toolbar.opacity": "불투명도",- "toolbar.max_slices_page": "페이지당 항목","toolbar.new_preset": "새 프리셋","toolbar.new_group": "새 묶음","group.editor_title": "묶음",diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.jsonindex b553133b..7270675f 100644--- a/src/Filee.App/Assets/i18n/pl.json+++ b/src/Filee.App/Assets/i18n/pl.json@@ -57,9 +57,6 @@"donut.empty": "Przeciągnij tu ustawienia","donut.same_format": "Ten sam format","donut.group_caption": "Grupa: {0}",- "donut.more": "Więcej →",- "donut.back": "← Wstecz",- "donut.nav_hint": "Strona {0} z {1}","toast.converting": "{0} → {1}","toast.done": "Gotowe",@@ -132,13 +129,12 @@"profile.fonts": "Czcionki","profile.data": "Dane","profile.models": "Modele 3D",- "profile.utility": "Szybkie narzędzia","profile.mixed": "Różne pliki","preset.crop": "Kadruj",- "crop.title": "Kadrowanie","crop.save": "Kadruj i zapisz","crop.reset": "Resetuj",+ "crop.skip": "Pomiń","crop.aspect_title": "Proporcje:","crop.aspect_free": "Dowolne","crop.aspect_original": "Oryginalne",@@ -323,7 +319,6 @@"toolbar.size": "Rozmiar","toolbar.hole": "Otwór","toolbar.opacity": "Krycie",- "toolbar.max_slices_page": "Wycinki/stronę","toolbar.new_preset": "Nowe ustawienie","toolbar.new_group": "Nowa grupa","group.editor_title": "Grupa",diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.jsonindex 48917897..0a6f4f23 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -57,9 +57,6 @@"donut.empty": "把预设拖到这里","donut.same_format": "同格式","donut.group_caption": "组 · {0} 项",- "donut.more": "更多 →",- "donut.back": "← 返回",- "donut.nav_hint": "第 {0}/{1} 页","toast.converting": "{0} → {1}","toast.done": "完成",@@ -132,13 +129,12 @@"profile.fonts": "字体","profile.data": "数据","profile.models": "3D 模型",- "profile.utility": "快捷工具","profile.mixed": "混合文件","preset.crop": "裁剪",- "crop.title": "裁剪","crop.save": "裁剪并保存","crop.reset": "重置",+ "crop.skip": "跳过","crop.aspect_title": "比例:","crop.aspect_free": "自由","crop.aspect_original": "原始比例",@@ -323,7 +319,6 @@"toolbar.size": "大小","toolbar.hole": "内圈","toolbar.opacity": "不透明度",- "toolbar.max_slices_page": "每页项目数","toolbar.new_preset": "新预设","toolbar.new_group": "新建组","group.editor_title": "组",diff --git a/src/Filee.App/Controls/CropCanvas.cs b/src/Filee.App/Controls/CropCanvas.csindex 9956f331..d0cad03e 100644--- a/src/Filee.App/Controls/CropCanvas.cs+++ b/src/Filee.App/Controls/CropCanvas.cs@@ -1,5 +1,4 @@-// Interactive crop control with manual screenshot-style selection, 8 resize handles,-// rule-of-thirds grid, and aspect ratio locking (1:1 square, free-form, etc.).+// Interactive image crop control: handles, rule-of-thirds grid and aspect ratio constraints.using Avalonia;using Avalonia.Controls;@@ -60,10 +59,21 @@ public sealed class CropCanvas : Controlprivate Rect _dragStartCrop;private const double MinSizePx = 24.0;+ private static readonly Cursor ArrowCursor = new(StandardCursorType.Arrow);+ private static readonly Cursor SizeAllCursor = new(StandardCursorType.SizeAll);+ private static readonly Cursor SizeNorthSouthCursor = new(StandardCursorType.SizeNorthSouth);+ private static readonly Cursor SizeWestEastCursor = new(StandardCursorType.SizeWestEast);+ private static readonly Cursor TopLeftCursor = new(StandardCursorType.TopLeftCorner);+ private static readonly Cursor TopRightCursor = new(StandardCursorType.TopRightCorner);+ private static readonly Cursor CrossCursor = new(StandardCursorType.Cross);+private static readonly IBrush DimMaskBrush = new SolidColorBrush(Color.FromArgb(175, 0, 0, 0));private static readonly IPen CropBorderPen = new Pen(Brushes.White, 1.5);private static readonly IPen GridPen = new Pen(new SolidColorBrush(Color.FromArgb(80, 255, 255, 255)), 1);+ private static double SafeClamp(double val, double min, double max) =>+ min > max ? Math.Clamp(val, max, min) : Math.Clamp(val, min, max);+static CropCanvas(){AffectsRender<CropCanvas>(SourceImageProperty, NormalizedCropRectProperty, AspectRatioProperty);@@ -302,26 +312,26 @@ public sealed class CropCanvas : Controlvar h = HitTestHandle(pt, crop, imgBounds);Cursor = h switch{- CropHandle.TopLeft or CropHandle.BottomRight => new Cursor(StandardCursorType.TopLeftCorner),- CropHandle.TopRight or CropHandle.BottomLeft => new Cursor(StandardCursorType.TopRightCorner),- CropHandle.Top or CropHandle.Bottom => new Cursor(StandardCursorType.SizeNorthSouth),- CropHandle.Left or CropHandle.Right => new Cursor(StandardCursorType.SizeWestEast),- CropHandle.Body => new Cursor(StandardCursorType.SizeAll),- CropHandle.CreateNew => new Cursor(StandardCursorType.Cross),- _ => Cursor.Default,+ CropHandle.TopLeft or CropHandle.BottomRight => TopLeftCursor,+ CropHandle.TopRight or CropHandle.BottomLeft => TopRightCursor,+ CropHandle.Top or CropHandle.Bottom => SizeNorthSouthCursor,+ CropHandle.Left or CropHandle.Right => SizeWestEastCursor,+ CropHandle.Body => SizeAllCursor,+ CropHandle.CreateNew => CrossCursor,+ _ => ArrowCursor,};return;}- // Active manual screenshot-style selection drag+ // Active manual selection dragif (_activeHandle == CropHandle.CreateNew){var p1 = new Point(- Math.Clamp(_dragStartPoint.X, imgBounds.Left, imgBounds.Right),- Math.Clamp(_dragStartPoint.Y, imgBounds.Top, imgBounds.Bottom));+ SafeClamp(_dragStartPoint.X, imgBounds.Left, imgBounds.Right),+ SafeClamp(_dragStartPoint.Y, imgBounds.Top, imgBounds.Bottom));var p2 = new Point(- Math.Clamp(pt.X, imgBounds.Left, imgBounds.Right),- Math.Clamp(pt.Y, imgBounds.Top, imgBounds.Bottom));+ SafeClamp(pt.X, imgBounds.Left, imgBounds.Right),+ SafeClamp(pt.Y, imgBounds.Top, imgBounds.Bottom));if (AspectRatio <= 0){@@ -334,7 +344,7 @@ public sealed class CropCanvas : Control}else{- // Constrained aspect ratio selection (e.g. 1:1 Instagram post)+ // Constrained aspect ratio selectionvar R = AspectRatio;var dx = p2.X - p1.X;var dy = p2.Y - p1.Y;@@ -370,8 +380,8 @@ public sealed class CropCanvas : Controlvar deltaX = pt.X - _dragStartPoint.X;var deltaY = pt.Y - _dragStartPoint.Y;- var newX = Math.Clamp(_dragStartCrop.X + deltaX, imgBounds.Left, Math.Max(imgBounds.Left, imgBounds.Right - _dragStartCrop.Width));- var newY = Math.Clamp(_dragStartCrop.Y + deltaY, imgBounds.Top, Math.Max(imgBounds.Top, imgBounds.Bottom - _dragStartCrop.Height));+ var newX = SafeClamp(_dragStartCrop.X + deltaX, imgBounds.Left, Math.Max(imgBounds.Left, imgBounds.Right - _dragStartCrop.Width));+ var newY = SafeClamp(_dragStartCrop.Y + deltaY, imgBounds.Top, Math.Max(imgBounds.Top, imgBounds.Bottom - _dragStartCrop.Height));SetCropFromScreen(new Rect(newX, newY, _dragStartCrop.Width, _dragStartCrop.Height), imgBounds);return;@@ -392,32 +402,32 @@ public sealed class CropCanvas : Controlswitch (_activeHandle){case CropHandle.TopLeft:- left = Math.Clamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);- top = Math.Clamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);+ left = SafeClamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);+ top = SafeClamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);break;case CropHandle.TopRight:- right = Math.Clamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);- top = Math.Clamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);+ right = SafeClamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);+ top = SafeClamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);break;case CropHandle.BottomLeft:- left = Math.Clamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);- bottom = Math.Clamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);+ left = SafeClamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);+ bottom = SafeClamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);break;case CropHandle.BottomRight:- right = Math.Clamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);- bottom = Math.Clamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);+ right = SafeClamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);+ bottom = SafeClamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);break;case CropHandle.Top:- top = Math.Clamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);+ top = SafeClamp(_dragStartCrop.Top + dyRes, imgBounds.Top, bottom - MinSizePx);break;case CropHandle.Bottom:- bottom = Math.Clamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);+ bottom = SafeClamp(_dragStartCrop.Bottom + dyRes, top + MinSizePx, imgBounds.Bottom);break;case CropHandle.Left:- left = Math.Clamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);+ left = SafeClamp(_dragStartCrop.Left + dxRes, imgBounds.Left, right - MinSizePx);break;case CropHandle.Right:- right = Math.Clamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);+ right = SafeClamp(_dragStartCrop.Right + dxRes, left + MinSizePx, imgBounds.Right);break;}@@ -425,7 +435,7 @@ public sealed class CropCanvas : Control}else{- // Proportional aspect ratio handle resizing (e.g. 1:1 square)+ // Proportional aspect ratio handle resizingvar R = AspectRatio;switch (_activeHandle)@@ -435,7 +445,7 @@ public sealed class CropCanvas : Controlvar anchor = _dragStartCrop.TopLeft;var delta = (dxRes + dyRes * R) / 2.0;var maxW = Math.Min(imgBounds.Right - anchor.X, (imgBounds.Bottom - anchor.Y) * R);- var w = Math.Clamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;SetCropFromScreen(new Rect(anchor.X, anchor.Y, w, h), imgBounds);break;@@ -446,7 +456,7 @@ public sealed class CropCanvas : Controlvar anchorY = _dragStartCrop.Top;var delta = (-dxRes + dyRes * R) / 2.0;var maxW = Math.Min(anchorX - imgBounds.Left, (imgBounds.Bottom - anchorY) * R);- var w = Math.Clamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;SetCropFromScreen(new Rect(anchorX - w, anchorY, w, h), imgBounds);break;@@ -457,7 +467,7 @@ public sealed class CropCanvas : Controlvar anchorY = _dragStartCrop.Bottom;var delta = (dxRes - dyRes * R) / 2.0;var maxW = Math.Min(imgBounds.Right - anchorX, (anchorY - imgBounds.Top) * R);- var w = Math.Clamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;SetCropFromScreen(new Rect(anchorX, anchorY - h, w, h), imgBounds);break;@@ -468,7 +478,7 @@ public sealed class CropCanvas : Controlvar anchorY = _dragStartCrop.Bottom;var delta = (-dxRes - dyRes * R) / 2.0;var maxW = Math.Min(anchorX - imgBounds.Left, (anchorY - imgBounds.Top) * R);- var w = Math.Clamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width + delta, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;SetCropFromScreen(new Rect(anchorX - w, anchorY - h, w, h), imgBounds);break;@@ -477,9 +487,9 @@ public sealed class CropCanvas : Control{var anchorLeft = _dragStartCrop.Left;var maxW = Math.Min(imgBounds.Right - anchorLeft, imgBounds.Height * R);- var w = Math.Clamp(_dragStartCrop.Width + dxRes, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width + dxRes, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;- var y = Math.Clamp(_dragStartCrop.Center.Y - h / 2.0, imgBounds.Top, imgBounds.Bottom - h);+ var y = SafeClamp(_dragStartCrop.Center.Y - h / 2.0, imgBounds.Top, imgBounds.Bottom - h);SetCropFromScreen(new Rect(anchorLeft, y, w, h), imgBounds);break;}@@ -487,9 +497,9 @@ public sealed class CropCanvas : Control{var anchorRight = _dragStartCrop.Right;var maxW = Math.Min(anchorRight - imgBounds.Left, imgBounds.Height * R);- var w = Math.Clamp(_dragStartCrop.Width - dxRes, MinSizePx, Math.Max(MinSizePx, maxW));+ var w = SafeClamp(_dragStartCrop.Width - dxRes, MinSizePx, Math.Max(MinSizePx, maxW));var h = w / R;- var y = Math.Clamp(_dragStartCrop.Center.Y - h / 2.0, imgBounds.Top, imgBounds.Bottom - h);+ var y = SafeClamp(_dragStartCrop.Center.Y - h / 2.0, imgBounds.Top, imgBounds.Bottom - h);SetCropFromScreen(new Rect(anchorRight - w, y, w, h), imgBounds);break;}@@ -497,9 +507,9 @@ public sealed class CropCanvas : Control{var anchorTop = _dragStartCrop.Top;var maxH = Math.Min(imgBounds.Bottom - anchorTop, imgBounds.Width / R);- var h = Math.Clamp(_dragStartCrop.Height + dyRes, MinSizePx, Math.Max(MinSizePx, maxH));+ var h = SafeClamp(_dragStartCrop.Height + dyRes, MinSizePx, Math.Max(MinSizePx, maxH));var w = h * R;- var x = Math.Clamp(_dragStartCrop.Center.X - w / 2.0, imgBounds.Left, imgBounds.Right - w);+ var x = SafeClamp(_dragStartCrop.Center.X - w / 2.0, imgBounds.Left, imgBounds.Right - w);SetCropFromScreen(new Rect(x, anchorTop, w, h), imgBounds);break;}@@ -507,9 +517,9 @@ public sealed class CropCanvas : Control{var anchorBottom = _dragStartCrop.Bottom;var maxH = Math.Min(anchorBottom - imgBounds.Top, imgBounds.Width / R);- var h = Math.Clamp(_dragStartCrop.Height - dyRes, MinSizePx, Math.Max(MinSizePx, maxH));+ var h = SafeClamp(_dragStartCrop.Height - dyRes, MinSizePx, Math.Max(MinSizePx, maxH));var w = h * R;- var x = Math.Clamp(_dragStartCrop.Center.X - w / 2.0, imgBounds.Left, imgBounds.Right - w);+ var x = SafeClamp(_dragStartCrop.Center.X - w / 2.0, imgBounds.Left, imgBounds.Right - w);SetCropFromScreen(new Rect(x, anchorBottom - h, w, h), imgBounds);break;}diff --git a/src/Filee.App/Controls/DonutMenu.Groups.cs b/src/Filee.App/Controls/DonutMenu.Groups.csindex 80d0e394..1638c9a1 100644--- a/src/Filee.App/Controls/DonutMenu.Groups.cs+++ b/src/Filee.App/Controls/DonutMenu.Groups.cs@@ -41,20 +41,6 @@ public sealed partial class DonutMenuprivate IDisposable? _expandTimer;private double _pendingDistance;- // Navigation slice hover timer (e.g. dwell on "More" or "Back" to turn page)- public event EventHandler<int>? NavigationRequested;- private int _pendingNav = -1;- private IDisposable? _navTimer;- private bool _navCooldown;- private static readonly TimeSpan NavDelay = TimeSpan.FromSeconds(2.0);-- private void ClearPendingNav()- {- _pendingNav = -1;- _navTimer?.Dispose();- _navTimer = null;- }-/// <summary>How long the pointer rests on a group slice before it opens: passing over on the way elsewhere doesn't.</summary>internal static readonly TimeSpan ExpandDelay = TimeSpan.FromMilliseconds(160);@@ -121,38 +107,15 @@ public sealed partial class DonutMenuvar sub = -1;switch (hit.Kind){- case DonutHitKind.Segment when hit.Index >= 0 && hit.Index < Count && Items![hit.Index].IsNavigation:- _expanded = -1;- ClearPending();- if (!_navCooldown && _pendingNav != hit.Index)- {- ClearPendingNav();- _pendingNav = hit.Index;- var navIndex = hit.Index;- var delta = Items![navIndex].IsNextPage ? 1 : -1;- _navTimer = DispatcherTimer.RunOnce(() =>- {- ClearPendingNav();- _navCooldown = true; // Stay in cooldown while pointer remains on this slot to prevent bounce-back flicker- NavigationRequested?.Invoke(this, delta);- }, NavDelay);- }- break;case DonutHitKind.Segment when hit.Index == _expanded:- _navCooldown = false;- ClearPendingNav();_ringFromKeys = false; // the mouse reached it: from here on it leadsbreak;case DonutHitKind.Segment when at is { } across && OnWayToRing(across):- _navCooldown = false;- ClearPendingNav();// A neighbour's outer half under the open ring, crossed on the way to its outer slices: that neighbour is// what a click or a drop here converts with, but the ring stays open.ClearPending();break;case DonutHitKind.Segment when hit.Index >= 0 && hit.Index < Count && Items![hit.Index].CanExpand:- _navCooldown = false;- ClearPendingNav();_expanded = -1;var distance = at is { } p ? Distance(p, Center) : 0;if (_pendingGroup != hit.Index)@@ -172,32 +135,22 @@ public sealed partial class DonutMenu}break;case DonutHitKind.SubSegment:- _navCooldown = false;- ClearPendingNav();_ringFromKeys = false;sub = hit.Sub;break;case DonutHitKind.Outside when _pendingGroup >= 0 && at is { } flick && InFan(flick, _pendingGroup) &&Distance(flick, Center) <= SubRadii.Outer + BackdropMargin:- _navCooldown = false;- ClearPendingNav();ExpandPendingGroup(); // flicked straight out to where its ring opens: no need to waitbreak;case DonutHitKind.Outside:- _navCooldown = false;- ClearPendingNav();ClearPending(); // left the slice before it opened: it stays closedif (_expanded >= 0 && at is { } q && !InFan(q, _expanded))_expanded = -1; // went round the outside, away from the ringbreak;case DonutHitKind.Center when _ringFromKeys:- _navCooldown = false;- ClearPendingNav();sub = _subHover; // on its way out of the hole to the ringbreak;default:- _navCooldown = false;- ClearPendingNav();_expanded = -1;_ringFromKeys = false;ClearPending();@@ -325,19 +278,12 @@ public sealed partial class DonutMenu/// </summary>public bool Converts(DonutHit hit) => hit.Kind switch{- DonutHitKind.Segment => hit.Index >= 0 && hit.Index < Count && Items![hit.Index] is { IsGroup: false, IsNavigation: false, IsEnabled: true },+ DonutHitKind.Segment => hit.Index >= 0 && hit.Index < Count && Items![hit.Index] is { IsGroup: false, IsEnabled: true },DonutHitKind.SubSegment => hit.Index >= 0 && hit.Index < Count && Items![hit.Index].Children is { } children &&hit.Sub >= 0 && hit.Sub < children.Count && children[hit.Sub].IsEnabled,_ => false,};- /// <summary>True when <paramref name="hit"/> is a page navigation slice.</summary>- public bool IsNavigation(DonutHit hit) =>- hit.Kind == DonutHitKind.Segment && hit.Index >= 0 && hit.Index < Count && Items![hit.Index] is { IsNavigation: true };-- /// <summary>True when <paramref name="hit"/> accepts a drag drop (conversion slice or page turn slice).</summary>- public bool AcceptsDrop(DonutHit hit) => Converts(hit) || IsNavigation(hit);-/// <summary>/// A drag from outside left the window, last seen at <paramref name="lastAt"/>: clears what it lit up and folds a/// group. Unless it was still on the donut or on the fan of a group that is open or about to open: Windows and macOS@@ -447,8 +393,10 @@ public sealed partial class DonutMenuvar item = children[k];var mid = DonutGeometry.SubMidAngle(parentMid, k, children.Count, subSpan);var wedge = CreateWedge(center, inner, outer, mid, subSpan);+ context.DrawGeometry(WithOpacity(SliceBrush, SliceOpacity * (item.IsEnabled ? 1 : 0.55)), BorderPen(), wedge);var hot = k == _subHover && group == _expanded && item.IsEnabled;- DrawGlassSlice(context, wedge, item, center, inner, outer, mid, subSpan, hot ? 1.0 : 0, false);+ if (hot)+ context.DrawGeometry(WithOpacity(AccentBrush, 0.82), null, wedge);DrawLabel(context, item, center, (inner + outer) / 2, mid, subSpan * (inner + outer) / 2 - 8,SubBand - 8, bold, regular, hot);}diff --git a/src/Filee.App/Controls/DonutMenu.Progress.cs b/src/Filee.App/Controls/DonutMenu.Progress.csindex 1f1d22f2..fb0fd851 100644--- a/src/Filee.App/Controls/DonutMenu.Progress.cs+++ b/src/Filee.App/Controls/DonutMenu.Progress.cs@@ -289,8 +289,10 @@ public sealed partial class DonutMenuusing (context.PushOpacity(1 - c)){var wedge = CreateWedge(center, r1, r2, i, n);+ context.DrawGeometry(WithOpacity(SliceBrush, SliceOpacity), BorderPen(), wedge);var hot = i == ActiveIndex;- DrawGlassSlice(context, wedge, Items![i], center, r1, r2, DonutGeometry.MidAngle(i, n), DonutGeometry.Span(n), hot ? 1.0 : 0, false);+ if (hot)+ context.DrawGeometry(WithOpacity(AccentBrush, 0.8), null, wedge);// Labels shrink with their slice instead of vanishing when the collapse starts.DrawLabel(context, Items![i], center, (r1 + r2) / 2, DonutGeometry.MidAngle(i, n),DonutGeometry.Span(n) * (r1 + r2) / 2 - 10, r2 - r1 - 16, bold, regular, hot);@@ -300,8 +302,7 @@ public sealed partial class DonutMenu// The hole shrinks to the size of the ring's plate.var plate = RingRadius + RingStroke + 2;var holeRadius = Lerp(r1 - 6, plate, EaseInCubic(collapseAll));- var isDarkHole = CenterBrush is ISolidColorBrush scHole ? ThemeService.Luminance(scHole.Color) < 0.5 : true;- DrawCenterDisc(context, center, holeRadius, isDarkHole);+ context.DrawEllipse(CenterBrush, BorderPen(), center, holeRadius, holeRadius);return;}@@ -319,9 +320,8 @@ public sealed partial class DonutMenuusing var __ = context.PushOpacity(opacity);var plateRadius = RingRadius + RingStroke + 2;- var isDarkPlate = CenterBrush is ISolidColorBrush scPlate ? ThemeService.Luminance(scPlate.Color) < 0.5 : true;DrawPlateShadow(context, center, plateRadius);- DrawCenterDisc(context, center, plateRadius, isDarkPlate);+ context.DrawEllipse(CenterBrush, BorderPen(), center, plateRadius, plateRadius);context.DrawEllipse(null, new Pen(WithOpacity(SecondaryForeground, 0.22), RingStroke), center, RingRadius, RingRadius);var arcBrush = _outcome switchdiff --git a/src/Filee.App/Controls/DonutMenu.cs b/src/Filee.App/Controls/DonutMenu.csindex 350d36c0..2929cb38 100644--- a/src/Filee.App/Controls/DonutMenu.cs+++ b/src/Filee.App/Controls/DonutMenu.cs@@ -44,15 +44,6 @@ public sealed class DonutItem/// <summary>A group with something to fan out.</summary>public bool CanExpand => Children is { Count: > 0 };-- /// <summary>True when this slice navigates between pages of presets rather than converting.</summary>- public bool IsNavigation { get; init; }-- /// <summary>True when clicking/hovering this slice advances to the next page.</summary>- public bool IsNextPage { get; init; }-- /// <summary>True when clicking/hovering this slice returns to the previous page.</summary>- public bool IsPrevPage { get; init; }}/// <summary>Donut-shaped menu control.</summary>@@ -409,7 +400,6 @@ public sealed partial class DonutMenu : Control_span = Enumerable.Range(0, n).Select(_ => new Spring { Value = DonutGeometry.Span(n) }).ToArray();_expanded = _shownExpanded = _subHover = -1;ClearPending();- ClearPendingNav();_expand = default;// The window is reused: a keyboard hold from the last time it was open must not swallow the first moves now._keyboardHold = _ringFromKeys = false;@@ -814,7 +804,9 @@ public sealed partial class DonutMenu : Controlif (n == 0){var ring = CreateRing(center, r1, r2);- DrawGlassSlice(context, ring, null, center, r1, r2, 0, 2 * Math.PI, 0, _dropTargetIndex >= 0);+ context.DrawGeometry(WithOpacity(SliceBrush, SliceOpacity), BorderPen(), ring);+ if (_dropTargetIndex >= 0)+ context.DrawGeometry(WithOpacity(AccentBrush, 0.35), null, ring);}for (var i = 0; i < n; i++)@@ -845,7 +837,12 @@ public sealed partial class DonutMenu : Controlusing (context.PushOpacity(Math.Clamp(open, 0, 1) * (i == _dimmedIndex ? 0.3 : 1))){var wedge = CreateWedge(center, r1, r2, mid, span);- DrawGlassSlice(context, wedge, item, center, r1, r2, mid, span, hover, i == _dropTargetIndex);+ context.DrawGeometry(WithOpacity(SliceBrush, SliceOpacity * (item.IsEnabled ? 1 : 0.55)), BorderPen(), wedge);++ // The accent fades in and out with the highlight (no floor: a floor made it vanish with a jump).+ var emphasis = i == _dropTargetIndex ? 1.0 : hover;+ if (emphasis > 0.01 && item.IsEnabled)+ context.DrawGeometry(WithOpacity(AccentBrush, 0.82 * Math.Clamp(emphasis, 0, 1)), null, wedge);var hot = (i == ActiveIndex || i == _dropTargetIndex) && item.IsEnabled;DrawLabel(context, item, center, (r1 + r2) / 2, mid, span * (r1 + r2) / 2 - 10,@@ -870,205 +867,21 @@ public sealed partial class DonutMenu : Controlprivate void DrawSoftShadow(DrawingContext context, Point center, double r2){- var opening = _open.Length == 0 ? 1 : Math.Clamp(_open.Average(), 0, 1);- if (opening <= 0.001)- return;-- using (context.PushOpacity(opening))- {- // macOS Tier 1: Large diffuse ambient shadow- var ambientRadius = r2 + 28;- var ambientBrush = new RadialGradientBrush- {- GradientStops =- {- new GradientStop(Color.FromArgb(0, 0, 0, 0), 0),- new GradientStop(Color.FromArgb(0, 0, 0, 0), (r2 - 14) / ambientRadius),- new GradientStop(Color.FromArgb(26, 0, 0, 0), (r2 - 2) / ambientRadius),- new GradientStop(Color.FromArgb(12, 0, 0, 0), (r2 + 10) / ambientRadius),- new GradientStop(Color.FromArgb(0, 0, 0, 0), 1),- },- };- context.DrawEllipse(ambientBrush, null, new Point(center.X, center.Y + 4), ambientRadius, ambientRadius);-- // macOS Tier 2: Directional contact key shadow (grounding the wheel to light from above)- var keyRadius = r2 + 12;- var keyBrush = new RadialGradientBrush- {- GradientStops =- {- new GradientStop(Color.FromArgb(0, 0, 0, 0), 0),- new GradientStop(Color.FromArgb(0, 0, 0, 0), (r2 - 16) / keyRadius),- new GradientStop(Color.FromArgb(52, 0, 0, 0), (r2 - 2) / keyRadius),- new GradientStop(Color.FromArgb(0, 0, 0, 0), 1),- },- };- context.DrawEllipse(keyBrush, null, new Point(center.X, center.Y + 7), keyRadius, keyRadius);- }- }-- private void DrawGlassSlice(DrawingContext context, Geometry wedge, DonutItem? item, Point center,- double r1, double r2, double mid, double span, double hover, bool isDropTarget)- {- var isEnabled = item?.IsEnabled ?? true;- var baseOpacity = SliceOpacity * (isEnabled ? 1.0 : 0.55);- var isDark = SliceBrush is ISolidColorBrush sc ? ThemeService.Luminance(sc.Color) < 0.5 : true;-- // 1. Frosted Glass Base Gradient (ambient light catching the upper glass)- if (SliceBrush is ISolidColorBrush solid)- {- var c = solid.Color;- var topA = (byte)Math.Clamp(c.A * baseOpacity * (isDark ? 0.94 : 0.96), 0, 255);- var botA = (byte)Math.Clamp(c.A * baseOpacity * (isDark ? 0.98 : 0.92), 0, 255);- var glassFill = new LinearGradientBrush- {- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 1, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(isDark- ? Color.FromArgb(topA, (byte)Math.Min(255, c.R + 22), (byte)Math.Min(255, c.G + 24), (byte)Math.Min(255, c.B + 28))- : Color.FromArgb(topA, 255, 255, 255), 0),- new GradientStop(isDark- ? Color.FromArgb(botA, (byte)Math.Max(0, c.R - 8), (byte)Math.Max(0, c.G - 8), (byte)Math.Max(0, c.B - 6))- : Color.FromArgb(botA, (byte)Math.Max(0, c.R - 10), (byte)Math.Max(0, c.G - 8), (byte)Math.Max(0, c.B - 4)), 1),- }- };- context.DrawGeometry(glassFill, null, wedge);- }- else- {- context.DrawGeometry(WithOpacity(SliceBrush, baseOpacity), null, wedge);- }-- // 2. Frosted Specular Sheen (Apple macOS physical glass reflection)- var sheenBrush = new LinearGradientBrush- {- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 0.75, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(Color.FromArgb((byte)(isDark ? 30 : 65), 255, 255, 255), 0),- new GradientStop(Color.FromArgb((byte)(isDark ? 8 : 16), 255, 255, 255), 0.4),- new GradientStop(Color.FromArgb(0, 255, 255, 255), 1),- }- };- context.DrawGeometry(sheenBrush, null, wedge);-- // 3. Specular Glass Hairline Border (1px light-catching rim)- var borderBrush = new LinearGradientBrush- {- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 1, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(isDark ? Color.FromArgb(64, 255, 255, 255) : Color.FromArgb(135, 255, 255, 255), 0),- new GradientStop(isDark ? Color.FromArgb(32, 255, 255, 255) : Color.FromArgb(42, 0, 0, 0), 0.5),- new GradientStop(isDark ? Color.FromArgb(18, 255, 255, 255) : Color.FromArgb(24, 0, 0, 0), 1),- }- };- context.DrawGeometry(null, new Pen(borderBrush, 1), wedge);-- // 4. Vibrant Neon Glass Hover / Active Glow- var emphasis = isDropTarget ? 1.0 : hover;- if (emphasis > 0.01 && isEnabled)- {- var clampedEmp = Math.Clamp(emphasis, 0, 1);- if (AccentBrush is ISolidColorBrush accentSolid)- {- var ac = accentSolid.Color;- var hoverFill = new RadialGradientBrush- {- Center = new RelativePoint(0.5, 0.45, RelativeUnit.Relative),- GradientOrigin = new RelativePoint(0.5, 0.45, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(Color.FromArgb((byte)(225 * clampedEmp), ac.R, ac.G, ac.B), 0),- new GradientStop(Color.FromArgb((byte)(185 * clampedEmp), (byte)Math.Max(0, ac.R - 15), (byte)Math.Max(0, ac.G - 15), (byte)Math.Max(0, ac.B - 15)), 1),- }- };- context.DrawGeometry(hoverFill, null, wedge);-- // Specular inner sheen for the hot state- var hotSheen = new LinearGradientBrush- {- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 0.6, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(Color.FromArgb((byte)(80 * clampedEmp), 255, 255, 255), 0),- new GradientStop(Color.FromArgb(0, 255, 255, 255), 1),- }- };- context.DrawGeometry(hotSheen, null, wedge);-- // Glowing rim on hover- var glowPen = new Pen(new SolidColorBrush(Color.FromArgb((byte)(235 * clampedEmp), (byte)Math.Min(255, ac.R + 32), (byte)Math.Min(255, ac.G + 32), (byte)Math.Min(255, ac.B + 32))), 1.2);- context.DrawGeometry(null, glowPen, wedge);- }- else- {- context.DrawGeometry(WithOpacity(AccentBrush, 0.82 * clampedEmp), null, wedge);- }- }- }-- private void DrawCenterDisc(DrawingContext context, Point center, double radius, bool isDark)- {- // 1. Frosted glass disc fill with top-to-bottom illumination gradient- if (CenterBrush is ISolidColorBrush solid)- {- var baseC = solid.Color;- var centerFill = new LinearGradientBrush- {- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 1, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(isDark- ? Color.FromArgb(baseC.A, (byte)Math.Min(255, baseC.R + 20), (byte)Math.Min(255, baseC.G + 20), (byte)Math.Min(255, baseC.B + 24))- : Color.FromArgb(baseC.A, 255, 255, 255), 0),- new GradientStop(isDark- ? Color.FromArgb(baseC.A, (byte)Math.Max(0, baseC.R - 8), (byte)Math.Max(0, baseC.G - 8), (byte)Math.Max(0, baseC.B - 6))- : Color.FromArgb(baseC.A, (byte)Math.Max(0, baseC.R - 8), (byte)Math.Max(0, baseC.G - 6), (byte)Math.Max(0, baseC.B - 4)), 1),- }- };- context.DrawEllipse(centerFill, null, center, radius, radius);- }- else- {- context.DrawEllipse(CenterBrush, null, center, radius, radius);- }-- // 3. Inner glass lens specular reflection dome- var lensGleam = new RadialGradientBrush- {- Center = new RelativePoint(0.5, 0.35, RelativeUnit.Relative),- GradientOrigin = new RelativePoint(0.5, 0.35, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(Color.FromArgb((byte)(isDark ? 28 : 55), 255, 255, 255), 0),- new GradientStop(Color.FromArgb(0, 255, 255, 255), 1),- }- };- context.DrawEllipse(lensGleam, null, center, radius, radius);-- // 4. Specular glass hairline rim- var centerBorder = new LinearGradientBrush+ // A radial gradient ring fakes a soft drop shadow without blur effects (cheap on any GPU).+ var shadowRadius = r2 + 14;+ var brush = new RadialGradientBrush{- StartPoint = new RelativePoint(0.5, 0, RelativeUnit.Relative),- EndPoint = new RelativePoint(0.5, 1, RelativeUnit.Relative),GradientStops ={- new GradientStop(isDark ? Color.FromArgb(70, 255, 255, 255) : Color.FromArgb(130, 255, 255, 255), 0),- new GradientStop(isDark ? Color.FromArgb(30, 255, 255, 255) : Color.FromArgb(40, 0, 0, 0), 0.5),- new GradientStop(isDark ? Color.FromArgb(16, 255, 255, 255) : Color.FromArgb(20, 0, 0, 0), 1),- }+ new GradientStop(Color.FromArgb(0, 0, 0, 0), 0),+ new GradientStop(Color.FromArgb(0, 0, 0, 0), (r2 - 18) / shadowRadius),+ new GradientStop(Color.FromArgb(46, 0, 0, 0), (r2 - 2) / shadowRadius),+ new GradientStop(Color.FromArgb(0, 0, 0, 0), 1),+ },};- context.DrawEllipse(null, new Pen(centerBorder, 1), center, radius, radius);-- // 5. Inset subtle bright bevel- context.DrawEllipse(null, new Pen(new SolidColorBrush(Colors.White, isDark ? 0.05 : 0.35), 0.5), center, radius - 1, radius - 1);+ var opening = _open.Length == 0 ? 1 : Math.Clamp(_open.Average(), 0, 1);+ using (context.PushOpacity(opening))+ context.DrawEllipse(brush, null, new Point(center.X, center.Y + 4), shadowRadius, shadowRadius);}private void DrawCenter(DrawingContext context, Point center, double r1, Typeface bold, Typeface regular)@@ -1076,23 +889,9 @@ public sealed partial class DonutMenu : Controlvar pulse = 1 + _centerPulse.Value * 0.06;var radius = (r1 - 6) * pulse;var cancelHot = _externalCenterHot;- var isDark = CenterBrush is ISolidColorBrush sc ? ThemeService.Luminance(sc.Color) < 0.5 : true;-- DrawCenterDisc(context, center, radius, isDark);-+ context.DrawEllipse(CenterBrush, BorderPen(), center, radius, radius);if (cancelHot)- {- var dangerGlow = new RadialGradientBrush- {- Center = new RelativePoint(0.5, 0.5, RelativeUnit.Relative),- GradientStops =- {- new GradientStop(Color.FromArgb(60, 220, 60, 60), 0),- new GradientStop(Color.FromArgb(100, 200, 40, 40), 1),- }- };- context.DrawEllipse(dangerGlow, new Pen(DangerBrush, 1.2), center, radius, radius);- }+ context.DrawEllipse(WithOpacity(DangerBrush, 0.18), null, center, radius, radius);var maxWidth = radius * 1.6;var title = MakeText(CenterTitle ?? "", bold, 14, Foreground, maxWidth, maxLines: 2);@@ -1115,24 +914,12 @@ public sealed partial class DonutMenu : Controllabel.Height + 14 < maxHeight;var caption = showCaption ? MakeText(item.Caption!, regular, 10.5, hot ? OnAccentBrush : SecondaryForeground, width) : null;- var total = label.Height + (caption?.Height ?? 0) + (item.IsNavigation && showCaption ? 4 : 0);+ var total = label.Height + (caption?.Height ?? 0);var anchor = DonutGeometry.PointAt(center, radius, angle);var y = anchor.Y - total / 2;DrawCentered(context, label, anchor.X, y);if (caption is not null)- {- var captionY = y + label.Height + (item.IsNavigation ? 3 : 0);- if (item.IsNavigation && !hot)- {- // Sleek macOS glass pill around page numbers e.g. "1/2"- var isDark = SliceBrush is ISolidColorBrush sc ? ThemeService.Luminance(sc.Color) < 0.5 : true;- var pillWidth = Math.Max(caption.Width + 12, 34);- var pillRect = new Rect(anchor.X - pillWidth / 2, captionY - 1, pillWidth, caption.Height + 2);- var pillFill = new SolidColorBrush(isDark ? Color.FromArgb(45, 255, 255, 255) : Color.FromArgb(25, 0, 0, 0));- context.DrawRectangle(pillFill, null, new RoundedRect(pillRect, 7));- }- DrawCentered(context, caption, anchor.X, captionY);- }+ DrawCentered(context, caption, anchor.X, y + label.Height);}private Point EditButtonCenter(int index)diff --git a/src/Filee.App/Services/ConversionService.cs b/src/Filee.App/Services/ConversionService.csindex 714c0dd4..894637a6 100644--- a/src/Filee.App/Services/ConversionService.cs+++ b/src/Filee.App/Services/ConversionService.cs@@ -61,7 +61,7 @@ public sealed class ConversionService/// <returns>The job's view model, or null when there was nothing to convert.</returns>public JobViewModel? Start(IReadOnlyList<string> files, Preset preset, bool showInToast = true){- if (files.Count == 0 || preset.IsGroup)+ if (files.Count == 0 || preset.IsGroup || preset.IsTool)return null;// A preset on "Default" saves where Settings > General says (read now, so a changed default applies at once).preset = _store.Settings.WithDefaultOutput(preset);diff --git a/src/Filee.App/Services/CropService.cs b/src/Filee.App/Services/CropService.csindex e99abc88..964129d7 100644--- a/src/Filee.App/Services/CropService.cs+++ b/src/Filee.App/Services/CropService.cs@@ -1,9 +1,13 @@-// Service that loads images and executes cropping via ImageMagick.+// Loads image previews and performs crops using ImageMagick and OutputPathResolver.using System.IO;using Avalonia.Media.Imaging;+using Filee.Core.History;+using Filee.Core.Localization;using Filee.Core.Presets;+using Filee.Core.Settings;using ImageMagick;+using Microsoft.Extensions.Logging;namespace Filee.App.Services;@@ -22,9 +26,8 @@ public static class CropServicevar origWidth = (int)image.Width;var origHeight = (int)image.Height;- // Generate an in-memory PNG for the Avalonia viewport- // If the source image is huge (e.g. 40MP camera RAW/photo), scale preview down for UI fluidity- var maxDisplayDim = 2560;+ // Generate an in-memory PNG for the viewport, downscaling huge images for UI fluidity.+ const int maxDisplayDim = 2560;if (image.Width > maxDisplayDim || image.Height > maxDisplayDim){image.Resize(new MagickGeometry((uint)maxDisplayDim, (uint)maxDisplayDim) { Greater = true });@@ -40,28 +43,33 @@ public static class CropService}/// <summary>- /// Crops the image at <paramref name="inputPath"/> with the given pixel coordinates and saves the result.+ /// Crops the image at <paramref name="inputPath"/> with the given pixel coordinates and saves the result using+ /// the preset's output rule and the application's default output settings./// </summary>- public static async Task<string> CropFileAsync(string inputPath, int x, int y, int width, int height, Preset? preset = null)+ public static async Task<string?> CropFileAsync(+ string inputPath,+ int x, int y, int width, int height,+ Preset preset,+ UserDataStore store,+ ILocalizer loc,+ ILogger? log = null){return await Task.Run(() =>{- var dir = Path.GetDirectoryName(inputPath) ?? "";- var nameWithoutExt = Path.GetFileNameWithoutExtension(inputPath);- var ext = Path.GetExtension(inputPath);-- var pattern = preset?.Output.FileNamePattern ?? "{name}_cropped";- var outputName = pattern.Replace("{name}", nameWithoutExt) + ext;- var outputPath = Path.Combine(dir, outputName);-- // Avoid collisions- var counter = 1;- while (File.Exists(outputPath))+ var ext = Path.GetExtension(inputPath).TrimStart('.');+ var appliedPreset = store.Settings.WithDefaultOutput(preset);+ var tokens = new OutputPathResolver.Tokens(inputPath, loc.DisplayName(appliedPreset), 1, DateTime.Now);+ var outputPath = OutputPathResolver.Resolve(appliedPreset.Output, tokens, ext, File.Exists);+ if (outputPath is null){- outputPath = Path.Combine(dir, $"{pattern.Replace("{name}", nameWithoutExt)}_{counter}{ext}");- counter++;+ log?.LogInformation("Skipping crop of {Input} as conflict policy resolved to null", inputPath);+ return null;}+ var outDir = Path.GetDirectoryName(outputPath);+ if (!string.IsNullOrEmpty(outDir))+ Directory.CreateDirectory(outDir);+using var image = new MagickImage(inputPath);image.AutoOrient();@@ -73,11 +81,38 @@ public static class CropServiceimage.Crop(new MagickGeometry(clampedX, clampedY, clampedW, clampedH));image.ResetPage();- // Quality- if (preset?.Image.Quality is > 0 and <= 100)- image.Quality = (uint)preset.Image.Quality;+ if (appliedPreset.Image.Quality is > 0 and <= 100)+ image.Quality = (uint)appliedPreset.Image.Quality;image.Write(outputPath);++ if (appliedPreset.Output.KeepDates || store.Settings.KeepFileDates)+ {+ try+ {+ File.SetCreationTimeUtc(outputPath, File.GetCreationTimeUtc(inputPath));+ File.SetLastWriteTimeUtc(outputPath, File.GetLastWriteTimeUtc(inputPath));+ }+ catch+ {+ // Ignore date preservation failures on read-only/virtual filesystems+ }+ }++ if (store.Settings.KeepHistory)+ {+ store.AddHistory(new HistoryEntry+ {+ JobId = Guid.NewGuid().ToString("N")[..12],+ FinishedAt = DateTime.Now,+ PresetId = preset.Id,+ PresetName = loc.DisplayName(preset),+ State = Filee.Core.Conversion.JobState.Completed,+ Sources = [inputPath],+ Outputs = [outputPath],+ });+ }+return outputPath;});}diff --git a/src/Filee.App/Services/PresetAvailability.cs b/src/Filee.App/Services/PresetAvailability.csindex 5076d342..b82d63c8 100644--- a/src/Filee.App/Services/PresetAvailability.cs+++ b/src/Filee.App/Services/PresetAvailability.cs@@ -9,17 +9,21 @@ namespace Filee.App.Services;public sealed class PresetAvailability(ConverterCatalog catalog, ILocalizer loc, EngineDownloadService downloads){+ private static readonly HashSet<string> WritableSingleFrameRasterFormats =+ [+ "jpg", "png", "webp", "bmp", "avif", "heic", "jxl", "jp2", "tga", "qoi", "dds", "pcx",+ ];/// <summary>/// Returns <c>null</c> when at least one of <paramref name="formats"/> can be converted with the preset,/// otherwise a localized reason — naming the optional engine to download when that would help./// </summary>public string? Check(Preset preset, IReadOnlyList<FileFormat> formats){- if (preset.Kind == PresetKind.Tool)+ if (preset.IsTool){- if (preset.Id == "tool-crop")- return formats.Any(f => f.Category == FormatCategory.Image || f.Id == "pdf") ? null : loc["error.unsupported_source"];- return null;+ if (formats.Count > 0 && formats.All(f => WritableSingleFrameRasterFormats.Contains(f.Id)))+ return null;+ return loc["error.unsupported_source"];}// "Compress into one archive" packs the files as they are, so any file works, even of an unknown type.diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.csindex e8128444..1bf5fb90 100644--- a/src/Filee.App/Services/RadialController.cs+++ b/src/Filee.App/Services/RadialController.cs@@ -19,7 +19,6 @@ using Filee.App.ViewModels;using Filee.App.Views;using Filee.Core.Conversion;using Filee.Core.Platform;-using Filee.Core.Presets;using Filee.Core.Profiles;using Filee.Core.Settings;using Microsoft.Extensions.Logging;@@ -54,7 +53,6 @@ public sealed class RadialController(private static readonly LogThrottle Throttle = new(TimeSpan.FromMinutes(1));private bool _converted; // a conversion started from the files on the donut nowprivate readonly HashSet<string> _formatRequestsOffered = new(StringComparer.OrdinalIgnoreCase);- private TriggerGesture? _activeGesture;/// <summary>/// How long a drag that never brought files may keep the invisible window up, in case the button release is@@ -71,9 +69,8 @@ public sealed class RadialController(/// invisible until files are dragged into it (FilesEntered); a gesture without files (text, a rubber-band/// selection, nothing at all) never shows anything and closes when the button is released./// </summary>- public void ShowForDrag(int x, int y, TriggerGesture? gesture = null)+ public void ShowForDrag(int x, int y){- _activeGesture = gesture;ReleaseProgressToToast();var window = EnsureWindow();// A ring from an earlier conversion (finished or handed to the toast) must not keep this gesture's window up.@@ -194,19 +191,12 @@ public sealed class RadialController({if (viewModel.IsClickMode || SameFiles(files, viewModel.Files))return;- viewModel.Load(files, clickMode: false, profileId: _activeGesture?.TargetProfileId);+ viewModel.Load(files, clickMode: false);donut.PlayOpenAnimation();};window.Dropped += (hit, files) =>{_dropped = true;- if (hit.Kind is DonutHitKind.Segment && viewModel.IsNavigationAt(hit.Index))- {- viewModel.NavigateAt(hit.Index);- donut.PlayOpenAnimation();- _dropped = false;- return;- }if (hit.Kind is DonutHitKind.Segment or DonutHitKind.SubSegment)Convert(hit.Index, hit.Sub, files.Count > 0 ? files : viewModel.Files);else@@ -225,21 +215,7 @@ public sealed class RadialController(};donut.ActiveIndexChanged += (_, index) => viewModel.ShowHint(index, donut.ActiveSubIndex, donut.IsCenterHot);- donut.SegmentInvoked += (_, index) =>- {- if (viewModel.IsNavigationAt(index))- {- viewModel.NavigateAt(index);- donut.PlayOpenAnimation();- return;- }- Convert(index, -1, viewModel.Files);- };- donut.NavigationRequested += (_, delta) =>- {- viewModel.CyclePage(delta);- donut.PlayOpenAnimation();- };+ donut.SegmentInvoked += (_, index) => Convert(index, -1, viewModel.Files);donut.SubSegmentInvoked += (_, hit) => Convert(hit.Group, hit.Sub, viewModel.Files);donut.CenterInvoked += (_, _) => Close();donut.SegmentContextRequested += async (_, index) => await EditPresetAsync(index);@@ -264,10 +240,11 @@ public sealed class RadialController(return;}- if (preset.Kind == PresetKind.Tool && preset.Id == "tool-crop")+ if (preset.IsTool){+ var near = _window?.Position;Close(animate: false);- windows.ShowCropOverlay(files, preset);+ windows.ShowCropOverlay(files, preset, near);return;}diff --git a/src/Filee.App/Services/ThemeService.cs b/src/Filee.App/Services/ThemeService.csindex 93f6a01e..e87ca333 100644--- a/src/Filee.App/Services/ThemeService.cs+++ b/src/Filee.App/Services/ThemeService.cs@@ -20,7 +20,7 @@ public sealed class ThemeService(IPlatformServices platform)private const string Latin = "fonts:Filee#Noto Sans";private const string Korean = "fonts:Filee#Noto Sans KR";private const string Chinese = "fonts:Filee#Noto Sans SC";- private const string SystemFallbacks = "-apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"SF Pro Display\", Helvetica Neue, Segoe UI, Malgun Gothic, Microsoft YaHei, PingFang SC, Apple SD Gothic Neo, sans-serif";+ private const string SystemFallbacks = "Segoe UI, Malgun Gothic, Microsoft YaHei, PingFang SC, Apple SD Gothic Neo, sans-serif";public void Apply(ThemeSettings theme, string language){diff --git a/src/Filee.App/Services/WindowService.cs b/src/Filee.App/Services/WindowService.csindex ab0b115e..e907cfc8 100644--- a/src/Filee.App/Services/WindowService.cs+++ b/src/Filee.App/Services/WindowService.cs@@ -11,6 +11,7 @@ using Filee.Core.Localization;using Filee.Core.Presets;using Filee.Core.Settings;using Microsoft.Extensions.DependencyInjection;+using Microsoft.Extensions.Logging;namespace Filee.App.Services;@@ -31,14 +32,17 @@ public sealed class WindowService(ILocalizer loc, IServiceProvider services, Mempublic MainWindow? Main => _main;- /// <summary>Opens the zero-window interactive Crop overlay HUD.</summary>- public void ShowCropOverlay(IReadOnlyList<string> files, Preset preset)+ /// <summary>Opens the interactive crop overlay for the files.</summary>+ public void ShowCropOverlay(IReadOnlyList<string> files, Preset preset, PixelPoint? near = null){if (files.Count == 0)return;_cropOverlay?.Close();- var vm = new CropOverlayViewModel(files, preset, loc);+ var store = services.GetRequiredService<UserDataStore>();+ var log = services.GetService<ILogger<CropOverlayViewModel>>();+ var vm = new CropOverlayViewModel(files, preset, loc, store, log);var win = new CropOverlayWindow { DataContext = vm };+ win.PositionOnScreen(near);win.Closed += (_, _) =>{if (_cropOverlay == win)@@ -210,6 +214,8 @@ public sealed class WindowService(ILocalizer loc, IServiceProvider services, Mem// A group converts nothing: it gets its own editor (name and the presets it fans out).if (preset.IsGroup)return await EditGroupAsync(preset, owner);+ if (preset.IsTool)+ return false;var dialog = new PresetEditorWindow{DataContext = new PresetEditorViewModel(preset, loc),diff --git a/src/Filee.App/Styles/Soft.axaml b/src/Filee.App/Styles/Soft.axamlindex 6a6edeac..e1f8e23d 100644--- a/src/Filee.App/Styles/Soft.axaml+++ b/src/Filee.App/Styles/Soft.axaml@@ -45,7 +45,7 @@<CornerRadius x:Key="SoftRadius">16</CornerRadius><CornerRadius x:Key="SoftRadiusSmall">9</CornerRadius><CornerRadius x:Key="SoftRadiusLarge">22</CornerRadius>- <FontFamily x:Key="AppFontFamily">-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Segoe UI, Malgun Gothic, Microsoft YaHei, sans-serif</FontFamily>+ <FontFamily x:Key="AppFontFamily">Segoe UI, Malgun Gothic, Microsoft YaHei, sans-serif</FontFamily><!-- Springy easing used by press/hover transitions ("말랑말랑"). --><BackEaseOut x:Key="SoftEase" />diff --git a/src/Filee.App/ViewModels/CropOverlayViewModel.cs b/src/Filee.App/ViewModels/CropOverlayViewModel.csindex 9046e3ba..553e830f 100644--- a/src/Filee.App/ViewModels/CropOverlayViewModel.cs+++ b/src/Filee.App/ViewModels/CropOverlayViewModel.cs@@ -1,4 +1,4 @@-// ViewModel driving the zero-window Crop overlay dialog.+// State of the interactive crop overlay.using System.IO;using Avalonia;@@ -8,14 +8,18 @@ using CommunityToolkit.Mvvm.Input;using Filee.App.Services;using Filee.Core.Localization;using Filee.Core.Presets;+using Filee.Core.Settings;+using Microsoft.Extensions.Logging;namespace Filee.App.ViewModels;-public sealed partial class CropOverlayViewModel : ObservableObject+public sealed partial class CropOverlayViewModel : ObservableObject, IDisposable{private readonly IReadOnlyList<string> _files;private readonly Preset _preset;private readonly ILocalizer _loc;+ private readonly UserDataStore _store;+ private readonly ILogger? _log;[ObservableProperty] private int _currentIndex;[ObservableProperty] private string _currentFileName = "";@@ -49,13 +53,15 @@ public sealed partial class CropOverlayViewModel : ObservableObjectpublic event Action? ResetRequested;public event Action<double>? AspectRatioChanged;- public Rect CurrentCropRect { get; set; } = new(0.1, 0.1, 0.8, 0.8);+ public Rect CurrentCropRect { get; set; } = new(0.05, 0.05, 0.9, 0.9);- public CropOverlayViewModel(IReadOnlyList<string> files, Preset preset, ILocalizer loc)+ public CropOverlayViewModel(IReadOnlyList<string> files, Preset preset, ILocalizer loc, UserDataStore store, ILogger? log = null){_files = files;_preset = preset;_loc = loc;+ _store = store;+ _log = log;_hasMultipleFiles = files.Count > 1;_ = LoadFileAsync(0);@@ -78,18 +84,20 @@ public sealed partial class CropOverlayViewModel : ObservableObjecttry{var (bitmap, origW, origH) = await CropService.LoadPreviewAsync(path);+ PreviewImage?.Dispose();PreviewImage = bitmap;OriginalWidth = origW;OriginalHeight = origH;SelectedAspect = "free";AspectRatio = 0;+ AspectRatioChanged?.Invoke(0);CurrentCropRect = new Rect(0.05, 0.05, 0.9, 0.9);UpdateDimensions(CurrentCropRect);ResetRequested?.Invoke();}- catch (Exception)+ catch (Exception ex){- // If failed to load this file, advance or close+ _log?.LogError(ex, "Failed to load preview for {File}", path);if (index < _files.Count - 1)await LoadFileAsync(index + 1);else@@ -124,11 +132,11 @@ public sealed partial class CropOverlayViewModel : ObservableObjecttry{- await CropService.CropFileAsync(path, x, y, w, h, _preset);+ await CropService.CropFileAsync(path, x, y, w, h, _preset, _store, _loc, _log);}- catch (Exception)+ catch (Exception ex){- // Log/ignore and proceed+ _log?.LogError(ex, "Failed to crop {File}", path);}finally{@@ -145,6 +153,18 @@ public sealed partial class CropOverlayViewModel : ObservableObject}}+ [RelayCommand]+ public async Task SkipAsync()+ {+ if (IsBusy)+ return;++ if (CurrentIndex < _files.Count - 1)+ await LoadFileAsync(CurrentIndex + 1);+ else+ CloseRequested?.Invoke();+ }+[RelayCommand]public void Reset(){@@ -178,4 +198,10 @@ public sealed partial class CropOverlayViewModel : ObservableObjectAspectRatio = ratio;AspectRatioChanged?.Invoke(ratio);}++ public void Dispose()+ {+ PreviewImage?.Dispose();+ PreviewImage = null;+ }}diff --git a/src/Filee.App/ViewModels/GroupEditorViewModel.cs b/src/Filee.App/ViewModels/GroupEditorViewModel.csindex 6128fa0d..87ee0972 100644--- a/src/Filee.App/ViewModels/GroupEditorViewModel.cs+++ b/src/Filee.App/ViewModels/GroupEditorViewModel.cs@@ -30,7 +30,7 @@ public sealed partial class GroupEditorViewModel : ObservableObject_name = loc.DisplayName(group);foreach (var id in group.SubPresetIds){- if (store.FindPreset(id) is { IsGroup: false } preset)+ if (store.FindPreset(id) is { IsGroup: false, IsTool: false } preset)Members.Add(MemberOf(preset));}Members.CollectionChanged += (_, _) => Refresh();@@ -137,7 +137,7 @@ public sealed partial class GroupEditorViewModel : ObservableObject{var taken = Members.Select(m => m.PresetId).ToHashSet();Available.Clear();- foreach (var preset in _store.Presets.Where(p => !p.IsGroup && !taken.Contains(p.Id)))+ foreach (var preset in _store.Presets.Where(p => !p.IsGroup && !p.IsTool && !taken.Contains(p.Id)))Available.Add(new Choice<string>(preset.Id, _loc.DisplayName(preset), CaptionOf(preset)));OnPropertyChanged(nameof(IsFull));OnPropertyChanged(nameof(IsEmpty));diff --git a/src/Filee.App/ViewModels/Pages/PresetsPageViewModel.cs b/src/Filee.App/ViewModels/Pages/PresetsPageViewModel.csindex 0ebd0c4e..9aa4e261 100644--- a/src/Filee.App/ViewModels/Pages/PresetsPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/PresetsPageViewModel.cs@@ -43,8 +43,8 @@ public sealed partial class PresetsPageViewModel : ObservableObject, IFitsWindow_loc = loc;_windows = windows;VisiblePresets = new FilteredList<PresetListItem>(Presets, p => [p.Name, p.Target, p.Preset.TargetFormat]);- // Groups convert nothing: they live on the donut only (Settings → Toolbar).- foreach (var preset in store.Presets.Where(p => !p.IsGroup))+ // Groups and tools convert nothing: they live on the donut only (Settings → Toolbar).+ foreach (var preset in store.Presets.Where(p => !p.IsGroup && !p.IsTool))Presets.Add(new PresetListItem(preset, loc));SelectedPreset = Presets.FirstOrDefault();}diff --git a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.csindex 9e1c64d5..48220249 100644--- a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs@@ -61,7 +61,6 @@ public sealed partial class ToolbarPageViewModel : ObservableObjectOuterRadius = store.Settings.Donut.OuterRadius;HoleRatio = store.Settings.Donut.HoleRatio * 100;SliceOpacity = store.Settings.Donut.Opacity * 100;- MaxPageSlices = store.Settings.Donut.MaxPageSlices;_loading = false;SelectedProfile = Profiles.FirstOrDefault();@@ -103,7 +102,6 @@ public sealed partial class ToolbarPageViewModel : ObservableObject[ObservableProperty] private double _outerRadius;[ObservableProperty] private double _holeRatio;[ObservableProperty] private double _sliceOpacity;- [ObservableProperty] private double _maxPageSlices;private ToolbarProfile? Profile => SelectedProfile?.Profile;@@ -185,7 +183,6 @@ public sealed partial class ToolbarPageViewModel : ObservableObjectpartial void OnOuterRadiusChanged(double value) => SaveAppearance();partial void OnHoleRatioChanged(double value) => SaveAppearance();partial void OnSliceOpacityChanged(double value) => SaveAppearance();- partial void OnMaxPageSlicesChanged(double value) => SaveAppearance();private void SaveAppearance(){@@ -194,7 +191,6 @@ public sealed partial class ToolbarPageViewModel : ObservableObject_store.Settings.Donut.OuterRadius = Math.Round(OuterRadius);_store.Settings.Donut.HoleRatio = Math.Round(HoleRatio) / 100;_store.Settings.Donut.Opacity = Math.Round(SliceOpacity) / 100;- _store.Settings.Donut.MaxPageSlices = (int)Math.Clamp(Math.Round(MaxPageSlices), 6, 12);_store.SaveSettings();}diff --git a/src/Filee.App/ViewModels/Pages/WatchFoldersPageViewModel.cs b/src/Filee.App/ViewModels/Pages/WatchFoldersPageViewModel.csindex e32635cd..29ef6949 100644--- a/src/Filee.App/ViewModels/Pages/WatchFoldersPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/WatchFoldersPageViewModel.cs@@ -29,7 +29,7 @@ public sealed partial class WatchFoldersPageViewModel : ObservableObject, IDispo_service = service;_loc = loc;_conversions = conversions;- Presets = store.Presets.Where(p => !p.IsGroup).Select(p => new Choice<string>(p.Id, loc.DisplayName(p), FormatLabels.NameOf(loc, p.TargetFormat))).ToList();+ Presets = store.Presets.Where(p => !p.IsGroup && !p.IsTool).Select(p => new Choice<string>(p.Id, loc.DisplayName(p), FormatLabels.NameOf(loc, p.TargetFormat))).ToList();OriginalsChoices =[new Choice<AfterConversion>(AfterConversion.Keep, loc["watch.originals_keep"]),diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.csindex 0fc2906d..37f25c5b 100644--- a/src/Filee.App/ViewModels/RadialViewModel.cs+++ b/src/Filee.App/ViewModels/RadialViewModel.cs@@ -40,45 +40,33 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,/// </summary>[ObservableProperty] private string _hitBackground = "Transparent";- [ObservableProperty] private int _currentPage;- [ObservableProperty] private int _totalPages = 1;-- /// <summary>Maximum number of slices shown on one page of the donut.</summary>- public int MaxPageSlices => store.Settings.Donut.MaxPageSlices is >= 4 and <= ToolbarProfile.MaxSlices- ? store.Settings.Donut.MaxPageSlices- : ToolbarProfile.MaxSlices;-/// <summary>Files the donut will convert (empty while waiting for a drag to enter).</summary>public IReadOnlyList<string> Files { get; private set; } = [];- /// <summary>Presets on the current page in slice order.</summary>+ /// <summary>Presets in slice order.</summary>public IReadOnlyList<Preset> Presets { get; private set; } = [];- /// <summary>For each slice on the current page, the presets its group fans out.</summary>+ /// <summary>For each slice, the presets its group fans out (empty for an ordinary preset).</summary>private IReadOnlyList<IReadOnlyList<Preset>> _subPresets = [];- private IReadOnlyList<Preset> _allPresets = [];- private IReadOnlyList<IReadOnlyList<Preset>> _allSubPresets = [];- private IReadOnlyList<DonutItem> _allItems = [];-/// <summary>/// The preset that slice <paramref name="index"/> converts with, or slice <paramref name="sub"/> of its group's ring;- /// null when there is none, or when the slice is a navigation page-flip control.+ /// null when there is none or it can't convert these files./// </summary>public Preset? PresetAt(int index, int sub){- if (index < 0 || index >= Items.Count || Items[index].IsNavigation)+ if (index < 0 || index >= Items.Count)return null;if (sub < 0)- return Items[index] is { IsEnabled: true, IsGroup: false } && index < Presets.Count ? Presets[index] : null;- return Items[index].Children is { } children && sub < children.Count && children[sub].IsEnabled && index < _subPresets.Count+ return Items[index] is { IsEnabled: true, IsGroup: false } ? Presets[index] : null;+ return Items[index].Children is { } children && sub < children.Count && children[sub].IsEnabled? _subPresets[index][sub]: null;}/// <summary>The preset slice <paramref name="index"/> shows, or slice <paramref name="sub"/> of its group's ring (to edit it).</summary>public Preset? PresetShownAt(int index, int sub) =>- index < 0 || index >= Presets.Count || (index < Items.Count && Items[index].IsNavigation) ? null+ index < 0 || index >= Presets.Count ? null: sub < 0 ? Presets[index]: sub < _subPresets[index].Count ? _subPresets[index][sub] : null;@@ -87,48 +75,6 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,public bool HasFiles => Files.Count > 0;- /// <summary>True if the slice at <paramref name="index"/> is a page navigation control.</summary>- public bool IsNavigationAt(int index) =>- index >= 0 && index < Items.Count && Items[index].IsNavigation;-- /// <summary>Navigates page if the slice at <paramref name="index"/> is a navigation item.</summary>- public bool NavigateAt(int index)- {- if (!IsNavigationAt(index))- return false;- if (Items[index].IsNextPage)- NextPage();- else if (Items[index].IsPrevPage)- PrevPage();- return true;- }-- public void NextPage()- {- if (TotalPages <= 1)- return;- CurrentPage = (CurrentPage + 1) % TotalPages;- ApplyPage();- }-- public void PrevPage()- {- if (TotalPages <= 1)- return;- CurrentPage = (CurrentPage - 1 + TotalPages) % TotalPages;- ApplyPage();- }-- public void CyclePage(int delta)- {- if (TotalPages <= 1)- return;- if (delta > 0)- NextPage();- else if (delta < 0)- PrevPage();- }-/// <summary>Drag mode before any file entered: an empty ring saying "Bring files here".</summary>public void ResetForDrag(){@@ -136,11 +82,6 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,Files = [];Presets = [];_subPresets = [];- _allPresets = [];- _allSubPresets = [];- _allItems = [];- CurrentPage = 0;- TotalPages = 1;ApplyAppearance();ReserveSubRing = store.Profiles.Any(profile => profile.PresetIds.Any(id => store.FindPreset(id)?.IsGroup == true));Items = [];@@ -151,7 +92,7 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,}/// <summary>Fills the donut for the given files.</summary>- public void Load(IReadOnlyList<string> files, bool clickMode, string? profileId = null)+ public void Load(IReadOnlyList<string> files, bool clickMode){IsClickMode = clickMode;Files = files;@@ -159,15 +100,14 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,HitBackground = "Transparent";ApplyAppearance();- var profile = (!string.IsNullOrEmpty(profileId) ? store.Profiles.FirstOrDefault(p => p.Id == profileId) : null)- ?? ProfileSelector.Select(store.Profiles, files);+ var profile = ProfileSelector.Select(store.Profiles, files);var formats = ProfileSelector.DetectFormats(files);- _allPresets = (profile?.PresetIds ?? [])+ Presets = (profile?.PresetIds ?? []).Select(store.FindPreset).OfType<Preset>().ToList();- _allSubPresets = _allPresets+ _subPresets = Presets.Select(p => (IReadOnlyList<Preset>)(p.IsGroup ? p.SubPresetIds : []).Select(store.FindPreset).OfType<Preset>().Where(c => !c.IsGroup).Take(Preset.MaxSubPresets).ToList()).ToList();@@ -178,6 +118,7 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,return new DonutItem{Id = p.Id,+ // On a group's ring the group's name gives the context: "Rotate" → Left / Right / 180°.Label = caption ? loc.DisplayName(p) : loc.RingName(p),Caption = !caption ? null: p.TargetFormat == BuiltInData.SameAsSource@@ -188,167 +129,49 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,};}- _allItems = _allPresets.Select((p, i) =>+ Items = Presets.Select((p, i) =>{if (!p.IsGroup)return ItemOf(p);- var children = _allSubPresets[i].Select(c => ItemOf(c, caption: false)).ToList();+ // A group: its own name and size, and its presets on the ring it fans out (labels only, they're small).+ var children = _subPresets[i].Select(c => ItemOf(c, caption: false)).ToList();return new DonutItem{Id = p.Id,Label = loc.DisplayName(p),Caption = loc.Format("donut.group_caption", children.Count),IsEnabled = children.Any(c => c.IsEnabled),+ // Its presets were all deleted since it was made: say so rather than show a dead slice.DisabledReason = children.Count == 0 ? loc["donut.group_empty"]: children.Select(c => c.DisabledReason).FirstOrDefault(r => r is not null),Children = children,};}).ToList();- CurrentPage = 0;- CalculatePages();- ApplyPage();-CenterTitle = formats.Count == 1? loc.Format("donut.files_same", files.Count, formats[0].DisplayName): loc.Format("donut.files_mixed", files.Count);- UpdateCenterSubtitle();- }-- private void CalculatePages()- {- if (_allItems.Count <= MaxPageSlices)- {- TotalPages = 1;- return;- }-- // Page 0: (MaxPageSlices - 1) items + 1 Next item- var remaining = _allItems.Count - (MaxPageSlices - 1);- var pages = 1;- while (remaining > 0)- {- pages++;- if (remaining <= MaxPageSlices - 1)- break;- remaining -= (MaxPageSlices - 2); // Middle pages have both Prev and Next- }- TotalPages = Math.Max(1, pages);- }-- private void ApplyPage()- {- if (TotalPages <= 1 || _allItems.Count <= MaxPageSlices)- {- Items = _allItems;- Presets = _allPresets;- _subPresets = _allSubPresets;- UpdateCenterSubtitle();- return;- }-- var pageItems = new List<DonutItem>();- var pagePresets = new List<Preset>();- var pageSubPresets = new List<IReadOnlyList<Preset>>();-- int startIndex;- int takeCount;- var hasPrev = CurrentPage > 0;- var hasNext = CurrentPage < TotalPages - 1;-- if (CurrentPage == 0)- {- startIndex = 0;- takeCount = MaxPageSlices - 1;- }- else- {- startIndex = (MaxPageSlices - 1) + (CurrentPage - 1) * (MaxPageSlices - 2);- takeCount = hasNext ? MaxPageSlices - 2 : _allItems.Count - startIndex;- }-- if (hasPrev)- {- pageItems.Add(new DonutItem- {- Id = "__nav_prev",- Label = loc["donut.back"],- Caption = $"{CurrentPage + 1}/{TotalPages}",- IsNavigation = true,- IsPrevPage = true,- IsEnabled = true,- });- pagePresets.Add(new Preset { Id = "__nav_prev", Name = loc["donut.back"] });- pageSubPresets.Add([]);- }-- for (var i = 0; i < takeCount && startIndex + i < _allItems.Count; i++)- {- var idx = startIndex + i;- pageItems.Add(_allItems[idx]);- pagePresets.Add(_allPresets[idx]);- pageSubPresets.Add(_allSubPresets[idx]);- }-- if (hasNext)- {- pageItems.Add(new DonutItem- {- Id = "__nav_next",- Label = loc["donut.more"],- Caption = $"{CurrentPage + 1}/{TotalPages}",- IsNavigation = true,- IsNextPage = true,- IsEnabled = true,- });- pagePresets.Add(new Preset { Id = "__nav_next", Name = loc["donut.more"] });- pageSubPresets.Add([]);- }-- Items = pageItems;- Presets = pagePresets;- _subPresets = pageSubPresets;- UpdateCenterSubtitle();- }-- private void UpdateCenterSubtitle()- {- if (TotalPages > 1)- CenterSubtitle = loc.Format("donut.nav_hint", CurrentPage + 1, TotalPages);- else- CenterSubtitle = IsClickMode ? loc["donut.close_hint"] : null;+ CenterSubtitle = clickMode ? loc["donut.close_hint"] : null;}/// <summary>Updates the centre hint for the emphasised slice (and slice <paramref name="sub"/> of its group's ring).</summary>public void ShowHint(int index, int sub, bool centerHot){if (centerHot)- {CenterSubtitle = loc["donut.cancel"];- }- else if (index >= 0 && index < Items.Count && Items[index].IsNavigation)- {- CenterSubtitle = loc.Format("donut.nav_hint", CurrentPage + 1, TotalPages);- }else if (index >= 0 && index < Items.Count && Items[index].Children is { Count: > 0 } children &&(sub >= 0 || Items[index].IsEnabled))- {CenterSubtitle = sub >= 0 && sub < children.Count? children[sub].IsEnabled? loc.Format(IsClickMode ? "donut.click_to" : "donut.drop_to", $"{Items[index].Label} · {children[sub].Label}"): children[sub].DisabledReason: loc["donut.pick_in_group"];- }else if (index >= 0 && index < Items.Count)- {CenterSubtitle = Items[index].IsEnabled? loc.Format(IsClickMode ? "donut.click_to" : "donut.drop_to", Items[index].Label): Items[index].DisabledReason;- }else- {- UpdateCenterSubtitle();- }+ CenterSubtitle = IsClickMode ? loc["donut.close_hint"] : null;}/// <summary>Click mode, before the window is placed: room for a group's ring only if this donut has a group.</summary>diff --git a/src/Filee.App/Views/CropOverlayWindow.axaml b/src/Filee.App/Views/CropOverlayWindow.axamlindex d9607c41..068f2b61 100644--- a/src/Filee.App/Views/CropOverlayWindow.axaml+++ b/src/Filee.App/Views/CropOverlayWindow.axaml@@ -4,10 +4,9 @@xmlns:c="using:Filee.App.Controls"x:Class="Filee.App.Views.CropOverlayWindow"x:DataType="vm:CropOverlayViewModel"- Title="Filee — Crop"+ Title="{DynamicResource preset.crop}"Icon="avares://Filee/Assets/Icons/filee.ico"Width="960" Height="680" MinWidth="680" MinHeight="500"- WindowStartupLocation="CenterScreen"WindowDecorations="None"Background="Transparent"TransparencyLevelHint="Transparent"@@ -19,14 +18,14 @@<Setter Property="Padding" Value="10,5" /><Setter Property="CornerRadius" Value="6" /><Setter Property="FontSize" Value="12" />- <Setter Property="Background" Value="#22FFFFFF" />- <Setter Property="Foreground" Value="#EEEEEE" />+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />+ <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" /><Setter Property="BorderThickness" Value="1" />- <Setter Property="BorderBrush" Value="#22FFFFFF" />+ <Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" /><Setter Property="Cursor" Value="Hand" /></Style><Style Selector="Button.aspect:pointerover">- <Setter Property="Background" Value="#44FFFFFF" />+ <Setter Property="Opacity" Value="0.85" /></Style><Style Selector="Button.aspect.active"><Setter Property="Background" Value="{DynamicResource AccentBrush}" />@@ -40,74 +39,76 @@</Style></Window.Styles>- <!-- Dark translucent overlay card with rounded corners and drop shadow -->- <Border Margin="16" CornerRadius="14"- Background="#E61A1A1E"- BorderBrush="#33FFFFFF" BorderThickness="1"+ <!-- Overlay card with soft rounded corners and theme styling -->+ <Border Margin="16" CornerRadius="{DynamicResource SoftRadius}"+ Background="{DynamicResource SurfaceBrush}"+ BorderBrush="{DynamicResource SubtleBorderBrush}" BorderThickness="1"ClipToBounds="True"- BoxShadow="0 10 32 0 #80000000">+ BoxShadow="{DynamicResource CardShadow}"><DockPanel><!-- Top header bar -->- <Border DockPanel.Dock="Top" Height="48" Padding="16,0" BorderBrush="#22FFFFFF" BorderThickness="0,0,0,1"- Background="#26000000">+ <Border DockPanel.Dock="Top" Height="48" Padding="16,0" BorderBrush="{DynamicResource SubtleBorderBrush}" BorderThickness="0,0,0,1"+ Background="{DynamicResource SurfaceAltBrush}"><DockPanel VerticalAlignment="Center"><Button DockPanel.Dock="Right" Classes="icon" Command="{Binding CancelCommand}"ToolTip.Tip="{DynamicResource common.cancel}" Margin="4,0,0,0">- <PathIcon Width="12" Height="12" Data="{StaticResource Icon.Close}" Foreground="#AAAAAA" />+ <PathIcon Width="12" Height="12" Data="{StaticResource Icon.Close}" Foreground="{DynamicResource TextSecondaryBrush}" /></Button><StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center"><PathIcon Width="16" Height="16" Data="{StaticResource Icon.Crop}" Foreground="{DynamicResource AccentBrush}" />- <TextBlock Text="{DynamicResource preset.crop}" FontWeight="SemiBold" FontSize="14" Foreground="#FFFFFF" />- <TextBlock Text="—" Foreground="#666666" />- <TextBlock Text="{Binding CurrentFileName}" FontSize="13" Foreground="#CCCCCC" TextTrimming="CharacterEllipsis" MaxWidth="360" />+ <TextBlock Text="{DynamicResource preset.crop}" FontWeight="SemiBold" FontSize="14" Foreground="{DynamicResource TextPrimaryBrush}" />+ <TextBlock Text="—" Foreground="{DynamicResource TextSecondaryBrush}" />+ <TextBlock Text="{Binding CurrentFileName}" FontSize="13" Foreground="{DynamicResource TextSecondaryBrush}" TextTrimming="CharacterEllipsis" MaxWidth="360" />- <Border IsVisible="{Binding HasMultipleFiles}" Background="#33FFFFFF" CornerRadius="10" Padding="8,2">- <TextBlock Text="{Binding CounterText}" FontSize="11" Foreground="#EEEEEE" />+ <Border IsVisible="{Binding HasMultipleFiles}" Background="{DynamicResource AccentSoftBrush}" CornerRadius="10" Padding="8,2">+ <TextBlock Text="{Binding CounterText}" FontSize="11" Foreground="{DynamicResource TextPrimaryBrush}" /></Border></StackPanel></DockPanel></Border>- <!-- Bottom toolbar HUD -->- <Border DockPanel.Dock="Bottom" Padding="16,12" BorderBrush="#22FFFFFF" BorderThickness="0,1,0,0"- Background="#26000000">+ <!-- Bottom toolbar -->+ <Border DockPanel.Dock="Bottom" Padding="16,12" BorderBrush="{DynamicResource SubtleBorderBrush}" BorderThickness="0,1,0,0"+ Background="{DynamicResource SurfaceAltBrush}"><DockPanel><!-- Action Buttons on the Right --><StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center"><Button Content="{DynamicResource crop.reset}" Command="{Binding ResetCommand}"Classes="aspect" />+ <Button Content="{DynamicResource crop.skip}" Command="{Binding SkipCommand}"+ IsVisible="{Binding HasMultipleFiles}" Classes="aspect" /><Button Content="{DynamicResource common.cancel}" Command="{Binding CancelCommand}"IsCancel="True" Classes="aspect" /><Button Content="{DynamicResource crop.save}" Command="{Binding CropAndSaveCommand}"IsDefault="True" Classes="accent" FontWeight="SemiBold" Padding="14,6" CornerRadius="6" /></StackPanel>+ <!-- Aspect ratio selector on the Left --><StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">- <TextBlock Text="{DynamicResource crop.aspect_title}" VerticalAlignment="Center" FontSize="12" Foreground="#888888" Margin="0,0,2,0" />- <Button Classes="aspect" Classes.active="{Binding IsAspectFree}" Content="{DynamicResource crop.aspect_free}" Command="{Binding SetAspectCommand}" CommandParameter="free" ToolTip.Tip="Free-form selection" />- <Button Classes="aspect" Classes.active="{Binding IsAspectSquare}" Content="1:1" Command="{Binding SetAspectCommand}" CommandParameter="1:1" ToolTip.Tip="1:1 Square (Instagram post)" />- <Button Classes="aspect" Classes.active="{Binding IsAspect45}" Content="4:5" Command="{Binding SetAspectCommand}" CommandParameter="4:5" ToolTip.Tip="4:5 Portrait (Instagram feed)" />- <Button Classes="aspect" Classes.active="{Binding IsAspect916}" Content="9:16" Command="{Binding SetAspectCommand}" CommandParameter="9:16" ToolTip.Tip="9:16 Vertical (Stories / Reels)" />- <Button Classes="aspect" Classes.active="{Binding IsAspect169}" Content="16:9" Command="{Binding SetAspectCommand}" CommandParameter="16:9" ToolTip.Tip="16:9 Widescreen" />- <Button Classes="aspect" Classes.active="{Binding IsAspectOriginal}" Content="{DynamicResource crop.aspect_original}" Command="{Binding SetAspectCommand}" CommandParameter="original" ToolTip.Tip="Original photo aspect ratio" />+ <TextBlock Text="{DynamicResource crop.aspect_title}" VerticalAlignment="Center" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,2,0" />+ <Button Classes="aspect" Classes.active="{Binding IsAspectFree}" Content="{DynamicResource crop.aspect_free}" Command="{Binding SetAspectCommand}" CommandParameter="free" />+ <Button Classes="aspect" Classes.active="{Binding IsAspectSquare}" Content="1:1" Command="{Binding SetAspectCommand}" CommandParameter="1:1" />+ <Button Classes="aspect" Classes.active="{Binding IsAspect43}" Content="4:3" Command="{Binding SetAspectCommand}" CommandParameter="4:3" />+ <Button Classes="aspect" Classes.active="{Binding IsAspect169}" Content="16:9" Command="{Binding SetAspectCommand}" CommandParameter="16:9" />+ <Button Classes="aspect" Classes.active="{Binding IsAspectOriginal}" Content="{DynamicResource crop.aspect_original}" Command="{Binding SetAspectCommand}" CommandParameter="original" />- <Border Background="#22000000" BorderBrush="#33FFFFFF" BorderThickness="1" CornerRadius="6" Padding="8,4" Margin="6,0,0,0">- <TextBlock Text="{Binding DimensionsText}" FontSize="11" FontFamily="Consolas, monospace" Foreground="#DDDDDD" />+ <Border Background="{DynamicResource SurfaceBrush}" BorderBrush="{DynamicResource SubtleBorderBrush}" BorderThickness="1" CornerRadius="6" Padding="8,4" Margin="6,0,0,0">+ <TextBlock Text="{Binding DimensionsText}" FontSize="11" FontFamily="Consolas, monospace" Foreground="{DynamicResource TextSecondaryBrush}" /></Border></StackPanel></DockPanel></Border><!-- Center image viewport and interactive crop canvas -->- <Grid Background="#11000000">+ <Grid Background="{DynamicResource PageBrush}"><c:CropCanvas x:Name="Canvas"SourceImage="{Binding PreviewImage}"HorizontalAlignment="Stretch"VerticalAlignment="Stretch" /><!-- Loading spinner / busy indicator -->- <Border IsVisible="{Binding IsBusy}" Background="#66000000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">+ <Border IsVisible="{Binding IsBusy}" Background="#44000000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"><ProgressBar IsIndeterminate="True" Width="80" Height="4" HorizontalAlignment="Center" VerticalAlignment="Center" /></Border></Grid>diff --git a/src/Filee.App/Views/CropOverlayWindow.axaml.cs b/src/Filee.App/Views/CropOverlayWindow.axaml.csindex 6a32cee9..082d9e79 100644--- a/src/Filee.App/Views/CropOverlayWindow.axaml.cs+++ b/src/Filee.App/Views/CropOverlayWindow.axaml.cs@@ -1,3 +1,4 @@+using Avalonia;using Avalonia.Controls;using Avalonia.Input;using Filee.App.ViewModels;@@ -9,10 +10,27 @@ public partial class CropOverlayWindow : Windowpublic CropOverlayWindow(){InitializeComponent();-DataContextChanged += OnDataContextChanged;}+ public void PositionOnScreen(PixelPoint? near = null)+ {+ var screen = (near.HasValue ? Screens.ScreenFromPoint(near.Value) : null)+ ?? Screens.ScreenFromPoint(Screens.Primary?.Bounds.Center ?? default)+ ?? Screens.Primary;++ if (screen is not null)+ {+ var scaling = screen.Scaling;+ var area = screen.WorkingArea;+ var winW = (int)(Width * scaling);+ var winH = (int)(Height * scaling);+ var x = area.X + Math.Max(0, (area.Width - winW) / 2);+ var y = area.Y + Math.Max(0, (area.Height - winH) / 2);+ Position = new PixelPoint(x, y);+ }+ }+private void OnDataContextChanged(object? sender, EventArgs e){if (DataContext is CropOverlayViewModel vm)@@ -21,6 +39,7 @@ public partial class CropOverlayWindow : Windowvm.ResetRequested += () => Canvas.ResetCrop();vm.AspectRatioChanged += ratio => Canvas.SetAspectRatio(ratio);Canvas.CropRectChanged += rect => vm.UpdateDimensions(rect);+ Closed += (_, _) => vm.Dispose();}}@@ -32,12 +51,19 @@ public partial class CropOverlayWindow : WindowClose();e.Handled = true;}+ else if (e.Key == Key.R && e.KeyModifiers == KeyModifiers.None)+ {+ if (DataContext is CropOverlayViewModel vm)+ {+ vm.Reset();+ e.Handled = true;+ }+ }}protected override void OnPointerPressed(PointerPressedEventArgs e){base.OnPointerPressed(e);- // Allow dragging the window when clicking on empty header spacevar pt = e.GetPosition(this);if (pt.Y < 50 && e.GetCurrentPoint(this).Properties.IsLeftButtonPressed){diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml b/src/Filee.App/Views/Pages/ToolbarPage.axamlindex 5f9a3a0e..88c238c0 100644--- a/src/Filee.App/Views/Pages/ToolbarPage.axaml+++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml@@ -263,10 +263,6 @@<TextBlock Classes="label" VerticalAlignment="Center" Text="{DynamicResource toolbar.opacity}" /><Slider Grid.Column="1" Minimum="50" Maximum="100" Value="{Binding SliceOpacity}" /></Grid>- <Grid ColumnDefinitions="90,*">- <TextBlock Classes="label" VerticalAlignment="Center" Text="{DynamicResource toolbar.max_slices_page}" />- <Slider Grid.Column="1" Minimum="6" Maximum="12" Value="{Binding MaxPageSlices}" />- </Grid></StackPanel></Border></StackPanel>diff --git a/src/Filee.App/Views/RadialWindow.axaml.cs b/src/Filee.App/Views/RadialWindow.axaml.csindex 8c6c8687..0cfaab79 100644--- a/src/Filee.App/Views/RadialWindow.axaml.cs+++ b/src/Filee.App/Views/RadialWindow.axaml.cs@@ -71,7 +71,7 @@ public partial class RadialWindow : WindowDonut.SetExternalHit(hit, at);// Always COPY. Reporting MOVE would make Explorer delete the source files after the drop.- e.DragEffects = files && Donut.AcceptsDrop(hit) ? DragDropEffects.Copy : DragDropEffects.None;+ e.DragEffects = files && Donut.Converts(hit) ? DragDropEffects.Copy : DragDropEffects.None;e.Handled = true;}@@ -88,22 +88,11 @@ public partial class RadialWindow : WindowDragSummary?.Invoke(_dragOverEvents, hit, Donut.LitAmount(hit.Index));Donut.CollapseGroup();Donut.SetExternalHighlight(-1);- e.DragEffects = Donut.AcceptsDrop(hit) ? DragDropEffects.Copy : DragDropEffects.None;+ e.DragEffects = Donut.Converts(hit) ? DragDropEffects.Copy : DragDropEffects.None;Dropped?.Invoke(hit, LocalFiles(e));e.Handled = true;}- protected override void OnPointerWheelChanged(PointerWheelEventArgs e)- {- base.OnPointerWheelChanged(e);- if (DataContext is Filee.App.ViewModels.RadialViewModel vm && vm.TotalPages > 1)- {- vm.CyclePage(e.Delta.Y < 0 ? 1 : -1);- Donut.PlayOpenAnimation();- e.Handled = true;- }- }-protected override void OnKeyDown(KeyEventArgs e){base.OnKeyDown(e);diff --git a/src/Filee.Cli/Cli.cs b/src/Filee.Cli/Cli.csindex 23e928ce..89bbfb9f 100644--- a/src/Filee.Cli/Cli.cs+++ b/src/Filee.Cli/Cli.cs@@ -232,7 +232,7 @@ internal static class Cli?? presets.FirstOrDefault(p => string.Equals(host.Texts.DisplayName(p), wanted, StringComparison.OrdinalIgnoreCase));// Conversions first: a group of the same name (say a "Rotate" group next to your own "Rotate" preset)// must not hide one. A group is only found to say what it holds.- var found = Find(host.Store.Presets.Where(p => !p.IsGroup)) ?? Find(host.Store.Presets);+ var found = Find(host.Store.Presets.Where(p => !p.IsGroup && !p.IsTool)) ?? Find(host.Store.Presets);if (found is null){errors.WriteLine($"filee: no preset '{wanted}'. Run 'filee presets' for the list.");@@ -247,6 +247,11 @@ internal static class Cli: $"filee: '{wanted}' is a group on the donut, not a conversion, and has no presets left. Run 'filee presets' for the list.");return null;}+ if (found.IsTool)+ {+ errors.WriteLine($"filee: '{wanted}' is an interactive tool, not a conversion.");+ return null;+ }preset = found.Clone();}preset = host.Store.Settings.WithDefaultOutput(preset);@@ -337,7 +342,7 @@ internal static class Cliprivate static int ListPresets(CliHost host, TextWriter output){output.WriteLine($"{"ID",-24} {"NAME",-28} TARGET");- foreach (var preset in host.Store.Presets.Where(p => !p.IsGroup))+ foreach (var preset in host.Store.Presets.Where(p => !p.IsGroup && !p.IsTool))output.WriteLine($"{preset.Id,-24} {host.Texts.DisplayName(preset),-28} {preset.TargetFormat}");output.WriteLine();output.WriteLine("Use one with: filee convert <files> --preset <id or name>");diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.csindex 4d3e8682..f1fde541 100644--- a/src/Filee.Core/Settings/AppSettings.cs+++ b/src/Filee.Core/Settings/AppSettings.cs@@ -57,9 +57,6 @@ public sealed class DonutSettings/// <summary>Background opacity of the slices (0.5 - 1).</summary>public double Opacity { get; set; } = 0.96;- /// <summary>Maximum slices per page before paginating (6 - 12, default 12).</summary>- public int MaxPageSlices { get; set; } = 12;-public DonutSettings Clone() => (DonutSettings)MemberwiseClone();}@@ -67,7 +64,7 @@ public sealed class DonutSettingspublic sealed class AppSettings{/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>- public const int CurrentSchemaVersion = 21;+ public const int CurrentSchemaVersion = 20;public int SchemaVersion { get; set; } = CurrentSchemaVersion;diff --git a/src/Filee.Core/Settings/TriggerGesture.cs b/src/Filee.Core/Settings/TriggerGesture.csindex f8f887e2..d7a870a0 100644--- a/src/Filee.Core/Settings/TriggerGesture.cs+++ b/src/Filee.Core/Settings/TriggerGesture.cs@@ -72,9 +72,6 @@ public sealed class TriggerGesturepublic TriggerScope Scope { get; set; } = TriggerScope.FileManager;- /// <summary>Optional profile id to open when triggered (e.g. "utility" for the quick tools wheel).</summary>- public string? TargetProfileId { get; set; }-public TriggerGesture Clone() => (TriggerGesture)MemberwiseClone();/// <summary>Default gestures for the current OS.</summary>@@ -82,11 +79,9 @@ public sealed class TriggerGesture{// On macOS Ctrl+click means right-click, and Option already means "copy" in Finder.var dragModifier = OperatingSystem.IsMacOS() ? ModifierKeys.Alt : ModifierKeys.Ctrl;- var utilityModifier = dragModifier | ModifierKeys.Shift;return[new() { Kind = TriggerKind.Drag, Modifiers = dragModifier, Button = TriggerMouseButton.Left },- new() { Kind = TriggerKind.Drag, Modifiers = utilityModifier, Button = TriggerMouseButton.Left, TargetProfileId = "utility" },new() { Kind = TriggerKind.KeyChord, Modifiers = ModifierKeys.Ctrl | ModifierKeys.Alt, Button = TriggerMouseButton.None, Key = "Space" },];}diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.csindex 0cf0d7dc..bcd92528 100644--- a/src/Filee.Core/Settings/UserDataStore.cs+++ b/src/Filee.Core/Settings/UserDataStore.cs@@ -138,8 +138,8 @@ public sealed class UserDataStorepublic Preset? FindPreset(string id) => Presets.FirstOrDefault(p => p.Id == id);- /// <summary>The preset <paramref name="id"/> when it converts (a group doesn't), for every place that runs one.</summary>- public Preset? FindConversion(string id) => Presets.FirstOrDefault(p => p.Id == id && !p.IsGroup);+ /// <summary>The preset <paramref name="id"/> when it converts (a group or tool doesn't), for every place that runs one.</summary>+ public Preset? FindConversion(string id) => Presets.FirstOrDefault(p => p.Id == id && !p.IsGroup && !p.IsTool);/// <summary>Exports presets and profiles to a shareable JSON file.</summary>public void Export(string path) =>@@ -183,9 +183,9 @@ public sealed class UserDataStore// conversion to "group": still a group, now an empty one, rather than a conversion that can never run.foreach (var preset in Presets.Where(p => !p.IsGroup && p.TargetFormat == Preset.GroupTarget))preset.Kind = PresetKind.Group;- // A group fans out conversions only (no group in a group), each once, at most MaxSubPresets, and has no+ // A group fans out conversions only (no group or tool in a group), each once, at most MaxSubPresets, and has no// target format an older Filee could run it with.- var conversions = Presets.Where(p => !p.IsGroup).Select(p => p.Id).ToHashSet();+ var conversions = Presets.Where(p => !p.IsGroup && !p.IsTool).Select(p => p.Id).ToHashSet();foreach (var group in Presets.Where(p => p.IsGroup)){group.SubPresetIds = group.SubPresetIds.Where(conversions.Contains).Distinct().Take(Preset.MaxSubPresets).ToList();@@ -550,14 +550,27 @@ internal static class SettingsMigrations}}- // v21: interactive "Crop" tool, after "Remove background" as in a new library, on no donut: users add it in Settings → Toolbar.+ // v21: interactive "Crop" tool, after "Remove background" as in a new library, on no donut: users add it in+ // Settings → Toolbar. Present already but saved since by a Filee before 21: that one read the unknown+ // kind as a Group, dropped the target format and left an empty group. Kind and target format are put back,+ // the user's own changes (name, file name pattern) stay.if (from < 21){- if (presets.All(p => p.Id != "tool-crop") && BuiltInData.CreatePresets().FirstOrDefault(p => p.Id == "tool-crop") is { } crop)+ if (BuiltInData.CreatePresets().FirstOrDefault(p => p.Id == "tool-crop") is { } crop){- var at = presets.FindIndex(p => p.Id == "remove-background");- presets.Insert(at < 0 ? presets.Count : at + 1, crop);- changed = true;+ if (presets.FirstOrDefault(p => p.Id == "tool-crop") is not { } existing)+ {+ var at = presets.FindIndex(p => p.Id == "remove-background");+ presets.Insert(at < 0 ? presets.Count : at + 1, crop);+ changed = true;+ }+ else if (existing.Kind != PresetKind.Tool)+ {+ existing.Kind = PresetKind.Tool;+ existing.TargetFormat = crop.TargetFormat;+ existing.SubPresetIds = [];+ changed = true;+ }}}return changed;diff --git a/tests/Filee.Core.Tests/UserDataStoreTests.cs b/tests/Filee.Core.Tests/UserDataStoreTests.csindex 42a6700f..08a84db6 100644--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs@@ -747,6 +747,26 @@ public class UserDataStoreTestsAssert.False(SettingsMigrations.ApplyToLibrary(20, presets, profiles)); // once only}+ [Fact]+ public void Back_from_an_older_Filee_tool_crop_works_again_and_keeps_the_users_changes()+ {+ // What a Filee before 21 leaves after saving: kind read as Group, TargetFormat dropped, SubPresetIds empty, the rest as it was.+ var presets = BuiltInData.CreatePresets();+ var crop = presets.Single(p => p.Id == "tool-crop");+ crop.Kind = PresetKind.Group;+ crop.TargetFormat = Preset.GroupTarget;+ crop.SubPresetIds = [];+ crop.Name = "Trim";++ Assert.True(SettingsMigrations.ApplyToLibrary(20, presets, BuiltInData.CreateProfiles()));++ Assert.Equal(PresetKind.Tool, crop.Kind);+ Assert.Equal(BuiltInData.SameAsSource, crop.TargetFormat);+ Assert.Empty(crop.SubPresetIds);+ Assert.Equal("Trim", crop.Name);+ Assert.Single(presets, p => p.Id == "tool-crop");+ }+[Fact]public void Back_from_an_older_Filee_compress_pdf_compresses_again_and_keeps_the_users_changes(){