Browse Source

If key is consumed, RackScene should not attempt to recognize key

commands
tags/v0.6.0
Andrew Belt 6 years ago
parent
commit
cbffd494ca
2 changed files with 39 additions and 36 deletions
  1. +1
    -0
      include/util/common.hpp
  2. +38
    -36
      src/app/RackScene.cpp

+ 1
- 0
include/util/common.hpp View File

@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <assert.h>



+ 38
- 36
src/app/RackScene.cpp View File

@@ -86,43 +86,45 @@ void RackScene::draw(NVGcontext *vg) {
}

void RackScene::onHoverKey(EventHoverKey &e) {
switch (e.key) {
case GLFW_KEY_N:
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->reset();
e.consumed = true;
return;
}
break;
case GLFW_KEY_Q:
if (guiIsModPressed() && !guiIsShiftPressed()) {
guiClose();
e.consumed = true;
return;
}
break;
case GLFW_KEY_O:
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->openDialog();
e.consumed = true;
return;
}
break;
case GLFW_KEY_S:
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->saveDialog();
e.consumed = true;
return;
}
if (guiIsModPressed() && guiIsShiftPressed()) {
gRackWidget->saveAsDialog();
e.consumed = true;
return;
}
break;
}

Widget::onHoverKey(e);

if (!e.consumed) {
switch (e.key) {
case GLFW_KEY_N: {
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->reset();
e.consumed = true;
return;
}
} break;
case GLFW_KEY_Q: {
if (guiIsModPressed() && !guiIsShiftPressed()) {
guiClose();
e.consumed = true;
return;
}
} break;
case GLFW_KEY_O: {
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->openDialog();
e.consumed = true;
return;
}
} break;
case GLFW_KEY_S: {
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->saveDialog();
e.consumed = true;
return;
}
if (guiIsModPressed() && guiIsShiftPressed()) {
gRackWidget->saveAsDialog();
e.consumed = true;
return;
}
} break;
}
}
}

void RackScene::onPathDrop(EventPathDrop &e) {


Loading…
Cancel
Save