Merge branch 'master' into windows
[ardour.git] / libs / ardour / playlist.cc
index 8a19b1fcebdf1f60fba36f03564106c47141aed1..47462a3575be3b19274698290d9dbf861f68a3d8 100644 (file)
@@ -250,7 +250,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f
                plist.add (Properties::layer, region->layer());
                plist.add (Properties::layering_index, region->layering_index());
 
-               new_region = RegionFactory::RegionFactory::create (region, plist);
+               new_region = RegionFactory::create (region, plist);
 
                add_region_internal (new_region, position);
        }
@@ -284,7 +284,7 @@ Playlist::copy_regions (RegionList& newlist) const
        RegionReadLock rlock (const_cast<Playlist *> (this));
 
        for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
-               newlist.push_back (RegionFactory::RegionFactory::create (*i, true));
+               newlist.push_back (RegionFactory::create (*i, true));
        }
 }
 
@@ -751,10 +751,6 @@ Playlist::flush_notifications (bool from_undo)
 
         notify_region_added (region);
 
-        if (!holding_state ()) {
-                check_crossfades (region->range ());
-        }
-
         region->PropertyChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
 
         return true;
@@ -848,6 +844,17 @@ Playlist::flush_notifications (bool from_undo)
         }
  }
 
+ void
+ Playlist::get_source_equivalent_regions (boost::shared_ptr<Region> other, vector<boost::shared_ptr<Region> >& results)
+ {
+        for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+
+                if ((*i) && (*i)->any_source_equivalent (other)) {
+                        results.push_back (*i);
+                }
+        }
+ }
+
  void
  Playlist::partition (framepos_t start, framepos_t end, bool cut)
  {
@@ -1095,8 +1102,6 @@ Playlist::flush_notifications (bool from_undo)
 
                 in_partition = false;
         }
-
-        check_crossfades (Evoral::Range<framepos_t> (start, end));
  }
 
  boost::shared_ptr<Playlist>
@@ -1553,10 +1558,6 @@ Playlist::flush_notifications (bool from_undo)
                 save = !(_splicing || _nudging);
         }
 
-        if (what_changed.contains (our_interests) && !what_changed.contains (pos_and_length)) {
-                check_crossfades (region->range ());
-        }
-
         if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) {
                 notify_region_moved (region);
         } else if (!what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) {
@@ -1996,11 +1997,11 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
 
         freeze ();
         /* add the added regions */
-        for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) {
+        for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin(); i != change.added.end(); ++i) {
                 add_region_internal ((*i), (*i)->position());
         }
         /* remove the removed regions */
-        for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
+        for (RegionListProperty::ChangeContainer::const_iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
                 remove_region (*i);
         }
 
@@ -2100,15 +2101,6 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
 
        if (seen_region_nodes && regions.empty()) {
                ret = -1;
-       } else {
-
-               /* update dependents, which was not done during add_region_internal
-                  due to in_set_state being true
-               */
-               
-               for (RegionList::iterator r = regions.begin(); r != regions.end(); ++r) {
-                       check_crossfades ((*r)->range ());
-               }
        }
                
        thaw ();
@@ -2421,7 +2413,6 @@ Playlist::raise_region (boost::shared_ptr<Region> region)
 {
        set_layer (region, region->layer() + 1.5);
        relayer ();
-       check_crossfades (region->range ());
 }
 
 void
@@ -2429,7 +2420,6 @@ Playlist::lower_region (boost::shared_ptr<Region> region)
 {
        set_layer (region, region->layer() - 1.5);
        relayer ();
-       check_crossfades (region->range ());
 }
 
 void
@@ -2437,7 +2427,6 @@ Playlist::raise_region_to_top (boost::shared_ptr<Region> region)
 {
        set_layer (region, DBL_MAX);
        relayer ();
-       check_crossfades (region->range ());
 }
 
 void
@@ -2445,7 +2434,6 @@ Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
 {
        set_layer (region, -0.5);
        relayer ();
-       check_crossfades (region->range ());
 }
 
 void
@@ -2500,7 +2488,7 @@ Playlist::uses_source (boost::shared_ptr<const Source> src) const
 {
        RegionReadLock rlock (const_cast<Playlist*> (this));
 
-       for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
+       for (set<boost::shared_ptr<Region> >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
                if ((*r)->uses_source (src)) {
                        return true;
                }
@@ -2545,7 +2533,7 @@ Playlist::region_by_id (const ID& id) const
 {
        /* searches all regions ever added to this playlist */
 
-       for (set<boost::shared_ptr<Region> >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
+       for (set<boost::shared_ptr<Region> >::const_iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
                if ((*i)->id() == id) {
                        return *i;
                }
@@ -2837,6 +2825,7 @@ Playlist::combine (const RegionList& r)
                /* make position relative to zero */
 
                pl->add_region (copied_region, original_region->position() - earliest_position);
+               copied_region->set_layer (original_region->layer ());
 
                /* use the maximum number of channels for any region */
 
@@ -3114,10 +3103,6 @@ restart:
                        }
                }
        }
-
-       for (list<Evoral::Range<framepos_t> >::iterator i = ranges.begin(); i != ranges.end(); ++i) {
-               check_crossfades (*i);
-       }
 }
 
 void