24 setInterceptsMouseClicks(
false,
true);
136 virtual void wheelMoved(
const MouseEvent& e,
const MouseWheelDetails& wheel) { }
161 void mouseDown(
const MouseEvent& event)
override;
167 void mouseDrag(
const MouseEvent& event)
override;
173 void mouseUp(
const MouseEvent& event)
override;
185 void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override {
186 for (
Listener* listener : listeners_)
187 listener->wheelMoved(e, wheel);
237 listeners_.erase(std::find(listeners_.begin(), listeners_.end(), listener));
265 clearVisibleFrames();
266 currently_selected_.clear();
273 recreateVisibleFrames();
283 void clearVisibleFrames();
284 void recreateVisibleFrames();
285 void repositionVisibleFrames();
290 void createKeyframeAtPosition(Point<int> position);
292 void selectFrames(std::vector<WavetableKeyframe*> keyframes);
293 void positionSelectionBox(
const MouseEvent& event);
295 void setFrameQuads();
297 int getRowFromY(
int y);
298 int getPositionFromX(
int x);
299 int getUnclampedPositionFromX(
int x);
303 std::vector<Listener*> listeners_;
304 std::map<WavetableKeyframe*, std::unique_ptr<DraggableFrame>> frame_lookup_;
312 Point<int> mouse_down_position_;
313 Point<int> menu_created_position_;
314 std::vector<WavetableKeyframe*> currently_selected_;
316 int dragged_start_x_;
318 int draw_vertical_offset_;
319 int playhead_position_;
A visual frame representing a single wavetable keyframe, which can be dragged by the user.
Definition wavetable_organizer.h:17
bool full_frame_
Definition wavetable_organizer.h:57
bool fullFrame() const
Determines if the frame represents a full row or a small diamond.
Definition wavetable_organizer.h:41
DraggableFrame(bool full_frame=false)
Constructs a DraggableFrame.
Definition wavetable_organizer.h:23
bool selected_
Definition wavetable_organizer.h:56
force_inline bool selected() const
Checks if the frame is currently selected.
Definition wavetable_organizer.h:53
force_inline void select(bool selected)
Sets the frame's selection state.
Definition wavetable_organizer.h:47
bool isInside(int x, int y)
Checks if a point is inside the frame's clickable area.
Definition wavetable_organizer.cpp:16
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
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
A class responsible for creating complete wavetables from groups of wavetable components.
Definition wavetable_creator.h:27
Represents a single state of a waveform at a specific position in a wavetable.
Definition wavetable_keyframe.h:35
Interface for objects that need to respond to organizer events.
Definition wavetable_organizer.h:109
virtual void wheelMoved(const MouseEvent &e, const MouseWheelDetails &wheel)
Called when the mouse wheel is moved over the organizer.
Definition wavetable_organizer.h:136
virtual void positionsUpdated()
Called when keyframe positions or arrangement changes.
Definition wavetable_organizer.h:116
virtual void frameSelected(WavetableKeyframe *keyframe)=0
Called when a frame is selected.
virtual void frameDragged(WavetableKeyframe *keyframe, int position)=0
Called when a frame is being dragged by the user.
virtual ~Listener()
Definition wavetable_organizer.h:111
Manages the display and interaction of wavetable keyframes and groups on a timeline.
Definition wavetable_organizer.h:72
static constexpr int kMaxKeyframes
Definition wavetable_organizer.h:78
void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Called when the mouse wheel is moved. Passes wheel movements to listeners for additional behaviors (l...
Definition wavetable_organizer.h:185
void componentsChanged() override
Called when components change (e.g. frames added/removed). Refreshes the displayed frames.
Definition wavetable_organizer.h:217
void componentsScrolled(int offset) override
Called when components are scrolled via the WavetableComponentList. Adjusts vertical offset of rows.
Definition wavetable_organizer.cpp:546
void createKeyframeAtMenu()
Shows a menu to create a keyframe at a specific position.
Definition wavetable_organizer.cpp:259
void mouseDrag(const MouseEvent &event) override
Called as the mouse is dragged. Used for dragging frames or adjusting selection rectangles.
Definition wavetable_organizer.cpp:387
void resized() override
Handles resizing and rearranges the displayed frames and rows.
Definition wavetable_organizer.cpp:91
void selectDefaultFrame()
Selects a default frame (usually the first one) if available.
Definition wavetable_organizer.cpp:145
void componentsReordered() override
Called when components are reordered. Refreshes visuals.
Definition wavetable_organizer.h:211
void paintBackground(Graphics &g) override
Paints the background, including a grid and handle areas.
Definition wavetable_organizer.cpp:59
MouseMode
The current mouse interaction mode used by the organizer.
Definition wavetable_organizer.h:94
@ kNumMouseModes
Definition wavetable_organizer.h:99
@ kDragging
Definition wavetable_organizer.h:97
@ kSelecting
Definition wavetable_organizer.h:96
@ kWaiting
Definition wavetable_organizer.h:95
@ kRightClick
Definition wavetable_organizer.h:98
static constexpr int kDrawSkipLarge
Definition wavetable_organizer.h:77
void componentAdded(WavetableComponent *component) override
Called when a component is added to the wavetable. Updates frame display accordingly.
Definition wavetable_organizer.cpp:538
static constexpr int kDrawSkip
Definition wavetable_organizer.h:76
WavetableOrganizer(WavetableCreator *wavetable_creator, int max_frames)
Constructs a WavetableOrganizer.
Definition wavetable_organizer.cpp:22
void removeListener(Listener *listener)
Removes a previously added listener.
Definition wavetable_organizer.h:236
void clear()
Clears all visible frames and selection.
Definition wavetable_organizer.h:264
virtual ~WavetableOrganizer()
Definition wavetable_organizer.cpp:53
void playheadMoved(int position) override
Called when the playhead moves, updates the visual playhead position.
Definition wavetable_organizer.cpp:518
void mouseUp(const MouseEvent &event) override
Called when the mouse button is released. Finalizes drags, completes selections, or handles context m...
Definition wavetable_organizer.cpp:427
void deleteSelectedKeyframes()
Deletes all currently selected keyframes.
Definition wavetable_organizer.cpp:250
OrganizerMenu
Menu actions available in the organizer context menus.
Definition wavetable_organizer.h:84
@ kCreate
Definition wavetable_organizer.h:86
@ kCancel
Definition wavetable_organizer.h:85
@ kRemove
Definition wavetable_organizer.h:87
static constexpr float kHandleHeightPercent
Fraction of the total height used for the handle area.
Definition wavetable_organizer.h:75
void componentRemoved(WavetableComponent *component) override
Called when a component is removed from the wavetable. Ensures selected frames are updated accordingl...
Definition wavetable_organizer.cpp:525
void addListener(Listener *listener)
Adds a listener for organizer events.
Definition wavetable_organizer.h:230
void mouseDoubleClick(const MouseEvent &event) override
Called on a double-click. Used for quickly adding or removing keyframes.
Definition wavetable_organizer.cpp:501
void mouseDown(const MouseEvent &event) override
Called when the mouse button is pressed. Used for selecting frames, starting drags,...
Definition wavetable_organizer.cpp:369
void init()
Initializes the organizer and sets up frames.
Definition wavetable_organizer.h:272
int handleWidth() const
Gets the width of the handle area for rows.
Definition wavetable_organizer.cpp:246
bool hasSelectedFrames() const
Checks if there is at least one selected frame.
Definition wavetable_organizer.h:280
A listener interface for objects interested in playhead position changes.
Definition wavetable_playhead.h:31
#define force_inline
Definition common.h:23
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...