feat(editor): step controls for orientation, crop, look and output size

Owner review 1 asked for the Camera step to frame the picture the way the
mockup does, so the step now offers Aspect, Rotation (icon buttons), Mirror
and Flip switches, Straighten, Crop size, Crop X and Crop Y, and Reset
framing. Cropping by margins is gone: the crop box is now held to the chosen
aspect.

- EditorSession gains Orient and ResetFraming. Edit and Optimise refit a
  box that was already held to the aspect whenever the aspect or the export
  box changes, and do it in the same undo step. A crop from an older project
  that was placed by offsets is left for the render to fit.
- Straighten drives the preview's grid through the new SliderActivity
  attached behaviour, which a NumberRow switches on with ShowsGrid.
- Exposure gains a Look group with Filter and Strength. A newer project's
  extra look data is kept as it is.
- Export: Width and Height now edit the preset's own box, and a new Output
  size row shows the size after the chosen proportions are applied, marked
  Capped when the encoder shrinks it. ExportPlan carries OutputSize and
  EncodedSize.
- New SwitchRow, IconActionsRow and GroupRow rows with their panel
  templates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 20:24:03 +01:00
1 parent aaf9c0bba7
commit 7413b72ecc
14 files changed
+1030 -100

No files matched your search

+52 -3
View File
@@ -280,6 +280,27 @@ public sealed class ExportTab : EditorTab
public EditableField Height { get; }
/// <summary>
/// "2160 × 3840": what the render makes of the box (Width × Height) and the chosen proportions (owner review 1, R5),
/// "(capped)" when the encoder takes no more; null before the plan.
/// </summary>
public string? OutputSizeText => Editor.Plan is { } plan ? OutputSizeOf(plan) : null;
/// <summary>Where the output size comes from, or the largest size the encoder takes when it capped it.</summary>
public string OutputSizeToolTip => OutputSizeToolTipOf(Editor.Plan);
/// <summary>The Output size row of <paramref name="plan"/>: "2160 × 3840", or "1080 × 1920 (capped)".</summary>
public static string OutputSizeOf(ExportPlan plan)
{
ArgumentNullException.ThrowIfNull(plan);
return plan.IsCapped ? Loc.L("Editor.Export.Capped", SizeText(plan.EncodedSize)) : SizeText(plan.OutputSize);
}
/// <summary>The Output size row's tooltip for <paramref name="plan"/>.</summary>
public static string OutputSizeToolTipOf(ExportPlan? plan) => plan is { IsCapped: true }
? Loc.L("Tooltips.Editor.Export.OutputCapped", SizeText(LargestTaken(plan)))
: Loc.L("Tooltips.Editor.Export.OutputSize");
/// <summary>"16:9".</summary>
public string AspectText => Editor.Plan is { } plan ? Aspect(plan.Setup.Encoder.Settings.Width, plan.Setup.Encoder.Settings.Height) : string.Empty;
@@ -473,6 +494,7 @@ public sealed class ExportTab : EditorTab
try
{
UpdateLists();
LoadBox();
SaveChoices = !CanChooseFolder ? [new SaveChoice(null)]
: Export.Folder is { } folder ? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
: [new SaveChoice(null), new SaveChoice(null, Browse: true)];
@@ -493,9 +515,7 @@ public sealed class ExportTab : EditorTab
_refreshing = true;
try
{
var settings = Editor.Plan?.Setup.Encoder.Settings;
if (!Width.IsDirty) Width.Load(settings?.Width.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
if (!Height.IsDirty) Height.Load(settings?.Height.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
LoadBox();
UpdateLists();
Notices = Editor.Plan is { } plan ? PlanNotices(plan) : [];
OnAllPropertiesChanged();
@@ -547,6 +567,35 @@ public sealed class ExportTab : EditorTab
base.Dispose();
}
/// <summary>
/// Width and Height edit the preset's box, which the chosen proportions are fitted in (owner review 1, R5): they show the
/// resolved box (empty for a side the preset leaves to the source), not the size rendered (Output size).
/// </summary>
private void LoadBox()
{
var resolved = Resolved;
if (!Width.IsDirty) Width.Load(resolved.Width > 0 ? resolved.Width.ToString(CultureInfo.InvariantCulture) : string.Empty);
if (!Height.IsDirty) Height.Load(resolved.Height > 0 ? resolved.Height.ToString(CultureInfo.InvariantCulture) : string.Empty);
}
/// <summary>"2160 × 3840".</summary>
private static string SizeText((int Width, int Height) size) =>
size.Width.ToString(Loc.Culture) + " × " + size.Height.ToString(Loc.Culture);
/// <summary>
/// The encoder's largest size turned as the output is (as <see cref="EncoderSelector"/> fits it) when the output is
/// larger; otherwise the codec level capped it, and the size made is the largest it takes.
/// </summary>
private static (int Width, int Height) LargestTaken(ExportPlan plan)
{
var (width, height) = plan.OutputSize;
if (plan.Setup.Encoder.Capability is not { } capability) return plan.EncodedSize;
var (maxWidth, maxHeight) = (width >= height) == (capability.MaxWidth >= capability.MaxHeight)
? (capability.MaxWidth, capability.MaxHeight)
: (capability.MaxHeight, capability.MaxWidth);
return width > maxWidth || height > maxHeight ? (maxWidth, maxHeight) : plan.EncodedSize;
}
/// <summary>The choices that depend on the resolved codec (new lists only when they change, so selections stay bound).</summary>
private void UpdateLists()
{