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) : AudioProcessorEditor (ownerFilter)
{ {
//[Constructor_pre] You can add your own custom stuff here.. //[Constructor_pre] You can add your own custom stuff here..
PropertiesFile::Options options; PropertiesFile::Options options;
options.applicationName = ProjectInfo::projectName; options.applicationName = ProjectInfo::projectName;
options.osxLibrarySubFolder = "Application Support"; options.osxLibrarySubFolder = "Application Support";

View File

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

View File

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