diff --git a/include/plugin.hpp b/include/plugin.hpp index 71e6471d..da0c637c 100644 --- a/include/plugin.hpp +++ b/include/plugin.hpp @@ -17,12 +17,15 @@ struct Plugin { std::string slug; /** Human readable name for your plugin, e.g. "Foo Modular" */ std::string name; - /** The file path of the plugins directory */ - std::string path; /** A list of the models made available by this plugin */ std::list models; + /** The file path of the plugins directory */ + std::string path; /** OS-dependent library handle */ void *handle = NULL; + /** Optional metadata for the Add Module context menu */ + std::string homepageUrl; + std::string manualUrl; }; struct Model { diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 58dc055b..03820243 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -366,10 +366,18 @@ struct AddModuleMenuItem : MenuItem { } }; +struct UrlItem : MenuItem { + std::string url; + void onAction() { + openBrowser(url); + } +}; + struct AddPluginMenuItem : MenuItem { Plugin *plugin; Vec modulePos; Menu *createChildMenu() { + // Model items Menu *menu = new Menu(); for (Model *model : plugin->models) { AddModuleMenuItem *item = new AddModuleMenuItem(); @@ -378,6 +386,39 @@ struct AddPluginMenuItem : MenuItem { item->modulePos = modulePos; menu->pushChild(item); } + + // Metadata items + { + MenuLabel *label = new MenuLabel(); + menu->pushChild(label); + } + { + MenuLabel *label = new MenuLabel(); + label->text = plugin->name; + menu->pushChild(label); + } + + if (!plugin->homepageUrl.empty()) { + UrlItem *item = new UrlItem(); + item->text = "Homepage"; + item->url = plugin->homepageUrl; + menu->pushChild(item); + } + + if (!plugin->manualUrl.empty()) { + UrlItem *item = new UrlItem(); + item->text = "Manual"; + item->url = plugin->manualUrl; + menu->pushChild(item); + } + + if (!plugin->path.empty()) { + UrlItem *item = new UrlItem(); + item->text = "Browse Directory"; + item->url = plugin->path; + menu->pushChild(item); + } + return menu; } }; diff --git a/src/core/core.cpp b/src/core/core.cpp index ddc515e8..7fe507cc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -4,6 +4,7 @@ void init(rack::Plugin *plugin) { plugin->slug = "Core"; plugin->name = "Core"; + plugin->homepageUrl = "https://vcvrack.com/"; createModel(plugin, "AudioInterface", "Audio Interface"); createModel(plugin, "MidiInterface", "MIDI Interface"); }