Browse Source

Implement file browser showing in separate method

master
xenakios 6 years ago
parent
commit
1a42192509
2 changed files with 23 additions and 17 deletions
  1. +22
    -17
      Source/PluginEditor.cpp
  2. +1
    -0
      Source/PluginEditor.h

+ 22
- 17
Source/PluginEditor.cpp View File

@@ -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)
{


+ 1
- 0
Source/PluginEditor.h View File

@@ -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…
Cancel
Save