Browse Source

Make Ctrl, Shift, and Ctrl+shift mods consistent between arrow key rack scrolling and knob movement. Ctrl is slow, Shift is fast, Ctrl+shift is very slow.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
6de4cd9be4
3 changed files with 12 additions and 13 deletions
  1. +4
    -4
      src/app/AudioWidget.cpp
  2. +4
    -5
      src/app/Knob.cpp
  3. +4
    -4
      src/app/RackScrollWidget.cpp

+ 4
- 4
src/app/AudioWidget.cpp View File

@@ -111,7 +111,7 @@ static void appendAudioDeviceMenu(ui::Menu* menu, audio::Port* port) {
int numOutputs = port->getDeviceNumOutputs(deviceId); int numOutputs = port->getDeviceNumOutputs(deviceId);
std::string name = port->getDeviceName(deviceId); std::string name = port->getDeviceName(deviceId);


// Prevents devices with a ridiculous number of channels from being displayed
// Display only 8 channel offsets per device, because some virtual devices (e.g. ALSA) can have thousands of useless channels.
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
int inputOffset = i * port->maxInputs; int inputOffset = i * port->maxInputs;
int outputOffset = i * port->maxOutputs; int outputOffset = i * port->maxOutputs;
@@ -124,7 +124,7 @@ static void appendAudioDeviceMenu(ui::Menu* menu, audio::Port* port) {
item->inputOffset = inputOffset; item->inputOffset = inputOffset;
item->outputOffset = outputOffset; item->outputOffset = outputOffset;
item->text = getDetailTemplate(name, numInputs, inputOffset, port->maxInputs, numOutputs, outputOffset, port->maxOutputs); item->text = getDetailTemplate(name, numInputs, inputOffset, port->maxInputs, numOutputs, outputOffset, port->maxOutputs);
item->rightText = CHECKMARK(item->deviceId == port->getDeviceId() && inputOffset == port->inputOffset && outputOffset == port->outputOffset);
item->rightText = CHECKMARK(deviceId == port->getDeviceId() && inputOffset == port->inputOffset && outputOffset == port->outputOffset);
menu->addChild(item); menu->addChild(item);
} }
} }
@@ -143,8 +143,8 @@ struct AudioDeviceChoice : LedDisplayChoice {
if (box.size.x >= 200.0) if (box.size.x >= 200.0)
text += "Device: "; text += "Device: ";
std::string detail = ""; std::string detail = "";
if (port && port->device)
detail = getDetailTemplate(port->device->getName(), port->getNumInputs(), port->inputOffset, port->maxInputs, port->getNumOutputs(), port->outputOffset, port->maxOutputs);
if (port && port->getDevice())
detail = getDetailTemplate(port->getDevice()->getName(), port->getNumInputs(), port->inputOffset, port->maxInputs, port->getNumOutputs(), port->outputOffset, port->maxOutputs);


if (detail != "") { if (detail != "") {
text += detail; text += detail;


+ 4
- 5
src/app/Knob.cpp View File

@@ -125,13 +125,12 @@ void Knob::onDragMove(const event::DragMove& e) {
float modScale = 1.f; float modScale = 1.f;
// Drag slower if Ctrl is held // Drag slower if Ctrl is held
int mods = APP->window->getMods(); int mods = APP->window->getMods();
if ((mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
if ((mods & RACK_MOD_MASK) == RACK_MOD_CTRL)
modScale /= 16.f; modScale /= 16.f;
}
// Drag even slower if Ctrl-Shift is held
if ((mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
if ((mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT)
modScale *= 4.f;
if ((mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT))
modScale /= 256.f; modScale /= 256.f;
}


// Ratio between parameter value scale / (angle range / 2*pi) // Ratio between parameter value scale / (angle range / 2*pi)
float rangeRatio; float rangeRatio;


+ 4
- 4
src/app/RackScrollWidget.cpp View File

@@ -98,12 +98,12 @@ void RackScrollWidget::onHoverKey(const event::HoverKey& e) {


// Scroll with arrow keys // Scroll with arrow keys
float arrowSpeed = 32.f; float arrowSpeed = 32.f;
if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT))
arrowSpeed /= 16.f;
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL)
arrowSpeed *= 4.f;
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT)
arrowSpeed /= 4.f; arrowSpeed /= 4.f;
if ((e.mods & RACK_MOD_MASK) == GLFW_MOD_SHIFT)
arrowSpeed *= 4.f;
if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT))
arrowSpeed /= 16.f;


if (e.action == RACK_HELD) { if (e.action == RACK_HELD) {
if (e.key == GLFW_KEY_LEFT) { if (e.key == GLFW_KEY_LEFT) {


Loading…
Cancel
Save