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
This commit is contained in:
Carl Hetherington 2011-03-09 18:13:12 +00:00
parent fd380077bf
commit d9101a1561
2 changed files with 16 additions and 15 deletions

View File

@ -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);
}
}

View File

@ -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];