Browse Source

Add menu item and key command for cloning selected modules.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
eeaafcfb88
4 changed files with 19 additions and 2 deletions
  1. +1
    -0
      include/app/RackWidget.hpp
  2. +4
    -2
      src/app/ModuleWidget.cpp
  3. +9
    -0
      src/app/RackWidget.cpp
  4. +5
    -0
      src/app/Scene.cpp

+ 1
- 0
include/app/RackWidget.hpp View File

@@ -82,6 +82,7 @@ struct RackWidget : widget::OpaqueWidget {
void resetSelectedModulesAction();
void randomizeSelectedModulesAction();
void disconnectSelectedModulesAction();
void cloneSelectedModulesAction();
void bypassSelectedModulesAction(bool bypassed);
bool areSelectedModulesBypassed();
void deleteSelectedModulesAction();


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

@@ -345,8 +345,10 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) {
e.consume(this);
}
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
cloneAction();
e.consume(this);
if (!APP->scene->rack->hasSelectedModules()) {
cloneAction();
e.consume(this);
}
}
if (e.keyName == "u" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
if (!APP->scene->rack->hasSelectedModules()) {


+ 9
- 0
src/app/RackWidget.cpp View File

@@ -761,6 +761,10 @@ void RackWidget::disconnectSelectedModulesAction() {
delete complexAction;
}

void RackWidget::cloneSelectedModulesAction() {
// TODO
}

void RackWidget::bypassSelectedModulesAction(bool bypassed) {
history::ComplexAction* complexAction = new history::ComplexAction;
complexAction->name = bypassed ? "bypass modules" : "un-bypass modules";
@@ -877,6 +881,11 @@ void RackWidget::appendSelectionContextMenu(ui::Menu* menu) {
disconnectSelectedModulesAction();
}, n == 0));

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

// Bypass
std::string bypassText = RACK_MOD_CTRL_NAME "+E";
bool bypassed = (n > 0) && areSelectedModulesBypassed();


+ 5
- 0
src/app/Scene.cpp View File

@@ -230,6 +230,11 @@ void Scene::onHoverKey(const HoverKeyEvent& e) {
rack->randomizeSelectedModulesAction();
e.consume(this);
}
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
if (rack->hasSelectedModules())
rack->cloneSelectedModulesAction();
e.consume(this);
}
if (e.keyName == "u" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
if (rack->hasSelectedModules())
rack->disconnectSelectedModulesAction();


Loading…
Cancel
Save