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

A GUI component for editing and visualizing a user-defined line shape (curve or envelope). More...

#include <line_editor.h>

Inheritance diagram for LineEditor:
OpenGlLineRenderer OpenGlComponent LfoEditor LineMapEditor

Classes

class  Listener
 Interface for classes that want to receive notifications about line editor changes. More...
 

Public Types

enum  MenuOptions {
  kCancel , kCopy , kPaste , kSave ,
  kEnterPhase , kEnterValue , kResetPower , kRemovePoint ,
  kInit , kFlipHorizontal , kFlipVertical , kNumMenuOptions
}
 Context menu options available in the line editor. More...
 

Public Member Functions

 LineEditor (LineGenerator *line_source)
 Constructs the LineEditor.
 
virtual ~LineEditor ()
 Destructor.
 
void resetWavePath ()
 Resets the wave path, recalculating positions based on current points and powers.
 
void resized () override
 Called when the component is resized.
 
float padY (float y)
 Pads a Y coordinate to fit the drawing area with vertical padding.
 
float unpadY (float y)
 Removes padding from a padded Y coordinate.
 
float padX (float x)
 Pads an X coordinate to fit the drawing area with horizontal padding.
 
float unpadX (float x)
 Removes padding from a padded X coordinate.
 
virtual void mouseDown (const MouseEvent &e) override
 
virtual void mouseDoubleClick (const MouseEvent &e) override
 
virtual void mouseMove (const MouseEvent &e) override
 
virtual void mouseDrag (const MouseEvent &e) override
 
virtual void mouseUp (const MouseEvent &e) override
 
virtual void respondToCallback (int point, int power, int option)
 Responds to a callback triggered by a menu option or action.
 
bool hasMatchingSystemClipboard ()
 Checks if the system clipboard contains a compatible line data JSON.
 
void paintLine (const MouseEvent &e)
 Paints the line by adding points according to a pattern when in paint mode.
 
void drawDown (const MouseEvent &e)
 Handles the initial mouse press (not in paint mode) for dragging points or powers.
 
void drawDrag (const MouseEvent &e)
 Handles mouse dragging to move points or adjust powers.
 
void drawUp (const MouseEvent &e)
 Handles mouse release to finalize point or power positions.
 
void mouseWheelMove (const MouseEvent &e, const MouseWheelDetails &wheel) override
 
void mouseExit (const MouseEvent &e) override
 
void clearActiveMouseActions ()
 
void renderGrid (OpenGlWrapper &open_gl, bool animate)
 Renders the grid lines that show snapping lines or painting sections.
 
void renderPoints (OpenGlWrapper &open_gl, bool animate)
 Renders the points and power handles on the curve.
 
void init (OpenGlWrapper &open_gl) override
 Initializes OpenGL resources for rendering the line.
 
void render (OpenGlWrapper &open_gl, bool animate) override
 Renders the line using OpenGL.
 
void destroy (OpenGlWrapper &open_gl) override
 Destroys OpenGL resources allocated by this line renderer.
 
void setSizeRatio (float ratio)
 Sets the size ratio, scaling UI elements accordingly.
 
float sizeRatio () const
 Gets the current size ratio.
 
void setLoop (bool loop)
 Enables or disables looping of the line at the edges.
 
void setSmooth (bool smooth)
 Enables or disables smoothing of the curve.
 
bool getSmooth () const
 Checks if smoothing is enabled.
 
void setPaint (bool paint)
 Enables or disables paint mode.
 
void setPaintPattern (std::vector< std::pair< float, float > > pattern)
 Sets a pattern of points used when painting the line.
 
virtual void setGridSizeX (int size)
 Sets the horizontal grid size.
 
virtual void setGridSizeY (int size)
 Sets the vertical grid size.
 
int getGridSizeX ()
 Gets the current horizontal grid size.
 
int getGridSizeY ()
 Gets the current vertical grid size.
 
void setModel (LineGenerator *model)
 Sets the LineGenerator model defining the curve.
 
LineGeneratorgetModel ()
 Gets the current LineGenerator model.
 
void showTextEntry ()
 Shows the text editor for entering a precise value or phase.
 
void hideTextEntry ()
 Hides the text entry editor.
 
void textEditorReturnKeyPressed (TextEditor &editor) override
 
void textEditorFocusLost (TextEditor &editor) override
 
void textEditorEscapeKeyPressed (TextEditor &editor) override
 
