46 for (
Listener* listener : listeners_)
47 listener->componentsScrolled();
49 Viewport::visibleAreaChanged(newVisibleArea);
53 std::vector<Listener*> listeners_;
291 void scrollBarMoved(ScrollBar* scroll_bar,
double range_start)
override;
298 void scroll(
const MouseEvent& e,
const MouseWheelDetails& wheel) {
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
A base class representing a component in a wavetable synthesis chain.
Definition wavetable_component.h:32
Interface for objects wanting to know when the component list changes.
Definition wavetable_component_list.h:86
virtual void componentAdded(WavetableComponent *component)=0
Called when a component is added.
virtual void componentsChanged()=0
Called when components change (e.g., after add/remove/reset).
virtual void componentsScrolled(int offset)
Called when components are scrolled.
Definition wavetable_component_list.h:116
virtual void componentsReordered()=0
Called when components are reordered.
virtual void componentRemoved(WavetableComponent *component)=0
Called when a component is removed.
virtual ~Listener()
Definition wavetable_component_list.h:88
A UI component that lists and manages the wavetable sources and modifiers.
Definition wavetable_component_list.h:65
void paintBackground(Graphics &g) override
Overridden to paint the background and related elements.
Definition wavetable_component_list.cpp:111
std::unique_ptr< OpenGlToggleButton > add_modifier_buttons_[kMaxSources]
Buttons to add modifiers.
Definition wavetable_component_list.h:330
void moveModifierUp()
Moves the currently selected modifier up in its group.
Definition wavetable_component_list.cpp:450
int current_component_index_
The currently selected component index.
Definition wavetable_component_list.h:324
std::unique_ptr< PlainShapeComponent > plus_icons_[kMaxSources+1]
Plus icons next to buttons.
Definition wavetable_component_list.h:331
int numGroups()
Returns the number of groups in the wavetable.
Definition wavetable_component_list.h:262
int row_height_
Height of each row in pixels.
Definition wavetable_component_list.h:332
WavetableComponentViewport viewport_
Viewport for scrolling the component list.
Definition wavetable_component_list.h:318
void modifierMenuClicked(int row_index)
Displays a menu for the modifier row at the given index.
Definition wavetable_component_list.cpp:275
void addComponent(int type)
Adds a new component (modifier) of the given type.
Definition wavetable_component_list.cpp:383
void addListener(Listener *listener)
Adds a listener interested in component changes.
Definition wavetable_component_list.h:150
void positionGroups()
Positions the groups and modifiers in the scrollable list.
Definition wavetable_component_list.cpp:150
std::unique_ptr< OpenGlScrollBar > scroll_bar_
A custom scrollbar for vertical scrolling.
Definition wavetable_component_list.h:320
void moveModifierDown()
Moves the currently selected modifier down in its group.
Definition wavetable_component_list.cpp:459
std::unique_ptr< OpenGlShapeButton > menu_buttons_[kMaxRows]
Menu buttons for each row.
Definition wavetable_component_list.h:328
void menuClicked(int row_index)
Displays a general menu for the given row index, determining if it's a group or modifier.
Definition wavetable_component_list.cpp:297
void buttonClicked(Button *button) override
Overridden to handle button clicks (menus, add source/modifier).
Definition wavetable_component_list.cpp:330
WavetableComponentList(WavetableCreator *wavetable_creator)
Constructs a WavetableComponentList for managing sources and modifiers.
Definition wavetable_component_list.cpp:38
std::unique_ptr< PlainTextComponent > names_[kMaxRows]
Text labels for each component row.
Definition wavetable_component_list.h:327
void scroll(const MouseEvent &e, const MouseWheelDetails &wheel)
Scrolls the viewport by mouse wheel.
Definition wavetable_component_list.h:298
void groupMenuClicked(int row_index)
Displays a menu for the group row at the given index.
Definition wavetable_component_list.cpp:253
void init()
Initializes the component list after construction.
Definition wavetable_component_list.cpp:107
static constexpr int kMaxSources
Maximum number of source groups.
Definition wavetable_component_list.h:68
std::vector< Listener * > listeners_
Listeners for changes in the component list.
Definition wavetable_component_list.h:325
void addSource(int index)
Adds a new source of the given index (maps to a component type).
Definition wavetable_component_list.cpp:361
void removeGroup()
Removes the currently selected group.
Definition wavetable_component_list.cpp:418
void componentsScrolled() override
Called when the components are scrolled.
Definition wavetable_component_list.cpp:349
WavetableCreator * wavetable_creator_
The wavetable creator managing group/components.
Definition wavetable_component_list.h:322
void notifyComponentAdded(WavetableComponent *component)
Notifies listeners that a component was added.
Definition wavetable_component_list.cpp:469
void addModifierClicked(int group_index)
Called when the "Add Modifier" button is clicked for a particular group.
Definition wavetable_component_list.cpp:304
Component component_container_
Container holding all UI elements for the list.
Definition wavetable_component_list.h:319
void removeComponent()
Removes the currently selected component.
Definition wavetable_component_list.cpp:397
void moveGroupUp()
Moves the currently selected group up in the list.
Definition wavetable_component_list.cpp:432
std::unique_ptr< OpenGlToggleButton > create_component_button_
Button to add a new source.
Definition wavetable_component_list.h:329
void notifyComponentRemoved(WavetableComponent *component)
Notifies listeners that a component was removed.
Definition wavetable_component_list.cpp:475
OpenGlMultiQuad component_backgrounds_
Background rectangles for each row.
Definition wavetable_component_list.h:326
void setRowHeight(int row_height)
Sets the height of each row in the list.
Definition wavetable_component_list.h:156
std::pair< int, int > getIndicesForRow(int row_index)
Retrieves the group and component indices for a given row index.
Definition wavetable_component_list.cpp:239
void setScrollBarRange()
Sets the scrollbar range based on content size.
Definition wavetable_component_list.cpp:234
int current_group_index_
The currently selected group index.
Definition wavetable_component_list.h:323
void moveGroupDown()
Moves the currently selected group down in the list.
Definition wavetable_component_list.cpp:441
static constexpr int kMaxRows
Maximum number of rows for components.
Definition wavetable_component_list.h:67
void resetGroups()
Resets the display of groups and modifiers in the UI.
Definition wavetable_component_list.cpp:131
void addSourceClicked()
Called when the "Add Source" button is clicked.
Definition wavetable_component_list.cpp:318
void notifyComponentsReordered()
Notifies listeners that components have been reordered.
Definition wavetable_component_list.cpp:481
void resized() override
Overridden to layout and refresh the UI.
Definition wavetable_component_list.cpp:123
void scrollBarMoved(ScrollBar *scroll_bar, double range_start) override
Called when the scroll bar moves.
Definition wavetable_component_list.cpp:357
void clear()
Clears the list of sources and modifiers.
Definition wavetable_component_list.cpp:103
void notifyComponentsChanged()
Notifies listeners that components have changed.
Definition wavetable_component_list.cpp:487
ComponentRowMenu
Menu options for component rows.
Definition wavetable_component_list.h:74
@ kMoveUp
Definition wavetable_component_list.h:77
@ kReset
Definition wavetable_component_list.h:76
@ kRemove
Definition wavetable_component_list.h:79
@ kRowCancel
Definition wavetable_component_list.h:75
@ kMoveDown
Definition wavetable_component_list.h:78
void resetComponent()
Resets the currently selected component to default state.
Definition wavetable_component_list.cpp:407
Interface for objects wanting to know when the viewport scrolls.
Definition wavetable_component_list.h:26
virtual ~Listener()
Definition wavetable_component_list.h:28
virtual void componentsScrolled()=0
Called whenever the visible area changes, e.g., due to scrolling.
A Viewport subclass that notifies listeners when the visible area changes.
Definition wavetable_component_list.h:20
void visibleAreaChanged(const Rectangle< int > &newVisibleArea) override
Overridden to notify listeners when the visible area changes.
Definition wavetable_component_list.h:45
void addListener(Listener *listener)
Adds a listener that will be notified on scroll events.
Definition wavetable_component_list.h:39
A class responsible for creating complete wavetables from groups of wavetable components.
Definition wavetable_creator.h:27
int numGroups() const
Gets the total number of WavetableGroups.
Definition wavetable_creator.h:63
A class representing a group of WavetableComponents combined to form part of a wavetable.
Definition wavetable_group.h:24