diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-09 18:13:12 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-09 18:13:12 +0000 |
commit | d9101a15611f3e96a2b313dd86d522605588c32b (patch) | |
tree | 989f831d0f5e2e77ce10ee015e45a72e58cb0ec9 | |
parent | fd380077bf6e6a37018448204193333b174c7b67 (diff) |
Small refactoring; fix stuck notes on the sequence LMB down, RMB down, LMB up, RMB up (#3824).
git-svn-id: svn://localhost/ardour2/branches/3.0@9114 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/piano_roll_header.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/piano_roll_header.h | 2 |
2 files changed, 16 insertions, 15 deletions
diff --git a/gtk2_ardour/piano_roll_header.cc b/gtk2_ardour/piano_roll_header.cc index e88f551e91..28398678a1 100644 --- a/gtk2_ardour/piano_roll_header.cc +++ b/gtk2_ardour/piano_roll_header.cc @@ -479,7 +479,7 @@ PianoRollHeader::on_motion_notify_event (GdkEventMotion* ev) 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]) { @@ -516,7 +516,7 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev) invalidate_note_range(note, note); } else { - _clicked_note = no_note; + reset_clicked_note(note); } } } @@ -547,11 +547,7 @@ PianoRollHeader::on_button_release_event (GdkEventButton* ev) _dragging = false; if (note == _clicked_note) { - _active_notes[note] = false; - _clicked_note = no_note; - send_note_off(note); - - invalidate_note_range(note, note); + reset_clicked_note(note); } } } @@ -574,14 +570,7 @@ PianoRollHeader::on_leave_notify_event (GdkEventCrossing*) invalidate_note_range(_highlighted_note, _highlighted_note); if (_clicked_note != no_note) { - _active_notes[_clicked_note] = false; - send_note_off(_clicked_note); - - if (_clicked_note != _highlighted_note) { - invalidate_note_range(_clicked_note, _clicked_note); - } - - _clicked_note = no_note; + reset_clicked_note(_clicked_note, _clicked_note != _highlighted_note); } _highlighted_note = no_note; @@ -700,3 +689,13 @@ PianoRollHeader::send_note_off(uint8_t note) } } +void +PianoRollHeader::reset_clicked_note (uint8_t note, bool invalidate) +{ + _active_notes[note] = false; + _clicked_note = no_note; + send_note_off (note); + if (invalidate) { + invalidate_note_range (note, note); + } +} diff --git a/gtk2_ardour/piano_roll_header.h b/gtk2_ardour/piano_roll_header.h index 453c32468d..7f469aebce 100644 --- a/gtk2_ardour/piano_roll_header.h +++ b/gtk2_ardour/piano_roll_header.h @@ -92,6 +92,8 @@ private: void send_note_on(uint8_t note); void send_note_off(uint8_t note); + void reset_clicked_note(uint8_t, bool invalidate = true); + MidiStreamView& _view; uint8_t _event[3]; |