|
|
| 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.
|
|
void | clearCurrentFilePath () |
| | Clear the backing path for an untitled or built-in document.
|
|
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 | setElementVisible (const svg::SVGElement &element, bool visible) |
| | Set the visibility of element by toggling its display presentation attribute. Hiding captures the element's current author display value (if any) before overwriting it with display="none". Showing restores that captured value when it is a genuine, non-none author value (e.g. display="block"), so a hide/show round trip does not clobber it; otherwise (no captured value, or the element was never hidden through this toggle this session) it writes display="inline" (a definitively visible value, observable through the computed-style visibility check). Routes through applyMutation so the Layers panel eye button and context menu share one code path. Visibility toggles are intentionally NOT lock-gated.
|
|
void | setElementLocked (const svg::SVGElement &element, bool locked) |
| | Lock or unlock element by toggling the data-donner-locked marker attribute ("true" to lock, "false" to unlock). Routes through applyMutation. The lock toggle itself is NOT lock-gated, so a locked layer can always be unlocked.
|
|
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.
|
| bool | reorderSelectedElement (ZOrder direction) |
| | Reorder the single selected element among its siblings (paint/z-order), recording one undoable structural edit.
|
| bool | reorderElementBeforeSibling (svg::SVGElement element, std::optional< svg::SVGElement > referenceSibling) |
| | Move element so it sits immediately before referenceSibling among its current parent's children (or to the end when referenceSibling is std::nullopt), recording one undoable structural edit.
|
| bool | moveElementBefore (svg::SVGElement element, svg::SVGElement parent, std::optional< svg::SVGElement > referenceElement, std::string_view undoLabel="Move element") |
| | Move element into parent before referenceElement as one undoable DOM edit.
|
|
GroupOperationAvailability | groupSelectionAvailability () const |
| | Return whether the current selection can be wrapped in one lossless structural group.
|
|
bool | groupSelection () |
| | Wrap the current contiguous same-parent selection in an attribute-free <g>.
|
|
GroupOperationAvailability | ungroupSelectionAvailability () const |
| | Return whether the selected attribute-free <g> can be removed losslessly.
|
|
bool | ungroupSelection () |
| | Lift the selected attribute-free group's children into its parent.
|
| bool | renameSelectedElement (std::string_view newId) |
| | Rename the single selected element's id to newId, updating every internal reference so the document keeps rendering the same - one undoable structural edit.
|
|
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 | enterGroupEdit (const svg::SVGElement &group) |
|
bool | exitGroupEdit () |
| | Exit one isolated editing level and select the group that was being edited.
|
|
const std::optional< svg::SVGElement > & | editingScope () const |
| | Current isolated group, or null when editing the full document.
|
|
bool | isElementInEditingScope (const svg::SVGElement &element) const |
| | Whether p element is selectable within the current isolated group.
|
| 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::SVGGraphicsElement > | 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::SVGGraphicsElement > | 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.
|
|
std::vector< svg::SVGElement > | selectableElements () |
| | Return every selectable geometry element in the document, in document order (root-to-leaf depth-first). This is the canonical "Select All" set: the same elements hitTestRect would return for a marquee covering the whole canvas, minus the rectangle filter. Non-geometry nodes (<defs>, gradients, plain containers, XML text nodes) are excluded, so it matches what marquee selection treats as selectable. Empty when there is no document.
|
|
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 |
| void | recordDocumentSourceUndoOnNextFlush (std::string label, svg::SVGElement anchorElement, std::string beforeSource) |
| | Defer a single document-source undo entry to the next flushFrame().
|
|
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.
|