OSC: Blank some more feedback values when select observer is destroyed.
[ardour.git] / libs / ardour / playlist.cc
index b571a9eb5fd618698264c4ccc93b93be4fe9fc74..eaee1c4326659fbb24b767fd90422e1402456ea3 100644 (file)
@@ -141,7 +141,7 @@ Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide
        , _type(type)
 {
 #ifndef NDEBUG
-       const XMLProperty* prop = node.property("type");
+       XMLProperty const * prop = node.property("type");
        assert(!prop || DataType(prop->value()) == _type);
 #endif
 
@@ -1769,10 +1769,17 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
 
  }
 
- /***********************************************************************
+ /* *********************************************************************
   FINDING THINGS
   **********************************************************************/
 
+boost::shared_ptr<RegionList>
+Playlist::region_list() {
+       RegionReadLock rlock (this);
+       boost::shared_ptr<RegionList> rlist (new RegionList (regions.rlist ()));
+       return rlist;
+}
+
 boost::shared_ptr<RegionList>
 Playlist::regions_at (framepos_t frame)
 {
@@ -1822,6 +1829,7 @@ Playlist::regions_at (framepos_t frame)
         for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) {
 
                 RegionList::iterator tmp = i;
+
                 ++tmp;
 
                 if ((*i)->muted()) {
@@ -1949,7 +1957,7 @@ Playlist::find_next_transient (framepos_t from, int dir)
        bool reached = false;
 
        if (dir > 0) {
-               for (AnalysisFeatureList::iterator x = points.begin(); x != points.end(); ++x) {
+               for (AnalysisFeatureList::const_iterator x = points.begin(); x != points.end(); ++x) {
                        if ((*x) >= from) {
                                reached = true;
                        }
@@ -2047,23 +2055,25 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
 
                         boost::shared_ptr<Region> r = (*i);
                         frameoffset_t distance;
+                        const framepos_t first_frame = r->first_frame();
+                        const framepos_t last_frame = r->last_frame();
 
-                        if (r->first_frame() > frame) {
+                        if (first_frame > frame) {
 
-                                distance = r->first_frame() - frame;
+                                distance = first_frame - frame;
 
                                 if (distance < closest) {
-                                        ret = r->first_frame();
+                                        ret = first_frame;
                                         closest = distance;
                                 }
                         }
 
-                        if (r->last_frame () > frame) {
+                        if (last_frame > frame) {
 
-                                distance = r->last_frame () - frame;
+                                distance = last_frame - frame;
 
                                 if (distance < closest) {
-                                        ret = r->last_frame ();
+                                        ret = last_frame;
                                         closest = distance;
                                 }
                         }
@@ -2075,23 +2085,25 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
 
                         boost::shared_ptr<Region> r = (*i);
                         frameoffset_t distance;
+                        const framepos_t first_frame = r->first_frame();
+                        const framepos_t last_frame = r->last_frame();
 
-                        if (r->last_frame() < frame) {
+                        if (last_frame < frame) {
 
-                                distance = frame - r->last_frame();
+                                distance = frame - last_frame;
 
                                 if (distance < closest) {
-                                        ret = r->last_frame();
+                                        ret = last_frame;
                                         closest = distance;
                                 }
                         }
 
-                        if (r->first_frame() < frame) {
+                        if (first_frame < frame) {
 
-                                distance = frame - r->first_frame();
+                                distance = frame - first_frame;
 
                                 if (distance < closest) {
-                                        ret = r->first_frame();
+                                        ret = first_frame;
                                         closest = distance;
                                 }
                         }
@@ -2156,7 +2168,7 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
         XMLNodeConstIterator niter;
         XMLPropertyList plist;
         XMLPropertyConstIterator piter;
-        XMLProperty *prop;
+        XMLProperty const * prop;
         boost::shared_ptr<Region> region;
         string region_name;
         bool seen_region_nodes = false;
@@ -2899,6 +2911,7 @@ Playlist::update_after_tempo_map_change ()
        }
 
        thaw ();
+       notify_contents_changed();
 }
 
 void
@@ -3126,7 +3139,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
 
        // (2) get all the original regions
 
-       const RegionList& rl (pl->region_list().rlist());
+       const RegionList& rl (pl->region_list_property().rlist());
        RegionFactory::CompoundAssociations& cassocs (RegionFactory::compound_associations());
        frameoffset_t move_offset = 0;