fix for most (all? we can dream ...) issues involved in #4399 (editing multiply-appli...
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 56dd2b746dc029ba4bb28e4123a4cf980b89dd41..e71bbe4778b5968d1cf60e4b33352e10a1faf1ba 100644 (file)
@@ -1304,3 +1304,30 @@ TimeAxisView::reset_visual_state ()
                set_height (preset_height (HeightNormal));
        }
 }
+
+TrackViewList
+TrackViewList::filter_to_unique_playlists ()
+{
+       std::set<boost::shared_ptr<ARDOUR::Playlist> > playlists;
+       TrackViewList ts;
+
+       for (iterator i = begin(); i != end(); ++i) {
+               RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
+               if (!rtav) {
+                       /* not a route: include it anyway */
+                       ts.push_back (*i);
+               } else {
+                       boost::shared_ptr<ARDOUR::Track> t = rtav->track();
+                       if (t) {
+                               if (playlists.insert (t->playlist()).second) {
+                                       /* playlist not seen yet */
+                                       ts.push_back (*i);
+                               }
+                       } else {
+                               /* not a track: include it anyway */
+                               ts.push_back (*i);
+                       }
+               }
+       }
+       return ts;
+}