2023-07-25 19:44:18 +00:00
|
|
|
#include "MainMenuBarModel.h"
|
|
|
|
#include "../PluginEditor.h"
|
|
|
|
|
|
|
|
juce::StringArray MainMenuBarModel::getMenuBarNames() {
|
2023-12-21 14:14:33 +00:00
|
|
|
if (editor.processor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) {
|
2023-12-21 18:31:18 +00:00
|
|
|
return juce::StringArray("File", "Audio");
|
2023-12-21 14:14:33 +00:00
|
|
|
} else {
|
|
|
|
return juce::StringArray("File");
|
|
|
|
}
|
2023-07-25 19:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
juce::PopupMenu MainMenuBarModel::getMenuForIndex(int topLevelMenuIndex, const juce::String& menuName) {
|
|
|
|
juce::PopupMenu menu;
|
2023-12-20 20:58:08 +00:00
|
|
|
|
|
|
|
if (topLevelMenuIndex == 0) {
|
|
|
|
menu.addItem(1, "Open");
|
|
|
|
menu.addItem(2, "Save");
|
|
|
|
menu.addItem(3, "Save As");
|
2023-12-21 14:43:15 +00:00
|
|
|
if (editor.processor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) {
|
|
|
|
menu.addItem(4, "Create New Project");
|
|
|
|
}
|
2023-12-20 20:58:08 +00:00
|
|
|
} else if (topLevelMenuIndex == 1) {
|
2023-12-21 18:31:18 +00:00
|
|
|
menu.addItem(1, "Settings");
|
2023-12-20 20:58:08 +00:00
|
|
|
}
|
|
|
|
|
2023-07-25 19:44:18 +00:00
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainMenuBarModel::menuItemSelected(int menuItemID, int topLevelMenuIndex) {
|
2023-12-20 20:58:08 +00:00
|
|
|
switch (topLevelMenuIndex) {
|
|
|
|
case 0:
|
|
|
|
switch (menuItemID) {
|
|
|
|
case 1:
|
|
|
|
editor.openProject();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
editor.saveProject();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
editor.saveProjectAs();
|
|
|
|
break;
|
2023-12-21 14:43:15 +00:00
|
|
|
case 4:
|
|
|
|
editor.resetToDefault();
|
|
|
|
break;
|
2023-12-20 20:58:08 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2023-07-25 19:44:18 +00:00
|
|
|
break;
|
2023-12-20 20:58:08 +00:00
|
|
|
case 1:
|
|
|
|
editor.openAudioSettings();
|
2023-07-25 19:44:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2023-12-20 20:58:08 +00:00
|
|
|
|
2023-07-25 19:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainMenuBarModel::menuBarActivated(bool isActive) {}
|