Vital
Loading...
Searching...
No Matches
ModulationExpansionBox Class Reference

A popup box that displays multiple ModulationAmountKnob controls in a grid. More...

#include <modulation_manager.h>

Inheritance diagram for ModulationExpansionBox:
OpenGlQuad OpenGlMultiQuad OpenGlComponent

Classes

class  Listener
 Interface for objects interested in focus changes of the ModulationExpansionBox. More...
 

Public Member Functions

 ModulationExpansionBox ()
 
void focusLost (FocusChangeType cause) override
 
void setAmountControls (std::vector< ModulationAmountKnob * > amount_controls)
 Sets the amount controls displayed inside this expansion box.
 
void addListener (Listener *listener)
 Adds a Listener for expansion box focus events.
 
- Public Member Functions inherited from OpenGlQuad
 OpenGlQuad (Shaders::FragmentShader shader)
 Constructs a single quad with a given fragment shader.
 
- Public Member Functions inherited from OpenGlMultiQuad
 OpenGlMultiQuad (int max_quads, Shaders::FragmentShader shader=Shaders::kColorFragment)
 Constructs an OpenGlMultiQuad with a given maximum number of quads.
 
virtual ~OpenGlMultiQuad ()
 Destructor. Frees any allocated OpenGL resources.
 
virtual void init (OpenGlWrapper &open_gl) override
 Initializes OpenGL buffers and shader attributes.
 
virtual void render (OpenGlWrapper &open_gl, bool animate) override
 Renders the quads using OpenGL.
 
virtual void destroy (OpenGlWrapper &open_gl) override
 Releases OpenGL resources when the component is destroyed.
 
void paintBackground (Graphics &g) override
 Suppresses background painting; rendering is handled by OpenGL.
 
void resized () override
 Called when the component is resized. Marks data as dirty to recalculate positions if needed.
 
void markDirty ()
 Marks all vertex data as dirty, prompting a refresh on the next render.
 
void setFragmentShader (Shaders::FragmentShader shader)
 Sets the fragment shader used to render the quads.
 
void setNumQuads (int num_quads)
 Sets how many quads will actually be drawn (up to max_quads).
 
force_inline void setColor (Colour color)
 Sets the base color for the quads.
 
force_inline Colour getColor ()
 Gets the current base color.
 
force_inline void setAltColor (Colour color)
 Sets an alternate color, often used by custom shaders.
 
force_inline void setModColor (Colour color)
 Sets a modulation color for custom effects in the shader.
 
force_inline void setThumbColor (Colour color)
 Sets a "thumb" color, potentially for scroll bars or similar widgets.
 
force_inline void setThumbAmount (float amount)
 Sets the amount of thumb exposure (used in certain shader effects).
 
force_inline void setStartPos (float pos)
 Sets a starting position used by some shaders (e.g., arc start).
 
force_inline void setMaxArc (float max_arc)
 Sets the maximum arc angle or similar parameter used by some shaders.
 
force_inline float getMaxArc ()
 Gets the current maximum arc value.
 
force_inline float getQuadX (int i) const
 Gets the x-position of a specified quad.
 
force_inline float getQuadY (int i) const
 Gets the y-position of a specified quad.
 
force_inline float getQuadWidth (int i) const
 Gets the width of the specified quad.
 
force_inline float getQuadHeight (int i) const
 Gets the height of the specified quad.
 
float * getVerticesData (int i)
 Gets a pointer to the vertex data for a given quad.
 
void setRotatedCoordinates (int i, float x, float y, float w, float h)
 Sets rotated coordinates for a quad, adjusting its texture mapping.
 
void setCoordinates (int i, float x, float y, float w, float h)
 Sets coordinates for a quad in normalized device space.
 
void setShaderValue (int i, float shader_value, int value_index=0)
 Sets a shader value for all four vertices of a quad.
 
void setDimensions (int i, float quad_width, float quad_height, float full_width, float full_height)
 Sets dimensions for a quad, typically to scale based on component size.
 
void setQuadHorizontal (int i, float x, float w)
 Sets horizontal position and width for a quad.
 
void setQuadVertical (int i, float y, float h)
 Sets vertical position and height for a quad.
 