void setSliderPositionFromText ()
 Sets the position of the selected point/power from the text field.
 
void setAllowFileLoading (bool allow)
 Allows or disallows file loading actions (copy/paste from files).
 
void addListener (Listener *listener)
 Adds a listener for line editor events.
 
void setActive (bool active)
 Sets whether the line editor is active (enabled).
 
force_inline void resetPositions ()
 Marks positions as needing recalculation on next render.
 
OpenGlComponentgetTextEditorComponent ()
 Gets the OpenGlComponent for text editing (if any).
 
- Public Member Functions inherited from OpenGlLineRenderer
 OpenGlLineRenderer (int num_points, bool loop=false)
 Constructs an OpenGlLineRenderer for a given number of points.
 
virtual ~OpenGlLineRenderer ()
 Destructor.
 
force_inline void setColor (Colour color)
 Sets the line color.
 
force_inline void setLineWidth (float width)
 Sets the line width in pixels.
 
force_inline void setBoost (float boost)
 Sets a global boost value affecting line thickness.
 
force_inline float boostLeftAt (int index) const
 Gets the left-side boost at a given point index.
 
force_inline float boostRightAt (int index) const
 Gets the right-side boost at a given point index.
 
force_inline float yAt (int index) const
 Gets the y-coordinate of a point at a given index.
 
force_inline float xAt (int index) const
 Gets the x-coordinate of a point at a given index.
 
force_inline void setBoostLeft (int index, float val)
 Sets the left-side boost for a point, marking data as dirty.
 
force_inline void setBoostRight (int index, float val)
 Sets the right-side boost for a point, marking data as dirty.
 
force_inline void setYAt (int index, float val)
 Sets the y-coordinate of a point, marking data as dirty.
 
force_inline void setXAt (int index, float val)
 Sets the x-coordinate of a point, marking data as dirty.
 
void setFillVertices (bool left)
 Sets fill vertices according to the current line and boost data.
 
void setLineVertices (bool left)
 Sets line vertices according to the current line and boost data.
 
force_inline void setFill (bool fill)
 Enables or disables filling below the line.
 
force_inline void setFillColor (Colour fill_color)
 Sets a uniform fill color if only one color is needed.
 
force_inline void setFillColors (Colour fill_color_from, Colour fill_color_to)
 Sets a gradient fill from one color to another.
 
force_inline void setFillCenter (float fill_center)
 Sets the vertical center for the fill area.
 
force_inline void setFit (bool fit)
 Enables fitting the line inside the available area.
 
force_inline void setBoostAmount (float boost_amount)
 Sets the boost amount that affects line thickness.
 
force_inline void setFillBoostAmount (float boost_amount)
 Sets the boost amount that affects fill thickness.
 
force_inline void setIndex (int index)
 Sets an index used for custom behavior (e.g., multiple line sets).
 
void boostLeftRange (float start, float end, int buffer_vertices, float min)
 Boosts left-side range of the line.
 
void boostRightRange (float start, float end, int buffer_vertices, float min)
 Boosts right-side range of the line.
 
void boostRange (float *boosts, float start, float end, int buffer_vertices, float min)
 Boosts a range for the given boost array.
 
void boostRange (vital::poly_float start, vital::poly_float end, int buffer_vertices, vital::poly_float min)
 Boosts left and right arrays using poly_float parameters.
 
void decayBoosts (vital::poly_float mult)
 Decays all boosts by a multiplicative factor, allowing animated damping.
 
void enableBackwardBoost (bool enable)
 Enables backward boost calculation for symmetrical line deformation.
 
force_inline int numPoints () const
 Gets the number of points in the line.
 
force_inline Colour color () const
 Gets the current line color.
 
void drawLines (OpenGlWrapper &open_gl, bool left)
 Draws the line and optional fill using OpenGL.
 
bool anyBoostValue ()
 Checks if any boost value is set.
 
- 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.
 
virtual void paintBackground (Graphics &g)
 Paints a standard background for the component.
 
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.
 

Static Public Attributes

static constexpr float kPositionWidth = 9.0f
 Width in pixels for main position markers.
 
static constexpr float kPowerWidth = 7.0f
 Width in pixels for power markers (curve shaping handles).
 
static constexpr float kRingThickness = 0.45f
 Fractional thickness for marker ring rendering.
 
static constexpr float kGrabRadius = 12.0f
 Radius in pixels for detecting grabbing a point or power handle.
 
static constexpr float kDragRadius = 20.0f
 Radius in pixels for dragging a point or power handle.
 
