@@ -17,12 +17,15 @@ struct Plugin { | |||||
std::string slug; | std::string slug; | ||||
/** Human readable name for your plugin, e.g. "Foo Modular" */ | /** Human readable name for your plugin, e.g. "Foo Modular" */ | ||||
std::string name; | std::string name; | ||||
/** The file path of the plugins directory */ | |||||
std::string path; | |||||
/** A list of the models made available by this plugin */ | /** A list of the models made available by this plugin */ | ||||
std::list<Model*> models; | std::list<Model*> models; | ||||
/** The file path of the plugins directory */ | |||||
std::string path; | |||||
/** OS-dependent library handle */ | /** OS-dependent library handle */ | ||||
void *handle = NULL; | void *handle = NULL; | ||||
/** Optional metadata for the Add Module context menu */ | |||||
std::string homepageUrl; | |||||
std::string manualUrl; | |||||
}; | }; | ||||
struct Model { | struct Model { | ||||
@@ -366,10 +366,18 @@ struct AddModuleMenuItem : MenuItem { | |||||
} | } | ||||
}; | }; | ||||
struct UrlItem : MenuItem { | |||||
std::string url; | |||||
void onAction() { | |||||
openBrowser(url); | |||||
} | |||||
}; | |||||
struct AddPluginMenuItem : MenuItem { | struct AddPluginMenuItem : MenuItem { | ||||
Plugin *plugin; | Plugin *plugin; | ||||
Vec modulePos; | Vec modulePos; | ||||
Menu *createChildMenu() { | Menu *createChildMenu() { | ||||
// Model items | |||||
Menu *menu = new Menu(); | Menu *menu = new Menu(); | ||||
for (Model *model : plugin->models) { | for (Model *model : plugin->models) { | ||||
AddModuleMenuItem *item = new AddModuleMenuItem(); | AddModuleMenuItem *item = new AddModuleMenuItem(); | ||||
@@ -378,6 +386,39 @@ struct AddPluginMenuItem : MenuItem { | |||||
item->modulePos = modulePos; | item->modulePos = modulePos; | ||||
menu->pushChild(item); | 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; | return menu; | ||||
} | } | ||||
}; | }; | ||||
@@ -4,6 +4,7 @@ | |||||
void init(rack::Plugin *plugin) { | void init(rack::Plugin *plugin) { | ||||
plugin->slug = "Core"; | plugin->slug = "Core"; | ||||
plugin->name = "Core"; | plugin->name = "Core"; | ||||
plugin->homepageUrl = "https://vcvrack.com/"; | |||||
createModel<AudioInterfaceWidget>(plugin, "AudioInterface", "Audio Interface"); | createModel<AudioInterfaceWidget>(plugin, "AudioInterface", "Audio Interface"); | ||||
createModel<MidiInterfaceWidget>(plugin, "MidiInterface", "MIDI Interface"); | createModel<MidiInterfaceWidget>(plugin, "MidiInterface", "MIDI Interface"); | ||||
} | } |