Vital
Loading...
Searching...
No Matches
extra_mod_section.cpp
Go to the documentation of this file.
1#include "extra_mod_section.h"
2
3#include "line_map_editor.h"
5#include "skin.h"
6#include "fonts.h"
7#include "modulation_button.h"
9
10namespace {
14 const char* kModulationStrings[] = {
15 "pitch_wheel",
16 "mod_wheel"
17 };
18}
19
21 // Initialize the other_modulations_ selector with two buttons: pitch wheel and mod wheel.
22 other_modulations_ = std::make_unique<ModulationTabSelector>("OTHER", 2, kModulationStrings);
23 other_modulations_->getButton(0)->overrideText("PITCH WHL");
24 other_modulations_->getButton(1)->overrideText("MOD WHL");
25 other_modulations_->drawBorders(true);
26 addSubSection(other_modulations_.get());
27 other_modulations_->registerModulationButtons(this);
28 other_modulations_->setVertical(true);
29
30 // Create the macro knob section for additional macro controls.
31 macro_knobs_ = std::make_unique<MacroKnobSection>("MACRO");
32 addSubSection(macro_knobs_.get());
33}
34
36
38 // Paint the background behind the other_modulations_ subsection.
39 g.saveState();
40 Rectangle<int> bounds = getLocalArea(other_modulations_.get(), other_modulations_->getLocalBounds());
41 g.reduceClipRegion(bounds);
42 g.setOrigin(bounds.getTopLeft());
43 other_modulations_->paintBackground(g);
44 g.restoreState();
45
46 // Paint backgrounds of any children that require it.
48}
49
51 // Paint a shadow effect behind the other_modulations_ tab area.
52 paintTabShadow(g, other_modulations_->getBounds());
54}
55
57 // Paint a shadow effect behind the other_modulations_ tab area.
58 int padding = getPadding();
59 int knob_section_height = getKnobSectionHeight();
60 int widget_margin = getWidgetMargin();
61
62 // The macro knobs may occupy a significant portion of the space.
63 int macro_height = 4 * (2 * knob_section_height - widget_margin + padding) - padding;
64 int mod_height = getHeight() - macro_height - padding;
65
66 // Set bounds for macro knobs and other modulations sections.
67 macro_knobs_->setBounds(0, 0, getWidth(), macro_height);
68 other_modulations_->setBounds(0, macro_height + padding, getWidth(), mod_height);
69
70 // Update base class (SynthSection) layout and font size for the mod tabs.
72 other_modulations_->setFontSize(getModFontSize());
73}
virtual ~ExtraModSection()
Destructor.
Definition extra_mod_section.cpp:35
void paintBackgroundShadow(Graphics &g) override
Paints a background shadow for the component.
Definition extra_mod_section.cpp:50
ExtraModSection(String name, SynthGuiData *synth_data)
Constructs the ExtraModSection.
Definition extra_mod_section.cpp:20
void paintBackground(Graphics &g) override
Paints the background of the component.
Definition extra_mod_section.cpp:37
void resized() override
Called when the component is resized.
Definition extra_mod_section.cpp:56
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
float getModFontSize()
Definition synth_section.cpp:672
float getPadding()
Definition synth_section.cpp:660
virtual void paintBackgroundShadow(Graphics &g)
Stub for painting background shadows. Overridden by subclasses if needed.
Definition synth_section.h:445
void addSubSection(SynthSection *section, bool show=true)
Adds a subsection (another SynthSection) as a child.
Definition synth_section.cpp:457
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
void paintChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all child sections.
Definition synth_section.cpp:274
float getKnobSectionHeight()
Definition synth_section.cpp:633
virtual void paintTabShadow(Graphics &g)
Paints a tab-like shadow effect around the component.
Definition synth_section.cpp:188
float getWidgetMargin()
Definition synth_section.cpp:676
A struct holding references and data used by the GUI to interact with the SynthBase.
Definition synth_gui_interface.h:27