static constexpr int kResolution = 64
 Resolution used for intermediate line calculations.
 
static constexpr int kNumWrapPoints = 8
 Number of wrap points for looping lines.
 
static constexpr int kDrawPoints = kResolution + LineGenerator::kMaxPoints
 Number of points drawn: resolution plus max points from LineGenerator.
 
static constexpr int kTotalPoints = kDrawPoints + 2 * kNumWrapPoints
 Total points including wrap-around.
 
static constexpr int kMaxGridSizeX = 32
 Maximum grid sizes for horizontal and vertical lines.
 
static constexpr int kMaxGridSizeY = 24
 
static constexpr float kPaddingY = 6.0f
 Vertical padding in pixels.
 
static constexpr float kPaddingX = 0.0f
 Horizontal padding in pixels.
 
static constexpr float kPowerMouseMultiplier = 9.0f
 Multiplier for mouse movements when adjusting power handles.
 
static constexpr float kMinPointDistanceForPower = 3.0f
 Minimum horizontal distance (in pixels) between points to show power handles.
 
- Static Public Attributes inherited from OpenGlLineRenderer
static constexpr int kLineFloatsPerVertex = 3
 Floats per vertex in the line data (x, y, and potentially others).
 
static constexpr int kFillFloatsPerVertex = 4
 Floats per vertex in the fill data (x, y, and boost value).
 
static constexpr int kLineVerticesPerPoint = 6
 Number of vertices per point in the line representation.
 
static constexpr int kFillVerticesPerPoint = 2
 Number of vertices per point in the fill representation.
 
static constexpr int kLineFloatsPerPoint = kLineVerticesPerPoint * kLineFloatsPerVertex
 Floats per point in the line data (6 vertices * 3 floats each).
 
static constexpr int kFillFloatsPerPoint = kFillVerticesPerPoint * kFillFloatsPerVertex
 Floats per point in the fill data (2 vertices * 4 floats each).
 

Protected Member Functions

void drawPosition (OpenGlWrapper &open_gl, Colour color, float fraction_x)
 Draws a position marker at a specific fraction of the X-axis.
 
void setEditingCircleBounds ()
 Sets bounds for the editing circles (hover and drag indicators).
 
void setGridPositions ()
 Calculates and sets positions for grid lines.
 
void setPointPositions ()
 Calculates and sets positions for point and power handle quads.
 
void setGlPositions ()
 Updates OpenGL buffers with the latest positions if needed.
 
int getActivePoint ()
 Gets the currently active point index.
 
int getActivePower ()
 Gets the currently active power handle index.
 
int getActiveGridSection ()
 Gets the currently active grid section index for painting.
 
bool isPainting ()
 Checks if painting mode is currently active.
 
bool isPaintEnabled ()
 Checks if paint mode is globally enabled.
 
vital::poly_float adjustBoostPhase (vital::poly_float phase)
 Adjusts a given phase value for boost calculations.
 
virtual void enableTemporaryPaintToggle (bool toggle)
 Temporarily enables or disables paint mode using a toggle (e.g., via a modifier key).
 
- Protected Member Functions inherited from OpenGlComponent
bool setViewPort (OpenGlWrapper &open_gl)
 Sets the viewport for this component using the current OpenGlWrapper.
 

Protected Attributes

bool active_
 
std::vector< Listener * > listeners_
 
- 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.
 

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.
 

Detailed Description

A GUI component for editing and visualizing a user-defined line shape (curve or envelope).

The LineEditor component displays and allows interactive editing of a set of control points and powers that define a curve. This curve may represent an LFO shape or an envelope. Users can add, remove, and move points, as well as adjust the curve’s power segments for non-linear transitions. The editor supports grid snapping, painting patterns, copying/pasting states, and file loading/saving.

The rendered curve is shown using OpenGL for efficient visualization. Hover indicators, dragging handles, and visual feedback are provided. The LineEditor also supports text-based entry for precise values and can handle custom mouse interactions (like painting patterns).

Member Enumeration Documentation

◆ MenuOptions

Context menu options available in the line editor.

Enumerator
kCancel 
kCopy 
kPaste 
kSave 
kEnterPhase 
kEnterValue 
kResetPower 
kRemovePoint 
kInit 
kFlipHorizontal 
kFlipVertical 
kNumMenuOptions 

Constructor & Destructor Documentation

◆ LineEditor()

