8 static constexpr float kTextHeightRatio = 0.6f;
11 if (findParentComponentOfClass<SynthGuiInterface>() ==
nullptr)
20 title_backgrounds_.
setColor(lighten);
21 float width = getWidth();
22 float line_width = 2.0f / width;
25 for (
int i = 0; i < line_positions_.size() && i <
kMaxLines; ++i)
26 lines_.
setQuad(i, line_positions_[i] * 2.0f / width - 1.0f, -1.0f, line_width, 2.0f);
31 int num_titles =
static_cast<int>(titles_.size());
32 int num_positions =
static_cast<int>(line_positions_.size());
34 float gl_title_height = title_height * 2.0f / getHeight();
36 for (
int i = 0; i < num_titles && i - 1 < num_positions; ++i) {
37 std::string title = titles_[i];
38 title_texts_[i]->setColor(text);
39 title_texts_[i]->setTextSize(title_height * kTextHeightRatio);
40 title_texts_[i]->setText(title);
41 title_texts_[i]->setActive(
true);
43 int start_position = 0;
44 int end_position = getWidth();
46 start_position = line_positions_[i - 1];
47 if (i < line_positions_.size())
48 end_position = line_positions_[i];
50 title_texts_[i]->setBounds(start_position, 0, end_position - start_position, title_height);
52 title_backgrounds_.
setQuad(i, -2.0f, -2.0f, 0.0f, 0.0f);
54 title_backgrounds_.
setQuad(i, start_position * 2.0f / getWidth() - 1.0f, 1.0f - gl_title_height,
55 (end_position - start_position) * 2.0f / getWidth(), gl_title_height);
58 title_texts_[i]->redrawImage(
true);
62 for (
int i = num_titles; i <=
kMaxLines; ++i) {
63 title_texts_[i]->setActive(
false);
89 listener->frameDoneEditing();
93 listener->frameChanged();
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
void setNumQuads(int num_quads)
Sets how many quads will actually be drawn (up to max_quads).
Definition open_gl_multi_quad.h:92
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
@ kWidgetPrimary1
Definition skin.h:165
@ kBodyText
Definition skin.h:133
@ kLightenScreen
Definition skin.h:141
@ kBody
Definition skin.h:129
A base class representing a component in a wavetable synthesis chain.
Definition wavetable_component.h:32
void setPositions()
Updates all OpenGL components and text positions after changes to lines or titles.
Definition wavetable_component_overlay.cpp:7
static constexpr int kMaxLines
Maximum possible lines for control divisions.
Definition wavetable_component_overlay.h:45
A listener interface for receiving changes to the wavetable overlay.
Definition wavetable_component_overlay.h:118
int getWidgetPadding()
Gets the widget padding.
Definition wavetable_component_overlay.cpp:109
void setComponent(WavetableComponent *component)
Sets the WavetableComponent that this overlay is editing.
Definition wavetable_component_overlay.cpp:81
static constexpr float kWidgetHeightForWidth
Definition wavetable_component_overlay.h:29
ControlsBackground controls_background_
Definition wavetable_component_overlay.h:300
virtual void setEditBounds(Rectangle< int > bounds)
Sets the editing bounds within which controls and titles are placed.
Definition wavetable_component_overlay.cpp:67
void resetOverlay()
Resets the overlay, clearing any associated component.
Definition wavetable_component_overlay.cpp:76
std::vector< Listener * > listeners_
Definition wavetable_component_overlay.h:301
static constexpr float kTitleHeightRatio
Definition wavetable_component_overlay.h:32
static constexpr float kTitleHeightForWidth
Ratio constants for layout and sizing.
Definition wavetable_component_overlay.h:28
int getDividerX()
Gets the x position of a divider line.
Definition wavetable_component_overlay.cpp:101
Rectangle< int > edit_bounds_
Definition wavetable_component_overlay.h:302
static constexpr float kDividerPoint
Definition wavetable_component_overlay.h:31
float getTitleHeight()
Gets the title height based on ratio and current edit bounds.
Definition wavetable_component_overlay.cpp:97
int getWidgetHeight()
Gets the widget height for controls.
Definition wavetable_component_overlay.cpp:105
WavetableComponent * current_component_
Definition wavetable_component_overlay.h:299
int controls_width_
Definition wavetable_component_overlay.h:303
void notifyChanged(bool mouse_up)
Notifies listeners that a change has occurred to the frame.
Definition wavetable_component_overlay.cpp:86
static void setOverlayOwner(WavetableComponentOverlay *overlay, WavetableComponent *owner)
Set the owner WavetableComponent of an already created overlay.
Definition wavetable_overlay_factory.cpp:42