commit b95cba69270e7d1f92325cf17a5f8d3cc38dcd3f parent ffc6587eb25b8610fc58009b93659e052a7d8394 Author: Mario Kruselj <mario.kruselj@gmail.com> Date: Mon, 13 May 2024 15:42:12 +0200 Add "displayTime" property to the tooltip component in the skin engine Also reduce the default tooltip time to 1.5 seconds so that it doesn't linger for too long Diffstat:
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/source/jucePluginEditorLib/focusedParameter.cpp b/source/jucePluginEditorLib/focusedParameter.cpp @@ -47,7 +47,7 @@ namespace jucePluginEditorLib FocusedParameter::~FocusedParameter() { m_tooltip.reset(); - + for (auto* p : m_boundParameters) p->removeListener(g_listenerId); } @@ -140,6 +140,8 @@ namespace jucePluginEditorLib m_tooltip->initialize(_component, value); - startTimer(3000); + const int tooltipTime = m_tooltip->getTooltipDisplayTime(); + + startTimer(tooltipTime == 0 ? 1500 : tooltipTime); } } diff --git a/source/jucePluginEditorLib/focusedParameterTooltip.cpp b/source/jucePluginEditorLib/focusedParameterTooltip.cpp @@ -14,13 +14,23 @@ namespace jucePluginEditorLib void FocusedParameterTooltip::setVisible(bool _visible) const { - if (isValid()) + if(isValid()) m_label->setVisible(_visible); } + int FocusedParameterTooltip::getTooltipDisplayTime() const + { + int time = 0; + + if(m_label->getProperties().contains("displayTime")) + time = static_cast<int>(m_label->getProperties()["displayTime"]); + + return time; + } + void FocusedParameterTooltip::initialize(juce::Component* _component, const juce::String& _value) const { - if (!isValid()) + if(!isValid()) return; if(dynamic_cast<juce::Slider*>(_component) && _component->isShowing()) diff --git a/source/jucePluginEditorLib/focusedParameterTooltip.h b/source/jucePluginEditorLib/focusedParameterTooltip.h @@ -15,6 +15,7 @@ namespace jucePluginEditorLib FocusedParameterTooltip(juce::Label* _label); bool isValid() const { return m_label != nullptr; } + int getTooltipDisplayTime() const; void setVisible(bool _visible) const; void initialize(juce::Component* _component, const juce::String& _value) const; diff --git a/source/xtJucePlugin/skins/xtDefault/xtDefault.json b/source/xtJucePlugin/skins/xtDefault/xtDefault.json @@ -8879,6 +8879,7 @@ "height" : "55" }, "componentProperties" : { + "displayTime" : "2000", "offsetY" : "25" } }