set midi-metric ticks depending on meter-type
[ardour.git] / gtk2_ardour / region_selection.cc
index 8ad7502414632acb873632296c19426d6499ceb9..57ab59fd6864cb7e5a9b0f0bb7d879f2317efa67 100644 (file)
@@ -33,7 +33,7 @@ using namespace PBD;
  */
 RegionSelection::RegionSelection ()
 {
-       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
+       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, boost::bind (&RegionSelection::remove_it, this, _1), gui_context());
 }
 
 /** Copy constructor.
@@ -42,7 +42,7 @@ RegionSelection::RegionSelection ()
 RegionSelection::RegionSelection (const RegionSelection& other)
        : std::list<RegionView*>()
 {
-       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
+       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, boost::bind (&RegionSelection::remove_it, this, _1), gui_context());
 
        for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
                add (*i);
@@ -87,7 +87,7 @@ bool RegionSelection::contains (RegionView* rv) const
 
 /** Add a region to the selection.
  *  @param rv Region to add.
- *  @return false if we already had the region or if it cannot be added, 
+ *  @return false if we already had the region or if it cannot be added,
  *          otherwise true.
  */
 bool
@@ -137,7 +137,7 @@ RegionSelection::remove (RegionView* rv)
 
                // remove from layer sorted list
                _bylayer.remove (rv);
-               
+
                erase (r);
                return true;
        }
@@ -260,7 +260,7 @@ RegionSelection::start () const
        if (s == max_framepos) {
                return 0;
        }
-       
+
        return s;
 }
 
@@ -269,8 +269,20 @@ RegionSelection::end_frame () const
 {
        framepos_t e = 0;
        for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
-               e = max (e, (*i)->region()->position () + (*i)->region()->length ());
+               e = max (e, (*i)->region()->last_frame ());
        }
 
        return e;
 }
+
+/** @return the playlists that the regions in the selection are on */
+set<boost::shared_ptr<Playlist> >
+RegionSelection::playlists () const
+{
+       set<boost::shared_ptr<Playlist> > pl;
+       for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
+               pl.insert ((*i)->region()->playlist ());
+       }
+
+       return pl;
+}