summaryrefslogtreecommitdiff
path: root/gtk2_ardour/piano_roll_header.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-03-09 18:13:12 +0000
committerCarl Hetherington <carl@carlh.net>2011-03-09 18:13:12 +0000
commitd9101a15611f3e96a2b313dd86d522605588c32b (patch)
tree989f831d0f5e2e77ce10ee015e45a72e58cb0ec9 /gtk2_ardour/piano_roll_header.cc
parentfd380077bf6e6a37018448204193333b174c7b67 (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
Diffstat (limited to 'gtk2_ardour/piano_roll_header.cc')
-rw-r--r--gtk2_ardour/piano_roll_header.cc29
1 files changed, 14 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);
+ }
+}