void setQuad (int i, float x, float y, float w, float h)
 Sets the position and size of a quad in normalized device space.
 
void setActive (bool active)
 Activates or deactivates rendering of this component.
 
void setThickness (float thickness, bool reset=false)
 Sets the thickness used by some shaders and can reset to this thickness.
 
void setRounding (float rounding)
 Sets the rounding radius of the quads.
 
void setTargetComponent (Component *target_component)
 Sets a target component to help position the quads.
 
void setScissorComponent (Component *scissor_component)
 Sets a component for scissoring (clipping) rendering area.
 
OpenGLShaderProgram * shader ()
 Gets the current OpenGL shader program.
 
void setAdditive (bool additive)
 Enables or disables additive blending for rendering.
 
void setAlpha (float alpha, bool reset=false)
 Sets the alpha blending multiplier, can reset to this alpha.
 
void setDrawWhenNotVisible (bool draw)
 Sets whether to draw even if the component is not visible.
 
- Public Member Functions inherited from OpenGlComponent
 OpenGlComponent (String name="")
 Constructs an OpenGlComponent.
 
virtual ~OpenGlComponent ()
 Destructor.
 
virtual void parentHierarchyChanged () override
 Called when the component's parent hierarchy changes.
 
void addRoundedCorners ()
 Adds rounded corners to the component's edges.
 
void addBottomRoundedCorners ()
 Adds rounded corners only at the bottom of the component.
 
void renderCorners (OpenGlWrapper &open_gl, bool animate, Colour color, float rounding)
 Renders the corner shapes using the given color and rounding amount.
 
void renderCorners (OpenGlWrapper &open_gl, bool animate)
 Renders corners with default body color and rounding.
 
void repaintBackground ()
 Requests a repaint of the component's background on the OpenGL layer.
 
Colour getBodyColor () const
 Retrieves the component's body color.
 
void setParent (const SynthSection *parent)
 Sets a pointer to the parent SynthSection for skin value lookups.
 
float findValue (Skin::ValueId value_id)
 Finds a float value from the skin associated with this component's parent.
 
void setSkinValues (const Skin &skin)
 Applies the skin overrides to this component's colors.
 
void setSkinOverride (Skin::SectionOverride skin_override)
 Sets a skin override to control the component's color scheme.
 
force_inline void checkGlError ()
 Checks for and asserts that there are no OpenGL errors.
 
void setBackgroundColor (const Colour &color)
 Sets the background color of the component for painting operations.
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenGlComponent
static bool setViewPort (Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl)
 Sets the OpenGL viewport to match a specified rectangle within a component.
 
static bool setViewPort (Component *component, OpenGlWrapper &open_gl)
 Convenience overload that sets the viewport for the entire component's local bounds.
 
static void setScissor (Component *component, OpenGlWrapper &open_gl)
 Sets the OpenGL scissor region to the entire component's local bounds.
 
static void setScissorBounds (Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl)
 Sets the OpenGL scissor region to a specified rectangle within a component.
 
