6 : m_labelText(labelText)
8 setComponentID(labelText);
12 m_slider.setSliderStyle(Slider::SliderStyle::RotaryVerticalDrag);
13 m_slider.setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox,
false, 0, 0);
14 m_slider.setScrollWheelEnabled(
false);
17 m_label.setText(labelText, dontSendNotification);
19 m_label.setJustificationType(Justification::centred);
20 m_label.setVisible(setLabelVisible);
23 ImageFileFormat::loadFrom(KrotosBinaryData::HoverHand_png, KrotosBinaryData::HoverHand_pngSize));
25 ImageFileFormat::loadFrom(KrotosBinaryData::GrabbingHand_png, KrotosBinaryData::GrabbingHand_pngSize));
36 m_slider.addMouseListener(
this,
true);
43 if (getComponentID() ==
"Pan")
51 String formattedValue = String::formatted(
m_valueFormat, value);
62 const float tolerance = 1.5f;
64 if (value < -tolerance)
66 else if (value > tolerance)
74 if (
m_slider.getBounds().contains(event.getPosition()))
94 Rectangle<int> sliderBounds = getLocalBounds();
96 sliderBounds.expand(sliderBounds.getHeight() / 2, 0);
97 sliderBounds.removeFromRight(sliderBounds.getHeight() / 2);
98 m_slider.setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox,
false, 0, 0);
99 m_label.setJustificationType(Justification::centredLeft);
100 m_label.setBorderSize(juce::BorderSize<int>(0));
102 m_label.setBounds(labelBounds);
107 auto bounds = getLocalBounds();
109 const int padding = 0;
110 Rectangle<int> labelBounds;
111 Rectangle<int> sliderBounds;
114 labelHeight =
static_cast<int>(getHeight() * 0.2f);
115 labelHeight = jmax<int>(labelHeight, 10);
117 labelBounds = bounds.removeFromBottom(labelHeight).reduced(padding);
118 sliderBounds = bounds;
119 fontSize = 0.7f * (float)labelHeight;
120 m_slider.setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox,
false, labelBounds.getWidth(),
121 labelBounds.getHeight());
123 if (sliderBounds.getWidth() < 25 || sliderBounds.getHeight() < 50)
125 sliderBounds = sliderBounds.expanded(5);
126 labelBounds = labelBounds.expanded(3);
130 m_label.setJustificationType(Justification::centred);
131 m_label.setFont(Font(fontSize));
132 m_label.setBounds(labelBounds);
136 auto bounds = getLocalBounds();
139 Rectangle<int> labelBounds;
145 else if (
m_slider.getSliderStyle() == Slider::SliderStyle::LinearHorizontal)
149 else if (
m_slider.getSliderStyle() == Slider::SliderStyle::RotaryVerticalDrag)
154 m_slider.setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox,
false, labelBounds.getWidth(),
155 labelBounds.getHeight());
156 m_label.setJustificationType(Justification::centred);
157 m_label.setBounds(labelBounds);
173 m_slider.setColour(Slider::ColourIds::thumbColourId, newColour);
Slider m_slider
Definition AttachedSlider.h:91
String m_labelText
Definition AttachedSlider.h:88
void setLabelYPosition(int newPos)
Definition AttachedSlider.cpp:182
Label & getLabel()
Definition AttachedSlider.cpp:163
std::unique_ptr< SliderParameterAttachment > & getAttachment()
Definition AttachedSlider.cpp:169
void setDebugColour(Colour newColour)
Definition AttachedSlider.cpp:171
void resized() override
Definition AttachedSlider.cpp:89
String panSuffix(double value) const
Definition AttachedSlider.cpp:60
void updateLabel()
Definition AttachedSlider.cpp:39
void paint(Graphics &g) override
Definition AttachedSlider.cpp:87
DraggableLabel m_label
Definition AttachedSlider.h:90
int m_labelYPositionOverride
Definition AttachedSlider.h:94
Slider & getControlComponent()
Definition AttachedSlider.cpp:167
void setDragAndDropDescription(const var &description)
Definition AttachedSlider.cpp:176
bool m_mouseIsOver
Definition AttachedSlider.h:87
String m_valueFormat
Definition AttachedSlider.h:85
struct krotos::AttachedSlider::Layout m_layout
LabelPosition m_labelPosition
Definition AttachedSlider.h:89
Slider & getSlider()
Definition AttachedSlider.cpp:165
void mouseMove(const MouseEvent &event) override
Definition AttachedSlider.cpp:72
void mouseExit(const MouseEvent &) override
Definition AttachedSlider.cpp:81
AttachedSlider(const String &labelText, bool setLabelVisible=true, const String &dragAndDropDescription=String())
Definition AttachedSlider.cpp:5
std::unique_ptr< SliderParameterAttachment > m_attachment
Definition AttachedSlider.h:92
void setLabelPosition(LabelPosition position)
Definition AttachedSlider.h:49
String m_valueSuffix
Definition AttachedSlider.h:86
void setEnableDrag(bool dragEnabled)
Definition DraggableLabel.cpp:46
void setHoverHandImage(const Image &image)
Definition DraggableLabel.cpp:96
void setGrabHandImage(const Image &image)
Definition DraggableLabel.cpp:98
void setDragAndDropDescription(const var &newDescription)
Definition DraggableLabel.cpp:41
Definition AirAbsorptionFilter.cpp:2
const Rectangle< int > linearSliderLabelBounds
Definition AttachedSlider.h:77
const Rectangle< int > rotarySliderLabelBounds
Definition AttachedSlider.h:78
const int lhFontHeight
Definition AttachedSlider.h:73
const int lhLabelWidth
Definition AttachedSlider.h:72
struct krotos::AttachedSlider::Layout::Above above