Browse Source

Don't remove ModuleWidget while holding Delete, only pressing/repeating.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
19ea6d0e81
2 changed files with 12 additions and 18 deletions
  1. +2
    -8
      src/app/ModuleWidget.cpp
  2. +10
    -10
      src/app/RackWidget.cpp

+ 2
- 8
src/app/ModuleWidget.cpp View File

@@ -331,10 +331,6 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) {
cloneAction();
e.consume(this);
}
if ((e.key == GLFW_KEY_DELETE || e.key == GLFW_KEY_BACKSPACE) && (e.mods & RACK_MOD_MASK) == 0) {
removeAction();
e.consume(this);
}
if (e.keyName == "i" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
resetAction();
e.consume(this);
@@ -351,13 +347,11 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) {
bypassAction(!module->isBypassed());
e.consume(this);
}
}

if (e.action == RACK_HELD) {
// Also handle Delete/Backspace when holding the key while hovering
if ((e.key == GLFW_KEY_DELETE || e.key == GLFW_KEY_BACKSPACE) && (e.mods & RACK_MOD_MASK) == 0) {
// Deletes `this`
removeAction();
e.consume(NULL);
return;
}
}



+ 10
- 10
src/app/RackWidget.cpp View File

@@ -1026,16 +1026,6 @@ void RackWidget::appendSelectionContextMenu(ui::Menu* menu) {
pasteClipboardAction();
}));

// Duplicate
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() {
cloneSelectedModulesAction();
}, n == 0));

// Delete
menu->addChild(createMenuItem("Delete", "Backspace/Delete", [=]() {
deleteSelectedModulesAction();
}, n == 0));

// Initialize
menu->addChild(createMenuItem("Initialize", RACK_MOD_CTRL_NAME "+I", [=]() {
resetSelectedModulesAction();
@@ -1059,6 +1049,16 @@ void RackWidget::appendSelectionContextMenu(ui::Menu* menu) {
menu->addChild(createMenuItem("Bypass", bypassText, [=]() {
bypassSelectedModulesAction(!bypassed);
}, n == 0));

// Duplicate
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() {
cloneSelectedModulesAction();
}, n == 0));

// Delete
menu->addChild(createMenuItem("Delete", "Backspace/Delete", [=]() {
deleteSelectedModulesAction();
}, n == 0));
}

void RackWidget::clearCables() {


Loading…
Cancel
Save