#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"
*/
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.
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);
RegionSelection::clear_all()
{
clear();
+ pending.clear ();
_bylayer.clear();
}
{
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;
+}
+
+size_t
+RegionSelection::n_midi_regions () const
+{
+ size_t count = 0;
+
+ for (const_iterator r = begin(); r != end(); ++r) {
+ MidiRegionView* const mrv = dynamic_cast<MidiRegionView*> (*r);
+ if (mrv) {
+ ++count;
+ }
+ }
+
+ return count;
+}