Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::DesignFrameElement Struct Reference

#include <design_frame_view.hpp>

Public Types

enum class  Kind {
  knob , fader , toggle , text_field ,
  dropdown , tab_group , stepper , momentary ,
  swap , action , value_label , xy_pad ,
  custom
}

Public Attributes

Kind kind = Kind::knob
float cx = 0.0f
 pivot / hit center, SVG coords
float cy = 0.0f
float hit_radius = 0.0f
 click-target radius, SVG coords
std::string needle_d
float value = 0.5f
 0..1 (xy_pad: the X axis)
float value_y = 0.5f
 0..1 (xy_pad: the Y axis, 0=top)
bool flash = false
 toggle only: press-flash command button (sample next/prev/random, dice).
bool enabled = true
 When false, the element is bypassed/disabled: hit-testing skips it (it cannot be hovered, dragged, clicked, or gesture) and a subclass/painter may dim it (see DesignFrameView::element_enabled).
float x = 0.0f
float y = 0.0f
float w = 0.0f
float h = 0.0f
 element rect, SVG coords
std::string placeholder
 text_field
std::vector< std::string > options
 dropdown options / tab labels
int selected_index = 0
 dropdown / tab selection
std::string bg_color
 text_field: the design's own field background ("#RRGGBB").
int note = -1
 Raw parsed number: typing keys = relative semitone (0–15), piano keys = absolute MIDI note.
