Initial work on custom GUI
This commit is contained in:
@ -12,11 +12,55 @@
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "PluginProcessor.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class ParameterComponent : public Component,
|
||||
public Slider::Listener
|
||||
{
|
||||
public:
|
||||
ParameterComponent(AudioProcessorParameter* par) : m_par(par)
|
||||
{
|
||||
addAndMakeVisible(&m_label);
|
||||
m_label.setText(par->getName(50),dontSendNotification);
|
||||
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par);
|
||||
if (floatpar)
|
||||
{
|
||||
m_slider = std::make_unique<Slider>();
|
||||
m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval);
|
||||
m_slider->setValue(*floatpar, dontSendNotification);
|
||||
m_slider->addListener(this);
|
||||
addAndMakeVisible(m_slider.get());
|
||||
}
|
||||
AudioParameterChoice* choicepar = dynamic_cast<AudioParameterChoice*>(par);
|
||||
if (choicepar)
|
||||
{
|
||||
|
||||
}
|
||||
AudioParameterBool* boolpar = dynamic_cast<AudioParameterBool*>(par);
|
||||
if (boolpar)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
void resized() override
|
||||
{
|
||||
m_label.setBounds(0, 0, 200, 24);
|
||||
if (m_slider)
|
||||
m_slider->setBounds(m_label.getRight() + 1, 0, getWidth() - 2 - m_label.getWidth(), 24);
|
||||
}
|
||||
void sliderValueChanged(Slider* slid) override
|
||||
{
|
||||
|
||||
}
|
||||
private:
|
||||
Label m_label;
|
||||
AudioProcessorParameter* m_par = nullptr;
|
||||
std::unique_ptr<Slider> m_slider;
|
||||
std::unique_ptr<ComboBox> m_combobox;
|
||||
std::unique_ptr<ToggleButton> m_togglebut;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
*/
|
||||
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor
|
||||
{
|
||||
public:
|
||||
@ -28,9 +72,7 @@ public:
|
||||
void resized() override;
|
||||
|
||||
private:
|
||||
// This reference is provided as a quick way for your editor to
|
||||
// access the processor object that created it.
|
||||
PaulstretchpluginAudioProcessor& processor;
|
||||
|
||||
std::vector<std::shared_ptr<ParameterComponent>> m_parcomps;
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
||||
};
|
||||
|
Reference in New Issue
Block a user