Remove dependency on modified Juce Component header

This commit is contained in:
xenakios 2019-02-28 16:53:40 +02:00
parent 33dae072ac
commit ae8a5e44c8
2 changed files with 10 additions and 2 deletions

View File

@ -377,3 +377,11 @@ private:
double m_slope; double m_slope;
double m_sr = 0.0; double m_sr = 0.0;
}; };
template<typename T, typename... Args>
inline std::unique_ptr<T> makeAddAndMakeVisible(Component& parent, Args&&... args)
{
auto temp = std::make_unique<T>(args...);
parent.addAndMakeVisible(temp.get());
return std::move(temp);
}

View File

@ -1182,7 +1182,7 @@ ParameterComponent::ParameterComponent(AudioProcessorParameter * par, bool notif
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par); AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par);
if (floatpar) if (floatpar)
{ {
m_slider = makeAddAndMakeVisible<MySlider>(&floatpar->range); m_slider = makeAddAndMakeVisible<MySlider>(*this,&floatpar->range);
m_notify_only_on_release = notifyOnlyOnRelease; m_notify_only_on_release = notifyOnlyOnRelease;
m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval); m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval);
m_slider->setValue(*floatpar, dontSendNotification); m_slider->setValue(*floatpar, dontSendNotification);
@ -1192,7 +1192,7 @@ ParameterComponent::ParameterComponent(AudioProcessorParameter * par, bool notif
AudioParameterInt* intpar = dynamic_cast<AudioParameterInt*>(par); AudioParameterInt* intpar = dynamic_cast<AudioParameterInt*>(par);
if (intpar) if (intpar)
{ {
m_slider = makeAddAndMakeVisible<MySlider>(); m_slider = makeAddAndMakeVisible<MySlider>(*this);
m_notify_only_on_release = notifyOnlyOnRelease; m_notify_only_on_release = notifyOnlyOnRelease;
m_slider->setRange(intpar->getRange().getStart(), intpar->getRange().getEnd(), 1.0); m_slider->setRange(intpar->getRange().getStart(), intpar->getRange().getEnd(), 1.0);
m_slider->setValue(*intpar, dontSendNotification); m_slider->setValue(*intpar, dontSendNotification);