LineEditor::LineEditor ( LineGenerator * line_source)

Constructs the LineEditor.

Parameters
line_sourceThe line source (LineGenerator) providing the curve data.

◆ ~LineEditor()

LineEditor::~LineEditor ( )
virtual

Destructor.

Member Function Documentation

◆ addListener()

void LineEditor::addListener ( Listener * listener)
inline

Adds a listener for line editor events.

Parameters
listenerThe listener to add.

◆ adjustBoostPhase()

vital::poly_float LineEditor::adjustBoostPhase ( vital::poly_float phase)
protected

Adjusts a given phase value for boost calculations.

Parameters
phaseThe phase value as a poly_float.
Returns
Adjusted phase for smooth boosting.

◆ clearActiveMouseActions()

void LineEditor::clearActiveMouseActions ( )

◆ destroy()

void LineEditor::destroy ( OpenGlWrapper & open_gl)
overridevirtual

Destroys OpenGL resources allocated by this line renderer.

Parameters
open_glThe OpenGlWrapper providing the OpenGL context.

Reimplemented from OpenGlLineRenderer.

◆ drawDown()

void LineEditor::drawDown ( const MouseEvent & e)

Handles the initial mouse press (not in paint mode) for dragging points or powers.

Parameters
eThe mouse event.

◆ drawDrag()

void LineEditor::drawDrag ( const MouseEvent & e)

Handles mouse dragging to move points or adjust powers.

Parameters
eThe mouse event.

◆ drawPosition()

void LineEditor::drawPosition ( OpenGlWrapper & open_gl,
Colour color,
float fraction_x )
protected

Draws a position marker at a specific fraction of the X-axis.

Parameters
open_glThe OpenGL wrapper.
colorThe color of the marker.
fraction_xThe normalized X position (0.0 to 1.0).

◆ drawUp()

void LineEditor::drawUp ( const MouseEvent & e)

Handles mouse release to finalize point or power positions.

Parameters
eThe mouse event.

◆ enableTemporaryPaintToggle()

void LineEditor::enableTemporaryPaintToggle ( bool toggle)
protectedvirtual

Temporarily enables or disables paint mode using a toggle (e.g., via a modifier key).

Parameters
toggleTrue to temporarily enable, false to disable.

◆ getActiveGridSection()

int LineEditor::getActiveGridSection ( )
inlineprotected

Gets the currently active grid section index for painting.

Returns
The grid section index, or -1 if none.

◆ getActivePoint()

int LineEditor::getActivePoint ( )
inlineprotected

Gets the currently active point index.

Returns
The index of the active point, or -1 if none.

◆ getActivePower()

int LineEditor::getActivePower ( )
inlineprotected

Gets the currently active power handle index.

Returns
The index of the active power, or -1 if none.

◆ getGridSizeX()

int LineEditor::getGridSizeX ( )
inline

Gets the current horizontal grid size.

◆ getGridSizeY()

int LineEditor::getGridSizeY ( )
inline

Gets the current vertical grid size.

◆ getModel()

LineGenerator * LineEditor::getModel ( )
inline

Gets the current LineGenerator model.

◆ getSmooth()

bool LineEditor::getSmooth ( ) const
inline

Checks if smoothing is enabled.

Returns
True if smoothing is enabled, false otherwise.

◆ getTextEditorComponent()

OpenGlComponent * LineEditor::getTextEditorComponent ( )
inline

Gets the OpenGlComponent for text editing (if any).

Returns
The text editor's OpenGL component, or nullptr if none.

◆ hasMatchingSystemClipboard()

bool LineEditor::hasMatchingSystemClipboard ( )

Checks if the system clipboard contains a compatible line data JSON.

Returns
True if clipboard data matches a known line state format.

◆ hideTextEntry()

void LineEditor::hideTextEntry ( )

Hides the text entry editor.

◆ init()

void LineEditor::init ( OpenGlWrapper & open_gl)
overridevirtual

Initializes OpenGL resources for rendering the line.

Parameters
open_glThe OpenGlWrapper providing the OpenGL context.

Reimplemented from OpenGlLineRenderer.

◆ isPaintEnabled()

bool LineEditor::isPaintEnabled ( )
inlineprotected

Checks if paint mode is globally enabled.

◆ isPainting()

bool LineEditor::isPainting ( )
inlineprotected

Checks if painting mode is currently active.

◆ mouseDoubleClick()

void LineEditor::mouseDoubleClick ( const MouseEvent & e)
overridevirtual

