commit e4f6814b9a602f490de1025fa64614aa96ef9e5e
parent 6ad408a31395eacacc42f8454017cfa21efe6b9f
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Thu, 18 Apr 2024 22:01:55 +0200
Merge branch 'oss/osirus' into oss/vavra
Diffstat:
3 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/source/jucePluginEditorLib/focusedParameter.cpp b/source/jucePluginEditorLib/focusedParameter.cpp
@@ -60,6 +60,34 @@ namespace jucePluginEditorLib
updateControlLabel(component);
}
+ void FocusedParameter::updateParameter(const std::string& _name, const std::string& _value)
+ {
+ if (m_focusedParameterName)
+ {
+ if(_name.empty())
+ {
+ m_focusedParameterName->setVisible(false);
+ }
+ else
+ {
+ m_focusedParameterName->setText(_name, juce::dontSendNotification);
+ m_focusedParameterName->setVisible(true);
+ }
+ }
+ if(m_focusedParameterValue)
+ {
+ if(_value.empty())
+ {
+ m_focusedParameterValue->setVisible(false);
+ }
+ else
+ {
+ m_focusedParameterValue->setText(_value, juce::dontSendNotification);
+ m_focusedParameterValue->setVisible(true);
+ }
+ }
+ }
+
void FocusedParameter::timerCallback()
{
updateControlLabel(nullptr);
@@ -78,10 +106,7 @@ namespace jucePluginEditorLib
if(!_component || !_component->getProperties().contains("parameter"))
{
- if (m_focusedParameterName)
- m_focusedParameterName->setVisible(false);
- if (m_focusedParameterValue)
- m_focusedParameterValue->setVisible(false);
+ updateParameter({}, {});
m_tooltip->setVisible(false);
return;
}
@@ -102,29 +127,16 @@ namespace jucePluginEditorLib
}
if(!p)
{
- if (m_focusedParameterName)
- m_focusedParameterName->setVisible(false);
- if (m_focusedParameterValue)
- m_focusedParameterValue->setVisible(false);
+ updateParameter({}, {});
m_tooltip->setVisible(false);
return;
}
- const auto value = p->getText(p->getValue(), 0);
+ const auto value = p->getText(p->getValue(), 0).toStdString();
const auto& desc = p->getDescription();
- if (m_focusedParameterName)
- {
- m_focusedParameterName->setText(desc.displayName, juce::dontSendNotification);
- m_focusedParameterName->setVisible(true);
- }
-
- if (m_focusedParameterValue)
- {
- m_focusedParameterValue->setText(value, juce::dontSendNotification);
- m_focusedParameterValue->setVisible(true);
- }
+ updateParameter(desc.displayName, value);
m_tooltip->initialize(_component, value);
diff --git a/source/jucePluginEditorLib/focusedParameter.h b/source/jucePluginEditorLib/focusedParameter.h
@@ -31,6 +31,8 @@ namespace jucePluginEditorLib
void onMouseEnter(const juce::MouseEvent& _event);
+ virtual void updateParameter(const std::string& _name, const std::string& _value);
+
private:
void timerCallback() override;
void updateControlLabel(juce::Component* _component);
diff --git a/source/jucePluginLib/patchdb/db.cpp b/source/jucePluginLib/patchdb/db.cpp
@@ -1421,6 +1421,7 @@ namespace pluginLib::patchDB
bool DB::saveJson()
{
m_cacheDirty = true;
+ m_cacheFileName.deleteFile();
if (!m_jsonFileName.hasWriteAccess())
{
@@ -1689,8 +1690,6 @@ namespace pluginLib::patchDB
if(!synthLib::readFile(data, m_cacheFileName.getFullPathName().toStdString()))
return false;
- m_cacheFileName.deleteFile();
-
synthLib::BinaryStream inStream(data);
auto stream = inStream.tryReadChunk(chunks::g_patchManager);