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 64180151569adff31c012819e42cb8ae42a74a78
parent 024359310809127d0ca01d7e0d8ef3f4131dedba
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 20 Mar 2022 02:15:04 +0100

add support for custom component properties

Diffstat:
Msource/juceUiLib/uiObject.cpp | 14++++++++++++++
Msource/juceUiLib/uiObject.h | 2++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/source/juceUiLib/uiObject.cpp b/source/juceUiLib/uiObject.cpp @@ -263,6 +263,18 @@ namespace genericUI return true; } + void UiObject::readProperties(juce::Component& _target) + { + const auto it = m_components.find("componentProperties"); + if(it == m_components.end()) + return; + + const auto props = it->second; + + for (const auto& prop : props) + _target.getProperties().set(juce::Identifier(prop.first.c_str()), juce::var(prop.second.c_str())); + } + template <typename T> T* UiObject::createJuceObject(Editor& _editor) { return createJuceObject(_editor, new T()); @@ -288,6 +300,8 @@ namespace genericUI tooltipClient->setTooltip(tooltip); } + readProperties(*_object); + return comp; } diff --git a/source/juceUiLib/uiObject.h b/source/juceUiLib/uiObject.h @@ -60,6 +60,8 @@ namespace genericUI template<typename T> void bindParameter(const Editor& _editor, T& _target) const; + void readProperties(juce::Component& _target); + template<typename Target, typename Style> void createStyle(Editor& _editor, Target& _target, Style* _style);