Region List rewrite (libardour part)

Region List rewrite (libardour part)
This commit is contained in:
Ben Loftis 2018-10-16 17:44:11 -05:00
parent 4a4ac0d867
commit 74dd35f4b9
6 changed files with 42 additions and 1 deletions

View file

@ -86,6 +86,8 @@ public:
/** create a region with specified sources @param srcs and XML state */
static boost::shared_ptr<Region> create (SourceList& srcs, const XMLNode&);
static boost::shared_ptr<Region> get_whole_region_for_source (boost::shared_ptr<ARDOUR::Source>);
static void get_regions_using_source (boost::shared_ptr<Source>, std::set<boost::shared_ptr<Region> >& );
static void remove_regions_using_source (boost::shared_ptr<Source>);

View file

@ -1767,7 +1767,9 @@ public:
f ( (*i).second );
}
}
bool playlist_is_active( boost::shared_ptr<Playlist>);
private:
void reset_write_sources (bool mark_write_complete, bool force = false);
SourceMap sources;

View file

@ -601,6 +601,7 @@ Playlist::flush_notifications (bool from_undo)
crossfade_ranges.push_back ((*s)->range ());
remove_dependents (*s);
RegionRemoved (boost::weak_ptr<Region> (*s)); /* EMIT SIGNAL */
Region::RegionPropertyChanged(*s, Properties::hidden);
}
for (s = pending_adds.begin(); s != pending_adds.end(); ++s) {

View file

@ -629,6 +629,18 @@ RegionFactory::new_region_name (string old)
return old;
}
boost::shared_ptr<Region>
RegionFactory::get_whole_region_for_source (boost::shared_ptr<Source> s)
{
Glib::Threads::Mutex::Lock lm (region_map_lock);
for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
if (i->second->uses_source (s) && i->second->whole_file()) {
return (i->second);
}
}
}
void
RegionFactory::get_regions_using_source (boost::shared_ptr<Source> s, std::set<boost::shared_ptr<Region> >& r)
{

View file

@ -5378,6 +5378,17 @@ Session::create_midi_source_by_stealing_name (boost::shared_ptr<Track> track)
DataType::MIDI, *this, path, false, sample_rate()));
}
bool
Session::playlist_is_active (boost::shared_ptr<Playlist> playlist)
{
Glib::Threads::Mutex::Lock lm (playlists->lock);
for (SessionPlaylists::List::iterator i = playlists->playlists.begin(); i != playlists->playlists.end(); i++) {
if ( (*i) == playlist ) {
return true;
}
}
return false;
}
void
Session::add_playlist (boost::shared_ptr<Playlist> playlist, bool unused)

View file

@ -626,6 +626,13 @@ Track::find_and_use_playlist (DataType dt, PBD::ID const & id)
return use_playlist (dt, playlist);
}
void
update_region_visibility(boost::shared_ptr<Region> r)
{
Region::RegionPropertyChanged(r, Properties::hidden);
}
int
Track::use_playlist (DataType dt, boost::shared_ptr<Playlist> p)
{
@ -637,9 +644,15 @@ Track::use_playlist (DataType dt, boost::shared_ptr<Playlist> p)
}
}
boost::shared_ptr<Playlist> old = _playlists[dt];
if (ret == 0) {
_playlists[dt] = p;
}
//allow all regions of prior and new playlists to update their visibility?
if (old) old->foreach_region(update_region_visibility);
if (p) p->foreach_region(update_region_visibility);
_session.set_dirty ();
PlaylistChanged (); /* EMIT SIGNAL */