|
|
Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
|
Renders the editor's tree view and inspector panes. More...
#include "donner/editor/SidebarPresenter.h"
Classes | |
| struct | IconTexture |
| Maps a static path-operation icon bitmap to an ImGui texture handle for display. The icon bitmaps are rendered from embedded Bootstrap SVG resources through Donner; ImGui only receives the final raster texture for the image button. More... | |
Public Types | |
| enum class | TransformField : std::uint8_t { PositionX , PositionY , Width , Height , Rotation , Matrix } |
| Which inspector transform widget owns the in-progress edit. More... | |
| using | IconTextureProvider |
Public Member Functions | |
| void | refreshSnapshot (const EditorApp &app) |
| Refresh the tree / inspector snapshot from live app state. Safe to call only when the async renderer is idle. | |
| void | renderTreeView (EditorApp *liveApp, TreeViewState &state, const IconTextureProvider &iconTextureProvider={}) const |
Render the tree pane from the current snapshot. When liveApp is non-null, click-induced selection mutations are applied to it; when null, clicks are dropped (the render is "read-only" because the worker thread owns the document). | |
| bool | renderInspector (EditorApp *liveApp, const ViewportState &viewport, const IconTextureProvider &iconTextureProvider={}) |
| Render the inspector pane from the current snapshot. | |
| bool | inspectorHasSelectionForTesting () const |
| bool | hasTreeSnapshotForTesting () const |
| bool | isTreeNodeExpandedForTesting (std::uint32_t entityId) const |
Whether the tree node for entityId is expanded. Keyed by the element's 32-bit entity id (entity cast). Drives the disclosure round-trip test. | |
| void | toggleTreeNodeExpandedForTesting (std::uint32_t entityId) |
Toggle the tree disclosure for entityId, exactly as clicking the row's chevron does. | |
| std::string_view | inspectorTitleForTesting () const |
| std::span< const std::pair< std::string, std::string > > | inspectorXmlAttributesForTesting () const |
| std::span< const std::pair< std::string, std::string > > | inspectorComputedStyleForTesting () const |
| std::span< const std::optional< ImU32 > > | inspectorComputedStyleSwatchesForTesting () const |
| const std::optional< Box2d > & | inspectorBoundsForTesting () const |
| const std::optional< Transform2d > & | inspectorTransformForTesting () const |
| std::optional< Box2d > | transformFieldRectForTesting (TransformField field) const |
| Last rendered screen rectangle for one decomposed Transform field. Matrix cells are excluded because they are indexed separately. | |
| void | beginTransformEditForTesting (EditorApp &app, TransformField field, int matrixIndex=0) |
Capture the edit baseline for field, as widget activation does. | |
| bool | hasTransformEditForTesting () const |
| Whether a transform edit is currently in progress. | |
| bool | applyTransformEditForTesting (EditorApp &app, double value) |
Write value into the active edit and queue the resulting mutation, as one frame of dragging does. Returns true if a mutation was queued. | |
| void | commitTransformEditForTesting (EditorApp &app) |
| Finalize the active edit into one undo entry, as widget deactivation does. | |
Renders the editor's tree view and inspector panes.
The panes are always rendered from an internal snapshot so they stay visible even while the async renderer is mutating the document (the "(rendering...)" placeholder used to cover this gap, which made the panes flash to a disabled message on every render). The snapshot is refreshed from the live EditorApp when the caller indicates the worker thread isn't touching the document; otherwise the most recent capture is replayed unchanged. Click handling is gated the same way so mutations can't race the worker.
| struct donner::editor::SidebarPresenter::IconTexture |
Maps a static path-operation icon bitmap to an ImGui texture handle for display. The icon bitmaps are rendered from embedded Bootstrap SVG resources through Donner; ImGui only receives the final raster texture for the image button.
| stableId | Stable id of the static icon resource being uploaded. |
| bitmap | The Donner-rendered RGBA icon bitmap. |
| Class Members | ||
|---|---|---|
| ImTextureID | texture = 0 | ImGui texture handle. |
| Vector2d | uvBottomRight = Vector2d(1.0, 1.0) | Bottom-right valid payload UV. |
| using donner::editor::SidebarPresenter::IconTextureProvider |
|
strong |
Which inspector transform widget owns the in-progress edit.
| bool donner::editor::SidebarPresenter::renderInspector | ( | EditorApp * | liveApp, |
| const ViewportState & | viewport, | ||
| const IconTextureProvider & | iconTextureProvider = {} ) |
Render the inspector pane from the current snapshot.
| liveApp | Live editor app for button actions, or null while the renderer owns the document. |
| viewport | Viewport state diagnostics. |
| iconTextureProvider | Uploads static Donner-rendered path operation icon bitmaps to ImGui textures for display, or null to keep blank hit areas in headless tests. |
| void donner::editor::SidebarPresenter::renderTreeView | ( | EditorApp * | liveApp, |
| TreeViewState & | state, | ||
| const IconTextureProvider & | iconTextureProvider = {} ) const |
Render the tree pane from the current snapshot. When liveApp is non-null, click-induced selection mutations are applied to it; when null, clicks are dropped (the render is "read-only" because the worker thread owns the document).
| iconTextureProvider | Uploads the shared disclosure-chevron mask to an ImGui texture; pass null (e.g. headless tests) to skip chevron art while keeping the disclosure interaction. |