diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-02 21:08:37 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-02 21:08:37 +0000 |
commit | 3e013e45b37d11008b869154e0d4a4d8ddd5a201 (patch) | |
tree | c2a2a6340407d53d2adbabe1f1ff003fb3e73567 | |
parent | 3a85e71031bc26d67d66db985da2159415f84fdb (diff) |
fix up start-in-source values from regions created as sections of another region (semantics changed as plists were introducted); remove some "optimizations" from Playlist::set_state() added to help with MementoCommand but that made undo not work correctly; make sure that Playlist::clear() notifies about regions being removed
git-svn-id: svn://localhost/ardour2/branches/3.0@6722 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 4 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 38 |
2 files changed, 23 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 6eaf1fb41a..b2174d1933 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2666,7 +2666,7 @@ Editor::region_from_selection () PropertyList plist; - plist.add (ARDOUR::Properties::start, internal_start); + plist.add (ARDOUR::Properties::start, current->start() + internal_start); plist.add (ARDOUR::Properties::length, selection_cnt); plist.add (ARDOUR::Properties::name, new_name); plist.add (ARDOUR::Properties::layer, 0); @@ -2706,7 +2706,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re PropertyList plist; - plist.add (ARDOUR::Properties::start, internal_start); + plist.add (ARDOUR::Properties::start, current->start() + internal_start); plist.add (ARDOUR::Properties::length, end - start + 1); plist.add (ARDOUR::Properties::name, new_name); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 7e6371a366..8d3b59427d 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -143,12 +143,6 @@ RegionListProperty::diff (PropertyList& before, PropertyList& after) const before.add (b); after.add (a); - - cerr << "pdiff on " << _playlist.name() << " before contains " - << b->change().added.size() << " adds and " << b->change().removed.size() << " removes\n"; - cerr << "pdiff on " << _playlist.name() << " after contains " - << a->change().added.size() << " adds and " << a->change().removed.size() << " removes\n"; - } } @@ -274,7 +268,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f PropertyList plist; - plist.add (Properties::start, offset); + plist.add (Properties::start, region->start() + offset); plist.add (Properties::length, len); plist.add (Properties::name, new_name); plist.add (Properties::layer, region->layer()); @@ -432,6 +426,7 @@ Playlist::release_notifications () if (g_atomic_int_dec_and_test (&block_notifications)) { flush_notifications (); } + } void @@ -499,7 +494,7 @@ Playlist::notify_region_added (boost::shared_ptr<Region> r) /* the length change might not be true, but we have to act as though it could be. */ - + if (holding_state()) { pending_adds.insert (r); pending_contents_change = true; @@ -670,7 +665,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, flo { PropertyList plist; - plist.add (Properties::start, 0); + plist.add (Properties::start, region->start()); plist.add (Properties::length, length); plist.add (Properties::name, name); plist.add (Properties::layer, region->layer()); @@ -939,7 +934,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re PropertyList plist; - plist.add (Properties::start, pos2 - pos1); + plist.add (Properties::start, current->start() + (pos2 - pos1)); plist.add (Properties::length, pos3 - pos2); plist.add (Properties::name, new_name); plist.add (Properties::layer, regions.size()); @@ -958,7 +953,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re PropertyList plist; - plist.add (Properties::start, pos3 - pos1); + plist.add (Properties::start, current->start() + (pos3 - pos1)); plist.add (Properties::length, pos4 - pos3); plist.add (Properties::name, new_name); plist.add (Properties::layer, regions.size()); @@ -996,7 +991,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re PropertyList plist; - plist.add (Properties::start, pos2 - pos1); + plist.add (Properties::start, current->start() + (pos2 - pos1)); plist.add (Properties::length, pos4 - pos2); plist.add (Properties::name, new_name); plist.add (Properties::layer, regions.size()); @@ -1039,7 +1034,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re PropertyList plist; - plist.add (Properties::start, 0); + plist.add (Properties::start, current->start()); plist.add (Properties::length, pos3 - pos1); plist.add (Properties::name, new_name); plist.add (Properties::layer, regions.size()); @@ -1244,7 +1239,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, floa { PropertyList plist; - plist.add (Properties::start, 0); + plist.add (Properties::start, region->start()); plist.add (Properties::length, length); plist.add (Properties::name, name); @@ -1600,9 +1595,19 @@ Playlist::clear (bool with_signals) } regions.clear (); + + for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) { + remove_dependents (*s); + } } if (with_signals) { + + for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) { + RegionRemoved (boost::weak_ptr<Region> (*s)); /* EMIT SIGNAL */ + } + + pending_removes.clear (); pending_length = false; LengthChanged (); pending_contents_change = false; @@ -2104,7 +2109,7 @@ Playlist::set_state (const XMLNode& node, int version) } } - clear (false); + clear (true); nlist = node.children(); @@ -2136,7 +2141,7 @@ Playlist::set_state (const XMLNode& node, int version) error << _("Playlist: cannot create region from XML") << endmsg; continue; } - + add_region (region, region->position(), 1.0); // So that layer_op ordering doesn't get screwed up @@ -2153,7 +2158,6 @@ Playlist::set_state (const XMLNode& node, int version) check_dependents (*r, false); } - clear_pending (); // this makes thaw() do nothing thaw (); notify_contents_changed (); |