Reimplemented in LfoEditor.

◆ mouseDown()

void LineEditor::mouseDown ( const MouseEvent & e)
overridevirtual

Reimplemented in LfoEditor.

◆ mouseDrag()

void LineEditor::mouseDrag ( const MouseEvent & e)
overridevirtual

◆ mouseExit()

void LineEditor::mouseExit ( const MouseEvent & e)
override

◆ mouseMove()

void LineEditor::mouseMove ( const MouseEvent & e)
overridevirtual

◆ mouseUp()

void LineEditor::mouseUp ( const MouseEvent & e)
overridevirtual

Reimplemented in LfoEditor.

◆ mouseWheelMove()

void LineEditor::mouseWheelMove ( const MouseEvent & e,
const MouseWheelDetails & wheel )
override

◆ padX()

float LineEditor::padX ( float x)
inline

Pads an X coordinate to fit the drawing area with horizontal padding.

Parameters
xThe X coordinate (unscaled).
Returns
The padded X coordinate.

◆ padY()

float LineEditor::padY ( float y)
inline

Pads a Y coordinate to fit the drawing area with vertical padding.

Parameters
yThe Y coordinate (unscaled).
Returns
The padded Y coordinate.

◆ paintLine()

void LineEditor::paintLine ( const MouseEvent & e)

Paints the line by adding points according to a pattern when in paint mode.

Parameters
eThe mouse event.

◆ render()

void LineEditor::render ( OpenGlWrapper & open_gl,
bool animate )
overridevirtual

Renders the line using OpenGL.

Parameters
open_glThe OpenGlWrapper providing the OpenGL context.
animateIf true, animations (like boosts) are allowed.

Reimplemented from OpenGlLineRenderer.

Reimplemented in LineMapEditor.

◆ renderGrid()

void LineEditor::renderGrid ( OpenGlWrapper & open_gl,
bool animate )

Renders the grid lines that show snapping lines or painting sections.

◆ renderPoints()

void LineEditor::renderPoints ( OpenGlWrapper & open_gl,
bool animate )

Renders the points and power handles on the curve.

◆ resetPositions()

force_inline void LineEditor::resetPositions ( )
inline

Marks positions as needing recalculation on next render.

◆ resetWavePath()

void LineEditor::resetWavePath ( )

Resets the wave path, recalculating positions based on current points and powers.

◆ resized()

void LineEditor::resized ( )
inlineoverridevirtual

Called when the component is resized.

Adjusts internal states or sub-components (like corners).

Reimplemented from OpenGlComponent.

◆ respondToCallback()

void LineEditor::respondToCallback ( int point,
int power,
int option )
virtual

Responds to a callback triggered by a menu option or action.

Parameters
pointThe active point index, or -1 if none.
powerThe active power handle index, or -1 if none.
optionThe selected menu option ID.

Reimplemented in LfoEditor.

◆ setActive()

void LineEditor::setActive ( bool active)
inline

Sets whether the line editor is active (enabled).

Parameters
activeTrue if active, false otherwise.

◆ setAllowFileLoading()

void LineEditor::setAllowFileLoading ( bool allow)
inline

Allows or disallows file loading actions (copy/paste from files).

Parameters
allowTrue to allow file loading, false otherwise.

◆ setEditingCircleBounds()

void LineEditor::setEditingCircleBounds ( )
protected

Sets bounds for the editing circles (hover and drag indicators).

◆ setGlPositions()

void LineEditor::setGlPositions ( )
protected

Updates OpenGL buffers with the latest positions if needed.

◆ setGridPositions()

void LineEditor::setGridPositions ( )
protected

Calculates and sets positions for grid lines.

◆ setGridSizeX()

virtual void LineEditor::setGridSizeX ( int size)
inlinevirtual

Sets the horizontal grid size.

Parameters
sizeThe number of divisions horizontally.

◆ setGridSizeY()

virtual void LineEditor::setGridSizeY ( int size)
inlinevirtual

Sets the vertical grid size.

Parameters
sizeThe number of divisions vertically.

◆ setLoop()

void LineEditor::setLoop ( bool loop)
inline

Enables or disables looping of the line at the edges.

Parameters
loopTrue to loop the line, false otherwise.

◆ setModel()

void LineEditor::setModel ( LineGenerator * model)
inline

Sets the LineGenerator model defining the curve.

Parameters
modelThe new LineGenerator model.

◆ setPaint()

