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:
32 files changed
+1612
-369
No files matched your search
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Core.Export;
|
||||
@@ -14,7 +14,8 @@ namespace Titano.App.Sections;
|
||||
|
||||
/// <summary>
|
||||
/// The Sequence section (BRIEF §12.3): opens the sequence the Library (or Jobs) chose into an <see cref="EditorViewModel"/>
|
||||
/// and closes the previous one after saving it; without a sequence it shows the empty state.
|
||||
/// and closes the previous one after saving it; without a sequence it shows the empty state. A failed open is reported
|
||||
/// and leaves the section usable; an edit that cannot be saved is never dropped without the user's confirmation.
|
||||
/// </summary>
|
||||
public sealed class SequenceViewModel : SectionViewModel
|
||||
{
|
||||
@@ -51,7 +52,7 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
|
||||
public bool IsEmpty => _editor is null && !_isLoading;
|
||||
|
||||
/// <summary>The open sequence has an edit not stored yet (the save follows each change after a moment).</summary>
|
||||
/// <summary>The open sequence has an edit not stored yet (the save follows each change after a moment, and retries after a failure).</summary>
|
||||
public bool HasPendingSave => _editor?.Session.HasPendingSave == true;
|
||||
|
||||
/// <summary>"Titano — Harbour sunset" while a sequence is open.</summary>
|
||||
@@ -64,10 +65,30 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
return _switch;
|
||||
}
|
||||
|
||||
/// <summary>Saves and closes the open sequence.</summary>
|
||||
/// <summary>
|
||||
/// Stores the open sequence's last edit. When the save fails (archive offline, read-only, busy), asks whether to
|
||||
/// discard the edit (BRIEF §12.1: modals only for destructive confirmations).
|
||||
/// </summary>
|
||||
/// <returns>True when the editor may close: everything is stored or the user chose to discard.</returns>
|
||||
public async Task<bool> ConfirmCloseAsync()
|
||||
{
|
||||
if (Editor is not { } editor || await editor.Session.FlushAsync()) return true;
|
||||
return Shell.Services.Dialogs.Confirm(new ConfirmRequest
|
||||
{
|
||||
Heading = Loc.L("Editor.Unsaved.Title"),
|
||||
Message = Loc.L("Editor.Unsaved.Message", editor.Title, editor.Session.LastSaveError?.Message ?? string.Empty),
|
||||
SafeText = Loc.L("Editor.Unsaved.Keep"),
|
||||
SafeToolTip = Loc.L("Tooltips.Editor.Unsaved.Keep"),
|
||||
ActionText = Loc.L("Editor.Unsaved.Discard"),
|
||||
ActionToolTip = Loc.L("Tooltips.Editor.Unsaved.Discard"),
|
||||
IsDestructive = true,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Closes the open sequence (after <see cref="ConfirmCloseAsync"/>, which stores its last edit).</summary>
|
||||
public async Task CloseAsync()
|
||||
{
|
||||
await _switch;
|
||||
await Settled(_switch);
|
||||
if (Editor is not { } editor) return;
|
||||
Editor = null;
|
||||
_openId = null;
|
||||
@@ -91,10 +112,25 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
if (e.PropertyName == nameof(ShellViewModel.CurrentSequenceId) && IsSelected) OnActivated();
|
||||
}
|
||||
|
||||
/// <summary>Waits for <paramref name="task"/>; its failure was reported where it happened.</summary>
|
||||
private static async Task Settled(Task task)
|
||||
{
|
||||
try
|
||||
{
|
||||
await task;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
Log.Debug("editor", $"An earlier open of the editor failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SwitchAsync(Task previous, Guid sequenceId)
|
||||
{
|
||||
await previous;
|
||||
await Settled(previous);
|
||||
if (sequenceId == _openId) return;
|
||||
// The open sequence keeps its editor while its last edit is neither stored nor deliberately discarded.
|
||||
if (!await ConfirmCloseAsync()) return;
|
||||
var services = Shell.Services;
|
||||
IsLoading = true;
|
||||
OnPropertyChanged(nameof(IsEmpty));
|
||||
@@ -117,9 +153,11 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
Editor = editor;
|
||||
await editor.AttachJobsAsync();
|
||||
}
|
||||
catch (Exception ex) when (ex is InvalidDataException or InvalidOperationException or IOException or UnauthorizedAccessException)
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
_openId = null;
|
||||
// Whatever failed (index, decoder set-up, advisor, the job list), the section stays usable: an editor that
|
||||
// opened stays open, otherwise the next Open tries again.
|
||||
if (Editor is null) _openId = null;
|
||||
Log.Warning("editor", $"Sequence {sequenceId} could not be opened", ex);
|
||||
Shell.ReportError(ex);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user