From d9101a15611f3e96a2b313dd86d522605588c32b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 9 Mar 2011 18:13:12 +0000 Subject: 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 --- gtk2_ardour/piano_roll_header.cc | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'gtk2_ardour/piano_roll_header.cc') 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); + } +} -- cgit v1.2.3