diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-20 02:54:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-20 02:54:23 +0000 |
commit | 5de9a8f38b0e18317b2b23c5b8698d0d29eba12b (patch) | |
tree | 2068d91f2e1af148386e855cee397d332709f4c6 /gtk2_ardour/piano_roll_header.cc | |
parent | c2a93a9b3855f85830a715757b8c131113bc9a3e (diff) |
make mouse range mode do something interesting when in internal/note edit mode. not entirely finished because the usual modifiers to add/extend the selection don't work correctly. note that this works both on the scroomer (where the modifiers do work correctly) and in the track (where they do not)
git-svn-id: svn://localhost/ardour2/branches/3.0@11273 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/piano_roll_header.cc')
-rw-r--r-- | gtk2_ardour/piano_roll_header.cc | 74 |
1 files changed, 50 insertions, 24 deletions
diff --git a/gtk2_ardour/piano_roll_header.cc b/gtk2_ardour/piano_roll_header.cc index b041bb3a89..3243f893c7 100644 --- a/gtk2_ardour/piano_roll_header.cc +++ b/gtk2_ardour/piano_roll_header.cc @@ -22,9 +22,11 @@ #include "gtkmm2ext/keyboard.h" +#include "editing.h" #include "piano_roll_header.h" #include "midi_time_axis.h" #include "midi_streamview.h" +#include "public_editor.h" const int no_note = 0xff; @@ -465,26 +467,39 @@ PianoRollHeader::on_motion_notify_event (GdkEventMotion* ev) int note = _view.y_to_note(ev->y); - if (_highlighted_note != no_note) { - if (note > _highlighted_note) { - invalidate_note_range(_highlighted_note, note); - } else { - invalidate_note_range(note, _highlighted_note); - } - - _highlighted_note = note; - } + if (editor().current_mouse_mode() == Editing::MouseRange) { + + /* select note range */ - /* redraw already taken care of above */ - if (_clicked_note != no_note && _clicked_note != note) { - _active_notes[_clicked_note] = false; - send_note_off(_clicked_note); + if (Keyboard::no_modifiers_active (ev->state)) { + AddNoteSelection (note); // EMIT SIGNAL + } - _clicked_note = note; + } else { + + /* play notes */ - if (!_active_notes[note]) { - _active_notes[note] = true; - send_note_on(note); + if (_highlighted_note != no_note) { + if (note > _highlighted_note) { + invalidate_note_range(_highlighted_note, note); + } else { + invalidate_note_range(note, _highlighted_note); + } + + _highlighted_note = note; + } + + /* redraw already taken care of above */ + if (_clicked_note != no_note && _clicked_note != note) { + _active_notes[_clicked_note] = false; + send_note_off(_clicked_note); + + _clicked_note = note; + + if (!_active_notes[note]) { + _active_notes[note] = true; + send_note_on(note); + } } } } @@ -499,9 +514,15 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev) { int note = _view.y_to_note(ev->y); - if (ev->button == 2) { - send_note_on (note); - /* relax till release */ + if (ev->button != 1) { + return false; + } + + if (editor().current_mouse_mode() == Editing::MouseRange) { + if (Keyboard::no_modifiers_active (ev->state)) { + SetNoteSelection (note); // EMIT SIGNAL + } + _dragging = true; } else { if (ev->type == GDK_BUTTON_PRESS && note >= 0 && note < 128) { @@ -529,8 +550,7 @@ PianoRollHeader::on_button_release_event (GdkEventButton* ev) { int note = _view.y_to_note(ev->y); - if (ev->button == 2) { - send_note_off (note); + if (editor().current_mouse_mode() == Editing::MouseRange) { if (Keyboard::no_modifiers_active (ev->state)) { AddNoteSelection (note); // EMIT SIGNAL @@ -539,12 +559,11 @@ PianoRollHeader::on_button_release_event (GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) { ExtendNoteSelection (note); // EMIT SIGNAL } - + } else { if (_dragging) { remove_modal_grab(); - _dragging = false; if (note == _clicked_note) { reset_clicked_note(note); @@ -552,6 +571,7 @@ PianoRollHeader::on_button_release_event (GdkEventButton* ev) } } + _dragging = false; return true; } @@ -694,3 +714,9 @@ PianoRollHeader::reset_clicked_note (uint8_t note, bool invalidate) invalidate_note_range (note, note); } } + +PublicEditor& +PianoRollHeader::editor() const +{ + return _view.trackview().editor(); +} |