2
0
Fork 0

Merge pull request #10 from getdunne/master

Add programs menu
This commit is contained in:
reales 2019-09-02 20:52:44 +02:00 committed by GitHub
commit cfc90052f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -636,6 +636,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
PopupMenu menu; PopupMenu menu;
PopupMenu skinMenu; PopupMenu skinMenu;
PopupMenu bankMenu; PopupMenu bankMenu;
PopupMenu progMenu;
Array<File> skins; Array<File> skins;
const Array<File>& banks = getFilter()->getBankFiles(); const Array<File>& banks = getFilter()->getBankFiles();
@ -670,6 +671,16 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
menu.addSubMenu("Banks", bankMenu); menu.addSubMenu("Banks", bankMenu);
} }
int progStart = 2000;
{
for (int i = 0; i < processor.getNumPrograms(); ++i)
{
progMenu.addItem(i + progStart + 1, processor.getProgramName(i), true, i == processor.getCurrentProgram());
}
menu.addSubMenu("Programs", progMenu);
}
const Point<int> pos = e.getMouseDownScreenPosition(); const Point<int> pos = e.getMouseDownScreenPosition();
int result = menu.showAt(Rectangle<int>(pos.getX(), pos.getY(), 1, 1)); int result = menu.showAt(Rectangle<int>(pos.getX(), pos.getY(), 1, 1));
@ -691,6 +702,12 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
const File bankFile = banks.getUnchecked(result); const File bankFile = banks.getUnchecked(result);
getFilter()->loadFromFXBFile(bankFile); getFilter()->loadFromFXBFile(bankFile);
} }
else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
{
result -= 1;
result -= progStart;
processor.setCurrentProgram(result);
}
} }
} }