@@ -75,7 +75,12 @@ struct Model { | |||||
std::string getUserPresetDirectory(); | std::string getUserPresetDirectory(); | ||||
/** Returns the module or plugin manual URL, whichever exists. */ | /** Returns the module or plugin manual URL, whichever exists. */ | ||||
std::string getManualUrl(); | std::string getManualUrl(); | ||||
void appendContextMenu(ui::Menu* menu); | |||||
/** Appends items to menu with useful Model information. | |||||
Enable `inBrowser` to show Module Browser key commands. | |||||
*/ | |||||
void appendContextMenu(ui::Menu* menu, bool inBrowser = false); | |||||
bool isFavorite(); | bool isFavorite(); | ||||
void setFavorite(bool favorite); | void setFavorite(bool favorite); | ||||
}; | }; | ||||
@@ -305,7 +305,7 @@ struct ModelBox : widget::OpaqueWidget { | |||||
menu->addChild(createMenuLabel(model->name)); | menu->addChild(createMenuLabel(model->name)); | ||||
menu->addChild(createMenuLabel(model->plugin->brand)); | menu->addChild(createMenuLabel(model->plugin->brand)); | ||||
model->appendContextMenu(menu); | |||||
model->appendContextMenu(menu, true); | |||||
} | } | ||||
}; | }; | ||||
@@ -95,7 +95,7 @@ std::string Model::getManualUrl() { | |||||
} | } | ||||
void Model::appendContextMenu(ui::Menu* menu) { | |||||
void Model::appendContextMenu(ui::Menu* menu, bool inBrowser) { | |||||
// plugin | // plugin | ||||
menu->addChild(createMenuItem("Plugin: " + plugin->name, "", [=]() { | menu->addChild(createMenuItem("Plugin: " + plugin->name, "", [=]() { | ||||
system::openBrowser(plugin->pluginUrl); | system::openBrowser(plugin->pluginUrl); | ||||
@@ -181,12 +181,12 @@ void Model::appendContextMenu(ui::Menu* menu) { | |||||
} | } | ||||
// Favorite | // Favorite | ||||
menu->addChild(createBoolMenuItem("Favorite", | |||||
std::string favoriteRightText = inBrowser ? (RACK_MOD_CTRL_NAME "+click") : ""; | |||||
if (isFavorite()) | |||||
favoriteRightText += " " CHECKMARK_STRING; | |||||
menu->addChild(createMenuItem("Favorite", favoriteRightText, | |||||
[=]() { | [=]() { | ||||
return isFavorite(); | |||||
}, | |||||
[=](bool favorite) { | |||||
setFavorite(favorite); | |||||
setFavorite(!isFavorite()); | |||||
} | } | ||||
)); | )); | ||||
} | } | ||||