Vital
|
A specialized slider with extended functionality for modulation, parameter control, popup menus, and text entry. More...
#include <synth_slider.h>
Classes | |
class | SliderListener |
Listener interface for receiving slider events such as mouse interactions, modulation changes, and GUI changes. More... | |
Public Types | |
enum | MenuId { kCancel = 0 , kArmMidiLearn , kClearMidiLearn , kDefaultValue , kManualEntry , kClearModulations , kModulationList } |
Menu item IDs for the right-click popup menu. More... | |
Public Member Functions | |
SynthSlider (String name) | |
virtual void | mouseDown (const MouseEvent &e) override |
Mouse event overrides for custom behavior. | |
virtual void | mouseDrag (const MouseEvent &e) override |
virtual void | mouseEnter (const MouseEvent &e) override |
virtual void | mouseExit (const MouseEvent &e) override |
virtual void | mouseUp (const MouseEvent &e) override |
virtual void | mouseDoubleClick (const MouseEvent &e) override |
virtual void | mouseWheelMove (const MouseEvent &e, const MouseWheelDetails &wheel) override |
virtual void | focusLost (FocusChangeType cause) override |
virtual void | valueChanged () override |
Called when the slider value changes. Notifies GUIs. | |
String | getRawTextFromValue (double value) |
String | getSliderTextFromValue (double value) |
String | getTextFromValue (double value) override |
double | getValueFromText (const String &text) override |
double | getAdjustedValue (double value) |
double | getValueFromAdjusted (double value) |
void | setValueFromAdjusted (double value) |
virtual void | parentHierarchyChanged () override |
Called when the parent hierarchy changes, updates references to synthesizer. | |
virtual double | snapValue (double attemptedValue, DragMode dragMode) override |
void | textEditorTextChanged (TextEditor &) override |
TextEditor::Listener overrides for handling text entry. | |
void | textEditorReturnKeyPressed (TextEditor &editor) override |
void | textEditorFocusLost (TextEditor &editor) override |
void | setSliderPositionFromText () |
Sets the slider position from the current text in the text editor. | |
void | showTextEntry () |
Shows the text entry box for manual value entry. | |
virtual bool | shouldShowPopup () |
virtual void | drawShadow (Graphics &g) |
void | drawRotaryShadow (Graphics &g) |
void | snapToValue (bool snap, float value=0.0) |
void | setScalingType (vital::ValueDetails::ValueScale scaling_type) |
vital::ValueDetails::ValueScale | getScalingType () const |
void | setStringLookup (const std::string *lookup) |
void | setScrollEnabled (bool enabled) |
const std::string * | getStringLookup () const |
void | setUnits (const String &units) |
String | getUnits () const |
String | formatValue (float value) |
void | setDefaultRange () |
Sets the default parameter range based on the parameter details. | |
void | addSliderListener (SliderListener *listener) |
void | showPopup (bool primary) |
void | hidePopup (bool primary) |
void | setPopupPlacement (BubbleComponent::BubblePlacement placement) |
void | setModulationPlacement (BubbleComponent::BubblePlacement placement) |
BubbleComponent::BubblePlacement | getPopupPlacement () |
BubbleComponent::BubblePlacement | getModulationPlacement () |
void | notifyGuis () |
Notifies GUI listeners of a value change. | |
void | handlePopupResult (int result) |
void | setSensitivity (double sensitivity) |
double | getSensitivity () |
Rectangle< int > | getModulationMeterBounds () const |
bool | hasModulationArea () const |
Rectangle< int > | getModulationArea () const |
void | setModulationArea (Rectangle< int > area) |
bool | isModulationBipolar () const |
bool | isModulationStereo () const |
bool | isModulationBypassed () const |
void | setTextHeightPercentage (float percentage) |
float | getTextHeightPercentage () |
float | mouseHovering () const |
std::vector< vital::ModulationConnection * > | getConnections () |
void | setMouseWheelMovement (double movement) |
void | setMaxDisplayCharacters (int characters) |
void | setMaxDecimalPlaces (int decimal_places) |
void | setTextEntrySizePercent (float width_percent, float height_percent) |
void | setTextEntryWidthPercent (float percent) |
void | setShiftIndexAmount (int shift_amount) |
void | setShowPopupOnHover (bool show) |
void | setPopupPrefix (String prefix) |
void | setPopupSuffix (const juce::String &suffix) |
void | setKnobSizeScale (float scale) |
float | getKnobSizeScale () const override |
void | useSuffix (bool use) |
void | setExtraModulationTarget (Component *component) |
Component * | getExtraModulationTarget () |
void | setModulationBarRight (bool right) |
bool | isModulationBarRight () |
void | setDisplayMultiply (float multiply) |
void | setDisplayExponentialBase (float base) |
void | overrideValue (Skin::ValueId value_id, float value) |
float | findValue (Skin::ValueId value_id) const override |
void | setAlternateDisplay (Skin::ValueId id, float value, vital::ValueDetails details) |
vital::ValueDetails * | getDisplayDetails () |
OpenGlComponent * | getTextEditorComponent () |
![]() | |
OpenGlSlider (String name) | |
virtual void | resized () override |
Called when the component is resized. Updates colors and display values. | |
void | parentHierarchyChanged () override |
Called when the parent hierarchy changes. Used for retrieving parent sections. | |
void | paintToImage (bool paint) |
bool | isText () const |
bool | isTextOrCurve () const |
bool | isModulationKnob () const |
bool | isRotaryQuad () const |
bool | isHorizontalQuad () const |
bool | isVerticalQuad () const |
OpenGlComponent * | getImageComponent () |
OpenGlComponent * | getQuadComponent () |
void | setMaxArc (float arc) |
void | setModulationKnob () |
Marks this slider as a modulation knob. | |
void | setModulationAmount (float modulation) |
float | getModulationAmount () const |
bool | isBipolar () const |
bool | isActive () const |
void | setBipolar (bool bipolar=true) |
void | setActive (bool active=true) |
virtual Colour | getModColor () const |
virtual Colour | getBackgroundColor () const |
virtual Colour | getUnselectedColor () const |
virtual Colour | getSelectedColor () const |
virtual Colour | getThumbColor () const |
int | getLinearSliderWidth () |
void | setSliderDisplayValues () |
Sets the slider display values (positions, sizes) based on current style. | |
void | redoImage (bool skip_image=false) |
void | setColors () |
Updates internal colors based on the current skin and state. | |
void | setAlpha (float alpha, bool reset=false) |
void | setDrawWhenNotVisible (bool draw) |
SynthSection * | getSectionParent () |
Static Public Attributes | |
static constexpr int | kDefaultFormatLength = 5 |
static constexpr int | kDefaultFormatDecimalPlaces = 5 |
static constexpr float | kDefaultTextEntryWidthPercent = 0.9f |
static constexpr float | kDefaultTextEntryHeightPercent = 0.35f |
static constexpr float | kModulationSensitivity = 0.003f |
static constexpr float | kTextEntryHeightPercent = 0.6f |
static constexpr float | kSlowDragMultiplier = 0.1f |
static constexpr float | kDefaultSensitivity = 1.0f |
static constexpr float | kDefaultTextHeightPercentage = 0.7f |
static constexpr float | kDefaultRotaryDragLength = 200.0f |
static constexpr float | kRotaryModulationControlPercent = 0.26f |
static constexpr float | kLinearWidthPercent = 0.26f |
static constexpr float | kLinearHandlePercent = 1.2f |
static constexpr float | kLinearModulationPercent = 0.1f |
![]() | |
static constexpr float | kRotaryAngle = 0.8f * vital::kPi |
The default rotary arc angle used for rotary sliders. | |
Protected Member Functions | |
PopupItems | createPopupMenu () |
void | setRotaryTextEntryBounds () |
Sets bounds for text entry in rotary mode. | |
void | setLinearTextEntryBounds () |
Sets bounds for text entry in linear mode. | |
void | notifyModulationAmountChanged () |
Notifies listeners that modulation amount has changed. | |
void | notifyModulationRemoved () |
Notifies listeners that a modulation was removed. | |
void | notifyModulationsChanged () |
Notifies listeners that modulations changed. | |
A specialized slider with extended functionality for modulation, parameter control, popup menus, and text entry.
This class supports various display scales, text entry, popup menus for MIDI learn or clearing modulations, and a wide range of customization. It integrates closely with the synthesizer's parameter architecture.
enum SynthSlider::MenuId |
SynthSlider::SynthSlider | ( | String | name | ) |
Constructor.
name | The name of the slider. |
void SynthSlider::addSliderListener | ( | SynthSlider::SliderListener * | listener | ) |
Adds a slider listener to receive events.
listener | The listener to add. |
|
protected |
Creates the popup menu items.
void SynthSlider::drawRotaryShadow | ( | Graphics & | g | ) |
Draws a shadow for rotary sliders.
g | The graphics context. |
|
virtual |
Draws a shadow behind the slider if needed.
g | The graphics context. |
Reimplemented in InvisibleSlider.
|
inlineoverridevirtual |
Gets a Skin value, considering overrides.
value_id | The Skin Value ID. |
Reimplemented from OpenGlSlider.
|
overridevirtual |
String SynthSlider::formatValue | ( | float | value | ) |
Formats the value into a string.
value | The value to format. |
double SynthSlider::getAdjustedValue | ( | double | value | ) |
Adjusts a raw slider value to its display scale.
value | The raw value. |
std::vector< vital::ModulationConnection * > SynthSlider::getConnections | ( | ) |
Gets the modulation connections for this parameter.
vital::ValueDetails * SynthSlider::getDisplayDetails | ( | ) |
Gets the appropriate ValueDetails for display (normal or alternate).
|
inline |
Gets the extra modulation target component.
|
inlineoverridevirtual |
Provides a scaling factor for the knob size.
Reimplemented from OpenGlSlider.
|
inline |
Gets the modulation area.
Rectangle< int > SynthSlider::getModulationMeterBounds | ( | ) | const |
Gets the modulation meter bounds if any.
|
inline |
Gets the current modulation placement.
|
inline |
Gets the current popup placement.
String SynthSlider::getRawTextFromValue | ( | double | value | ) |
Retrieves the raw text from a value (no formatting).
value | The slider value. |
|
inline |
Gets the scaling type.
|
inline |
Gets the slider's drag sensitivity.
String SynthSlider::getSliderTextFromValue | ( | double | value | ) |
Retrieves the slider text from a value, applying formatting and prefix.
value | The slider value. |
|
inline |
Gets the string lookup table.
|
inline |
Gets the OpenGL component used for the text editor.
|
override |
Converts a value to a string representation.
value | The value to convert. |
|
inline |
Gets the text height percentage.
|
inline |
Gets the display units.
double SynthSlider::getValueFromAdjusted | ( | double | value | ) |
Reverses the adjusted value back to the raw value.
value | The adjusted value. |
|
override |
Converts a string to a slider value.
text | The text to parse. |
void SynthSlider::handlePopupResult | ( | int | result | ) |
Handles the result of a popup menu action.
result | The selected menu item ID. |
|
inline |
Checks if the slider has a dedicated modulation area.
void SynthSlider::hidePopup | ( | bool | primary | ) |
Hides the popup display.
primary | If true, hides primary popup. |
|
inline |
Checks if the modulation bar is on the right side.
|
inline |
Checks if the modulation is bipolar.
|
inline |
Checks if modulation is bypassed.
|
inline |
Checks if the modulation is stereo.
|
overridevirtual |
|
overridevirtual |
Mouse event overrides for custom behavior.
Reimplemented in ModulationAmountKnob, TempoSelector, TextSelector, and TuningSelector.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Reimplemented in ModulationAmountKnob.
|
inline |
Gets whether the mouse is hovering over the slider.
|
overridevirtual |
Reimplemented in ModulationAmountKnob, PitchWheel, TempoSelector, and TextSelector.
|
overridevirtual |
Reimplemented in TuningSelector.
void SynthSlider::notifyGuis | ( | ) |
Notifies GUI listeners of a value change.
|
protected |
Notifies listeners that modulation amount has changed.
|
protected |
Notifies listeners that a modulation was removed.
|
protected |
Notifies listeners that modulations changed.
|
inline |
|
overridevirtual |
Called when the parent hierarchy changes, updates references to synthesizer.
Reimplemented in ControlWheel, and TuningSelector.
|
inline |
Sets alternate display settings.
id | The Skin Value ID to check. |
value | The value that triggers alternate display. |
details | The alternate ValueDetails. |
void SynthSlider::setDefaultRange | ( | ) |
Sets the default parameter range based on the parameter details.
|
inline |
Sets the exponential base for display conversions.
base | The exponential base. |
|
inline |
Sets a multiplier for display values.
multiply | The multiplier. |
|
inline |
Sets an extra component to be used as a modulation target.
component | The extra modulation target component. |
|
inline |
Sets a scale factor for the knob size.
scale | The scale factor. |
|
protected |
Sets bounds for text entry in linear mode.
|
inline |
Sets the maximum decimal places for display.
decimal_places | The max decimal places. |
|
inline |
Sets the maximum display characters for formatting.
characters | The max characters. |
|
inline |
Sets the modulation area.
area | The new modulation area. |
|
inline |
Sets whether the modulation bar is on the right side (for text/curve).
right | True if modulation bar should be on the right side. |
|
inline |
Sets the modulation placement bubble direction.
placement | The bubble placement. |
|
inline |
Sets the mouse wheel movement amount for value changes.
movement | The new movement increment. |
|
inline |
Sets the popup placement relative to the slider.
placement | The bubble placement. |
|
inline |
Sets a prefix for displayed values in the popup.
prefix | The popup prefix string. |
|
inline |
|
protected |
Sets bounds for text entry in rotary mode.
|
inline |
Sets the scaling type of the parameter value.
scaling_type | The scaling type (linear, quadratic, etc.). |
|
inline |
Enables or disables mouse wheel scrolling.
enabled | True to enable scrolling. |
|
inline |
Sets the slider's drag sensitivity.
sensitivity | The new sensitivity. |
|
inline |
Sets an amount by which the index-based parameter changes when shift is held.
shift_amount | The shift index amount. |
|
inline |
Sets whether to show a popup on hover.
show | True to show popup on hover. |
void SynthSlider::setSliderPositionFromText | ( | ) |
Sets the slider position from the current text in the text editor.
|
inline |
Sets a lookup table for indexed parameters.
lookup | The lookup table. |
|
inline |
Sets the size of the text entry in percentages of the component's size.
width_percent | The width percentage. |
height_percent | The height percentage. |
|
inline |
Sets the width percentage used for text entry height calculation.
percent | The height percentage. |
|
inline |
Sets the text height percentage.
percentage | The text height percentage. |
|
inline |
Sets the display units.
units | The units string. |
void SynthSlider::setValueFromAdjusted | ( | double | value | ) |
Sets the slider value from an adjusted value.
value | The adjusted value. |
|
inlinevirtual |
Determines if a popup should be shown (override for custom logic).
Reimplemented in TextSelector.
void SynthSlider::showPopup | ( | bool | primary | ) |
Shows a popup display with the current value.
primary | If true, shows primary popup. |
void SynthSlider::showTextEntry | ( | ) |
Shows the text entry box for manual value entry.
|
inline |
Enables or disables snapping to a specific value.
snap | True to enable snapping. |
value | The value to snap to. |
|
overridevirtual |
Snaps the slider value to a special value if snap is enabled.
attemptedValue | The attempted slider value. |
dragMode | The drag mode. |
|
override |
|
override |
|
inlineoverride |
TextEditor::Listener overrides for handling text entry.
|
inline |
Uses a suffix (units) in the displayed values.
use | True to use suffix. |
|
overridevirtual |
Called when the slider value changes. Notifies GUIs.
Reimplemented from OpenGlSlider.
Reimplemented in TempoSelector, and TuningSelector.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
protected |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |