gnome_canvas_request_redraw (item->canvas,
unionrect.x0 - 0.5,
unionrect.y0 - 0.5,
- unionrect.x1 + 0.5,
- unionrect.y1 + 0.5);
+ unionrect.x1 + 1.5,
+ unionrect.y1 + 1.5);
}
/*
}
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>((*x)->region());
+ boost::shared_ptr<Region> _xx;
switch (op) {
case Cut:
if (!ar) break;
- npl->add_region (RegionFactory::create (ar), (*x)->region()->position() - first_position);
+ _xx = RegionFactory::create ((*x)->region());
+ npl->add_region (_xx, (*x)->region()->position() - first_position);
pl->remove_region (((*x)->region()));
break;
case Copy:
if (!ar) break;
- npl->add_region (RegionFactory::create (ar), (*x)->region()->position() - first_position);
+ npl->add_region ((*x)->region(), (*x)->region()->position() - first_position);
break;
case Clear:
foo.push_back ((*i).pl);
}
+
if (!foo.empty()) {
cut_buffer->set (foo);
}
-
+
for (set<PlaylistState, lt_playlist>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
(*pl).playlist->thaw ();
session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
/* Selections own their playlists */
for (PlaylistSelection::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+ /* selections own their own regions, which are copies of the "originals". make them go away */
+ (*i)->drop_regions ();
(*i)->release ();
}
virtual bool destroy_region (boost::shared_ptr<Region>) = 0;
+ /* special case function used by UI selection objects, which have playlists that actually own the regions
+ within them.
+ */
+
+ void drop_regions ();
+
protected:
friend class Session;
string _name;
time_t _timestamp;
- std::set<boost::shared_ptr<ARDOUR::Playlist> > _playlists;
+ Glib::Mutex playlist_lock;
+ typedef std::map<boost::shared_ptr<ARDOUR::Playlist>, uint32_t > PlaylistMap;
+ PlaylistMap _playlists;
private:
uint32_t _in_use;
boost::shared_ptr<Region> r = RegionFactory::create (srcs, _start, _length, new_name, _layer, f);
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
- cerr << "new region name is " << ar->name() << endl;
v.push_back (ar);
boost::shared_ptr<Playlist> pl (playlist());
if (pl) {
- cerr << "Send modified\n";
pl->Modified();
}
AudioRegion::set_playlist (boost::weak_ptr<Playlist> wpl)
{
boost::shared_ptr<Playlist> old_playlist = (_playlist.lock());
+
boost::shared_ptr<Playlist> pl (wpl.lock());
if (old_playlist == pl) {
} else {
if (old_playlist) {
for (SourceList::const_iterator i = sources.begin(); i != sources.end(); ++i) {
- (*i)->remove_playlist (_playlist);
+ (*i)->remove_playlist (old_playlist);
}
}
}
old_length = _get_maximum_extent();
}
+ if (!in_set_state) {
+ /* unset playlist */
+ region->set_playlist (boost::weak_ptr<Playlist>());
+ }
+
for (i = regions.begin(); i != regions.end(); ++i) {
if (*i == region) {
return save;
}
+void
+Playlist::drop_regions ()
+{
+ RegionLock rl (this);
+ regions.clear ();
+ all_regions.clear ();
+}
+
void
Playlist::clear (bool with_signals)
{
void
Source::add_playlist (boost::shared_ptr<Playlist> pl)
{
- _playlists.insert (pl);
+ std::pair<PlaylistMap::iterator,bool> res;
+ std::pair<boost::shared_ptr<Playlist>, uint32_t> newpair (pl, 1);
+ Glib::Mutex::Lock lm (playlist_lock);
+
+ res = _playlists.insert (newpair);
+
+ if (!res.second) {
+ /* it already existed, bump count */
+ res.first->second++;
+ }
+
pl->GoingAway.connect (bind (mem_fun (*this, &Source::remove_playlist), boost::weak_ptr<Playlist> (pl)));
}
return;
}
- std::set<boost::shared_ptr<Playlist> >::iterator x;
+ PlaylistMap::iterator x;
+ Glib::Mutex::Lock lm (playlist_lock);
if ((x = _playlists.find (pl)) != _playlists.end()) {
- _playlists.erase (x);
+ if (x->second > 1) {
+ x->second--;
+ } else {
+ _playlists.erase (x);
+ }
}
}