|
|
| EditorApp (const EditorApp &)=delete |
|
EditorApp & | operator= (const EditorApp &)=delete |
|
| EditorApp (EditorApp &&)=delete |
|
EditorApp & | operator= (EditorApp &&)=delete |
|
bool | loadFromString (std::string_view svgBytes) |
| | Load an SVG document from a string. Replaces any current document and clears the current selection. Returns true on parse success.
|
|
bool | hasDocument () const |
| | Whether a document has been loaded.
|
|
AsyncSVGDocument & | document () |
| | Direct access to the wrapped AsyncSVGDocument. Used by the main loop for flushFrame() and currentFrameVersion(), and by tests.
|
|
const AsyncSVGDocument & | document () const |
|
const std::optional< std::string > & | currentFilePath () const |
| | The file path this document was loaded from, or std::nullopt if it was created from scratch. Populated by the main loop via setCurrentFilePath after a successful File → Open / argv load.
|
|
void | setCurrentFilePath (std::string path) |
| | Set the path associated with the current document. Called by the main loop when a file is loaded. Clears the dirty flag.
|
|
bool | isDirty () const |
| | Whether the document has unsaved changes. Set automatically on every mutation via applyMutation; cleared by setCurrentFilePath / markClean.
|
|
void | markClean () |
| | Mark the document as clean (e.g. after a successful save).
|
|
void | markDirty () |
| | Mark the document as dirty. The main loop calls this when the user types in the source pane, since text-pane edits don't go through applyMutation.
|
|
void | setCleanSourceText (std::string_view sourceText) |
| | Record the current source text as the "clean" baseline. Used after loading or saving a document so later source edits can determine whether the in-memory text has diverged from the last persisted bytes.
|
|
std::string_view | cleanSourceText () const |
| | The last source text known to be in sync with the DOM.
|
|
bool | revertToCleanSource () |
| | Reload the last clean source baseline and clear transient document state.
|
|
void | syncDirtyFromSource (std::string_view currentSourceText) |
| | Recompute the dirty flag from the current source text. This allows the editor to clear the dirty indicator when the user undoes or edits back to the last clean baseline.
|
|
void | applyMutation (EditorCommand command) |
| | The single entry point for editor-initiated DOM writes. Tools and the text pane both flow through here. Pushes the command onto the document's command queue; nothing is applied until flushFrame().
|
|
void | restoreSelectionAfterNextDocumentReplace (std::vector< AttributeWritebackTarget > targets) |
| | Restore these selection targets after the next source-backed document replacement.
|
|
bool | flushFrame () |
| | Drain and apply any pending mutations. Called once per frame at the start of the main loop. Returns true if any commands were applied.
|
| bool | deleteSelectionWithUndo (std::string_view currentSourceText) |
| | Delete the current selection and record a source-level undo entry.
|
|
const std::vector< svg::SVGElement > & | selectedElements () const |
| | All currently-selected elements, in selection order. Empty when nothing is selected. Multi-element selections come from shift+click and marquee-drag (Milestone 4 of the editor UX design doc).
|
|
const std::optional< svg::SVGElement > & | selectedElement () const |
| | Single-element accessor for back-compat with single-select call sites (overlay chrome, source-pane highlight, drag writeback, inspector, etc.). Returns the first selected element, or std::nullopt if nothing is selected. Cached so the const optional& reference stays stable across calls.
|
|
bool | hasSelection () const |
| | Whether anything is selected.
|
|
void | setSelection (std::optional< svg::SVGElement > element) |
| | Replace the current selection with a single element. Pass std::nullopt to clear.
|
|
void | setSelection (std::vector< svg::SVGElement > elements) |
| | Replace the current selection with the given list. Use this for marquee-resolved multi-selects.
|
|
void | toggleInSelection (const svg::SVGElement &element) |
| | Add element to the current selection if it isn't already selected; remove it if it is. The natural Shift+click handler.
|
|
void | addToSelection (const svg::SVGElement &element) |
| | Append element to the current selection without disturbing existing entries. No-op if element is already selected.
|
| bool | setAttributeOnSelection (std::string_view attrName, std::string_view attrValue) |
| | Queue an attribute write for every selected element.
|
| bool | setStylePropertyOnSelection (std::string_view propertyName, std::string_view propertyValue) |
| | Merge a single CSS declaration into each selected element's style attribute.
|
| bool | setStrokeWidthOnSelection (double strokeWidth) |
| | Queue a stroke-width style-property write for every selected element.
|
|
const ActivePaintStyle & | activePaintStyle () const |
| | Active paint settings used by path-authoring tools for newly-created elements.
|
| void | setActiveFill (std::string_view fill) |
| | Set the active fill attribute for newly-created elements.
|
| void | setActiveStroke (std::string_view stroke) |
| | Set the active stroke attribute for newly-created elements.
|
| void | setActiveStrokeWidth (double strokeWidth) |
| | Set the active stroke width for newly-created elements.
|
|
void | clearSelection () |
| | Drop every entry from the selection. Equivalent to setSelection(std::nullopt) but reads better at clear sites.
|
| PathOperationAvailability | pathOperationAvailability (PathOperationKind operation) const |
| | Return whether a path operation is available for the current selection.
|
| bool | applyPathOperation (PathOperationKind operation) |
| | Queue a destructive path operation over the current selection.
|
| PathOperationAvailability | compoundPathUnbundleAvailability (std::optional< svg::SVGElement > target=std::nullopt) const |
| | Return whether a compound path can be unbundled into separate path elements.
|
| bool | unbundleCompoundPath (std::optional< svg::SVGElement > target=std::nullopt) |
| | Queue an unbundle operation for one compound path.
|
|
std::optional< svg::SVGGeometryElement > | hitTest (const Vector2d &documentPoint) |
| | Find the topmost geometry element at the given document-space point, or std::nullopt if no element is hit. Coordinates are in the SVG canvas space (the same space as the root <svg> viewBox).
|
|
std::vector< svg::SVGGeometryElement > | hitTestRect (const Box2d &documentRect) |
| | Find every geometry element whose painted shape intersects documentRect. Used by marquee selection. Returns elements in document order (root-to-leaf depth-first), so callers that care about z-order can rely on a stable sequence.
|
|
UndoTimeline & | undoTimeline () |
| | Access the underlying UndoTimeline. Tools record begin/commit transactions on it directly; EditorApp::undo() below is the canonical way to apply undo entries because it routes them through the command queue so the mutation seam is preserved.
|
|
const UndoTimeline & | undoTimeline () const |
|
bool | canUndo () const |
| | Whether there is an entry to undo.
|
|
bool | canRedo () const |
| | Whether the most recently undone entry can be redone.
|
|
void | undo () |
| | Undo the most recent entry. Pops the timeline's next entry and pushes the restored transform onto the command queue as a SetTransformCommand — the actual DOM mutation happens on the next flushFrame(), keeping every DOM write on the same path. No-op if there is nothing to undo.
|
| void | redo () |
| | Redo the most recently undone entry.
|
|
void | setStructuredEditingEnabled (bool enabled) |
| | Enable or disable the structured-editing incremental path (M5). When enabled, text edits that land inside a known attribute value dispatch to SetAttributeCommand instead of ReplaceDocumentCommand, preserving tree identity. Defaults to true; the flag remains as a runtime escape hatch while the structured-editing rollout settles.
|
|
bool | structuredEditingEnabled () const |
| | Whether the structured-editing incremental path is active.
|
|
void | enqueueTransformWriteback (CompletedTransformWriteback writeback) |
| | Queue a transform writeback that main.cc will splice into the source on its next applyPendingTransformWriteback() call. SelectTool calls this when a drag completes; undo() / redo() call it so undoing a canvas drag restores both the DOM transform and the source text in lock-step. Multiple entries are preserved so grouped multi-selection undo/redo updates every participant.
|
|
std::optional< CompletedTransformWriteback > | consumeTransformWriteback () |
| | Drain the oldest queued transform writeback, if any.
|
|
std::vector< CompletedTransformWriteback > | consumeTransformWritebacks () |
| | Drain all queued transform writebacks. Called once per frame by DocumentSyncController.
|
|
void | enqueueElementRemoveWriteback (CompletedElementRemoveWriteback writeback) |
| | Queue an element-removal writeback that main.cc will splice into the source on its next drain.
|
|
std::vector< CompletedElementRemoveWriteback > | consumeElementRemoveWritebacks () |
| | Drain any queued element-removal writebacks.
|
Top-level editor shell.
Lifetime: typically one per window. All public methods are UI-thread only.