Browse Source

The color of the cables can be changed with CTRL+right click

pull/1514/head^2
The XOR 5 years ago
parent
commit
f044e2aef3
1 changed files with 15 additions and 7 deletions
  1. +15
    -7
      src/app/PortWidget.cpp

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

@@ -4,6 +4,7 @@
#include <app.hpp>
#include <history.hpp>
#include <componentlibrary.hpp>
#include <settings.hpp>


namespace rack {
@@ -65,13 +66,20 @@ void PortWidget::onButton(const event::Button &e) {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) {
CableWidget *cw = APP->scene->rack->getTopCable(this);
if (cw) {
// history::CableRemove
history::CableRemove *h = new history::CableRemove;
h->setCable(cw);
APP->history->push(h);

APP->scene->rack->removeCable(cw);
delete cw;
if ((APP->window->getMods() & RACK_MOD_MASK) == RACK_MOD_CTRL) {
int id = APP->scene->rack->nextCableColorId++;
APP->scene->rack->nextCableColorId %= settings::cableColors.size();
cw->color = settings::cableColors[id];
} else
{
// history::CableRemove
history::CableRemove *h = new history::CableRemove;
h->setCable(cw);
APP->history->push(h);

APP->scene->rack->removeCable(cw);
delete cw;
}
}

e.consume(this);


Loading…
Cancel
Save