35 virtual void barsChanged(
int start,
int end,
bool mouse_up) = 0;
111 void mouseMove(
const MouseEvent& e)
override;
117 void mouseDown(
const MouseEvent& e)
override;
123 void mouseUp(
const MouseEvent& e)
override;
129 void mouseDrag(
const MouseEvent& e)
override;
135 void mouseExit(
const MouseEvent& e)
override;
200 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
BarEditor)
Interface for receiving notifications when bar values are changed.
Definition bar_editor.h:24
virtual void barsChanged(int start, int end, bool mouse_up)=0
Called when bar values have changed.
virtual ~Listener()
Definition bar_editor.h:26
An interactive component that allows editing individual bars in a bar graph visually.
Definition bar_editor.h:18
void mouseExit(const MouseEvent &e) override
Handles mouse exit events. Clears hover state.
Definition bar_editor.cpp:78
void addListener(Listener *listener)
Adds a listener to receive updates when bars change.
Definition bar_editor.h:141
void clearOdd()
Clears every odd-indexed bar.
Definition bar_editor.cpp:125
void mouseDown(const MouseEvent &e) override
Handles mouse down events. Initiates editing or shows popup menu.
Definition bar_editor.cpp:35
Point< int > current_mouse_position_
Current mouse position.
Definition bar_editor.h:196
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the editor including the highlight of the currently hovered bar.
Definition bar_editor.h:80
void mouseDrag(const MouseEvent &e) override
Handles mouse drag events. Updates bar values while dragging.
Definition bar_editor.cpp:70
void mouseMove(const MouseEvent &e) override
Handles mouse move events to update hovered bar.
Definition bar_editor.cpp:31
void mouseUp(const MouseEvent &e) override
Handles mouse up events. Completes editing operation.
Definition bar_editor.cpp:58
virtual void resized() override
Called when the editor is resized.
Definition bar_editor.h:102
vital::utils::RandomGenerator random_generator_
Random generator for randomizing bars.
Definition bar_editor.h:194
float clear_value_
Value to clear bars to.
Definition bar_editor.h:199
virtual void destroy(OpenGlWrapper &open_gl) override
Destroys all OpenGL components.
Definition bar_editor.h:94
void changeValues(const MouseEvent &e)
Changes values based on mouse drag position.
Definition bar_editor.cpp:133
void clearLeft()
Clears bars to the left of the currently hovered bar.
Definition bar_editor.cpp:108
void clearRight()
Clears bars to the right of the currently hovered bar.
Definition bar_editor.cpp:99
BarEditorMenu
Popup menu actions for bar editing.
Definition bar_editor.h:42
@ kClearEven
Definition bar_editor.h:47
@ kClearLeft
Definition bar_editor.h:46
@ kRandomize
Definition bar_editor.h:49
@ kClearOdd
Definition bar_editor.h:48
@ kClear
Definition bar_editor.h:44
@ kCancel
Definition bar_editor.h:43
@ kClearRight
Definition bar_editor.h:45
void clearEven()
Clears every even-indexed bar.
Definition bar_editor.cpp:117
void setClearValue(float value)
Sets the value used when clearing bars.
Definition bar_editor.h:147
bool editing_
Whether the user is currently editing bars.
Definition bar_editor.h:198
int getHoveredIndex(Point< int > position)
Gets the index of the bar under the given position.
Definition bar_editor.cpp:172
virtual void init(OpenGlWrapper &open_gl) override
Initializes the OpenGL components used by this editor.
Definition bar_editor.h:70
OpenGlQuad editing_quad_
Quad used to highlight the hovered bar.
Definition bar_editor.h:193
void randomize()
Randomizes all bars using a uniform distribution.
Definition bar_editor.cpp:82
BarEditor(int num_points)
Constructs a BarEditor for a given number of bars.
Definition bar_editor.h:56
virtual ~BarEditor()
Destructor.
Definition bar_editor.h:64
void clear()
Clears all bars to the clear value.
Definition bar_editor.cpp:91
std::vector< Listener * > listeners_
List of listeners for bar changes.
Definition bar_editor.h:195
Point< int > last_edit_position_
Last position during editing for interpolation.
Definition bar_editor.h:197
A renderer for drawing a series of bars using OpenGL.
Definition bar_renderer.h:18
virtual void destroy(OpenGlWrapper &open_gl) override
Destroys any allocated OpenGL resources.
Definition bar_renderer.cpp:153
virtual void init(OpenGlWrapper &open_gl) override
Initializes the renderer with an OpenGL context.
Definition bar_renderer.cpp:57
int num_points_
Number of bars to render.
Definition bar_renderer.h:280
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the bars using the current OpenGL context.
Definition bar_renderer.cpp:149
float scale_
Scale factor for bar dimensions.
Definition bar_renderer.h:271
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL buffers and shader attributes.
Definition open_gl_multi_quad.cpp:37
void setQuad(int i, float x, float y, float w, float h)
Sets the position and size of a quad in normalized device space.
Definition open_gl_multi_quad.h:313
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the quads using OpenGL.
Definition open_gl_multi_quad.cpp:92
virtual void destroy(OpenGlWrapper &open_gl) override
Releases OpenGL resources when the component is destroyed.
Definition open_gl_multi_quad.cpp:69
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
@ kLightenScreen
Definition skin.h:141
A basic random number generator for producing uniform distributions of floats.
Definition utils.h:61
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Provides various utility functions, classes, and constants for audio, math, and general-purpose opera...