|
@@ -64,102 +64,76 @@ void Scene::onHoverKey(const event::HoverKey& e) { |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) { |
|
|
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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|