X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=inline;f=gtk2_ardour%2Fregion_selection.cc;h=1536dd61e4e7ad1b8bfdfa1b5bbff437d8ab981b;hb=aabc5108f34058d466d1e7451694193a08379ce2;hp=333e2104ad8f49244affffc5883c939f162ad763;hpb=ed626628b54e67dd9621c08d82a42afaed00c7ac;p=ardour.git diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc index 333e2104ad..1536dd61e4 100644 --- a/gtk2_ardour/region_selection.cc +++ b/gtk2_ardour/region_selection.cc @@ -21,6 +21,7 @@ #include "ardour/region.h" #include "gui_thread.h" +#include "midi_region_view.h" #include "region_view.h" #include "region_selection.h" #include "time_axis_view.h" @@ -33,7 +34,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 +43,7 @@ RegionSelection::RegionSelection () RegionSelection::RegionSelection (const RegionSelection& other) : std::list() { - 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); @@ -73,6 +74,7 @@ void RegionSelection::clear_all() { clear(); + pending.clear (); _bylayer.clear(); } @@ -269,8 +271,35 @@ 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 > +RegionSelection::playlists () const +{ + set > pl; + for (RegionSelection::const_iterator i = begin(); i != end(); ++i) { + pl.insert ((*i)->region()->playlist ()); + } + + return pl; +} + +size_t +RegionSelection::n_midi_regions () const +{ + size_t count = 0; + + for (const_iterator r = begin(); r != end(); ++r) { + MidiRegionView* const mrv = dynamic_cast (*r); + if (mrv) { + ++count; + } + } + + return count; +}