Vixen
feb85697
csharp
public sealed class SettingsDocument

The project's settings as a document: edits through the editing pipeline, with an undo history of their own.

Read the guide page for this →

Remarks

#1310, decision (a). A settings window's rows wrote straight into the settings object — no document, so no undo — and kept a dirty flag of their own beside the store's, which was a second vocabulary for "unsaved" the project's close question could not see. The window's inspector now edits through this document: every change is a command on Stack, HasUnsavedChanges is the one answer the window's Apply, Save All and the close prompt read, and undoing back to where it was saved is clean again.

⚠ Its own stack, reached only from inside the settings window. It never becomes ActiveDocument — that is what Ctrl+Z reaches when nothing nearer the focus owns a history, so a settings document that took it would be the viewport's Ctrl+Z quietly undoing a project setting, which is the hazard the window's own remark refused undo over. The window hosts this stack as its undo manager instead, so Ctrl+Z there undoes a setting and anywhere else never does.

⚠ A write that did not go through the stack is a change from outside it — a category's Reset, or a plugin that writes a settings object and calls MarkChanged``1. It is ExternallyModified: saved by Save, asked about on close, and not taken back by an undo, because nothing recorded how.

Fields and properties (2)

Methods (5)

  • public SettingsDocument(EditorProject project, string title)

    Opens the project's settings as a document, without taking the focus.

  • public void Record(Type type)

    Says an edit through this document's stack reached a settings type, so a save writes it.

  • protected override void SaveCore()

    Writes the document back to wherever it came from.

  • protected override bool ReloadCore()

    Reads the file again. Overridden by a document that knows how.

  • protected internal override void OnClosed()

    Called once when the document leaves the project.

Used by (2)

  • EditorApplicationVixen.Editor.App
  • SettingsDocumentTestsVixen.Editor.Core.Tests