feat: export panel and Render menu, playback options, videos library (owner review 1 phase 5) #27
No files matched your search
@@ -8,6 +8,7 @@ using Chronos.App.Jobs;
|
|||||||
using Chronos.App.Library;
|
using Chronos.App.Library;
|
||||||
using Chronos.App.Server;
|
using Chronos.App.Server;
|
||||||
using Chronos.App.Settings;
|
using Chronos.App.Settings;
|
||||||
|
using Chronos.App.Videos;
|
||||||
using Chronos.Core.Advice;
|
using Chronos.Core.Advice;
|
||||||
using Chronos.Core.Analysis;
|
using Chronos.Core.Analysis;
|
||||||
using Chronos.Core.Analysis.Deep;
|
using Chronos.Core.Analysis.Deep;
|
||||||
@@ -74,6 +75,8 @@ public sealed class SampleData
|
|||||||
if (!services.Environment.IsCapture) throw new InvalidOperationException("Sample data only runs in a capture environment.");
|
if (!services.Environment.IsCapture) throw new InvalidOperationException("Sample data only runs in a capture environment.");
|
||||||
var settings = services.Settings;
|
var settings = services.Settings;
|
||||||
var sample = new SampleData(services);
|
var sample = new SampleData(services);
|
||||||
|
// Not this PC's own Videos folder, so Settings › Archive reads the same on any machine; set before Settings reads it.
|
||||||
|
settings.VideosFolder = @"D:\Videos\Chronos";
|
||||||
services.Server.Dispose();
|
services.Server.Dispose();
|
||||||
services.Server = new ServerSession(settings, services.SaveSettings, new SampleServerApiFactory(sample), new PlainTokenProtector());
|
services.Server = new ServerSession(settings, services.SaveSettings, new SampleServerApiFactory(sample), new PlainTokenProtector());
|
||||||
services.Encoders = new SampleEncoders();
|
services.Encoders = new SampleEncoders();
|
||||||
@@ -442,6 +445,143 @@ public sealed class SampleData
|
|||||||
/// <summary>The editor sample with a colour look (owner review 1, R6): Sepia at 60 %.</summary>
|
/// <summary>The editor sample with a colour look (owner review 1, R6): Sepia at 60 %.</summary>
|
||||||
public static ProjectSettings SepiaLook(ProjectSettings project) => ExposureTab.WithLook(project, "sepia", 0.6);
|
public static ProjectSettings SepiaLook(ProjectSettings project) => ExposureTab.WithLook(project, "sepia", 0.6);
|
||||||
|
|
||||||
|
/// <summary>The editor sample played as a boomerang twice, fading in over 1 s and out over 1.5 s (settings format 3).</summary>
|
||||||
|
public static ProjectSettings Boomerang(ProjectSettings project)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(project);
|
||||||
|
return project with
|
||||||
|
{
|
||||||
|
Export = project.Export with { Playback = new PlaybackSettings { Direction = PlaybackDirection.Boomerang, Loops = 2, FadeIn = 1, FadeOut = 1.5 } },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Videos section's sample (owner review 1, R9), on sequences the server does not hold (so the sync table keeps its
|
||||||
|
/// own sample): this PC's 4K video of Comet over the ridge, which the server holds too and which was copied to the videos
|
||||||
|
/// folder, a still saved from it, a 1080p share and a PNG image sequence of Clouds over the Langhe, and last year's render
|
||||||
|
/// of Fog lifting whose file is gone; two renders the sample server alone holds; and a GIF of a workspace project not sent
|
||||||
|
/// yet. The files are small stand-ins (the still a real JPEG); sizes, durations and dates are the records', all from
|
||||||
|
/// <see cref="Now"/>. The section reads the server's and the workspace's renders from here.
|
||||||
|
/// </summary>
|
||||||
|
public async Task FillVideosAsync(Sections.VideosViewModel videos)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(videos);
|
||||||
|
var db = _db ?? throw new InvalidOperationException("FillAsync first.");
|
||||||
|
async Task<Sequence> LocalAsync(string text) => (await db.Sequences.ListAsync(new Data.Repositories.SequenceQuery { Text = text, Limit = 1 })).Items[0];
|
||||||
|
var root = Path.Combine(_services.Environment.DataDirectory, "archive");
|
||||||
|
var comet = await LocalAsync("Comet over the ridge");
|
||||||
|
var clouds = await LocalAsync("Clouds over the Langhe");
|
||||||
|
var fog = await LocalAsync("Fog lifting");
|
||||||
|
string FolderOf(Sequence s) => Path.Combine(root, s.Folder.Replace('/', Path.DirectorySeparatorChar));
|
||||||
|
string Output(Sequence s, string name) => Path.Combine(FolderOf(s), "exports", $"{s.FirstCapture:yyyy-MM-dd} {s.DisplayTitle} - {name}");
|
||||||
|
|
||||||
|
Render Make(Sequence s, string preset, string file, string codec, int width, int height, double fps, double seconds, long bytes, DateTimeOffset created,
|
||||||
|
string? kind = null) => new()
|
||||||
|
{
|
||||||
|
Id = Guid.CreateVersion7(),
|
||||||
|
SequenceId = s.Id,
|
||||||
|
PresetName = preset,
|
||||||
|
OutputPath = Output(s, file),
|
||||||
|
Codec = codec,
|
||||||
|
Width = width,
|
||||||
|
Height = height,
|
||||||
|
Fps = fps,
|
||||||
|
DurationSeconds = seconds,
|
||||||
|
Bytes = bytes,
|
||||||
|
Created = created,
|
||||||
|
ProducedBy = "studio-pc",
|
||||||
|
Kind = kind,
|
||||||
|
};
|
||||||
|
var cometVideo = Make(comet, "4K HEVC", "4K HEVC.mp4", "hevc", 3840, 2160, 24, 41.9, 1_380_000_000L, Now.AddDays(-2).AddHours(-3));
|
||||||
|
var cometStill = Make(comet, "Frame 512", "Frame 512.jpg", "jpegsequence", 3840, 2160, 0, 0, 3_400_000L, Now.AddDays(-1).AddHours(-1), RenderKind.Still);
|
||||||
|
var cloudsShare = Make(clouds, "1080p share", "1080p share.mp4", "h264", 1920, 1080, 30, 44, 186_000_000L, Now.AddDays(-20));
|
||||||
|
var cloudsFrames = Make(clouds, "PNG frames", "PNG frames", "pngsequence", 3840, 2160, 24, 55, 6_240_000_000L, Now.AddDays(-21).AddHours(-2));
|
||||||
|
var fogArchive = Make(fog, "4K archive", "4K archive.mp4", "hevc", 3840, 2160, 24, 40.8, 1_120_000_000L, new DateTimeOffset(2025, 12, 4, 19, 40, 0, TimeSpan.Zero));
|
||||||
|
foreach (var render in new[] { cometVideo, cometStill, cloudsShare, cloudsFrames, fogArchive }) await db.Renders.InsertAsync(render);
|
||||||
|
|
||||||
|
foreach (var render in new[] { cometVideo, cloudsShare }) WriteStandIn(render.OutputPath);
|
||||||
|
Directory.CreateDirectory(cloudsFrames.OutputPath);
|
||||||
|
WriteStandIn(Path.Combine(cloudsFrames.OutputPath, "frame_000001.png"));
|
||||||
|
// The still is one of the sequence's own photos, so its card and the player show a picture.
|
||||||
|
File.Copy(Directory.EnumerateFiles(FolderOf(comet), "*.JPG").Order(StringComparer.Ordinal).First(), cometStill.OutputPath, overwrite: true);
|
||||||
|
await db.RenderCopies.InsertAsync(new RenderCopy
|
||||||
|
{
|
||||||
|
Id = Guid.CreateVersion7(),
|
||||||
|
RenderId = cometVideo.Id,
|
||||||
|
Path = Path.Combine(@"D:\Videos\Chronos", Path.GetFileName(cometVideo.OutputPath)),
|
||||||
|
Bytes = cometVideo.Bytes,
|
||||||
|
CopiedAt = Now.AddDays(-1),
|
||||||
|
CopiedBy = "studio-pc",
|
||||||
|
});
|
||||||
|
|
||||||
|
VideoDto OnServer(Guid id, Guid sequence, string title, DateTime first, string preset, string codec, int width, int height, double fps, double seconds, long bytes,
|
||||||
|
DateTimeOffset created, string? project = null) =>
|
||||||
|
new(id, sequence, preset, codec, width, height, fps, seconds, bytes, created, "nas", null, null, null, RenderKind.Video, title, first, project, project is null ? null : 3,
|
||||||
|
VideoStates.Ok, [], $"{first:yyyy-MM-dd} {title} - {preset}.mp4");
|
||||||
|
IReadOnlyList<VideoDto> server =
|
||||||
|
[
|
||||||
|
OnServer(Guid.CreateVersion7(), _sunrise, "Sunrise over Superga", new DateTime(2026, 7, 2, 5, 12, 0), "4K HEVC", "hevc", 3840, 2160, 24, 120, 3_960_000_000L, Now.AddHours(-6)),
|
||||||
|
OnServer(cometVideo.Id, comet.Id, comet.DisplayTitle, comet.FirstCapture!.Value, cometVideo.PresetName, "hevc", 3840, 2160, 24, 41.9, cometVideo.Bytes, cometVideo.Created),
|
||||||
|
OnServer(Guid.CreateVersion7(), _lakeComo, "Lake Como storm", new DateTime(2026, 8, 21, 16, 30, 0), "Vertical 1080p", "h264", 1080, 1920, 30, 48.3, 248_000_000L,
|
||||||
|
Now.AddDays(-30), project: "Vertical social"),
|
||||||
|
];
|
||||||
|
|
||||||
|
var milan = await LocalAsync("Milan skyline dusk");
|
||||||
|
var gif = Path.Combine(_services.Environment.DataDirectory, "workspace-sample", "exports", $"{milan.FirstCapture:yyyy-MM-dd} {milan.DisplayTitle} - GIF preview.gif");
|
||||||
|
WriteStandIn(gif);
|
||||||
|
IReadOnlyList<VideoEntry> workspace =
|
||||||
|
[
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = Guid.CreateVersion7(),
|
||||||
|
SequenceId = milan.Id,
|
||||||
|
Title = milan.DisplayTitle,
|
||||||
|
PresetName = "GIF preview",
|
||||||
|
Codec = "gif",
|
||||||
|
Width = 960,
|
||||||
|
Height = 540,
|
||||||
|
Fps = 12,
|
||||||
|
DurationSeconds = 8,
|
||||||
|
Bytes = 24_600_000L,
|
||||||
|
Created = Now.AddHours(-3),
|
||||||
|
Kind = RenderKind.Video,
|
||||||
|
FileName = Path.GetFileName(gif),
|
||||||
|
LocalPath = gif,
|
||||||
|
IsUnsent = true,
|
||||||
|
WorkspaceProjectId = Guid.CreateVersion7(),
|
||||||
|
ProjectName = "Social cut",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
videos.ServerVideos = () => new VideoServer(VideoServerState.Available, () => new SampleRemoteVideos(server), CanEdit: true, CanDelete: true);
|
||||||
|
videos.WorkspaceRenders = _ => Task.FromResult(workspace);
|
||||||
|
|
||||||
|
static void WriteStandIn(string path)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||||
|
File.WriteAllBytes(path, new byte[4096]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The sample server's videos library: one page, read only.</summary>
|
||||||
|
private sealed class SampleRemoteVideos(IReadOnlyList<VideoDto> videos) : IRemoteVideos
|
||||||
|
{
|
||||||
|
public Task<VideoPageDto> ListAsync(VideoQueryDto query, CancellationToken cancellationToken = default) => Task.FromResult(new VideoPageDto(videos, null, videos.Count));
|
||||||
|
|
||||||
|
public Task<VideoDeletePlanDto> PlanDeleteAsync(IReadOnlyList<Guid> ids, CancellationToken cancellationToken = default) =>
|
||||||
|
throw new NotSupportedException("The sample server deletes no videos.");
|
||||||
|
|
||||||
|
public Task<VideoDeletePlanDto> DeleteAsync(IReadOnlyList<Guid> ids, string fingerprint, CancellationToken cancellationToken = default) =>
|
||||||
|
throw new NotSupportedException("The sample server deletes no videos.");
|
||||||
|
|
||||||
|
public Task<VideoCopyResultDto> CopyAsync(IReadOnlyList<Guid> ids, CancellationToken cancellationToken = default) =>
|
||||||
|
throw new NotSupportedException("The sample server copies no videos.");
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>A deep analysis of <paramref name="sequenceId"/> half way through: the editor's busy state (settings wait, viewing stays live).</summary>
|
/// <summary>A deep analysis of <paramref name="sequenceId"/> half way through: the editor's busy state (settings wait, viewing stays live).</summary>
|
||||||
public async Task MarkAnalysingAsync(Guid sequenceId)
|
public async Task MarkAnalysingAsync(Guid sequenceId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,13 +17,14 @@ using Chronos.Core.Diagnostics;
|
|||||||
using Chronos.Core.Imaging.Geometry;
|
using Chronos.Core.Imaging.Geometry;
|
||||||
using Chronos.Ui.Controls;
|
using Chronos.Ui.Controls;
|
||||||
using Chronos.Ui.Theming;
|
using Chronos.Ui.Theming;
|
||||||
|
using Chronos.Ui.Visuals;
|
||||||
|
|
||||||
namespace Chronos.App.Shell;
|
namespace Chronos.App.Shell;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <c>Chronos.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
/// <c>Chronos.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
||||||
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
||||||
/// one, then the sync table with transfers, a conflict and its confirmation, then the sequence editor on an archive
|
/// one, then the Videos section, then the sync table with transfers, a conflict and its confirmation, then the sequence editor on an archive
|
||||||
/// sequence and on a server sequence with proxies, its server job and a read-only account), plus the Library, the
|
/// sequence and on a server sequence with proxies, its server job and a read-only account), plus the Library, the
|
||||||
/// editor's Exposure tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review,
|
/// editor's Exposure tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review,
|
||||||
/// the pixel diff against <c>tests/visual/baselines</c> and phase reports (BRIEF §20.2), then exits. The pictures are
|
/// the pixel diff against <c>tests/visual/baselines</c> and phase reports (BRIEF §20.2), then exits. The pictures are
|
||||||
@@ -140,6 +141,8 @@ public static class ScreenCapture
|
|||||||
written += await SaveAsync(window, directory, "archive-" + view, theme);
|
written += await SaveAsync(window, directory, "archive-" + view, theme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
written += await CaptureVideosAsync(window, shell, sample, directory);
|
||||||
|
|
||||||
// The sync table with proxies kept here and transfers in every state, then filtered to the conflict, then the
|
// The sync table with proxies kept here and transfers in every state, then filtered to the conflict, then the
|
||||||
// conflict's confirmation (after the other screens, so the Jobs capture keeps its own sample).
|
// conflict's confirmation (after the other screens, so the Jobs capture keeps its own sample).
|
||||||
await sample.CacheProxiesAsync();
|
await sample.CacheProxiesAsync();
|
||||||
@@ -224,6 +227,42 @@ public static class ScreenCapture
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Videos section (owner review 1, R9) on <see cref="SampleData.FillVideosAsync"/> in both themes: the cards of this
|
||||||
|
/// PC's, the server's and the workspace's renders (<c>videos</c>), then the list with the still selected and shown in the
|
||||||
|
/// player pane (<c>videos-list</c>); the cards again after, with nothing selected.
|
||||||
|
/// </summary>
|
||||||
|
private static async Task<int> CaptureVideosAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
|
||||||
|
{
|
||||||
|
var videos = shell.Videos;
|
||||||
|
await sample.FillVideosAsync(videos);
|
||||||
|
var written = 0;
|
||||||
|
foreach (var theme in Themes)
|
||||||
|
{
|
||||||
|
ThemeManager.Apply(theme);
|
||||||
|
DismissToasts(window);
|
||||||
|
videos.LayoutIndex = 0;
|
||||||
|
shell.Navigate(SectionKey.Videos);
|
||||||
|
await videos.RefreshAsync();
|
||||||
|
await Settle(window);
|
||||||
|
// The cards ask for their covers once shown; the covers decode off the UI thread.
|
||||||
|
for (var i = 0; i < 40 && videos.Rows.Any(r => r.Entry.IsLocal && r.Poster is null); i++) await Task.Delay(50);
|
||||||
|
written += await SaveAsync(window, directory, "videos", theme, waitForThumbnails: shell);
|
||||||
|
|
||||||
|
videos.LayoutIndex = 1;
|
||||||
|
if (videos.Rows.FirstOrDefault(r => r.Entry.Kind == Core.Model.RenderKind.Still) is { } still)
|
||||||
|
{
|
||||||
|
still.IsSelected = true;
|
||||||
|
videos.PlayCommand.Execute(still);
|
||||||
|
}
|
||||||
|
written += await SaveAsync(window, directory, "videos-list", theme);
|
||||||
|
videos.ClosePlayerCommand.Execute(null);
|
||||||
|
videos.ClearSelectionCommand.Execute(null);
|
||||||
|
videos.LayoutIndex = 0;
|
||||||
|
}
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
private static void SelectSyncFilter(ShellViewModel shell, SyncFilter filter) =>
|
private static void SelectSyncFilter(ShellViewModel shell, SyncFilter filter) =>
|
||||||
shell.Server.Sync.Chips.First(c => c.Filter == filter).SelectCommand.Execute(null);
|
shell.Server.Sync.Chips.First(c => c.Filter == filter).SelectCommand.Execute(null);
|
||||||
|
|
||||||
@@ -251,7 +290,8 @@ public static class ScreenCapture
|
|||||||
/// The editor on the synthetic sunset: every step of the Edit path in both themes (<c>edit-<step>-<theme>.png</c>,
|
/// The editor on the synthetic sunset: every step of the Edit path in both themes (<c>edit-<step>-<theme>.png</c>,
|
||||||
/// the Camera step with a keyframe selected, the Export step as Export.html with the crop mask and no compare), then
|
/// the Camera step with a keyframe selected, the Export step as Export.html with the crop mask and no compare), then
|
||||||
/// the preview overlays, the waveform, the "what changed" toast of Optimise all, the picker over the open sequence
|
/// the preview overlays, the waveform, the "what changed" toast of Optimise all, the picker over the open sequence
|
||||||
/// (<c>edit-change</c>), the crop box, straighten and look scenes (<see cref="CaptureFramingAsync"/>), the Export step of the sequence once the server has it (Sync on) with two "Save both" copies
|
/// (<c>edit-change</c>), the crop box, straighten and look scenes (<see cref="CaptureFramingAsync"/>), the Export groups
|
||||||
|
/// and the Render menu (<see cref="CaptureExportAsync"/>), the Export step of the sequence once the server has it (Sync on) with two "Save both" copies
|
||||||
/// to restore, and the Analysis step while the analysis runs (<c>edit-busy</c>).
|
/// to restore, and the Analysis step while the analysis runs (<c>edit-busy</c>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<int> CaptureEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
|
private static async Task<int> CaptureEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
|
||||||
@@ -298,6 +338,7 @@ public static class ScreenCapture
|
|||||||
shell.Sequence.CancelPickCommand.Execute(null);
|
shell.Sequence.CancelPickCommand.Execute(null);
|
||||||
}
|
}
|
||||||
written += await CaptureFramingAsync(window, editor, directory);
|
written += await CaptureFramingAsync(window, editor, directory);
|
||||||
|
written += await CaptureExportAsync(window, editor, directory);
|
||||||
|
|
||||||
// The server has the sequence (Sync can be ticked) and two copies of this PC's settings were kept by "Save both".
|
// The server has the sequence (Sync can be ticked) and two copies of this PC's settings were kept by "Save both".
|
||||||
await sample.KeepEditorCopiesAsync(id);
|
await sample.KeepEditorCopiesAsync(id);
|
||||||
@@ -307,11 +348,14 @@ public static class ScreenCapture
|
|||||||
export.SyncToServer = true;
|
export.SyncToServer = true;
|
||||||
editor.SelectedTab = export;
|
editor.SelectedTab = export;
|
||||||
editor.IsCompare = false;
|
editor.IsCompare = false;
|
||||||
|
// Sync and Restore are rows of the File group: the groups above it folded to their summaries.
|
||||||
|
var groups = OpenGroups(export, export.FileGroup);
|
||||||
foreach (var theme in Themes)
|
foreach (var theme in Themes)
|
||||||
{
|
{
|
||||||
ThemeManager.Apply(theme);
|
ThemeManager.Apply(theme);
|
||||||
written += await SaveEditorAsync(window, editor, directory, "edit-export-copies", theme);
|
written += await SaveEditorAsync(window, editor, directory, "edit-export-copies", theme);
|
||||||
}
|
}
|
||||||
|
RestoreGroups(export, groups);
|
||||||
export.SyncToServer = false;
|
export.SyncToServer = false;
|
||||||
editor.SelectedTab = editor.Exposure;
|
editor.SelectedTab = editor.Exposure;
|
||||||
editor.IsCompare = true;
|
editor.IsCompare = true;
|
||||||
@@ -374,6 +418,105 @@ public static class ScreenCapture
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Export step of owner review 1 (R3) in both themes: Output and File folded to their summary lines, Encoding and
|
||||||
|
/// Playback open on a boomerang played twice with fades, scrolled down to Playback's last row (<c>edit-export-playback</c>),
|
||||||
|
/// undone after with the groups as they were; then the header's Render ▾ menu dropped down over the Export step
|
||||||
|
/// (<c>edit-render-menu</c>).
|
||||||
|
/// </summary>
|
||||||
|
private static async Task<int> CaptureExportAsync(MainWindow window, EditorViewModel editor, string directory)
|
||||||
|
{
|
||||||
|
var written = 0;
|
||||||
|
var session = editor.Session;
|
||||||
|
var export = editor.Tabs.OfType<ExportTab>().Single();
|
||||||
|
var frame = editor.CurrentIndex;
|
||||||
|
foreach (var theme in Themes)
|
||||||
|
{
|
||||||
|
ThemeManager.Apply(theme);
|
||||||
|
editor.SelectedTab = export;
|
||||||
|
editor.IsCompare = false;
|
||||||
|
editor.CurrentIndex = 40;
|
||||||
|
var open = OpenGroups(export, export.EncodingGroup, export.PlaybackGroup);
|
||||||
|
var played = session.Edit(SampleData.Boomerang);
|
||||||
|
await Settle(window);
|
||||||
|
// The panel ends with Playback's last row: scrolled down to it, with as much of Encoding as fits above.
|
||||||
|
var panel = ScrollerOf<SettingGroup>(window);
|
||||||
|
panel?.ScrollToBottom();
|
||||||
|
written += await SaveEditorAsync(window, editor, directory, "edit-export-playback", theme);
|
||||||
|
panel?.ScrollToTop();
|
||||||
|
if (played) session.Undo();
|
||||||
|
RestoreGroups(export, open);
|
||||||
|
|
||||||
|
await Settle(window);
|
||||||
|
if (!await editor.WhenIdleAsync(TimeSpan.FromSeconds(30))) Log.Warning("capture", "edit-render-menu was still busy");
|
||||||
|
written += await SaveRenderMenuAsync(window, editor, directory, theme);
|
||||||
|
}
|
||||||
|
// The scenes after keep the frame they had.
|
||||||
|
editor.CurrentIndex = frame;
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SettingGroup[] GroupsOf(ExportTab export) => [export.OutputGroup, export.EncodingGroup, export.PlaybackGroup, export.FileGroup];
|
||||||
|
|
||||||
|
/// <summary>Opens the Export step's groups <paramref name="open"/> and folds the others; returns which were open, for <see cref="RestoreGroups"/>.</summary>
|
||||||
|
private static bool[] OpenGroups(ExportTab export, params SettingGroup[] open)
|
||||||
|
{
|
||||||
|
var groups = GroupsOf(export);
|
||||||
|
var before = groups.Select(g => g.IsExpanded).ToArray();
|
||||||
|
foreach (var group in groups) group.IsExpanded = open.Contains(group);
|
||||||
|
return before;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The Export step's groups open or folded as <see cref="OpenGroups"/> found them (the app keeps them for the next run).</summary>
|
||||||
|
private static void RestoreGroups(ExportTab export, bool[] open)
|
||||||
|
{
|
||||||
|
var groups = GroupsOf(export);
|
||||||
|
for (var i = 0; i < groups.Length; i++) groups[i].IsExpanded = open[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The window with the header's Render ▾ menu dropped down below its button, as the menu shows it. A context menu opens
|
||||||
|
/// in a popup of its own, on screen, which the window's picture does not hold: the menu is made from the same entries
|
||||||
|
/// (<see cref="SplitButton.CreateItem"/>), laid out apart and drawn over the window where it drops down (kept inside the
|
||||||
|
/// window, as Windows keeps it on the screen).
|
||||||
|
/// </summary>
|
||||||
|
private static async Task<int> SaveRenderMenuAsync(MainWindow window, EditorViewModel editor, string directory, AppTheme theme)
|
||||||
|
{
|
||||||
|
await Settle(window);
|
||||||
|
if (FindVisual<SplitButton>(window, b => b.Name == "RenderButton") is not { } button)
|
||||||
|
{
|
||||||
|
Log.Warning("capture", "The Render button is not shown; edit-render-menu skipped");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
var menu = new ContextMenu { FlowDirection = window.FlowDirection };
|
||||||
|
var template = button.TryFindResource(SplitButton.ItemTemplateKey) as DataTemplate;
|
||||||
|
foreach (var entry in editor.RenderMenuItems) menu.Items.Add(SplitButton.CreateItem(entry, template));
|
||||||
|
menu.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||||
|
menu.Arrange(new Rect(menu.DesiredSize));
|
||||||
|
menu.UpdateLayout();
|
||||||
|
await window.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
|
||||||
|
menu.UpdateLayout();
|
||||||
|
var root = (FrameworkElement)VisualTreeHelper.GetChild(window, 0);
|
||||||
|
// Below the button, 4 px apart (SplitButton's placement), its left edge on the button's.
|
||||||
|
var at = button.TranslatePoint(new Point(0, button.ActualHeight + 4), root);
|
||||||
|
at = new Point(Math.Round(Math.Clamp(at.X, 0, Math.Max(0, root.ActualWidth - menu.ActualWidth))), Math.Round(at.Y));
|
||||||
|
return Save(window, Path.Combine(directory, $"edit-render-menu-{theme.ToString().ToLowerInvariant()}.png"), (menu, at)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The first shown element of type <typeparamref name="T"/> under <paramref name="root"/> that <paramref name="match"/> takes; null when none.</summary>
|
||||||
|
private static T? FindVisual<T>(DependencyObject root, Func<T, bool> match)
|
||||||
|
where T : FrameworkElement
|
||||||
|
{
|
||||||
|
var pending = new Stack<DependencyObject>([root]);
|
||||||
|
while (pending.Count > 0)
|
||||||
|
{
|
||||||
|
var node = pending.Pop();
|
||||||
|
if (node is T { IsVisible: true } found && match(found)) return found;
|
||||||
|
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(node); i++) pending.Push(VisualTreeHelper.GetChild(node, i));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>The scroll viewer around the shown row whose data is a <typeparamref name="TRow"/>; null when none is shown.</summary>
|
/// <summary>The scroll viewer around the shown row whose data is a <typeparamref name="TRow"/>; null when none is shown.</summary>
|
||||||
private static ScrollViewer? ScrollerOf<TRow>(DependencyObject root)
|
private static ScrollViewer? ScrollerOf<TRow>(DependencyObject root)
|
||||||
{
|
{
|
||||||
@@ -455,7 +598,10 @@ public static class ScreenCapture
|
|||||||
written += await SaveEditorAsync(window, editor, directory, "edit-remote", theme);
|
written += await SaveEditorAsync(window, editor, directory, "edit-remote", theme);
|
||||||
editor.SelectedTab = export;
|
editor.SelectedTab = export;
|
||||||
editor.IsCompare = false;
|
editor.IsCompare = false;
|
||||||
|
// The server's encoder is the Encoding group's first row, the folder it keeps the renders in the File group's.
|
||||||
|
var groups = OpenGroups(export, export.EncodingGroup, export.FileGroup);
|
||||||
written += await SaveEditorAsync(window, editor, directory, "edit-remote-export", theme);
|
written += await SaveEditorAsync(window, editor, directory, "edit-remote-export", theme);
|
||||||
|
RestoreGroups(export, groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
sample.RunServerRender();
|
sample.RunServerRender();
|
||||||
@@ -522,7 +668,8 @@ public static class ScreenCapture
|
|||||||
window.UpdateLayout();
|
window.UpdateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool Save(Window window, string path)
|
/// <param name="overlay">An element laid out apart (a drop-down menu) drawn over the window with its top left at the point given.</param>
|
||||||
|
private static bool Save(Window window, string path, (FrameworkElement Element, Point At)? overlay = null)
|
||||||
{
|
{
|
||||||
if (VisualTreeHelper.GetChildrenCount(window) == 0) window.ApplyTemplate();
|
if (VisualTreeHelper.GetChildrenCount(window) == 0) window.ApplyTemplate();
|
||||||
if (VisualTreeHelper.GetChildrenCount(window) == 0)
|
if (VisualTreeHelper.GetChildrenCount(window) == 0)
|
||||||
@@ -542,8 +689,24 @@ public static class ScreenCapture
|
|||||||
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||||
// A right-to-left window's content already renders mirrored, as on screen.
|
// A right-to-left window's content already renders mirrored, as on screen.
|
||||||
bitmap.Render(root);
|
bitmap.Render(root);
|
||||||
|
BitmapSource picture = bitmap;
|
||||||
|
if (overlay is ({ } element, var at))
|
||||||
|
{
|
||||||
|
var layer = new RenderTargetBitmap((int)Math.Ceiling(element.ActualWidth * dpi.DpiScaleX), (int)Math.Ceiling(element.ActualHeight * dpi.DpiScaleY),
|
||||||
|
dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||||
|
layer.Render(element);
|
||||||
|
var drawing = new DrawingVisual();
|
||||||
|
using (var context = drawing.RenderOpen())
|
||||||
|
{
|
||||||
|
context.DrawImage(bitmap, new Rect(0, 0, width / dpi.DpiScaleX, height / dpi.DpiScaleY));
|
||||||
|
context.DrawImage(layer, new Rect(at, new Size(layer.PixelWidth / dpi.DpiScaleX, layer.PixelHeight / dpi.DpiScaleY)));
|
||||||
|
}
|
||||||
|
var composed = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||||
|
composed.Render(drawing);
|
||||||
|
picture = composed;
|
||||||
|
}
|
||||||
var encoder = new PngBitmapEncoder();
|
var encoder = new PngBitmapEncoder();
|
||||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
encoder.Frames.Add(BitmapFrame.Create(picture));
|
||||||
using var stream = File.Create(path);
|
using var stream = File.Create(path);
|
||||||
encoder.Save(stream);
|
encoder.Save(stream);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -190,8 +190,9 @@ public class SplitButton : Control
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The control of one structured entry: a <see cref="Separator"/>, or a <see cref="MenuItem"/> whose header is the entry
|
/// The control of one structured entry: a <see cref="Separator"/>, or a <see cref="MenuItem"/> whose header is the entry
|
||||||
/// (shown by <paramref name="template"/>, its label alone without one) with its command, check, tooltip and submenu.
|
/// (shown by <paramref name="template"/>, its label alone without one) with its command, check, tooltip and submenu.
|
||||||
|
/// Public for the desktop's <c>--capture</c>, which draws the menu as it drops down without opening a popup on screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static Control CreateItem(RenderMenuItem entry, DataTemplate? template)
|
public static Control CreateItem(RenderMenuItem entry, DataTemplate? template)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(entry);
|
ArgumentNullException.ThrowIfNull(entry);
|
||||||
if (entry.Kind == RenderMenuItemKind.Separator) return new Separator();
|
if (entry.Kind == RenderMenuItemKind.Separator) return new Separator();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ formats and with animations off, so the same code draws the same pixels on any d
|
|||||||
the machine is shown as fixed sample values while the clock is frozen (`AppClock`): free space (1.2 TB), the
|
the machine is shown as fixed sample values while the clock is frozen (`AppClock`): free space (1.2 TB), the
|
||||||
server's response time (12 ms) and the time and duration of the last sync comparison. The capture's data folder is a
|
server's response time (12 ms) and the time and duration of the last sync comparison. The capture's data folder is a
|
||||||
new one in the machine's temporary folder, but the screens show it as a sample user's (`C:\Users\Studio\AppData\Local\Chronos`,
|
new one in the machine's temporary folder, but the screens show it as a sample user's (`C:\Users\Studio\AppData\Local\Chronos`,
|
||||||
its sample archive as `D:\ChronosArchive`: `AppEnvironment.Shown`), so neither the temporary folder nor the user name
|
its sample archive as `D:\ChronosArchive`: `AppEnvironment.Shown`; the videos folder is set to `D:\Videos\Chronos`), so neither the temporary folder nor the user name
|
||||||
reaches a picture; a path typed over a shown one goes back to the temporary folder (`AppEnvironment.Actual`), so the
|
reaches a picture; a path typed over a shown one goes back to the temporary folder (`AppEnvironment.Actual`), so the
|
||||||
capture writes nowhere else. Two captures made with different `TEMP` folders are identical. Two things still come from the
|
capture writes nowhere else. Two captures made with different `TEMP` folders are identical. Two things still come from the
|
||||||
machine: the time zone (times are shown in local time; the baselines are made in the development PC's, Europe/Rome,
|
machine: the time zone (times are shown in local time; the baselines are made in the development PC's, Europe/Rome,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 167 KiB |
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 167 KiB |
|
Before Width: | Height: | Size: 258 KiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 270 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 271 KiB After Width: | Height: | Size: 271 KiB |
|
Before Width: | Height: | Size: 271 KiB After Width: | Height: | Size: 271 KiB |
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 425 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 404 KiB After Width: | Height: | Size: 404 KiB |
|
Before Width: | Height: | Size: 272 KiB After Width: | Height: | Size: 273 KiB |
|
Before Width: | Height: | Size: 317 KiB After Width: | Height: | Size: 317 KiB |
|
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 310 KiB |
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 249 KiB After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 245 KiB |
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 229 KiB |
|
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 241 KiB |
|
Before Width: | Height: | Size: 235 KiB After Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 122 KiB |