2
0
Fork 0

Async menu

This commit is contained in:
George Reales 2020-05-30 18:59:56 +02:00
parent ab8f2c2fec
commit 3a66cbe99e
3 changed files with 18 additions and 16 deletions

View file

@ -31,7 +31,6 @@ PluginEditor::PluginEditor (AdlibBlasterAudioProcessor* ownerFilter)
: AudioProcessorEditor (ownerFilter)
{
//[Constructor_pre] You can add your own custom stuff here..
PropertiesFile::Options options;
options.applicationName = ProjectInfo::projectName;
options.osxLibrarySubFolder = "Application Support";

View file

@ -62,8 +62,6 @@ private:
//==============================================================================
std::unique_ptr<PluginGui> comp;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginEditor)
};

View file

@ -163,6 +163,7 @@ void PluginGui::setRecordButtonState(bool recording) {
PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
groupComponent2.reset (new GroupComponent ("new group",
@ -3043,6 +3044,7 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
}
bool PluginGui::loadBrowserFile(){
FileChooser browser("Select SBI instrument file",
instrumentLoadDirectory,
#ifdef JUCE_IOS
@ -3082,20 +3084,23 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
}
}
if(hasFile){
int id = menuLoad.show();
//int id = menuLoad.show();
menuLoad.showMenuAsync (PopupMenu::Options().withParentComponent (this->getTopLevelComponent()), [this](int id){
if (id > 0) {
selectedIdxFile = id -1;
if (allSbiFiles[selectedIdxFile].existsAsFile()){
processor->loadInstrumentFromFile(allSbiFiles[selectedIdxFile].getFullPathName());
this->selectedIdxFile = id -1;
if (this->allSbiFiles[selectedIdxFile].existsAsFile()){
this->processor->loadInstrumentFromFile(allSbiFiles[selectedIdxFile].getFullPathName());
} else {
loadBrowserFile();
this->loadBrowserFile();
}
}
// No select, return true to ignore the popup menu
else{
return true;
return;
}
});
}
return hasFile;
}