X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_playlists.cc;h=5713e1545807e109ddb91f645f92af5b403f7ca7;hb=8018bed0ded65003279dfbdf446bae2697378488;hp=cc2f1b25abf06927a74856f763bd2c59b514dc42;hpb=20262abe7f1f73943ffa1dcf5bfb6599bee5d2a0;p=ardour.git diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index cc2f1b25ab..5713e15458 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -23,7 +23,7 @@ #include "ardour/playlist_factory.h" #include "ardour/session_playlists.h" #include "ardour/track.h" -#include "i18n.h" +#include "pbd/i18n.h" #include "pbd/compose.h" #include "pbd/xml++.h" @@ -244,7 +244,6 @@ SessionPlaylists::destroy_region (boost::shared_ptr r) } } - void SessionPlaylists::find_equivalent_playlist_regions (boost::shared_ptr region, vector >& result) { @@ -260,6 +259,10 @@ SessionPlaylists::source_use_count (boost::shared_ptr src) const { uint32_t count = 0; + /* XXXX this can go wildly wrong in the presence of circular references + * between compound regions. + */ + for (List::const_iterator p = playlists.begin(); p != playlists.end(); ++p) { if ((*p)->uses_source (src)) { ++count; @@ -333,10 +336,16 @@ SessionPlaylists::maybe_delete_unused (boost::function > playlists_tbd; - bool delete_all = false; + bool delete_remaining = false; + bool keep_remaining = false; for (List::iterator x = unused_playlists.begin(); x != unused_playlists.end(); ++x) { - if (delete_all) { + + if (keep_remaining) { + break; + } + + if (delete_remaining) { playlists_tbd.push_back (*x); continue; } @@ -348,9 +357,14 @@ SessionPlaylists::maybe_delete_unused (boost::function tr) const return pl_tr; } + +void +SessionPlaylists::foreach (boost::function)> functor, bool incl_unused) +{ + Glib::Threads::Mutex::Lock lm (lock); + for (List::iterator i = playlists.begin(); i != playlists.end(); i++) { + if (!(*i)->hidden()) { + functor (*i); + } + } + if (!incl_unused) { + return; + } + for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); i++) { + if (!(*i)->hidden()) { + functor (*i); + } + } +}