2
0
Fork 0

Add programs menu

There is now a third sub-menu on the right-click menu, beneath "Skins" and "Banks", from which you can select the among the programs in the current bank.
This commit is contained in:
Shane Dunne 2019-09-02 14:43:35 -04:00
parent d3c550d22e
commit 13a25f5f25

View file

@ -636,6 +636,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
PopupMenu menu;
PopupMenu skinMenu;
PopupMenu bankMenu;
PopupMenu progMenu;
Array<File> skins;
const Array<File>& banks = getFilter()->getBankFiles();
@ -670,6 +671,16 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
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();
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);
getFilter()->loadFromFXBFile(bankFile);
}
else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
{
result -= 1;
result -= progStart;
processor.setCurrentProgram(result);
}
}
}