-{
- /* since GTK bindings are generally activated on press, and since
- detectable auto-repeat is the name of the game and only sends
- repeated presses, carry out key actions at key press, not release.
- */
-
- if (ev->keyval == GDK_Alt_L || ev->keyval == GDK_Alt_R){
- _mouse_state = SelectTouchDragging;
- return true;
-
- } else if (ev->keyval == GDK_Escape) {
- clear_selection();
- _mouse_state = None;
-
- } else if (ev->keyval == GDK_comma || ev->keyval == GDK_period) {
-
- bool start = (ev->keyval == GDK_comma);
- bool end = (ev->keyval == GDK_period);
- bool shorter = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier);
- bool fine = Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
-
- change_note_lengths (fine, shorter, 0.0, start, end);
-
- return true;
-
- } else if (ev->keyval == GDK_Delete) {
-
- delete_selection();
- return true;
-
- } else if (ev->keyval == GDK_Tab) {
-
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- goto_previous_note ();
- } else {
- goto_next_note ();
- }
- return true;
-
- } else if (ev->keyval == GDK_Up) {
-
- bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
- bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
-
- if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
- change_velocities (true, fine, allow_smush);
- } else {
- transpose (true, fine, allow_smush);
- }
- return true;
-
- } else if (ev->keyval == GDK_Down) {
-
- bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
- bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
-
- if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
- change_velocities (false, fine, allow_smush);
- } else {
- transpose (false, fine, allow_smush);
- }
- return true;
-
- } else if (ev->keyval == GDK_Left) {
-
- nudge_notes (false);
- return true;
-
- } else if (ev->keyval == GDK_Right) {
-
- nudge_notes (true);
- return true;
-
- } else if (ev->keyval == GDK_Control_L) {
- return true;
-
- }
-
- return false;
+{
+ /* since GTK bindings are generally activated on press, and since
+ detectable auto-repeat is the name of the game and only sends
+ repeated presses, carry out key actions at key press, not release.
+ */
+
+ bool unmodified = Keyboard::no_modifier_keys_pressed (ev);
+
+ if (unmodified && (ev->keyval == GDK_Alt_L || ev->keyval == GDK_Alt_R)) {
+ _mouse_state = SelectTouchDragging;
+ return true;
+
+ } else if (ev->keyval == GDK_Escape && unmodified) {
+ clear_selection();
+ _mouse_state = None;
+
+ } else if (unmodified && (ev->keyval == GDK_comma || ev->keyval == GDK_period)) {
+
+ bool start = (ev->keyval == GDK_comma);
+ bool end = (ev->keyval == GDK_period);
+ bool shorter = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier);
+ bool fine = Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
+
+ change_note_lengths (fine, shorter, 0.0, start, end);
+
+ return true;
+
+ } else if (ev->keyval == GDK_Delete && unmodified) {
+
+ delete_selection();
+ return true;
+
+ } else if (ev->keyval == GDK_Tab) {
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ goto_previous_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
+ } else {
+ goto_next_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
+ }
+ return true;
+
+ } else if (ev->keyval == GDK_ISO_Left_Tab) {
+
+ /* Shift-TAB generates ISO Left Tab, for some reason */
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ goto_previous_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
+ } else {
+ goto_next_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
+ }
+ return true;
+
+
+
+ } else if (ev->keyval == GDK_Up) {
+
+ bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
+ bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
+ bool together = Keyboard::modifier_state_contains (ev->state, Keyboard::Level4Modifier);
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ change_velocities (true, fine, allow_smush, together);
+ } else {
+ transpose (true, fine, allow_smush);
+ }
+ return true;
+
+ } else if (ev->keyval == GDK_Down) {
+
+ bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
+ bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier);
+ bool together = Keyboard::modifier_state_contains (ev->state, Keyboard::Level4Modifier);
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ change_velocities (false, fine, allow_smush, together);
+ } else {
+ transpose (false, fine, allow_smush);
+ }
+ return true;
+
+ } else if (ev->keyval == GDK_Left && unmodified) {
+
+ nudge_notes (false);
+ return true;
+
+ } else if (ev->keyval == GDK_Right && unmodified) {
+
+ nudge_notes (true);
+ return true;
+
+ } else if (ev->keyval == GDK_c && unmodified) {
+ channel_edit ();
+ return true;
+
+ } else if (ev->keyval == GDK_v && unmodified) {
+ velocity_edit ();
+ return true;
+ }
+
+ return false;