Implement file browser showing in separate method
This commit is contained in:
parent
eef1f1a8e7
commit
1a42192509
@ -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<FileBrowserComponent>(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<FileBrowserComponent>(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)
|
||||
{
|
||||
|
@ -479,6 +479,7 @@ private:
|
||||
MyTabComponent m_wavefilter_tab;
|
||||
Component* m_wave_container=nullptr;
|
||||
void showAbout();
|
||||
void toggleFileBrowser();
|
||||
std::vector<int> m_capturelens{ 2,5,10,30,60,120 };
|
||||
|
||||
std::unique_ptr<FileBrowserComponent> m_filechooser;
|
||||
|
Loading…
Reference in New Issue
Block a user