kopia lustrzana https://github.com/jameshball/osci-render
Add sosci logo to about section and add examples dropdown
rodzic
a954424d7b
commit
ed7f046beb
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 16 MiB |
Plik binarny nie jest wyświetlany.
|
@ -21,6 +21,10 @@ juce::StringArray MainMenuBarModel::getMenuBarNames() {
|
|||
|
||||
juce::PopupMenu MainMenuBarModel::getMenuForIndex(int topLevelMenuIndex, const juce::String& menuName) {
|
||||
juce::PopupMenu menu;
|
||||
|
||||
if (customMenuLogic) {
|
||||
customMenuLogic(menu, topLevelMenuIndex);
|
||||
}
|
||||
|
||||
for (int i = 0; i < menuItems[topLevelMenuIndex].size(); i++) {
|
||||
menu.addItem(i + 1, menuItems[topLevelMenuIndex][i].first);
|
||||
|
@ -30,6 +34,9 @@ juce::PopupMenu MainMenuBarModel::getMenuForIndex(int topLevelMenuIndex, const j
|
|||
}
|
||||
|
||||
void MainMenuBarModel::menuItemSelected(int menuItemID, int topLevelMenuIndex) {
|
||||
if (customMenuSelectedLogic && customMenuSelectedLogic(menuItemID, topLevelMenuIndex)) {
|
||||
return;
|
||||
}
|
||||
menuItems[topLevelMenuIndex][menuItemID - 1].second();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ public:
|
|||
|
||||
void addTopLevelMenu(const juce::String& name);
|
||||
void addMenuItem(int topLevelMenuIndex, const juce::String& name, std::function<void()> action);
|
||||
|
||||
std::function<void(juce::PopupMenu&, int)> customMenuLogic;
|
||||
std::function<bool(int, int)> customMenuSelectedLogic;
|
||||
|
||||
private:
|
||||
juce::StringArray getMenuBarNames() override;
|
||||
|
|
|
@ -2,11 +2,39 @@
|
|||
#include "../SosciPluginEditor.h"
|
||||
#include "../SosciPluginProcessor.h"
|
||||
|
||||
SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& e, SosciAudioProcessor& processor) : editor(e), processor(processor) {
|
||||
SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& e, SosciAudioProcessor& p) : editor(e), processor(p) {
|
||||
addTopLevelMenu("File");
|
||||
addTopLevelMenu("About");
|
||||
addTopLevelMenu("Recording");
|
||||
addTopLevelMenu("Audio");
|
||||
|
||||
std::vector<std::tuple<juce::String, const void *, int>> examples = {
|
||||
{"default.sosci", BinaryData::default_sosci, BinaryData::default_sosciSize},
|
||||
};
|
||||
|
||||
// This is a hack - ideally I would improve the MainMenuBarModel class to allow for submenus
|
||||
customMenuLogic = [this, examples](juce::PopupMenu& menu, int topLevelMenuIndex) {
|
||||
if (topLevelMenuIndex == 0) {
|
||||
juce::PopupMenu submenu;
|
||||
|
||||
for (int i = 0; i < examples.size(); i++) {
|
||||
submenu.addItem(SUBMENU_ID + i, std::get<0>(examples[i]));
|
||||
}
|
||||
|
||||
menu.addSubMenu("Examples", submenu);
|
||||
}
|
||||
};
|
||||
|
||||
customMenuSelectedLogic = [this, examples](int menuItemID, int topLevelMenuIndex) {
|
||||
if (topLevelMenuIndex == 0) {
|
||||
if (menuItemID >= SUBMENU_ID) {
|
||||
int index = menuItemID - SUBMENU_ID;
|
||||
processor.setStateInformation(std::get<1>(examples[index]), std::get<2>(examples[index]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
addMenuItem(0, "Open", [&]() { editor.openProject(); });
|
||||
addMenuItem(0, "Save", [&]() { editor.saveProject(); });
|
||||
|
@ -17,7 +45,7 @@ SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& e, SosciAudioPro
|
|||
|
||||
addMenuItem(1, "About sosci", [&]() {
|
||||
juce::DialogWindow::LaunchOptions options;
|
||||
AboutComponent* about = new AboutComponent(BinaryData::logo_png, BinaryData::logo_pngSize,
|
||||
AboutComponent* about = new AboutComponent(BinaryData::sosci_logo_png, BinaryData::sosci_logo_pngSize,
|
||||
juce::String(ProjectInfo::projectName) + " by " + ProjectInfo::companyName + "\n"
|
||||
#if SOSCI_FEATURES
|
||||
"Thank you for purchasing sosci!\n"
|
||||
|
@ -34,7 +62,7 @@ SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& e, SosciAudioPro
|
|||
options.content.setOwned(about);
|
||||
options.content->setSize(500, 270);
|
||||
options.dialogTitle = "About";
|
||||
options.dialogBackgroundColour = Colours::dark;
|
||||
options.dialogBackgroundColour = Colours::veryDark;
|
||||
options.escapeKeyTriggersCloseButton = true;
|
||||
#if JUCE_WINDOWS
|
||||
// if not standalone, use native title bar for compatibility with DAWs
|
||||
|
|
|
@ -12,4 +12,6 @@ public:
|
|||
|
||||
SosciPluginEditor& editor;
|
||||
SosciAudioProcessor& processor;
|
||||
|
||||
const int SUBMENU_ID = 100;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
file="Resources/fonts/FiraSans-Regular.ttf"/>
|
||||
</GROUP>
|
||||
<GROUP id="{525C568C-29E9-D0A2-9773-8A04981C5575}" name="images">
|
||||
<FILE id="jI9VSZ" name="logo.png" compile="0" resource="1" file="Resources/images/logo.png"/>
|
||||
<FILE id="vNhqT4" name="sosci_logo.png" compile="0" resource="1" file="Resources/images/sosci_logo.png"/>
|
||||
<FILE id="G294jK" name="sosci_mac.png" compile="0" resource="1" file="Resources/images/sosci_mac.png"/>
|
||||
<FILE id="CeSRLV" name="sosci_mac_saturated.png" compile="0" resource="1"
|
||||
file="Resources/images/sosci_mac_saturated.png"/>
|
||||
|
@ -36,6 +36,9 @@
|
|||
<FILE id="XojumY" name="vector_display_reflection.jpg" compile="0"
|
||||
resource="1" file="Resources/oscilloscope/vector_display_reflection.jpg"/>
|
||||
</GROUP>
|
||||
<GROUP id="{08DE8F94-4A00-7C71-4AF3-4C34C821A5DF}" name="sosci">
|
||||
<FILE id="AHn0sU" name="default.sosci" compile="0" resource="1" file="Resources/sosci/default.sosci"/>
|
||||
</GROUP>
|
||||
<GROUP id="{82BCD6F1-A8BF-F30B-5587-81EE70168883}" name="svg">
|
||||
<FILE id="rl17ZK" name="cog.svg" compile="0" resource="1" file="Resources/svg/cog.svg"/>
|
||||
<FILE id="sDajXu" name="delete.svg" compile="0" resource="1" file="Resources/svg/delete.svg"/>
|
||||
|
|
Ładowanie…
Reference in New Issue