void LineEditor::setPaint ( bool paint)

Enables or disables paint mode.

Parameters
paintTrue to enable paint mode.

◆ setPaintPattern()

void LineEditor::setPaintPattern ( std::vector< std::pair< float, float > > pattern)
inline

Sets a pattern of points used when painting the line.

Parameters
patternA vector of (phase, amplitude) pairs defining the pattern.

◆ setPointPositions()

void LineEditor::setPointPositions ( )
protected

Calculates and sets positions for point and power handle quads.

◆ setSizeRatio()

void LineEditor::setSizeRatio ( float ratio)
inline

Sets the size ratio, scaling UI elements accordingly.

Parameters
ratioThe size ratio.

◆ setSliderPositionFromText()

void LineEditor::setSliderPositionFromText ( )

Sets the position of the selected point/power from the text field.

◆ setSmooth()

void LineEditor::setSmooth ( bool smooth)
inline

Enables or disables smoothing of the curve.

Parameters
smoothTrue to smooth the curve, false otherwise.

◆ showTextEntry()

void LineEditor::showTextEntry ( )

Shows the text editor for entering a precise value or phase.

◆ sizeRatio()

float LineEditor::sizeRatio ( ) const
inline

Gets the current size ratio.

Returns
The size ratio.

◆ textEditorEscapeKeyPressed()

void LineEditor::textEditorEscapeKeyPressed ( TextEditor & editor)
override

◆ textEditorFocusLost()

void LineEditor::textEditorFocusLost ( TextEditor & editor)
override

◆ textEditorReturnKeyPressed()

void LineEditor::textEditorReturnKeyPressed ( TextEditor & editor)
override

◆ unpadX()

float LineEditor::unpadX ( float x)
inline

Removes padding from a padded X coordinate.

Parameters
xThe padded X coordinate.
Returns
The unpadded X coordinate.

◆ unpadY()

float LineEditor::unpadY ( float y)
inline

Removes padding from a padded Y coordinate.

Parameters
yThe padded Y coordinate.
Returns
The unpadded Y coordinate.

Member Data Documentation

◆ active_

bool LineEditor::active_
protected

◆ kDragRadius

float LineEditor::kDragRadius = 20.0f
staticconstexpr

Radius in pixels for dragging a point or power handle.

◆ kDrawPoints

int LineEditor::kDrawPoints = kResolution + LineGenerator::kMaxPoints
staticconstexpr

Number of points drawn: resolution plus max points from LineGenerator.

◆ kGrabRadius

float LineEditor::kGrabRadius = 12.0f
staticconstexpr

Radius in pixels for detecting grabbing a point or power handle.

◆ kMaxGridSizeX

int LineEditor::kMaxGridSizeX = 32
staticconstexpr

Maximum grid sizes for horizontal and vertical lines.

◆ kMaxGridSizeY

int LineEditor::kMaxGridSizeY = 24
staticconstexpr

◆ kMinPointDistanceForPower

float LineEditor::kMinPointDistanceForPower = 3.0f
staticconstexpr

Minimum horizontal distance (in pixels) between points to show power handles.

◆ kNumWrapPoints

int LineEditor::kNumWrapPoints = 8
staticconstexpr

Number of wrap points for looping lines.

◆ kPaddingX

float LineEditor::kPaddingX = 0.0f
staticconstexpr

Horizontal padding in pixels.

◆ kPaddingY

float LineEditor::kPaddingY = 6.0f
staticconstexpr

Vertical padding in pixels.

◆ kPositionWidth

float LineEditor::kPositionWidth = 9.0f
staticconstexpr

Width in pixels for main position markers.

◆ kPowerMouseMultiplier

float LineEditor::kPowerMouseMultiplier = 9.0f
staticconstexpr

Multiplier for mouse movements when adjusting power handles.

◆ kPowerWidth

float LineEditor::kPowerWidth = 7.0f
staticconstexpr

Width in pixels for power markers (curve shaping handles).

◆ kResolution

int LineEditor::kResolution = 64
staticconstexpr

Resolution used for intermediate line calculations.

◆ kRingThickness

float LineEditor::kRingThickness = 0.45f
staticconstexpr

Fractional thickness for marker ring rendering.

◆ kTotalPoints

int LineEditor::kTotalPoints = kDrawPoints + 2 * kNumWrapPoints
staticconstexpr

Total points including wrap-around.

◆ listeners_

std::vector<Listener*> LineEditor::listeners_
protected

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