-bool
-MidiRegionView::key_press (GdkEventKey* ev)
-{
- /* 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;