int view_group = -1
 View scope for per-view keyboards (e.g.
int target_frame = -1
 For Kind::swap: the frame index to activate when this button is clicked (the swap link target).
std::string action
 For Kind::action: the action id fired (on_action) when clicked, e.g.
std::string text
 For Kind::value_label: the live display string painted over the rect (right-aligned to match the design's baked readouts).
bool value_left_align = false
 value_label: left-align the text in the rect instead of right-aligning.
std::string factory_id
 For Kind::custom: the id the overlay factory is registered under (register_design_control_factory).
std::string custom_props
 For Kind::custom: opaque props handed to the factory (typically a JSON string the factory parses).
std::string source_node_id
 Source node id this overlay came from (e.g.
std::string param_key
 Optional host-parameter binding id for this control.
std::string display_text
 Host-formatted readout for param_key, cached by sync_from_host_params() once per tick so paint() can read it without re-entering the host.
bool display_text_bound = false
 Whether display_text came from a host parameter at the last sync, as opposed to being empty because nothing resolved.

Member Enumeration Documentation

◆ Kind

Enumerator
knob 
fader 
toggle 
text_field 
dropdown 
tab_group 
stepper 
momentary 
swap 
action 
value_label 
xy_pad 
custom 

Member Data Documentation

◆ action

std::string pulp::view::DesignFrameElement::action

For Kind::action: the action id fired (on_action) when clicked, e.g.

"octave_up". Empty = unset. Uses the x/y/w/h rect as the hit-region.

◆ bg_color

std::string pulp::view::DesignFrameElement::bg_color

text_field: the design's own field background ("#RRGGBB").

When set, the overlay paints this exact color so it blends seamlessly with the baked box (the overlay is inset past the leading icon, which stays visible). Empty → the default dark field color.

◆ custom_props

std::string pulp::view::DesignFrameElement::custom_props

For Kind::custom: opaque props handed to the factory (typically a JSON string the factory parses).

Pulp does not interpret these.

◆ cx

float pulp::view::DesignFrameElement::cx = 0.0f

pivot / hit center, SVG coords

◆ cy

float pulp::view::DesignFrameElement::cy = 0.0f

◆ display_text

std::string pulp::view::DesignFrameElement::display_text

Host-formatted readout for param_key, cached by sync_from_host_params() once per tick so paint() can read it without re-entering the host.

Empty and display_text_bound == false when the element carries no param_key, when no HostParamSurface resolves it, or before the first sync. Read it via element_display_text() / element_has_display_text() rather than directly — those bound the index and carry the contract.

Purely a HOST CACHE, with no authored counterpart — which is what makes it behave differently from value and text when the host goes away. Those two have an authored value in the frame's own element set, so a frame swap restores something meaningful ("degrade to local state"). This has none: the frames_ copy never carries display text, so a swap installs elements that have simply never been synced, and their readout is empty until the next sync against a live surface — the same state as before the first sync. That reads as UNBOUND (display_text_bound == false), so a painter gated on element_has_display_text() draws nothing rather than a stale value from the frame it just left.

Distinct from text, which is the value_label's own painted readout and is author-owned (set_element_text): an element may carry a caller-set text AND a host-formatted display_text without either clobbering the other.

◆ display_text_bound

bool pulp::view::DesignFrameElement::display_text_bound = false

Whether display_text came from a host parameter at the last sync, as opposed to being empty because nothing resolved.

Distinguishes "the host formats this as an empty string" from "no host parameter here".

◆ enabled

bool pulp::view::DesignFrameElement::enabled = true

When false, the element is bypassed/disabled: hit-testing skips it (it cannot be hovered, dragged, clicked, or gesture) and a subclass/painter may dim it (see DesignFrameView::element_enabled).

Defaults enabled.

◆ factory_id

std::string pulp::view::DesignFrameElement::factory_id

For Kind::custom: the id the overlay factory is registered under (register_design_control_factory).

Empty/unregistered → inert render.

◆ flash

bool pulp::view::DesignFrameElement::flash = false

toggle only: press-flash command button (sample next/prev/random, dice).

Lights with the tint on press and clears on release, instead of the default sticky on/off flip — the right feel for a momentary command.

◆ h

float pulp::view::DesignFrameElement::h = 0.0f

element rect, SVG coords

◆ hit_radius

float pulp::view::DesignFrameElement::hit_radius = 0.0f

click-target radius, SVG coords

◆ kind

Kind pulp::view::DesignFrameElement::kind = Kind::knob

◆ needle_d

std::string pulp::view::DesignFrameElement::needle_d

◆ note

int pulp::view::DesignFrameElement::note = -1

Raw parsed number: typing keys = relative semitone (0–15), piano keys = absolute MIDI note.

-1 = unset. Consumers map by this, NOT positional index (a re-export may reorder elements). Uses the x/y/w/h rect as the hit-region. value doubles as the pressed/lit flag (0 or 1).

◆ options

std::vector<std::string> pulp::view::DesignFrameElement::options

dropdown options / tab labels

◆ param_key

std::string pulp::view::DesignFrameElement::param_key

Optional host-parameter binding id for this control.

When non-empty, a foreign-host binder (e.g. the embed shim's string-key↔host bridge) maps this element to the host parameter named by this key: it forwards the element's on_element_changed / gesture begin+end to the host, and routes host→UI pushes back by matching the key. Vendor-neutral — just an opaque id the consumer resolves against its own parameter system (a host param id, a CLAP param key, an AU parameter address, etc.); Pulp does not interpret it. A hand-built (non-imported) view sets this per control to declare its binding; an imported view may leave it empty and let the binder fall back to source_node_id. Empty = this element is not bound to a host parameter.

◆ placeholder

std::string pulp::view::DesignFrameElement::placeholder

text_field

◆ selected_index

int pulp::view::DesignFrameElement::selected_index = 0

dropdown / tab selection

◆ source_node_id

std::string pulp::view::DesignFrameElement::source_node_id

Source node id this overlay came from (e.g.

a Figma node id like "1273:33424"), copied from the IR's IRInteractiveElement during materialization. Empty when the element wasn't lowered from a design import. Lets a tool (the inspector's Wiring lens) map a live control back to its design node — to flag "not wired up" and fetch that exact frame.

◆ target_frame

int pulp::view::DesignFrameElement::target_frame = -1

For Kind::swap: the frame index to activate when this button is clicked (the swap link target).

-1 = unset.

◆ text

std::string pulp::view::DesignFrameElement::text

For Kind::value_label: the live display string painted over the rect (right-aligned to match the design's baked readouts).

Updated via set_element_text.

◆ value

float pulp::view::DesignFrameElement::value = 0.5f

0..1 (xy_pad: the X axis)

◆ value_left_align

bool pulp::view::DesignFrameElement::value_left_align = false

value_label: left-align the text in the rect instead of right-aligning.

Use for a readout that follows a fixed label (e.g. "PITCH BEND <value>") where a variable-width value must grow rightward into empty space, not leftward over the label.

◆ value_y

float pulp::view::DesignFrameElement::value_y = 0.5f

0..1 (xy_pad: the Y axis, 0=top)

◆ view_group

int pulp::view::DesignFrameElement::view_group = -1

View scope for per-view keyboards (e.g.

typing vs piano). hit_element only tests momentary elements in the active view group (see set_active_view_group). -1 = always active (ungrouped).

◆ w

float pulp::view::DesignFrameElement::w = 0.0f

◆ x

float pulp::view::DesignFrameElement::x = 0.0f

◆ y

float pulp::view::DesignFrameElement::y = 0.0f

The documentation for this struct was generated from the following file: