21 if (button_->getToggleState() && use_on_colors_) {
23 active_color = on_down_color_;
25 active_color = on_normal_color_;
27 hover_color = on_hover_color_;
31 active_color = off_down_color_;
33 active_color = off_normal_color_;
35 hover_color = off_hover_color_;
39 active_color = active_color.interpolatedWith(hover_color, hover_amount_);
42 shape_.
render(open_gl, animate);
48 hover_amount_ = std::min(1.0f, hover_amount_ +
kHoverInc);
50 hover_amount_ = std::max(0.0f, hover_amount_ -
kHoverInc);
127 active_color = active_color.interpolatedWith(hover_color,
hover_amount_);
148 static constexpr float kPowerRadius = 0.45f;
149 static constexpr float kPowerHoverRadius = 0.65f;
156 background_.
setQuad(0, -kPowerRadius, -kPowerRadius, 2.0f * kPowerRadius, 2.0f * kPowerRadius);
161 background_.
setQuad(0, -kPowerHoverRadius, -kPowerHoverRadius, 2.0f * kPowerHoverRadius, 2.0f * kPowerHoverRadius);
176 bool enabled =
button_->isEnabled();
185 if (!
down_ && enabled)
196 float border_x = 4.0f /
button_->getWidth();
197 float border_y = 4.0f /
button_->getHeight();
198 background_.
setQuad(0, -1.0f + border_x, -1.0f + border_y, 2.0f - 2.0f * border_x, 2.0f - 2.0f * border_y);
212 bool enabled =
button_->isEnabled();
221 if (!
down_ && enabled)
239 static constexpr float kUiButtonSizeMult = 0.45f;
241 ToggleButton::resized();
242 SynthSection* section = findParentComponentOfClass<SynthSection>();
266 OpenGlToggleButton::clicked(modifiers);
268 if (!modifiers.isPopupMenu()) {
270 listener->guiChanged(
this);
278 int lookup = on ? 1 : 0;
281 return string_lookup_[lookup];
290 if (parent ==
nullptr)
306 if (parent ==
nullptr)
311 if (e.mods.isPopupMenu()) {
319 SynthSection* parent = findParentComponentOfClass<SynthSection>();
320 parent->
showPopupSelector(
this, e.getPosition(), options, [=](
int selection) { handlePopupResult(selection); });
332 if (!e.mods.isPopupMenu()) {
344 button_listeners_.push_back(listener);
float findValue(Skin::ValueId value_id)
Finds a float value from the skin associated with this component's parent.
Definition open_gl_component.cpp:173
bool isActive() const
Checks if this component is currently active.
Definition open_gl_image_component.h:131
void setColor(Colour color)
Sets a color tint for the image.
Definition open_gl_image_component.h:101
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the image using OpenGL.
Definition open_gl_image_component.cpp:61
void markDirty()
Marks all vertex data as dirty, prompting a refresh on the next render.
Definition open_gl_multi_quad.h:78
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
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
void setRounding(float rounding)
Sets the rounding radius of the quads.
Definition open_gl_multi_quad.h:347
@ kLight
Definition open_gl_image_component.h:309
void setTextSize(float size)
Sets the size of the text in points.
Definition open_gl_image_component.h:372
void setFontType(FontType font_type)
Sets the font type (Title, Light, Regular, Mono).
Definition open_gl_image_component.h:381
@ kButtonFontSize
Definition skin.h:88
@ kLabelBackgroundRounding
Definition skin.h:74
@ kUiButtonPressed
Definition skin.h:195
@ kUiButtonText
Definition skin.h:193
@ kIconButtonOff
Definition skin.h:185
@ kIconButtonOn
Definition skin.h:188
@ kUiActionButton
Definition skin.h:196
@ kPowerButtonOff
Definition skin.h:138
@ kUiButtonHover
Definition skin.h:194
@ kPowerButtonOn
Definition skin.h:137
@ kIconButtonOffHover
Definition skin.h:186
@ kLightenScreen
Definition skin.h:141
@ kUiActionButtonHover
Definition skin.h:197
@ kUiActionButtonPressed
Definition skin.h:198
@ kUiButton
Definition skin.h:192
@ kOverlayScreen
Definition skin.h:140
@ kIconButtonOffPressed
Definition skin.h:187
@ kIconButtonOnPressed
Definition skin.h:190
@ kTextComponentBackground
Definition skin.h:147
@ kIconButtonOnHover
Definition skin.h:189
@ kBody
Definition skin.h:129
A base class providing foundational functionality for the Vital synthesizer’s engine,...
Definition synth_base.h:42
virtual void beginChangeGesture(const std::string &name)
Called when a parameter change gesture begins. Typically not implemented in this base class.
Definition synth_base.h:356
bool isMidiMapped(const std::string &name)
Checks if a given parameter name is MIDI mapped.
Definition synth_base.cpp:677
virtual void endChangeGesture(const std::string &name)
Called when a parameter change gesture ends. Typically not implemented in this base class.
Definition synth_base.h:363
void clearMidiLearn(const std::string &name)
Clears the MIDI mapping for a given parameter name.
Definition synth_base.cpp:673
void armMidiLearn(const std::string &name)
Arms the given parameter name for MIDI learn, associating the next received MIDI control with it.
Definition synth_base.cpp:665
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
SynthBase * getSynth()
Returns the SynthBase instance this interface is managing.
Definition synth_gui_interface.h:85
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
void showPopupSelector(Component *source, Point< int > position, const PopupItems &options, std::function< void(int)> callback, std::function< void()> cancel={ })
Shows a popup selector with options.
Definition synth_section.cpp:119
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
static const bool isParameter(const std::string &name)
Definition synth_parameters.h:220
const std::string kOffOnNames[]
Off/On state names.
Definition synth_strings.h:18
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174