gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 1f189b2b97fe5489c0d7cde62edd0285d21f2d9d
parent f1e20c4cc0c063e2f42964fb24d0640b5c5985bc
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 20 Mar 2022 13:00:24 +0100

add focused parameter tooltip

Diffstat:
Msource/jucePlugin/skins/Trancy/VirusC_Trancy.json | 19+++++++++++++++++++
Msource/jucePlugin/ui3/VirusEditor.cpp | 46++++++++++++++++++++++++++++++++++++++++++++++
Msource/jucePlugin/ui3/VirusEditor.h | 1+
3 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/source/jucePlugin/skins/Trancy/VirusC_Trancy.json b/source/jucePlugin/skins/Trancy/VirusC_Trancy.json @@ -5588,6 +5588,25 @@ "height" : "28", "tooltip" : "Copy a valid ROM file with file extension .bin next to this plugin" } + }, + { + "name" : "FocusedParameterTooltip", + "label" : { + "text" : "42", + "textHeight" : "28", + "backgroundColor" : "000000FF", + "alignH" : "C", + "alignV" : "C", + "fontFile" : "Digital", + "fontName" : "Register", + "x" : "989", + "y" : "614.5", + "width" : "134", + "height" : "35" + }, + "componentProperties" : { + "offsetY" : "25" + } } ] } \ No newline at end of file diff --git a/source/jucePlugin/ui3/VirusEditor.cpp b/source/jucePlugin/ui3/VirusEditor.cpp @@ -28,6 +28,11 @@ namespace genericVirusUI m_presetName = findComponentT<juce::Label>("PatchName"); m_focusedParameterName = findComponentT<juce::Label>("FocusedParameterName"); m_focusedParameterValue = findComponentT<juce::Label>("FocusedParameterValue"); + m_focusedParameterTooltip = findComponentT<juce::Label>("FocusedParameterTooltip", false); + + if(m_focusedParameterTooltip) + m_focusedParameterTooltip->setVisible(false); + m_romSelector = findComponentT<juce::ComboBox>("RomSelector"); m_playModeSingle = findComponentT<juce::Button>("PlayModeSingle", false); @@ -212,6 +217,8 @@ namespace genericVirusUI { m_focusedParameterName->setVisible(false); m_focusedParameterValue->setVisible(false); + if(m_focusedParameterTooltip) + m_focusedParameterTooltip->setVisible(false); return; } @@ -223,6 +230,8 @@ namespace genericVirusUI { m_focusedParameterName->setVisible(false); m_focusedParameterValue->setVisible(false); + if(m_focusedParameterTooltip) + m_focusedParameterTooltip->setVisible(false); return; } @@ -235,6 +244,43 @@ namespace genericVirusUI m_focusedParameterName->setVisible(true); m_focusedParameterValue->setVisible(true); + + if(m_focusedParameterTooltip && dynamic_cast<juce::Slider*>(_component)) + { + int x = _component->getX(); + int y = _component->getY(); + + // local to global + auto parent = _component->getParentComponent(); + + while(parent && parent != this) + { + x += parent->getX(); + y += parent->getY(); + parent = parent->getParentComponent(); + } + + x += (_component->getWidth()>>1) - (m_focusedParameterTooltip->getWidth()>>1); + y += _component->getHeight() + (m_focusedParameterTooltip->getHeight()>>1); + + // global to local of tooltip parent + parent = m_focusedParameterTooltip->getParentComponent(); + + while(parent && parent != this) + { + x -= parent->getX(); + y -= parent->getY(); + parent = parent->getParentComponent(); + } + + if(m_focusedParameterTooltip->getProperties().contains("offsetY")) + y += static_cast<int>(m_focusedParameterTooltip->getProperties()["offsetY"]); + + m_focusedParameterTooltip->setTopLeftPosition(x,y); + m_focusedParameterTooltip->setText(value, juce::dontSendNotification); + m_focusedParameterTooltip->setVisible(true); + m_focusedParameterTooltip->toFront(false); + } } void VirusEditor::updatePresetName() const diff --git a/source/jucePlugin/ui3/VirusEditor.h b/source/jucePlugin/ui3/VirusEditor.h @@ -64,6 +64,7 @@ namespace genericVirusUI juce::Label* m_presetName = nullptr; juce::Label* m_focusedParameterName = nullptr; juce::Label* m_focusedParameterValue = nullptr; + juce::Label* m_focusedParameterTooltip = nullptr; juce::ComboBox* m_romSelector = nullptr; juce::Button* m_playModeSingle = nullptr;