When tabbing between notes in a MIDI region view, only consider those that are being...
authorCarl Hetherington <carl@carlh.net>
Tue, 15 Nov 2011 14:24:14 +0000 (14:24 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 15 Nov 2011 14:24:14 +0000 (14:24 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10614 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc

index 0f30c357330873cb259b25320f0d38dda70068cc..9a6e5a498f657bd788cbd27434cebd4464467067 100644 (file)
@@ -3281,24 +3281,30 @@ MidiRegionView::goto_next_note (bool add_to_selection)
 
        time_sort_events ();
 
+       MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&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<MidiTimeAxisView*>(&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