static std::unique_ptr< OpenGLShaderProgram::Uniform > getUniform (const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
 Retrieves a uniform from the shader program if it exists.
 
static std::unique_ptr< OpenGLShaderProgram::Attribute > getAttribute (const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
 Retrieves an attribute from the shader program if it exists.
 
static String translateFragmentShader (const String &code)
 Translates a fragment shader code snippet to be compatible with the current GL version.
 
static String translateVertexShader (const String &code)
 Translates a vertex shader code snippet to be compatible with the current GL version.
 
- Static Public Attributes inherited from OpenGlMultiQuad
static constexpr int kNumVertices = 4
 Number of vertices per quad.
 
static constexpr int kNumFloatsPerVertex = 10
 Number of floats per vertex (x, y, w, h, plus custom shader values).
 
static constexpr int kNumFloatsPerQuad = kNumVertices * kNumFloatsPerVertex
 Number of floats total per quad (4 vertices * 10 floats each).
 
static constexpr int kNumIndicesPerQuad = 6
 Number of indices per quad (2 triangles forming a rectangle).
 
static constexpr float kThicknessDecay = 0.4f
 Decay factor for thickness adjustments over time.
 
static constexpr float kAlphaInc = 0.2f
 Increment for alpha blending adjustments.
 
- Protected Member Functions inherited from OpenGlComponent
bool setViewPort (OpenGlWrapper &open_gl)
 Sets the viewport for this component using the current OpenGlWrapper.
 
- Protected Attributes inherited from OpenGlMultiQuad
Component * target_component_
 The component this relates to for sizing/positioning.
 
Component * scissor_component_
 The component used for scissoring (clipping).
 
Shaders::FragmentShader fragment_shader_
 The fragment shader used for rendering.
 
int max_quads_
 Maximum number of quads.
 
int num_quads_
 Current number of quads to draw.
 
bool draw_when_not_visible_
 If true, draw even if the component is not visible.
 
bool active_
 If false, nothing is rendered.
 
bool dirty_
 If true, vertex data is dirty and needs re-upload.
 
Colour color_
 Base color tint.
 
Colour alt_color_
 Alternate color for shader use.
 
Colour mod_color_
 Modulation color for shader.
 
Colour thumb_color_
 Color for a "thumb" element (e.g., in a slider).
 
float max_arc_
 Maximum arc for certain shader effects.
 
float thumb_amount_
 Amount parameter for thumb effects.
 
float start_pos_
 Start position parameter for shader effects.
 
float current_alpha_mult_
 Current alpha multiplier for gradual changes.
 
float alpha_mult_
 Target alpha multiplier.
 
bool additive_blending_
 Use additive blending if true.
 
float current_thickness_
 Current thickness for gradual changes.
 
float thickness_
 Target thickness.
 
float rounding_
 Rounding radius for corners.
 
std::unique_ptr< float[]> data_
 Vertex data for all quads.
 
std::unique_ptr< int[]> indices_
 Index data for drawing quads.
 
OpenGLShaderProgram * shader_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > color_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > alt_color_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > mod_color_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > background_color_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > thumb_color_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > thickness_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > rounding_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > max_arc_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > thumb_amount_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > start_pos_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Uniform > alpha_mult_uniform_
 
std::unique_ptr< OpenGLShaderProgram::Attribute > position_
 
std::unique_ptr< OpenGLShaderProgram::Attribute > dimensions_
 
std::unique_ptr< OpenGLShaderProgram::Attribute > coordinates_
 
std::unique_ptr< OpenGLShaderProgram::Attribute > shader_values_
 
GLuint vertex_buffer_
 OpenGL buffer for vertex data.
 
GLuint indices_buffer_
 OpenGL buffer for index data.
 
- Protected Attributes inherited from OpenGlComponent
std::unique_ptr< OpenGlCornerscorners_
 Optional corners for rounded edges.
 
bool only_bottom_corners_
 Flag to round only the bottom corners.
 
Colour background_color_
 The background color of the component.
 
Colour body_color_
 The body color of the component.
 
const SynthSectionparent_
 Pointer to parent SynthSection for skin lookups.
 
Skin::SectionOverride skin_override_
 Skin override for custom appearance.
 
const vital::StatusOutputnum_voices_readout_
 StatusOutput for voice count lookups.
 

Detailed Description

A popup box that displays multiple ModulationAmountKnob controls in a grid.

The ModulationExpansionBox is used when there are too many modulations to fit directly around a ModulationButton. It creates a callout or popup area where multiple modulations can be edited.

Constructor & Destructor Documentation

◆ ModulationExpansionBox()

ModulationExpansionBox::ModulationExpansionBox ( )
inline

Member Function Documentation

◆ addListener()

void ModulationExpansionBox::addListener ( Listener * listener)
inline

Adds a Listener for expansion box focus events.

Parameters
listenerA pointer to a Listener.

◆ focusLost()

void ModulationExpansionBox::focusLost ( FocusChangeType cause)
inlineoverride

◆ setAmountControls()

void ModulationExpansionBox::setAmountControls ( std::vector< ModulationAmountKnob * > amount_controls)
inline

Sets the amount controls displayed inside this expansion box.

Parameters
amount_controlsA vector of pointers to ModulationAmountKnob objects.

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