diff --git a/i18n/en/Editor.resx b/i18n/en/Editor.resx
index 3369c389..b371aa79 100644
--- a/i18n/en/Editor.resx
+++ b/i18n/en/Editor.resx
@@ -241,6 +241,7 @@
Keep
Mainthe name of every sequence's first project, holding the sequence's own settings
New project…
+ Open project…
Remove local copy…
Rename…
Save version…
@@ -268,6 +269,8 @@
{0} · read-only
Unsaved changes
Discard changes
+ The versions not sent and the unsaved changes go to the workspace's trash folder; Chronos does not bring them back.long
+ Discard the changes of {0}?
Files
The photos copied to this PC are deleted; the project stays in the library and opens again from there.long
None
@@ -275,6 +278,7 @@
Send first
Size
Remove local copy of {0}{0} project name
+ Type the project name to confirmlong
Versions not sent
Yes
Render · {0}
@@ -379,11 +383,15 @@
Project not deleted
Project {0} deleted{0} project name
{0} {1} here, {2} in the librarylong; {0} setting name, {1} value in this workspace, {2} value in the library
+ {0} changed in the library while your edit waited to be saved. The settings below differ: keep your values, or take the library's.long
Project in sync
Library photos changed
Version not sent yet
Nothing new to save
Library offline
+ Open
+ Project not opened
+ Project read-only
Local copy not removed
Local copy removed
Project renamed
@@ -394,6 +402,7 @@
Not sentversions saved here wait to be sent to the library
Library newerthe library has versions the workspace has not taken
Conflict
+ Not in library
In sync
No media
Changedthe project has changes not saved as a version
@@ -402,6 +411,7 @@
Syncing
Sync failed
Project synced
+ Library's values taken
Undo
Update media
Updating media
diff --git a/i18n/en/Errors.resx b/i18n/en/Errors.resx
index 916a0c5c..0cd30fb0 100644
--- a/i18n/en/Errors.resx
+++ b/i18n/en/Errors.resx
@@ -49,11 +49,13 @@
The closing brace at position {1} has no opening one; double it for a literal brace.
Something went wrong.
Settle the conflict first: Sync shows which settings differ.
+ Its local copy could not be removed now: Remove local copy takes it later.long
{0} did not match its source after it was copied.{0} file path
A file of this project in the workspace cannot be read; the log names it.
The last edit could not be stored yet; it is tried again, try once more in a moment.
The library's copy of this project does not match what was sent; nothing was removed.
The workspace folder is inside a library; nothing is copied into it.
+ The workspace folder {0} is inside a library, where Edit copies nothing: keep Chronos's data folder outside your libraries.long
A project name has 1 to 60 characters.
The Main project holds the sequence's own settings: it cannot be deleted.
The workspace's photos of this project changed; the editor reads them again.
@@ -67,5 +69,6 @@
This project is no longer in the library.
This project was saved by a newer Chronos: it opens read-only.
The library refused a version of this project; the log says why.
+ This project's sequence is no longer in the library: only its local copy can be removed, from the picker's menu.long
Some work is not in the library yet: send it first, or discard it.
diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx
index 75e98a54..b48b5abb 100644
--- a/i18n/en/Tooltips.resx
+++ b/i18n/en/Tooltips.resx
@@ -261,6 +261,7 @@
Keep the project as it is
Project {0} ({1}): save a version, sync, history, other projects and the local copy{0} project name, {1} its state
Make another project of this sequence, starting from this one (for example a vertical cut for social media)
+ Open another project of this sequence: one in the library, or a new onelong
Free this PC's space: delete the photos copied to the workspace; the project stays in the library
Give this project another name, here and in the library
Keep the project as it is now as a version of its history, with an optional note (Ctrl+S)
@@ -275,6 +276,7 @@
Edited with proxies on this PC; changes are saved on {0} and analyses and renders run there
Shown from {0}; your account can look at this sequence but not change it
Remove the copy without sending what is not in the library; that work is kept aside in the workspace's trash
+ Keep the local copy as it is
Delete the workspace copy; every version is in the library
Save and send what is not in the library yet, then remove the copy
Render with the selected preset; progress in the job bar · Ctrl+R
@@ -326,10 +328,12 @@
Keep your values of these settings; they are sent to the library
Decide later and keep editing; Sync asks again
Photos were added to or removed from this sequence in the library after the workspace copied it
+ Open project {0}, which holds your versionslong
Keep the library's values in this project, and send yours to a new project “{0}”{0} the new project's name
Versions saved here that wait to be sent to the library: {0}. Sync sends them{0} number of versions
Versions in the library this workspace has not taken yet: {0}. Sync takes them{0} number of versions
You and the library changed the same settings: Sync to choose which to keep
+ The library no longer has this project or its sequence: nothing more can be sent; remove the local copy (its work is kept aside)long
Every version of this project is in the library, and nothing changed since the last one
The workspace holds no photos of this project: opening it copies them again
Changes not saved as a version yet: Save version (Ctrl+S) keeps them in the history
@@ -338,7 +342,9 @@
Asking the library where this project stands
Taking the library's new versions and sending yours
Use the library's values of these settings in the editor
+ Use the library's values of these settings; Ctrl+Z brings yours backlong
Bring back the project as it was before the restore
+ Bring back your values of the settings the library's replacedlong
Copy the library's frames into the workspace again; the frames you excluded or keyed follow their photos
Import photos already in the archive again; nothing is overwritten
Copy into this PC's archive with the naming templates · {0}
diff --git a/i18n/it/Editor.it.resx b/i18n/it/Editor.it.resx
index 980e5388..dcc5a09f 100644
--- a/i18n/it/Editor.it.resx
+++ b/i18n/it/Editor.it.resx
@@ -230,6 +230,7 @@
Mantieni
Principale
Nuovo progetto…
+ Apri progetto…
Rimuovi copia locale…
Rinomina…
Salva versione…
@@ -257,6 +258,8 @@
{0} · sola lettura
Modifiche non salvate
Scarta modifiche
+ Le versioni non inviate e le modifiche non salvate vanno nella cartella cestino dello spazio di lavoro; Chronos non le riporta indietro.
+ Scartare le modifiche di {0}?
File
Le foto copiate su questo PC vengono eliminate; il progetto resta nella libreria e si riapre da lì.
Nessuna
@@ -264,6 +267,7 @@
Prima invia
Dimensione
Rimuovi copia locale di {0}
+ Scrivi il nome del progetto per confermare
Versioni non inviate
Sì
Renderizza · {0}
@@ -354,11 +358,15 @@
Progetto non eliminato
Progetto {0} eliminato
{0} {1} qui, {2} nella libreria
+ {0} è cambiato nella libreria mentre la tua modifica attendeva il salvataggio. Le impostazioni qui sotto sono diverse: tieni i tuoi valori o prendi quelli della libreria.
Progetto sincronizzato
Foto della libreria cambiate
Versione non ancora inviata
Niente di nuovo da salvare
Libreria non in linea
+ Apri
+ Progetto non aperto
+ Progetto in sola lettura
Copia locale non rimossa
Copia locale rimossa
Progetto rinominato
@@ -369,6 +377,7 @@
Da inviare
Libreria più nuova
Conflitto
+ Non in libreria
Sincronizzato
Senza media
Modificato
@@ -377,6 +386,7 @@
Sincronizzazione
Sincronizzazione non riuscita
Sincronizzazione eseguita
+ Valori della libreria presi
Annulla
Aggiorna media
Aggiornamento media
diff --git a/i18n/it/Errors.it.resx b/i18n/it/Errors.it.resx
index d2a4b811..f2a1cc3f 100644
--- a/i18n/it/Errors.it.resx
+++ b/i18n/it/Errors.it.resx
@@ -49,11 +49,13 @@
La parentesi graffa chiusa alla posizione {1} non ha un'apertura; raddoppiala per una graffa letterale.
Si è verificato un problema.
Risolvi prima il conflitto: Sincronizza mostra quali impostazioni sono diverse.
+ La sua copia locale ora non è stata rimossa: Rimuovi copia locale la toglie più tardi.
{0} non corrispondeva all'originale dopo la copia.
Un file di questo progetto nello spazio di lavoro non è leggibile; il log lo indica.
L'ultima modifica non è ancora stata memorizzata; viene ritentata, riprova tra un momento.
La copia di questo progetto nella libreria non corrisponde a quanto inviato; non è stato rimosso nulla.
La cartella dello spazio di lavoro è dentro una libreria; non vi viene copiato nulla.
+ La cartella dello spazio di lavoro {0} è dentro una libreria, dove Modifica non copia nulla: tieni la cartella dei dati di Chronos fuori dalle tue librerie.
Il nome di un progetto ha da 1 a 60 caratteri.
Il progetto Principale contiene le impostazioni della sequenza: non può essere eliminato.
Le foto di questo progetto nello spazio di lavoro sono cambiate; l'editor le rilegge.
@@ -67,5 +69,6 @@
Questo progetto non è più nella libreria.
Questo progetto è stato salvato da un Chronos più recente: si apre in sola lettura.
La libreria ha rifiutato una versione di questo progetto; il log spiega il motivo.
+ La sequenza di questo progetto non è più nella libreria: si può solo rimuoverne la copia locale, dal menu del selettore.
Parte del lavoro non è ancora nella libreria: prima inviala oppure scartala.
diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx
index 57626515..d3b216a5 100644
--- a/i18n/it/Tooltips.it.resx
+++ b/i18n/it/Tooltips.it.resx
@@ -261,6 +261,7 @@
Tieni il progetto com'è
Progetto {0} ({1}): salva una versione, sincronizza, cronologia, altri progetti e copia locale
Crea un altro progetto di questa sequenza a partire da questo (per esempio un taglio verticale per i social)
+ Apri un altro progetto di questa sequenza: uno della libreria o uno nuovo
Libera spazio su questo PC: elimina le foto copiate nello spazio di lavoro; il progetto resta nella libreria
Dai un altro nome a questo progetto, qui e nella libreria
Tieni il progetto com'è ora come versione della sua cronologia, con una nota facoltativa (Ctrl+S)
@@ -275,6 +276,7 @@
Modificata con i proxy su questo PC; le modifiche si salvano su {0} e analisi e render vengono eseguiti lì
Mostrata da {0}; il tuo account può vedere questa sequenza ma non modificarla
Rimuovi la copia senza inviare ciò che non è nella libreria; quel lavoro resta da parte nel cestino dello spazio di lavoro
+ Mantieni la copia locale com'è
Elimina la copia di lavoro; ogni versione è nella libreria
Salva e invia ciò che non è ancora nella libreria, poi rimuovi la copia
Renderizza con il preset scelto; avanzamento nella barra dei lavori · Ctrl+R
@@ -325,10 +327,12 @@
Tieni i tuoi valori di queste impostazioni; vengono inviati alla libreria
Decidi più tardi e continua a modificare; Sincronizza lo chiede di nuovo
Sono state aggiunte o tolte foto a questa sequenza nella libreria dopo che lo spazio di lavoro l'ha copiata
+ Apri il progetto {0}, che contiene le tue versioni
Tieni i valori della libreria in questo progetto e invia i tuoi a un nuovo progetto «{0}»
Versioni salvate qui in attesa di essere inviate alla libreria: {0}. Sincronizza le invia
Versioni nella libreria non ancora prese da questo spazio di lavoro: {0}. Sincronizza le prende
Tu e la libreria avete modificato le stesse impostazioni: sincronizza per scegliere quali tenere
+ La libreria non ha più questo progetto o la sua sequenza: non si può più inviare nulla; rimuovi la copia locale (il suo lavoro resta da parte)
Ogni versione di questo progetto è nella libreria e nulla è cambiato dall'ultima
Lo spazio di lavoro non ha foto di questo progetto: aprirlo le copia di nuovo
Modifiche non ancora salvate come versione: Salva versione (Ctrl+S) le tiene nella cronologia
@@ -337,7 +341,9 @@
Chiede alla libreria lo stato di questo progetto
Prende le nuove versioni della libreria e invia le tue
Usa nell'editor i valori della libreria per queste impostazioni
+ Usa i valori della libreria per queste impostazioni; Ctrl+Z riporta i tuoi
Riporta il progetto com'era prima del ripristino
+ Riporta i tuoi valori delle impostazioni sostituite da quelli della libreria
Copia di nuovo i fotogrammi della libreria nello spazio di lavoro; i fotogrammi esclusi o con keyframe seguono le loro foto
Importa di nuovo le foto già in archivio; nulla viene sovrascritto
Copia nell'archivio di questo PC con i modelli dei nomi · {0}
diff --git a/src/Chronos.App/Archive/ArchiveDialogViewModels.cs b/src/Chronos.App/Archive/ArchiveDialogViewModels.cs
index f7f8f186..a5fa4e11 100644
--- a/src/Chronos.App/Archive/ArchiveDialogViewModels.cs
+++ b/src/Chronos.App/Archive/ArchiveDialogViewModels.cs
@@ -94,6 +94,15 @@ public abstract class ArchiveDialogViewModel : LocalizedViewModel
ErrorText = null;
ErrorToolTip = null;
}
+
+ /// The dialog was closed (disposed): one still waiting to be shown no longer is.
+ public bool IsClosed { get; private set; }
+
+ public override void Dispose()
+ {
+ IsClosed = true;
+ base.Dispose();
+ }
}
/// A fact of the rebuild dialog ("Sidecars · 412"); a path stays left to right, a missing value says why in its tooltip.
diff --git a/src/Chronos.App/Editor/EditorSession.cs b/src/Chronos.App/Editor/EditorSession.cs
index f0dbc2a8..c23dbd7b 100644
--- a/src/Chronos.App/Editor/EditorSession.cs
+++ b/src/Chronos.App/Editor/EditorSession.cs
@@ -46,7 +46,8 @@ public sealed class EditorSession : IAsyncDisposable
Source = source;
_codecs = codecs ?? [];
_basis = content.Project;
- History = new ProjectHistory(content.Project);
+ // Undo steps take outside changes as the source merges them (a workspace project: positions photo by photo).
+ History = new ProjectHistory(content.Project, merge: (basis, ours, theirs) => source.Merge(basis, ours, theirs).Merged);
History.Changed += OnProjectChanged;
_saver = new ProjectSaver(SaveAsync, saveDelay ?? DefaultSaveDelay);
_saver.Failed += OnSaveFailed;
@@ -190,10 +191,11 @@ public sealed class EditorSession : IAsyncDisposable
}
///
- /// Settles against the server's settings as the last save read them. Both choices first take
- /// in what only the server changed (like any merge, without an undo step). then saves
- /// the editor's values of the settings both changed; otherwise the server's values become the project as one
- /// undoable step, so Ctrl+Z brings the editor's back (and saves them).
+ /// Settles against the settings stored meanwhile (the server's, a workspace's working state a sync
+ /// wrote) as the last save read them. Both choices first take in what only the other side changed (like any merge,
+ /// without an undo step). then saves the editor's values of the settings both changed;
+ /// otherwise the other side's values become the project as one undoable step, so Ctrl+Z brings the editor's back (and
+ /// saves them).
///
/// False when there is no conflict to settle (a later save already went through).
public bool ResolveConflict(bool keepMine)
@@ -202,8 +204,8 @@ public sealed class EditorSession : IAsyncDisposable
Conflict = null;
var basis = _basis;
_basis = theirs;
- History.Replace(ProjectMerge.Merge(basis, Project, theirs));
- if (!keepMine) History.Apply(ProjectMerge.Merge(basis, theirs, Project));
+ History.Replace(Source.Merge(basis, Project, theirs).Merged);
+ if (!keepMine) History.Apply(Source.Merge(basis, theirs, Project).Merged);
// The change waiting for its retry goes now, on top of the server's settings.
_ = _saver.FlushAsync();
return true;
@@ -245,13 +247,13 @@ public sealed class EditorSession : IAsyncDisposable
{
var content = await Source.LoadAsync(cancellationToken);
Follow(content);
- // A server's settings that conflict with the editor's waiting change are not merged over it: that change's
- // retry meets them and asks (Conflict).
- if (Conflict is null && (!IsRemote || ProjectMerge.Conflicts(_basis, Project, content.Project).Count == 0))
+ // Settings a server or a sync stored that conflict with the editor's waiting change are not merged over it: that
+ // change's retry meets them and asks (Conflict).
+ var merge = Conflict is null ? Source.Merge(_basis, Project, content.Project) : null;
+ if (merge is not null && (!Source.AsksConflicts || !merge.HasConflicts))
{
- var merged = ProjectMerge.Merge(_basis, Project, content.Project);
_basis = content.Project;
- History.Replace(merged);
+ History.Replace(merge.Merged);
}
}
finally
@@ -261,6 +263,38 @@ public sealed class EditorSession : IAsyncDisposable
ContentChanged?.Invoke();
}
+ ///
+ /// Reads the project again after the user took the other side's values of the settings both changed (a workspace
+ /// project's "Take the library's", settled by its sync): what only the other side changed comes in as any merge does,
+ /// without an undo step (: the stored project as keeping the editor's values would have left
+ /// it), then the values taken become the project as one undoable step, so Ctrl+Z brings the editor's back (and saves
+ /// them), as does for a server's.
+ ///
+ /// That step, which a toast's Undo can take back while it is the last change; null when it changed nothing.
+ public async Task TakeOverAsync(ProjectSettings kept, CancellationToken cancellationToken = default)
+ {
+ ArgumentNullException.ThrowIfNull(kept);
+ await _saver.FlushAsync();
+ var taken = await BeginReadAsync();
+ ProjectRestore? step = null;
+ try
+ {
+ var content = await Source.LoadAsync(cancellationToken);
+ Follow(content);
+ var basis = _basis;
+ _basis = content.Project;
+ History.Replace(Source.Merge(basis, Project, kept).Merged);
+ var before = Project;
+ if (!IsReadOnly && History.Apply(Source.Merge(kept, Project, content.Project).Merged)) step = new ProjectRestore(this, before, Project);
+ }
+ finally
+ {
+ taken.SetResult();
+ }
+ ContentChanged?.Invoke();
+ return step;
+ }
+
/// Stores pending changes now; false when the save failed (the change stays pending and is retried).
public Task FlushAsync() => _saver.FlushAsync();
@@ -357,7 +391,9 @@ public sealed class EditorSession : IAsyncDisposable
private void OnProjectChanged()
{
- _saver.Schedule(Project);
+ // A read-only project takes what is read again (a workspace pull of a newer Chronos's settings) without a save that
+ // could never be stored and would be retried for ever.
+ if (!IsReadOnly) _saver.Schedule(Project);
ProjectChanged?.Invoke();
}
@@ -410,7 +446,7 @@ public sealed class EditorSession : IAsyncDisposable
Conflict = null;
_basis = stored;
// Someone else's change was merged in: show it without an undo step (edits made since the save are kept).
- if (!ProjectMerge.SameValues(stored, project)) History.Replace(ProjectMerge.Merge(project, Project, stored));
+ if (!ProjectMerge.SameValues(stored, project)) History.Replace(Source.Merge(project, Project, stored).Merged);
}
}
diff --git a/src/Chronos.App/Editor/EditorViewModel.cs b/src/Chronos.App/Editor/EditorViewModel.cs
index d31f2f84..e92d6b23 100644
--- a/src/Chronos.App/Editor/EditorViewModel.cs
+++ b/src/Chronos.App/Editor/EditorViewModel.cs
@@ -8,6 +8,7 @@ using Chronos.App.Infrastructure;
using Chronos.App.Jobs;
using Chronos.App.Server;
using Chronos.App.Shell;
+using Chronos.App.Workspace;
using Chronos.Core.Advice;
using Chronos.Core.Analysis;
using Chronos.Core.Diagnostics;
@@ -480,7 +481,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// Why the controls that change the project are disabled; null while they are not.
public string? LockedToolTip => IsOutdated ? Loc.L("Tooltips.Editor.Outdated", ServerName)
- : IsReadOnly ? Loc.L("Tooltips.Editor.ReadOnly")
+ : IsReadOnly ? Loc.L(Session.Source is WorkspaceSequenceSource ? "Errors.Workspace.ReadOnly" : "Tooltips.Editor.ReadOnly")
: IsBusy ? Loc.L("Tooltips.Editor.Busy")
: null;
@@ -1053,17 +1054,33 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
});
///
- /// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"): the
- /// dialog lists them; Keep mine overwrites the server's, Take server (the safe default, also on Esc) shows theirs as
- /// one undoable step. Saving waits until then.
+ /// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"), or, for
+ /// a workspace project, that a sync took from the library while the edit waited (owner review 2, R8): the dialog lists
+ /// them; Keep mine overwrites the other side's, Take server or the library's (the safe default, also on Esc) shows theirs
+ /// as one undoable step. Saving waits until then.
///
private void OnConflictFound(ProjectConflictException conflict) => _dispatcher.BeginInvoke(() =>
{
if (_disposed || Session.Conflict is null) return;
- var keepMine = Shell.Services.Dialogs.Confirm(ConflictRequest(conflict, Title, ServerName ?? string.Empty));
+ var request = Session.Source is WorkspaceSequenceSource ? LibraryConflictRequest(conflict, Title) : ConflictRequest(conflict, Title, ServerName ?? string.Empty);
+ var keepMine = Shell.Services.Dialogs.Confirm(request);
if (!_disposed) Session.ResolveConflict(keepMine);
});
+ /// The conflict prompt of a workspace project: what differs (the editor's value, then the library's) and what each choice keeps.
+ internal static ConfirmRequest LibraryConflictRequest(ProjectConflictException conflict, string title) => new()
+ {
+ Heading = Loc.L("Editor.Workspace.Conflict.Title"),
+ Message = Loc.L("Editor.Workspace.Edited.Message", title),
+ Detail = string.Join(Environment.NewLine, WorkspaceText.ConflictLines(conflict.Differences, 10)),
+ DetailToolTip = Loc.L("Tooltips.Editor.Workspace.Differences"),
+ SafeText = Loc.L("Editor.Workspace.Conflict.TakeHome"),
+ SafeToolTip = Loc.L("Tooltips.Editor.Workspace.TakeHomeUndo"),
+ ActionText = Loc.L("Server.Sync.Action.KeepMine"),
+ ActionToolTip = Loc.L("Tooltips.Editor.Workspace.KeepMine"),
+ IsDestructive = true,
+ };
+
/// The conflict prompt: what differs (the editor's value, then the server's) and what each choice replaces.
internal static ConfirmRequest ConflictRequest(ProjectConflictException conflict, string title, string server) => new()
{
@@ -1160,8 +1177,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
}
///
- /// The frames of the server sequence changed while it is open (any thread): everything that changes the project is
- /// disabled and says why, and a toast offers to fetch the proxies again.
+ /// The frames of the server sequence changed while it is open, or a workspace project's sync took a newer Chronos's
+ /// settings (any thread): everything that changes the project is disabled and says why, and a toast says so (for a
+ /// server sequence, offering to fetch the proxies again).
///
private void OnReadOnlyChanged() => _dispatcher.BeginInvoke(() =>
{
@@ -1173,6 +1191,12 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
OnPropertyChanged(nameof(RenderChoiceToolTip));
OnRenderStateChanged();
OnBusyChanged();
+ // A workspace project a sync turned read-only (a newer Chronos saved it): said once, the controls say why too.
+ if (IsReadOnly && Session.Source is WorkspaceSequenceSource)
+ {
+ Shell.ShowToast(new Toast { Title = Loc.L("Editor.Workspace.ReadOnly"), Message = Loc.L("Errors.Workspace.ReadOnly") });
+ return;
+ }
if (!IsOutdated) return;
var (id, title) = (Session.Content.Sequence.Id, Title);
Shell.ShowToast(new Toast
diff --git a/src/Chronos.App/Editor/ISequenceSource.cs b/src/Chronos.App/Editor/ISequenceSource.cs
index 46be0566..a1709a2d 100644
--- a/src/Chronos.App/Editor/ISequenceSource.cs
+++ b/src/Chronos.App/Editor/ISequenceSource.cs
@@ -35,6 +35,12 @@ public interface ISequenceSource : IAsyncDisposable
///
bool IsOutdated { get; }
+ ///
+ /// A change stored meanwhile by someone else to settings the editor changed too is asked about
+ /// (), never merged over the editor's: a server sequence, a workspace project.
+ ///
+ bool AsksConflicts => IsRemote;
+
/// changed (any thread).
event Action? ReadOnlyChanged;
@@ -68,6 +74,13 @@ public interface ISequenceSource : IAsyncDisposable
/// The editor's own reason the project was not stored, worded for the user.
Task SaveProjectAsync(ProjectSettings project, ProjectSettings basis, CancellationToken cancellationToken);
+ ///
+ /// The three-way merge of the editor's projects, all three naming this source's frames (): member
+ /// by member, a member both sides changed listed as a conflict and settled for . A workspace
+ /// project merges its frame positions photo by photo, as its sync does.
+ ///
+ ProjectMergeResult Merge(ProjectSettings basis, ProjectSettings ours, ProjectSettings theirs) => ProjectMerge.MergeWithConflicts(basis, ours, theirs);
+
/// Queues an analysis or render job for the sequence; returns the job id.
Task SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken);
diff --git a/src/Chronos.App/Editor/ProjectHistory.cs b/src/Chronos.App/Editor/ProjectHistory.cs
index de7d5ca8..fc396f9f 100644
--- a/src/Chronos.App/Editor/ProjectHistory.cs
+++ b/src/Chronos.App/Editor/ProjectHistory.cs
@@ -9,7 +9,11 @@ namespace Chronos.App.Editor;
/// (the drag or key press ended); any other edit, undo or redo also ends the run. The oldest steps
/// are dropped beyond .
///
-public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
+///
+/// The three-way merge (basis, ours, theirs) that gives each step an outside change (): the source's,
+/// which merges a workspace project's frame positions photo by photo; when null.
+///
+public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200, Func? merge = null)
{
private readonly LinkedList _undo = new();
private readonly LinkedList _redo = new();
@@ -71,7 +75,8 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
{
ArgumentNullException.ThrowIfNull(current);
if (ProjectMerge.SameValues(current, Current)) return;
- var rebase = new ProjectMerge.Rebase(Current, current);
+ var (basis, theirs) = (Current, current);
+ Func rebase = merge is null ? new ProjectMerge.Rebase(basis, theirs).Apply : step => merge(basis, step, theirs);
Rebase(_undo, rebase);
Rebase(_redo, rebase);
_runKey = null;
@@ -98,9 +103,9 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
Changed?.Invoke();
}
- private static void Rebase(LinkedList steps, ProjectMerge.Rebase rebase)
+ private static void Rebase(LinkedList steps, Func rebase)
{
- for (var node = steps.First; node is not null; node = node.Next) node.Value = rebase.Apply(node.Value);
+ for (var node = steps.First; node is not null; node = node.Next) node.Value = rebase(node.Value);
}
private bool Move(ProjectSettings target)
diff --git a/src/Chronos.App/Editor/WorkspaceSequenceSource.cs b/src/Chronos.App/Editor/WorkspaceSequenceSource.cs
index 9ae8554f..2df62006 100644
--- a/src/Chronos.App/Editor/WorkspaceSequenceSource.cs
+++ b/src/Chronos.App/Editor/WorkspaceSequenceSource.cs
@@ -34,7 +34,10 @@ public interface IProjectRenders
/// library): the frames and pixels of the media the workspace holds (media/media.json, the proxies), the project
/// from its working state (project.chronos, positions placed on those frames), saved there atomically under the
/// project's lease and merged against the basis like (a pull or a copy job writes it
-/// too). Jobs run on this PC's engine against the home's sequence (same id): an analysis reads the home's originals, a
+/// too): frame positions photo by photo as the sync merges them (), and settings the editor changed to
+/// other values than those stored meanwhile asked about (), never decided for the
+/// editor. A pull that brings a newer Chronos's settings turns it read-only (). Jobs run on
+/// this PC's engine against the home's sequence (same id): an analysis reads the home's originals, a
/// render renders the home's originals with the project's portable settings and records the project and the version
/// (). The deep report is the home's while its frames are the media's, else the copy the
/// workspace took. A copy job that changed the media (Update media) makes saves made against the frames read before refused
@@ -94,12 +97,11 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
public bool IsOutdated => false;
- /// A workspace project's read-only state is known when it opens.
- public event Action? ReadOnlyChanged
- {
- add { }
- remove { }
- }
+ /// The library's values and the editor's are asked about where both changed a setting, as a sync asks.
+ public bool AsksConflicts => true;
+
+ /// The working state read again holds a newer Chronos's settings (a pull took them), or no longer does.
+ public event Action? ReadOnlyChanged;
public event Action? JobChanged;
@@ -183,6 +185,10 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
/// The project is read-only, or its media are gone.
/// The media changed since they were read (a copy job): read them again first.
+ ///
+ /// The working state stored meanwhile (a sync took the library's versions) holds other values of settings this edit
+ /// changed too: nothing is stored until the user keeps theirs or takes the library's.
+ ///
public Task SaveProjectAsync(ProjectSettings project, ProjectSettings basis, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(project);
@@ -200,7 +206,13 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
// A copy job moved the working state onto other frames: the editor reads them and moves its positions first.
if (media.FramesVersion != framesVersion) throw new FramesChangedException(Loc.L("Errors.Workspace.MediaChanged"));
var stored = ProjectSettings.FromJson(ProjectContent.Place(bundle.Project.ToJson(), media.Photos), allowNewer: true);
- var merged = ProjectMerge.SameValues(stored, basis) ? project : ProjectMerge.Merge(basis, project, stored);
+ var merged = project;
+ if (!ProjectMerge.SameValues(stored, basis))
+ {
+ var merge = Merge(basis, project, stored, media.Photos);
+ if (merge.HasConflicts) throw new ProjectConflictException(Loc.L("Editor.Error.SaveConflict"), stored, merge.Conflicts);
+ merged = merge.Merged;
+ }
if (ProjectMerge.SameValues(merged, stored)) return merged;
folder.WriteBundle(bundle with { Project = merged, Saved = DateTimeOffset.UtcNow });
return merged;
@@ -208,6 +220,33 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
}, cancellationToken);
}
+ ///
+ /// The editor's merges as the sync merges (owner review 2, R8): member by member, and frame positions photo by photo and
+ /// flag by flag in the portable form, so an exclusion or a keyframe a sync wrote meanwhile stays beside the editor's own
+ /// (positional arrays would take one side whole). All three name the frames of the media read last.
+ ///
+ public ProjectMergeResult Merge(ProjectSettings basis, ProjectSettings ours, ProjectSettings theirs) => Merge(basis, ours, theirs, Photos);
+
+ private static ProjectMergeResult Merge(ProjectSettings basis, ProjectSettings ours, ProjectSettings theirs, FramePhotos photos)
+ {
+ ArgumentNullException.ThrowIfNull(basis);
+ ArgumentNullException.ThrowIfNull(ours);
+ ArgumentNullException.ThrowIfNull(theirs);
+ var merge = ProjectMerge.MergeWithConflicts(basis, ours, theirs);
+ // Positions only one side moved, or none, merge alike either way; the portable form is needed where both did.
+ if (photos.Count == 0 || !merge.Conflicts.Any(c => NamesPosition(c.Path)) || basis.IsNewerFormat || ours.IsNewerFormat || theirs.IsNewerFormat) return merge;
+ var portable = ProjectMerge.MergeWithConflicts(Portable(basis, photos), Portable(ours, photos), Portable(theirs, photos));
+ var placed = ProjectSettings.FromJson(ProjectContent.Place(ProjectContent.Canonical(portable.Merged.ToJson()), photos), allowNewer: true);
+ return portable with { Merged = placed };
+
+ static ProjectSettings Portable(ProjectSettings settings, FramePhotos photos) =>
+ ProjectSettings.FromJson(ProjectContent.ToPortable(settings, photos), allowNewer: true);
+ }
+
+ /// A merge path of a frame position (an exclusion, the hero, a camera keyframe, a frame waiting for its photo).
+ private static bool NamesPosition(string path) =>
+ path is "excludedFrames" or "heroFrame" || path.StartsWith("camera.keyframes", StringComparison.Ordinal) || path.StartsWith("pendingFrames", StringComparison.Ordinal);
+
public async Task SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken)
{
if (_engine is null) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"));
@@ -271,11 +310,13 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
///
/// Takes the media read now: a frame source over them when they differ from those read before (the old one is disposed
- /// with this source, as a decode may still read it), their frames and photos, the project's workspace section.
+ /// with this source, as a decode may still read it), their frames and photos, the project's workspace section, and
+ /// whether the settings are a newer Chronos's (said by when that changed).
///
private void Swap(WorkspaceSequence media, WorkspaceMedia index, BundleWorkspace workspace, bool readOnly)
{
var ids = media.Frames.Select(f => f.Id).ToArray();
+ bool changed;
lock (_gate)
{
if (_frames is null || index.FramesVersion != _framesVersion || !ids.AsSpan().SequenceEqual(_frameIds))
@@ -289,8 +330,10 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
_framesVersion = index.FramesVersion;
_photos = index.Photos;
_workspace = workspace;
+ changed = _readOnly != readOnly;
_readOnly = readOnly;
}
+ if (changed) ReadOnlyChanged?.Invoke();
}
/// The last version saved: the newest one not sent yet, else the base; with its content hash.
diff --git a/src/Chronos.App/Sections/SequencePickerView.xaml b/src/Chronos.App/Sections/SequencePickerView.xaml
index 7191b87c..53b3bc32 100644
--- a/src/Chronos.App/Sections/SequencePickerView.xaml
+++ b/src/Chronos.App/Sections/SequencePickerView.xaml
@@ -80,10 +80,18 @@
Grid.IsSharedSizeScope="True" Visibility="{Binding Picker.HasWorkspaceItems, Converter={StaticResource BoolToVisibility}}">
+
-
+
+
+
+
+
+
+
diff --git a/src/Chronos.App/Sections/SequencePickerViewModel.cs b/src/Chronos.App/Sections/SequencePickerViewModel.cs
index 346702a5..6a1da6e2 100644
--- a/src/Chronos.App/Sections/SequencePickerViewModel.cs
+++ b/src/Chronos.App/Sections/SequencePickerViewModel.cs
@@ -51,6 +51,7 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
_open = new AsyncRelayCommand(() => (Selected ?? Items.FirstOrDefault()) is { } item ? _section.PickAsync(item) : Task.CompletedTask, () => Items.Count > 0);
OpenItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _section.PickAsync(item) : Task.CompletedTask);
OpenProjectCommand = new AsyncRelayCommand((p, _) => (p as WorkspaceProjectItem ?? SelectedProject) is { } item ? _section.PickProjectAsync(item) : Task.CompletedTask);
+ RemoveCopyCommand = new AsyncRelayCommand((p, _) => (p as WorkspaceProjectItem ?? SelectedProject) is { } item ? _section.RemoveProjectCopyAsync(item) : Task.CompletedTask);
SearchOpenCommand = new AsyncRelayCommand(OpenFromSearchAsync);
ClearCommand = new RelayCommand(() => SearchText = string.Empty);
}
@@ -73,6 +74,9 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
/// Opens a project of the Workspace group (double-click, Enter in its list), else the selected one.
public ICommand OpenProjectCommand { get; }
+ /// "Remove local copy…" of a project of the Workspace group (its menu, Delete in its list), also one that cannot open.
+ public ICommand RemoveCopyCommand { get; }
+
/// The Workspace group read last, then its projects' states (tests wait for it).
public async Task WorkspaceLoadedAsync()
{
diff --git a/src/Chronos.App/Sections/SequenceView.xaml b/src/Chronos.App/Sections/SequenceView.xaml
index 1dbc580b..f93fa080 100644
--- a/src/Chronos.App/Sections/SequenceView.xaml
+++ b/src/Chronos.App/Sections/SequenceView.xaml
@@ -121,6 +121,7 @@
+