Browse Source

Add key command label to Favorite menu of Model.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
3cc3be7847
3 changed files with 13 additions and 8 deletions
  1. +6
    -1
      include/plugin/Model.hpp
  2. +1
    -1
      src/app/Browser.cpp
  3. +6
    -6
      src/plugin/Model.cpp

+ 6
- 1
include/plugin/Model.hpp View File

@@ -75,7 +75,12 @@ struct Model {
std::string getUserPresetDirectory();
/** Returns the module or plugin manual URL, whichever exists. */
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();
void setFavorite(bool favorite);
};


+ 1
- 1
src/app/Browser.cpp View File

@@ -305,7 +305,7 @@ struct ModelBox : widget::OpaqueWidget {

menu->addChild(createMenuLabel(model->name));
menu->addChild(createMenuLabel(model->plugin->brand));
model->appendContextMenu(menu);
model->appendContextMenu(menu, true);
}
};



+ 6
- 6
src/plugin/Model.cpp View File

@@ -95,7 +95,7 @@ std::string Model::getManualUrl() {
}


void Model::appendContextMenu(ui::Menu* menu) {
void Model::appendContextMenu(ui::Menu* menu, bool inBrowser) {
// plugin
menu->addChild(createMenuItem("Plugin: " + plugin->name, "", [=]() {
system::openBrowser(plugin->pluginUrl);
@@ -181,12 +181,12 @@ void Model::appendContextMenu(ui::Menu* menu) {
}

// 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());
}
));
}


Loading…
Cancel
Save