#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::clear_all()
{
clear();
+ pending.clear ();
_bylayer.clear();
}
return find (begin(), end(), rv) != end();
}
+bool RegionSelection::contains (boost::shared_ptr<ARDOUR::Region> region) const
+{
+ for (const_iterator r = begin (); r != end (); ++r) {
+ if ((*r)->region () == region) {
+ return true;
+ }
+ }
+ return false;
+}
+
/** 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,
bool
RegionSelection::add (RegionView* rv)
{
- if (!rv->region()->playlist()) {
+ if (!rv->region()->playlist()) {
/* not attached to a playlist - selection not allowed.
This happens if the user tries to select a region
during a capture pass.
// remove from layer sorted list
_bylayer.remove (rv);
-
+ pending.remove (rv->region()->id());
erase (r);
return true;
}
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;
+}
+
+ARDOUR::RegionList
+RegionSelection::regionlist () const
+{
+ ARDOUR::RegionList rl;
+ for (const_iterator r = begin (); r != end (); ++r) {
+ rl.push_back ((*r)->region ());
+ }
+ return rl;
+}