From a7fd6e2925746ca08594e5ffcfaf416b08deee7b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 15 Nov 2011 14:24:14 +0000 Subject: When tabbing between notes in a MIDI region view, only consider those that are being displayed according to the channel selector. Should avoid confusions such as that in #3976. git-svn-id: svn://localhost/ardour2/branches/3.0@10614 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_region_view.cc | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 0f30c35733..9a6e5a498f 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3281,24 +3281,30 @@ MidiRegionView::goto_next_note (bool add_to_selection) time_sort_events (); + MidiTimeAxisView* const mtv = dynamic_cast(&trackview); + uint16_t const channel_mask = mtv->channel_selector().get_selected_channels (); + for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { if ((*i)->selected()) { use_next = true; continue; } else if (use_next) { - if (!add_to_selection) { - unique_select (*i); - } else { - note_selected (*i, true, false); + if (channel_mask & (1 << (*i)->note()->channel())) { + if (!add_to_selection) { + unique_select (*i); + } else { + note_selected (*i, true, false); + } + return; } - return; } } /* use the first one */ - unique_select (_events.front()); - + if (!_event.empty() && (channel_mask & (1 << _events.front()->note()->channel ()))) { + unique_select (_events.front()); + } } void @@ -3312,23 +3318,30 @@ MidiRegionView::goto_previous_note (bool add_to_selection) time_sort_events (); + MidiTimeAxisView* const mtv = dynamic_cast(&trackview); + uint16_t const channel_mask = mtv->channel_selector().get_selected_channels (); + for (Events::reverse_iterator i = _events.rbegin(); i != _events.rend(); ++i) { if ((*i)->selected()) { use_next = true; continue; } else if (use_next) { - if (!add_to_selection) { - unique_select (*i); - } else { - note_selected (*i, true, false); + if (channel_mask & (1 << (*i)->note()->channel())) { + if (!add_to_selection) { + unique_select (*i); + } else { + note_selected (*i, true, false); + } + return; } - return; } } /* use the last one */ - unique_select (*(_events.rbegin())); + if (!_events.empty() && (channel_mask & (1 << (*_events.rbegin())->note()->channel ()))) { + unique_select (*(_events.rbegin())); + } } void -- cgit v1.2.3