menu, but make key command Mod+shift+D disable cloning cables.tags/v2.0.0
@@ -110,7 +110,7 @@ struct ModuleWidget : widget::OpaqueWidget { | |||||
void randomizeAction(); | void randomizeAction(); | ||||
void appendDisconnectActions(history::ComplexAction* complexAction); | void appendDisconnectActions(history::ComplexAction* complexAction); | ||||
void disconnectAction(); | void disconnectAction(); | ||||
void cloneAction(bool cloneCables); | |||||
void cloneAction(bool cloneCables = true); | |||||
void bypassAction(bool bypassed); | void bypassAction(bool bypassed); | ||||
/** Deletes `this` */ | /** Deletes `this` */ | ||||
void removeAction(); | void removeAction(); | ||||
@@ -91,7 +91,7 @@ struct RackWidget : widget::OpaqueWidget { | |||||
void resetSelectionAction(); | void resetSelectionAction(); | ||||
void randomizeSelectionAction(); | void randomizeSelectionAction(); | ||||
void disconnectSelectionAction(); | void disconnectSelectionAction(); | ||||
void cloneSelectionAction(bool cloneCables); | |||||
void cloneSelectionAction(bool cloneCables = true); | |||||
void bypassSelectionAction(bool bypassed); | void bypassSelectionAction(bool bypassed); | ||||
bool isSelectionBypassed(); | bool isSelectionBypassed(); | ||||
void deleteSelectionAction(); | void deleteSelectionAction(); | ||||
@@ -317,11 +317,11 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) { | |||||
} | } | ||||
} | } | ||||
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | ||||
cloneAction(false); | |||||
cloneAction(); | |||||
e.consume(this); | e.consume(this); | ||||
} | } | ||||
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) { | if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) { | ||||
cloneAction(true); | |||||
cloneAction(false); | |||||
e.consume(this); | e.consume(this); | ||||
} | } | ||||
if (e.keyName == "i" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | if (e.keyName == "i" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | ||||
@@ -999,14 +999,7 @@ void ModuleWidget::createContextMenu() { | |||||
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() { | menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() { | ||||
if (!weakThis) | if (!weakThis) | ||||
return; | return; | ||||
weakThis->cloneAction(false); | |||||
})); | |||||
// Duplicate with cables | |||||
menu->addChild(createMenuItem("Duplicate with cables", RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+D", [=]() { | |||||
if (!weakThis) | |||||
return; | |||||
weakThis->cloneAction(true); | |||||
weakThis->cloneAction(); | |||||
})); | })); | ||||
// Delete | // Delete | ||||
@@ -1227,12 +1227,7 @@ void RackWidget::appendSelectionContextMenu(ui::Menu* menu) { | |||||
// Duplicate | // Duplicate | ||||
menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() { | menu->addChild(createMenuItem("Duplicate", RACK_MOD_CTRL_NAME "+D", [=]() { | ||||
cloneSelectionAction(false); | |||||
}, n == 0)); | |||||
// Duplicate with cables | |||||
menu->addChild(createMenuItem("Duplicate with cables", RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+D", [=]() { | |||||
cloneSelectionAction(true); | |||||
cloneSelectionAction(); | |||||
}, n == 0)); | }, n == 0)); | ||||
// Delete | // Delete | ||||
@@ -280,13 +280,13 @@ void Scene::onHoverKey(const HoverKeyEvent& e) { | |||||
} | } | ||||
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | ||||
if (rack->hasSelection()) { | if (rack->hasSelection()) { | ||||
rack->cloneSelectionAction(false); | |||||
rack->cloneSelectionAction(); | |||||
e.consume(this); | e.consume(this); | ||||
} | } | ||||
} | } | ||||
if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) { | if (e.keyName == "d" && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) { | ||||
if (rack->hasSelection()) { | if (rack->hasSelection()) { | ||||
rack->cloneSelectionAction(true); | |||||
rack->cloneSelectionAction(false); | |||||
e.consume(this); | e.consume(this); | ||||
} | } | ||||
} | } | ||||