Add settings menu button

This commit is contained in:
xenakios 2017-12-20 00:50:47 +02:00
parent bcd03d923e
commit b6e46bd293
3 changed files with 19 additions and 2 deletions

View File

@ -33,6 +33,10 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
m_import_button.setButtonText("Import file..."); m_import_button.setButtonText("Import file...");
attachCallback(m_import_button, [this]() { chooseFile(); }); 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_info_label);
addAndMakeVisible(&m_wavecomponent); addAndMakeVisible(&m_wavecomponent);
const auto& pars = processor.getParameters(); const auto& pars = processor.getParameters();
@ -86,8 +90,10 @@ void PaulstretchpluginAudioProcessorEditor::resized()
{ {
m_import_button.setBounds(1, 1, 60, 24); m_import_button.setBounds(1, 1, 60, 24);
m_import_button.changeWidthToFitText(); m_import_button.changeWidthToFitText();
m_settings_button.setBounds(m_import_button.getRight() + 1, 1, 60, 24);
m_info_label.setBounds(m_import_button.getRight() + 1, m_import_button.getY(), getWidth()-m_import_button.getRight()-1, 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<int,30> indexes; std::array<int,30> indexes;
indexes[cpi_main_volume] = 0; indexes[cpi_pause_enabled] = 1; indexes[cpi_main_volume] = 0; indexes[cpi_pause_enabled] = 1;
indexes[cpi_capture_enabled] = 2; indexes[cpi_max_capture_len] = 3; 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) WaveformComponent::WaveformComponent(AudioFormatManager* afm)
{ {
TimeSelectionChangedCallback = [](Range<double>, int) {}; TimeSelectionChangedCallback = [](Range<double>, int) {};

View File

@ -337,9 +337,11 @@ private:
//SpectralVisualizer m_specvis; //SpectralVisualizer m_specvis;
TextButton m_import_button; TextButton m_import_button;
TextButton m_settings_button;
Label m_info_label; Label m_info_label;
SpectralChainEditor m_spec_order_ed; SpectralChainEditor m_spec_order_ed;
void chooseFile(); void chooseFile();
void showSettingsMenu();
String m_last_err; String m_last_err;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
}; };

View File

@ -297,6 +297,7 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl
m_cur_num_out_chans = numoutchans; m_cur_num_out_chans = numoutchans;
m_ready_to_play = true; m_ready_to_play = true;
} }
} }
void PaulstretchpluginAudioProcessor::releaseResources() void PaulstretchpluginAudioProcessor::releaseResources()