diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 7293dbd..3eebc6c 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -25,20 +25,20 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA extern String g_plugintitle; //============================================================================== -PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (PaulstretchpluginAudioProcessor& p) - : AudioProcessorEditor (&p), - m_wavecomponent(p.m_afm), - processor (p) +PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p) + : AudioProcessorEditor(&p), + m_wavecomponent(p.m_afm), + processor(p) { addAndMakeVisible(&m_import_button); m_import_button.setButtonText("Import file..."); - attachCallback(m_import_button, [this]() { chooseFile(); }); + m_import_button.onClick = [this]() { chooseFile(); }; addAndMakeVisible(&m_settings_button); m_settings_button.setButtonText("Settings..."); - attachCallback(m_settings_button, [this]() { showSettingsMenu(); }); - + m_settings_button.onClick = [this]() { showSettingsMenu(); }; + addAndMakeVisible(&m_info_label); m_info_label.setJustificationType(Justification::centredRight); diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 32f758b..186b8c5 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -40,34 +40,6 @@ private: double m_elapsed = 0.0; }; -inline void attachCallback(Button& button, std::function callback) -{ - struct ButtonCallback : public Button::Listener, - private ComponentListener - { - ButtonCallback(Button& b, std::function f) : target(b), fn(f) - { - target.addListener(this); - target.addComponentListener(this); - } - - ~ButtonCallback() - { - target.removeListener(this); - } - - void componentBeingDeleted(Component&) override { delete this; } - void buttonClicked(Button*) override { fn(); } - - Button& target; - std::function fn; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ButtonCallback) - }; - - new ButtonCallback(button, callback); -} - class MySlider : public Slider { public: