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

+32
View File
@@ -13,6 +13,10 @@
<data name="Editor.Camera.Aspect" xml:space="preserve"><value>Aspect</value></data>
<data name="Editor.Camera.CenterX" xml:space="preserve"><value>Horizontal centre</value></data>
<data name="Editor.Camera.CenterY" xml:space="preserve"><value>Vertical centre</value></data>
<data name="Editor.Camera.CropBottom" xml:space="preserve"><value>Crop bottom</value></data>
<data name="Editor.Camera.CropLeft" xml:space="preserve"><value>Crop left</value></data>
<data name="Editor.Camera.CropRight" xml:space="preserve"><value>Crop right</value></data>
<data name="Editor.Camera.CropTop" xml:space="preserve"><value>Crop top</value></data>
<data name="Editor.Camera.Curve" xml:space="preserve"><value>Keyframes</value></data>
<data name="Editor.Camera.KeyOf" xml:space="preserve"><value>Keyframe {0} of {1} · {2}</value></data>
<data name="Editor.Camera.Keys.one" xml:space="preserve"><value>{0} keyframe</value></data>
@@ -22,18 +26,30 @@
<data name="Editor.Camera.RemoveKey" xml:space="preserve"><value>Remove keyframe</value></data>
<data name="Editor.Camera.Zoom" xml:space="preserve"><value>Zoom</value></data>
<data name="Editor.Chart.Clouds" xml:space="preserve"><value>cloud cover %</value></data>
<data name="Editor.Chart.Flicker" xml:space="preserve"><value>Flicker</value></data>
<data name="Editor.Chart.FlickerAfter" xml:space="preserve"><value>change after correction</value></data>
<data name="Editor.Chart.FlickerBefore" xml:space="preserve"><value>frame-to-frame change</value></data>
<data name="Editor.Chart.Level0" xml:space="preserve"><value>0 %</value></data>
<data name="Editor.Chart.Level100" xml:space="preserve"><value>100 %</value></data>
<data name="Editor.Chart.Level50" xml:space="preserve"><value>50 %</value></data>
<data name="Editor.Chart.Luminance" xml:space="preserve"><value>Luminance</value></data>
<data name="Editor.Chart.Measured" xml:space="preserve"><value>measured luminance</value></data>
<data name="Editor.Chart.NotAnalysed" xml:space="preserve"><value>Not analysed yet</value></data>
<data name="Editor.Chart.PathX" xml:space="preserve"><value>horizontal path</value></data>
<data name="Editor.Chart.PathY" xml:space="preserve"><value>vertical path</value></data>
<data name="Editor.Chart.Shown" xml:space="preserve"><value>video frames per photo</value></data>
<data name="Editor.Chart.Sky" xml:space="preserve"><value>sky region</value></data>
<data name="Editor.Chart.Stars" xml:space="preserve"><value>stars per Mpx</value></data>
<data name="Editor.Chart.Steps" xml:space="preserve"><value>exposure steps as received</value></data>
<data name="Editor.Chart.Switch" xml:space="preserve"><value>Chart</value></data>
<data name="Editor.Chart.Target" xml:space="preserve"><value>target curve</value></data>
<data name="Editor.Chart.Waveform" xml:space="preserve"><value>Waveform</value></data>
<data name="Editor.Chart.WaveformOf" xml:space="preserve"><value>luma of frame {0}</value></data>
<data name="Editor.Empty" xml:space="preserve"><value>Pick a sequence in the Library</value></data>
<data name="Editor.Error.Missing" xml:space="preserve"><value>This sequence is no longer in the archive.</value><comment>long</comment></data>
<data name="Editor.Error.NoEngine" xml:space="preserve"><value>Jobs cannot run until the archive index is open.</value><comment>long</comment></data>
<data name="Editor.Error.Project" xml:space="preserve"><value>The settings of this sequence cannot be read.</value><comment>long</comment></data>
<data name="Editor.Error.SaveConflict" xml:space="preserve"><value>The settings of this sequence were changed elsewhere at the same time.</value><comment>long</comment></data>
<data name="Editor.Export.About" xml:space="preserve"><value>about {0}</value></data>
<data name="Editor.Export.AddToQueue" xml:space="preserve"><value>Add to queue</value></data>
<data name="Editor.Export.Batch" xml:space="preserve"><value>Batch…</value></data>
@@ -64,6 +80,7 @@
<data name="Editor.Export.RenderNow" xml:space="preserve"><value>Render now</value></data>
<data name="Editor.Export.Resolution" xml:space="preserve"><value>Resolution</value></data>
<data name="Editor.Export.Result" xml:space="preserve"><value>Result</value></data>
<data name="Editor.Export.Reveal" xml:space="preserve"><value>show file</value></data>
<data name="Editor.Export.SaveTo" xml:space="preserve"><value>Save to</value></data>
<data name="Editor.Export.SequenceFolder" xml:space="preserve"><value>Sequence exports/</value></data>
<data name="Editor.Export.Size" xml:space="preserve"><value>Estimated size</value></data>
@@ -116,6 +133,7 @@
<data name="Editor.Frames.SetHero" xml:space="preserve"><value>Set hero</value></data>
<data name="Editor.Frames.Warnings" xml:space="preserve"><value>Warnings</value></data>
<data name="Editor.Loading" xml:space="preserve"><value>Opening sequence</value></data>
<data name="Editor.Marker.Cut" xml:space="preserve"><value>Cut: pause or gap</value></data>
<data name="Editor.Marker.Keyframe" xml:space="preserve"><value>Keyframe</value></data>
<data name="Editor.Marker.Step" xml:space="preserve"><value>Exposure step {0} EV</value></data>
<data name="Editor.Marker.StepIgnored" xml:space="preserve"><value>Step {0} EV not received</value></data>
@@ -138,23 +156,30 @@
<data name="Editor.Preview.Clip" xml:space="preserve"><value>Preview 10 s</value></data>
<data name="Editor.Preview.Compare" xml:space="preserve"><value>Compare</value></data>
<data name="Editor.Preview.CropMask" xml:space="preserve"><value>Crop mask</value></data>
<data name="Editor.Preview.CropResult" xml:space="preserve"><value>Crop result</value></data>
<data name="Editor.Preview.ExitFullScreen" xml:space="preserve"><value>Exit full screen</value></data>
<data name="Editor.Preview.FullScreen" xml:space="preserve"><value>Full screen</value></data>
<data name="Editor.Preview.OutputSize" xml:space="preserve"><value>output {0}</value></data>
<data name="Editor.Preview.OutputTime" xml:space="preserve"><value>{0} of {1}</value></data>
<data name="Editor.Preview.Pause" xml:space="preserve"><value>Pause</value></data>
<data name="Editor.Preview.Play" xml:space="preserve"><value>Play</value></data>
<data name="Editor.Preview.Regions" xml:space="preserve"><value>Regions</value></data>
<data name="Editor.Preview.ShotData" xml:space="preserve"><value>Shot data</value></data>
<data name="Editor.Preview.Unreadable" xml:space="preserve"><value>This frame cannot be read.</value></data>
<data name="Editor.Preview.Vectors" xml:space="preserve"><value>Vectors</value></data>
<data name="Editor.Preview.Wipe" xml:space="preserve"><value>original | corrected</value></data>
<data name="Editor.Regions.Auto" xml:space="preserve"><value>Auto</value></data>
<data name="Editor.Regions.Horizon" xml:space="preserve"><value>Horizon</value></data>
<data name="Editor.Regions.Luminance" xml:space="preserve"><value>Luminance</value></data>
<data name="Editor.Render" xml:space="preserve"><value>Render · {0}</value></data>
<data name="Editor.Render.Done" xml:space="preserve"><value>Render finished</value></data>
<data name="Editor.Render.Queued" xml:space="preserve"><value>Render queued</value></data>
<data name="Editor.Render.Reveal" xml:space="preserve"><value>Show in folder</value></data>
<data name="Editor.RenderButton" xml:space="preserve"><value>Render</value></data>
<data name="Editor.Reset" xml:space="preserve"><value>Reset</value></data>
<data name="Editor.ResetToAuto" xml:space="preserve"><value>Back to Auto</value></data>
<data name="Editor.Save.Failed" xml:space="preserve"><value>Changes not saved</value></data>
<data name="Editor.Save.Retry" xml:space="preserve"><value>Retry</value></data>
<data name="Editor.Sections" xml:space="preserve"><value>Sections</value></data>
<data name="Editor.Shot.Aperture" xml:space="preserve"><value>f/{0}</value><comment>invariant</comment></data>
<data name="Editor.Shot.Focal" xml:space="preserve"><value>{0} mm</value><comment>invariant</comment></data>
@@ -170,6 +195,7 @@
<data name="Editor.Summary.Frames.one" xml:space="preserve"><value>{0:N0} frame</value></data>
<data name="Editor.Summary.Frames.other" xml:space="preserve"><value>{0:N0} frames</value></data>
<data name="Editor.Summary.Interval" xml:space="preserve"><value>{0} s interval</value></data>
<data name="Editor.Summary.Source" xml:space="preserve"><value>source {0}</value></data>
<data name="Editor.Summary.Warnings.one" xml:space="preserve"><value>{0} warning</value></data>
<data name="Editor.Summary.Warnings.other" xml:space="preserve"><value>{0} warnings</value></data>
<data name="Editor.Tab.Camera" xml:space="preserve"><value>Camera</value></data>
@@ -185,13 +211,19 @@
<data name="Editor.Time.Output" xml:space="preserve"><value>output {0} %</value></data>
<data name="Editor.Time.Plan.one" xml:space="preserve"><value>{0:N0} frame → {1} · {2} fps</value><comment>long</comment></data>
<data name="Editor.Time.Plan.other" xml:space="preserve"><value>{0:N0} frames → {1} · {2} fps</value><comment>long</comment></data>
<data name="Editor.Time.PlanChart" xml:space="preserve"><value>Render plan</value></data>
<data name="Editor.Time.Rate" xml:space="preserve"><value>Playback rate</value></data>
<data name="Editor.Time.Source" xml:space="preserve"><value>source {0} %</value></data>
<data name="Editor.Timing.Adaptive" xml:space="preserve"><value>Adaptive</value></data>
<data name="Editor.Timing.Constant" xml:space="preserve"><value>Constant</value></data>
<data name="Editor.Timing.Interpolated" xml:space="preserve"><value>Interpolated</value></data>
<data name="Editor.Timing.Remapped" xml:space="preserve"><value>Remapped</value></data>
<data name="Editor.Unsaved.Discard" xml:space="preserve"><value>Discard change</value></data>
<data name="Editor.Unsaved.Keep" xml:space="preserve"><value>Keep editing</value></data>
<data name="Editor.Unsaved.Message" xml:space="preserve"><value>The last change to {0} could not be saved: {1}</value><comment>long</comment></data>
<data name="Editor.Unsaved.Title" xml:space="preserve"><value>Unsaved change</value></data>
<data name="Editor.Value.Centred" xml:space="preserve"><value>Centred</value></data>
<data name="Editor.Value.Degrees" xml:space="preserve"><value>{0}°</value><comment>invariant</comment></data>
<data name="Editor.Value.Ev" xml:space="preserve"><value>{0} EV</value><comment>invariant</comment></data>
<data name="Editor.Value.Fps" xml:space="preserve"><value>{0} fps</value><comment>invariant</comment></data>
<data name="Editor.Value.Frames.one" xml:space="preserve"><value>{0:N0} frame</value></data>
+30 -3
View File
@@ -15,7 +15,9 @@
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Dismiss</value></data>
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Open the folder with the log files</value></data>
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Return to the advisor's value</value></data>
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Read every frame again and refresh the analysis; runs as a background job</value></data>
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Read every frame again and refresh the analysis · Ctrl+Shift+A</value></data>
<data name="Tooltips.Editor.AnalyseCost" xml:space="preserve"><value>Read every frame again and refresh the analysis · about {0} · Ctrl+Shift+A</value></data>
<data name="Tooltips.Editor.AnalyseQueued" xml:space="preserve"><value>An analysis of this sequence is already queued or running</value></data>
<data name="Tooltips.Editor.Auto.Default" xml:space="preserve"><value>Auto: no advice yet, the engine’s default applies; Analyse lets the advisor decide</value></data>
<data name="Tooltips.Editor.Back" xml:space="preserve"><value>Back to Library</value></data>
<data name="Tooltips.Editor.Busy" xml:space="preserve"><value>An analysis or render of this sequence is running; settings wait until it ends</value></data>
@@ -23,14 +25,25 @@
<data name="Tooltips.Editor.Camera.Aspect" xml:space="preserve"><value>Output aspect ratio; a preset with a fixed size uses its own</value></data>
<data name="Tooltips.Editor.Camera.CenterX" xml:space="preserve"><value>Horizontal centre of the selected keyframe’s view</value></data>
<data name="Tooltips.Editor.Camera.CenterY" xml:space="preserve"><value>Vertical centre of the selected keyframe’s view</value></data>
<data name="Tooltips.Editor.Camera.Crop" xml:space="preserve"><value>Cuts this share of the frame on that side; aspect and placement then apply inside the crop</value></data>
<data name="Tooltips.Editor.Camera.Curve" xml:space="preserve"><value>Zoom keyframes over the sequence: double-click adds · drag moves · Delete removes · arrows nudge</value></data>
<data name="Tooltips.Editor.Camera.KeyExists" xml:space="preserve"><value>This frame already has a keyframe; select it on the curve to edit it</value></data>
<data name="Tooltips.Editor.Camera.Keys" xml:space="preserve"><value>Virtual-camera keyframes: zoom and framing at chosen frames, eased in between</value></data>
<data name="Tooltips.Editor.Camera.NoKey" xml:space="preserve"><value>Select a keyframe on the curve first</value></data>
<data name="Tooltips.Editor.Camera.OffsetX" xml:space="preserve"><value>Moves the crop left or right inside the frame</value></data>
<data name="Tooltips.Editor.Camera.OffsetY" xml:space="preserve"><value>Moves the crop up or down inside the frame</value></data>
<data name="Tooltips.Editor.Camera.RemoveKey" xml:space="preserve"><value>Remove the selected keyframe</value></data>
<data name="Tooltips.Editor.Camera.Zoom" xml:space="preserve"><value>Zoom of the selected keyframe; 1 shows the whole crop, more zooms in and softens</value></data>
<data name="Tooltips.Editor.Chart.Flicker" xml:space="preserve"><value>Frame-to-frame brightness change before and after the correction</value></data>
<data name="Tooltips.Editor.Chart.Luminance" xml:space="preserve"><value>Measured luminance against the target curve, sky region and exposure steps</value></data>
<data name="Tooltips.Editor.Chart.Plan" xml:space="preserve"><value>Video frames each photo is shown for, cuts marked · click shows that frame</value></data>
<data name="Tooltips.Editor.Chart.Seek" xml:space="preserve"><value>Click or drag to show that frame</value></data>
<data name="Tooltips.Editor.Chart.Waveform" xml:space="preserve"><value>Luma waveform of the frame on screen: exposure and clipping at a glance</value></data>
<data name="Tooltips.Editor.Chart.WaveformView" xml:space="preserve"><value>Luma of the corrected frame across the picture: white at the top, black at the bottom</value></data>
<data name="Tooltips.Editor.Export.AddToQueue" xml:space="preserve"><value>Add this render to the queue and keep editing</value></data>
<data name="Tooltips.Editor.Export.ApplyPreset" xml:space="preserve"><value>Apply this sequence preset to every section · {0}</value></data>
<data name="Tooltips.Editor.Export.Batch" xml:space="preserve"><value>Queue every ticked preset as one job; the sequence is prepared once</value></data>
<data name="Tooltips.Editor.Export.BatchEmpty" xml:space="preserve"><value>Tick presets on the cards first</value></data>
<data name="Tooltips.Editor.Export.BitRate" xml:space="preserve"><value>Average bit rate; more keeps detail and gradients, files grow</value></data>
<data name="Tooltips.Editor.Export.Codec" xml:space="preserve"><value>Video or image codec; 10-bit HEVC keeps sky gradients clean</value></data>
<data name="Tooltips.Editor.Export.Colour" xml:space="preserve"><value>Rec.709 colour; 10-bit avoids banding in skies, HDR is not offered</value></data>
@@ -41,7 +54,7 @@
<data name="Tooltips.Editor.Export.FrameRateAuto" xml:space="preserve"><value>Auto: the preset’s {0} fps</value></data>
<data name="Tooltips.Editor.Export.FrameRateReset" xml:space="preserve"><value>Return to the preset’s frame rate</value></data>
<data name="Tooltips.Editor.Export.Height" xml:space="preserve"><value>Output height in pixels; empty follows the width · Enter applies, Esc reverts</value></data>
<data name="Tooltips.Editor.Export.History" xml:space="preserve"><value>Open Jobs to see the renders of this sequence</value></data>
<data name="Tooltips.Editor.Export.History" xml:space="preserve"><value>Open Jobs filtered on this sequence</value></data>
<data name="Tooltips.Editor.Export.InBatch" xml:space="preserve"><value>Include this preset when Batch queues the render</value></data>
<data name="Tooltips.Editor.Export.Name" xml:space="preserve"><value>Tokens: {date} {title} {preset} {codec} {width} {height} {fps} · Enter applies, Esc reverts</value></data>
<data name="Tooltips.Editor.Export.Preset" xml:space="preserve"><value>Render with {0}; editing a value makes it Custom</value></data>
@@ -58,10 +71,12 @@
<data name="Tooltips.Editor.Exposure.Transitions" xml:space="preserve"><value>Frames over which each ISO, shutter or aperture step is spread; 0 keeps the steps</value></data>
<data name="Tooltips.Editor.Exposure.WhiteBalance" xml:space="preserve"><value>Smooths the colour ratios so auto white balance stops flickering while the sunset drift stays</value></data>
<data name="Tooltips.Editor.Exposure.Window" xml:space="preserve"><value>Frames used to estimate the flicker-free curve; too short leaves flicker, too long flattens real light changes</value></data>
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Click or drag to show a frame; markers show exposure steps, warnings and keyframes</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Leave this frame out of every render; the photo is not deleted</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Show the first frame concerned</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Use the frame as the sequence thumbnail</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Make this the hero frame; the editor opens on it</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Use this frame in renders again</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Sort by this column; click again to reverse</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Click a row to show the frame</value></data>
<data name="Tooltips.Editor.Motion.Blur" xml:space="preserve"><value>Adds blur along the motion like a slower shutter; costs optical flow on every frame</value></data>
<data name="Tooltips.Editor.Motion.Flow" xml:space="preserve"><value>Optical flow precision for blur and synthesised frames; Best is the slowest</value></data>
@@ -85,15 +100,24 @@
<data name="Tooltips.Editor.Preview.ActualSize" xml:space="preserve"><value>Show pixels at 1:1 without interpolation · Ctrl+1; Ctrl+0 fits</value></data>
<data name="Tooltips.Editor.Preview.Clip" xml:space="preserve"><value>Play ten seconds of the video’s frames with the current settings</value></data>
<data name="Tooltips.Editor.Preview.Compare" xml:space="preserve"><value>Wipe compare: original on the left, corrected on the right; drag the line</value></data>
<data name="Tooltips.Editor.Preview.CropLoss" xml:space="preserve"><value>Dim what the output cuts (what I lose)</value></data>
<data name="Tooltips.Editor.Preview.CropMask" xml:space="preserve"><value>Show the whole frame and darken what the output will cut</value></data>
<data name="Tooltips.Editor.Preview.CropResult" xml:space="preserve"><value>Hide what the output cuts (how it will look)</value></data>
<data name="Tooltips.Editor.Preview.ExitFullScreen" xml:space="preserve"><value>Close full screen · Esc</value></data>
<data name="Tooltips.Editor.Preview.FullScreen" xml:space="preserve"><value>Full screen at native resolution · Esc closes</value></data>
<data name="Tooltips.Editor.Preview.Regions" xml:space="preserve"><value>Show the sky and landscape boundary used by region deflicker</value></data>
<data name="Tooltips.Editor.Preview.ShotData" xml:space="preserve"><value>Show or hide the shot data</value></data>
<data name="Tooltips.Editor.Preview.Vectors" xml:space="preserve"><value>Overlay the motion to the next frame measured by the engine</value></data>
<data name="Tooltips.Editor.Preview.View" xml:space="preserve"><value>Drag the line to compare · drag to pan · wheel zooms · double-click 1:1</value></data>
<data name="Tooltips.Editor.Render" xml:space="preserve"><value>Render with the selected preset; progress in the job bar · Ctrl+R</value></data>
<data name="Tooltips.Editor.Render.NameError" xml:space="preserve"><value>Fix the file name first: {0}</value></data>
<data name="Tooltips.Editor.Render.NoFrames" xml:space="preserve"><value>Every frame is excluded: include some in the Frames tab</value></data>
<data name="Tooltips.Editor.Render.NoSource" xml:space="preserve"><value>The frame size is unknown: the frames could not be read</value></data>
<data name="Tooltips.Editor.Render.Planning" xml:space="preserve"><value>Working out the render; ready in a moment</value></data>
<data name="Tooltips.Editor.Render.Reveal" xml:space="preserve"><value>Show the rendered file in Explorer</value></data>
<data name="Tooltips.Editor.RenderChoice" xml:space="preserve"><value>Choose another preset</value></data>
<data name="Tooltips.Editor.ResetSection" xml:space="preserve"><value>Return every control of this section to Auto · Ctrl+Z undoes</value></data>
<data name="Tooltips.Editor.Save.Retry" xml:space="preserve"><value>Try to save now; saving is also retried automatically</value></data>
<data name="Tooltips.Editor.Stack.Length" xml:space="preserve"><value>Frames combined into each output frame; trails and smoothing grow with it</value></data>
<data name="Tooltips.Editor.Stack.Mode" xml:space="preserve"><value>Median and mean remove noise and moving things; star trails keep the brightest pixels</value></data>
<data name="Tooltips.Editor.Tab.Camera" xml:space="preserve"><value>Crop, aspect, virtual camera moves</value></data>
@@ -103,9 +127,12 @@
<data name="Tooltips.Editor.Tab.Motion" xml:space="preserve"><value>Motion blur, optical flow, stabilisation</value></data>
<data name="Tooltips.Editor.Tab.Stack" xml:space="preserve"><value>Median and star-trail stacking</value></data>
<data name="Tooltips.Editor.Tab.Time" xml:space="preserve"><value>Frame rate, timing mode, speed curve</value></data>
<data name="Tooltips.Editor.Time.Curve" xml:space="preserve"><value>Output time to source position: double-click adds a point · drag moves · Delete removes · arrows nudge</value></data>
<data name="Tooltips.Editor.Time.Fit" xml:space="preserve"><value>Scales the timing so the video lasts this long; off keeps the playback rate</value></data>
<data name="Tooltips.Editor.Time.Mode" xml:space="preserve"><value>Constant: one frame per photo; Adaptive: follows capture time; Interpolated: fills gaps; Remapped: follows the curve</value></data>
<data name="Tooltips.Editor.Time.Rate" xml:space="preserve"><value>Photos shown per second of video; more plays the sequence faster</value></data>
<data name="Tooltips.Editor.Unsaved.Discard" xml:space="preserve"><value>Close without the change; the stored settings stay as they were</value></data>
<data name="Tooltips.Editor.Unsaved.Keep" xml:space="preserve"><value>Stay in the editor; saving is retried in the background</value></data>
<data name="Tooltips.Jobs.Cancel" xml:space="preserve"><value>Stop this job; Retry continues later from its last checkpoint</value></data>
<data name="Tooltips.Jobs.ClearDone" xml:space="preserve"><value>Hide finished jobs from the list; they stay in the history</value></data>
<data name="Tooltips.Jobs.Filter.All" xml:space="preserve"><value>Every job</value></data>
+33 -2
View File
@@ -12,6 +12,10 @@
<data name="Editor.Camera.Aspect" xml:space="preserve"><value>Formato</value></data>
<data name="Editor.Camera.CenterX" xml:space="preserve"><value>Centro orizzontale</value></data>
<data name="Editor.Camera.CenterY" xml:space="preserve"><value>Centro verticale</value></data>
<data name="Editor.Camera.CropBottom" xml:space="preserve"><value>Ritaglio in basso</value></data>
<data name="Editor.Camera.CropLeft" xml:space="preserve"><value>Ritaglio a sinistra</value></data>
<data name="Editor.Camera.CropRight" xml:space="preserve"><value>Ritaglio a destra</value></data>
<data name="Editor.Camera.CropTop" xml:space="preserve"><value>Ritaglio in alto</value></data>
<data name="Editor.Camera.Curve" xml:space="preserve"><value>Fotogrammi chiave</value></data>
<data name="Editor.Camera.KeyOf" xml:space="preserve"><value>Chiave {0} di {1} · {2}</value></data>
<data name="Editor.Camera.Keys.one" xml:space="preserve"><value>{0} chiave</value></data>
@@ -21,18 +25,30 @@
<data name="Editor.Camera.RemoveKey" xml:space="preserve"><value>Rimuovi chiave</value></data>
<data name="Editor.Camera.Zoom" xml:space="preserve"><value>Zoom</value></data>
<data name="Editor.Chart.Clouds" xml:space="preserve"><value>copertura nuvolosa %</value></data>
<data name="Editor.Chart.Flicker" xml:space="preserve"><value>Sfarfallio</value></data>
<data name="Editor.Chart.FlickerAfter" xml:space="preserve"><value>variazione dopo la correzione</value></data>
<data name="Editor.Chart.FlickerBefore" xml:space="preserve"><value>variazione tra fotogrammi</value></data>
<data name="Editor.Chart.Level0" xml:space="preserve"><value>0%</value></data>
<data name="Editor.Chart.Level100" xml:space="preserve"><value>100%</value></data>
<data name="Editor.Chart.Level50" xml:space="preserve"><value>50%</value></data>
<data name="Editor.Chart.Luminance" xml:space="preserve"><value>Luminanza</value></data>
<data name="Editor.Chart.Measured" xml:space="preserve"><value>luminanza misurata</value></data>
<data name="Editor.Chart.NotAnalysed" xml:space="preserve"><value>Non ancora analizzata</value></data>
<data name="Editor.Chart.PathX" xml:space="preserve"><value>percorso orizzontale</value></data>
<data name="Editor.Chart.PathY" xml:space="preserve"><value>percorso verticale</value></data>
<data name="Editor.Chart.Shown" xml:space="preserve"><value>fotogrammi video per foto</value></data>
<data name="Editor.Chart.Sky" xml:space="preserve"><value>regione del cielo</value></data>
<data name="Editor.Chart.Stars" xml:space="preserve"><value>stelle per Mpx</value></data>
<data name="Editor.Chart.Steps" xml:space="preserve"><value>salti di esposizione ricevuti</value></data>
<data name="Editor.Chart.Switch" xml:space="preserve"><value>Grafico</value></data>
<data name="Editor.Chart.Target" xml:space="preserve"><value>curva obiettivo</value></data>
<data name="Editor.Chart.Waveform" xml:space="preserve"><value>Forma d’onda</value></data>
<data name="Editor.Chart.WaveformOf" xml:space="preserve"><value>luma del fotogramma {0}</value></data>
<data name="Editor.Empty" xml:space="preserve"><value>Scegli una sequenza in Libreria</value></data>
<data name="Editor.Error.Missing" xml:space="preserve"><value>Questa sequenza non è più nell’archivio.</value></data>
<data name="Editor.Error.NoEngine" xml:space="preserve"><value>I lavori non possono partire finché l’indice dell’archivio non è aperto.</value></data>
<data name="Editor.Error.Project" xml:space="preserve"><value>Le impostazioni di questa sequenza non sono leggibili.</value></data>
<data name="Editor.Error.SaveConflict" xml:space="preserve"><value>Le impostazioni di questa sequenza sono state modificate altrove nello stesso momento.</value></data>
<data name="Editor.Export.About" xml:space="preserve"><value>circa {0}</value></data>
<data name="Editor.Export.AddToQueue" xml:space="preserve"><value>Metti in coda</value></data>
<data name="Editor.Export.Batch" xml:space="preserve"><value>In serie…</value></data>
@@ -43,7 +59,7 @@
<data name="Editor.Export.Encoder" xml:space="preserve"><value>Encoder</value></data>
<data name="Editor.Export.EncoderAuto" xml:space="preserve"><value>Auto</value></data>
<data name="Editor.Export.FileName" xml:space="preserve"><value>Nome file</value></data>
<data name="Editor.Export.FrameRate" xml:space="preserve"><value>Fotogrammi al secondo</value></data>
<data name="Editor.Export.FrameRate" xml:space="preserve"><value>Fotogrammi/s</value></data>
<data name="Editor.Export.Hardware" xml:space="preserve"><value>hardware</value></data>
<data name="Editor.Export.Height" xml:space="preserve"><value>Altezza</value></data>
<data name="Editor.Export.History.one" xml:space="preserve"><value>Render precedenti: {0} · ultimo {1}</value></data>
@@ -59,6 +75,7 @@
<data name="Editor.Export.RenderNow" xml:space="preserve"><value>Renderizza ora</value></data>
<data name="Editor.Export.Resolution" xml:space="preserve"><value>Risoluzione</value></data>
<data name="Editor.Export.Result" xml:space="preserve"><value>Risultato</value></data>
<data name="Editor.Export.Reveal" xml:space="preserve"><value>mostra file</value></data>
<data name="Editor.Export.SaveTo" xml:space="preserve"><value>Salva in</value></data>
<data name="Editor.Export.SequenceFolder" xml:space="preserve"><value>exports/ della sequenza</value></data>
<data name="Editor.Export.Size" xml:space="preserve"><value>Dimensione stimata</value></data>
@@ -75,7 +92,7 @@
<data name="Editor.Exposure.Strength" xml:space="preserve"><value>Intensità</value></data>
<data name="Editor.Exposure.Temperature" xml:space="preserve"><value>Temperatura colore</value></data>
<data name="Editor.Exposure.Transitions" xml:space="preserve"><value>Transizioni</value></data>
<data name="Editor.Exposure.WhiteBalance" xml:space="preserve"><value>Bilanciamento del bianco</value></data>
<data name="Editor.Exposure.WhiteBalance" xml:space="preserve"><value>Bilanciamento uniforme</value></data>
<data name="Editor.Exposure.Window" xml:space="preserve"><value>Finestra deflicker</value></data>
<data name="Editor.Filmstrip" xml:space="preserve"><value>Pellicola</value></data>
<data name="Editor.Flow.Balanced" xml:space="preserve"><value>Bilanciata</value></data>
@@ -108,6 +125,7 @@
<data name="Editor.Frames.SetHero" xml:space="preserve"><value>Imposta copertina</value></data>
<data name="Editor.Frames.Warnings" xml:space="preserve"><value>Avvisi</value></data>
<data name="Editor.Loading" xml:space="preserve"><value>Apertura sequenza</value></data>
<data name="Editor.Marker.Cut" xml:space="preserve"><value>Taglio: pausa o vuoto</value></data>
<data name="Editor.Marker.Keyframe" xml:space="preserve"><value>Fotogramma chiave</value></data>
<data name="Editor.Marker.Step" xml:space="preserve"><value>Salto di esposizione {0} EV</value></data>
<data name="Editor.Marker.StepIgnored" xml:space="preserve"><value>Salto {0} EV non ricevuto</value></data>
@@ -128,23 +146,30 @@
<data name="Editor.Preview.Clip" xml:space="preserve"><value>Anteprima 10 s</value></data>
<data name="Editor.Preview.Compare" xml:space="preserve"><value>Confronta</value></data>
<data name="Editor.Preview.CropMask" xml:space="preserve"><value>Maschera ritaglio</value></data>
<data name="Editor.Preview.CropResult" xml:space="preserve"><value>Risultato ritaglio</value></data>
<data name="Editor.Preview.ExitFullScreen" xml:space="preserve"><value>Esci da schermo intero</value></data>
<data name="Editor.Preview.FullScreen" xml:space="preserve"><value>Schermo intero</value></data>
<data name="Editor.Preview.OutputSize" xml:space="preserve"><value>uscita {0}</value></data>
<data name="Editor.Preview.OutputTime" xml:space="preserve"><value>{0} di {1}</value></data>
<data name="Editor.Preview.Pause" xml:space="preserve"><value>Pausa</value></data>
<data name="Editor.Preview.Play" xml:space="preserve"><value>Riproduci</value></data>
<data name="Editor.Preview.Regions" xml:space="preserve"><value>Regioni</value></data>
<data name="Editor.Preview.ShotData" xml:space="preserve"><value>Dati di scatto</value></data>
<data name="Editor.Preview.Unreadable" xml:space="preserve"><value>Questo fotogramma non si può leggere.</value></data>
<data name="Editor.Preview.Vectors" xml:space="preserve"><value>Vettori</value></data>
<data name="Editor.Preview.Wipe" xml:space="preserve"><value>originale | corretto</value></data>
<data name="Editor.Regions.Auto" xml:space="preserve"><value>Auto</value></data>
<data name="Editor.Regions.Horizon" xml:space="preserve"><value>Orizzonte</value></data>
<data name="Editor.Regions.Luminance" xml:space="preserve"><value>Luminanza</value></data>
<data name="Editor.Render" xml:space="preserve"><value>Renderizza · {0}</value></data>
<data name="Editor.Render.Done" xml:space="preserve"><value>Render completato</value></data>
<data name="Editor.Render.Queued" xml:space="preserve"><value>Render in coda</value></data>
<data name="Editor.Render.Reveal" xml:space="preserve"><value>Mostra nella cartella</value></data>
<data name="Editor.RenderButton" xml:space="preserve"><value>Renderizza</value></data>
<data name="Editor.Reset" xml:space="preserve"><value>Ripristina</value></data>
<data name="Editor.ResetToAuto" xml:space="preserve"><value>Torna ad Auto</value></data>
<data name="Editor.Save.Failed" xml:space="preserve"><value>Modifiche non salvate</value></data>
<data name="Editor.Save.Retry" xml:space="preserve"><value>Riprova</value></data>
<data name="Editor.Sections" xml:space="preserve"><value>Sezioni</value></data>
<data name="Editor.Stack.Length" xml:space="preserve"><value>Lunghezza</value></data>
<data name="Editor.Stack.Mean" xml:space="preserve"><value>Media</value></data>
@@ -156,6 +181,7 @@
<data name="Editor.Summary.Frames.one" xml:space="preserve"><value>{0:N0} fotogramma</value></data>
<data name="Editor.Summary.Frames.other" xml:space="preserve"><value>{0:N0} fotogrammi</value></data>
<data name="Editor.Summary.Interval" xml:space="preserve"><value>intervallo {0} s</value></data>
<data name="Editor.Summary.Source" xml:space="preserve"><value>sorgente {0}</value></data>
<data name="Editor.Summary.Warnings.one" xml:space="preserve"><value>{0} avviso</value></data>
<data name="Editor.Summary.Warnings.other" xml:space="preserve"><value>{0} avvisi</value></data>
<data name="Editor.Tab.Camera" xml:space="preserve"><value>Inquadratura</value></data>
@@ -171,12 +197,17 @@
<data name="Editor.Time.Output" xml:space="preserve"><value>uscita {0} %</value></data>
<data name="Editor.Time.Plan.one" xml:space="preserve"><value>{0:N0} fotogramma → {1} · {2} fps</value></data>
<data name="Editor.Time.Plan.other" xml:space="preserve"><value>{0:N0} fotogrammi → {1} · {2} fps</value></data>
<data name="Editor.Time.PlanChart" xml:space="preserve"><value>Piano di render</value></data>
<data name="Editor.Time.Rate" xml:space="preserve"><value>Velocità</value></data>
<data name="Editor.Time.Source" xml:space="preserve"><value>sorgente {0} %</value></data>
<data name="Editor.Timing.Adaptive" xml:space="preserve"><value>Adattivo</value></data>
<data name="Editor.Timing.Constant" xml:space="preserve"><value>Costante</value></data>
<data name="Editor.Timing.Interpolated" xml:space="preserve"><value>Interpolato</value></data>
<data name="Editor.Timing.Remapped" xml:space="preserve"><value>Su curva</value></data>
<data name="Editor.Unsaved.Discard" xml:space="preserve"><value>Scarta modifica</value></data>
<data name="Editor.Unsaved.Keep" xml:space="preserve"><value>Continua a modificare</value></data>
<data name="Editor.Unsaved.Message" xml:space="preserve"><value>L’ultima modifica a {0} non è stata salvata: {1}</value></data>
<data name="Editor.Unsaved.Title" xml:space="preserve"><value>Modifica non salvata</value></data>
<data name="Editor.Value.Centred" xml:space="preserve"><value>Centrato</value></data>
<data name="Editor.Value.Frames.one" xml:space="preserve"><value>{0:N0} fotogramma</value></data>
<data name="Editor.Value.Frames.other" xml:space="preserve"><value>{0:N0} fotogrammi</value></data>
+32 -5
View File
@@ -15,7 +15,9 @@
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Chiudi</value></data>
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Apri la cartella dei file di log</value></data>
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Torna al valore consigliato</value></data>
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Rilegge ogni fotogramma e aggiorna l’analisi; gira come lavoro in background</value></data>
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Rilegge ogni fotogramma e aggiorna l’analisi · Ctrl+Maiusc+A</value></data>
<data name="Tooltips.Editor.AnalyseCost" xml:space="preserve"><value>Rilegge ogni fotogramma e aggiorna l’analisi · circa {0} · Ctrl+Maiusc+A</value></data>
<data name="Tooltips.Editor.AnalyseQueued" xml:space="preserve"><value>Un’analisi di questa sequenza è già in coda o in corso</value></data>
<data name="Tooltips.Editor.Auto.Default" xml:space="preserve"><value>Auto: ancora nessun consiglio, vale il valore predefinito; Analizza lascia decidere al consulente</value></data>
<data name="Tooltips.Editor.Back" xml:space="preserve"><value>Torna alla Libreria</value></data>
<data name="Tooltips.Editor.Busy" xml:space="preserve"><value>È in corso un’analisi o un render di questa sequenza; le impostazioni attendono la fine</value></data>
@@ -23,14 +25,25 @@
<data name="Tooltips.Editor.Camera.Aspect" xml:space="preserve"><value>Formato dell’uscita; un preset con dimensioni fisse usa il proprio</value></data>
<data name="Tooltips.Editor.Camera.CenterX" xml:space="preserve"><value>Centro orizzontale dell’inquadratura della chiave scelta</value></data>
<data name="Tooltips.Editor.Camera.CenterY" xml:space="preserve"><value>Centro verticale dell’inquadratura della chiave scelta</value></data>
<data name="Tooltips.Editor.Camera.Crop" xml:space="preserve"><value>Taglia questa parte del fotogramma su quel lato; formato e posizione valgono poi dentro il ritaglio</value></data>
<data name="Tooltips.Editor.Camera.Curve" xml:space="preserve"><value>Fotogrammi chiave dello zoom: doppio clic aggiunge · trascina sposta · Canc rimuove · le frecce spostano di poco</value></data>
<data name="Tooltips.Editor.Camera.KeyExists" xml:space="preserve"><value>Questo fotogramma ha già un fotogramma chiave; selezionalo sulla curva per modificarlo</value></data>
<data name="Tooltips.Editor.Camera.Keys" xml:space="preserve"><value>Chiavi della camera virtuale: zoom e inquadratura in fotogrammi scelti, raccordati tra loro</value></data>
<data name="Tooltips.Editor.Camera.NoKey" xml:space="preserve"><value>Seleziona prima un fotogramma chiave sulla curva</value></data>
<data name="Tooltips.Editor.Camera.OffsetX" xml:space="preserve"><value>Sposta il ritaglio a sinistra o a destra nel fotogramma</value></data>
<data name="Tooltips.Editor.Camera.OffsetY" xml:space="preserve"><value>Sposta il ritaglio in alto o in basso nel fotogramma</value></data>
<data name="Tooltips.Editor.Camera.RemoveKey" xml:space="preserve"><value>Rimuove la chiave selezionata</value></data>
<data name="Tooltips.Editor.Camera.Zoom" xml:space="preserve"><value>Zoom della chiave scelta; 1 mostra tutto il ritaglio, di più ingrandisce e ammorbidisce</value></data>
<data name="Tooltips.Editor.Export.AddToQueue" xml:space="preserve"><value>Mette in coda questo render e continui a modificare</value></data>
<data name="Tooltips.Editor.Chart.Flicker" xml:space="preserve"><value>Variazione di luminosità tra fotogrammi prima e dopo la correzione</value></data>
<data name="Tooltips.Editor.Chart.Luminance" xml:space="preserve"><value>Luminanza misurata rispetto alla curva obiettivo, regione del cielo e salti di esposizione</value></data>
<data name="Tooltips.Editor.Chart.Plan" xml:space="preserve"><value>Fotogrammi video per ogni foto, con i tagli segnati · un clic mostra quel fotogramma</value></data>
<data name="Tooltips.Editor.Chart.Seek" xml:space="preserve"><value>Clic o trascina per mostrare quel fotogramma</value></data>
<data name="Tooltips.Editor.Chart.Waveform" xml:space="preserve"><value>Forma d’onda della luma del fotogramma a schermo: esposizione e clipping a colpo d’occhio</value></data>
<data name="Tooltips.Editor.Chart.WaveformView" xml:space="preserve"><value>Luma del fotogramma corretto lungo l’immagine: bianco in alto, nero in basso</value></data>
<data name="Tooltips.Editor.Export.AddToQueue" xml:space="preserve"><value>Mette in coda questo render; puoi continuare a modificare</value></data>
<data name="Tooltips.Editor.Export.ApplyPreset" xml:space="preserve"><value>Applica questo preset di sequenza a tutte le sezioni · {0}</value></data>
<data name="Tooltips.Editor.Export.Batch" xml:space="preserve"><value>Mette in coda i preset spuntati come un unico lavoro; la sequenza si prepara una volta</value></data>
<data name="Tooltips.Editor.Export.BatchEmpty" xml:space="preserve"><value>Spunta prima i preset sulle schede</value></data>
<data name="Tooltips.Editor.Export.BitRate" xml:space="preserve"><value>Bit rate medio; di più conserva dettagli e sfumature, i file crescono</value></data>
<data name="Tooltips.Editor.Export.Codec" xml:space="preserve"><value>Codec video o immagine; HEVC a 10 bit mantiene pulite le sfumature del cielo</value></data>
<data name="Tooltips.Editor.Export.Colour" xml:space="preserve"><value>Colore Rec.709; 10 bit evitano il banding nel cielo, l’HDR non è disponibile</value></data>
@@ -41,7 +54,7 @@
<data name="Tooltips.Editor.Export.FrameRateAuto" xml:space="preserve"><value>Auto: i {0} fps del preset</value></data>
<data name="Tooltips.Editor.Export.FrameRateReset" xml:space="preserve"><value>Torna ai fotogrammi al secondo del preset</value></data>
<data name="Tooltips.Editor.Export.Height" xml:space="preserve"><value>Altezza in pixel; vuoto segue la larghezza · Invio applica, Esc annulla</value></data>
<data name="Tooltips.Editor.Export.History" xml:space="preserve"><value>Apre Lavori per vedere i render di questa sequenza</value></data>
<data name="Tooltips.Editor.Export.History" xml:space="preserve"><value>Apre Lavori filtrati su questa sequenza</value></data>
<data name="Tooltips.Editor.Export.InBatch" xml:space="preserve"><value>Include questo preset quando In serie mette in coda il render</value></data>
<data name="Tooltips.Editor.Export.Name" xml:space="preserve"><value>Segnaposto: {date} {title} {preset} {codec} {width} {height} {fps} · Invio applica, Esc annulla</value></data>
<data name="Tooltips.Editor.Export.Preset" xml:space="preserve"><value>Renderizza con {0}; modificare un valore lo rende Personalizzato</value></data>
@@ -58,10 +71,12 @@
<data name="Tooltips.Editor.Exposure.Transitions" xml:space="preserve"><value>Fotogrammi su cui si distribuisce ogni salto di ISO, tempo o diaframma; 0 lascia i salti</value></data>
<data name="Tooltips.Editor.Exposure.WhiteBalance" xml:space="preserve"><value>Smussa i rapporti di colore: il bilanciamento automatico smette di sfarfallare e la deriva del tramonto resta</value></data>
<data name="Tooltips.Editor.Exposure.Window" xml:space="preserve"><value>Fotogrammi usati per stimare la curva senza sfarfallio; troppo corta lo lascia, troppo lunga appiattisce i veri cambi di luce</value></data>
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Clic o trascina per mostrare un fotogramma; i segni indicano salti di esposizione, avvisi e fotogrammi chiave</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Lascia fuori questo fotogramma da ogni render; la foto non viene eliminata</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Mostra il primo fotogramma interessato</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Usa il fotogramma come copertina della sequenza</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Rende questo fotogramma la copertina; l’editor si apre qui</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Usa di nuovo questo fotogramma nei render</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Ordina per questa colonna; un altro clic inverte</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Fai clic su una riga per mostrare il fotogramma</value></data>
<data name="Tooltips.Editor.Motion.Blur" xml:space="preserve"><value>Aggiunge mosso lungo il movimento come un tempo più lungo; richiede il flusso ottico su ogni fotogramma</value></data>
<data name="Tooltips.Editor.Motion.Flow" xml:space="preserve"><value>Precisione del flusso ottico per mosso e fotogrammi sintetici; Massima è la più lenta</value></data>
@@ -85,15 +100,24 @@
<data name="Tooltips.Editor.Preview.ActualSize" xml:space="preserve"><value>Mostra i pixel 1:1 senza interpolazione · Ctrl+1; Ctrl+0 adatta</value></data>
<data name="Tooltips.Editor.Preview.Clip" xml:space="preserve"><value>Riproduce dieci secondi dei fotogrammi del video con le impostazioni attuali</value></data>
<data name="Tooltips.Editor.Preview.Compare" xml:space="preserve"><value>Confronto a tendina: originale a sinistra, corretto a destra; trascina la linea</value></data>
<data name="Tooltips.Editor.Preview.CropLoss" xml:space="preserve"><value>Scurisce ciò che l’uscita taglia (cosa perdo)</value></data>
<data name="Tooltips.Editor.Preview.CropMask" xml:space="preserve"><value>Mostra tutto il fotogramma e scurisce ciò che l’uscita taglierà</value></data>
<data name="Tooltips.Editor.Preview.CropResult" xml:space="preserve"><value>Nasconde ciò che l’uscita taglia (come apparirà)</value></data>
<data name="Tooltips.Editor.Preview.ExitFullScreen" xml:space="preserve"><value>Chiudi schermo intero · Esc</value></data>
<data name="Tooltips.Editor.Preview.FullScreen" xml:space="preserve"><value>Schermo intero alla risoluzione nativa · Esc chiude</value></data>
<data name="Tooltips.Editor.Preview.Regions" xml:space="preserve"><value>Mostra il confine tra cielo e paesaggio usato dal deflicker per regioni</value></data>
<data name="Tooltips.Editor.Preview.ShotData" xml:space="preserve"><value>Mostra o nasconde i dati di scatto</value></data>
<data name="Tooltips.Editor.Preview.Vectors" xml:space="preserve"><value>Sovrappone il movimento verso il fotogramma successivo misurato dal motore</value></data>
<data name="Tooltips.Editor.Preview.View" xml:space="preserve"><value>Trascina la linea per confrontare · trascina per spostare · la rotellina ingrandisce · doppio clic 1:1</value></data>
<data name="Tooltips.Editor.Render" xml:space="preserve"><value>Renderizza con il preset scelto; avanzamento nella barra dei lavori · Ctrl+R</value></data>
<data name="Tooltips.Editor.Render.NameError" xml:space="preserve"><value>Correggi prima il nome del file: {0}</value></data>
<data name="Tooltips.Editor.Render.NoFrames" xml:space="preserve"><value>Tutti i fotogrammi sono esclusi: includine alcuni nella scheda Fotogrammi</value></data>
<data name="Tooltips.Editor.Render.NoSource" xml:space="preserve"><value>La dimensione dei fotogrammi è sconosciuta: non è stato possibile leggerli</value></data>
<data name="Tooltips.Editor.Render.Planning" xml:space="preserve"><value>Calcolo del render in corso; pronto tra un attimo</value></data>
<data name="Tooltips.Editor.Render.Reveal" xml:space="preserve"><value>Mostra il file del render in Esplora file</value></data>
<data name="Tooltips.Editor.RenderChoice" xml:space="preserve"><value>Scegli un altro preset</value></data>
<data name="Tooltips.Editor.ResetSection" xml:space="preserve"><value>Riporta in Auto ogni controllo di questa sezione · Ctrl+Z annulla</value></data>
<data name="Tooltips.Editor.Save.Retry" xml:space="preserve"><value>Prova a salvare ora; il salvataggio viene anche ritentato da solo</value></data>
<data name="Tooltips.Editor.Stack.Length" xml:space="preserve"><value>Fotogrammi combinati in ogni fotogramma d’uscita; scie e levigatura crescono con esso</value></data>
<data name="Tooltips.Editor.Stack.Mode" xml:space="preserve"><value>Mediana e media tolgono rumore e ciò che si muove; le scie stellari tengono i pixel più luminosi</value></data>
<data name="Tooltips.Editor.Tab.Camera" xml:space="preserve"><value>Ritaglio, formato, movimenti della camera virtuale</value></data>
@@ -102,10 +126,13 @@
<data name="Tooltips.Editor.Tab.Frames" xml:space="preserve"><value>Tabella dei fotogrammi, avvisi, esclusioni</value></data>
<data name="Tooltips.Editor.Tab.Motion" xml:space="preserve"><value>Mosso, flusso ottico, stabilizzazione</value></data>
<data name="Tooltips.Editor.Tab.Stack" xml:space="preserve"><value>Stacking a mediana e scie stellari</value></data>
<data name="Tooltips.Editor.Tab.Time" xml:space="preserve"><value>Velocità, modo dei tempi, curva di velocità</value></data>
<data name="Tooltips.Editor.Tab.Time" xml:space="preserve"><value>Frequenza fotogrammi, modo dei tempi, curva di velocità</value></data>
<data name="Tooltips.Editor.Time.Curve" xml:space="preserve"><value>Tempo del video verso posizione nella sequenza: doppio clic aggiunge un punto · trascina sposta · Canc rimuove · le frecce spostano di poco</value></data>
<data name="Tooltips.Editor.Time.Fit" xml:space="preserve"><value>Scala i tempi perché il video duri così; spento mantiene la velocità</value></data>
<data name="Tooltips.Editor.Time.Mode" xml:space="preserve"><value>Costante: un fotogramma per foto; Adattivo: segue l’ora di scatto; Interpolato: riempie i vuoti; Su curva: segue la curva</value></data>
<data name="Tooltips.Editor.Time.Rate" xml:space="preserve"><value>Foto mostrate per secondo di video; di più accelera la sequenza</value></data>
<data name="Tooltips.Editor.Unsaved.Discard" xml:space="preserve"><value>Chiude senza la modifica; le impostazioni salvate restano com’erano</value></data>
<data name="Tooltips.Editor.Unsaved.Keep" xml:space="preserve"><value>Resta nell’editor; il salvataggio viene ritentato in background</value></data>
<data name="Tooltips.Jobs.Cancel" xml:space="preserve"><value>Ferma questa attività; Riprova la continua più tardi dall'ultimo punto di ripresa</value></data>
<data name="Tooltips.Jobs.ClearDone" xml:space="preserve"><value>Nasconde le attività concluse dall'elenco; restano nella cronologia</value></data>
<data name="Tooltips.Jobs.Filter.All" xml:space="preserve"><value>Tutte le attività</value></data>
+90 -9
View File
@@ -8,18 +8,34 @@ using Titano.Core.Localization;
using Titano.Core.Mathematics;
using Titano.Core.Project;
using Titano.Ui.Mvvm;
using Titano.Ui.Visuals;
namespace Titano.App.Editor;
/// <summary>Margins of the free crop, in the order of <c>CameraTab.Margins</c> (opposites differ in the lowest bit).</summary>
public enum CropSide
{
Left,
Right,
Top,
Bottom,
}
/// <summary>
/// Camera (BRIEF §12.3): output aspect and crop placement, and virtual-camera keyframes edited as a zoom curve over the
/// sequence (X = frame, Y = zoom) with the selected keyframe's framing below.
/// Camera (BRIEF §12.3): the free crop of the frame (margins), the output aspect and its placement inside the crop, and
/// virtual-camera keyframes edited as a zoom curve over the sequence (X = frame, Y = zoom) with the selected keyframe's
/// framing below.
/// </summary>
public sealed class CameraTab : EditorTab
{
/// <summary>Zoom at the top of the curve editor.</summary>
public const double MaxZoom = 4;
/// <summary>Largest crop margin; opposite margins together leave at least <see cref="MinCropSize"/> of the frame.</summary>
public const double MaxCropMargin = 0.45;
public const double MinCropSize = 0.1;
private int _selectedKey = -1;
public CameraTab(EditorViewModel editor)
@@ -28,6 +44,10 @@ public sealed class CameraTab : EditorTab
var s = editor.Session;
Rows =
[
CropRow(s, CropSide.Left, "Editor.Camera.CropLeft"),
CropRow(s, CropSide.Right, "Editor.Camera.CropRight"),
CropRow(s, CropSide.Top, "Editor.Camera.CropTop"),
CropRow(s, CropSide.Bottom, "Editor.Camera.CropBottom"),
new AutoChoiceRow<string>(s, EditorSettings.Aspect, "Editor.Camera.Aspect", "Tooltips.Editor.Camera.Aspect",
[
new Choice("source", "Editor.Aspect.Source"), new Choice("16:9", "Editor.Aspect.Ratio", "16:9"), new Choice("21:9", "Editor.Aspect.Ratio", "21:9"),
@@ -35,9 +55,9 @@ public sealed class CameraTab : EditorTab
new Choice("9:16", "Editor.Aspect.Ratio", "9:16"), new Choice("4:5", "Editor.Aspect.Ratio", "4:5"),
]),
new NumberRow(s, "Editor.Camera.OffsetX", "Tooltips.Editor.Camera.OffsetX", -1, 1, 0.05, p => p.Camera.OffsetX,
(p, v) => p with { Camera = p.Camera with { OffsetX = v } }, Placement),
(p, v) => p with { Camera = p.Camera with { OffsetX = v } }, EditorText.Placement),
new NumberRow(s, "Editor.Camera.OffsetY", "Tooltips.Editor.Camera.OffsetY", -1, 1, 0.05, p => p.Camera.OffsetY,
(p, v) => p with { Camera = p.Camera with { OffsetY = v } }, Placement),
(p, v) => p with { Camera = p.Camera with { OffsetY = v } }, EditorText.Placement),
];
AddKeyCommand = new RelayCommand(AddKey, () => !Editor.IsBusy && Keys.All(k => k.Frame != Editor.CurrentIndex));
RemoveKeyCommand = new RelayCommand(RemoveKey, () => !Editor.IsBusy && SelectedKey >= 0);
@@ -96,6 +116,12 @@ public sealed class CameraTab : EditorTab
public ICommand RemoveKeyCommand { get; }
/// <summary>What Add keyframe does, or why it cannot run now.</summary>
public string AddKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy"
: Keys.Any(k => k.Frame == Editor.CurrentIndex) ? "Tooltips.Editor.Camera.KeyExists" : "Tooltips.Editor.Camera.AddKey");
public string RemoveKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : HasSelectedKey ? "Tooltips.Editor.Camera.RemoveKey" : "Tooltips.Editor.Camera.NoKey");
/// <summary>Run by the curve editor after each finished edit.</summary>
public ICommand CommitCurveCommand { get; }
@@ -130,9 +156,38 @@ public sealed class CameraTab : EditorTab
Editor.Session.Edit(p => p with { Camera = p.Camera with { Keyframes = [.. keys.DistinctBy(k => k.Frame)] } });
}
public void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead));
public override void OnCurrentFrameChanged()
{
OnPropertyChanged(nameof(Playhead));
OnPropertyChanged(nameof(AddKeyToolTip));
}
private static string Placement(double value) => value == 0 ? Loc.L("Editor.Value.Centred") : value.ToString("+0.00;−0.00", Loc.Culture);
public override void OnBusyChanged()
{
base.OnBusyChanged();
OnPropertyChanged(nameof(AddKeyToolTip));
OnPropertyChanged(nameof(RemoveKeyToolTip));
}
/// <summary>A margin of the free crop (<see cref="CameraSettings.Crop"/>, normalised x, y, width, height); all zero = the whole frame.</summary>
private static NumberRow CropRow(EditorSession session, CropSide side, string headerKey) => new(session, headerKey, "Tooltips.Editor.Camera.Crop", 0,
MaxCropMargin, 0.01, p => Margins(p.Camera.Crop)[(int)side], (p, v) => p with { Camera = p.Camera with { Crop = WithMargin(p.Camera.Crop, side, v) } },
v => Formatting.Percent(v));
/// <summary>Left, right, top and bottom margins of a crop rectangle.</summary>
private static double[] Margins(double[]? crop) => crop is [var x, var y, var w, var h] && new[] { x, y, w, h }.All(double.IsFinite)
? [double.Clamp(x, 0, 1), double.Clamp(1 - x - w, 0, 1), double.Clamp(y, 0, 1), double.Clamp(1 - y - h, 0, 1)]
: [0, 0, 0, 0];
private static double[]? WithMargin(double[]? crop, CropSide side, double value)
{
var margins = Margins(crop);
var opposite = (int)side ^ 1;
margins[(int)side] = double.Clamp(value, 0, double.Min(MaxCropMargin, 1 - MinCropSize - margins[opposite]));
if (margins.All(m => m == 0)) return null;
var (left, right, top, bottom) = (margins[0], margins[1], margins[2], margins[3]);
return [left, top, 1 - left - right, 1 - top - bottom];
}
private Point ToPoint(CameraKey key) => new(Editor.FrameCount > 1 ? (double)key.Frame / (Editor.FrameCount - 1) : 0, (key.Zoom - 1) / (MaxZoom - 1));
@@ -166,6 +221,7 @@ public sealed class CameraTab : EditorTab
private void OnSelectedKeyChanged()
{
OnPropertyChanged(nameof(HasSelectedKey));
OnPropertyChanged(nameof(RemoveKeyToolTip));
OnPropertyChanged(nameof(SelectedCenterX));
OnPropertyChanged(nameof(SelectedCenterY));
OnPropertyChanged(nameof(SelectedZoom));
@@ -175,13 +231,16 @@ public sealed class CameraTab : EditorTab
}
/// <summary>
/// Time (BRIEF §12.3): timing mode, playback rate, fit-to duration and the time-remap curve (output time → source
/// position, Fritsch–Carlson as the render evaluates it), with the plan in numbers.
/// Time (BRIEF §12.3): timing mode, playback rate, fit-to duration, the plan chart (video frames each photo gets, cuts
/// marked, the plan in numbers) and the time-remap curve (output time → source position, Fritsch–Carlson as the render
/// evaluates it).
/// </summary>
public sealed class TimeTab : EditorTab
{
private Func<double, double>? _evaluator;
private string? _planText;
private IReadOnlyList<ChartSeries> _planSeries = [];
private IReadOnlyList<TimelineMarker> _planMarkers = [];
public TimeTab(EditorViewModel editor)
: base(editor, "Time", AdvisorSection.Timing)
@@ -216,6 +275,16 @@ public sealed class TimeTab : EditorTab
/// <summary>"3,600 frames → 2 min 30 s · 24 fps".</summary>
public string? PlanText { get => _planText; private set => Set(ref _planText, value); }
/// <summary>Video frames each photo is shown for (0 = skipped by a speed-up, gap = excluded), over the sequence.</summary>
public IReadOnlyList<ChartSeries> PlanSeries { get => _planSeries; private set => Set(ref _planSeries, value); }
/// <summary>Cuts of the plan (deliberate pauses, gaps, long exclusion runs).</summary>
public IReadOnlyList<TimelineMarker> PlanMarkers { get => _planMarkers; private set => Set(ref _planMarkers, value); }
public IReadOnlyList<ChartLegendItem> PlanLegend { get; } = [new(Loc.L("Editor.Chart.Shown"), "Brush.Accent")];
public Func<double, string> PlanFormatter { get; } = v => v.ToString("0.#", Loc.Culture);
public double Playhead => Editor.FrameCount > 1 ? (double)Editor.CurrentIndex / (Editor.FrameCount - 1) : double.NaN;
public Func<double, string> XFormatter { get; } = x => Loc.L("Editor.Time.Output", (x * 100).ToString("0", Loc.Culture));
@@ -240,11 +309,23 @@ public sealed class TimeTab : EditorTab
if (Editor.Plan is not { } plan)
{
PlanText = null;
PlanSeries = [];
PlanMarkers = [];
return;
}
var render = plan.Setup.Plan;
PlanText = Loc.Plural("Editor.Time.Plan", render.Frames.Count, Formatting.Duration(TimeSpan.FromSeconds(render.DurationSeconds)),
EditorText.FrameRate(render.FrameRate));
var shown = new double[Editor.FrameCount];
Array.Fill(shown, double.NaN);
foreach (var index in render.IncludedFrames) shown[index] = 0;
foreach (var frame in render.Frames)
{
var index = int.Clamp((int)double.Round(frame.SourcePosition), 0, shown.Length - 1);
shown[index] = (double.IsNaN(shown[index]) ? 0 : shown[index]) + frame.Slots;
}
PlanSeries = [new ChartSeries(Loc.L("Editor.Chart.Shown"), shown, "Brush.Accent")];
PlanMarkers = [.. render.IncludedFrames.Where(render.IsCutBefore).Select(i => new TimelineMarker(i, MarkerKind.Warning, Loc.L("Editor.Marker.Cut")))];
}
/// <summary>The curve editor finished an edit: the points become the remap curve, and the timing mode follows it.</summary>
@@ -261,7 +342,7 @@ public sealed class TimeTab : EditorTab
});
}
public void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead));
public override void OnCurrentFrameChanged() => OnPropertyChanged(nameof(Playhead));
private static Func<double, double>? Spline(IReadOnlyList<Point> points)
{
+17
View File
@@ -0,0 +1,17 @@
using System.Globalization;
using System.Windows.Data;
namespace Titano.App.Editor;
/// <summary>Columns of the Export tab's preset grid: as many as fit at <see cref="MinCardWidth"/> (four at 1440 px, three at 1200 px).</summary>
public sealed class CardColumns : IValueConverter
{
public const double MinCardWidth = 200;
public static CardColumns Instance { get; } = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
value is double width && double.IsFinite(width) ? int.Max(1, (int)(width / MinCardWidth)) : 4;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();
}
+15
View File
@@ -19,6 +19,21 @@ public static class EditorImages
bitmap.Freeze();
return bitmap;
}
/// <summary>A waveform as an opacity mask (white, alpha = density) so the view paints it in a theme brush.</summary>
public static BitmapSource ToMask(LumaWaveform waveform)
{
ArgumentNullException.ThrowIfNull(waveform);
var pixels = new byte[waveform.Density.Length * 4];
for (var i = 0; i < waveform.Density.Length; i++)
{
var alpha = waveform.Density[i];
pixels[4 * i] = pixels[4 * i + 1] = pixels[4 * i + 2] = pixels[4 * i + 3] = alpha;
}
var bitmap = BitmapSource.Create(waveform.Columns, waveform.Rows, 96, 96, PixelFormats.Pbgra32, null, pixels, waveform.Columns * 4);
bitmap.Freeze();
return bitmap;
}
}
/// <summary>
+118 -38
View File
@@ -5,25 +5,81 @@
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
xmlns:e="clr-namespace:Titano.App.Editor">
<!--
The measuring tool of each editor section, below the tab strip (BRIEF §12.3): luminance, camera path and sky charts,
the frame table, the keyframe and time-remap curve editors, and the Export tab's preset cards. Clicking a chart seeks
the preview.
The measuring tool of each editor section, below the tab strip (BRIEF §12.3): luminance, flicker and waveform,
camera path and sky charts, the frame table, the keyframe and time-remap curve editors with the plan chart, and the
Export tab's preset cards. Clicking a chart seeks the preview.
-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Titano;component/Editor/EditorStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- One choice of a vertical segment group (the Exposure chart switch): text, accent when chosen. -->
<Style x:Key="RadioButton.ChartSegment" TargetType="RadioButton" BasedOn="{StaticResource RadioButton.Segment}">
<Setter Property="Width" Value="NaN" />
<Setter Property="MinWidth" Value="64" />
<Setter Property="Height" Value="26" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="FontSize" Value="{StaticResource Size.Secondary}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Margin" Value="0,0,0,-1" />
</Style>
<DataTemplate x:Key="Template.Chart">
<Border Style="{StaticResource Border.Panel}" Padding="10" Margin="0,10,0,0">
<v:SeriesChart Series="{Binding Series}" Legend="{Binding Legend}" Summary="{Binding Summary}" YLabelFormatter="{Binding YFormatter}"
CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" AutomationProperties.Name="{Binding Header}" />
CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" ToolTip="{l:Loc Tooltips.Editor.Chart.Seek}" AutomationProperties.Name="{Binding Header}" />
</Border>
</DataTemplate>
<!-- Exposure: luminance (measured vs target), flicker (frame-to-frame change before and after) or the waveform of the frame on screen. -->
<DataTemplate DataType="{x:Type e:ExposureTab}">
<Border Style="{StaticResource Border.Panel}" Padding="10" Margin="0,10,0,0">
<v:SeriesChart Series="{Binding Series}" Legend="{Binding Legend}" Markers="{Binding Markers}" Summary="{Binding Summary}" YLabelFormatter="{Binding YFormatter}"
CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" AutomationProperties.Name="{Binding Header}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Margin="0,0,10,0" VerticalAlignment="Top" AutomationProperties.Name="{l:Loc Editor.Chart.Switch}">
<RadioButton Style="{StaticResource RadioButton.ChartSegment}" ui:ControlState.CornerRadius="6,6,0,0" Content="{l:Loc Editor.Chart.Luminance}"
IsChecked="{Binding IsLuminance}" GroupName="ExposureChart" ToolTip="{l:Loc Tooltips.Editor.Chart.Luminance}" />
<RadioButton Style="{StaticResource RadioButton.ChartSegment}" ui:ControlState.CornerRadius="0" Content="{l:Loc Editor.Chart.Flicker}"
IsChecked="{Binding IsFlicker}" GroupName="ExposureChart" ToolTip="{l:Loc Tooltips.Editor.Chart.Flicker}" />
<RadioButton Style="{StaticResource RadioButton.ChartSegment}" ui:ControlState.CornerRadius="0,0,6,6" Content="{l:Loc Editor.Chart.Waveform}"
IsChecked="{Binding IsWaveform}" GroupName="ExposureChart" ToolTip="{l:Loc Tooltips.Editor.Chart.Waveform}" />
</StackPanel>
<v:SeriesChart Grid.Column="1" Series="{Binding Series}" Legend="{Binding Legend}" Markers="{Binding Markers}" Summary="{Binding Summary}"
YLabelFormatter="{Binding YFormatter}" CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" ToolTip="{l:Loc Tooltips.Editor.Chart.Seek}"
AutomationProperties.Name="{Binding Header}"
Visibility="{Binding IsWaveform, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
<!-- Waveform monitor: luma level (bottom 0 %, top 100 %) across the picture; density drawn in the accent colour. -->
<Grid Grid.Column="1" Visibility="{Binding IsWaveform, Converter={StaticResource BoolToVisibility}}" ToolTip="{l:Loc Tooltips.Editor.Chart.WaveformView}"
AutomationProperties.Name="{l:Loc Editor.Chart.Waveform}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.ColumnSpan="2" Text="{Binding WaveformTitle}" Style="{StaticResource Text.Header}" Margin="0,0,0,6" Typography.NumeralAlignment="Tabular" />
<Grid Grid.Row="1" Margin="0,0,6,0">
<TextBlock Text="{l:Loc Editor.Chart.Level100}" Style="{StaticResource Text.Header}" VerticalAlignment="Top" HorizontalAlignment="Right" />
<TextBlock Text="{l:Loc Editor.Chart.Level50}" Style="{StaticResource Text.Header}" VerticalAlignment="Center" HorizontalAlignment="Right" />
<TextBlock Text="{l:Loc Editor.Chart.Level0}" Style="{StaticResource Text.Header}" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
</Grid>
<Border Grid.Row="1" Grid.Column="1" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1">
<Grid>
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" VerticalAlignment="Center" />
<Rectangle Fill="{DynamicResource Brush.Accent}">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="{Binding Editor.WaveformImage}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</DataTemplate>
@@ -35,7 +91,7 @@
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource Template.Chart}" />
</DataTemplate>
<!-- Frames: virtualised table; row actions show on hover or selection (DESIGN §4 tables). -->
<!-- Frames: virtualised table with sortable headers; row actions show on hover or selection (DESIGN §4 tables). -->
<DataTemplate DataType="{x:Type e:FramesTab}">
<Border Style="{StaticResource Border.Panel}" Margin="0,10,0,0">
<Grid>
@@ -43,7 +99,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,6,24,6">
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,4,24,4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" MinWidth="40" />
@@ -56,14 +112,22 @@
<ColumnDefinition Width="1.6*" MinWidth="60" />
<ColumnDefinition Width="Auto" MinWidth="118" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Number}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Time}" TextAlignment="Right" />
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Exposure}" TextAlignment="Right" />
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Iso}" TextAlignment="Right" />
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Aperture}" TextAlignment="Right" />
<TextBlock Grid.Column="5" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Size}" TextAlignment="Right" />
<TextBlock Grid.Column="6" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Tier}" Margin="10,0,0,0" />
<TextBlock Grid.Column="7" Style="{StaticResource Text.Header}" Text="{l:Loc Editor.Frames.Column.Flags}" Margin="10,0,0,0" />
<Button Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[0]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Number}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" />
<Button Grid.Column="1" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[1]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Time}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" HorizontalContentAlignment="Right" />
<Button Grid.Column="2" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[2]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Exposure}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" HorizontalContentAlignment="Right" />
<Button Grid.Column="3" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[3]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Iso}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" HorizontalContentAlignment="Right" />
<Button Grid.Column="4" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[4]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Aperture}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" HorizontalContentAlignment="Right" />
<Button Grid.Column="5" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[5]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Size}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" HorizontalContentAlignment="Right" />
<Button Grid.Column="6" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[6]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Tier}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" Margin="10,0,0,0" />
<Button Grid.Column="7" Style="{StaticResource Button.SortHeader}" DataContext="{Binding Columns[7]}" Command="{Binding SortCommand}"
Content="{l:Loc Editor.Frames.Column.Flags}" ToolTip="{l:Loc Tooltips.Editor.Frames.Sort}" Margin="10,0,0,0" />
</Grid>
</Border>
<ListBox Grid.Row="1" ItemsSource="{Binding Frames}" SelectedItem="{Binding Selected}" ItemContainerStyle="{StaticResource ListBoxItem.Row}"
@@ -71,7 +135,7 @@
ToolTip="{l:Loc Tooltips.Editor.Frames.Table}" AutomationProperties.Name="{Binding Header}" BorderThickness="0" Background="Transparent">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type e:FrameRow}">
<Grid Height="34">
<Grid Height="36">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" MinWidth="40" />
<ColumnDefinition Width="*" MinWidth="56" />
@@ -122,30 +186,43 @@
<Border Style="{StaticResource Border.Panel}" Padding="10" Margin="0,10,0,0">
<v:CurveEditor Points="{Binding KeyPoints}" Mode="Keyframes" SelectedIndex="{Binding SelectedKey, Mode=TwoWay}" PlayheadPosition="{Binding Playhead}"
XLabelFormatter="{Binding XFormatter}" YLabelFormatter="{Binding YFormatter}" e:CurveCommit.Command="{Binding CommitCurveCommand}"
IsEnabled="{Binding Editor.IsEditable}" AutomationProperties.Name="{l:Loc Editor.Camera.Curve}" />
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{l:Loc Tooltips.Editor.Camera.Curve}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.Camera.Curve}" />
</Border>
</DataTemplate>
<!-- Time: the remap curve (output time → source position) with the plan in numbers. -->
<!-- Time: the plan chart (video frames per photo, cuts) beside the remap curve (output time → source position). -->
<DataTemplate DataType="{x:Type e:TimeTab}">
<Border Style="{StaticResource Border.Panel}" Padding="10" Margin="0,10,0,0">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Text="{Binding PlanText}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Chip}" Margin="0,0,0,6"
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" />
<v:CurveEditor Points="{Binding RemapPoints}" Mode="TimeRemap" Evaluator="{Binding Evaluator}" ShowDiagonal="True" PlayheadPosition="{Binding Playhead}"
XLabelFormatter="{Binding XFormatter}" YLabelFormatter="{Binding YFormatter}" e:CurveCommit.Command="{Binding CommitCurveCommand}"
IsEnabled="{Binding Editor.IsEditable}" AutomationProperties.Name="{l:Loc Editor.Time.Curve}" />
</DockPanel>
</Border>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource Border.Panel}" Padding="10">
<v:SeriesChart Series="{Binding PlanSeries}" Legend="{Binding PlanLegend}" Markers="{Binding PlanMarkers}" Summary="{Binding PlanText}"
YLabelFormatter="{Binding PlanFormatter}" CurrentIndex="{Binding Editor.CurrentIndex, Mode=TwoWay}" ToolTip="{l:Loc Tooltips.Editor.Chart.Plan}"
AutomationProperties.Name="{l:Loc Editor.Time.PlanChart}" />
</Border>
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="10">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Editor.Time.Curve}" Style="{StaticResource Text.Header}" Margin="0,0,0,6" />
<v:CurveEditor Points="{Binding RemapPoints}" Mode="TimeRemap" Evaluator="{Binding Evaluator}" ShowDiagonal="True" PlayheadPosition="{Binding Playhead}"
XLabelFormatter="{Binding XFormatter}" YLabelFormatter="{Binding YFormatter}" e:CurveCommit.Command="{Binding CommitCurveCommand}"
IsEnabled="{Binding Editor.IsEditable}" ToolTip="{l:Loc Tooltips.Editor.Time.Curve}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.Time.Curve}" />
</DockPanel>
</Border>
</Grid>
</DataTemplate>
<!-- Export: preset cards, four per row (Export.html). -->
<!-- Export: preset cards at least 200 px wide (four per row in Export.html at 1440 px, three at 1200 px). -->
<DataTemplate DataType="{x:Type e:ExportTab}">
<ScrollViewer Margin="0,10,0,0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
<ItemsControl ItemsSource="{Binding Cards}" Focusable="False" IsEnabled="{Binding Editor.IsEditable}">
<ItemsControl ItemsSource="{Binding Cards}" Focusable="False" IsEnabled="{Binding Editor.IsEditable}" Margin="-5,0,-5,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="4" />
<UniformGrid Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ItemsControl}, Converter={x:Static e:CardColumns.Instance}}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
@@ -153,16 +230,19 @@
<Button Style="{StaticResource Button.PresetCard}" Command="{Binding SelectCommand}" CommandParameter="{Binding}" ToolTip="{Binding ToolTip}"
AutomationProperties.Name="{Binding Name}">
<DockPanel>
<DockPanel DockPanel.Dock="Top" LastChildFill="False">
<CheckBox DockPanel.Dock="Right" IsChecked="{Binding IsInBatch}" Visibility="{Binding CanBatch, Converter={StaticResource BoolToVisibility}}"
ToolTip="{l:Loc Tooltips.Editor.Export.InBatch}" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" Margin="6,0,0,0" />
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" MaxWidth="150" VerticalAlignment="Center" />
<Border Style="{StaticResource Border.Recommended}" Visibility="{Binding IsRecommended, Converter={StaticResource BoolToVisibility}}">
<!-- The chip moves under the name when both do not fit on one line. -->
<WrapPanel DockPanel.Dock="Top">
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="0,0,8,0" />
<Border Style="{StaticResource Border.Recommended}" Margin="0" Visibility="{Binding IsRecommended, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{l:Loc Editor.Export.Recommended}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" />
</Border>
</WrapPanel>
<DockPanel DockPanel.Dock="Bottom">
<CheckBox DockPanel.Dock="Right" IsChecked="{Binding IsInBatch}" Visibility="{Binding CanBatch, Converter={StaticResource BoolToVisibility}}"
ToolTip="{l:Loc Tooltips.Editor.Export.InBatch}" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" Margin="6,0,0,0" />
<TextBlock Text="{Binding Estimate}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</DockPanel>
<TextBlock DockPanel.Dock="Bottom" Text="{Binding Estimate}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis"
Typography.NumeralAlignment="Tabular" />
<StackPanel Margin="0,4,0,0">
<TextBlock Text="{Binding Format}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding Encoding}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" TextTrimming="CharacterEllipsis"
+34 -19
View File
@@ -145,8 +145,8 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Content="{l:Loc Editor.OptimiseSection}" Command="{Binding OptimiseCommand}" ToolTip="{Binding OptimiseToolTip}" ToolTipService.ShowOnDisabled="True" />
<Button Grid.Column="1" Style="{StaticResource Button.Subtle}" Content="{l:Loc Editor.Reset}" Margin="8,0,0,0" Command="{Binding ResetCommand}"
ToolTip="{l:Loc Tooltips.Editor.ResetSection}" Visibility="{Binding CanReset, Converter={StaticResource BoolToVisibility}}" />
<Button Grid.Column="1" Style="{StaticResource Button.SectionReset}" Content="{l:Loc Editor.Reset}" Margin="8,0,0,0" Command="{Binding ResetCommand}"
ToolTip="{Binding ResetToolTip}" Visibility="{Binding CanReset, Converter={StaticResource BoolToVisibility}}" />
</Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.BusyToolTip}" ToolTipService.ShowOnDisabled="True">
@@ -187,9 +187,11 @@
<TextBlock Text="{Binding KeyText}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" Style="{StaticResource Text.Secondary}"
ToolTip="{l:Loc Tooltips.Editor.Camera.Keys}" />
<Button Grid.Column="1" Style="{StaticResource Button.Icon}" Width="28" Height="28" MinWidth="28" Margin="8,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Plus}"
Command="{Binding AddKeyCommand}" ToolTip="{l:Loc Tooltips.Editor.Camera.AddKey}" AutomationProperties.Name="{l:Loc Editor.Camera.AddKey}" />
Command="{Binding AddKeyCommand}" ToolTip="{Binding AddKeyToolTip}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.Camera.AddKey}" />
<Button Grid.Column="2" Style="{StaticResource Button.Icon}" Width="28" Height="28" MinWidth="28" Margin="6,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Minus}"
Command="{Binding RemoveKeyCommand}" ToolTip="{l:Loc Tooltips.Editor.Camera.RemoveKey}" AutomationProperties.Name="{l:Loc Editor.Camera.RemoveKey}" />
Command="{Binding RemoveKeyCommand}" ToolTip="{Binding RemoveKeyToolTip}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.Camera.RemoveKey}" />
</Grid>
<StackPanel Visibility="{Binding HasSelectedKey, Converter={StaticResource BoolToVisibility}}">
<Grid MinHeight="24">
@@ -274,9 +276,9 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Content="{l:Loc Editor.Export.AddToQueue}" Command="{Binding AddToQueueCommand}" ToolTip="{l:Loc Tooltips.Editor.Export.AddToQueue}"
<Button Content="{l:Loc Editor.Export.AddToQueue}" Command="{Binding AddToQueueCommand}" ToolTip="{Binding AddToQueueToolTip}"
ToolTipService.ShowOnDisabled="True" />
<Button Grid.Column="1" Content="{l:Loc Editor.Export.Batch}" Margin="8,0,0,0" Command="{Binding BatchCommand}" ToolTip="{l:Loc Tooltips.Editor.Export.Batch}"
<Button Grid.Column="1" Content="{l:Loc Editor.Export.Batch}" Margin="8,0,0,0" Command="{Binding BatchCommand}" ToolTip="{Binding BatchToolTip}"
ToolTipService.ShowOnDisabled="True" />
</Grid>
<Button Style="{StaticResource Button.Primary}" Height="36" Content="{l:Loc Editor.Export.RenderNow}" Command="{Binding RenderNowCommand}"
@@ -284,14 +286,17 @@
<DockPanel Margin="0,8,0,0">
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.HistoryLink}" Command="{Binding HistoryCommand}"
ToolTip="{l:Loc Tooltips.Editor.Export.History}" Margin="6,0,0,0" />
<TextBlock Text="{Binding HistoryText}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.Reveal}" Command="{Binding RevealLastCommand}"
ToolTip="{l:Loc Tooltips.Editor.Render.Reveal}" Margin="6,0,0,0" Visibility="{Binding HasHistory, Converter={StaticResource BoolToVisibility}}" />
<TextBlock Text="{Binding HistoryText}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
ToolTip="{Binding HistoryText}" />
</DockPanel>
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.BusyToolTip}" ToolTipService.ShowOnDisabled="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="88" />
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -305,15 +310,15 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Container}" />
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Container}" ToolTip="{l:Loc Editor.Export.Container}" />
<ComboBox Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Containers}" SelectedItem="{Binding SelectedContainer}" DisplayMemberPath="Label"
ToolTip="{l:Loc Tooltips.Editor.Export.Container}" AutomationProperties.Name="{l:Loc Editor.Export.Container}" />
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Codec}" />
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Codec}" ToolTip="{l:Loc Editor.Export.Codec}" />
<ComboBox Grid.Row="1" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding CodecChoices}" SelectedItem="{Binding SelectedCodec}" DisplayMemberPath="Label"
ToolTip="{l:Loc Tooltips.Editor.Export.Codec}" AutomationProperties.Name="{l:Loc Editor.Export.Codec}" />
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Resolution}" />
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Resolution}" ToolTip="{l:Loc Editor.Export.Resolution}" />
<Grid Grid.Row="2" Grid.Column="1" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="56" />
@@ -329,7 +334,7 @@
<TextBlock Grid.Column="3" Text="{Binding AspectText}" Style="{StaticResource Text.Hint}" FontSize="{StaticResource Size.Secondary}" Margin="6,0,0,0" />
</Grid>
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FrameRate}" />
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FrameRate}" ToolTip="{l:Loc Editor.Export.FrameRate}" />
<Grid Grid.Row="3" Grid.Column="1" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -346,7 +351,7 @@
Visibility="{Binding IsFrameRateAuto, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
</Grid>
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Quality}" />
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Quality}" ToolTip="{l:Loc Editor.Export.Quality}" />
<Grid Grid.Row="4" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -361,7 +366,7 @@
Visibility="{Binding IsQualityApplicable, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
</Grid>
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Encoder}" />
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Encoder}" ToolTip="{l:Loc Editor.Export.Encoder}" />
<Grid Grid.Row="5" Grid.Column="1" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -369,20 +374,30 @@
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding Encoders}" SelectedItem="{Binding SelectedEncoder}" DisplayMemberPath="Label"
ToolTip="{l:Loc Tooltips.Editor.Export.Encoder}" AutomationProperties.Name="{l:Loc Editor.Export.Encoder}" />
<TextBlock x:Name="Kind" Grid.Column="1" Text="{Binding EncoderKind}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}"
VerticalAlignment="Center" Margin="8,0,0,0" />
<TextBlock Grid.Column="1" Text="{Binding EncoderKind}" FontSize="{StaticResource Size.Secondary}" VerticalAlignment="Center" Margin="8,0,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsHardware}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Brush.Success}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Colour}" />
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Colour}" ToolTip="{l:Loc Editor.Export.Colour}" />
<ComboBox Grid.Row="6" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Depths}" SelectedItem="{Binding SelectedDepth}" DisplayMemberPath="Label"
IsEnabled="{Binding CanChooseDepth}" ToolTip="{l:Loc Tooltips.Editor.Export.Colour}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.Export.Colour}" />
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FileName}" />
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FileName}" ToolTip="{l:Loc Editor.Export.FileName}" />
<TextBox Grid.Row="7" Grid.Column="1" Margin="0,0,0,8" Text="{Binding NameTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
shell:EditBehavior.Field="{Binding NameTemplate}" ToolTip="{Binding NameTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.FileName}" />
<TextBlock Grid.Row="8" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.SaveTo}" />
<TextBlock Grid.Row="8" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.SaveTo}" ToolTip="{l:Loc Editor.Export.SaveTo}" />
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding SaveChoices}" SelectedItem="{Binding SelectedSave}" DisplayMemberPath="Label"
ToolTip="{Binding SaveToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.SaveTo}" />
</Grid>
+20 -6
View File
@@ -1,4 +1,5 @@
using Titano.Core.Advice;
using Titano.Core.Diagnostics;
using Titano.Core.Export;
using Titano.Core.Project;
using Titano.Core.Video;
@@ -35,7 +36,7 @@ public sealed class EditorSession : IAsyncDisposable
History = new ProjectHistory(content.Project);
History.Changed += OnProjectChanged;
_saver = new ProjectSaver(SaveAsync, saveDelay ?? DefaultSaveDelay);
_saver.Failed += ex => SaveFailed?.Invoke(ex);
_saver.Failed += OnSaveFailed;
(Content, Context, Advice, Presets) = Analyse(content, _codecs);
}
@@ -45,7 +46,7 @@ public sealed class EditorSession : IAsyncDisposable
/// <summary>The sequence was read again (after an analysis): frames, reports, advice and presets.</summary>
public event Action? ContentChanged;
/// <summary>Saving the project failed; the next change tries again.</summary>
/// <summary>Saving the project failed (raised once per run of failures; the save is retried until it succeeds).</summary>
public event Action<Exception>? SaveFailed;
public ISequenceSource Source { get; }
@@ -64,9 +65,12 @@ public sealed class EditorSession : IAsyncDisposable
public ProjectSettings Project => History.Current;
/// <summary>A change is waiting for its save or being saved.</summary>
/// <summary>A change is waiting for its save, being saved, or waiting for a retry after a failed save.</summary>
public bool HasPendingSave => _saver.HasPendingChanges;
/// <summary>Why the pending change could not be stored; null when the last save succeeded.</summary>
public Exception? LastSaveError => _saver.LastError;
/// <summary>Applies <paramref name="change"/> as an undoable step; false when it changes nothing.</summary>
/// <param name="mergeKey">Consecutive edits with the same key are one undo step (a slider drag).</param>
public bool Edit(Func<ProjectSettings, ProjectSettings> change, string? mergeKey = null)
@@ -75,6 +79,9 @@ public sealed class EditorSession : IAsyncDisposable
return History.Apply(change(Project), mergeKey);
}
/// <summary>The drag or key press behind a run of merged edits ended (<see cref="ProjectHistory.EndRun"/>).</summary>
public void EndEditRun() => History.EndRun();
public bool Undo() => History.Undo();
public bool Redo() => History.Redo();
@@ -146,13 +153,14 @@ public sealed class EditorSession : IAsyncDisposable
ContentChanged?.Invoke();
}
/// <summary>Stores pending changes now.</summary>
public Task FlushAsync() => _saver.FlushAsync();
/// <summary>Stores pending changes now; false when the save failed (the change stays pending and is retried).</summary>
public Task<bool> FlushAsync() => _saver.FlushAsync();
/// <summary>Stores what is pending one last time and releases the source; callers that must not lose an edit flush and ask first.</summary>
public async ValueTask DisposeAsync()
{
History.Changed -= OnProjectChanged;
await _saver.FlushAsync();
if (!await _saver.FlushAsync()) Log.Warning("editor", $"The last change of {Content.Sequence.DisplayTitle} was not saved", _saver.LastError);
await Source.DisposeAsync();
}
@@ -177,6 +185,12 @@ public sealed class EditorSession : IAsyncDisposable
return changes;
}
private void OnSaveFailed(Exception ex, int failures)
{
Log.Warning("editor", $"Saving the project of {Content.Sequence.DisplayTitle} failed (attempt {failures})", ex);
if (failures == 1) SaveFailed?.Invoke(ex);
}
private void OnProjectChanged()
{
_saver.Schedule(Project);
+95 -9
View File
@@ -12,29 +12,50 @@
<GridLength x:Key="Editor.Grid.ExportPreview">9*</GridLength>
<GridLength x:Key="Editor.Grid.ExportMeasure">12*</GridLength>
<GridLength x:Key="Editor.Grid.Panel">320</GridLength>
<!-- Label column of the Output panel (Export.html 96 px); labels end in an ellipsis and say it all in their tooltip. -->
<GridLength x:Key="Editor.Grid.Label">96</GridLength>
<!-- Tools over the preview: 30 px, chrome fill, accent when on (Editor.html). -->
<!-- Tools over the preview (Editor.html): 30 px, icon and label, chrome fill, accent when on. -->
<Style x:Key="ToggleButton.PreviewTool" TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Width" Value="30" />
<Setter Property="MinWidth" Value="30" />
<Setter Property="Height" Value="30" />
<Setter Property="Padding" Value="0" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="Margin" Value="0,0,6,0" />
<Setter Property="Background" Value="{DynamicResource Brush.Chrome}" />
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.Card}" />
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
</Style>
<Style x:Key="Button.PreviewTool" TargetType="Button" BasedOn="{StaticResource Button.Base}">
<!-- Icon-only tools (full screen, play, crop view): square, named for assistive technology. -->
<Style x:Key="ToggleButton.PreviewToolIcon" TargetType="ToggleButton" BasedOn="{StaticResource ToggleButton.PreviewTool}">
<Setter Property="Width" Value="30" />
<Setter Property="Padding" Value="0" />
</Style>
<Style x:Key="Button.PreviewTool" TargetType="Button" BasedOn="{StaticResource Button.Base}">
<Setter Property="MinWidth" Value="30" />
<Setter Property="Height" Value="30" />
<Setter Property="Padding" Value="0" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="Margin" Value="0,0,6,0" />
<Setter Property="Background" Value="{DynamicResource Brush.Chrome}" />
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.Card}" />
</Style>
<Style x:Key="Button.PreviewToolIcon" TargetType="Button" BasedOn="{StaticResource Button.PreviewTool}">
<Setter Property="Width" Value="30" />
<Setter Property="Padding" Value="0" />
</Style>
<!-- Play / pause: the glyph follows the player. -->
<Style x:Key="Button.PlayTool" TargetType="Button" BasedOn="{StaticResource Button.PreviewToolIcon}">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Play}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying}" Value="True">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Pause}" />
</DataTrigger>
</Style.Triggers>
</Style>
<!-- Settings column (320 px panel, Editor.html aside). -->
<Style x:Key="Border.EditorPanel" TargetType="Border" BasedOn="{StaticResource Border.Panel}">
<Setter Property="Padding" Value="14" />
@@ -54,6 +75,48 @@
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<!-- Section Reset (Editor.html): stroke border, transparent fill, muted text. -->
<Style x:Key="Button.SectionReset" TargetType="Button" BasedOn="{StaticResource Button.Base}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.Card}" />
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
</Style>
<!-- Sortable column header of the frame table (DESIGN §4: 11 px faint, sortable); the chevron marks the sorted column. -->
<Style x:Key="Button.SortHeader" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
<Setter Property="Foreground" Value="{DynamicResource Brush.TextFaint}" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Height" Value="28" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="Transparent">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="Center">
<ContentPresenter VerticalAlignment="Center" />
<ui:Icon x:Name="Arrow" Glyph="{StaticResource Icon.ChevronUp}" Size="12" Margin="2,0,0,0" VerticalAlignment="Center" Visibility="Collapsed" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsSorted}" Value="True">
<Setter TargetName="Arrow" Property="Visibility" Value="Visible" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
</DataTrigger>
<DataTrigger Binding="{Binding IsDescending}" Value="True">
<Setter TargetName="Arrow" Property="Glyph" Value="{StaticResource Icon.ChevronDown}" />
</DataTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Preset card (Export.html): card fill, stroke, radius 8; accent border and glow when selected. -->
<Style x:Key="Button.PresetCard" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
@@ -63,7 +126,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Height" Value="118" />
<Setter Property="Margin" Value="0,0,10,10" />
<Setter Property="Margin" Value="5,0,5,10" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
@@ -102,12 +165,35 @@
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<!-- A finding of the warnings list: glyph and one sentence, click seeks its first frame. -->
<Style x:Key="Button.Finding" TargetType="Button" BasedOn="{StaticResource Button.Subtle}">
<Setter Property="Height" Value="Auto" />
<!--
A finding of the warnings list: glyph and one sentence, click seeks its first frame. Its own template (no
horizontal StackPanel as in the kit's buttons) so the sentence is measured at the panel width and wraps.
-->
<Style x:Key="Button.Finding" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="Padding" Value="6,4" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="{StaticResource Radius.Control}" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.CardPressed}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+21 -1
View File
@@ -39,7 +39,10 @@ public abstract class EditorTab : LocalizedViewModel
public virtual bool CanReset => true;
public string OptimiseToolTip => Loc.L(CanOptimise ? "Tooltips.Editor.OptimiseSection" : "Tooltips.Editor.OptimiseNone");
/// <summary>What Optimise section does, or why it cannot run now.</summary>
public string OptimiseToolTip => Loc.L(!CanOptimise ? "Tooltips.Editor.OptimiseNone" : Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.OptimiseSection");
public string ResetToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.ResetSection");
public ICommand OptimiseCommand { get; }
@@ -64,6 +67,23 @@ public abstract class EditorTab : LocalizedViewModel
{
}
/// <summary>The frame on screen changed (playheads, the frame table, keyframe commands).</summary>
public virtual void OnCurrentFrameChanged()
{
}
/// <summary>A job of this sequence started or ended: commands and their tooltips follow.</summary>
public virtual void OnBusyChanged()
{
OnPropertyChanged(nameof(OptimiseToolTip));
OnPropertyChanged(nameof(ResetToolTip));
}
/// <summary>Raises the enabled state of the tab's asynchronous commands (the others follow the command manager).</summary>
public virtual void RefreshCommands()
{
}
public override void Dispose()
{
foreach (var row in Rows) row.Dispose();
+89
View File
@@ -1,7 +1,11 @@
using System.Collections;
using System.Globalization;
using Titano.App.Infrastructure;
using Titano.Core.Advice;
using Titano.Core.Export;
using Titano.Core.Localization;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Core.Video;
namespace Titano.App.Editor;
@@ -24,6 +28,24 @@ public static class EditorText
return string.Join(Separator, parts);
}
/// <summary>"3,600 frames · 24 fps · 2 min 30 s · 3840×2160 · source 8192×5464": what the export makes of the sequence (Export.html header).</summary>
public static string OutputSummary(SequenceContent content, ExportPlan plan)
{
ArgumentNullException.ThrowIfNull(content);
ArgumentNullException.ThrowIfNull(plan);
var render = plan.Setup.Plan;
var settings = plan.Setup.Encoder.Settings;
var parts = new List<string>
{
Loc.Plural("Editor.Summary.Frames", content.Count),
Loc.L("Editor.Value.Fps", FrameRate(render.FrameRate)),
Formatting.Duration(TimeSpan.FromSeconds(render.DurationSeconds)),
};
if (settings.Width > 0 && settings.Height > 0) parts.Add(Size(settings.Width, settings.Height));
if (content.SourceWidth > 0 && content.SourceHeight > 0) parts.Add(Loc.L("Editor.Summary.Source", Size(content.SourceWidth, content.SourceHeight)));
return string.Join(Separator, parts);
}
/// <summary>"0413 / 3,600 · 18:02:11 · 1/8 s · f/8 · ISO 400 · 24 mm".</summary>
public static string Shot(Frame frame, int index, int count)
{
@@ -100,5 +122,72 @@ public static class EditorText
_ => Loc.L("Export.Codec." + codec),
};
/// <summary>"+1.0", "−0.7" (EV with a sign).</summary>
public static string Ev(double ev) => ev.ToString("+0.0;−0.0;0.0", Loc.Culture);
/// <summary>"01:17.2" (minutes, seconds and tenths of a video position).</summary>
public static string Clock(double seconds)
{
var t = TimeSpan.FromSeconds(double.Max(0, seconds));
return ((int)t.TotalMinutes).ToString("00", Loc.Culture) + ":" + t.Seconds.ToString("00", Loc.Culture) + Loc.Culture.NumberFormat.NumberDecimalSeparator
+ (t.Milliseconds / 100).ToString(Loc.Culture);
}
/// <summary>"Centred", "+0.25" (crop placement −1…1).</summary>
public static string Placement(double value) => value == 0 ? Loc.L("Editor.Value.Centred") : value.ToString("+0.00;−0.00", Loc.Culture);
/// <summary>The label of an advisor parameter as its control shows it.</summary>
public static string ParameterLabel(string parameter) => parameter switch
{
AdvisorParameters.Hero => Loc.L("Editor.Frames.HeroLabel"),
AdvisorParameters.Excluded => Loc.L("Editor.Frames.ExcludedLabel"),
AdvisorParameters.TimingMode => Loc.L("Editor.Time.Mode"),
AdvisorParameters.FrameRate => Loc.L("Editor.Time.Rate"),
AdvisorParameters.FitToSeconds => Loc.L("Editor.Time.Fit"),
AdvisorParameters.Deflicker => Loc.L("Editor.Exposure.Deflicker"),
AdvisorParameters.DeflickerWindow => Loc.L("Editor.Exposure.Window"),
AdvisorParameters.DeflickerStrength => Loc.L("Editor.Exposure.Strength"),
AdvisorParameters.Regions => Loc.L("Editor.Exposure.Regions"),
AdvisorParameters.HolyGrail => Loc.L("Editor.Exposure.HolyGrail"),
AdvisorParameters.TransitionLength => Loc.L("Editor.Exposure.Transitions"),
AdvisorParameters.WhiteBalanceSmoothing => Loc.L("Editor.Exposure.WhiteBalance"),
AdvisorParameters.MotionBlur => Loc.L("Editor.Motion.Blur"),
AdvisorParameters.TargetShutterAngle => Loc.L("Editor.Motion.Shutter"),
AdvisorParameters.FlowQuality => Loc.L("Editor.Motion.Flow"),
AdvisorParameters.Stabilize => Loc.L("Editor.Motion.Stabilize"),
AdvisorParameters.StabilizeSmoothing => Loc.L("Editor.Motion.Smoothing"),
AdvisorParameters.Aspect => Loc.L("Editor.Camera.Aspect"),
AdvisorParameters.OffsetY => Loc.L("Editor.Camera.OffsetY"),
AdvisorParameters.ExportPreset => Loc.L("Editor.Export.Preset"),
AdvisorParameters.Resolution => Loc.L("Editor.Export.Resolution"),
_ => parameter,
};
/// <summary>A value of an advisor parameter as its control shows it (the "what changed" toast of Optimise).</summary>
public static string Value(string parameter, object? value) => (parameter, value) switch
{
(_, null) => Loc.L("Editor.Value.None"),
(AdvisorParameters.Hero, int frame) => Loc.L("Editor.Frames.HeroValue", (frame + 1).ToString("D4", Loc.Culture)),
(AdvisorParameters.Aspect, "source") => Loc.L("Editor.Aspect.Source"),
(AdvisorParameters.FrameRate, string rate) when FrameRateText.TryParse(rate, out var parsed) => Loc.L("Editor.Value.Fps", FrameRate(parsed)),
(AdvisorParameters.FitToSeconds, double seconds) => Formatting.Duration(TimeSpan.FromSeconds(seconds)),
(AdvisorParameters.DeflickerWindow or AdvisorParameters.TransitionLength, int frames) => Loc.Plural("Editor.Value.Frames", frames),
(AdvisorParameters.DeflickerStrength, double strength) => strength.ToString("0.00", Loc.Culture),
(AdvisorParameters.TargetShutterAngle, double degrees) => Loc.L("Editor.Value.Degrees", degrees.ToString("0", Loc.Culture)),
(AdvisorParameters.StabilizeSmoothing, double sigma) => Loc.Plural("Editor.Value.Frames", (long)double.Round(sigma)),
(AdvisorParameters.OffsetY, double offset) => Placement(offset),
(AdvisorParameters.Resolution, string size) => size.Replace('x', '×'),
(_, bool on) => Loc.L(on ? "Editor.Value.On" : "Editor.Value.Off"),
(_, TimingMode mode) => Loc.L("Editor.Timing." + mode),
(_, RegionMode mode) => mode == RegionMode.Off ? Loc.L("Editor.Value.Off") : Loc.L("Editor.Regions." + mode),
(_, FlowQualitySetting quality) => Loc.L("Editor.Flow." + quality),
(_, string id) when ExportPresets.Find(id) is { } preset => Loc.L(preset.NameKey),
(_, string text) => text,
(_, double number) => number.ToString("0.##", Loc.Culture),
(_, IEnumerable list) => Loc.Plural("Editor.Value.Frames", list.Cast<object>().LongCount()),
(_, IFormattable formattable) => formattable.ToString(null, Loc.Culture),
_ => Convert.ToString(value, CultureInfo.InvariantCulture) ?? string.Empty,
};
private static string Number(double value) => value.ToString(value >= 10 ? "0" : "0.#", Loc.Culture);
}
+218 -104
View File
@@ -1,9 +1,8 @@
using System.Collections;
using System.Globalization;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using Titano.App.Infrastructure;
using Titano.App.Shell;
using Titano.Core.Advice;
using Titano.Core.Analysis;
@@ -14,6 +13,7 @@ using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Core.Render;
using Titano.Core.Video;
using Titano.Ui.Controls;
using Titano.Ui.Mvvm;
using Titano.Ui.Visuals;
@@ -21,10 +21,11 @@ namespace Titano.App.Editor;
/// <summary>
/// The sequence editor of one open sequence (BRIEF §12.3, Editor.html): header actions, the preview with its tools
/// (wipe compare, zoom, overlays) rendered through the pipeline at preview size, the filmstrip with markers, the
/// section tabs and the keyboard (space, arrows, Ctrl+Z/Y, Ctrl+0/1, Ctrl+R). Preview frames, corrections, the export
/// plan and the card estimates are computed off the UI thread; each request cancels the previous one. While an analysis
/// or render of this sequence runs, settings are disabled and viewing tools stay live.
/// (wipe compare, zoom, overlays) rendered through the pipeline at preview size (at the source's own size for 1:1 and
/// wheel zoom), the filmstrip with markers, the section tabs and the keyboard (space, arrows, Ctrl+Z/Y, Ctrl+0/1,
/// Ctrl+R, Ctrl+Shift+A). Preview frames, corrections, the export plan and the card estimates are computed off the UI
/// thread; each request cancels the previous one. While an analysis or render of this sequence runs, settings are
/// disabled and viewing tools stay live.
/// </summary>
public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
@@ -39,15 +40,21 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private readonly LatestRunner _plans = new(Debounce);
private readonly DispatcherTimer _player;
private readonly Dictionary<Guid, Job> _jobs = [];
private readonly AsyncRelayCommand _analyse;
private readonly AsyncRelayCommand _render;
private PreviewRenderer _renderer;
private int _currentIndex;
private EditorTab _selectedTab;
private ImageSource? _previewImage;
private ImageSource? _originalImage;
private ImageSource? _waveformImage;
private string? _previewMessage;
private bool _isCompare = true;
private bool _showVectors;
private bool _showRegions;
private bool _showCropMask;
private bool _exportCropMask = true;
private CropMaskMode _cropMaskMode = CropMaskMode.ShowLoss;
private PreviewZoomMode _zoomMode = PreviewZoomMode.Fit;
private Rect _cropRect = new(0, 0, 1, 1);
private IReadOnlyList<Point>? _regionBoundary;
@@ -57,9 +64,11 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private bool _previewBusy;
private RenderCorrections? _correctionsValue;
private ExportPlan? _plan;
private bool _planned;
private IReadOnlyList<TimelineMarker> _markers = [];
private IThumbnailSource _thumbnails;
private int _playLimit;
private double? _analysisSecondsPerFrame;
private bool _disposed;
public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList<IVideoEncoderProvider> encoders, EncoderHost host)
@@ -75,17 +84,10 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
_player = new DispatcherTimer(DispatcherPriority.Background, _dispatcher);
_player.Tick += (_, _) => Advance();
Frames = new FramesTab(this);
Exposure = new ExposureTab(this);
Tabs = [Frames, Exposure, new MotionTab(this), new CameraTab(this), new TimeTab(this), new StackTab(this), new ExportTab(this)];
_selectedTab = Exposure;
_currentIndex = session.Project.HeroFrame is { } hero && (uint)hero < (uint)FrameCount ? hero : 0;
RenderChoices = [.. ExportPresets.BuiltIn.Select(p => new Choice(p.Id, p.NameKey))];
BackCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Library));
AnalyseCommand = new AsyncRelayCommand(AnalyseAsync, () => !IsBusy);
_analyse = new AsyncRelayCommand(AnalyseAsync, () => !IsBusy && !IsAnalysing);
OptimiseAllCommand = new RelayCommand(OptimiseAll, () => !IsBusy);
RenderCommand = new AsyncRelayCommand(() => RenderAsync(JobPriority.User, batch: false), () => CanRender);
_render = new AsyncRelayCommand(() => RenderAsync(JobPriority.User, batch: false), () => CanRender);
UndoCommand = new RelayCommand(() => Session.Undo(), () => !IsBusy && Session.History.CanUndo);
RedoCommand = new RelayCommand(() => Session.Redo(), () => !IsBusy && Session.History.CanRedo);
PlayCommand = new RelayCommand(() => TogglePlay(limit: 0));
@@ -93,7 +95,14 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
StepBackCommand = new RelayCommand(() => CurrentIndex--);
StepForwardCommand = new RelayCommand(() => CurrentIndex++);
FitCommand = new RelayCommand(() => ZoomMode = PreviewZoomMode.Fit);
ActualSizeCommand = new RelayCommand(() => ZoomMode = PreviewZoomMode.Actual);
ActualSizeCommand = new RelayCommand(() => ZoomMode = PreviewZoomMode.Actual, () => !IsExportTab);
Frames = new FramesTab(this);
Exposure = new ExposureTab(this);
Tabs = [Frames, Exposure, new MotionTab(this), new CameraTab(this), new TimeTab(this), new StackTab(this), new ExportTab(this)];
_selectedTab = Exposure;
_currentIndex = session.Project.HeroFrame is { } hero && (uint)hero < (uint)FrameCount ? hero : 0;
RenderChoices = [.. ExportPresets.BuiltIn.Select(p => new Choice(p.Id, p.NameKey))];
session.ProjectChanged += OnProjectChanged;
session.ContentChanged += OnContentChanged;
@@ -113,8 +122,13 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public string Title => Session.Content.Sequence.DisplayTitle;
/// <summary>"3,600 frames · Canon EOS R5 · 2 s interval · 2 h 00 m · 3 warnings".</summary>
public string Summary => EditorText.Summary(Session.Content, Session.Advice.Findings.Count(f => f.Severity >= FindingSeverity.Warning));
/// <summary>
/// "3,600 frames · Canon EOS R5 · 2 s interval · 2 h 00 m · 3 warnings"; on the Export tab what the video will be:
/// "3,600 frames · 24 fps · 2 min 30 s · 3840×2160 · source 8192×5464" (Export.html).
/// </summary>
public string Summary => IsExportTab && Plan is { } plan
? EditorText.OutputSummary(Session.Content, plan)
: EditorText.Summary(Session.Content, Session.Advice.Findings.Count(f => f.Severity >= FindingSeverity.Warning));
public FramesTab Frames { get; }
@@ -129,8 +143,13 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
if (value is null || !Set(ref _selectedTab, value)) return;
OnPropertyChanged(nameof(IsExportTab));
if (IsExportTab && !ShowCropMask) ShowCropMask = true;
OnPropertyChanged(nameof(Summary));
OnToolsChanged();
// 1:1 is not a tool of the Export tab (Export.html): its picture fits the view.
if (IsExportTab) ZoomMode = PreviewZoomMode.Fit;
UpdateInfo();
RequestPreview(immediate: true);
CommandManager.InvalidateRequerySuggested();
}
}
@@ -149,9 +168,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
var clamped = FrameCount == 0 ? 0 : int.Clamp(value, 0, FrameCount - 1);
if (!Set(ref _currentIndex, clamped)) return;
Frames.OnCurrentFrameChanged();
foreach (var tab in Tabs.OfType<CameraTab>()) tab.OnCurrentFrameChanged();
foreach (var tab in Tabs.OfType<TimeTab>()) tab.OnCurrentFrameChanged();
foreach (var tab in Tabs) tab.OnCurrentFrameChanged();
UpdateInfo();
RequestPreview(immediate: _player.IsEnabled);
}
@@ -168,14 +185,23 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public ImageSource? OriginalImage { get => _originalImage; private set => Set(ref _originalImage, value); }
/// <summary>Luma waveform of the corrected preview (Exposure tab), as an alpha mask drawn in the accent colour.</summary>
public ImageSource? WaveformImage { get => _waveformImage; private set => Set(ref _waveformImage, value); }
/// <summary>One sentence over the preview when the frame on screen cannot be shown; null otherwise.</summary>
public string? PreviewMessage { get => _previewMessage; private set => Set(ref _previewMessage, value); }
public bool IsCompare { get => _isCompare; set => Set(ref _isCompare, value); }
/// <summary>The Vectors tool (kept while the Export tab hides it, shown again on the other tabs).</summary>
public bool ShowVectors
{
get => _showVectors;
set
{
if (Set(ref _showVectors, value)) RequestPreview(immediate: true);
if (!Set(ref _showVectors, value)) return;
OnPropertyChanged(nameof(ViewVectors));
RequestPreview(immediate: true);
}
}
@@ -184,25 +210,56 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
get => _showRegions;
set
{
if (Set(ref _showRegions, value)) RequestPreview(immediate: true);
if (!Set(ref _showRegions, value)) return;
OnPropertyChanged(nameof(ViewRegions));
RequestPreview(immediate: true);
}
}
/// <summary>The Crop mask tool of the current tab: the Export tab has its own, on by default (Export.html).</summary>
public bool ShowCropMask
{
get => _showCropMask;
get => IsExportTab ? _exportCropMask : _showCropMask;
set
{
if (Set(ref _showCropMask, value)) RequestPreview(immediate: true);
if (value == ShowCropMask) return;
if (IsExportTab) _exportCropMask = value;
else _showCropMask = value;
OnPropertyChanged();
RequestPreview(immediate: true);
}
}
/// <summary>Overlays the viewport draws: only tools that have a button on the current tab.</summary>
public bool ViewVectors => ShowVectors && !IsExportTab;
public bool ViewRegions => ShowRegions && !IsExportTab;
/// <summary>The crop mask shows "how it will look" (outside hidden) instead of "what I lose" (outside dimmed).</summary>
public bool IsCropResult
{
get => _cropMaskMode == CropMaskMode.ShowResult;
set
{
if (!Set(ref _cropMaskMode, value ? CropMaskMode.ShowResult : CropMaskMode.ShowLoss, nameof(CropMaskMode))) return;
OnPropertyChanged();
OnPropertyChanged(nameof(CropModeToolTip));
}
}
public CropMaskMode CropMaskMode => _cropMaskMode;
public string CropModeToolTip => Loc.L(IsCropResult ? "Tooltips.Editor.Preview.CropLoss" : "Tooltips.Editor.Preview.CropResult");
public PreviewZoomMode ZoomMode
{
get => _zoomMode;
set
{
if (Set(ref _zoomMode, value)) OnPropertyChanged(nameof(IsActualSize));
if (!Set(ref _zoomMode, value)) return;
OnPropertyChanged(nameof(IsActualSize));
// Fit renders at the view's size; 1:1 and wheel zoom need the source's own pixels.
RequestPreview(immediate: true);
}
}
@@ -227,17 +284,22 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// <summary>Shot data (bottom-right pill): frame, time, exposure; on the Export tab output time and size.</summary>
public string? InfoText { get; private set; }
/// <summary>Long edge of the preview picture in device pixels (the view reports its size).</summary>
/// <summary>Long edge of the view in device pixels (the view reports its size); Fit renders at this size.</summary>
public int PreviewEdge
{
get => _previewEdge;
set
{
var rounded = int.Clamp((value + 63) / 64 * 64, 256, 4096);
if (Set(ref _previewEdge, rounded)) RequestPreview();
if (Set(ref _previewEdge, rounded) && _zoomMode == PreviewZoomMode.Fit) RequestPreview();
}
}
/// <summary>Long edge the preview renders at: the view's in Fit, the source's own when zoomed (1:1 shows raw pixels).</summary>
public int RenderEdge => _zoomMode == PreviewZoomMode.Fit || SourceEdge <= 0 ? PreviewEdge : SourceEdge;
private int SourceEdge => int.Max(Session.Content.SourceWidth, Session.Content.SourceHeight);
// ---- Analysis, plan, jobs ----
/// <summary>The corrections of the current exposure settings, once prepared (target curves).</summary>
@@ -249,14 +311,30 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// <summary>An analysis or render of this sequence is running: settings wait, viewing tools stay live.</summary>
public bool IsBusy => _jobs.Values.Any(j => j.State == JobState.Running);
/// <summary>A deep analysis of this sequence is queued or running (Analyse would queue it twice).</summary>
public bool IsAnalysing => _jobs.Values.Any(j => j.Kind == JobKind.DeepAnalyse);
public bool IsEditable => !IsBusy;
public string? BusyToolTip => IsBusy ? Loc.L("Tooltips.Editor.Busy") : null;
/// <summary>What Analyse does and costs ("about 6 min" from the speed of the last analysis), or why it is disabled.</summary>
public string AnalyseToolTip => IsBusy ? Loc.L("Tooltips.Editor.Busy")
: IsAnalysing ? Loc.L("Tooltips.Editor.AnalyseQueued")
: _analysisSecondsPerFrame is { } perFrame ? Loc.L("Tooltips.Editor.AnalyseCost", Formatting.Duration(TimeSpan.FromSeconds(perFrame * FrameCount)))
: Loc.L("Tooltips.Editor.Analyse");
public string OptimiseAllToolTip => Loc.L(IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.OptimiseAll");
public bool IsPlaying => _player.IsEnabled;
public string PlayToolTip => Loc.L(IsPlaying ? "Tooltips.Editor.Pause" : "Tooltips.Editor.Play");
public string PlayName => Loc.L(IsPlaying ? "Editor.Preview.Pause" : "Editor.Preview.Play");
/// <summary>"Preview 10 s" (Export tab): plays ten seconds of the video's frames, or pauses them.</summary>
public string ClipToolTip => Loc.L(IsPlaying ? "Tooltips.Editor.Pause" : "Tooltips.Editor.Preview.Clip");
// ---- Render ----
public IReadOnlyList<Choice> RenderChoices { get; }
@@ -276,16 +354,27 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// <summary>"Render · 4K archive".</summary>
public string RenderText => Loc.L("Editor.Render", Plan?.PresetName ?? string.Empty);
public string RenderToolTip => Plan is { } plan && !plan.Setup.Encoder.IsReady && plan.Setup.Encoder.Notices.LastOrDefault() is { } notice
? Loc.L(notice.Key, [.. notice.Args])
: Loc.L("Tooltips.Editor.Render");
public string RenderToolTip => RenderBlockedReason ?? Loc.L("Tooltips.Editor.Render");
public bool CanRender => Plan is { NameError: null, Setup: { Encoder.IsReady: true, Plan.Frames.Count: > 0 } };
public bool CanRender => RenderBlockedReason is null;
/// <summary>Why the project's export cannot be rendered now, localised; null when it can.</summary>
public string? RenderBlockedReason => Plan switch
{
null when _planned => Loc.L("Tooltips.Editor.Render.NoSource"),
null => Loc.L("Tooltips.Editor.Render.Planning"),
{ NameError: { } error } => Loc.L("Tooltips.Editor.Render.NameError", error),
{ Setup.Encoder.IsReady: false } plan => plan.Setup.Encoder.Notices.LastOrDefault() is { } notice
? Loc.L(notice.Key, [.. notice.Args])
: Loc.L("Editor.Export.Unavailable"),
{ Setup.Plan.Frames.Count: 0 } => Loc.L("Tooltips.Editor.Render.NoFrames"),
_ => null,
};
public ICommand BackCommand { get; }
public ICommand AnalyseCommand { get; }
public ICommand AnalyseCommand => _analyse;
public ICommand OptimiseAllCommand { get; }
public ICommand RenderCommand { get; }
public ICommand RenderCommand => _render;
public ICommand UndoCommand { get; }
public ICommand RedoCommand { get; }
public ICommand PlayCommand { get; }
@@ -302,9 +391,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
if (content.Deep is { } deep)
{
return [.. deep.Exposure.Steps.Select(s => new TimelineMarker(s.Index, s.Received ? MarkerKind.ExposureStep : MarkerKind.Warning,
Loc.L(s.Received ? "Editor.Marker.Step" : "Editor.Marker.StepIgnored", Ev(s.MeasuredEv ?? s.ExpectedEv))))];
Loc.L(s.Received ? "Editor.Marker.Step" : "Editor.Marker.StepIgnored", EditorText.Ev(s.MeasuredEv ?? s.ExpectedEv))))];
}
return [.. content.Light.ExposureSteps.Select(s => new TimelineMarker(s.Index, MarkerKind.ExposureStep, Loc.L("Editor.Marker.Step", Ev(s.DeltaEv))))];
return [.. content.Light.ExposureSteps.Select(s => new TimelineMarker(s.Index, MarkerKind.ExposureStep, Loc.L("Editor.Marker.Step", EditorText.Ev(s.DeltaEv))))];
}
/// <summary>"Optimise section": the advisor's heavier decisions, reported in a toast (what changed, from what to what).</summary>
@@ -319,6 +408,18 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Shell.Notify(Loc.L("Editor.Render.Queued"), request.Label, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
}
/// <summary>Re-reads the enabled state of every command (the async ones keep their own event).</summary>
public void RefreshCommands()
{
_analyse.RaiseCanExecuteChanged();
_render.RaiseCanExecuteChanged();
foreach (var tab in Tabs) tab.RefreshCommands();
CommandManager.InvalidateRequerySuggested();
}
/// <summary>The Exposure tab switched to or from its waveform: the preview measures it.</summary>
public void OnWaveformNeeded() => RequestPreview(immediate: true);
/// <summary>
/// Completes once the preview, corrections, plan, estimates and filmstrip thumbnails in flight are done (capture and
/// tests); a finished step may start the next (corrections re-render the preview), so it waits until all are quiet.
@@ -351,12 +452,13 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Task[] Work() => [_preview.Idle, _corrections.Idle, _plans.Idle, .. Tabs.OfType<ExportTab>().Select(t => t.EstimatesIdle)];
}
/// <summary>Loads the jobs of this sequence already queued or running (busy state).</summary>
/// <summary>Loads the jobs of this sequence already queued or running (busy state) and the speed of the last analysis.</summary>
public async Task AttachJobsAsync()
{
if (Shell.Services.Jobs is not { } jobs) return;
var page = await jobs.ListAsync(null, 200);
foreach (var job in page.Items) Track(job);
foreach (var job in page.Items.OrderBy(j => j.Finished)) LearnAnalysisSpeed(job);
OnBusyChanged();
}
@@ -384,8 +486,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private void RequestPreview(bool immediate = false)
{
if (_disposed || FrameCount == 0) return;
var framing = ShowCropMask || ShowRegions ? PreviewFraming.Source : PreviewFraming.Output;
var request = new PreviewRequest(CurrentIndex, Session.Project, PreviewEdge, framing, ShowVectors);
var framing = ShowCropMask || ViewRegions ? PreviewFraming.Source : PreviewFraming.Output;
var waveform = SelectedTab is ExposureTab { ChartMode: ExposureChart.Waveform };
var request = new PreviewRequest(CurrentIndex, Session.Project, RenderEdge, framing, ViewVectors, waveform);
var version = ++_previewVersion;
_ = RunPreviewAsync(request, version, immediate);
}
@@ -394,6 +497,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
var renderer = _renderer;
PreviewResult? result = null;
var ran = false;
_previewBusy = true;
try
{
@@ -401,22 +505,35 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
using var frame = await renderer.RenderAsync(request, renderer.Cached(request.Project) ?? renderer.Latest, token);
if (frame is not null) result = PreviewResult.From(frame);
ran = true;
}, immediate);
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
Log.Warning("editor", $"Preview of frame {request.Index + 1} failed", ex);
ran = true;
}
finally
{
if (version == _previewVersion) _previewBusy = false;
}
if (result is not { } r || version != _previewVersion || _disposed) return;
if (version != _previewVersion || _disposed || !ran) return;
if (result is not { } r)
{
// The frame on screen cannot be shown: never leave the previous frame's picture under this frame's shot data.
PreviewImage = OriginalImage = null;
MotionVectors = null;
WaveformImage = null;
PreviewMessage = Loc.L("Editor.Preview.Unreadable");
return;
}
PreviewMessage = null;
PreviewImage = r.Corrected;
OriginalImage = r.Original;
CropRect = r.Crop;
RegionBoundary = ShowRegions ? r.Horizon : null;
MotionVectors = ShowVectors ? r.Vectors : null;
RegionBoundary = ViewRegions ? r.Horizon : null;
MotionVectors = ViewVectors ? r.Vectors : null;
WaveformImage = r.Waveform;
}
private void RequestCorrections()
@@ -473,13 +590,17 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Log.Warning("editor", "Planning the export failed", ex);
}
if (_disposed || !ReferenceEquals(planner, Planner) || !ReferenceEquals(project, Session.Project)) return;
_planned = true;
Plan = plan;
OnPropertyChanged(nameof(RenderText));
OnPropertyChanged(nameof(RenderToolTip));
OnPropertyChanged(nameof(RenderBlockedReason));
OnPropertyChanged(nameof(CanRender));
OnPropertyChanged(nameof(SelectedRenderChoice));
OnPropertyChanged(nameof(Summary));
foreach (var tab in Tabs) tab.OnPlanChanged();
UpdateInfo();
CommandManager.InvalidateRequerySuggested();
RefreshCommands();
}
// ---- Playback ----
@@ -500,6 +621,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
}
OnPropertyChanged(nameof(IsPlaying));
OnPropertyChanged(nameof(PlayToolTip));
OnPropertyChanged(nameof(PlayName));
OnPropertyChanged(nameof(ClipToolTip));
}
/// <summary>Next frame while playing; frames are skipped rather than queued when the preview is slower than the clock.</summary>
@@ -523,6 +646,13 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
// ---- Changes ----
private void OnToolsChanged()
{
OnPropertyChanged(nameof(ShowCropMask));
OnPropertyChanged(nameof(ViewVectors));
OnPropertyChanged(nameof(ViewRegions));
}
private void OnProjectChanged()
{
foreach (var tab in Tabs) tab.Refresh();
@@ -530,7 +660,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
RequestCorrections();
RequestPlan();
RequestPreview();
CommandManager.InvalidateRequerySuggested();
RefreshCommands();
}
private void OnContentChanged()
@@ -549,7 +679,15 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
RequestPreview(immediate: true);
}
private void OnSaveFailed(Exception ex) => Shell.ReportError(ex);
/// <summary>The first failure of a run of failed saves (they are retried until one succeeds); Retry tries at once.</summary>
private void OnSaveFailed(Exception ex) => Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Save.Failed"),
Message = ex.Message,
ActionText = Loc.L("Editor.Save.Retry"),
ActionToolTip = Loc.L("Tooltips.Editor.Save.Retry"),
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
});
private void UpdateMarkers()
{
@@ -575,7 +713,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
var settings = plan.Setup.Encoder.Settings;
var position = plan.Setup.Plan.DurationSeconds * CurrentIndex / double.Max(1, FrameCount - 1);
InfoText = string.Join(" · ", EditorText.Position(CurrentIndex, FrameCount),
Loc.L("Editor.Preview.OutputTime", Clock(position), Clock(plan.Setup.Plan.DurationSeconds)),
Loc.L("Editor.Preview.OutputTime", EditorText.Clock(position), EditorText.Clock(plan.Setup.Plan.DurationSeconds)),
Loc.L("Editor.Preview.OutputSize", EditorText.Size(settings.Width, settings.Height)));
}
else
@@ -594,7 +732,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Shell.Notify(Loc.L("Editor.Optimise.Nothing"));
return;
}
var lines = changes.Select(c => Loc.L("Editor.Optimise.Change", ParameterLabel(c.Parameter), ValueText(c.Before), ValueText(c.After)));
var lines = changes.Select(c => Loc.L("Editor.Optimise.Change", EditorText.ParameterLabel(c.Parameter), EditorText.Value(c.Parameter, c.Before),
EditorText.Value(c.Parameter, c.After)));
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, lines));
}
@@ -612,8 +751,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
if (_disposed) return;
var wasActive = _jobs.ContainsKey(job.Id);
Track(job);
LearnAnalysisSpeed(job);
OnBusyChanged();
if (wasActive && job.State == JobState.Done) _ = ReloadAsync();
if (wasActive && job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render ? job : null);
});
}
@@ -624,84 +764,58 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
else _jobs.Remove(job.Id);
}
private async Task ReloadAsync()
/// <summary>Seconds per frame of the latest finished deep analysis (any sequence): the cost Analyse announces.</summary>
private void LearnAnalysisSpeed(Job job)
{
if (job is { Kind: JobKind.DeepAnalyse, State: JobState.Done, ItemsPerSecond: > 0 and var speed }) _analysisSecondsPerFrame = 1 / speed;
}
/// <summary>Reads the sequence again after a job; a finished render offers its follow-ups (BRIEF §11.5).</summary>
private async Task ReloadAsync(Job? render)
{
try
{
await Session.ReloadAsync();
}
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException)
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or UnauthorizedAccessException)
{
Shell.ReportError(ex);
return;
}
if (render is null || _disposed) return;
var output = Session.Content.Renders.FirstOrDefault(r => render.Started is not { } started || r.Created >= started)?.OutputPath;
Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Render.Done"),
Message = output is null ? render.TargetLabel : System.IO.Path.GetFileName(output),
ActionText = output is null ? null : Loc.L("Editor.Render.Reveal"),
ActionToolTip = output is null ? null : Loc.L("Tooltips.Editor.Render.Reveal"),
ActionCommand = output is null ? null : new RelayCommand(() => ShellActions.Reveal(output)),
});
}
private void OnBusyChanged()
{
OnPropertyChanged(nameof(IsBusy));
OnPropertyChanged(nameof(IsAnalysing));
OnPropertyChanged(nameof(IsEditable));
OnPropertyChanged(nameof(BusyToolTip));
CommandManager.InvalidateRequerySuggested();
OnPropertyChanged(nameof(AnalyseToolTip));
OnPropertyChanged(nameof(OptimiseAllToolTip));
foreach (var tab in Tabs) tab.OnBusyChanged();
RefreshCommands();
}
private static string Clock(double seconds)
{
var t = TimeSpan.FromSeconds(double.Max(0, seconds));
return ((int)t.TotalMinutes).ToString("00", Loc.Culture) + ":" + t.Seconds.ToString("00", Loc.Culture) + Loc.Culture.NumberFormat.NumberDecimalSeparator
+ (t.Milliseconds / 100).ToString(Loc.Culture);
}
private static string Ev(double ev) => ev.ToString("+0.0;−0.0;0.0", Loc.Culture);
private static string ParameterLabel(string parameter) => parameter switch
{
AdvisorParameters.Hero => Loc.L("Editor.Frames.HeroLabel"),
AdvisorParameters.Excluded => Loc.L("Editor.Frames.ExcludedLabel"),
AdvisorParameters.TimingMode => Loc.L("Editor.Time.Mode"),
AdvisorParameters.FrameRate => Loc.L("Editor.Time.Rate"),
AdvisorParameters.FitToSeconds => Loc.L("Editor.Time.Fit"),
AdvisorParameters.Deflicker => Loc.L("Editor.Exposure.Deflicker"),
AdvisorParameters.DeflickerWindow => Loc.L("Editor.Exposure.Window"),
AdvisorParameters.DeflickerStrength => Loc.L("Editor.Exposure.Strength"),
AdvisorParameters.Regions => Loc.L("Editor.Exposure.Regions"),
AdvisorParameters.HolyGrail => Loc.L("Editor.Exposure.HolyGrail"),
AdvisorParameters.TransitionLength => Loc.L("Editor.Exposure.Transitions"),
AdvisorParameters.WhiteBalanceSmoothing => Loc.L("Editor.Exposure.WhiteBalance"),
AdvisorParameters.MotionBlur => Loc.L("Editor.Motion.Blur"),
AdvisorParameters.TargetShutterAngle => Loc.L("Editor.Motion.Shutter"),
AdvisorParameters.FlowQuality => Loc.L("Editor.Motion.Flow"),
AdvisorParameters.Stabilize => Loc.L("Editor.Motion.Stabilize"),
AdvisorParameters.StabilizeSmoothing => Loc.L("Editor.Motion.Smoothing"),
AdvisorParameters.Aspect => Loc.L("Editor.Camera.Aspect"),
AdvisorParameters.OffsetY => Loc.L("Editor.Camera.OffsetY"),
AdvisorParameters.ExportPreset => Loc.L("Editor.Export.Preset"),
AdvisorParameters.Resolution => Loc.L("Editor.Export.Resolution"),
_ => parameter,
};
private static string ValueText(object? value) => value switch
{
null => Loc.L("Editor.Value.None"),
bool b => Loc.L(b ? "Editor.Value.On" : "Editor.Value.Off"),
TimingMode m => Loc.L("Editor.Timing." + m),
RegionMode m => m == RegionMode.Off ? Loc.L("Editor.Value.Off") : Loc.L("Editor.Regions." + m),
FlowQualitySetting q => Loc.L("Editor.Flow." + q),
string id when ExportPresets.Find(id) is { } preset => Loc.L(preset.NameKey),
string text => text,
double d => d.ToString("0.##", Loc.Culture),
IEnumerable list => Loc.Plural("Editor.Value.Frames", list.Cast<object>().LongCount()),
IFormattable f => f.ToString(null, Loc.Culture),
_ => value.ToString() ?? string.Empty,
};
/// <summary>A rendered preview as frozen bitmaps and overlays in picture pixels (built off the UI thread).</summary>
private sealed record PreviewResult(ImageSource Corrected, ImageSource Original, Rect Crop, IReadOnlyList<Point> Horizon, IReadOnlyList<MotionVector> Vectors)
private sealed record PreviewResult(ImageSource Corrected, ImageSource Original, Rect Crop, IReadOnlyList<Point> Horizon, IReadOnlyList<MotionVector> Vectors,
ImageSource? Waveform)
{
public static PreviewResult From(PreviewFrame frame) => new(
EditorImages.ToBitmap(frame.Corrected),
EditorImages.ToBitmap(frame.Original),
new Rect(frame.Crop.X, frame.Crop.Y, frame.Crop.Width, frame.Crop.Height),
[.. frame.Horizon.Select(p => new Point(p.X, p.Y))],
[.. frame.Vectors.Select(v => new MotionVector(v.X, v.Y, v.Dx, v.Dy))]);
[.. frame.Vectors.Select(v => new MotionVector(v.X, v.Y, v.Dx, v.Dy))],
frame.Waveform is { } waveform ? EditorImages.ToMask(waveform) : null);
}
}
+37 -7
View File
@@ -103,6 +103,9 @@ public sealed class ExportTab : EditorTab
];
private readonly LatestRunner _estimates = new(TimeSpan.FromMilliseconds(250));
private readonly AsyncRelayCommand _renderNow;
private readonly AsyncRelayCommand _addToQueue;
private readonly AsyncRelayCommand _batch;
private IReadOnlyList<PresetCard> _cards = [];
private IReadOnlyList<CodecChoice> _codecChoices = [];
private IReadOnlyList<Choice> _encoders = [];
@@ -115,10 +118,11 @@ public sealed class ExportTab : EditorTab
: base(editor, "Export", AdvisorSection.Export)
{
SelectCommand = new RelayCommand(p => Select(p as PresetCard), _ => !Editor.IsBusy);
RenderNowCommand = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: false), () => Editor.CanRender);
AddToQueueCommand = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.Normal, batch: false), () => Editor.CanRender);
BatchCommand = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: true), () => Editor.CanRender && Batch.Count > 0);
HistoryCommand = new RelayCommand(() => Editor.Shell.Navigate(Shell.SectionKey.Jobs));
_renderNow = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: false), () => Editor.CanRender);
_addToQueue = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.Normal, batch: false), () => Editor.CanRender);
_batch = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: true), () => Editor.CanRender && Batch.Count > 0);
HistoryCommand = new RelayCommand(OpenHistory);
RevealLastCommand = new RelayCommand(() => ShellActions.Reveal(Editor.Session.Content.Renders[0].OutputPath), () => Editor.Session.Content.Renders.Count > 0);
ResetFrameRateCommand = new RelayCommand(() => EditOverrides(o => o with { FrameRate = null }));
Width = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Width = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Width"));
Height = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Height = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Height"));
@@ -131,14 +135,24 @@ public sealed class ExportTab : EditorTab
public ICommand SelectCommand { get; }
public ICommand RenderNowCommand { get; }
public ICommand RenderNowCommand => _renderNow;
public ICommand AddToQueueCommand { get; }
public ICommand AddToQueueCommand => _addToQueue;
public ICommand BatchCommand { get; }
public ICommand BatchCommand => _batch;
/// <summary>Jobs, filtered on this sequence (its renders and analyses).</summary>
public ICommand HistoryCommand { get; }
/// <summary>"Reveal in Explorer" for the newest render (BRIEF §11.5 follow-up).</summary>
public ICommand RevealLastCommand { get; }
public string AddToQueueToolTip => Editor.RenderBlockedReason ?? Loc.L("Tooltips.Editor.Export.AddToQueue");
public string BatchToolTip => Editor.RenderBlockedReason ?? Loc.L(Batch.Count > 0 ? "Tooltips.Editor.Export.Batch" : "Tooltips.Editor.Export.BatchEmpty");
public bool HasHistory => Editor.Session.Content.Renders.Count > 0;
public ICommand ResetFrameRateCommand { get; }
/// <summary>"Output · 4K archive".</summary>
@@ -359,6 +373,15 @@ public sealed class ExportTab : EditorTab
base.OnContentChanged();
}
public override void RefreshCommands()
{
_renderNow.RaiseCanExecuteChanged();
_addToQueue.RaiseCanExecuteChanged();
_batch.RaiseCanExecuteChanged();
OnPropertyChanged(nameof(AddToQueueToolTip));
OnPropertyChanged(nameof(BatchToolTip));
}
public override void Dispose()
{
_estimates.Dispose();
@@ -411,6 +434,13 @@ public sealed class ExportTab : EditorTab
for (var i = 0; i < cards.Count; i++) cards[i].Update(plans[i]);
}
private void OpenHistory()
{
Editor.Shell.Jobs.Filter = Jobs.JobFilter.All;
Editor.Shell.Jobs.SearchText = Editor.Title;
Editor.Shell.Navigate(Shell.SectionKey.Jobs);
}
private void Select(PresetCard? card)
{
if (card is null) return;
+96 -19
View File
@@ -1,14 +1,29 @@
using Titano.Core.Advice;
using Titano.Core.Localization;
using Titano.Core.Project;
using Titano.Core.Render;
using Titano.Ui.Visuals;
namespace Titano.App.Editor;
/// <summary>The measuring tools of the Exposure tab (BRIEF §12.3 "luminance/waveform charts").</summary>
public enum ExposureChart
{
/// <summary>Measured luminance against the target curve, sky region and exposure steps.</summary>
Luminance,
/// <summary>Frame-to-frame luminance change before and after the correction.</summary>
Flicker,
/// <summary>Luma waveform of the corrected frame on screen.</summary>
Waveform,
}
/// <summary>
/// Exposure (BRIEF §12.3): deflicker, regions, holy-grail transitions and white balance; the chart shows the measured
/// luminance (Sun) against the target curve the corrections produce (Accent), the sky region (dashed) and the exposure
/// steps as received.
/// Exposure (BRIEF §12.3): deflicker, regions, holy-grail transitions and white balance. The luminance chart shows the
/// measured luminance (Sun) against the target curve the corrections produce (Accent), the sky region (dashed) and the
/// exposure steps as received; the flicker chart the frame-to-frame change before and after correction; the waveform
/// the luma distribution of the corrected frame on screen.
/// </summary>
public sealed class ExposureTab : EditorTab
{
@@ -16,6 +31,7 @@ public sealed class ExposureTab : EditorTab
private IReadOnlyList<ChartLegendItem> _legend = [];
private IReadOnlyList<TimelineMarker> _markers = [];
private string? _summary;
private ExposureChart _chartMode;
public ExposureTab(EditorViewModel editor)
: base(editor, "Exposure", AdvisorSection.Exposure)
@@ -38,12 +54,37 @@ public sealed class ExposureTab : EditorTab
new AutoSwitchRow(s, EditorSettings.WhiteBalance, "Editor.Exposure.WhiteBalance", "Tooltips.Editor.Exposure.WhiteBalance"),
new InfoRow("Editor.Exposure.Temperature", "Tooltips.Editor.Exposure.Temperature", Temperature),
new NumberRow(s, "Editor.Exposure.Offset", "Tooltips.Editor.Exposure.Offset", -3, 3, 0.1, p => p.Exposure.ExposureOffsetEv,
(p, v) => p with { Exposure = p.Exposure with { ExposureOffsetEv = v } }, v => Loc.L("Editor.Value.Ev", v.ToString("+0.0;−0.0;0.0", Loc.Culture))),
(p, v) => p with { Exposure = p.Exposure with { ExposureOffsetEv = v } }, v => Loc.L("Editor.Value.Ev", EditorText.Ev(v))),
];
Refresh();
BuildChart();
}
/// <summary>Luminance, flicker or waveform (the switch beside the chart).</summary>
public ExposureChart ChartMode
{
get => _chartMode;
set
{
if (!Set(ref _chartMode, value)) return;
OnPropertyChanged(nameof(IsLuminance));
OnPropertyChanged(nameof(IsFlicker));
OnPropertyChanged(nameof(IsWaveform));
BuildChart();
Editor.OnWaveformNeeded();
}
}
// The switch's radio buttons: checking one chooses its chart; the group's unchecking of the others is ignored.
public bool IsLuminance { get => _chartMode == ExposureChart.Luminance; set => Choose(value, ExposureChart.Luminance); }
public bool IsFlicker { get => _chartMode == ExposureChart.Flicker; set => Choose(value, ExposureChart.Flicker); }
public bool IsWaveform { get => _chartMode == ExposureChart.Waveform; set => Choose(value, ExposureChart.Waveform); }
/// <summary>"luma of frame 0413".</summary>
public string WaveformTitle => Loc.L("Editor.Chart.WaveformOf", (Editor.CurrentIndex + 1).ToString("D4", Loc.Culture));
public IReadOnlyList<ChartSeries> Series { get => _series; private set => Set(ref _series, value); }
public IReadOnlyList<ChartLegendItem> Legend { get => _legend; private set => Set(ref _legend, value); }
@@ -53,7 +94,7 @@ public sealed class ExposureTab : EditorTab
/// <summary>"flicker −67 % · max step 0.21 EV".</summary>
public string? Summary { get => _summary; private set => Set(ref _summary, value); }
public Func<double, string> YFormatter { get; } = v => v.ToString("0.0", Loc.Culture);
public Func<double, string> YFormatter => _chartMode == ExposureChart.Flicker ? v => Loc.L("Editor.Value.Ev", EditorText.Ev(v)) : v => v.ToString("0.0", Loc.Culture);
public override void OnContentChanged()
{
@@ -63,6 +104,13 @@ public sealed class ExposureTab : EditorTab
public override void OnCorrectionsChanged() => BuildChart();
public override void OnCurrentFrameChanged() => OnPropertyChanged(nameof(WaveformTitle));
private void Choose(bool chosen, ExposureChart chart)
{
if (chosen) ChartMode = chart;
}
private (string?, string?) Temperature()
{
if (Editor.Session.Content.Deep is not { } deep) return (null, Loc.L("Tooltips.Editor.NotApplicable.NeedsAnalysis"));
@@ -79,28 +127,57 @@ public sealed class ExposureTab : EditorTab
double[] measured = corrections?.MeasuredLogLuminance is { } m && m.Any(double.IsFinite)
? m
: content.Deep is { } deep ? [.. deep.Frames.LogLuminance.Select(v => v ?? double.NaN)] : [.. content.Frames.Select(f => f.MeanLogLuminance ?? double.NaN)];
var series = new List<ChartSeries> { new(Loc.L("Editor.Chart.Measured"), measured, "Brush.Sun") };
var legend = new List<ChartLegendItem> { new(Loc.L("Editor.Chart.Measured"), "Brush.Sun") };
if (corrections is not null && measured.Any(double.IsFinite))
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.Target"), corrections.TargetLogLuminance(), "Brush.Accent") { Thickness = 2 });
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Target"), "Brush.Accent"));
}
if (content.Deep is { Regions: not null } withSky && withSky.Frames.SkyLogLuminance.Any(v => v is not null))
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.Sky"), withSky.Frames.SkyLogLuminance.Select(v => v ?? double.NaN).ToArray(), "Brush.Region")
{ Dash = LineDash.Dashed });
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Sky"), "Brush.Region", LegendSwatch.DashedLine));
}
var markers = EditorViewModel.StepMarkers(content);
var series = new List<ChartSeries>();
var legend = new List<ChartLegendItem>();
if (_chartMode == ExposureChart.Flicker)
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.FlickerBefore"), Steps(measured), "Brush.Sun"));
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.FlickerBefore"), "Brush.Sun"));
if (corrections is not null && measured.Any(double.IsFinite))
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.FlickerAfter"), Steps(corrections.TargetLogLuminance()), "Brush.Accent") { Thickness = 2 });
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.FlickerAfter"), "Brush.Accent"));
}
}
else
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.Measured"), measured, "Brush.Sun"));
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Measured"), "Brush.Sun"));
if (corrections is not null && measured.Any(double.IsFinite))
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.Target"), corrections.TargetLogLuminance(), "Brush.Accent") { Thickness = 2 });
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Target"), "Brush.Accent"));
}
if (content.Deep is { Regions: not null } withSky && withSky.Frames.SkyLogLuminance.Any(v => v is not null))
{
series.Add(new ChartSeries(Loc.L("Editor.Chart.Sky"), withSky.Frames.SkyLogLuminance.Select(v => v ?? double.NaN).ToArray(), "Brush.Region")
{ Dash = LineDash.Dashed });
legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Sky"), "Brush.Region", LegendSwatch.DashedLine));
}
}
if (markers.Count > 0) legend.Add(new ChartLegendItem(Loc.L("Editor.Chart.Steps"), "Brush.Sun", LegendSwatch.Triangle));
Series = series;
Legend = legend;
Markers = markers;
Summary = SummaryOf(corrections);
OnPropertyChanged(nameof(YFormatter));
}
private static string? SummaryOf(Core.Render.RenderCorrections? corrections)
/// <summary>Change from the previous usable frame, in EV (NaN where either is unusable).</summary>
private static double[] Steps(double[] logLuminance)
{
var steps = new double[logLuminance.Length];
var previous = double.NaN;
for (var i = 0; i < steps.Length; i++)
{
steps[i] = logLuminance[i] - previous;
if (double.IsFinite(logLuminance[i])) previous = logLuminance[i];
}
return steps;
}
private static string? SummaryOf(RenderCorrections? corrections)
{
if (corrections is null) return null;
var parts = new List<string>();
+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
{
+3 -3
View File
@@ -19,10 +19,10 @@
<v:PreviewViewport.ToolsContent>
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsCompare}" ui:ButtonIcon.Glyph="{StaticResource Icon.Compare}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" AutomationProperties.Name="{l:Loc Editor.Preview.Compare}" />
Content="{l:Loc Editor.Preview.Compare}" ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" />
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="True" ui:ButtonIcon.Glyph="{StaticResource Icon.Info}" Checked="OnShotData"
Unchecked="OnShotData" ToolTip="{l:Loc Tooltips.Editor.Preview.ShotData}" AutomationProperties.Name="{l:Loc Editor.Preview.ShotData}" />
<Button Style="{StaticResource Button.PreviewTool}" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Click="OnClose"
Unchecked="OnShotData" Content="{l:Loc Editor.Preview.ShotData}" ToolTip="{l:Loc Tooltips.Editor.Preview.ShotData}" />
<Button Style="{StaticResource Button.PreviewToolIcon}" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Click="OnClose"
ToolTip="{l:Loc Tooltips.Editor.Preview.ExitFullScreen}" AutomationProperties.Name="{l:Loc Editor.Preview.ExitFullScreen}" />
</StackPanel>
</v:PreviewViewport.ToolsContent>
+10 -2
View File
@@ -102,8 +102,16 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
if (json == stored.ToJson()) return merged;
AtomicFile.WriteAllText(folder.ProjectPath, json);
var result = await db.Sequences.EditAsync(sequenceId, new SequenceEdit { SettingsJson = json }, row.SettingsVersion, cancellationToken);
// A conflict means the settings moved in the index meanwhile (server API): merge again on top of them.
if (result.Outcome != SequenceEditOutcome.Conflict || attempt == SaveAttempts) return merged;
switch (result.Outcome)
{
case SequenceEditOutcome.Updated:
return merged;
case SequenceEditOutcome.NotFound:
throw Missing();
// The settings moved in the index meanwhile (server API): merge again on top of them; the file follows the next write.
case SequenceEditOutcome.Conflict when attempt == SaveAttempts:
throw new IOException(Loc.L("Editor.Error.SaveConflict"));
}
}
}, cancellationToken);
}
+41
View File
@@ -0,0 +1,41 @@
using Titano.Core.Imaging;
namespace Titano.App.Editor;
/// <summary>
/// A video waveform monitor of one picture (BRIEF §12.3 Exposure "waveform"): for each column band, how many pixels
/// sit at each encoded luma level (0 % at the bottom row, 100 % at the top). <see cref="Density"/> is 0–255 per cell,
/// row-major from the top, on a log scale so faint traces stay visible; values at or above 100 % pile into the top row.
/// </summary>
public sealed record LumaWaveform(int Columns, int Rows, byte[] Density)
{
public const int Levels = 100;
public const int MaxColumns = 320;
public static LumaWaveform Measure(ImageBuffer picture)
{
ArgumentNullException.ThrowIfNull(picture);
var columns = int.Min(picture.Width, MaxColumns);
var counts = new int[Levels * columns];
var (w, h) = (picture.Width, picture.Height);
var gray = picture.Channels < 3;
var r = picture.Plane(0);
var g = gray ? r : picture.Plane(1);
var b = gray ? r : picture.Plane(2);
for (var y = 0; y < h; y++)
{
for (var x = 0; x < w; x++)
{
var i = y * w + x;
var luma = ColorSpace.EncodeFast(ColorSpace.LumaR * r[i] + ColorSpace.LumaG * g[i] + ColorSpace.LumaB * b[i]);
var level = int.Clamp((int)(luma * (Levels - 1) + 0.5f), 0, Levels - 1);
counts[(Levels - 1 - level) * columns + (int)((long)x * columns / w)]++;
}
}
// A column band holding every pixel at one level is full density; one pixel is still visible.
var full = double.Log(1 + (double)w * h / columns);
var density = new byte[counts.Length];
for (var k = 0; k < counts.Length; k++) density[k] = counts[k] == 0 ? (byte)0 : (byte)double.Clamp(48 + 207 * double.Log(1 + counts[k]) / full, 0, 255);
return new LumaWaveform(columns, Levels, density);
}
}
+185 -53
View File
@@ -1,3 +1,4 @@
using System.Globalization;
using Titano.Core.Analysis;
using Titano.Core.Export;
using Titano.Core.Imaging;
@@ -18,9 +19,10 @@ public enum PreviewFraming
Source,
}
/// <param name="LongEdge">Long edge of the preview picture in pixels.</param>
/// <param name="LongEdge">Long edge of the preview picture in pixels (the source's own for 1:1).</param>
/// <param name="Vectors">Also measure the motion field to the next frame.</param>
public sealed record PreviewRequest(int Index, ProjectSettings Project, int LongEdge, PreviewFraming Framing, bool Vectors = false);
/// <param name="Waveform">Also measure the luma waveform of the corrected picture.</param>
public sealed record PreviewRequest(int Index, ProjectSettings Project, int LongEdge, PreviewFraming Framing, bool Vectors = false, bool Waveform = false);
/// <summary>A motion sample in preview pixels: origin and displacement to the next frame.</summary>
public readonly record struct VectorSample(float X, float Y, float Dx, float Dy);
@@ -42,6 +44,9 @@ public sealed class PreviewFrame(int index, ImageBuffer corrected, ImageBuffer o
public IReadOnlyList<VectorSample> Vectors { get; init; } = [];
/// <summary>Luma waveform of the corrected picture, when requested.</summary>
public LumaWaveform? Waveform { get; init; }
public void Dispose()
{
Corrected.Dispose();
@@ -50,12 +55,17 @@ public sealed class PreviewFrame(int index, ImageBuffer corrected, ImageBuffer o
}
/// <summary>
/// The corrected-frame preview through the render pipeline at preview size (BRIEF §12.3). Corrections come from
/// <see cref="RenderPreparation"/> exactly as a render prepares them (the deep analysis' luminance reused, the rest
/// measured on small decodes), cached per exposure/stabilisation settings; each frame then goes through the render's
/// exposure stage, its single geometry warp and the highlight knee. The render pipeline has no single-frame entry
/// point, so the per-frame steps of <c>RenderRun</c> are followed here; stacking and motion blur need neighbouring
/// frames and are left to the render.
/// The corrected-frame preview through the render pipeline at preview size (BRIEF §12.3). The render pipeline has no
/// single-frame entry point, so the per-frame steps of <c>RenderRun</c> are followed here: corrections from
/// <see cref="RenderPreparation"/> exactly as a render prepares them, then each frame through the render's exposure
/// stage, its single geometry warp and the highlight knee. Stacking and motion blur need neighbouring frames and are
/// left to the render.
/// <para>
/// Preparing is split so a slider never decodes the sequence again: a measuring preparation (luminance, colour means,
/// stabilisation; keyed on the settings that change what is measured) runs once, and every other change re-solves
/// from its series (<see cref="PrecomputedAnalysis"/>) and its white-balance gains. Analysis-size decodes are kept in
/// half precision within a memory budget, so region curves and segmentation re-measure from memory.
/// </para>
/// </summary>
public sealed class PreviewRenderer(SequenceContent content, ISequenceSource source)
{
@@ -63,11 +73,19 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
public const int AnalysisLongEdge = 128;
private const int VectorLongEdge = 320;
private const int VectorSpacing = 24;
private readonly CachedFrames _frames = new(content, source);
/// <summary>Motion arrows across the picture's long edge.</summary>
private const int VectorColumns = 40;
private static readonly RenderOptions Options = new() { AnalysisLongEdge = AnalysisLongEdge };
private readonly CompactFrames _frames = new(content, source);
private readonly Lock _gate = new();
private (string Key, RenderCorrections Corrections)? _latest;
private (string Key, RenderCorrections Corrections)? _measured;
/// <summary>Frames the preparations decoded so far (tests: a re-solve decodes nothing).</summary>
public int Decodes => _frames.Decodes;
/// <summary>Corrections for <paramref name="project"/> when already prepared, else null.</summary>
public RenderCorrections? Cached(ProjectSettings project)
@@ -87,14 +105,29 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
/// <summary>
/// Prepares the corrections for <paramref name="project"/> (or returns them when prepared already). Requests come
/// one after the other (the editor cancels the previous one), so nothing is shared between calls but the cache.
/// one after the other (the editor cancels the previous one); only the caches are shared between calls.
/// </summary>
public async Task<RenderCorrections> PrepareAsync(ProjectSettings project, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(project);
if (Cached(project) is { } cached) return cached;
var key = Key(project);
var corrections = await RenderPreparation.PrepareAsync(Input(project), new RenderOptions { AnalysisLongEdge = AnalysisLongEdge }, null, cancellationToken)
.ConfigureAwait(false);
var measured = await MeasureAsync(project, cancellationToken).ConfigureAwait(false);
var solveProject = project with
{
Exposure = project.Exposure with { WhiteBalanceSmoothing = project.Exposure.WhiteBalanceSmoothing.WithManual(false) },
};
var solved = await RenderPreparation.PrepareAsync(Input(solveProject, Reuse(measured, project)), Options, null, cancellationToken).ConfigureAwait(false);
var corrections = solved with
{
// Gains depend only on the measured colour means, which the measuring preparation keyed on.
WhiteBalance = measured.WhiteBalance,
Report = solved.Report with
{
MeasuredFrames = measured.Report.MeasuredFrames + solved.Report.MeasuredFrames,
Warnings = [.. measured.Report.Warnings.Concat(solved.Report.Warnings).DistinctBy(w => w.ToString())],
},
};
lock (_gate) _latest = (key, corrections);
return corrections;
}
@@ -112,13 +145,14 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
try
{
var vectors = request.Vectors && request.Index + 1 < content.Count
? await VectorsAsync(request, corrections, geometry, edge, corrected, cancellationToken).ConfigureAwait(false)
? await VectorsAsync(request, corrections, corrected.Width, corrected.Height, cancellationToken).ConfigureAwait(false)
: [];
return new PreviewFrame(request.Index, corrected, original)
{
Crop = request.Framing == PreviewFraming.Source ? CropOf(plan, corrected.Width, corrected.Height) : new RectD(0, 0, 1, 1),
Horizon = request.Framing == PreviewFraming.Source ? HorizonOf(corrected.Width, corrected.Height) : [],
Vectors = vectors,
Waveform = request.Waveform ? LumaWaveform.Measure(corrected) : null,
};
}
catch
@@ -129,7 +163,7 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
}
}
/// <summary>Cache key: the settings <see cref="RenderPreparation"/> reads.</summary>
/// <summary>Cache key of the corrections: every setting <see cref="RenderPreparation"/> reads.</summary>
internal static string Key(ProjectSettings project) => new ProjectSettings
{
Exposure = project.Exposure,
@@ -137,14 +171,68 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
ExcludedFrames = project.ExcludedFrames,
}.ToJson();
private RenderInput Input(ProjectSettings project) => new()
/// <summary>Cache key of the measuring preparation: the settings that change what is measured, resolved as the preparation resolves them.</summary>
internal static string MeasureKey(ProjectSettings project)
{
var (whiteBalance, stabilize, smoothing) = Measured(project);
return string.Join('|', whiteBalance, stabilize, smoothing.ToString("R", CultureInfo.InvariantCulture), string.Join(',', project.ExcludedFrames));
}
private static (bool WhiteBalance, bool Stabilize, double Smoothing) Measured(ProjectSettings project) => (
project.Exposure.WhiteBalanceSmoothing.Resolve(false),
project.Motion.Stabilize.Resolve(false),
project.Motion.StabilizeSmoothing.Resolve(new StabilizerOptions().SmoothingSigma));
/// <summary>
/// Luminance (deflicker forced on so it is always there), colour means and the stabilisation path for the project's
/// exclusions, prepared once per <see cref="MeasureKey"/>.
/// </summary>
private async Task<RenderCorrections> MeasureAsync(ProjectSettings project, CancellationToken cancellationToken)
{
var key = MeasureKey(project);
lock (_gate)
{
if (_measured is { } measured && measured.Key == key) return measured.Corrections;
}
var (whiteBalance, stabilize, smoothing) = Measured(project);
var basis = new ProjectSettings();
var measuring = basis with
{
Exposure = basis.Exposure with
{
Deflicker = basis.Exposure.Deflicker.WithManual(true),
WhiteBalanceSmoothing = basis.Exposure.WhiteBalanceSmoothing.WithManual(whiteBalance),
},
Motion = basis.Motion with { Stabilize = basis.Motion.Stabilize.WithManual(stabilize), StabilizeSmoothing = basis.Motion.StabilizeSmoothing.WithManual(smoothing) },
ExcludedFrames = project.ExcludedFrames,
};
var analysis = content.Deep is { } deep && deep.FrameCount == content.Count
? new PrecomputedAnalysis { LogLuminance = [.. deep.Frames.LogLuminance.Select(v => v ?? double.NaN)] }
: null;
var corrections = await RenderPreparation.PrepareAsync(Input(measuring, analysis), Options, null, cancellationToken).ConfigureAwait(false);
lock (_gate) _measured = (key, corrections);
return corrections;
}
/// <summary>The measured series a re-solve reuses.</summary>
private static PrecomputedAnalysis Reuse(RenderCorrections measured, ProjectSettings project) => new()
{
LogLuminance = measured.MeasuredLogLuminance,
Stabilization = measured.Stabilization is { } corrections
// The zoom is 1 / max(crop scale, 0.75), so its inverse is the crop scale the render zooms by.
? new StabilizationResult([], [], [], corrections, measured.Report.ShakeRms ?? 0, 1 / measured.StabilizationZoom, false)
: null,
StabilizationWidth = measured.StabilizationWidth,
StabilizationHeight = measured.StabilizationHeight,
StabilizationSmoothing = Measured(project).Smoothing,
};
private RenderInput Input(ProjectSettings project, PrecomputedAnalysis? analysis) => new()
{
Source = _frames,
Frames = SourceFrameInfo.From(content.Frames, content.Light.AdjustedTimes.Length == content.Count ? content.Light.AdjustedTimes : null),
Project = project with { ExcludedFrames = [.. project.ExcludedFrames.Union(content.NotRenderable()).Order()] },
Analysis = content.Deep is { } deep && deep.FrameCount == content.Count
? new PrecomputedAnalysis { LogLuminance = [.. deep.Frames.LogLuminance.Select(v => v ?? double.NaN)] }
: null,
Analysis = analysis,
};
private (RenderGeometry Geometry, int DecodeEdge)? Geometry(PreviewRequest request, RenderCorrections? corrections)
@@ -206,32 +294,41 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
if (ev != 0 || (gains is { } g && g != ChannelGains.Identity)) ExposureProcessor.Apply(frame, ev, gains);
}
/// <summary>Optical flow from this frame to the next, both prepared the same way, sampled on a grid in picture pixels.</summary>
private async Task<IReadOnlyList<VectorSample>> VectorsAsync(PreviewRequest request, RenderCorrections? corrections, RenderGeometry geometry, int edge,
ImageBuffer current, CancellationToken cancellationToken)
/// <summary>
/// Optical flow from this frame to the next, both rendered small the same way (whatever the preview's size, even
/// 1:1), sampled on a grid and scaled to the <paramref name="width"/>×<paramref name="height"/> picture.
/// </summary>
private async Task<IReadOnlyList<VectorSample>> VectorsAsync(PreviewRequest request, RenderCorrections? corrections, int width, int height,
CancellationToken cancellationToken)
{
var next = await PictureAsync(request.Index + 1, request, corrections, geometry, edge, cancellationToken).ConfigureAwait(false);
if (next is null) return [];
var (nextCorrected, nextOriginal, _) = next.Value;
nextOriginal.Dispose();
using (nextCorrected)
var small = request with { LongEdge = int.Min(request.LongEdge, VectorLongEdge), Vectors = false, Waveform = false };
if (Geometry(small, corrections) is not var (geometry, edge)) return [];
var current = await PictureAsync(request.Index, small, corrections, geometry, edge, cancellationToken).ConfigureAwait(false);
if (current is not var (a, aOriginal, _)) return [];
aOriginal.Dispose();
using (a)
{
var scale = double.Min(1, (double)VectorLongEdge / int.Max(current.Width, current.Height));
var (w, h) = ((int)double.Max(8, current.Width * scale), (int)double.Max(8, current.Height * scale));
using var a = Resampler.Resize(current, w, h);
using var b = Resampler.Resize(nextCorrected, w, h);
using var engine = new OpticalFlowEngine(FlowQuality.Draft);
using var field = engine.Compute(a, b, cancellationToken);
var samples = new List<VectorSample>();
for (var y = VectorSpacing / 2.0; y < current.Height; y += VectorSpacing)
var next = await PictureAsync(request.Index + 1, small, corrections, geometry, edge, cancellationToken).ConfigureAwait(false);
if (next is not var (b, bOriginal, _)) return [];
bOriginal.Dispose();
using (b)
{
for (var x = VectorSpacing / 2.0; x < current.Width; x += VectorSpacing)
using var conformed = b.Width == a.Width && b.Height == a.Height ? null : Resampler.Resize(b, a.Width, a.Height);
using var engine = new OpticalFlowEngine(FlowQuality.Draft);
using var field = engine.Compute(a, conformed ?? b, cancellationToken);
var (sx, sy) = ((double)width / a.Width, (double)height / a.Height);
var spacing = double.Max(8, int.Max(width, height) / (double)VectorColumns);
var samples = new List<VectorSample>();
for (var y = spacing / 2; y < height; y += spacing)
{
var (u, v) = field.Sample(x * w / current.Width, y * h / current.Height);
samples.Add(new VectorSample((float)x, (float)y, (float)(u * current.Width / w), (float)(v * current.Height / h)));
for (var x = spacing / 2; x < width; x += spacing)
{
var (u, v) = field.Sample(x / sx, y / sy);
samples.Add(new VectorSample((float)x, (float)y, (float)(u * sx), (float)(v * sy)));
}
}
return samples;
}
return samples;
}
}
@@ -273,16 +370,18 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
}
/// <summary>
/// The sequence as the preparation reads it, with small decodes kept (within a memory budget) so changing a setting
/// does not decode the sequence again.
/// The sequence as the preparations read it. Analysis-size decodes are kept in half precision (a quarter of a
/// 128-px frame in floats, about 65 KB) within a budget of 1/16 of the memory available to the process (64–512 MB,
/// several thousand frames), least recently decoded dropped first, so changing a setting re-measures from memory.
/// </summary>
private sealed class CachedFrames(SequenceContent content, ISequenceSource source) : IRenderFrameSource
private sealed class CompactFrames(SequenceContent content, ISequenceSource source) : IRenderFrameSource
{
private const long Budget = 64L << 20;
private static readonly long Budget = long.Clamp(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 16, 64L << 20, 512L << 20);
private readonly Lock _gate = new();
private readonly Dictionary<(int Index, int Edge), ImageBuffer> _cache = [];
private readonly Queue<(int Index, int Edge)> _order = new();
private readonly Dictionary<(int Index, int Edge), Stored> _cache = [];
private readonly LinkedList<(int Index, int Edge)> _order = new();
private long _bytes;
private int _decodes;
public int FrameCount => content.Count;
@@ -290,29 +389,62 @@ public sealed class PreviewRenderer(SequenceContent content, ISequenceSource sou
public int Height => content.SourceHeight;
public int Decodes => Volatile.Read(ref _decodes);
public async ValueTask<ImageBuffer> GetFrameAsync(int index, int maxLongEdge, DecodePurpose purpose, CancellationToken cancellationToken)
{
Stored? hit;
lock (_gate)
{
if (_cache.TryGetValue((index, maxLongEdge), out var hit)) return hit.Clone();
if (_cache.TryGetValue((index, maxLongEdge), out hit))
{
_order.Remove(hit.Node);
_order.AddLast(hit.Node);
}
}
if (hit is not null) return hit.Expand();
var frame = await source.DecodeAsync(index, maxLongEdge, purpose, cancellationToken).ConfigureAwait(false)
?? throw new RenderException("Export.Render.FrameUnreadable", $"Frame {index + 1} could not be decoded.",
[(index + 1).ToString(System.Globalization.CultureInfo.InvariantCulture), content.Frames[index].FileName]);
[(index + 1).ToString(CultureInfo.InvariantCulture), content.Frames[index].FileName]);
Interlocked.Increment(ref _decodes);
var stored = Stored.From(frame, new LinkedListNode<(int, int)>((index, maxLongEdge)));
lock (_gate)
{
if (frame.ByteSize <= Budget && _cache.TryAdd((index, maxLongEdge), frame.Clone()))
if (stored.Bytes <= Budget && _cache.TryAdd((index, maxLongEdge), stored))
{
_order.Enqueue((index, maxLongEdge));
_bytes += frame.ByteSize;
while (_bytes > Budget && _order.TryDequeue(out var oldest) && _cache.Remove(oldest, out var dropped))
_order.AddLast(stored.Node);
_bytes += stored.Bytes;
while (_bytes > Budget && _order.First is { } oldest)
{
_bytes -= dropped.ByteSize;
dropped.Dispose();
_order.RemoveFirst();
if (_cache.Remove(oldest.Value, out var dropped)) _bytes -= dropped.Bytes;
}
}
}
return frame;
}
private sealed class Stored(int width, int height, int channels, Half[] samples, LinkedListNode<(int, int)> node)
{
public LinkedListNode<(int, int)> Node { get; } = node;
public long Bytes => (long)samples.Length * sizeof(short);
public static Stored From(ImageBuffer frame, LinkedListNode<(int, int)> node)
{
var data = frame.Data;
var samples = new Half[data.Length];
for (var i = 0; i < data.Length; i++) samples[i] = (Half)data[i];
return new Stored(frame.Width, frame.Height, frame.Channels, samples, node);
}
public ImageBuffer Expand()
{
var frame = new ImageBuffer(width, height, channels, clear: false);
var data = frame.Data;
for (var i = 0; i < data.Length; i++) data[i] = (float)samples[i];
return frame;
}
}
}
}
+24 -7
View File
@@ -4,13 +4,14 @@ namespace Titano.App.Editor;
/// <summary>
/// Undo and redo of the editor's project (Ctrl+Z / Ctrl+Y). Projects are immutable, so each step is a snapshot.
/// Consecutive edits with the same <c>mergeKey</c> (one slider drag, typing in one field) form a single step; any
/// other edit, undo or redo ends the run. The oldest steps are dropped beyond <see cref="Capacity"/>.
/// Consecutive edits with the same <c>mergeKey</c> (one slider drag, typing in one field) form a single step until
/// <see cref="EndRun"/> (the drag or key press ended); any other edit, undo or redo also ends the run. The oldest steps
/// are dropped beyond <see cref="Capacity"/>.
/// </summary>
public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
{
private readonly LinkedList<ProjectSettings> _undo = new();
private readonly Stack<ProjectSettings> _redo = new();
private readonly LinkedList<ProjectSettings> _redo = new();
private string? _runKey;
/// <summary>The project, after any edit, undo, redo or <see cref="Replace"/>.</summary>
@@ -41,31 +42,47 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
return true;
}
/// <summary>The gesture behind a run of merged edits ended: the next edit is a new step even with the same key.</summary>
public void EndRun() => _runKey = null;
public bool Undo()
{
if (_undo.Last is not { } previous) return false;
_undo.RemoveLast();
_redo.Push(Current);
_redo.AddLast(Current);
return Move(previous.Value);
}
public bool Redo()
{
if (!_redo.TryPop(out var next)) return false;
if (_redo.Last is not { } next) return false;
_redo.RemoveLast();
_undo.AddLast(Current);
return Move(next);
return Move(next.Value);
}
/// <summary>Adopts a project changed outside the editor (analysis advice, a merge on save) without an undo step.</summary>
/// <summary>
/// Adopts a project changed outside the editor (analysis advice, another client's edit merged on save) without an
/// undo step. Every undo and redo snapshot takes the same outside change, so undo reverts only the user's own steps
/// and never brings back a value that predates the adopted change.
/// </summary>
public void Replace(ProjectSettings current)
{
ArgumentNullException.ThrowIfNull(current);
if (ProjectMerge.SameValues(current, Current)) return;
var rebase = new ProjectMerge.Rebase(Current, current);
Rebase(_undo, rebase);
Rebase(_redo, rebase);
_runKey = null;
Current = current;
Changed?.Invoke();
}
private static void Rebase(LinkedList<ProjectSettings> steps, ProjectMerge.Rebase rebase)
{
for (var node = steps.First; node is not null; node = node.Next) node.Value = rebase.Apply(node.Value);
}
private bool Move(ProjectSettings target)
{
_runKey = null;
+14 -4
View File
@@ -16,10 +16,7 @@ public static class ProjectMerge
ArgumentNullException.ThrowIfNull(basis);
ArgumentNullException.ThrowIfNull(ours);
ArgumentNullException.ThrowIfNull(theirs);
var b = JsonNode.Parse(basis.ToJson());
var o = JsonNode.Parse(ours.ToJson());
var t = JsonNode.Parse(theirs.ToJson());
return ProjectSettings.FromJson(Merge(b, o, t)?.ToJsonString() ?? "{}");
return new Rebase(basis, theirs).Apply(ours);
}
/// <summary>True when both projects store the same values.</summary>
@@ -39,4 +36,17 @@ public static class ProjectMerge
}
return merged;
}
/// <summary>One outside change (<paramref name="basis"/> → <paramref name="theirs"/>) applied to any number of projects made from the basis.</summary>
public sealed class Rebase(ProjectSettings basis, ProjectSettings theirs)
{
private readonly JsonNode? _basis = JsonNode.Parse(basis.ToJson());
private readonly JsonNode? _theirs = JsonNode.Parse(theirs.ToJson());
public ProjectSettings Apply(ProjectSettings ours)
{
ArgumentNullException.ThrowIfNull(ours);
return ProjectSettings.FromJson(Merge(_basis, JsonNode.Parse(ours.ToJson()), _theirs)?.ToJsonString() ?? "{}");
}
}
}
+68 -20
View File
@@ -4,20 +4,27 @@ namespace Titano.App.Editor;
/// <summary>
/// Writes the editor's project shortly after the last change: one write at a time, always the newest project, never
/// cancelled half way (a write is a file plus an index row). <see cref="FlushAsync"/> skips the wait and returns once
/// everything scheduled is stored. A failed write is reported and the next change tries again.
/// cancelled half way (a write is a file plus an index row). A failed write keeps the project pending and is retried
/// with a growing delay (2 s doubling up to <see cref="MaxRetryDelay"/>) until it is stored, so nothing is dropped
/// while the archive is offline or busy. <see cref="FlushAsync"/> skips the wait and reports whether everything is
/// stored after one more attempt. Runs on the context that scheduled the first write (the UI thread).
/// </summary>
public sealed class ProjectSaver(Func<ProjectSettings, Task> save, TimeSpan delay)
{
public static readonly TimeSpan MaxRetryDelay = TimeSpan.FromMinutes(1);
private readonly Lock _gate = new();
private readonly List<TaskCompletionSource<bool>> _flushes = [];
private ProjectSettings? _pending;
private bool _running;
private Task _loop = Task.CompletedTask;
private CancellationTokenSource _wait = new();
private bool _flushRequested;
private int _failures;
private CancellationTokenSource? _wait;
/// <summary>A write failed (raised on the context that scheduled the write).</summary>
public event Action<Exception>? Failed;
/// <summary>A write failed: the exception and how many writes in a row failed (1 for the first of a streak).</summary>
public event Action<Exception, int>? Failed;
/// <summary>A change waits for its write, is being written, or failed and waits for its retry.</summary>
public bool HasPendingChanges
{
get
@@ -26,6 +33,9 @@ public sealed class ProjectSaver(Func<ProjectSettings, Task> save, TimeSpan dela
}
}
/// <summary>Why the pending change could not be stored; null when the last write succeeded.</summary>
public Exception? LastError { get; private set; }
public void Schedule(ProjectSettings project)
{
ArgumentNullException.ThrowIfNull(project);
@@ -35,55 +45,93 @@ public sealed class ProjectSaver(Func<ProjectSettings, Task> save, TimeSpan dela
_pending = project;
if (_running) return;
_running = true;
if (!_wait.TryReset()) _wait = new CancellationTokenSource();
start = new TaskCompletionSource();
_loop = LoopAsync(start.Task, _wait.Token);
_ = LoopAsync(start.Task);
}
// The loop starts outside the lock: with nothing to wait for it would otherwise save while holding it.
start.SetResult();
}
/// <summary>Stores what is pending now, without the delay.</summary>
public Task FlushAsync()
/// <returns>True when everything is stored; false when the attempt failed (the change stays pending and is retried).</returns>
public Task<bool> FlushAsync()
{
lock (_gate)
{
_wait.Cancel();
return _loop;
if (!_running) return Task.FromResult(true);
var done = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
_flushes.Add(done);
_flushRequested = true;
_wait?.Cancel();
return done.Task;
}
}
private async Task LoopAsync(Task started, CancellationToken wait)
private async Task LoopAsync(Task started)
{
await started;
try
{
await Task.Delay(delay, wait);
}
catch (OperationCanceledException)
{
}
var wait = delay;
while (true)
{
CancellationTokenSource? timer = null;
lock (_gate)
{
if (!_flushRequested && wait > TimeSpan.Zero) timer = _wait = new CancellationTokenSource();
}
if (timer is not null)
{
try
{
await Task.Delay(wait, timer.Token);
}
catch (OperationCanceledException)
{
}
lock (_gate) _wait = null;
timer.Dispose();
}
ProjectSettings next;
lock (_gate)
{
_flushRequested = false;
if (_pending is null)
{
_running = false;
Complete(true);
return;
}
next = _pending;
_pending = null;
}
int failures;
try
{
await save(next);
lock (_gate) _failures = 0;
LastError = null;
// A change made during the write is written right after it.
wait = TimeSpan.Zero;
continue;
}
catch (Exception ex)
{
Failed?.Invoke(ex);
lock (_gate)
{
// A newer change contains this one (projects are whole snapshots); otherwise this one waits for the retry.
_pending ??= next;
failures = ++_failures;
Complete(false);
}
LastError = ex;
wait = TimeSpan.FromSeconds(double.Min(MaxRetryDelay.TotalSeconds, double.Pow(2, failures)));
Failed?.Invoke(ex, failures);
}
}
}
private void Complete(bool stored)
{
foreach (var flush in _flushes) flush.TrySetResult(stored);
_flushes.Clear();
}
}
+7 -3
View File
@@ -63,7 +63,7 @@ public abstract class AutoNumberRow(string headerKey, string toolTipKey, double
public double Step { get; } = step;
public string Format { get; } = format;
/// <summary>The slider value; the user moving it stores a manual value (one undo step per drag).</summary>
/// <summary>The slider value; the user moving it stores a manual value (one undo step per drag: the view ends the run when the drag ends).</summary>
public double Value
{
get => _value;
@@ -125,8 +125,12 @@ public sealed class AutoNumberRow<T> : AutoNumberRow
protected override void StoreManual(double value) => _session.Edit(p => _setting.WithManual(p, Convert(value)), _setting.Id);
protected override void StoreAuto(bool auto) =>
_session.Edit(p => auto ? _setting.Reset(p) : _setting.WithManual(p, _setting.Effective(p, _session.Content.Deep)), _setting.Id);
/// <summary>Back to Auto is a step of its own; taking over joins the drag that follows it.</summary>
protected override void StoreAuto(bool auto)
{
if (auto) _session.Edit(_setting.Reset);
else _session.Edit(p => _setting.WithManual(p, _setting.Effective(p, _session.Content.Deep)), _setting.Id);
}
protected override void Read()
{
+51 -27
View File
@@ -21,7 +21,7 @@
AutomationProperties.Name="{l:Loc Editor.Loading}" />
<!-- Editor.html: header, then the preview, filmstrip and section tabs on the left and the section's settings on the right. -->
<Grid x:Name="EditorRoot" DataContext="{Binding Editor}" Margin="16,0,16,12"
<Grid x:Name="EditorRoot" DataContext="{Binding Editor}" Margin="16,0,16,12" IsVisibleChanged="OnEditorVisibleChanged"
Visibility="{Binding Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
<Grid.InputBindings>
<KeyBinding Key="Z" Modifiers="Control" Command="{Binding UndoCommand}" />
@@ -29,6 +29,7 @@
<KeyBinding Key="D0" Modifiers="Control" Command="{Binding FitCommand}" />
<KeyBinding Key="D1" Modifiers="Control" Command="{Binding ActualSizeCommand}" />
<KeyBinding Key="R" Modifiers="Control" Command="{Binding RenderCommand}" />
<KeyBinding Key="A" Modifiers="Control+Shift" Command="{Binding AnalyseCommand}" />
</Grid.InputBindings>
<Grid.RowDefinitions>
<RowDefinition Height="52" />
@@ -47,14 +48,15 @@
<TextBlock Grid.Column="1" Text="{Binding Title}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" Margin="6,0,12,0" MaxWidth="320"
TextTrimming="CharacterEllipsis" />
<TextBlock Grid.Column="2" Text="{Binding Summary}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Body}" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" />
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{Binding Summary}" />
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0">
<Button Content="{l:Loc Editor.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{l:Loc Tooltips.Editor.Analyse}" ToolTipService.ShowOnDisabled="True" />
<Button Content="{l:Loc Editor.OptimiseAll}" Command="{Binding OptimiseAllCommand}" ToolTip="{l:Loc Tooltips.Editor.OptimiseAll}"
<Button Content="{l:Loc Editor.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{Binding AnalyseToolTip}" ToolTipService.ShowOnDisabled="True" />
<Button Content="{l:Loc Editor.OptimiseAll}" Command="{Binding OptimiseAllCommand}" ToolTip="{Binding OptimiseAllToolTip}"
ToolTipService.ShowOnDisabled="True" Margin="12,0,0,0" />
<v:SplitButton IsPrimary="True" Margin="12,0,0,0" Content="{Binding RenderText}" Command="{Binding RenderCommand}" ItemsSource="{Binding RenderChoices}"
DisplayMemberPath="Label" SelectedItem="{Binding SelectedRenderChoice}" ToolTip="{Binding RenderToolTip}"
DropDownToolTip="{l:Loc Tooltips.Editor.RenderChoice}" AutomationProperties.Name="{l:Loc Editor.RenderButton}" />
<v:SplitButton x:Name="RenderButton" IsPrimary="True" Margin="12,0,0,0" Content="{Binding RenderText}" Command="{Binding RenderCommand}"
ItemsSource="{Binding RenderChoices}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedRenderChoice}" ToolTip="{Binding RenderToolTip}"
ToolTipService.ShowOnDisabled="True" DropDownToolTip="{l:Loc Tooltips.Editor.RenderChoice}"
AutomationProperties.Name="{l:Loc Editor.RenderButton}" />
</StackPanel>
</Grid>
@@ -94,35 +96,57 @@
</Grid.RowDefinitions>
<v:PreviewViewport x:Name="Preview" Source="{Binding PreviewImage}" OriginalSource="{Binding OriginalImage}" IsCompareEnabled="{Binding IsCompare}"
WipeLabel="{Binding WipeLabel}" ZoomMode="{Binding ZoomMode, Mode=TwoWay}" ShowVectors="{Binding ShowVectors}"
MotionVectors="{Binding MotionVectors}" VectorScale="{Binding VectorScale}" ShowRegions="{Binding ShowRegions}"
RegionBoundary="{Binding RegionBoundary}" ShowCropMask="{Binding ShowCropMask}" CropRect="{Binding CropRect}" InfoText="{Binding InfoText}"
WipeLabel="{Binding WipeLabel}" ZoomMode="{Binding ZoomMode, Mode=TwoWay}" ShowVectors="{Binding ViewVectors}"
MotionVectors="{Binding MotionVectors}" VectorScale="{Binding VectorScale}" ShowRegions="{Binding ViewRegions}"
RegionBoundary="{Binding RegionBoundary}" ShowCropMask="{Binding ShowCropMask}" CropRect="{Binding CropRect}"
CropMaskMode="{Binding CropMaskMode}" InfoText="{Binding InfoText}" ToolTip="{l:Loc Tooltips.Editor.Preview.View}"
AutomationProperties.Name="{l:Loc Editor.Preview}" SizeChanged="OnPreviewSizeChanged">
<v:PreviewViewport.ToolsContent>
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=EditorRoot}">
<!-- Tools give the keyboard back to the preview after a click, so Space keeps playing (OnToolClicked). -->
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=EditorRoot}" ButtonBase.Click="OnToolClicked">
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsCompare}" ui:ButtonIcon.Glyph="{StaticResource Icon.Compare}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" AutomationProperties.Name="{l:Loc Editor.Preview.Compare}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowVectors}" ui:ButtonIcon.Glyph="{StaticResource Icon.Vectors}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Vectors}" AutomationProperties.Name="{l:Loc Editor.Preview.Vectors}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowRegions}" ui:ButtonIcon.Glyph="{StaticResource Icon.Regions}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Regions}" AutomationProperties.Name="{l:Loc Editor.Preview.Regions}" />
Content="{l:Loc Editor.Preview.Compare}" ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"
IsChecked="{Binding ShowVectors}" ui:ButtonIcon.Glyph="{StaticResource Icon.Vectors}" Content="{l:Loc Editor.Preview.Vectors}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Vectors}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"
IsChecked="{Binding ShowRegions}" ui:ButtonIcon.Glyph="{StaticResource Icon.Regions}" Content="{l:Loc Editor.Preview.Regions}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Regions}" />
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding ShowCropMask}" ui:ButtonIcon.Glyph="{StaticResource Icon.CropMask}"
ToolTip="{l:Loc Tooltips.Editor.Preview.CropMask}" AutomationProperties.Name="{l:Loc Editor.Preview.CropMask}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsActualSize}" ui:ButtonIcon.Glyph="{StaticResource Icon.ActualSize}"
ToolTip="{l:Loc Tooltips.Editor.Preview.ActualSize}" AutomationProperties.Name="{l:Loc Editor.Preview.ActualSize}" />
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewTool}" ui:ButtonIcon.Glyph="{StaticResource Icon.Fullscreen}" Click="OnFullScreen"
ToolTip="{l:Loc Tooltips.Editor.Preview.FullScreen}" AutomationProperties.Name="{l:Loc Editor.Preview.FullScreen}" />
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewTool}" ui:ButtonIcon.Glyph="{StaticResource Icon.Play}" Command="{Binding PlayCommand}"
ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{l:Loc Editor.Preview.Play}" />
<Button Style="{StaticResource Button.Base}" Height="30" Padding="10,0" Background="{DynamicResource Brush.Chrome}"
ui:ButtonIcon.Glyph="{StaticResource Icon.Play}" Content="{l:Loc Editor.Preview.Clip}" Command="{Binding PreviewClipCommand}"
ToolTip="{l:Loc Tooltips.Editor.Preview.Clip}" Visibility="{Binding IsExportTab, Converter={StaticResource BoolToVisibility}}" />
Content="{l:Loc Editor.Preview.CropMask}" ToolTip="{l:Loc Tooltips.Editor.Preview.CropMask}" />
<!-- "What I lose" (dimmed) or "how it will look" (hidden) outside the crop (BRIEF §12.3). -->
<ToggleButton Visibility="{Binding ShowCropMask, Converter={StaticResource BoolToVisibility}}" Style="{StaticResource ToggleButton.PreviewToolIcon}"
IsChecked="{Binding IsCropResult}" ui:ButtonIcon.Glyph="{StaticResource Icon.Eye}" ToolTip="{Binding CropModeToolTip}"
AutomationProperties.Name="{l:Loc Editor.Preview.CropResult}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"
IsChecked="{Binding IsActualSize}" Content="{l:Loc Editor.Preview.ActualSize}" ToolTip="{l:Loc Tooltips.Editor.Preview.ActualSize}" />
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewToolIcon}"
ui:ButtonIcon.Glyph="{StaticResource Icon.Fullscreen}" Click="OnFullScreen" ToolTip="{l:Loc Tooltips.Editor.Preview.FullScreen}"
AutomationProperties.Name="{l:Loc Editor.Preview.FullScreen}" />
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PlayTool}"
Command="{Binding PlayCommand}" ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{Binding PlayName}" />
<Button Content="{l:Loc Editor.Preview.Clip}" Command="{Binding PreviewClipCommand}" ToolTip="{Binding ClipToolTip}"
Visibility="{Binding IsExportTab, Converter={StaticResource BoolToVisibility}}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource Button.PreviewTool}">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Play}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying}" Value="True">
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Pause}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</v:PreviewViewport.ToolsContent>
</v:PreviewViewport>
<!-- The frame on screen cannot be read: one sentence instead of another frame's picture. -->
<TextBlock Text="{Binding PreviewMessage}" Style="{StaticResource Text.Secondary}" HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False" Visibility="{Binding PreviewMessage, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
<v:Filmstrip Grid.Row="1" Margin="0,10,0,0" Source="{Binding Thumbnails}" CurrentIndex="{Binding CurrentIndex, Mode=TwoWay}" Markers="{Binding Markers}"
AutomationProperties.Name="{l:Loc Editor.Filmstrip}" />
ToolTip="{l:Loc Tooltips.Editor.Filmstrip}" AutomationProperties.Name="{l:Loc Editor.Filmstrip}" />
<TabControl Grid.Row="2" Margin="0,10,0,0" ItemsSource="{Binding Tabs}" SelectedItem="{Binding SelectedTab}" AutomationProperties.Name="{l:Loc Editor.Sections}">
<TabControl.Resources>
+51 -7
View File
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using Titano.App.Editor;
using Titano.App.Shell;
using Titano.Core.Diagnostics;
@@ -16,35 +17,54 @@ public partial class SequenceView : UserControl
private static readonly DependencyProperty SavesBeforeClosingProperty =
DependencyProperty.RegisterAttached("SavesBeforeClosing", typeof(bool), typeof(SequenceView), new PropertyMetadata(false));
public SequenceView() => InitializeComponent();
public SequenceView()
{
InitializeComponent();
// A drag, a click or a key press is one undo step even when it moves a slider many times (ProjectHistory runs);
// handled events too, because sliders and repeat buttons mark theirs handled.
EditorRoot.AddHandler(Thumb.DragCompletedEvent, new DragCompletedEventHandler((_, _) => EndEditRun()), handledEventsToo: true);
EditorRoot.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler((_, _) => EndEditRun()), handledEventsToo: true);
EditorRoot.AddHandler(KeyUpEvent, new KeyEventHandler((_, _) => EndEditRun()), handledEventsToo: true);
}
private EditorViewModel? Editor => (DataContext as SequenceViewModel)?.Editor;
/// <summary>
/// The project is saved a moment after each edit; closing the window first stores the last edit (once per window,
/// so the editor's save is kept even when another section is showing).
/// The project is saved a moment after each edit; closing the window first stores the last edit, and asks before
/// discarding one that cannot be stored (once per window, so it holds even when another section is showing).
/// </summary>
private void OnLoaded(object sender, RoutedEventArgs e)
{
FocusPreview();
if (Window.GetWindow(this) is not { } window || (bool)window.GetValue(SavesBeforeClosingProperty)) return;
window.SetValue(SavesBeforeClosingProperty, true);
var (saved, closed) = (false, false);
var (saved, asking, closed) = (false, false, false);
window.Closing += OnClosing;
window.Closed += (_, _) => closed = true;
async void OnClosing(object? s, CancelEventArgs args)
{
if (saved || args.Cancel || window.DataContext is not ShellViewModel { Sequence: { HasPendingSave: true } section }) return;
saved = true;
args.Cancel = true;
if (asking) return;
asking = true;
var close = true;
try
{
await section.CloseAsync();
close = await section.ConfirmCloseAsync();
if (close) await section.CloseAsync();
}
catch (Exception ex)
catch (Exception ex) when (ex is not OutOfMemoryException)
{
Log.Warning("editor", "The last edit was not saved before closing", ex);
}
finally
{
asking = false;
}
// "Keep editing": the window stays open with the edit still pending.
if (!close) return;
saved = true;
// An application shutdown closes the window without waiting.
if (!closed) window.Close();
}
@@ -66,6 +86,29 @@ public partial class SequenceView : UserControl
e.Handled = true;
}
/// <summary>An opened editor takes the keyboard, so its shortcuts work without clicking into it first.</summary>
private void OnEditorVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue is true) FocusPreview();
}
/// <summary>A tool clicked with the mouse hands the keyboard back to the preview (Space keeps playing); keyboard users keep their focus.</summary>
private void OnToolClicked(object sender, RoutedEventArgs e)
{
if (InputManager.Current.MostRecentInputDevice is MouseDevice) Preview.Focus();
}
private void FocusPreview()
{
if (Editor is null) return;
Dispatcher.BeginInvoke(() =>
{
if (Preview.IsVisible && !IsKeyboardFocusWithin) Keyboard.Focus(Preview);
}, DispatcherPriority.Input);
}
private void EndEditRun() => Editor?.Session.EndEditRun();
/// <summary>The preview renders at the size it is shown, in device pixels.</summary>
private void OnPreviewSizeChanged(object sender, SizeChangedEventArgs e)
{
@@ -81,5 +124,6 @@ public partial class SequenceView : UserControl
var window = new FullScreenPreview(editor) { Owner = Window.GetWindow(this) };
window.ShowDialog();
editor.PreviewEdge = restore;
Preview.Focus();
}
}
+46 -8
View File
@@ -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);
}
+3 -2
View File
@@ -48,9 +48,10 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle. -->
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle, hidden when idle in the editor. -->
<ui:JobBar Text="{Binding JobText}" Progress="{Binding JobProgress}" IsActive="{Binding IsJobActive}" IsIndeterminate="{Binding IsJobIndeterminate}"
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" ActionGlyph="{StaticResource Icon.Pause}" />
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" ActionGlyph="{StaticResource Icon.Pause}"
Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}" />
<ContentControl Grid.Row="1" Content="{Binding Current}" Focusable="False" />
+24 -2
View File
@@ -45,6 +45,7 @@ public sealed class ShellViewModel : LocalizedViewModel
BottomSections = [Settings, About];
_current = Library;
Library.IsSelected = true;
Library.PropertyChanged += OnCurrentChanged;
NavigateCommand = new RelayCommand(p =>
{
@@ -95,7 +96,12 @@ public sealed class ShellViewModel : LocalizedViewModel
get => _current;
private set
{
if (Set(ref _current, value)) OnPropertyChanged(nameof(WindowTitle));
var previous = _current;
if (!Set(ref _current, value)) return;
previous.PropertyChanged -= OnCurrentChanged;
value.PropertyChanged += OnCurrentChanged;
OnPropertyChanged(nameof(WindowTitle));
OnPropertyChanged(nameof(IsJobBarVisible));
}
}
@@ -157,7 +163,17 @@ public sealed class ShellViewModel : LocalizedViewModel
: _queuedCount > 0 ? Loc.L("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
public double JobProgress { get => _jobProgress; private set => Set(ref _jobProgress, value); }
public bool IsJobActive { get => _jobActive; private set => Set(ref _jobActive, value); }
public bool IsJobActive
{
get => _jobActive;
private set
{
if (Set(ref _jobActive, value)) OnPropertyChanged(nameof(IsJobBarVisible));
}
}
/// <summary>The job bar shows "Ready" when idle, except in the editor where it gives its 40 px to the preview (DESIGN §4).</summary>
public bool IsJobBarVisible => _jobActive || _current != Sequence;
public bool IsJobIndeterminate { get => _jobIndeterminate; private set => Set(ref _jobIndeterminate, value); }
/// <summary>Pauses the job the bar shows.</summary>
@@ -217,6 +233,12 @@ public sealed class ShellViewModel : LocalizedViewModel
public void ShowToast(Toast toast) => PendingToasts.Add(toast);
/// <summary>The section on screen renamed itself (the editor opened a sequence): the window title follows.</summary>
private void OnCurrentChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(SectionViewModel.Title) or "" or null) OnPropertyChanged(nameof(WindowTitle));
}
/// <summary>A one-line notice with one action (job done, update available).</summary>
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null) =>
ShowToast(new Toast
+4 -4
View File
@@ -159,8 +159,8 @@
<Border Background="{TemplateBinding Background}" CornerRadius="{StaticResource Radius.Card}">
<Grid>
<v:PreviewSurface x:Name="PART_Surface" CornerRadius="8" />
<ContentPresenter Content="{TemplateBinding ToolsContent}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12" />
<Grid x:Name="Info" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="12" IsHitTestVisible="False">
<ContentPresenter x:Name="PART_Tools" Content="{TemplateBinding ToolsContent}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12" />
<Grid x:Name="PART_Info" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="12" IsHitTestVisible="False">
<Border Background="{DynamicResource Brush.Chrome}" Opacity="0.85" CornerRadius="{StaticResource Radius.Control}" />
<TextBlock Text="{TemplateBinding InfoText}" Margin="10,6" Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" />
</Grid>
@@ -168,10 +168,10 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="InfoText" Value="{x:Null}">
<Setter TargetName="Info" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_Info" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="InfoText" Value="">
<Setter TargetName="Info" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_Info" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
+24
View File
@@ -42,9 +42,13 @@ public readonly record struct MotionVector(float X, float Y, float Dx, float Dy)
/// Fit and 1:1; Ctrl+0 fits, Ctrl+1 shows 1:1.
/// </summary>
[TemplatePart(Name = PartSurface, Type = typeof(FrameworkElement))]
[TemplatePart(Name = PartTools, Type = typeof(FrameworkElement))]
[TemplatePart(Name = PartInfo, Type = typeof(FrameworkElement))]
public class PreviewViewport : Control
{
public const string PartSurface = "PART_Surface";
public const string PartTools = "PART_Tools";
public const string PartInfo = "PART_Info";
public static readonly RoutedCommand FitCommand = new(nameof(FitCommand), typeof(PreviewViewport), [new KeyGesture(Key.D0, ModifierKeys.Control)]);
public static readonly RoutedCommand ActualSizeCommand = new(nameof(ActualSizeCommand), typeof(PreviewViewport), [new KeyGesture(Key.D1, ModifierKeys.Control)]);
@@ -106,6 +110,8 @@ public class PreviewViewport : Control
private const double DividerGrip = 6;
private PreviewSurface? _surface;
private FrameworkElement? _tools;
private FrameworkElement? _info;
private ViewTransform _view = new(1, 0, 0);
private Size _imageSize = Size.Empty;
private bool _syncingZoom;
@@ -192,6 +198,8 @@ public class PreviewViewport : Control
{
if (_surface is not null) _surface.SizeChanged -= OnSurfaceSizeChanged;
base.OnApplyTemplate();
_tools = GetTemplateChild(PartTools) as FrameworkElement;
_info = GetTemplateChild(PartInfo) as FrameworkElement;
_surface = GetTemplateChild(PartSurface) as PreviewSurface;
if (_surface is null) return;
_surface.Owner = this;
@@ -200,6 +208,19 @@ public class PreviewViewport : Control
ApplyZoomMode();
}
/// <summary>The shot data pill sits beside the tools at the bottom, and moves to the top when both do not fit in one row.</summary>
protected override Size ArrangeOverride(Size arrangeBounds)
{
var size = base.ArrangeOverride(arrangeBounds);
if (_tools is not null && _info is not null)
{
var needed = _tools.DesiredSize.Width + _info.DesiredSize.Width;
var place = needed > arrangeBounds.Width ? VerticalAlignment.Top : VerticalAlignment.Bottom;
if (_info.VerticalAlignment != place) _info.VerticalAlignment = place;
}
return size;
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
@@ -285,6 +306,9 @@ public class PreviewViewport : Control
var viewport = (PreviewViewport)d;
var size = PixelSize(viewport.Source);
var resized = size != viewport._imageSize;
// The same picture at another resolution (a 1:1 render replacing the fitted one) keeps what is on screen.
if (resized && !size.IsEmpty && !viewport._imageSize.IsEmpty && viewport._view.Scale > 0)
viewport._view = viewport._view with { Scale = viewport._view.Scale * viewport._imageSize.Width / size.Width };
viewport._imageSize = size;
viewport._surface?.SetImages(viewport.Source, viewport.OriginalSource, size);
// Same-size frames (scrubbing) keep zoom and pan; a new size refits or re-clamps.