41 this->name = std::move(
name);
42 this->items = std::move(
items);
51 void addItem(
int sub_id,
const std::string& sub_name,
bool sub_selected =
false) {
52 items.emplace_back(sub_id, sub_name, sub_selected, std::vector<PopupItems>());
65 int size()
const {
return static_cast<int>(
items.size()); }
96 static constexpr float kRotationMult = 0.05f;
97 static constexpr float kWidthFrequency = 0.025f;
98 static constexpr float kMinRads = 0.6f;
99 static constexpr float kMaxRads = 4.0f;
100 static constexpr float kRadRange = kMaxRads - kMinRads;
101 static constexpr float kCompleteSpeed = 0.15f;
102 static constexpr float kStartRads = -
vital::kPi - 0.05f;
107 float width = (sinf(tick_ * kWidthFrequency) * 0.5f + 0.5f) * kRadRange + kMinRads;
110 width += kCompleteSpeed * complete_ticks_;
156 const DropShadow shadow(findColour(
Skin::kShadow,
true), 10.0f, Point<int>(0, 0));
158 logo_letter_.applyTransform(logo_letter_.getTransformToScaleToFit(getLocalBounds().toFloat(),
true));
159 logo_ring_.applyTransform(logo_ring_.getTransformToScaleToFit(getLocalBounds().toFloat(),
true));
161 shadow.drawForPath(g, logo_letter_);
162 shadow.drawForPath(g, logo_ring_);
168 ColourGradient letter_gradient(letter_top_color, 0.0f, 12.0f, letter_bottom_color, 0.0f, 96.0f,
false);
169 ColourGradient ring_gradient(ring_top_color, 0.0f, 12.0f, ring_bottom_color, 0.0f, 96.0f,
false);
170 g.setGradientFill(letter_gradient);
171 g.fillPath(logo_letter_);
173 g.setGradientFill(ring_gradient);
174 g.fillPath(logo_ring_);
181 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
AppLogo)
265 virtual void reset();
270 virtual void resized()
override;
276 virtual void paint(Graphics& g)
override;
320 String extensions, std::string passthrough_name, std::string additional_folders_name);
337 std::function<
void(
int)> callback, std::function<
void()> cancel = { });
348 const PopupItems& options, std::function<
void(
int)> callback);
358 BubbleComponent::BubblePlacement placement,
bool primary);
401 virtual void paintBody(Graphics& g, Rectangle<int> bounds);
408 virtual void paintBorder(Graphics& g, Rectangle<int> bounds);
502 Rectangle<int>
getDividedAreaBuffered(Rectangle<int> full_area,
int num_sections,
int section,
int buffer);
539 void drawLabel(Graphics& g, String text, Rectangle<int> component_bounds,
bool text_component =
false);
549 drawLabel(g, std::move(text), component->getBounds(), text_component);
785 void paintJointControl(Graphics& g,
int x,
int y,
int width,
int height,
const std::string& name);
825 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
SynthSection)
Displays the application's logo using paths and gradients.
Definition synth_section.h:140
void paint(Graphics &g) override
Paints the logo's letter and ring with gradients and shadows.
Definition synth_section.h:155
AppLogo(String name)
Constructs an AppLogo with a given name.
Definition synth_section.h:146
An OpenGlQuad subclass that displays a rotating "loading" animation.
Definition synth_section.h:75
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the loading animation, updating the arc width and position over time.
Definition synth_section.h:95
void completeRing()
Transitions the loading wheel to the "complete" state where it fully expands the arc.
Definition synth_section.h:124
void resized() override
Called when the component is resized.
Definition synth_section.h:81
LoadingWheel()
Definition synth_section.h:77
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
virtual void render(OpenGlWrapper &open_gl, bool animate)=0
Pure virtual function to render the component using OpenGL.
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
A component that uses OpenGL to render a cached image of a JUCE component or custom drawing.
Definition open_gl_image_component.h:18
void setShaderValue(int i, float shader_value, int value_index=0)
Sets a shader value for all four vertices of a quad.
Definition open_gl_multi_quad.h:254
force_inline void setAltColor(Colour color)
Sets an alternate color, often used by custom shaders.
Definition open_gl_multi_quad.h:118
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
force_inline void setStartPos(float pos)
Sets a starting position used by some shaders (e.g., arc start).
Definition open_gl_multi_quad.h:150
force_inline void setModColor(Colour color)
Sets a modulation color for custom effects in the shader.
Definition open_gl_multi_quad.h:126
void setAlpha(float alpha, bool reset=false)
Sets the alpha blending multiplier, can reset to this alpha.
Definition open_gl_multi_quad.h:382
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
static Path vitalV()
Creates the Vital 'V' logo path.
Definition paths.h:50
static Path vitalRing()
Creates the Vital ring logo path.
Definition paths.h:39
A UI component for selecting presets within the synthesizer.
Definition preset_selector.h:14
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
Manages the overall color and value theme (or "skin") of the user interface.
Definition skin.h:24
ValueId
Identifiers for various UI scaling/spacing values and configuration constants.
Definition skin.h:70
@ kWidgetAccent1
Definition skin.h:171
@ kWidgetPrimary2
Definition skin.h:166
@ kWidgetPrimary1
Definition skin.h:165
@ kWidgetSecondary1
Definition skin.h:168
@ kShadow
Definition skin.h:142
@ kWidgetSecondary2
Definition skin.h:169
SectionOverride
Identifiers for different UI sections that can have color or value overrides.
Definition skin.h:30
A semi-transparent overlay shown when the section is inactive.
Definition synth_section.h:235
void paintBackground(Graphics &g) override
Paints a standard background for the component.
Definition synth_section.h:239
OffOverlay()
Definition synth_section.h:237
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
Rectangle< int > getDividedAreaBuffered(Rectangle< int > full_area, int num_sections, int section, int buffer)
Divides an area into equal sections with buffering, returns the specified section.
Definition synth_section.cpp:776
std::map< std::string, ModulationButton * > modulation_buttons_
Definition synth_section.h:808
void drawTextComponentBackground(Graphics &g, Rectangle< int > bounds, bool extend_to_label)
Draws a background for a text component area.
Definition synth_section.cpp:319
static constexpr int kDefaultStandardKnobSize
Definition synth_section.h:215
virtual void guiChanged(SynthButton *button) override
Called when a SynthButton state changes (GUI interaction).
Definition synth_section.cpp:405
bool sideways_heading_
Definition synth_section.h:823
float getModFontSize()
Definition synth_section.cpp:672
virtual void buttonClicked(Button *clicked_button) override
Called when a button is clicked. Updates the synth parameter accordingly.
Definition synth_section.cpp:398
static constexpr float kDefaultWidgetFillFade
Definition synth_section.h:227
virtual void renderOpenGlComponents(OpenGlWrapper &open_gl, bool animate)
Renders all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:357
float getPadding()
Definition synth_section.cpp:660
std::vector< OpenGlComponent * > open_gl_components_
Definition synth_section.h:804
static constexpr float kDefaultWidgetFillCenter
Definition synth_section.h:229
void drawLabelConnectionForComponents(Graphics &g, Component *left, Component *right)
Draws a rectangular connection between labels of two components.
Definition synth_section.cpp:745
void drawLabelBackground(Graphics &g, Rectangle< int > bounds, bool text_component=false)
Draws a background for a label area.
Definition synth_section.cpp:755
static constexpr float kJointModulationRadiusPercent
Definition synth_section.h:200
float getSliderWidth()
Definition synth_section.cpp:637
virtual ~SynthSection()=default
void placeKnobsInArea(Rectangle< int > area, std::vector< Component * > knobs)
Definition synth_section.cpp:601
virtual void paintBackgroundShadow(Graphics &g)
Stub for painting background shadows. Overridden by subclasses if needed.
Definition synth_section.h:445
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
PresetSelector * preset_selector_
Definition synth_section.h:816
void paintJointControl(Graphics &g, int x, int y, int width, int height, const std::string &name)
Definition synth_section.cpp:564
void createOffOverlay()
Definition synth_section.cpp:514
float getModButtonWidth()
Definition synth_section.cpp:668
virtual void animate(bool animate)
Triggers animation state change in sub-sections if needed.
Definition synth_section.cpp:822
void addSubSection(SynthSection *section, bool show=true)
Adds a subsection (another SynthSection) as a child.
Definition synth_section.cpp:457
void paintOpenGlChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all OpenGL child components.
Definition synth_section.cpp:267
static constexpr int kDefaultKnobModulationMeterThickness
Definition synth_section.h:219
int getDualPopupWidth() const
Definition synth_section.h:767
void paintJointControlSliderBackground(Graphics &g, int x, int y, int width, int height)
Definition synth_section.cpp:525
float getTotalKnobHeight()
Definition synth_section.h:759
virtual std::string getFileName()
Gets the name of the currently loaded file. Overridden by subclasses.
Definition synth_section.h:382
void addToggleButton(ToggleButton *button, bool show)
Definition synth_section.cpp:420
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
bool active_
Definition synth_section.h:822
virtual void setSkinValues(const Skin &skin, bool top_level)
Sets skin values (colors, sizes) and applies them to sub-sections.
Definition synth_section.cpp:86
static constexpr int kDefaultLabelBackgroundWidth
Definition synth_section.h:210
void drawTempoDivider(Graphics &g, Component *sync)
Draws a divider line for tempo-related controls.
Definition synth_section.cpp:339
void drawTextBelowComponent(Graphics &g, String text, Component *component, int space, int padding=0)
Draws text below a component with optional padding.
Definition synth_section.cpp:800
static constexpr int kDefaultKnobSectionHeight
Definition synth_section.h:222
void setSidewaysHeading(bool sideways)
Definition synth_section.h:771
void hidePopupDisplay(bool primary)
Hides the currently shown popup display.
Definition synth_section.cpp:140
int getComponentShadowWidth()
Gets the width of shadow around components.
Definition synth_section.cpp:184
static constexpr float kTuneHeightPercent
Definition synth_section.h:199
virtual File getCurrentFile()
Gets the currently loaded file. Overridden by subclasses.
Definition synth_section.h:376
static constexpr float kJointLabelHeightPercent
Definition synth_section.h:203
static constexpr float kJointModulationExtensionPercent
Definition synth_section.h:201
virtual void paint(Graphics &g) override
Called when the component should paint itself.
Definition synth_section.cpp:49
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
void placeTempoControls(int x, int y, int width, int height, SynthSlider *tempo, SynthSlider *sync)
Definition synth_section.cpp:584
ToggleButton * activator() const
Gets the activator toggle button if any.
Definition synth_section.h:735
std::map< std::string, Button * > button_lookup_
Definition synth_section.h:807
virtual void paintBody(Graphics &g, Rectangle< int > bounds)
Paints the body background within given bounds.
Definition synth_section.cpp:165
std::map< std::string, ModulationButton * > getAllModulationButtons()
Gets all modulation buttons registered in this section.
Definition synth_section.h:669
std::vector< SynthSection * > sub_sections_
Definition synth_section.h:803
Rectangle< int > getTitleBounds()
Definition synth_section.cpp:709
float getWidgetRounding()
Definition synth_section.cpp:680
static constexpr double kTransposeMouseSensitivity
Definition synth_section.h:204
void paintChildBackground(Graphics &g, SynthSection *child)
Paints a child's background specifically.
Definition synth_section.cpp:292
void paintChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all child sections.
Definition synth_section.cpp:274
static constexpr float kDefaultWidgetLineWidth
Definition synth_section.h:228
void updatePopupBrowser(SynthSection *owner)
Updates the currently visible popup browser if any.
Definition synth_section.cpp:113
virtual void paintChildrenShadows(Graphics &g)
Paints shadows for child sections.
Definition synth_section.cpp:260
void paintKnobShadows(Graphics &g)
Paints knob shadows for all sliders.
Definition synth_section.cpp:253
Font getLabelFont()
Gets a suitable font for label text.
Definition synth_section.cpp:735
virtual void setActive(bool active)
Sets the active state of this section and sub-sections.
Definition synth_section.cpp:806
Rectangle< int > getLabelBackgroundBounds(Component *component, bool text_component=false)
Gets the label background bounds for a component.
Definition synth_section.h:528
static constexpr int kDefaultKnobThickness
Definition synth_section.h:216
static constexpr int kDefaultModulationButtonWidth
Definition synth_section.h:220
static constexpr int kDefaultLabelBackgroundRounding
Definition synth_section.h:211
virtual int getPixelMultiple() const
Definition synth_section.cpp:729
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 drawLabelBackgroundForComponent(Graphics &g, Component *component)
Draws label background for a specific component.
Definition synth_section.cpp:764
static constexpr float kPowerButtonPaddingPercent
Definition synth_section.h:197
static constexpr float kJointLabelBorderRatioX
Definition synth_section.h:205
void addModulationButton(ModulationButton *button, bool show=true)
Adds a modulation button to this section.
Definition synth_section.cpp:438
void setLabelFont(Graphics &g)
Sets the Graphics context font and color for labels.
Definition synth_section.cpp:740
static constexpr float kDefaultKnobModulationAmountThickness
Definition synth_section.h:217
virtual void destroyOpenGlComponents(OpenGlWrapper &open_gl)
Destroys all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:383
static constexpr int kDefaultPopupMenuWidth
Definition synth_section.h:213
float getSliderOverlap()
Definition synth_section.cpp:641
virtual void setSizeRatio(float ratio)
Sets the size ratio for scaling UI elements.
Definition synth_section.cpp:246
virtual void paintSidewaysHeadingText(Graphics &g)
Paints the section name heading text vertically if sideways_heading_ is true.
Definition synth_section.cpp:51
virtual void paintHeadingText(Graphics &g)
Paints the heading text for this section, either sideways or horizontally.
Definition synth_section.cpp:66
virtual std::string getFileAuthor()
Gets the author metadata of the currently loaded file. Overridden by subclasses.
Definition synth_section.h:388
void unlockCriticalSection()
Definition synth_section.cpp:623
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 size_ratio_
Definition synth_section.h:821
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
static constexpr int kDefaultBodyRounding
Definition synth_section.h:207
SynthButton * activator_
Definition synth_section.h:815
int getPopupWidth() const
Definition synth_section.h:766
static constexpr float kPitchLabelPercent
Definition synth_section.h:202
std::map< Skin::ValueId, float > value_lookup_
Definition synth_section.h:801
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
Skin::SectionOverride skin_override_
Definition synth_section.h:820
virtual void loadFile(const File &file)
Loads a file (e.g., a sample or wavetable). Overridden by subclasses.
Definition synth_section.h:370
int getTitleTextRight()
Definition synth_section.cpp:695
bool isActive() const
Checks if the section is currently active.
Definition synth_section.h:683
static constexpr int kDefaultTextWidth
Definition synth_section.h:224
static constexpr int kDefaultDualPopupMenuWidth
Definition synth_section.h:214
virtual void paintBackground(Graphics &g)
Paints the background of the section. Calls paintContainer, heading, knobs, children.
Definition synth_section.cpp:77
float getKnobSectionHeight()
Definition synth_section.cpp:633
void setActivator(SynthButton *activator)
Definition synth_section.cpp:504
SynthSection(const String &name)
Constructs a SynthSection with a given name.
Definition synth_section.cpp:11
void showDualPopupSelector(Component *source, Point< int > position, int width, const PopupItems &options, std::function< void(int)> callback)
Shows a dual popup selector for hierarchical selection.
Definition synth_section.cpp:126
void paintChildShadow(Graphics &g, SynthSection *child)
Paints a child's shadow specifically.
Definition synth_section.cpp:301
static constexpr int kDefaultSliderWidth
Definition synth_section.h:223
float getStandardKnobSize()
Definition synth_section.cpp:656
static constexpr int kDefaultKnobModulationMeterSize
Definition synth_section.h:218
std::map< std::string, SynthSlider * > getAllSliders()
Gets all sliders registered in this section.
Definition synth_section.h:657
static constexpr int kDefaultTextHeight
Definition synth_section.h:225
static constexpr int kDefaultPowerButtonOffset
Definition synth_section.h:196
Rectangle< int > getPowerButtonBounds()
Definition synth_section.cpp:704
std::map< std::string, SynthSlider * > slider_lookup_
Definition synth_section.h:806
void addOpenGlComponent(OpenGlComponent *open_gl_component, bool to_beginning=false)
Definition synth_section.cpp:489
float getSizeRatio() const
Definition synth_section.h:765
std::map< std::string, ToggleButton * > all_buttons_
Definition synth_section.h:811
void paintJointControlBackground(Graphics &g, int x, int y, int width, int height)
Definition synth_section.cpp:542
std::map< std::string, ToggleButton * > getAllButtons()
Gets all toggle buttons registered in this section.
Definition synth_section.h:663
bool preset_selector_half_width_
Definition synth_section.h:817
virtual void sliderValueChanged(Slider *moved_slider) override
Called when a slider value changes. Updates the synth parameter accordingly.
Definition synth_section.cpp:391
float getTextComponentHeight()
Definition synth_section.cpp:652
virtual void setAllValues(vital::control_map &controls)
Sets values for all known parameters from a control map.
Definition synth_section.cpp:827
void placeRotaryOption(Component *option, SynthSlider *rotary)
Definition synth_section.cpp:593
void setSkinValues(std::map< Skin::ValueId, float > values)
Sets custom skin values for this section.
Definition synth_section.h:741
Rectangle< int > getDividedAreaUnbuffered(Rectangle< int > full_area, int num_sections, int section, int buffer)
Divides an area into equal sections without extra buffering, returns the specified section.
Definition synth_section.cpp:768
virtual void reset()
Resets the section and all sub-sections.
Definition synth_section.cpp:30
void showPopupDisplay(Component *source, const std::string &text, BubbleComponent::BubblePlacement placement, bool primary)
Shows a brief popup display (like a tooltip).
Definition synth_section.cpp:133
static constexpr float kTransposeHeightPercent
Definition synth_section.h:198
void lockCriticalSection()
Definition synth_section.cpp:617
const SynthSection * parent_
Definition synth_section.h:814
float getTextSectionYOffset()
Definition synth_section.cpp:664
virtual void setValue(const std::string &name, vital::mono_float value, NotificationType notification)
Sets a single parameter value for a known control.
Definition synth_section.cpp:846
static constexpr int kDefaultLabelHeight
Definition synth_section.h:208
float getSliderOverlapWithSpace()
Definition synth_section.cpp:648
void setSliderHasHzAlternateDisplay(SynthSlider *slider)
Definition synth_section.cpp:410
void setPresetSelector(PresetSelector *preset_selector, bool half=false)
Definition synth_section.h:779
float getTitleWidth()
Definition synth_section.cpp:629
static constexpr int kDefaultPadding
Definition synth_section.h:212
virtual void setScrollWheelEnabled(bool enabled)
Enables or disables scroll wheel support for this section and sub-sections.
Definition synth_section.cpp:481
static constexpr int kDefaultModFontSize
Definition synth_section.h:221
void setSkinOverride(Skin::SectionOverride skin_override)
Definition synth_section.h:303
void setSkinValue(Skin::ValueId id, float value)
Sets a single skin value override.
Definition synth_section.h:748
static constexpr int kDefaultWidgetMargin
Definition synth_section.h:226
void setParent(const SynthSection *parent)
Sets the parent SynthSection.
Definition synth_section.h:253
std::map< std::string, ModulationButton * > all_modulation_buttons_
Definition synth_section.h:812
virtual void initOpenGlComponents(OpenGlWrapper &open_gl)
Initializes all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:349
void removeSubSection(SynthSection *section)
Removes a previously added subsection.
Definition synth_section.cpp:475
float getDisplayScale() const
Definition synth_section.cpp:719
virtual void paintTabShadow(Graphics &g)
Paints a tab-like shadow effect around the component.
Definition synth_section.cpp:188
virtual void repaintBackground()
Requests a repaint of the background.
Definition synth_section.cpp:96
Rectangle< int > getPresetBrowserBounds()
Definition synth_section.cpp:684
void placeJointControls(int x, int y, int width, int height, SynthSlider *left, SynthSlider *right, Component *widget=nullptr)
Definition synth_section.cpp:572
float getPowerButtonOffset() const
Definition synth_section.h:752
virtual void paintContainer(Graphics &g)
Paints the container background, body, heading, etc.
Definition synth_section.cpp:146
void paintOpenGlBackground(Graphics &g, OpenGlComponent *child)
Paints the background of an OpenGlComponent child.
Definition synth_section.cpp:310
std::unique_ptr< OffOverlay > off_overlay_
Definition synth_section.h:818
void showPopupBrowser(SynthSection *owner, Rectangle< int > bounds, std::vector< File > directories, String extensions, std::string passthrough_name, std::string additional_folders_name)
Shows a file browser popup (e.g., for loading samples or wavetables).
Definition synth_section.cpp:105
static constexpr int kDefaultLabelBackgroundHeight
Definition synth_section.h:209
std::map< std::string, SynthSlider * > all_sliders_
Definition synth_section.h:810
float getWidgetMargin()
Definition synth_section.cpp:676
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
constexpr mono_float kPi
Pi constant.
Definition common.h:36
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
float mono_float
Definition common.h:33
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174