12 portamento_ = std::make_unique<SynthSlider>(
"portamento_time");
14 portamento_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
17 portamento_slope_ = std::make_unique<SynthSlider>(
"portamento_slope");
19 portamento_slope_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
23 portamento_scale_ = std::make_unique<SynthButton>(
"portamento_scale");
25 portamento_scale_->setButtonText(
"OCTAVE SCALE");
29 portamento_force_ = std::make_unique<SynthButton>(
"portamento_force");
31 portamento_force_->setButtonText(
"ALWAYS GLIDE");
35 legato_ = std::make_unique<SynthButton>(
"legato");
36 legato_->setButtonText(
"LEGATO");
51 portamento_->drawShadow(g);
57 Rectangle<int> slope_bounds = portamento_slope_->getBounds().withBottom(getHeight() -
getWidgetMargin());
59 drawLabel(g, TRANS(
"SLOPE"), slope_bounds,
true);
65 int height = getHeight();
66 int buttons_width = 3 * getWidth() / 8;
67 int buttons_x = getWidth() - buttons_width;
69 int internal_margin = widget_margin / 2;
70 float button_height = (height - 2 * (widget_margin + internal_margin)) / 3.0f;
73 portamento_force_->setBounds(buttons_x, widget_margin, buttons_width - widget_margin, button_height);
74 legato_->setBounds(buttons_x, height - widget_margin - button_height,
75 buttons_width - widget_margin, button_height);
76 portamento_scale_->setBounds(buttons_x, portamento_force_->getBottom() + internal_margin,
77 buttons_width - widget_margin,
78 legato_->getY() - portamento_force_->getBottom() - 2 * internal_margin);
81 Rectangle<int> knobs_bounds(0, 0, buttons_x, height);
82 placeKnobsInArea(knobs_bounds, { portamento_.get(), portamento_slope_.get() });
84 Rectangle<int> slope_bounds = portamento_slope_->getBounds().withTop(
getWidgetMargin());
87 portamento_slope_->setBounds(slope_bounds.withBottom(bottom));
93 if (changed_slider == portamento_.get())
94 portamento_slope_->setActive(portamento_->getValue() != portamento_->getMinimum());
102 portamento_slope_->setActive(portamento_->getValue() != portamento_->getMinimum());
static CurveLookAndFeel * instance()
Gets the singleton instance of CurveLookAndFeel.
Definition curve_look_and_feel.h:52
virtual ~PortamentoSection()
Destructor.
Definition portamento_section.cpp:43
void setAllValues(vital::control_map &controls) override
Sets all parameter values from a given control map.
Definition portamento_section.cpp:99
void paintBackground(Graphics &g) override
Paints the background of the portamento section, including labels and backgrounds.
Definition portamento_section.cpp:45
void sliderValueChanged(Slider *changed_slider) override
Called when a slider value changes to update dependent controls.
Definition portamento_section.cpp:91
void resized() override
Called when the component is resized. Lays out sliders and buttons.
Definition portamento_section.cpp:64
PortamentoSection(String name)
Constructs a new PortamentoSection with a given name.
Definition portamento_section.cpp:10
@ kWidgetMargin
Definition skin.h:103
@ kKeyboard
Definition skin.h:44
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
void drawTextComponentBackground(Graphics &g, Rectangle< int > bounds, bool extend_to_label)
Draws a background for a text component area.
Definition synth_section.cpp:319
void placeKnobsInArea(Rectangle< int > area, std::vector< Component * > knobs)
Definition synth_section.cpp:601
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
void paintOpenGlChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all OpenGL child components.
Definition synth_section.cpp:267
void drawLabel(Graphics &g, String text, Rectangle< int > component_bounds, bool text_component=false)
Draws a label text below a component.
Definition synth_section.cpp:789
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
virtual void paintBody(Graphics &g, Rectangle< int > bounds)
Paints the body background within given bounds.
Definition synth_section.cpp:165
void drawLabelForComponent(Graphics &g, String text, Component *component, bool text_component=false)
Draws a label for a given component.
Definition synth_section.h:548
void setLabelFont(Graphics &g)
Sets the Graphics context font and color for labels.
Definition synth_section.cpp:740
void addButton(OpenGlToggleButton *button, bool show=true)
Definition synth_section.cpp:428
Rectangle< int > getLabelBackgroundBounds(Rectangle< int > bounds, bool text_component=false)
Gets the background bounds for a label.
Definition synth_section.cpp:782
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
virtual void paintBorder(Graphics &g, Rectangle< int > bounds)
Paints the border around given bounds.
Definition synth_section.cpp:170
virtual void sliderValueChanged(Slider *moved_slider) override
Called when a slider value changes. Updates the synth parameter accordingly.
Definition synth_section.cpp:391
virtual void setAllValues(vital::control_map &controls)
Sets values for all known parameters from a control map.
Definition synth_section.cpp:827
void setSkinOverride(Skin::SectionOverride skin_override)
Definition synth_section.h:303
float getWidgetMargin()
Definition synth_section.cpp:676
static TextLookAndFeel * instance()
Singleton instance access.
Definition text_look_and_feel.h:106
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...