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
Flip the donut with the mouse wheel, and with a key of the user's choice
KnifeLemonf37506187d0b
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex f538b77a..47baba06 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -58,8 +58,8 @@"donut.empty": "Drag presets here","donut.same_format": "Same format","donut.group_caption": "Group of {0}",- "donut.flip_to_back": "Tab ↻ back",- "donut.flip_to_front": "Tab ↻ front",+ "donut.flip_to_back": "{0} ↻ back",+ "donut.flip_to_front": "{0} ↻ front","toast.converting": "{0} → {1}","toast.done": "Done",@@ -317,6 +317,13 @@"triggers.record": "Record","triggers.recording": "Press a key combination…","triggers.clear": "Clear",+ "triggers.recording_key": "Press a key…",+ "triggers.flip_title": "Flip the donut",+ "triggers.flip_description": "While the donut is open, this key or a turn of the mouse wheel shows its back. Each donut gets its back under Donut toolbar.",+ "triggers.flip_wheel": "Mouse wheel flips the donut",+ "triggers.flip_reset": "Use Tab",+ "triggers.flip_key_taken": "{0} can't flip the donut: the donut or a shortcut already uses it.",+ "triggers.flip_key_unknown": "This key can't be used. Try another one.","triggers.threshold": "Drag distance","triggers.threshold_system": "System default","triggers.hold_ms": "Hold time",@@ -357,7 +364,9 @@"toolbar.new_group": "New group","toolbar.face_front": "Front","toolbar.face_back": "Back",- "toolbar.face_hint": "Tab flips the open donut over.",+ "toolbar.face_hint": "Flip the open donut: {0}",+ "toolbar.face_hint_wheel": "mouse wheel",+ "toolbar.face_hint_off": "Choose a key or the mouse wheel in Shortcuts to flip the open donut","group.editor_title": "Group","group.hint": "A group is one donut slice for several presets: rest on it or move outward and they fan out around it.","group.members": "Presets ({0} / {1})",diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.jsonindex 181ef4d0..87b006c6 100644--- a/src/Filee.App/Assets/i18n/es.json+++ b/src/Filee.App/Assets/i18n/es.json@@ -54,8 +54,8 @@"donut.empty": "Arrastra ajustes preestablecidos aquí","donut.same_format": "Mismo formato","donut.group_caption": "Grupo de {0}",- "donut.flip_to_back": "Tab ↻ reverso",- "donut.flip_to_front": "Tab ↻ anverso",+ "donut.flip_to_back": "{0} ↻ reverso",+ "donut.flip_to_front": "{0} ↻ anverso","toast.converting": "{0} → {1}","toast.done": "Hecho","toast.done_errors": "Fallaron {0} de {1}",@@ -304,6 +304,13 @@"triggers.record": "Grabar","triggers.recording": "Pulsa una combinación de teclas…","triggers.clear": "Borrar",+ "triggers.recording_key": "Pulsa una tecla…",+ "triggers.flip_title": "Dar la vuelta al menú circular",+ "triggers.flip_description": "Con el menú circular abierto, esta tecla o un giro de la rueda del ratón muestra su reverso. El reverso de cada menú se elige en Menú circular.",+ "triggers.flip_wheel": "La rueda del ratón da la vuelta al menú circular",+ "triggers.flip_reset": "Usar Tab",+ "triggers.flip_key_taken": "{0} no puede dar la vuelta al menú circular: ya lo usa el menú o un atajo.",+ "triggers.flip_key_unknown": "No se puede usar esta tecla. Prueba con otra.","triggers.threshold": "Distancia de arrastre","triggers.threshold_system": "Predeterminado del sistema","triggers.hold_ms": "Tiempo de pulsación",@@ -343,7 +350,9 @@"toolbar.new_group": "Nuevo grupo","toolbar.face_front": "Anverso","toolbar.face_back": "Reverso",- "toolbar.face_hint": "Tab da la vuelta al menú circular abierto.",+ "toolbar.face_hint": "Dar la vuelta al menú circular abierto: {0}",+ "toolbar.face_hint_wheel": "rueda del ratón",+ "toolbar.face_hint_off": "Elige una tecla o la rueda del ratón en Atajos para dar la vuelta al menú circular abierto","group.editor_title": "Grupo","group.hint": "Un grupo es una sola porción del menú circular para varios ajustes preestablecidos: detente en él o muévete hacia fuera y se despliegan a su alrededor.","group.members": "Ajustes preestablecidos ({0} / {1})",diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.jsonindex c3fbcdbd..79b6beb5 100644--- a/src/Filee.App/Assets/i18n/hi.json+++ b/src/Filee.App/Assets/i18n/hi.json@@ -54,8 +54,8 @@"donut.empty": "प्रीसेट यहाँ खींचें","donut.same_format": "वही फ़ॉर्मैट","donut.group_caption": "{0} का समूह",- "donut.flip_to_back": "Tab ↻ पीछे",- "donut.flip_to_front": "Tab ↻ आगे",+ "donut.flip_to_back": "{0} ↻ पीछे",+ "donut.flip_to_front": "{0} ↻ आगे","toast.converting": "{0} → {1}","toast.done": "हो गया","toast.done_errors": "{1} में से {0} विफल",@@ -304,6 +304,13 @@"triggers.record": "रिकॉर्ड करें","triggers.recording": "कुंजी संयोजन दबाएँ…","triggers.clear": "साफ़ करें",+ "triggers.recording_key": "कोई कुंजी दबाएँ…",+ "triggers.flip_title": "डोनट पलटें",+ "triggers.flip_description": "डोनट खुला हो, तो यह कुंजी दबाने या माउस व्हील घुमाने पर उसका पिछला भाग दिखता है। हर डोनट का पिछला भाग डोनट टूलबार में चुनें।",+ "triggers.flip_wheel": "माउस व्हील से डोनट पलटें",+ "triggers.flip_reset": "Tab इस्तेमाल करें",+ "triggers.flip_key_taken": "{0} से डोनट नहीं पलटा जा सकता: इसे डोनट या कोई शॉर्टकट पहले से इस्तेमाल करता है।",+ "triggers.flip_key_unknown": "यह कुंजी इस्तेमाल नहीं की जा सकती। कोई दूसरी आज़माएँ।","triggers.threshold": "खींचने की दूरी","triggers.threshold_system": "सिस्टम डिफ़ॉल्ट","triggers.hold_ms": "दबाए रखने का समय",@@ -343,7 +350,9 @@"toolbar.new_group": "नया समूह","toolbar.face_front": "आगे","toolbar.face_back": "पीछे",- "toolbar.face_hint": "Tab दबाकर खुले डोनट को पलटें।",+ "toolbar.face_hint": "खुले डोनट को पलटें: {0}",+ "toolbar.face_hint_wheel": "माउस व्हील",+ "toolbar.face_hint_off": "खुले डोनट को पलटने के लिए शॉर्टकट में कोई कुंजी या माउस व्हील चुनें","group.editor_title": "समूह","group.hint": "समूह कई प्रीसेट के लिए डोनट की एक स्लाइस होता है: उस पर रुकें या बाहर की ओर बढ़ें और प्रीसेट उसके चारों ओर फैल जाएँगे।","group.members": "प्रीसेट ({0} / {1})",diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.jsonindex 6eff19ad..5b81f31a 100644--- a/src/Filee.App/Assets/i18n/ja.json+++ b/src/Filee.App/Assets/i18n/ja.json@@ -54,8 +54,8 @@"donut.empty": "ここにプリセットをドラッグ","donut.same_format": "同じ形式","donut.group_caption": "{0}個入り",- "donut.flip_to_back": "Tab ↻ 裏面",- "donut.flip_to_front": "Tab ↻ 表面",+ "donut.flip_to_back": "{0} ↻ 裏面",+ "donut.flip_to_front": "{0} ↻ 表面","toast.converting": "{0} → {1}","toast.done": "完了","toast.done_errors": "{1}件中{0}件失敗",@@ -304,6 +304,13 @@"triggers.record": "記録","triggers.recording": "キーの組み合わせを押してください…","triggers.clear": "クリア",+ "triggers.recording_key": "キーを押してください…",+ "triggers.flip_title": "ドーナツメニューを裏返す",+ "triggers.flip_description": "ドーナツメニューが開いているときにこのキーを押すか、マウスホイールを回すと裏面が表示されます。各ドーナツメニューの裏面は「ドーナツメニュー」で設定します。",+ "triggers.flip_wheel": "マウスホイールで裏返す",+ "triggers.flip_reset": "Tabに戻す",+ "triggers.flip_key_taken": "{0}はドーナツメニューかショートカットで使われているため、裏返しには使えません。",+ "triggers.flip_key_unknown": "このキーは使えません。別のキーを押してください。","triggers.threshold": "ドラッグ距離","triggers.threshold_system": "システムの既定値","triggers.hold_ms": "長押し時間",@@ -343,7 +350,9 @@"toolbar.new_group": "グループ作成","toolbar.face_front": "表面","toolbar.face_back": "裏面",- "toolbar.face_hint": "開いたドーナツメニューはTabキーで裏返せます",+ "toolbar.face_hint": "開いたドーナツメニューを裏返す: {0}",+ "toolbar.face_hint_wheel": "マウスホイール",+ "toolbar.face_hint_off": "開いたドーナツメニューを裏返すには、ショートカットでキーかマウスホイールを選んでください","group.editor_title": "グループ","group.hint": "グループは複数のプリセットをまとめた、ドーナツメニュー内の1つの項目です。カーソルを置いたままにするか外側へ動かすと、プリセットが周囲に展開します。","group.members": "プリセット({0}/{1})",diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.jsonindex 243532d3..92600ff4 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -58,8 +58,8 @@"donut.empty": "프리셋을 끌어다 놓으세요","donut.same_format": "같은 형식","donut.group_caption": "묶음 · {0}개",- "donut.flip_to_back": "Tab ↻ 뒷면",- "donut.flip_to_front": "Tab ↻ 앞면",+ "donut.flip_to_back": "{0} ↻ 뒷면",+ "donut.flip_to_front": "{0} ↻ 앞면","toast.converting": "{0} → {1}","toast.done": "완료",@@ -317,6 +317,13 @@"triggers.record": "키 입력","triggers.recording": "키 조합을 누르세요…","triggers.clear": "지우기",+ "triggers.recording_key": "키를 누르세요…",+ "triggers.flip_title": "도넛 뒤집기",+ "triggers.flip_description": "도넛이 열려 있을 때 이 키를 누르거나 마우스 휠을 돌리면 뒷면이 나와요. 도넛마다 뒷면은 원형 툴바에서 정해요.",+ "triggers.flip_wheel": "마우스 휠로 도넛 뒤집기",+ "triggers.flip_reset": "Tab으로",+ "triggers.flip_key_taken": "{0}은(는) 도넛이나 단축키가 이미 쓰고 있어서 뒤집기에 쓸 수 없어요.",+ "triggers.flip_key_unknown": "이 키는 쓸 수 없어요. 다른 키를 눌러 주세요.","triggers.threshold": "드래그 거리","triggers.threshold_system": "시스템 기본값","triggers.hold_ms": "누르는 시간",@@ -357,7 +364,9 @@"toolbar.new_group": "새 묶음","toolbar.face_front": "앞면","toolbar.face_back": "뒷면",- "toolbar.face_hint": "Tab을 누르면 열린 도넛이 뒤집혀요.",+ "toolbar.face_hint": "열린 도넛 뒤집기: {0}",+ "toolbar.face_hint_wheel": "마우스 휠",+ "toolbar.face_hint_off": "단축키에서 키나 마우스 휠을 고르면 열린 도넛을 뒤집을 수 있어요","group.editor_title": "묶음","group.hint": "묶음은 여러 프리셋을 도넛 한 칸에 담아요. 칸 위에 머물거나 바깥으로 움직이면 주변으로 펼쳐져요.","group.members": "프리셋 ({0} / {1})",diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.jsonindex ee6b95e3..904e98a3 100644--- a/src/Filee.App/Assets/i18n/pl.json+++ b/src/Filee.App/Assets/i18n/pl.json@@ -58,8 +58,8 @@"donut.empty": "Przeciągnij tu ustawienia","donut.same_format": "Ten sam format","donut.group_caption": "Grupa: {0}",- "donut.flip_to_back": "Tab ↻ tył",- "donut.flip_to_front": "Tab ↻ przód",+ "donut.flip_to_back": "{0} ↻ tył",+ "donut.flip_to_front": "{0} ↻ przód","toast.converting": "{0} → {1}","toast.done": "Gotowe",@@ -317,6 +317,13 @@"triggers.record": "Nagraj","triggers.recording": "Naciśnij kombinację klawiszy…","triggers.clear": "Wyczyść",+ "triggers.recording_key": "Naciśnij klawisz…",+ "triggers.flip_title": "Obracanie pierścienia",+ "triggers.flip_description": "Gdy pierścień jest otwarty, ten klawisz lub obrót kółka myszy pokazuje jego tył. Tył każdego pierścienia ustawisz w Pasku-pierścieniu.",+ "triggers.flip_wheel": "Kółko myszy obraca pierścień",+ "triggers.flip_reset": "Użyj Tab",+ "triggers.flip_key_taken": "{0} nie może obracać pierścienia: używa go już pierścień albo skrót.",+ "triggers.flip_key_unknown": "Tego klawisza nie można użyć. Spróbuj innego.","triggers.threshold": "Odległość przeciągania","triggers.threshold_system": "Domyślna systemu","triggers.hold_ms": "Czas przytrzymania",@@ -357,7 +364,9 @@"toolbar.new_group": "Nowa grupa","toolbar.face_front": "Przód","toolbar.face_back": "Tył",- "toolbar.face_hint": "Tab obraca otwarty pierścień.",+ "toolbar.face_hint": "Obracanie otwartego pierścienia: {0}",+ "toolbar.face_hint_wheel": "kółko myszy",+ "toolbar.face_hint_off": "Wybierz klawisz lub kółko myszy w Skrótach, by obracać otwarty pierścień","group.editor_title": "Grupa","group.hint": "Grupa to jeden wycinek pierścienia dla kilku ustawień: zatrzymaj się na nim lub przesuń na zewnątrz, a rozłożą się wokół.","group.members": "Ustawienia ({0} / {1})",diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.jsonindex 9b802d3f..f06e21a1 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -58,8 +58,8 @@"donut.empty": "把预设拖到这里","donut.same_format": "同格式","donut.group_caption": "组 · {0} 项",- "donut.flip_to_back": "Tab ↻ 背面",- "donut.flip_to_front": "Tab ↻ 正面",+ "donut.flip_to_back": "{0} ↻ 背面",+ "donut.flip_to_front": "{0} ↻ 正面","toast.converting": "{0} → {1}","toast.done": "完成",@@ -317,6 +317,13 @@"triggers.record": "录制","triggers.recording": "请按下组合键…","triggers.clear": "清除",+ "triggers.recording_key": "请按下一个键…",+ "triggers.flip_title": "翻转圆环",+ "triggers.flip_description": "圆环打开时,按下此键或转动鼠标滚轮即可显示背面。每个圆环的背面在环形工具栏中设置。",+ "triggers.flip_wheel": "用鼠标滚轮翻转圆环",+ "triggers.flip_reset": "使用 Tab",+ "triggers.flip_key_taken": "{0} 已被圆环或快捷操作占用,不能用来翻转圆环。",+ "triggers.flip_key_unknown": "无法使用此键,请换一个。","triggers.threshold": "拖动距离","triggers.threshold_system": "系统默认","triggers.hold_ms": "按住时间",@@ -357,7 +364,9 @@"toolbar.new_group": "新建组","toolbar.face_front": "正面","toolbar.face_back": "背面",- "toolbar.face_hint": "按 Tab 可翻转打开的圆环。",+ "toolbar.face_hint": "用 {0} 翻转打开的圆环",+ "toolbar.face_hint_wheel": "鼠标滚轮",+ "toolbar.face_hint_off": "在快捷操作中选择按键或鼠标滚轮,即可翻转打开的圆环","group.editor_title": "组","group.hint": "组把多个预设放进圆环的一格。停留在上面或向外移动,它们就会在周围展开。","group.members": "预设({0} / {1})",diff --git a/src/Filee.App/Controls/DonutMenu.Flip.cs b/src/Filee.App/Controls/DonutMenu.Flip.csindex a9d10128..75b50522 100644--- a/src/Filee.App/Controls/DonutMenu.Flip.cs+++ b/src/Filee.App/Controls/DonutMenu.Flip.cs@@ -1,15 +1,17 @@// Flipping the donut to its other face: every profile has a front and a back list of slices, and Tab turns the open// donut over. The ring turns about the vertical axis like a coin (its width goes 1 → 0, the faces swap while it is-// edge-on, 0 → 1); the hub stays where it is and says what Tab does ("Tab ↻ back").+// edge-on, 0 → 1); the hub stays where it is and says how to flip ("Tab ↻ back").//-// Click mode → Tab / Shift+Tab reach the focused window (HandleKey).-// Drag mode → the window has no keyboard focus during an OS drag: RadialController calls Flip when the global-// hook sees Tab (TriggerService.FlipKeyPressed).+// The flip key (Tab unless the user records another in Settings → Shortcuts) and the mouse wheel flip it:+// Click mode → the key reaches the focused window (HandleKey), the wheel the donut (OnPointerWheelChanged).+// Drag mode → the window has no keyboard focus during an OS drag: RadialController flips when the global hook+// sees the key or the wheel (TriggerService.FlipKeyPressed / FlipWheelTurned).//// The control only animates: the owner swaps Items when FaceSwapping is raised (RadialWindow → RadialViewModel), so// the slices, hit-testing and what a drop converts with always belong to the face that is drawn.using Avalonia;+using Avalonia.Input;using Avalonia.Media;using Filee.App.Services;@@ -17,7 +19,7 @@ namespace Filee.App.Controls;public sealed partial class DonutMenu{- /// <summary>There is another face with slices for these files: Tab flips to it.</summary>+ /// <summary>There is another face with slices for these files: the flip key or the wheel turns to it.</summary>public static readonly StyledProperty<bool> CanFlipProperty =AvaloniaProperty.Register<DonutMenu, bool>(nameof(CanFlip));@@ -25,6 +27,26 @@ public sealed partial class DonutMenupublic static readonly StyledProperty<string?> CenterHintProperty =AvaloniaProperty.Register<DonutMenu, string?>(nameof(CenterHint));+ /// <summary>A small mouse in front of <see cref="CenterHint"/>: the wheel flips (and no key does).</summary>+ public static readonly StyledProperty<bool> CenterHintWheelProperty =+ AvaloniaProperty.Register<DonutMenu, bool>(nameof(CenterHintWheel));++ /// <summary>The key that flips the donut in click mode, as the settings name it ("Tab", "F2"); null for none.</summary>+ public static readonly StyledProperty<string?> FlipKeyProperty =+ AvaloniaProperty.Register<DonutMenu, string?>(nameof(FlipKey));++ /// <summary>A turn of the mouse wheel over the donut flips it (click mode; drag mode reads the wheel globally).</summary>+ public static readonly StyledProperty<bool> FlipWithWheelProperty =+ AvaloniaProperty.Register<DonutMenu, bool>(nameof(FlipWithWheel));++ /// <summary>+ /// A wheel event this soon after the previous one belongs to the same turn of the wheel: one flip per turn, however+ /// many notches (or a touchpad's many small steps) it has, so a fast scroll doesn't flip back and forth.+ /// </summary>+ internal const long WheelQuietMs = 300;++ private long? _lastWheel;+/// <summary>How long a flip takes, there and back: the faces swap halfway.</summary>internal const double FlipDuration = 0.2;@@ -36,6 +58,30 @@ public sealed partial class DonutMenupublic bool CanFlip { get => GetValue(CanFlipProperty); set => SetValue(CanFlipProperty, value); }public string? CenterHint { get => GetValue(CenterHintProperty); set => SetValue(CenterHintProperty, value); }+ public bool CenterHintWheel { get => GetValue(CenterHintWheelProperty); set => SetValue(CenterHintWheelProperty, value); }+ public string? FlipKey { get => GetValue(FlipKeyProperty); set => SetValue(FlipKeyProperty, value); }+ public bool FlipWithWheel { get => GetValue(FlipWithWheelProperty); set => SetValue(FlipWithWheelProperty, value); }++ /// <summary>+ /// A wheel event at <paramref name="nowMs"/> (milliseconds, any clock): flips on the first one of a turn of the wheel+ /// and ignores the rest of it (<see cref="WheelQuietMs"/>). Returns true when it flipped.+ /// </summary>+ public bool FlipFromWheel(long nowMs)+ {+ var sameTurn = _lastWheel is { } last && nowMs - last < WheelQuietMs;+ _lastWheel = nowMs;+ return !sameTurn && Flip();+ }++ /// <summary>Click mode: the wheel over the donut flips it; nothing under the donut scrolls meanwhile.</summary>+ protected override void OnPointerWheelChanged(PointerWheelEventArgs e)+ {+ base.OnPointerWheelChanged(e);+ if (!FlipWithWheel || IsEditMode || _progressMode || e.Delta.Y == 0)+ return;+ FlipFromWheel(Environment.TickCount64);+ e.Handled = true;+ }/// <summary>/// The donut is edge-on (at once without animations): the owner shows the other face now by changingdiff --git a/src/Filee.App/Controls/DonutMenu.Groups.cs b/src/Filee.App/Controls/DonutMenu.Groups.csindex e272988a..f76dc516 100644--- a/src/Filee.App/Controls/DonutMenu.Groups.cs+++ b/src/Filee.App/Controls/DonutMenu.Groups.cs@@ -4,8 +4,8 @@// Pointer / drag → resting on a group's slice (ExpandDelay), or moving outward on it, opens its ring; the ring// stays open on its way out to it (the gap, the neighbours' outer half) and folds on another slice,// the hole, or going round the outside away from it.-// Keyboard → arrows move, Enter opens a group or converts, Esc / Backspace fold a ring first, Tab flips-// the donut (DonutMenu.Flip.cs).+// Keyboard → arrows move, Enter opens a group or converts, Esc / Backspace fold a ring first, the flip key+// (Tab unless set otherwise) flips the donut (DonutMenu.Flip.cs).// See-through → Windows and macOS let the pointer and drags through fully transparent pixels: a nearly// transparent backdrop and LeftThroughSeam keep a group from folding when it only seems to leave.@@ -13,6 +13,7 @@ using Avalonia;using Avalonia.Input;using Avalonia.Media;using Avalonia.Threading;+using Filee.App.Services;namespace Filee.App.Controls;@@ -201,15 +202,16 @@ public sealed partial class DonutMenu/// <summary>/// Keyboard (click mode): arrows move around the donut, Enter converts or opens a group; in a group's ring the- /// arrows move between its slices, Enter converts and Esc / Backspace go back to the donut. Tab and Shift+Tab flip- /// the donut to its other face (<see cref="Flip"/>). Returns false for keys left to the window (Esc on the donut- /// closes it).+ /// arrows move between its slices, Enter converts and Esc / Backspace go back to the donut. The flip key+ /// (<see cref="FlipKey"/>, Tab by default; with Shift or any other modifier too) flips the donut to its other face+ /// (<see cref="Flip"/>). Returns false for keys left to the window (Esc on the donut closes it)./// </summary>public bool HandleKey(Key key, KeyModifiers modifiers = KeyModifiers.None){- if (key == Key.Tab && !IsEditMode && !_progressMode)+ if (!IsEditMode && !_progressMode && FlipKey is { } flipKey &&+ string.Equals(KeyNames.ToHookName(key), flipKey, StringComparison.OrdinalIgnoreCase)){- // Also when there is nothing to flip to: Tab never takes the focus off the donut.+ // Also when there is nothing to flip to: the key never does something else (Tab: move the focus).Flip();return true;}diff --git a/src/Filee.App/Controls/DonutMenu.cs b/src/Filee.App/Controls/DonutMenu.csindex dea3129b..2011d339 100644--- a/src/Filee.App/Controls/DonutMenu.cs+++ b/src/Filee.App/Controls/DonutMenu.cs@@ -6,7 +6,7 @@// Motion.Enabled == false every value jumps straight to its target.//// After a drop the donut turns into a progress ring: see DonutMenu.Progress.cs. Group slices, which fan out a ring-// of presets, and the keyboard: DonutMenu.Groups.cs. Tab flips the donut to its other face: DonutMenu.Flip.cs.+// of presets, and the keyboard: DonutMenu.Groups.cs. Tab (or the wheel) flips the donut over: DonutMenu.Flip.cs.using System.Globalization;using Avalonia;@@ -132,7 +132,7 @@ public sealed partial class DonutMenu : ControlAffectsRender<DonutMenu>(HoleRatioProperty, SliceOpacityProperty, CenterTitleProperty, CenterSubtitleProperty,IsEditModeProperty, SliceBrushProperty, SliceBorderBrushProperty, CenterBrushProperty, AccentBrushProperty,OnAccentBrushProperty, ForegroundProperty, SecondaryForegroundProperty, SuccessBrushProperty, CornerRadiusProperty,- CenterHintProperty);+ CenterHintProperty, CenterHintWheelProperty);ItemsProperty.Changed.AddClassHandler<DonutMenu>((d, _) => d.OnItemsChanged());}@@ -936,10 +936,31 @@ public sealed partial class DonutMenu : Controlif (hint is not null){using (context.PushOpacity(0.85))- DrawCentered(context, hint, center.X, y + 5);+ {+ if (!CenterHintWheel)+ {+ DrawCentered(context, hint, center.X, y + 5);+ }+ else+ {+ // A small mouse in front: "🖱 ↻ back" when the wheel flips and no key does.+ const double iconWidth = 7, gap = 4;+ var left = center.X - (hint.Width + iconWidth + gap) / 2;+ DrawMouse(context, new Rect(left, y + 5 + (hint.Height - 10) / 2, iconWidth, 10), SecondaryForeground);+ DrawCentered(context, hint, center.X + (iconWidth + gap) / 2, y + 5);+ }+ }}}+ /// <summary>An outline of a mouse with its wheel, filling <paramref name="box"/>.</summary>+ private static void DrawMouse(DrawingContext context, Rect box, IBrush? brush)+ {+ var pen = new Pen(brush, 1.1);+ context.DrawRectangle(null, pen, box, box.Width / 2, box.Width / 2);+ context.DrawLine(pen, new Point(box.Center.X, box.Top + 2), new Point(box.Center.X, box.Top + 4.5));+ }+private void DrawLabel(DrawingContext context, DonutItem item, Point center, double radius, double angle,double maxWidth, double maxHeight, Typeface bold, Typeface regular, bool hot){diff --git a/src/Filee.App/Services/KeyNames.cs b/src/Filee.App/Services/KeyNames.csnew file mode 100644index 00000000..f73fd68d--- /dev/null+++ b/src/Filee.App/Services/KeyNames.cs@@ -0,0 +1,63 @@+// Key names as the global hook (SharpHook) and the settings use them: KeyCode without "Vc" ("Space", "F2", "Q").++using Avalonia.Input;++namespace Filee.App.Services;++/// <summary>Maps Avalonia keys to SharpHook key names (KeyCode without "Vc").</summary>+public static class KeyNames+{+ public static string? ToHookName(Key key) => key switch+ {+ >= Key.A and <= Key.Z => key.ToString(),+ >= Key.D0 and <= Key.D9 => ((int)(key - Key.D0)).ToString(),+ >= Key.NumPad0 and <= Key.NumPad9 => "NumPad" + (int)(key - Key.NumPad0),+ >= Key.F1 and <= Key.F24 => key.ToString(),+ Key.Space => "Space",+ Key.Enter => "Enter",+ Key.Tab => "Tab",+ Key.Escape => "Escape",+ Key.Back => "Backspace",+ Key.Insert => "Insert",+ Key.Delete => "Delete",+ Key.Home => "Home",+ Key.End => "End",+ Key.PageUp => "PageUp",+ Key.PageDown => "PageDown",+ Key.Left => "Left",+ Key.Right => "Right",+ Key.Up => "Up",+ Key.Down => "Down",+ Key.OemTilde => "BackQuote",+ Key.OemMinus => "Minus",+ Key.OemPlus => "Equals",+ Key.OemOpenBrackets => "OpenBracket",+ Key.OemCloseBrackets => "CloseBracket",+ Key.OemPipe => "Backslash",+ Key.OemSemicolon => "Semicolon",+ Key.OemQuotes => "Quote",+ Key.OemComma => "Comma",+ Key.OemPeriod => "Period",+ Key.OemQuestion => "Slash",+ Key.PrintScreen => "PrintScreen",+ Key.Pause => "Pause",+ _ => null,+ };++ /// <summary>A key name as people read it: "Tab", "F2", "Q", "`" for "BackQuote".</summary>+ public static string Display(string hookName) => hookName switch+ {+ "BackQuote" => "`",+ "Minus" => "-",+ "Equals" => "=",+ "OpenBracket" => "[",+ "CloseBracket" => "]",+ "Backslash" => "\\",+ "Semicolon" => ";",+ "Quote" => "'",+ "Comma" => ",",+ "Period" => ".",+ "Slash" => "/",+ _ => hookName,+ };+}diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.csindex 6aae916f..26a0b670 100644--- a/src/Filee.App/Services/RadialController.cs+++ b/src/Filee.App/Services/RadialController.cs@@ -7,8 +7,9 @@// Click mode (keyboard shortcut, context menu, drop zone):// files are known up front → donut appears activated → click a slice to convert, right-click to edit,// Esc / click outside closes.-// Tab flips the open donut to its other face (DonutMenu.Flip.cs): in click mode the focused window gets the key, in-// drag mode (no focus during an OS drag) the global hook reports it while the donut shows files.+// The flip key (Tab) and the mouse wheel flip the open donut to its other face (DonutMenu.Flip.cs): in click mode the+// focused window gets them, in drag mode (no focus during an OS drag) the global hook reports them while the donut+// shows files.// After a drop / click the donut becomes a progress ring at the same spot (DonutMenu.Progress.cs):// finished quickly → ✓ pops up in the centre, then the ring fades out;// still running after HandOffAfter, failed, Esc, click elsewhere or a new gesture → the toast takes over.@@ -256,12 +257,17 @@ public sealed class RadialController(};donut.ActiveIndexChanged += (_, index) => viewModel.ShowHint(index, donut.ActiveSubIndex, donut.IsCenterHot);- // Drag mode: Tab seen by the global hook (click mode gets it as a key of the focused window).+ // Drag mode: the flip key and the wheel seen by the global hook (click mode gets them in the focused window).triggers.FlipKeyPressed += (_, _) =>{- if (_visible && !_dropped && !viewModel.IsClickMode && viewModel.HasFiles)+ if (FlipsFromHook)donut.Flip();};+ triggers.FlipWheelTurned += (_, _) =>+ {+ if (FlipsFromHook)+ donut.FlipFromWheel(Environment.TickCount64);+ };donut.SegmentInvoked += (_, index) => Convert(index, -1, viewModel.Files);donut.SubSegmentInvoked += (_, hit) => Convert(hit.Group, hit.Sub, viewModel.Files);donut.CenterInvoked += (_, _) => Close();@@ -410,11 +416,13 @@ public sealed class RadialController(}/// <summary>- /// Has the global hook report Tab only while a drag-mode donut shows files that could flip; Tab is left alone- /// otherwise (see <see cref="TriggerService.WatchFlipKey"/>).+ /// Has the global hook report the flip key and the wheel only while a drag-mode donut shows files that could flip;+ /// they are left alone otherwise (see <see cref="TriggerService.WatchFlipKey"/>)./// </summary>- private void WatchFlipKey() =>- triggers.WatchFlipKey = _visible && !_dropped && !viewModel.IsClickMode && viewModel.HasFiles;+ private void WatchFlipKey() => triggers.WatchFlipKey = FlipsFromHook;++ /// <summary>A drag-mode donut shows files and nothing was dropped yet: the hook's flip key and wheel flip it.</summary>+ private bool FlipsFromHook => _visible && !_dropped && !viewModel.IsClickMode && viewModel.HasFiles;/// <summary>/// Top-left corner of a <paramref name="sidePx"/> square window centred on <paramref name="cursor"/>, moved intodiff --git a/src/Filee.App/Services/Triggers/TriggerService.cs b/src/Filee.App/Services/Triggers/TriggerService.csindex ae2faae4..ecbd6182 100644--- a/src/Filee.App/Services/Triggers/TriggerService.cs+++ b/src/Filee.App/Services/Triggers/TriggerService.cs@@ -57,17 +57,23 @@ public sealed class TriggerService : IDisposable/// <summary>A hold or keyboard gesture: open the donut for the file manager's current selection.</summary>public event EventHandler<GestureEventArgs>? SelectionGesture;- /// <summary>Tab went down while <see cref="WatchFlipKey"/> was on: flip the donut.</summary>+ /// <summary>The flip key went down while <see cref="WatchFlipKey"/> was on: flip the donut.</summary>public event EventHandler? FlipKeyPressed;+ /// <summary>The mouse wheel turned (up or down) while <see cref="WatchFlipKey"/> was on: flip the donut.</summary>+ public event EventHandler? FlipWheelTurned;+private volatile bool _watchFlipKey;+ private volatile string? _flipKey = DonutSettings.DefaultFlipKey;+ private volatile bool _flipWheel = true;private bool _flipKeyDown; // hook thread only/// <summary>- /// On while the drag-mode donut shows files: Tab is reported (<see cref="FlipKeyPressed"/>), once per press, not- /// for the repeats of a held key. During an OS drag the donut's window has no keyboard focus, so Tab reaches- /// Filee only through the hook. Nothing is swallowed: the hook only listens (Explorer and Finder ignore Tab- /// during a drag, so the drag goes on), and with the donut closed Tab isn't even looked at.+ /// On while the drag-mode donut shows files: the flip key (Tab unless set otherwise) and the mouse wheel are+ /// reported (<see cref="FlipKeyPressed"/>, once per press, not for the repeats of a held key;+ /// <see cref="FlipWheelTurned"/>). During an OS drag the donut's window has no keyboard focus, so they reach Filee+ /// only through the hook. Nothing is swallowed: the hook only listens (it runs on its own thread and can't hold an+ /// event back), Explorer and Finder ignore Tab during a drag, and with the donut closed neither is looked at./// </summary>public bool WatchFlipKey{@@ -75,7 +81,7 @@ public sealed class TriggerService : IDisposableset => _watchFlipKey = value;}- /// <summary>Tab went down or up (hook thread).</summary>+ /// <summary>The flip key went down or up (hook thread).</summary>private void OnFlipKey(bool down){var repeat = down && _flipKeyDown;@@ -84,6 +90,20 @@ public sealed class TriggerService : IDisposablePost(() => FlipKeyPressed?.Invoke(this, EventArgs.Empty));}+ /// <summary>A key went down or up (hook thread): the flip key's state is followed whether or not it is watched.</summary>+ private void OnKey(KeyCode code, bool down)+ {+ if (_flipKey is { } flip && string.Equals(KeyName(code), flip, StringComparison.OrdinalIgnoreCase))+ OnFlipKey(down);+ }++ /// <summary>The wheel turned (hook thread). Each notch is reported: the donut keeps one flip per turn.</summary>+ private void OnWheel(MouseWheelEventData wheel)+ {+ if (_watchFlipKey && _flipWheel && wheel.Direction == MouseWheelScrollDirection.Vertical && wheel.Rotation != 0)+ Post(() => FlipWheelTurned?.Invoke(this, EventArgs.Empty));+ }+/// <summary>Last known cursor position (physical pixels).</summary>public (int X, int Y) LastCursor { get; private set; }@@ -104,6 +124,8 @@ public sealed class TriggerService : IDisposable{_detector.Configure(settings.Triggers.Where(g => _platform.SupportsSelectionShortcut || g.Kind == TriggerKind.Drag).ToList());_detector.Paused = settings.Paused;+ _flipKey = settings.Donut.EffectiveFlipKey(settings.Triggers);+ _flipWheel = settings.Donut.FlipWithWheel;_excluded = new HashSet<string>(settings.ExcludedProcesses.Select(p => p.Trim().Replace(".exe", "", StringComparison.OrdinalIgnoreCase)),StringComparer.OrdinalIgnoreCase);}@@ -154,15 +176,11 @@ public sealed class TriggerService : IDisposable_hook.MouseMovedRelative += (_, e) => OnRelativeMove(e);_hook.KeyPressed += (_, e) =>{- if (e.Data.KeyCode == KeyCode.VcTab)- OnFlipKey(down: true);+ OnKey(e.Data.KeyCode, down: true);_detector.KeyDown(KeyName(e.Data.KeyCode), Map(e.RawEvent.Mask));};- _hook.KeyReleased += (_, e) =>- {- if (e.Data.KeyCode == KeyCode.VcTab)- OnFlipKey(down: false);- };+ _hook.KeyReleased += (_, e) => OnKey(e.Data.KeyCode, down: false);+ _hook.MouseWheel += (_, e) => OnWheel(e.Data);// Own the actual Run thread. SharpHook's RunAsync task completes BEFORE its finally// clears the native callback, so awaiting that task alone is not a safe restart barrier.var hook = _hook;diff --git a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.csindex 0e511ce8..dc90f74b 100644--- a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs@@ -65,8 +65,19 @@ public sealed partial class ToolbarPageViewModel : ObservableObject_loading = false;SelectedProfile = Profiles.FirstOrDefault();++ // How the open donut flips, as set in Settings → Shortcuts: "Flip the open donut: Tab / mouse wheel".+ var ways = new List<string>();+ if (store.Settings.Donut.EffectiveFlipKey(store.Settings.Triggers) is { } key)+ ways.Add(KeyNames.Display(key));+ if (store.Settings.Donut.FlipWithWheel)+ ways.Add(loc["toolbar.face_hint_wheel"]);+ FaceHint = ways.Count == 0 ? loc["toolbar.face_hint_off"] : loc.Format("toolbar.face_hint", string.Join(" / ", ways));}+ /// <summary>Under the Front / Back switch: what flips the open donut (or that nothing does).</summary>+ public string FaceHint { get; }+public ObservableCollection<ProfileItemViewModel> Profiles { get; } = [];public ObservableCollection<PaletteChip> Palette { get; } = [];diff --git a/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs b/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.csindex 1ef4d66b..472e1771 100644--- a/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs@@ -140,6 +140,96 @@ public sealed partial class TriggerGestureViewModel : ObservableObject}}+/// <summary>+/// How the open donut flips to its other face: a key (Tab unless the user records another; cleared, none) and the+/// mouse wheel. Both work while dragging and in click mode.+/// </summary>+public sealed partial class FlipOptionsViewModel : ObservableObject+{+ private readonly UserDataStore _store;+ private readonly ILocalizer _loc;+ private readonly Action _save;+ private readonly bool _loading;++ public FlipOptionsViewModel(UserDataStore store, ILocalizer loc, Action save)+ {+ _store = store;+ _loc = loc;+ _save = save;+ _loading = true;+ FlipWithWheel = store.Settings.Donut.FlipWithWheel;+ _loading = false;+ }++ private DonutSettings Donut => _store.Settings.Donut;++ [ObservableProperty, NotifyPropertyChangedFor(nameof(KeyText))] private bool _isRecording;++ /// <summary>Why the last key pressed while recording wasn't taken, or null.</summary>+ [ObservableProperty] private string? _error;++ [ObservableProperty] private bool _flipWithWheel;++ /// <summary>The key that flips now ("Tab", "F2"), "Press a key…" while recording, or "—" for none.</summary>+ public string KeyText => IsRecording ? _loc["triggers.recording_key"]+ : Donut.EffectiveFlipKey(_store.Settings.Triggers) is { } key ? KeyNames.Display(key) : "—";++ partial void OnIsRecordingChanged(bool value)+ {+ if (value)+ Error = null;+ }++ partial void OnFlipWithWheelChanged(bool value)+ {+ if (_loading)+ return;+ Donut.FlipWithWheel = value;+ _save();+ }++ [RelayCommand]+ private void ResetKey() => SetKey(DonutSettings.DefaultFlipKey);++ [RelayCommand]+ private void ClearKey() => SetKey("");++ private void SetKey(string key)+ {+ IsRecording = false;+ Error = null;+ Donut.FlipKey = key;+ _save();+ OnPropertyChanged(nameof(KeyText));+ }++ /// <summary>+ /// Called by the view while recording: the key pressed becomes the flip key (its modifiers don't count: a drag holds+ /// one anyway). Modifier keys alone wait for a real key; Esc, Enter, Space, the arrows, Backspace and the key of a+ /// keyboard shortcut are refused with the reason. Returns true when the key was handled.+ /// </summary>+ public bool Record(Key key)+ {+ if (!IsRecording || key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt or Key.LeftShift+ or Key.RightShift or Key.LWin or Key.RWin)+ return false;+ if (KeyNames.ToHookName(key) is not { } name)+ {+ Error = _loc["triggers.flip_key_unknown"];+ IsRecording = false;+ return true;+ }+ if (!DonutSettings.IsFlipKeyAllowed(name, _store.Settings.Triggers))+ {+ Error = _loc.Format("triggers.flip_key_taken", KeyNames.Display(name));+ IsRecording = false;+ return true;+ }+ SetKey(name);+ return true;+ }+}+public sealed partial class TriggersPageViewModel : ObservableObject, IDisposable{private readonly UserDataStore _store;@@ -163,8 +253,12 @@ public sealed partial class TriggersPageViewModel : ObservableObject, IDisposablforeach (var gesture in store.Settings.Triggers)Gestures.Add(new TriggerGestureViewModel(gesture, loc, Save));ExcludedApps = new ExcludedAppsViewModel(store.Settings.ExcludedProcesses, platform, Save);+ Flip = new FlipOptionsViewModel(store, loc, Save);}+ /// <summary>The key and the wheel that flip the open donut.</summary>+ public FlipOptionsViewModel Flip { get; }+public ObservableCollection<TriggerGestureViewModel> Gestures { get; } = [];public bool IsMacOS => _platform is MacOSPlatformServices;@@ -244,44 +338,3 @@ public sealed partial class TriggersPageViewModel : ObservableObject, IDisposablprivate void Save() => _store.SaveSettings();}--/// <summary>Maps Avalonia keys to SharpHook key names (KeyCode without "Vc").</summary>-public static class KeyNames-{- public static string? ToHookName(Key key) => key switch- {- >= Key.A and <= Key.Z => key.ToString(),- >= Key.D0 and <= Key.D9 => ((int)(key - Key.D0)).ToString(),- >= Key.NumPad0 and <= Key.NumPad9 => "NumPad" + (int)(key - Key.NumPad0),- >= Key.F1 and <= Key.F24 => key.ToString(),- Key.Space => "Space",- Key.Enter => "Enter",- Key.Tab => "Tab",- Key.Escape => "Escape",- Key.Back => "Backspace",- Key.Insert => "Insert",- Key.Delete => "Delete",- Key.Home => "Home",- Key.End => "End",- Key.PageUp => "PageUp",- Key.PageDown => "PageDown",- Key.Left => "Left",- Key.Right => "Right",- Key.Up => "Up",- Key.Down => "Down",- Key.OemTilde => "BackQuote",- Key.OemMinus => "Minus",- Key.OemPlus => "Equals",- Key.OemOpenBrackets => "OpenBracket",- Key.OemCloseBrackets => "CloseBracket",- Key.OemPipe => "Backslash",- Key.OemSemicolon => "Semicolon",- Key.OemQuotes => "Quote",- Key.OemComma => "Comma",- Key.OemPeriod => "Period",- Key.OemQuestion => "Slash",- Key.PrintScreen => "PrintScreen",- Key.Pause => "Pause",- _ => null,- };-}diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.csindex af3d6117..8b4df11d 100644--- a/src/Filee.App/ViewModels/RadialViewModel.cs+++ b/src/Filee.App/ViewModels/RadialViewModel.cs@@ -25,9 +25,21 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,/// <summary>The other face has a slice for these files: Tab flips to it.</summary>[ObservableProperty] private bool _canFlip;- /// <summary>"Tab ↻ back" / "Tab ↻ front" in the hub while <see cref="CanFlip"/>, else null.</summary>+ /// <summary>+ /// "Tab ↻ back" / "Tab ↻ front" in the hub (with the flip key of the settings) while <see cref="CanFlip"/> and a key+ /// or the wheel flips; else null.+ /// </summary>[ObservableProperty] private string? _flipHint;+ /// <summary>The hint shows a mouse instead of a key: only the wheel flips.</summary>+ [ObservableProperty] private bool _flipHintWheel;++ /// <summary>The key that flips the donut (settings name, "Tab"), or null for none.</summary>+ [ObservableProperty] private string? _flipKey;++ /// <summary>A turn of the mouse wheel flips the donut.</summary>+ [ObservableProperty] private bool _flipWithWheel;+/// <summary>/// The window keeps room for the ring a group fans out. Dragging, the donut is placed before the files (and so/// the donut) are known: room when any donut has a group. In click mode only when this one does@@ -192,7 +204,11 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,}var other = back ? _front : checkBack ? BackFace() : _back;CanFlip = other?.IsUsable == true;- FlipHint = CanFlip ? loc[back ? "donut.flip_to_front" : "donut.flip_to_back"] : null;+ var how = FlipKey is { } key ? KeyNames.Display(key) : "";+ FlipHint = CanFlip && (FlipKey is not null || FlipWithWheel)+ ? loc.Format(back ? "donut.flip_to_front" : "donut.flip_to_back", how).Trim()+ : null;+ FlipHintWheel = FlipHint is not null && FlipKey is null;}/// <summary>The back face's slices for the files, checked now if they weren't yet.</summary>@@ -281,5 +297,7 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,OuterRadius = Math.Clamp(store.Settings.Donut.OuterRadius, 100, 240);HoleRatio = store.Settings.Donut.HoleRatio;SliceOpacity = store.Settings.Donut.Opacity;+ FlipKey = store.Settings.Donut.EffectiveFlipKey(store.Settings.Triggers);+ FlipWithWheel = store.Settings.Donut.FlipWithWheel;}}diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml b/src/Filee.App/Views/Pages/ToolbarPage.axamlindex 673a58b9..8a049929 100644--- a/src/Filee.App/Views/Pages/ToolbarPage.axaml+++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml@@ -189,7 +189,7 @@</StackPanel></Border><TextBlock Classes="caption" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"- Margin="12,6,12,0" Text="{DynamicResource toolbar.face_hint}" />+ Margin="12,6,12,0" Text="{Binding FaceHint}" /><c:DonutMenu x:Name="Donut" IsEditMode="True" HorizontalAlignment="Center"Items="{Binding DonutItems}"CenterTitle="{Binding CenterTitle}"diff --git a/src/Filee.App/Views/Pages/TriggersPage.axaml b/src/Filee.App/Views/Pages/TriggersPage.axamlindex dbe420e2..28bb1025 100644--- a/src/Filee.App/Views/Pages/TriggersPage.axaml+++ b/src/Filee.App/Views/Pages/TriggersPage.axaml@@ -119,6 +119,36 @@</ItemsControl.ItemTemplate></ItemsControl>+ <!-- Flipping the open donut to its other face: a key (recorded) and the mouse wheel -->+ <Border x:Name="FlipCard" Classes="card">+ <StackPanel Spacing="10" DataContext="{Binding Flip}" x:DataType="vm:FlipOptionsViewModel">+ <TextBlock Classes="label" Text="{DynamicResource triggers.flip_title}" />+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource triggers.flip_description}" />+ <StackPanel Orientation="Horizontal" Spacing="6">+ <TextBlock Text="{DynamicResource triggers.key}" VerticalAlignment="Center" Margin="0,0,6,0" />+ <Border Classes="badge" MinWidth="120" Padding="12,6">+ <TextBlock Text="{Binding KeyText}" FontWeight="SemiBold" />+ </Border>+ <ToggleButton x:Name="FlipRecorder" IsChecked="{Binding IsRecording}" KeyDown="OnFlipRecorderKeyDown">+ <StackPanel Orientation="Horizontal" Spacing="6">+ <PathIcon Width="12" Height="12" Data="{StaticResource Icon.Record}" Foreground="{DynamicResource DangerBrush}" />+ <TextBlock Text="{DynamicResource triggers.record}" />+ </StackPanel>+ </ToggleButton>+ <Button Classes="ghost" Content="{DynamicResource triggers.flip_reset}" Command="{Binding ResetKeyCommand}" />+ <Button Classes="ghost" Content="{DynamicResource triggers.clear}" Command="{Binding ClearKeyCommand}" />+ </StackPanel>+ <TextBlock Classes="caption danger" TextWrapping="Wrap" Text="{Binding Error}"+ IsVisible="{Binding Error, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />+ <DockPanel>+ <ToggleSwitch x:Name="FlipWheel" DockPanel.Dock="Right" OnContent="{x:Null}" OffContent="{x:Null}" MinWidth="0"+ Margin="12,0,0,0" VerticalAlignment="Center" IsChecked="{Binding FlipWithWheel}"+ AutomationProperties.Name="{DynamicResource triggers.flip_wheel}" />+ <TextBlock Text="{DynamicResource triggers.flip_wheel}" TextWrapping="Wrap" VerticalAlignment="Center" />+ </DockPanel>+ </StackPanel>+ </Border>+<Border Classes="card"><StackPanel Spacing="8" DataContext="{Binding ExcludedApps}" x:DataType="vm:ExcludedAppsViewModel"><TextBlock Classes="label" Text="{DynamicResource triggers.excluded}" />diff --git a/src/Filee.App/Views/Pages/TriggersPage.axaml.cs b/src/Filee.App/Views/Pages/TriggersPage.axaml.csindex 71b94a85..a7e97058 100644--- a/src/Filee.App/Views/Pages/TriggersPage.axaml.cs+++ b/src/Filee.App/Views/Pages/TriggersPage.axaml.cs@@ -15,4 +15,11 @@ public partial class TriggersPage : UserControlif (sender is ToggleButton { DataContext: TriggerGestureViewModel vm } && vm.IsRecording)e.Handled = vm.Record(e.Key, e.KeyModifiers);}++ /// <summary>While "Record" is on, the next key pressed on the button flips the donut from now on.</summary>+ private void OnFlipRecorderKeyDown(object? sender, KeyEventArgs e)+ {+ if (sender is ToggleButton { DataContext: FlipOptionsViewModel vm } && vm.IsRecording)+ e.Handled = vm.Record(e.Key);+ }}diff --git a/src/Filee.App/Views/RadialWindow.axaml b/src/Filee.App/Views/RadialWindow.axamlindex bf9b770a..e3083d5e 100644--- a/src/Filee.App/Views/RadialWindow.axaml+++ b/src/Filee.App/Views/RadialWindow.axaml@@ -29,6 +29,9 @@SliceOpacity="{Binding SliceOpacity}"ReserveSubRing="{Binding ReserveSubRing}"CanFlip="{Binding CanFlip}"- CenterHint="{Binding FlipHint}" />+ CenterHint="{Binding FlipHint}"+ CenterHintWheel="{Binding FlipHintWheel}"+ FlipKey="{Binding FlipKey}"+ FlipWithWheel="{Binding FlipWithWheel}" /></Panel></Window>diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.csindex 863795d3..a350061d 100644--- a/src/Filee.Core/Settings/AppSettings.cs+++ b/src/Filee.Core/Settings/AppSettings.cs@@ -58,6 +58,50 @@ public sealed class DonutSettings/// <summary>Background opacity of the slices (0.5 - 1).</summary>public double Opacity { get; set; } = 0.96;+ /// <summary>The flip key unless the user picks another one (Settings → Shortcuts).</summary>+ public const string DefaultFlipKey = "Tab";++ /// <summary>+ /// The key that flips the open donut to its other face, as a SharpHook key name without "Vc" ("Tab", "F2", "Q");+ /// empty for none. See <see cref="EffectiveFlipKey"/>.+ /// </summary>+ public string FlipKey { get; set; } = DefaultFlipKey;++ /// <summary>A turn of the mouse wheel flips the open donut to its other face.</summary>+ public bool FlipWithWheel { get; set; } = true;++ /// <summary>+ /// Keys that never flip the donut: Esc closes it, Enter and Space convert or open a group, the arrows move between+ /// slices and Backspace folds a group's ring.+ /// </summary>+ public static readonly IReadOnlySet<string> ReservedFlipKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase)+ {+ "Escape", "Enter", "Space", "Left", "Right", "Up", "Down", "Backspace",+ };++ /// <summary>+ /// Whether <paramref name="key"/> may flip the donut: not a key the donut uses (<see cref="ReservedFlipKeys"/>), nor+ /// the key of a keyboard shortcut in <paramref name="gestures"/>. While a drag holds its modifier that shortcut would+ /// fire too, and open the donut for the selected files instead.+ /// </summary>+ public static bool IsFlipKeyAllowed(string key, IEnumerable<TriggerGesture> gestures) =>+ !string.IsNullOrWhiteSpace(key) && !ReservedFlipKeys.Contains(key) &&+ !gestures.Any(g => g.Kind == TriggerKind.KeyChord && string.Equals(g.Key, key, StringComparison.OrdinalIgnoreCase));++ /// <summary>+ /// The key that flips the donut now: none when the user cleared it; Tab in place of one that isn't allowed (a file+ /// edited by hand, or a keyboard shortcut that took the key since), or none when Tab isn't either.+ /// </summary>+ public string? EffectiveFlipKey(IEnumerable<TriggerGesture> gestures)+ {+ if (string.IsNullOrWhiteSpace(FlipKey))+ return null;+ var list = gestures as IReadOnlyCollection<TriggerGesture> ?? gestures.ToList();+ if (IsFlipKeyAllowed(FlipKey.Trim(), list))+ return FlipKey.Trim();+ return IsFlipKeyAllowed(DefaultFlipKey, list) ? DefaultFlipKey : null;+ }+public DonutSettings Clone() => (DonutSettings)MemberwiseClone();}diff --git a/tests/Filee.App.Tests/DonutFlipTests.cs b/tests/Filee.App.Tests/DonutFlipTests.csindex 6c3aae70..ebe23515 100644--- a/tests/Filee.App.Tests/DonutFlipTests.cs+++ b/tests/Filee.App.Tests/DonutFlipTests.cs@@ -41,15 +41,20 @@ public class DonutFlipTests/// Runs <paramref name="test"/> with animations on or off and the image donut's back face as given (null: the/// built-in one); everything is put back afterwards./// </summary>- private static void With(bool animations, List<string>? back, Action test, string language = "en")+ private static void With(bool animations, List<string>? back, Action test, string language = "en", string? flipKey = null,+ bool? wheel = null){TestServices.EnsureInitialized(language);var images = Images;var (front, before) = (images.PresetIds.ToList(), images.BackPresetIds?.ToList());+ var donut = Store.Settings.Donut;+ var (keyBefore, wheelBefore) = (donut.FlipKey, donut.FlipWithWheel);try{if (back is not null)images.BackPresetIds = back;+ donut.FlipKey = flipKey ?? DonutSettings.DefaultFlipKey;+ donut.FlipWithWheel = wheel ?? true;Motion.Configure(!animations, () => false);test();}@@ -58,6 +63,7 @@ public class DonutFlipTestsMotion.Configure(false, () => false);images.PresetIds = front;images.BackPresetIds = before;+ (donut.FlipKey, donut.FlipWithWheel) = (keyBefore, wheelBefore);}}@@ -85,7 +91,7 @@ public class DonutFlipTestsvar (vm, window, donut) = OpenClickMode();var front = vm.Items.Select(i => i.Id).ToList();Assert.True(vm.CanFlip);- Assert.Equal(loc["donut.flip_to_back"], vm.FlipHint);+ Assert.Equal(loc.Format("donut.flip_to_back", "Tab"), vm.FlipHint);Assert.Equal(vm.FlipHint, donut.CenterHint);Assert.True(donut.HandleKey(Key.Tab));@@ -98,7 +104,7 @@ public class DonutFlipTestsdonut.Advance(DonutMenu.FlipDuration * 0.3); // past edge-on: the backAssert.True(vm.IsBackFace);Assert.Equal(ImageBack, vm.Items.Select(i => i.Id));- Assert.Equal(loc["donut.flip_to_front"], donut.CenterHint);+ Assert.Equal(loc.Format("donut.flip_to_front", "Tab"), donut.CenterHint);Assert.Equal(loc["donut.close_hint"], vm.CenterSubtitle);donut.Advance(DonutMenu.FlipDuration);Assert.False(donut.IsFlipping);@@ -335,6 +341,241 @@ public class DonutFlipTests}});+ /// <summary>Another flip key from Settings → Shortcuts: it flips, Tab no longer does, and the hub names it.</summary>+ [AvaloniaFact]+ public void A_flip_key_from_the_settings_flips_in_click_mode_and_tab_no_longer_does() =>+ With(animations: false, back: null, flipKey: "F2", test: () =>+ {+ var loc = AppHost.Get<ILocalizer>();+ var (vm, window, donut) = OpenClickMode();+ Assert.Equal("F2", donut.FlipKey);+ Assert.Equal(loc.Format("donut.flip_to_back", "F2"), vm.FlipHint);+ Assert.False(vm.FlipHintWheel);++ Assert.False(donut.HandleKey(Key.Tab)); // the window's again+ Assert.False(vm.IsBackFace);+ Assert.True(donut.HandleKey(Key.F2, KeyModifiers.Shift));+ Assert.True(vm.IsBackFace);+ Assert.Equal(loc.Format("donut.flip_to_front", "F2"), vm.FlipHint);+ window.Close();+ });++ /// <summary>No key, the wheel on: the hub shows a mouse; neither: no hint and the donut doesn't flip by input.</summary>+ [AvaloniaFact]+ public void The_hub_shows_a_mouse_when_only_the_wheel_flips_and_nothing_when_nothing_does() =>+ With(animations: false, back: null, flipKey: "", wheel: true, test: () =>+ {+ var (vm, window, donut) = OpenClickMode();+ Assert.Null(donut.FlipKey);+ Assert.True(vm.FlipHintWheel);+ Assert.Equal(AppHost.Get<ILocalizer>().Format("donut.flip_to_back", "").Trim(), vm.FlipHint);+ Assert.False(donut.HandleKey(Key.Tab));+ RenderTests.Pump();+ RenderTests.Save(window, "donut-front-hint-wheel-en.png");+ window.Close();++ Store.Settings.Donut.FlipWithWheel = false;+ (vm, window, donut) = OpenClickMode();+ Assert.True(vm.CanFlip);+ Assert.Null(vm.FlipHint);+ Assert.False(vm.FlipHintWheel);+ Assert.False(donut.FlipWithWheel);+ window.MouseWheel(new Point(window.Bounds.Width / 2, window.Bounds.Height / 2), new Vector(0, -1));+ Dispatcher.UIThread.RunJobs();+ Assert.False(vm.IsBackFace);+ window.Close();+ });++ /// <summary>+ /// One flip per turn of the wheel: the notches of one turn (and a touchpad's many small steps) come close together,+ /// and a fast scroll mustn't flip back and forth. A pause starts a new turn.+ /// </summary>+ [AvaloniaFact]+ public void The_wheel_flips_once_per_turn() => With(animations: false, back: null, test: () =>+ {+ var (vm, window, donut) = OpenClickMode();+ Assert.True(donut.FlipWithWheel);+ Assert.True(donut.FlipFromWheel(10_000));+ Assert.True(vm.IsBackFace);+ Assert.False(donut.FlipFromWheel(10_040)); // the same turn+ Assert.False(donut.FlipFromWheel(10_200));+ Assert.False(donut.FlipFromWheel(10_450)); // still: 250 ms after the last notch+ Assert.True(vm.IsBackFace);+ Assert.True(donut.FlipFromWheel(10_450 + DonutMenu.WheelQuietMs)); // a new turn after a pause+ Assert.False(vm.IsBackFace);++ // Click mode: the wheel over the donut, as the window gets it.+ var over = new Point(window.Bounds.Width / 2, window.Bounds.Height / 2);+ Thread.Sleep((int)DonutMenu.WheelQuietMs + 50); // a new turn by the clock the window's wheel uses+ window.MouseWheel(over, new Vector(0, -1));+ window.MouseWheel(over, new Vector(0, -1));+ window.MouseWheel(over, new Vector(0, 1));+ Dispatcher.UIThread.RunJobs();+ Assert.True(vm.IsBackFace);+ window.Close();+ });++ /// <summary>Drag mode: the wheel and another flip key come from the global hook while the drag donut shows files.</summary>+ [AvaloniaFact]+ public void In_drag_mode_the_wheel_and_the_set_key_from_the_global_hook_flip_the_donut() =>+ With(animations: false, back: null, flipKey: "F2", test: () =>+ {+ var provider = new TriggerServiceLifecycleTests.DelayedProvider();+ provider.AllowExit.Set();+ using var triggers = TriggerServiceLifecycleTests.Create(provider, () => { });+ triggers.Apply(Store.Settings);+ triggers.Start();+ Assert.True(SpinWait.SpinUntil(() => provider.Runs == 1, 2000));+ var vm = AppHost.Get<RadialViewModel>();+ var radial = new RadialController(vm, AppHost.Get<ConversionService>(), AppHost.Get<WindowService>(), Store,+ AppHost.Get<IPlatformServices>(), triggers, NullLogger<RadialController>.Instance);+ var folder = Directory.CreateTempSubdirectory("filee-flip-");+ try+ {+ var file = Path.Combine(folder.FullName, "photo.jpg");+ File.WriteAllBytes(file, [0xFF, 0xD8, 0xFF]);+ radial.ShowForDrag(400, 400);+ var window = radial.Window!;+ RenderTests.Pump(); // laid out: the drag enters where the donut is+ var data = new DataTransfer();+ data.Add(DataTransferItem.CreateFile(window.StorageProvider.TryGetFileFromPathAsync(file).GetAwaiter().GetResult()!));+ window.DragDrop(new Point(window.Bounds.Width / 2 + 60, window.Bounds.Height / 2), RawDragEventType.DragEnter, data,+ DragDropEffects.Copy, RawInputModifiers.Control);+ Dispatcher.UIThread.RunJobs();+ Assert.True(triggers.WatchFlipKey);++ // Tab isn't the flip key now; F2 is.+ provider.PostKey(EventType.KeyPressed, KeyCode.VcTab, EventMask.LeftCtrl);+ Assert.False(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));+ provider.PostKey(EventType.KeyPressed, KeyCode.VcF2, EventMask.LeftCtrl);+ Assert.True(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));+ provider.PostKey(EventType.KeyReleased, KeyCode.VcF2, EventMask.LeftCtrl);++ // A fast turn of the wheel, many notches: one flip. Sideways scrolling doesn't flip.+ Thread.Sleep((int)DonutMenu.WheelQuietMs + 50);+ for (var i = 0; i < 6; i++)+ provider.PostWheel(-120);+ Assert.False(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));+ Thread.Sleep((int)DonutMenu.WheelQuietMs + 50);+ provider.PostWheel(120, MouseWheelScrollDirection.Horizontal);+ Assert.False(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));+ Thread.Sleep((int)DonutMenu.WheelQuietMs + 50);+ provider.PostWheel(120);+ Assert.True(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));++ // The wheel switched off in the settings: it is left alone.+ Store.Settings.Donut.FlipWithWheel = false;+ triggers.Apply(Store.Settings);+ Thread.Sleep((int)DonutMenu.WheelQuietMs + 50);+ provider.PostWheel(-120);+ Assert.True(TriggerServiceLifecycleTests.Settle(() => vm.IsBackFace));++ radial.Close(animate: false);+ window.Close();+ }+ finally+ {+ folder.Delete(recursive: true);+ }+ });++ /// <summary>+ /// Settings → Shortcuts records the flip key: modifiers alone wait for a key; Esc, Enter, Space, the arrows and the+ /// key of a keyboard shortcut are refused with the reason; another key is saved. "Use Tab", "Clear" and the wheel+ /// switch are saved too.+ /// </summary>+ [AvaloniaTheory]+ [InlineData("en", false)]+ [InlineData("ko", false)]+ [InlineData("ja", true)]+ public void The_flip_key_is_recorded_and_checked_in_the_shortcut_settings(string language, bool dark) =>+ With(animations: false, back: null, language: language, test: () =>+ {+ var loc = AppHost.Get<ILocalizer>();+ var theme = AppHost.Get<ThemeService>();+ var triggersBefore = Store.Settings.Triggers.Select(t => t.Clone()).ToList();+ Avalonia.Controls.Window? window = null;+ try+ {+ Store.Settings.Triggers.Add(new TriggerGesture { Kind = TriggerKind.KeyChord, Modifiers = Filee.Core.Settings.ModifierKeys.Ctrl, Key = "K" });+ if (dark)+ theme.Apply(new ThemeSettings { Mode = ThemeMode.Dark }, language);+ var page = new TriggersPageViewModel(Store, loc);+ var flip = page.Flip;+ Assert.Equal("Tab", flip.KeyText);+ Assert.True(flip.FlipWithWheel);++ flip.IsRecording = true;+ Assert.Equal(loc["triggers.recording_key"], flip.KeyText);+ Assert.False(flip.Record(Key.LeftCtrl)); // waits for a real key+ Assert.True(flip.IsRecording);+ foreach (var refused in new[] { Key.Escape, Key.Enter, Key.Space, Key.Left, Key.K })+ {+ flip.IsRecording = true;+ Assert.True(flip.Record(refused));+ Assert.False(flip.IsRecording);+ Assert.NotNull(flip.Error);+ Assert.Equal("Tab", Store.Settings.Donut.FlipKey);+ }+ Assert.Equal(loc.Format("triggers.flip_key_taken", "K"), flip.Error);++ window = new Avalonia.Controls.Window+ {+ Content = new Filee.App.Views.Pages.TriggersPage { DataContext = page }, Width = 820, Height = 1500,+ };+ window.Show();+ RenderTests.Pump();+ Assert.Single(window.GetVisualDescendants().OfType<Avalonia.Controls.Border>(), b => b.Name == "FlipCard");+ RenderTests.Save(window, $"triggers-flip-refused-{language}{(dark ? "-dark" : "")}.png");++ // Recorded on the button itself, as the user does it.+ var recorder = window.GetVisualDescendants().OfType<Avalonia.Controls.Primitives.ToggleButton>().Single(b => b.Name == "FlipRecorder");+ flip.IsRecording = true;+ recorder.Focus();+ window.KeyPress(Key.F2, RawInputModifiers.Control, PhysicalKey.F2, null);+ Dispatcher.UIThread.RunJobs();+ Assert.False(flip.IsRecording);+ Assert.Null(flip.Error);+ Assert.Equal("F2", Store.Settings.Donut.FlipKey);+ Assert.Equal("F2", flip.KeyText);+ Assert.Equal("F2", new UserDataStoreProbe(TestServices.DataDirectory).FlipKey); // saved+ RenderTests.Pump();+ RenderTests.Save(window, $"triggers-flip-{language}{(dark ? "-dark" : "")}.png");++ var wheel = window.GetVisualDescendants().OfType<Avalonia.Controls.ToggleSwitch>().Single(t => t.Name == "FlipWheel");+ wheel.IsChecked = false;+ Assert.False(Store.Settings.Donut.FlipWithWheel);+ flip.ClearKeyCommand.Execute(null);+ Assert.Equal("", Store.Settings.Donut.FlipKey);+ Assert.Equal("—", flip.KeyText);+ flip.ResetKeyCommand.Execute(null);+ Assert.Equal("Tab", Store.Settings.Donut.FlipKey);+ }+ finally+ {+ window?.Close();+ if (dark)+ theme.Apply(new ThemeSettings(), language);+ Store.Settings.Triggers.Clear();+ Store.Settings.Triggers.AddRange(triggersBefore);+ Store.Settings.Donut.FlipWithWheel = true;+ Store.SaveSettings();+ }+ });++ /// <summary>The settings as saved on disk, read by a second store.</summary>+ private sealed class UserDataStoreProbe(string directory)+ {+ public string FlipKey { get; } = Load(directory).Settings.Donut.FlipKey;++ private static UserDataStore Load(string directory)+ {+ var store = new UserDataStore(directory);+ store.Load();+ return store;+ }+ }+/// <summary>The image donut's back face, light and dark, and the ring halfway through its turn.</summary>[AvaloniaTheory][InlineData("en", false)]diff --git a/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs b/tests/Filee.App.Tests/TriggerServiceLifecycleTests.csindex 212e064f..61e955a7 100644--- a/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs+++ b/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs@@ -261,6 +261,19 @@ public sealed class TriggerServiceLifecycleTests}}+ public void PostWheel(short rotation, MouseWheelScrollDirection direction = MouseWheelScrollDirection.Vertical)+ {+ lock (_gate)+ {+ var e = new UioHookEvent+ {+ Type = EventType.MouseWheel,+ Wheel = new MouseWheelEventData { Rotation = rotation, Delta = 1, Direction = direction },+ };+ _callback?.Invoke(ref e, _data);+ }+ }+public void PressKey(){lock (_gate)diff --git a/tests/Filee.Core.Tests/BackFaceTests.cs b/tests/Filee.Core.Tests/BackFaceTests.csindex 56c948bd..41dc146e 100644--- a/tests/Filee.Core.Tests/BackFaceTests.cs+++ b/tests/Filee.Core.Tests/BackFaceTests.cs@@ -216,6 +216,61 @@ public class BackFaceTestsAssert.Equal(["to-gif"], Profile(store, "pdf").BackPresetIds);}+ [Fact]+ public void The_flip_key_and_the_wheel_are_saved_and_older_settings_get_tab_and_the_wheel()+ {+ using var dir = new TempDir();+ var path = Path.Combine(dir.Path, "settings.json");+ File.WriteAllText(path, """{ "schemaVersion": 24, "donut": { "outerRadius": 180 } }""");+ var store = NewStore(dir);+ Assert.Equal("Tab", store.Settings.Donut.FlipKey);+ Assert.True(store.Settings.Donut.FlipWithWheel);+ Assert.Equal(180, store.Settings.Donut.OuterRadius);++ store.Settings.Donut.FlipKey = "F2";+ store.Settings.Donut.FlipWithWheel = false;+ store.SaveSettings();+ var reloaded = NewStore(dir);+ Assert.Equal("F2", reloaded.Settings.Donut.FlipKey);+ Assert.False(reloaded.Settings.Donut.FlipWithWheel);++ // Cleared: no key, saved as such (not back to Tab).+ reloaded.Settings.Donut.FlipKey = "";+ reloaded.SaveSettings();+ Assert.Null(NewStore(dir).Settings.Donut.EffectiveFlipKey([]));+ }++ [Theory]+ [InlineData("Tab", true)]+ [InlineData("F2", true)]+ [InlineData("Q", true)]+ [InlineData("Escape", false)] // closes the donut+ [InlineData("Enter", false)] // converts / opens a group+ [InlineData("Space", false)]+ [InlineData("Left", false)] // moves between slices+ [InlineData("Backspace", false)] // folds a group's ring+ [InlineData("K", false)] // the key of a keyboard shortcut below+ [InlineData("", false)]+ public void Keys_the_donut_or_a_shortcut_uses_do_not_flip(string key, bool allowed)+ {+ TriggerGesture[] gestures =+ [+ new() { Kind = TriggerKind.Drag, Modifiers = ModifierKeys.Ctrl },+ new() { Kind = TriggerKind.KeyChord, Modifiers = ModifierKeys.Ctrl | ModifierKeys.Shift, Key = "K" },+ ];+ Assert.Equal(allowed, DonutSettings.IsFlipKeyAllowed(key, gestures));+ }++ [Fact]+ public void A_flip_key_that_is_not_allowed_falls_back_to_tab()+ {+ TriggerGesture[] chordOnF2 = [new() { Kind = TriggerKind.KeyChord, Key = "F2" }];+ Assert.Equal("Tab", new DonutSettings { FlipKey = "Escape" }.EffectiveFlipKey([]));+ Assert.Equal("Tab", new DonutSettings { FlipKey = "F2" }.EffectiveFlipKey(chordOnF2)); // a shortcut took it since+ Assert.Equal("F2", new DonutSettings { FlipKey = "F2" }.EffectiveFlipKey([]));+ Assert.Null(new DonutSettings { FlipKey = "Escape" }.EffectiveFlipKey([new() { Kind = TriggerKind.KeyChord, Key = "Tab" }]));+ }+[Fact]public void A_bundle_from_before_back_faces_imports_built_in_donuts_with_theirs(){