Skip to main content

Module editor

Module editor 

Source

Structs§

ClosureBridge
Adapter that implements EditorBridge over per-method closures.
PluginContext
Context passed to Editor::open. Carries:
ResizeCorrector
Enforces size constraints on host resizes that bypassed the format’s negotiation hooks. Some hosts resize the plugin’s embedded window directly at the windowing-system level (Bitwig on Linux/X11 resizes the embed window itself), so no checkSizeConstraint-style preflight ever runs - the editor’s own Resized handler is the last place that can enforce min_size / max_size / aspect_ratio.
SendPtr
A raw pointer wrapper that is Send + Sync.

Enums§

RawWindowHandle
Raw platform window handle for GUI parenting.

Traits§

Editor
Plugin GUI editor.
EditorBridge
Bridge between the editor and the host / plugin. Format wrappers (CLAP / VST3 / VST2 / AU / AAX / LV2) implement this trait - or build a ClosureBridge from per-method closures - and pass an Arc<dyn EditorBridge> to the editor through PluginContext.
IntoEditor
Fluent terminal for editor() impls: box any concrete editor into the Box<dyn Editor> the trait returns, dropping the Box::new(…) wrapper.
PluginContextReadF32
f32-precision parameter reads on PluginContext. Brought into scope by truce::prelude / truce::prelude32 / truce::prelude64m (the f32-buffer preludes). GUI binding crates (slint, egui, iced) take f32 natively, so this is the common case.
PluginContextReadF64
f64-precision parameter reads on PluginContext. Brought into scope by truce::prelude64. Same surface as PluginContextReadF32 but returns the bridge’s f64 value directly without narrowing.

Functions§

clamp_logical_size
Clamp a host-committed size to the editor’s [min, max] bounds only, leaving the aspect ratio untouched so the editor fills the host window exactly. The commit-time counterpart to fit_logical_size: on-ratio shaping already happened during the host’s drag negotiation (a preflight such as VST3 checkSizeConstraint), so re-fitting onto the ratio here would only floor the editor a pixel under the window and leave an unpainted letterbox line. The max clamp keeps the surface inside the window; the min clamp upholds the editor’s “can’t render smaller than this” floor even when a host hands over a too-small box.
fit_logical_size
Constrain a host-requested logical size to an editor’s Editor::min_size / Editor::max_size / Editor::aspect_ratio. Shared by every format wrapper so they enforce identical constraints.
fit_size
Same fit as fit_logical_size but over raw constraints rather than an &dyn Editor. Lets call sites that have already captured the bounds (e.g. an Objective-C resize callback that can’t carry a trait object) reuse the identical rule.
for_test_params
Build a PluginContext backed only by params. All write closures are no-ops; reads delegate to the params Arc; the transport reports the deterministic crate::events::TransportInfo::for_screenshot state so screenshot tests stay reproducible across CI runs.