Browse Source

Add numpad key commands. Clean up Scene::onHoverKey().

tags/v1.1.5
Andrew Belt 4 years ago
parent
commit
69681d2dbd
2 changed files with 71 additions and 96 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +70
    -96
      src/app/Scene.cpp

+ 1
- 0
CHANGELOG.md View File

@@ -9,6 +9,7 @@ In this document, Mod is Ctrl on Windows/Linux and Cmd on Mac.
- Stop worker threads when engine is paused to save CPU.
- Hide menu and scrollbars when fullscreen.
- Add key command (F3) for engine CPU meter.
- Add numpad key commands.
- Core
- Fix sustain pedal release bug when using polyphonic mode in MIDI-CV.
- API


+ 70
- 96
src/app/Scene.cpp View File

@@ -64,102 +64,76 @@ void Scene::onHoverKey(const event::HoverKey& e) {
return;

if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
switch (e.key) {
case GLFW_KEY_N: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->resetDialog();
e.consume(this);
}
} break;
case GLFW_KEY_Q: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->window->close();
e.consume(this);
}
} break;
case GLFW_KEY_O: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->loadDialog();
e.consume(this);
}
if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->patch->revertDialog();
e.consume(this);
}
} break;
case GLFW_KEY_S: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->saveDialog();
e.consume(this);
}
if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->patch->saveAsDialog();
e.consume(this);
}
} break;
case GLFW_KEY_Z: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->history->undo();
e.consume(this);
}
if ((e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->history->redo();
e.consume(this);
}
} break;
case GLFW_KEY_MINUS: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
float zoom = settings::zoom;
zoom *= 2;
zoom = std::ceil(zoom - 0.01f) - 1;
zoom /= 2;
settings::zoom = zoom;
e.consume(this);
}
} break;
case GLFW_KEY_EQUAL: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
float zoom = settings::zoom;
zoom *= 2;
zoom = std::floor(zoom + 0.01f) + 1;
zoom /= 2;
settings::zoom = zoom;
e.consume(this);
}
} break;
case GLFW_KEY_0: {
if ((e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
settings::zoom = 0.f;
e.consume(this);
}
} break;
case GLFW_KEY_ENTER: {
if ((e.mods & RACK_MOD_MASK) == 0) {
moduleBrowser->show();
}
e.consume(this);
} break;
case GLFW_KEY_F1: {
if ((e.mods & RACK_MOD_MASK) == 0) {
std::thread t([] {
system::openBrowser("https://vcvrack.com/manual/");
});
t.detach();
e.consume(this);
}
} break;
case GLFW_KEY_F3: {
if ((e.mods & RACK_MOD_MASK) == 0) {
settings::cpuMeter ^= true;
e.consume(this);
}
} break;
case GLFW_KEY_F11: {
if ((e.mods & RACK_MOD_MASK) == 0) {
APP->window->setFullScreen(!APP->window->isFullScreen());
e.consume(this);
}
} break;
if (e.key == GLFW_KEY_N && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->resetDialog();
e.consume(this);
}
else if (e.key == GLFW_KEY_Q && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->window->close();
e.consume(this);
}
else if (e.key == GLFW_KEY_O && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->loadDialog();
e.consume(this);
}
else if (e.key == GLFW_KEY_O && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->patch->revertDialog();
e.consume(this);
}
else if (e.key == GLFW_KEY_S && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->patch->saveDialog();
e.consume(this);
}
else if (e.key == GLFW_KEY_S && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->patch->saveAsDialog();
e.consume(this);
}
else if (e.key == GLFW_KEY_Z && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
APP->history->undo();
e.consume(this);
}
else if (e.key == GLFW_KEY_Z && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
APP->history->redo();
e.consume(this);
}
else if ((e.key == GLFW_KEY_MINUS || e.key == GLFW_KEY_KP_SUBTRACT) && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
float zoom = settings::zoom;
zoom *= 2;
zoom = std::ceil(zoom - 0.01f) - 1;
zoom /= 2;
settings::zoom = zoom;
e.consume(this);
}
else if ((e.key == GLFW_KEY_EQUAL || e.key == GLFW_KEY_KP_ADD) && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
float zoom = settings::zoom;
zoom *= 2;
zoom = std::floor(zoom + 0.01f) + 1;
zoom /= 2;
settings::zoom = zoom;
e.consume(this);
}
else if ((e.key == GLFW_KEY_0 || e.key == GLFW_KEY_KP_0) && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
settings::zoom = 0.f;
e.consume(this);
}
else if ((e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER) && (e.mods & RACK_MOD_MASK) == 0) {
moduleBrowser->show();
e.consume(this);
}
else if (e.key == GLFW_KEY_F1 && (e.mods & RACK_MOD_MASK) == 0) {
std::thread t([] {
system::openBrowser("https://vcvrack.com/manual/");
});
t.detach();
e.consume(this);
}
else if (e.key == GLFW_KEY_F3 && (e.mods & RACK_MOD_MASK) == 0) {
settings::cpuMeter ^= true;
e.consume(this);
}
else if (e.key == GLFW_KEY_F11 && (e.mods & RACK_MOD_MASK) == 0) {
APP->window->setFullScreen(!APP->window->isFullScreen());
e.consume(this);
}
}
}


Loading…
Cancel
Save