131 virtual void pointChanged(
int index, Point<float> position,
bool mouse_up) { }
144 virtual void pointAdded(
int index, Point<float> position) { }
185 drag_circle_.setBounds(getLocalBounds());
186 hover_circle_.setBounds(getLocalBounds());
187 grid_lines_.setBounds(getLocalBounds());
188 position_circle_.setBounds(getLocalBounds());
189 point_circles_.setBounds(getLocalBounds());
190 power_circles_.setBounds(getLocalBounds());
222 virtual void mouseDown(
const MouseEvent& e)
override;
224 virtual void mouseMove(
const MouseEvent& e)
override;
225 virtual void mouseDrag(
const MouseEvent& e)
override;
226 virtual void mouseUp(
const MouseEvent& e)
override;
264 void drawUp(
const MouseEvent& e);
266 void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override;
267 void mouseExit(
const MouseEvent& e)
override;
324 void setPaintPattern(std::vector<std::pair<float, float>> pattern) { paint_pattern_ = pattern; }
407 return value_entry_->getImageComponent();
461 bool isPainting() {
return paint_ != temporary_paint_toggle_; }
487 int getHoverPoint(Point<float> position);
488 int getHoverPower(Point<float> position);
489 float getSnapRadiusX();
490 float getSnapRadiusY();
491 float getSnappedX(
float x);
492 float getSnappedY(
float y);
494 void addPointAt(Point<float> position);
495 void movePoint(
int index, Point<float> position,
bool snap);
496 void movePower(
int index, Point<float> position,
bool all,
bool alternate);
497 void removePoint(
int index);
498 float getMinX(
int index);
499 float getMaxX(
int index);
501 Point<float> valuesToOpenGlPosition(
float x,
float y);
502 Point<float> getPowerPosition(
int index);
503 bool powerActive(
int index);
508 int active_grid_section_;
510 bool reset_positions_;
511 bool allow_file_loading_;
512 Point<float> last_mouse_position_;
513 int last_model_render_;
518 bool temporary_paint_toggle_;
519 std::vector<std::pair<float, float>> paint_pattern_;
531 std::unique_ptr<OpenGlTextEditor> value_entry_;
532 bool entering_phase_;
535 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
LineEditor)
Interface for classes that want to receive notifications about line editor changes.
Definition line_editor.h:86
virtual void pointsAdded(int index, int num_points_added)
Called when multiple points are added at once.
Definition line_editor.h:157
virtual void importLfo()=0
Called when the user requests to import an LFO.
virtual void pointRemoved(int index)
Called when a point is removed from the curve.
Definition line_editor.h:150
virtual void powersChanged(bool mouse_up)
Called when the curve powers have changed.
Definition line_editor.h:137
virtual void setPhase(float phase)=0
Called when the LFO phase or start point is changed.
virtual void exportLfo()=0
Called when the user requests to export the current LFO.
virtual void pointAdded(int index, Point< float > position)
Called when a point is added to the curve.
Definition line_editor.h:144
virtual void pointChanged(int index, Point< float > position, bool mouse_up)
Called when a point's position changes.
Definition line_editor.h:131
virtual void fileLoaded()=0
Called when a file (e.g., a saved LFO shape) is loaded into the editor.
virtual ~Listener()
Definition line_editor.h:88
virtual void pointsRemoved(int index, int num_points_removed)
Called when multiple points are removed at once.
Definition line_editor.h:164
virtual void togglePaintMode(bool enabled, bool temporary_switch)=0
Called when paint mode is toggled.
virtual void lineEditorScrolled(const MouseEvent &e, const MouseWheelDetails &wheel)=0
Called when the user scrolls the mouse wheel over the line editor.
A GUI component for editing and visualizing a user-defined line shape (curve or envelope).
Definition line_editor.h:27
bool isPainting()
Checks if painting mode is currently active.
Definition line_editor.h:461
static constexpr float kPaddingX
Horizontal padding in pixels.
Definition line_editor.h:56
void resized() override
Called when the component is resized.
Definition line_editor.h:183
void clearActiveMouseActions()
Definition line_editor.cpp:634
static constexpr int kDrawPoints
Number of points drawn: resolution plus max points from LineGenerator.
Definition line_editor.h:45
static constexpr int kTotalPoints
Total points including wrap-around.
Definition line_editor.h:47
vital::poly_float adjustBoostPhase(vital::poly_float phase)
Adjusts a given phase value for boost calculations.
Definition line_editor.cpp:1061
bool active_
Definition line_editor.h:481
void renderGrid(OpenGlWrapper &open_gl, bool animate)
Renders the grid lines that show snapping lines or painting sections.
Definition line_editor.cpp:763
void setSliderPositionFromText()
Sets the position of the selected point/power from the text field.
Definition line_editor.cpp:1027
virtual void setGridSizeY(int size)
Sets the vertical grid size.
Definition line_editor.h:336
void showTextEntry()
Shows the text editor for entering a precise value or phase.
Definition line_editor.cpp:995
void setPointPositions()
Calculates and sets positions for point and power handle quads.
Definition line_editor.cpp:931
static constexpr float kMinPointDistanceForPower
Minimum horizontal distance (in pixels) between points to show power handles.
Definition line_editor.h:61
void render(OpenGlWrapper &open_gl, bool animate) override
Renders the line using OpenGL.
Definition line_editor.cpp:788
static constexpr int kResolution
Resolution used for intermediate line calculations.
Definition line_editor.h:41
void setLoop(bool loop)
Enables or disables looping of the line at the edges.
Definition line_editor.h:300
static constexpr int kMaxGridSizeY
Definition line_editor.h:51
void init(OpenGlWrapper &open_gl) override
Initializes OpenGL resources for rendering the line.
Definition line_editor.cpp:753
bool getSmooth() const
Checks if smoothing is enabled.
Definition line_editor.h:312
bool isPaintEnabled()
Checks if paint mode is globally enabled.
Definition line_editor.h:466
virtual void mouseUp(const MouseEvent &e) override
Definition line_editor.cpp:603
virtual void setGridSizeX(int size)
Sets the horizontal grid size.
Definition line_editor.h:330
void resetWavePath()
Resets the wave path, recalculating positions based on current points and powers.
Definition line_editor.cpp:643
void setSmooth(bool smooth)
Enables or disables smoothing of the curve.
Definition line_editor.h:306
void addListener(Listener *listener)
Adds a listener for line editor events.
Definition line_editor.h:388
void setEditingCircleBounds()
Sets bounds for the editing circles (hover and drag indicators).
Definition line_editor.cpp:869
void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Definition line_editor.cpp:629
virtual void mouseDoubleClick(const MouseEvent &e) override
Definition line_editor.cpp:517
LineGenerator * getModel()
Gets the current LineGenerator model.
Definition line_editor.h:357
bool hasMatchingSystemClipboard()
Checks if the system clipboard contains a compatible line data JSON.
Definition line_editor.cpp:353
void destroy(OpenGlWrapper &open_gl) override
Destroys OpenGL resources allocated by this line renderer.
Definition line_editor.cpp:975
void drawDrag(const MouseEvent &e)
Handles mouse dragging to move points or adjust powers.
Definition line_editor.cpp:591
float padY(float y)
Pads a Y coordinate to fit the drawing area with vertical padding.
Definition line_editor.cpp:729
int getActivePower()
Gets the currently active power handle index.
Definition line_editor.h:450
static constexpr float kRingThickness
Fractional thickness for marker ring rendering.
Definition line_editor.h:34
void drawUp(const MouseEvent &e)
Handles mouse release to finalize point or power positions.
Definition line_editor.cpp:610
virtual void enableTemporaryPaintToggle(bool toggle)
Temporarily enables or disables paint mode using a toggle (e.g., via a modifier key).
Definition line_editor.cpp:1080
static constexpr float kPaddingY
Vertical padding in pixels.
Definition line_editor.h:54
MenuOptions
Context menu options available in the line editor.
Definition line_editor.h:67
@ kFlipHorizontal
Definition line_editor.h:77
@ kRemovePoint
Definition line_editor.h:75
@ kSave
Definition line_editor.h:71
@ kEnterValue
Definition line_editor.h:73
@ kCancel
Definition line_editor.h:68
@ kInit
Definition line_editor.h:76
@ kResetPower
Definition line_editor.h:74
@ kEnterPhase
Definition line_editor.h:72
@ kCopy
Definition line_editor.h:69
@ kNumMenuOptions
Definition line_editor.h:79
@ kPaste
Definition line_editor.h:70
@ kFlipVertical
Definition line_editor.h:78
void paintLine(const MouseEvent &e)
Paints the line by adding points according to a pattern when in paint mode.
Definition line_editor.cpp:364
float sizeRatio() const
Gets the current size ratio.
Definition line_editor.h:294
static constexpr int kNumWrapPoints
Number of wrap points for looping lines.
Definition line_editor.h:43
static constexpr float kDragRadius
Radius in pixels for dragging a point or power handle.
Definition line_editor.h:38
int getGridSizeY()
Gets the current vertical grid size.
Definition line_editor.h:346
static constexpr float kPositionWidth
Width in pixels for main position markers.
Definition line_editor.h:30
void mouseExit(const MouseEvent &e) override
Definition line_editor.cpp:624
float unpadY(float y)
Removes padding from a padded Y coordinate.
Definition line_editor.cpp:734
void setAllowFileLoading(bool allow)
Allows or disallows file loading actions (copy/paste from files).
Definition line_editor.h:382
void setSizeRatio(float ratio)
Sets the size ratio, scaling UI elements accordingly.
Definition line_editor.h:288
void setGlPositions()
Updates OpenGL buffers with the latest positions if needed.
Definition line_editor.cpp:963
force_inline void resetPositions()
Marks positions as needing recalculation on next render.
Definition line_editor.h:399
void setModel(LineGenerator *model)
Sets the LineGenerator model defining the curve.
Definition line_editor.h:352
void drawDown(const MouseEvent &e)
Handles the initial mouse press (not in paint mode) for dragging points or powers.
Definition line_editor.cpp:497
static constexpr float kPowerMouseMultiplier
Multiplier for mouse movements when adjusting power handles.
Definition line_editor.h:59
OpenGlComponent * getTextEditorComponent()
Gets the OpenGlComponent for text editing (if any).
Definition line_editor.h:405
void setGridPositions()
Calculates and sets positions for grid lines.
Definition line_editor.cpp:898
static constexpr float kPowerWidth
Width in pixels for power markers (curve shaping handles).
Definition line_editor.h:32
virtual void mouseMove(const MouseEvent &e) override
Definition line_editor.cpp:557
virtual void respondToCallback(int point, int power, int option)
Responds to a callback triggered by a menu option or action.
Definition line_editor.cpp:287
void setActive(bool active)
Sets whether the line editor is active (enabled).
Definition line_editor.h:394
void setPaint(bool paint)
Enables or disables paint mode.
Definition line_editor.cpp:985
void drawPosition(OpenGlWrapper &open_gl, Colour color, float fraction_x)
Draws a position marker at a specific fraction of the X-axis.
Definition line_editor.cpp:838
int getActivePoint()
Gets the currently active point index.
Definition line_editor.h:444
int getGridSizeX()
Gets the current horizontal grid size.
Definition line_editor.h:341
virtual void mouseDrag(const MouseEvent &e) override
Definition line_editor.cpp:582
void hideTextEntry()
Hides the text entry editor.
Definition line_editor.cpp:991
int getActiveGridSection()
Gets the currently active grid section index for painting.
Definition line_editor.h:456
float padX(float x)
Pads an X coordinate to fit the drawing area with horizontal padding.
Definition line_editor.cpp:739
void textEditorEscapeKeyPressed(TextEditor &editor) override
Definition line_editor.cpp:1023
LineEditor(LineGenerator *line_source)
Constructs the LineEditor.
Definition line_editor.cpp:21
void renderPoints(OpenGlWrapper &open_gl, bool animate)
Renders the points and power handles on the curve.
Definition line_editor.cpp:768
void setPaintPattern(std::vector< std::pair< float, float > > pattern)
Sets a pattern of points used when painting the line.
Definition line_editor.h:324
virtual void mouseDown(const MouseEvent &e) override
Definition line_editor.cpp:455
std::vector< Listener * > listeners_
Definition line_editor.h:482
void textEditorFocusLost(TextEditor &editor) override
Definition line_editor.cpp:1019
virtual ~LineEditor()
Destructor.
Definition line_editor.cpp:87
static constexpr int kMaxGridSizeX
Maximum grid sizes for horizontal and vertical lines.
Definition line_editor.h:50
void textEditorReturnKeyPressed(TextEditor &editor) override
Definition line_editor.cpp:1015
float unpadX(float x)
Removes padding from a padded X coordinate.
Definition line_editor.cpp:746
static constexpr float kGrabRadius
Radius in pixels for detecting grabbing a point or power handle.
Definition line_editor.h:36
A class for generating and storing a line shape, defined by a series of points and associated powers.
Definition line_generator.h:20
force_inline bool smooth() const
Indicates whether smoothing is enabled.
Definition line_generator.h:280
void setSmooth(bool smooth)
Enables or disables smoothing behavior.
Definition line_generator.h:96
static constexpr int kMaxPoints
Maximum number of points that can define the line.
Definition line_generator.h:25
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
force_inline Colour color() const
Gets the current line color.
Definition open_gl_line_renderer.h:189
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
#define force_inline
Definition common.h:23
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
Defines the SynthModule class which extends ProcessorRouter to form a building block of the Vital syn...