#include <optional>#include <ostream>#include <span>#include <string>#include <string_view>#include <utility>#include <vector>#include "donner/base/Box.h"#include "donner/base/Transform.h"#include "donner/css/Color.h"#include "donner/editor/CanvasScrollbars.h"#include "donner/editor/EditorApp.h"#include "donner/editor/FocusView.h"#include "donner/editor/FrameMissTelemetry.h"#include "donner/editor/GlTextureCache.h"#include "donner/editor/ImGuiIncludes.h"#include "donner/editor/PenTool.h"#include "donner/editor/RotateCursorSet.h"#include "donner/editor/SelectionTransformHandles.h"#include "donner/editor/SourceSelection.h"#include "donner/editor/ViewportInteractionController.h"#include "donner/svg/SVGDocument.h"#include "donner/svg/SVGElement.h"#include "donner/svg/properties/PaintServer.h"Classes | |
| struct | donner::editor::internal::ToolbarPaintReferenceState |
| Source range for a referenced paint server shown by the toolbar. More... | |
| struct | donner::editor::internal::ToolbarPaintSlotState |
| Paint slot presentation state for the fill/stroke toolbar. More... | |
| struct | donner::editor::internal::ToolbarPaintState |
| Fill and stroke toolbar paint state. More... | |
| struct | donner::editor::internal::DocumentLoadFailureNotice |
| Copy for the canvas notice shown when an opened document could not be loaded. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Enumerations | |
| enum class | donner::editor::internal::PendingClickBusyAction { RunIdleClickPath , CompleteFastRedrag , CancelBusyRender } |
| High-level action for a buffered canvas click before the idle-only hit-test path. | |
| enum class | donner::editor::internal::PendingClickIdleAction { DispatchSlowPath , BeginMarquee , WaitForMarqueeIntent } |
| High-level action for a buffered click once the renderer is idle. | |
| enum class | donner::editor::internal::DeferredRenderAction { ClearRequest , WakeForPenDrag , SubmitRender , WaitForRendererCompletion } |
| End-of-frame action for a deferred document render. | |
Functions | |
| FrameMemorySample | donner::editor::internal::MemorySampleFromPresentationResources (const PresentationResourceStats &resources) |
| Copy presentation resource counters into a frame-history sample. | |
| FrameMissResourceTelemetry | donner::editor::internal::FrameMissTelemetryFromPresentationResources (const PresentationResourceStats &resources) |
| Copy presentation resource counters into frame-miss telemetry. | |
| ImGuiMouseCursor | donner::editor::internal::CursorForTransformHandleIntent (const SelectionTransformHandleIntent &intent) |
| Select the ImGui cursor for a transform-handle hit. | |
| PenCursorHint | donner::editor::internal::PenCursorHintForIntent (PenHoverIntent intent) |
Pen nib variant to show for intent. | |
| bool | donner::editor::internal::ContainsScreenPoint (const Box2d &rect, const ImVec2 &point) |
| Test inclusive containment in a screen-space rectangle. | |
| std::optional< Box2d > | donner::editor::internal::TextFormatBarScreenRect (const ImVec2 &paneOrigin, const ImVec2 &contentRegion, const Box2d &toolPaletteRect, bool visible, float barHeight) |
| Place the format bar below the tool palette, or return no rectangle when hidden or empty. | |
| bool | donner::editor::internal::CanvasChromeCapturesInput (const ImVec2 &point, const std::optional< Box2d > &referenceChipRect, const Box2d &toolPaletteRect, const std::optional< Box2d > &textFormatBarRect, const std::optional< Box2d > &editingScopeBreadcrumbRect, const Box2d &canvasZoomControlRect, const std::optional< Box2d > &compactPanelRect=std::nullopt) |
| Test whether a pointer lies in any visible canvas chrome control. | |
| bool | donner::editor::internal::CanvasScrollbarsCaptureInput (bool scrollbarsVisible, const ViewportState &viewport, const Vector2d &screenPoint) noexcept |
| Test whether visible canvas scrollbars capture a screen-space pointer. | |
| bool | donner::editor::internal::GroupOperationCanDispatch (bool rendererBusy, const GroupOperationAvailability &availability) noexcept |
| Permit a group command only when the renderer is idle and the operation is available. | |
| bool | donner::editor::internal::PendingDocumentReplacementCanProcess (bool hasPendingRequest, bool documentWriteAvailable, bool hasPendingMutations) noexcept |
| Permit a queued replacement only when document writes are available and mutations are drained. | |
| bool | donner::editor::internal::ShouldRefreshSidebarSnapshots (bool rendererBusy, bool interactionActive, bool previewsPaused) noexcept |
| Refresh sidebar captures only while both rendering and interaction are idle. | |
| bool | donner::editor::internal::SidebarSnapshotRefreshPendingAfterPass (std::size_t deferredThumbnailCount) noexcept |
| Report whether deferred thumbnails require another snapshot refresh. | |
| template<typename Resolver> | |
| bool | donner::editor::internal::ResolveCachedDocumentBoolForFrame (bool rendererBusy, bool cachedValue, Resolver &&resolveWhenIdle) |
| Resolve a document-derived UI boolean without ever entering the live document while the renderer owns it. Busy frames replay the value from the last complete UI epoch. | |
| bool | donner::editor::internal::SamplePickerActionsNeedFollowupFrame (bool dismiss, bool openFile, bool newDocument) noexcept |
| Request another frame when the picker dismisses, opens a file, or creates a document. | |
| bool | donner::editor::internal::ShouldAdvanceSampleThumbnails (bool showSamplePicker, bool samplePresentationPending) noexcept |
| Background carousel work yields while a selected sample owns the next document render. | |
| DeferredRenderAction | donner::editor::internal::DeferredRenderActionForState (bool hasDocument, bool penDragFlushed, bool rendererBusy) noexcept |
| Choose how to advance a deferred render request from the current document and worker state. | |
| PendingClickBusyAction | donner::editor::internal::PendingClickBusyActionForState (bool tookFastRedrag, bool documentWriteUnavailable) |
| Choose the buffered-click action while the renderer owns the document. | |
| PendingClickIdleAction | donner::editor::internal::PendingClickIdleActionForState (bool leftMouseDown, bool pendingClickCanStartMarquee, bool selectHoldElapsed, bool selectDragIntent) |
| Choose the buffered-click action after the renderer releases the document. | |
| DocumentLoadFailureNotice | donner::editor::internal::DocumentLoadFailureNoticeFor (std::string_view reason, std::optional< std::size_t > line) |
| Explain a fatal parse diagnostic for the canvas notice. | |
| std::string_view | donner::editor::internal::TextToolHintLabel (bool isEditing, bool isDraggingBox, bool touchPreferred=false) |
| Discoverability hint for the idle text tool ("double-click places point
text, drag draws a box"). Empty while a session or box drag is active - the hint only shows when the next click/drag would act on empty canvas. | |
| css::RGBA | donner::editor::internal::PaintServerFallbackColor () |
| Return the neutral toolbar color used for paint that lacks a solid-color preview. | |
| ToolbarPaintSlotState | donner::editor::internal::ToolbarPaintSlotStateForActiveAttribute (std::string_view value) |
| Build a toolbar swatch from an authored paint value, retaining custom values as labels. | |
| ToolbarPaintReferenceState | donner::editor::internal::ToolbarPaintReferenceStateFor (svg::SVGDocument *document, std::optional< std::string_view > source, const svg::Reference &reference) |
| Capture a paint reference and its available source location for the toolbar. | |
| ToolbarPaintSlotState | donner::editor::internal::ToolbarPaintSlotStateForPaintServer (const svg::PaintServer &paint, const css::RGBA ¤tColor, svg::SVGDocument *document, std::optional< std::string_view > source) |
| Build a toolbar swatch and reference metadata from resolved paint. | |
| ToolbarPaintState | donner::editor::internal::ToolbarPaintStateForActivePaint (const ActivePaintStyle &paintStyle) |
| Build fill and stroke toolbar presentation from the active paint style. | |
| std::string | donner::editor::internal::PaintChipLabel (std::string_view prefix, const ToolbarPaintSlotState &state) |
| Format the label of a toolbar paint chip. | |
| std::string | donner::editor::internal::SelectionSizeChipLabel (const Box2d &screenBounds) |
| Format the selection bounds width and height for a toolbar chip. | |
| std::string | donner::editor::internal::SelectionPositionChipLabel (const Box2d &documentBounds) |
| Format the document-space selection position for a toolbar chip. | |
| std::string | donner::editor::internal::SelectionAngleChipLabel (const Transform2d &documentFromStartDocument) |
| Format the rotation represented by a selection transform. | |
| Box2d | donner::editor::internal::TransformDocumentBox (const Box2d &box, const Transform2d &documentFromBoundsDocument) |
| Transform every box corner and return their axis-aligned document-space bounds. | |
| bool | donner::editor::internal::DeferSourceFocusWhileAwaitingEdits (TextEditor &textEditor, bool focusEnabled) |
| Preserve enabled source focus while document edits await source-pane writeback. Disabled focus clears the view-only partition immediately. | |
| float | donner::editor::internal::ClampSourcePaneWidthForWindow (float requestedWidth, float windowWidth) |
| Clamp a requested source-pane width to the usable window range. | |
| std::string | donner::editor::internal::ReferenceHighlightChipLabel (const ReferenceHighlightSummary &summary) |
| Format the toolbar label for the current reference-highlight summary. | |
| void | donner::editor::internal::AddUniqueElements (std::vector< svg::SVGElement > *target, std::span< const svg::SVGElement > elements) |
| Append elements not already present in a destination list. | |
| bool | donner::editor::internal::ContainsElement (std::span< const svg::SVGElement > elements, const svg::SVGElement &element) |
| Test whether an element handle is present in a list. | |
| std::string | donner::editor::internal::ElementContextMenuLabel (const svg::SVGElement &element) |
| Build the display label for an element in the context menu. | |
| std::string | donner::editor::internal::InitialDocumentSyncSource (const ::donner::editor::EditorShellOptions &options) |
| Use host-provided initial source, otherwise load the requested file or return empty text. | |
| std::string | donner::editor::internal::CanonicalizeForTextEditor (std::string_view source) |
| Remove one final newline to match the text editor source representation. | |
| Box2d | donner::editor::internal::ResolveDocumentViewBox (svg::SVGDocument &document) |
| Resolve the authored viewBox, intrinsic dimensions, canvas size, or unit-box fallback under read access. | |
| std::optional< Box2d > | donner::editor::internal::ResolveDocumentViewBoxForFrame (svg::SVGDocument &document, bool rendererBusy) |
| Return no update while rendering is busy; otherwise resolve the document viewBox. | |
| void donner::editor::internal::AddUniqueElements | ( | std::vector< svg::SVGElement > * | target, |
| std::span< const svg::SVGElement > | elements ) |
Append elements not already present in a destination list.
| target | Non-null destination list to update. |
| elements | Elements to append without duplicates. |
|
nodiscard |
Remove one final newline to match the text editor source representation.
| source | Source text to copy and normalize. |
|
nodiscard |
Test whether a pointer lies in any visible canvas chrome control.
| point | Pointer position in logical screen pixels. |
| referenceChipRect | Optional reference-chip bounds. |
| toolPaletteRect | Tool-palette bounds. |
| textFormatBarRect | Optional text-format bar bounds. |
| editingScopeBreadcrumbRect | Optional editing-scope breadcrumb bounds. |
| canvasZoomControlRect | Zoom-control bounds. |
| compactPanelRect | Optional compact-panel bounds. |
|
nodiscardnoexcept |
Test whether visible canvas scrollbars capture a screen-space pointer.
| scrollbarsVisible | Whether scrollbars are currently shown. |
| viewport | Viewport used to compute scrollbar geometry. |
| screenPoint | Pointer position in logical screen pixels. |
|
nodiscard |
Clamp a requested source-pane width to the usable window range.
| requestedWidth | Requested width in logical pixels. |
| windowWidth | Available window width in logical pixels. |
|
nodiscard |
Test whether an element handle is present in a list.
| elements | Handles to search. |
| element | Handle to find. |
|
nodiscard |
Test inclusive containment in a screen-space rectangle.
| rect | Rectangle in logical screen pixels. |
| point | Point in the same coordinate system. |
|
nodiscard |
Select the ImGui cursor for a transform-handle hit.
| intent | Transform action and corner under the pointer. |
|
nodiscardnoexcept |
Choose how to advance a deferred render request from the current document and worker state.
| hasDocument | Whether a document is loaded. |
| penDragFlushed | Whether this pass applied a pending pen drag. |
| rendererBusy | Whether the render worker is busy. |
|
nodiscard |
Preserve enabled source focus while document edits await source-pane writeback. Disabled focus clears the view-only partition immediately.
| textEditor | Source pane whose focus partition may be cleared. |
| focusEnabled | Whether selected-element source focus is enabled. |
|
nodiscard |
Explain a fatal parse diagnostic for the canvas notice.
| reason | Parser diagnostic text. |
| line | One-based source line of the problem, when known. |
|
nodiscard |
Build the display label for an element in the context menu.
| element | Element whose tag and identity are displayed. |
|
nodiscard |
Copy presentation resource counters into frame-miss telemetry.
| resources | Current presentation resource accounting. |
|
nodiscardnoexcept |
Permit a group command only when the renderer is idle and the operation is available.
| rendererBusy | Whether the worker currently owns the document. |
| availability | Precomputed availability of the requested group operation. |
|
nodiscard |
Use host-provided initial source, otherwise load the requested file or return empty text.
| options | Initial document source and path options. |
|
nodiscard |
Copy presentation resource counters into a frame-history sample.
| resources | Current presentation resource accounting. |
|
nodiscard |
Format the label of a toolbar paint chip.
| prefix | Role label, such as fill or stroke. |
| state | Paint-slot presentation to describe. |
|
nodiscard |
Pen nib variant to show for intent.
PenHoverIntent::DragAnchor has no nib: grabbing an existing anchor is not a nib gesture, so the shell shows the anchor-point cursor for it and this returns the plain nib as an inert default.
| intent | What a pen-tool click under the pointer would do. |
|
nodiscard |
Choose the buffered-click action while the renderer owns the document.
| tookFastRedrag | Whether the cached presentation accepted a fast redrag. |
| documentWriteUnavailable | Whether live document mutation is unavailable. |
|
nodiscard |
Choose the buffered-click action after the renderer releases the document.
| leftMouseDown | Whether the initiating mouse button remains held. |
| pendingClickCanStartMarquee | Whether the buffered click may start a marquee. |
| selectHoldElapsed | Whether the selection hold interval elapsed. |
| selectDragIntent | Whether pointer movement establishes a selection drag. |
|
nodiscardnoexcept |
Permit a queued replacement only when document writes are available and mutations are drained.
| hasPendingRequest | Whether a replacement is queued. |
| documentWriteAvailable | Whether the caller can write the document now. |
| hasPendingMutations | Whether earlier mutations still need processing. |
|
nodiscard |
Format the toolbar label for the current reference-highlight summary.
| summary | Reference counts and highlight state. |
|
nodiscard |
Resolve the authored viewBox, intrinsic dimensions, canvas size, or unit-box fallback under read access.
| document | Document whose root geometry is inspected. |
|
nodiscard |
Return no update while rendering is busy; otherwise resolve the document viewBox.
| document | Document whose root geometry is inspected while idle. |
| rendererBusy | Whether the worker currently owns the document. |
|
nodiscardnoexcept |
Request another frame when the picker dismisses, opens a file, or creates a document.
| dismiss | Whether the picker was dismissed. |
| openFile | Whether file opening was requested. |
| newDocument | Whether a new document was requested. |
|
nodiscard |
Format the rotation represented by a selection transform.
| documentFromStartDocument | Transform from gesture-start document coordinates to current coordinates. |
|
nodiscard |
Format the document-space selection position for a toolbar chip.
| documentBounds | Selection bounds in document coordinates. |
|
nodiscard |
Format the selection bounds width and height for a toolbar chip.
| screenBounds | Bounds whose dimensions are displayed. |
|
nodiscardnoexcept |
Refresh sidebar captures only while both rendering and interaction are idle.
| rendererBusy | Whether the renderer owns the document. |
| interactionActive | Whether an interaction is in progress. |
| previewsPaused | Whether animation playback or its reset suspends auxiliary work. |
|
nodiscardnoexcept |
Report whether deferred thumbnails require another snapshot refresh.
| deferredThumbnailCount | Number of thumbnails left pending by this pass. |
|
nodiscard |
Place the format bar below the tool palette, or return no rectangle when hidden or empty.
| paneOrigin | Render-pane origin in logical screen pixels. |
| contentRegion | Available pane size in logical pixels. |
| toolPaletteRect | Screen-space toolbar bounds used to align the format bar. |
| visible | Whether the format bar is requested. |
| barHeight | Requested height in logical pixels. |
|
nodiscard |
Capture a paint reference and its available source location for the toolbar.
| document | Document used to resolve local references, or null. |
| source | Synchronized source text when available. |
| reference | Authored paint-server reference. |
|
nodiscard |
Build a toolbar swatch from an authored paint value, retaining custom values as labels.
| value | Authored fill or stroke value. |
|
nodiscard |
Build a toolbar swatch and reference metadata from resolved paint.
| paint | Paint server to display. |
| currentColor | Color used to resolve currentColor paint. |
| document | Document used to inspect local references, or null. |
| source | Synchronized source text when available. |
|
nodiscard |
Build fill and stroke toolbar presentation from the active paint style.
| paintStyle | Active fill and stroke values. |
|
nodiscard |
Transform every box corner and return their axis-aligned document-space bounds.
| box | Bounds in the source coordinate system. |
| documentFromBoundsDocument | Transform into destination document coordinates. |