Browse Source

Add ModelBox key commands for module manual and favorite.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
1ecdee5981
1 changed files with 19 additions and 1 deletions
  1. +19
    -1
      src/app/Browser.cpp

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

@@ -227,7 +227,7 @@ struct ModelBox : widget::OpaqueWidget {
}

void onButton(const ButtonEvent& e) override {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & RACK_MOD_MASK) == 0) {
ModuleWidget* mw = chooseModel(model);

// Pretend the moduleWidget was clicked so it can be dragged in the RackWidget
@@ -239,6 +239,11 @@ struct ModelBox : widget::OpaqueWidget {
mw->dragEnabled() = false;
}

if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
setFavorite(!isFavorite());
e.consume(this);
}

// Open context menu on right-click
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) {
createContextMenu();
@@ -246,6 +251,19 @@ struct ModelBox : widget::OpaqueWidget {
}
}

void onHoverKey(const HoverKeyEvent& e) override {
if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
if (e.key == GLFW_KEY_F1 && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
system::openBrowser(model->getManualUrl());
e.consume(this);
}
}

if (e.isConsumed())
return;
OpaqueWidget::onHoverKey(e);
}

ui::Tooltip* createTooltip() {
std::string text;
text += model->name;


Loading…
Cancel
Save