Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::DocumentSyncController Class Reference

Owns source-pane debounce, parse-error markers, and XML-owned source view mirroring. More...

#include "donner/editor/DocumentSyncController.h"

Public Member Functions

 DocumentSyncController (std::string initialSource)
void resetForLoadedDocument (const std::string &source)
void syncParseErrorMarkers (EditorApp &app, TextEditor &textEditor)
const SourceDiagnosticSnapshotsourceDiagnostics () const
 Diagnostics normalized for the current source buffer and parse revision.
bool mirrorSourceDeltas (EditorApp &app, TextEditor &textEditor, const std::vector< xml::XMLSourceDelta > &sourceDeltas)
 Mirror XML-owned source deltas into the source pane.
void handleTextEdits (EditorApp &app, TextEditor &textEditor, float deltaSeconds)
std::optional< float > nextTextSyncWakeSeconds () const
 Return the pending source-text sync wake interval, if a throttled edit is waiting.
void applyPendingWritebacks (EditorApp &app, SelectTool &selectTool, TextEditor &textEditor)
bool hasPendingWritebacks () const
 True when applyPendingWritebacks still has queued work. Writebacks accumulate while the async renderer owns the document and are drained by the first frame that finds it idle - so a frame that skips the document-sync stage while this holds would strand them until the next user input.

Detailed Description

Owns source-pane debounce, parse-error markers, and XML-owned source view mirroring.

Member Function Documentation

◆ mirrorSourceDeltas()

bool donner::editor::DocumentSyncController::mirrorSourceDeltas ( EditorApp & app,
TextEditor & textEditor,
const std::vector< xml::XMLSourceDelta > & sourceDeltas )

Mirror XML-owned source deltas into the source pane.

Use this when a canvas/DOM operation already mutated the XML document and returned xml::XMLSourceDelta records. The controller replays the deltas into textEditor with source-change suppression and falls back to mirroring the document source if the delta sequence cannot be applied precisely.

Parameters
appEditor app containing the source-backed document.
textEditorSource pane to update.
sourceDeltasSource deltas emitted by the XML document.
Returns
True if the source pane was updated from the deltas or fallback mirror.

The documentation for this class was generated from the following file: