From b6e46bd293aa39191735396d8b8eb87fc218025d Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 20 Dec 2017 00:50:47 +0200 Subject: [PATCH] Add settings menu button --- Source/PluginEditor.cpp | 18 ++++++++++++++++-- Source/PluginEditor.h | 2 ++ Source/PluginProcessor.cpp | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 076f159..0280c18 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -33,6 +33,10 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa m_import_button.setButtonText("Import file..."); attachCallback(m_import_button, [this]() { chooseFile(); }); + addAndMakeVisible(&m_settings_button); + m_settings_button.setButtonText("Settings..."); + attachCallback(m_settings_button, [this]() { showSettingsMenu(); }); + addAndMakeVisible(&m_info_label); addAndMakeVisible(&m_wavecomponent); const auto& pars = processor.getParameters(); @@ -86,8 +90,10 @@ void PaulstretchpluginAudioProcessorEditor::resized() { m_import_button.setBounds(1, 1, 60, 24); m_import_button.changeWidthToFitText(); - - m_info_label.setBounds(m_import_button.getRight() + 1, m_import_button.getY(), getWidth()-m_import_button.getRight()-1, 24); + m_settings_button.setBounds(m_import_button.getRight() + 1, 1, 60, 24); + m_settings_button.changeWidthToFitText(); + m_info_label.setBounds(m_settings_button.getRight() + 1, m_settings_button.getY(), + getWidth()-m_settings_button.getRight()-1, 24); std::array indexes; indexes[cpi_main_volume] = 0; indexes[cpi_pause_enabled] = 1; indexes[cpi_capture_enabled] = 2; indexes[cpi_max_capture_len] = 3; @@ -214,6 +220,14 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile() } } +void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() +{ + PopupMenu menu; + menu.addItem(1, "Foo 1", true, false); + menu.addItem(2, "Foo 2", true, false); + int r = menu.show(); +} + WaveformComponent::WaveformComponent(AudioFormatManager* afm) { TimeSelectionChangedCallback = [](Range, int) {}; diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index e58e9c4..dcb2c83 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -337,9 +337,11 @@ private: //SpectralVisualizer m_specvis; TextButton m_import_button; + TextButton m_settings_button; Label m_info_label; SpectralChainEditor m_spec_order_ed; void chooseFile(); + void showSettingsMenu(); String m_last_err; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index c014fca..ba6ce8d 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -297,6 +297,7 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl m_cur_num_out_chans = numoutchans; m_ready_to_play = true; } + } void PaulstretchpluginAudioProcessor::releaseResources()