fix(app): editor review fixes for saving, undo, preview, commands and layout

- Undo/redo snapshots take outside changes (advice, merged edits) on Replace;
  a drag, click or key press ends a merged run; Reset to Auto is its own step.
- A failed save stays pending and is retried with backoff; closing or switching
  asks before discarding it; the local source throws unless the index took it.
- Opening a sequence survives any failure; the window title follows the editor;
  the job bar hides when idle in the editor.
- Render, Add to queue and Batch re-read their state; disabled commands say why;
  Analyse is disabled while queued and announces its cost and Ctrl+Shift+A.
- Preview: 1:1 and wheel zoom render the source's own pixels, the view keeps its
  place across resolutions, crop mask result mode, unreadable frames say so,
  labelled tools, keyboard focus on open, tools hidden on Export lose their effect.
- Preparation re-solves from measured series (no re-decode per slider step) with
  a half-precision frame cache.
- Exposure flicker and waveform charts, Time plan chart, Camera crop margins,
  sortable frame table, wrapped findings, responsive preset cards, render-done
  follow-up, Jobs history filtered on the sequence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-03 10:36:50 +00:00
1 parent 596b748c5c
commit 25e85aee57
32 files changed
+1612 -369

No files matched your search

+80 -5
View File
@@ -8,15 +8,50 @@ using Titano.Ui.Mvvm;
namespace Titano.App.Editor;
/// <summary>Columns of the Frames table, each sortable (DESIGN §4 tables).</summary>
public enum FrameSort
{
Number,
Time,
Exposure,
Iso,
Aperture,
Size,
Tier,
Flags,
}
/// <summary>A sortable column header of the Frames table: its sort state and the command that sorts on it.</summary>
public sealed class FrameColumn(FramesTab owner, FrameSort sort) : ObservableObject
{
public FrameSort Sort { get; } = sort;
public bool IsSorted => owner.SortBy == Sort;
public bool IsDescending => IsSorted && owner.SortDescending;
public ICommand SortCommand { get; } = new RelayCommand(() => owner.SortOn(sort));
public void Refresh()
{
OnPropertyChanged(nameof(IsSorted));
OnPropertyChanged(nameof(IsDescending));
}
}
/// <summary>One frame of the Frames table; texts are formatted when shown (the table is virtualised).</summary>
public sealed class FrameRow(FramesTab owner, Frame frame, int index) : ObservableObject
{
/// <summary>Archive flags named in the table (the others are internal or shown elsewhere).</summary>
public const FrameFlags Shown = FrameFlags.Missing | FrameFlags.Corrupt | FrameFlags.Duplicate | FrameFlags.Undecodable | FrameFlags.Black | FrameFlags.White;
private static readonly FrameFlags[] ShownFlags =
[FrameFlags.Missing, FrameFlags.Corrupt, FrameFlags.Duplicate, FrameFlags.Undecodable, FrameFlags.Black, FrameFlags.White];
public int Index { get; } = index;
public Frame Frame => frame;
public string Number => (Index + 1).ToString("D4", Loc.Culture);
public string Time => frame.CapturedAt?.ToString("T", Loc.Culture) ?? string.Empty;
@@ -79,6 +114,7 @@ public sealed class FramesTab : EditorTab
{
private HashSet<int> _excluded = [];
private int? _hero;
private FrameRow[] _rows = [];
private IReadOnlyList<FrameRow> _frames = [];
private IReadOnlyList<FindingItem> _findings = [];
private FrameRow? _selected;
@@ -92,11 +128,20 @@ public sealed class FramesTab : EditorTab
{
if (p is FindingItem { Frame: { } frame }) Editor.CurrentIndex = frame;
});
Columns = [.. Enum.GetValues<FrameSort>().Select(c => new FrameColumn(this, c))];
Load();
}
/// <summary>Rows in the table's order (<see cref="SortBy"/>).</summary>
public IReadOnlyList<FrameRow> Frames { get => _frames; private set => Set(ref _frames, value); }
/// <summary>Column headers in <see cref="FrameSort"/> order.</summary>
public IReadOnlyList<FrameColumn> Columns { get; }
public FrameSort SortBy { get; private set; } = FrameSort.Number;
public bool SortDescending { get; private set; }
public IReadOnlyList<FindingItem> Findings
{
get => _findings;
@@ -143,6 +188,15 @@ public sealed class FramesTab : EditorTab
public bool IsExcluded(int index) => _excluded.Contains(index);
/// <summary>Sorts the table on <paramref name="column"/>; the same column again reverses the order.</summary>
public void SortOn(FrameSort column)
{
SortDescending = column == SortBy && !SortDescending;
SortBy = column;
Frames = Sorted();
foreach (var header in Columns) header.Refresh();
}
public override void Refresh()
{
base.Refresh();
@@ -157,7 +211,7 @@ public sealed class FramesTab : EditorTab
_hero = project.HeroFrame;
foreach (var index in changed)
{
if ((uint)index < (uint)Frames.Count) Frames[index].Refresh();
if ((uint)index < (uint)_rows.Length) _rows[index].Refresh();
}
OnPropertyChanged(nameof(HeroText));
OnPropertyChanged(nameof(ExcludedText));
@@ -170,12 +224,12 @@ public sealed class FramesTab : EditorTab
base.OnContentChanged();
}
public void OnCurrentFrameChanged()
public override void OnCurrentFrameChanged()
{
var index = Editor.CurrentIndex;
if ((uint)index < (uint)Frames.Count && !ReferenceEquals(_selected, Frames[index]))
if ((uint)index < (uint)_rows.Length && !ReferenceEquals(_selected, _rows[index]))
{
_selected = Frames[index];
_selected = _rows[index];
OnPropertyChanged(nameof(Selected));
}
OnPropertyChanged(nameof(IsCurrentExcluded));
@@ -188,12 +242,33 @@ public sealed class FramesTab : EditorTab
var content = Editor.Session.Content;
_excluded = Editor.Session.Project.ExcludedFrames.ToHashSet();
_hero = Editor.Session.Project.HeroFrame;
Frames = [.. content.Frames.Select((f, i) => new FrameRow(this, f, i))];
_rows = [.. content.Frames.Select((f, i) => new FrameRow(this, f, i))];
Frames = Sorted();
Findings = [.. Editor.Session.Advice.Findings.OrderByDescending(f => f.Severity).Select(ToItem)];
_selected = null;
OnCurrentFrameChanged();
}
private IReadOnlyList<FrameRow> Sorted()
{
IEnumerable<FrameRow> rows = SortBy switch
{
FrameSort.Time => _rows.OrderBy(r => r.Frame.CapturedAt),
FrameSort.Exposure => _rows.OrderBy(r => r.Frame.ExposureTime),
FrameSort.Iso => _rows.OrderBy(r => r.Frame.Iso),
FrameSort.Aperture => _rows.OrderBy(r => r.Frame.FNumber),
FrameSort.Size => _rows.OrderBy(r => (long)r.Frame.Width * r.Frame.Height),
FrameSort.Tier => _rows.OrderBy(r => r.Tier, StringComparer.CurrentCulture),
// Flagged frames together: excluded first, then by how many archive flags they carry.
FrameSort.Flags => _rows.OrderBy(r => (r.IsExcluded ? 0 : 1) * 64 - BitCount(r.Frame.Flags & FrameRow.Shown)),
_ => _rows,
};
if (SortBy != FrameSort.Number && rows is IOrderedEnumerable<FrameRow> ordered) rows = ordered.ThenBy(r => r.Index);
return SortDescending ? [.. rows.Reverse()] : [.. rows];
}
private static int BitCount(FrameFlags flags) => System.Numerics.BitOperations.PopCount((uint)flags);
private static FindingItem ToItem(Finding finding) => new(
finding.Severity switch
{