Browse Source

Ctrl-click an input port to clone the plugged cable.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
e184fdb947
1 changed files with 26 additions and 15 deletions
  1. +26
    -15
      src/app/PortWidget.cpp

+ 26
- 15
src/app/PortWidget.cpp View File

@@ -84,28 +84,38 @@ void PortWidget::onLeave(const event::Leave &e) {

void PortWidget::onDragStart(const event::DragStart &e) {
CableWidget *cw = NULL;
if (type == OUTPUT && (APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) {
// Keep cable NULL
if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) {
if (type == OUTPUT) {
// Keep cable NULL. Will be created below
}
else {
CableWidget *topCw = APP->scene->rackWidget->getTopCable(this);
if (topCw) {
cw = new CableWidget;
cw->setOutput(topCw->outputPort);
}
}
}
else {
// Grab cable on top of stack
cw = APP->scene->rackWidget->getTopCable(this);
}

if (cw) {
// history::CableRemove
history::CableRemove *h = new history::CableRemove;
h->setCable(cw);
APP->history->push(h);
if (cw) {
// history::CableRemove
history::CableRemove *h = new history::CableRemove;
h->setCable(cw);
APP->history->push(h);

// Disconnect and reuse existing cable
APP->scene->rackWidget->removeCable(cw);
if (type == OUTPUT)
cw->setOutput(NULL);
else
cw->setInput(NULL);
// Disconnect and reuse existing cable
APP->scene->rackWidget->removeCable(cw);
if (type == OUTPUT)
cw->setOutput(NULL);
else
cw->setInput(NULL);
}
}
else {

if (!cw) {
// Create a new cable
cw = new CableWidget;
if (type == OUTPUT)
@@ -113,6 +123,7 @@ void PortWidget::onDragStart(const event::DragStart &e) {
else
cw->setInput(this);
}

APP->scene->rackWidget->setIncompleteCable(cw);
e.consume(this);
}


Loading…
Cancel
Save