Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
CommandQueue.h File Reference

CommandQueue is the per-frame queued-command seam described in Editor Architecture. It accumulates canvas, tool, application, and full-document-replacement commands on the UI thread and coalesces them at flush time. Incremental source-pane edits use AsyncSVGDocument::applySourceEdit() instead of this queue. More...

#include <deque>
#include <optional>
#include <string>
#include <vector>
#include "donner/editor/EditorCommand.h"
Include dependency graph for CommandQueue.h:
This graph shows which files directly or indirectly include this file:

Classes

class  donner::editor::CommandQueue
 Ordered queue of editor commands awaiting document access. More...
struct  donner::editor::CommandQueue::FlushResult
 Outcome of flushing pending editor commands. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

CommandQueue is the per-frame queued-command seam described in Editor Architecture. It accumulates canvas, tool, application, and full-document-replacement commands on the UI thread and coalesces them at flush time. Incremental source-pane edits use AsyncSVGDocument::applySourceEdit() instead of this queue.

Coalescing rules (applied in flush()):

  1. ReplaceDocument is exclusive: it drops every command queued before it (their entity references would be invalidated by the re-parse). Commands queued after a ReplaceDocument apply against the new document.
  2. SetTransform collapses by entity: multiple SetTransform commands targeting the same Entity flush as a single command carrying the most recent transform. A drag that produces 60 mouse-move SetTransform commands per second flushes as a single setTransform() call.
  3. InsertElement and DeleteElement are structural and are never coalesced.
  4. No reordering across commands targeting different entities. Coalescing only collapses redundant writes.

The queue is UI-thread-only. The render thread reads the shared live document under ConcurrentDom access guards, never through this queue.


Class Documentation

◆ donner::editor::CommandQueue::FlushResult

struct donner::editor::CommandQueue::FlushResult

Outcome of flushing pending editor commands.

Class Members
vector< EditorCommand > effectiveCommands
bool hadReplaceDocument = false True when any ReplaceDocument was drained from the raw pending batch.
bool preserveUndoOnReparse = false True only when the drained batch contained at least one ReplaceDocument and every drained ReplaceDocument carried the preserve-undo marker.