|
| std::vector< FormatBarFontFamily > | donner::editor::BuildFormatBarFamilies (const std::vector< svg::FontFamilyInfo > &catalogFamilies, const std::function< FormatBarFontPreview(const svg::FontFamilyInfo &)> &previewForFamily) |
| | Build the picker's family list from a catalog listing.
|
| bool | donner::editor::FormatBarShouldShow (bool hasSingleTextSelection, bool textEditingActive) |
| | Whether the format bar should be shown, given the styling context.
|
|
void | donner::editor::ReadTextFormatState (const svg::SVGElement &text, FormatBarState *state) |
| | Populate the font fields (fontFamily, fontSize, hasFontSize, bold, italic, underline) of state from the computed style of a single selected/edited <text> element, so inherited, CSS and relative values show what the text renders with. Computing the style can need document write access, so the caller must not hold a document read scope. Leaves visible, families, and boldToggleFont untouched (owned by the shell).
|
|
void | donner::editor::ReadTextFormatState (const svg::PropertyRegistry &style, FormatBarState *state) |
| | Populate the same fields from an already computed style, for callers that hold only a document read scope (see svg::SVGElement::computedStyleIfPresent).
|
| bool | donner::editor::ApplyFormatBarActionsToSelection (const FormatBarActions &actions, const FormatBarState &state, bool routeTogglesToSelection, EditorApp &app) |
| | Route the attribute-write half of the bar's actions onto the app's current selection (the TextInspectorPanel seam): font family, font size, and - when routeTogglesToSelection is true - the B/I/U toggles. During an editing session the shell handles B/I/U through TextTool instead and passes routeTogglesToSelection=false, so this only writes family/size.
|
TextFormatBarPresenter renders a contextual floating text-formatting bar below the canvas tool palette. The bar is shown only while text styling is in context: when the canvas selection is a single <text> element or an in-canvas text editing session is active. It offers a searchable font-family picker (each known family previewed in its own face, with a free-text fallback for families the editor lacks), an editable font-size control with attached steps and a focus-opened preset list, and Bold/Italic/Underline toggles.
Following the MenuBarPresenter pattern, the presenter is a thin, testable surface: render() draws the imgui controls and returns edge-triggered FormatBarActions, which the shell routes to the existing styling commands. B/I/U during an editing session go through the TextTool style toggles; family, size, and the selection-only B/I/U path go through the TextInspectorPanel attribute-write seam (setAttributeOnSelection). This bar is a second surface over those commands, not a new styling pipeline.
Route the attribute-write half of the bar's actions onto the app's current selection (the TextInspectorPanel seam): font family, font size, and - when routeTogglesToSelection is true - the B/I/U toggles. During an editing session the shell handles B/I/U through TextTool instead and passes routeTogglesToSelection=false, so this only writes family/size.
Toggle-off writes the "normal"/"none" value (rather than removing the attribute) to stay on the pure attribute-write path; the value that flips is derived from state's current B/I/U flags.
- Returns
- true if any document mutation was queued.
| bool donner::editor::FormatBarShouldShow |
( |
bool | hasSingleTextSelection, |
|
|
bool | textEditingActive ) |
|
nodiscard |
Whether the format bar should be shown, given the styling context.
The bar is contextual: it appears while the selection is a single <text> element, or while an in-canvas text editing session is active (which also makes that element the selection, but the session predicate is kept explicit so the bar stays up through selection churn during editing).
- Parameters
-
| hasSingleTextSelection | True when exactly one <text> is selected. |
| textEditingActive | True when an in-canvas text session owns the caret. |