diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 78e6a6f..fee3ef5 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -56,24 +56,9 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau addAndMakeVisible(&m_import_button); m_import_button.setButtonText("Show browser"); - m_import_button.onClick = [this]() + m_import_button.onClick = [this]() { - if (m_filechooser == nullptr) - { - String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", - File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); - File initialloc(initiallocfn); - m_filechooser = std::make_unique(1 | 4, - initialloc, &m_filefilter, nullptr); - m_filechooser->addListener(this); - addChildComponent(m_filechooser.get()); - } - m_filechooser->setBounds(0, 50, getWidth(), getHeight() - 60); - m_filechooser->setVisible(!m_filechooser->isVisible()); - if (m_filechooser->isVisible()) - m_import_button.setButtonText("Hide browser"); - else - m_import_button.setButtonText("Show browser"); + toggleFileBrowser(); }; addAndMakeVisible(&m_settings_button); @@ -609,6 +594,26 @@ void PaulstretchpluginAudioProcessorEditor::showAbout() } +void PaulstretchpluginAudioProcessorEditor::toggleFileBrowser() +{ + if (m_filechooser == nullptr) + { + String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", + File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); + File initialloc(initiallocfn); + m_filechooser = std::make_unique(1 | 4, + initialloc, &m_filefilter, nullptr); + m_filechooser->addListener(this); + addChildComponent(m_filechooser.get()); + } + m_filechooser->setBounds(0, 50, getWidth(), getHeight() - 60); + m_filechooser->setVisible(!m_filechooser->isVisible()); + if (m_filechooser->isVisible()) + m_import_button.setButtonText("Hide browser"); + else + m_import_button.setButtonText("Show browser"); +} + WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* thumb, StretchAudioSource* sas) : m_sas(sas) { diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index f3984fa..f8c840d 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -479,6 +479,7 @@ private: MyTabComponent m_wavefilter_tab; Component* m_wave_container=nullptr; void showAbout(); + void toggleFileBrowser(); std::vector m_capturelens{ 2,5,10,30,60,120 }; std::unique_ptr m_filechooser;