summaryrefslogtreecommitdiff
path: root/gtk2_ardour/selection.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/selection.cc')
-rw-r--r--gtk2_ardour/selection.cc107
1 files changed, 21 insertions, 86 deletions
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index 9d0744acbe..eeccde1301 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -104,8 +104,7 @@ operator== (const Selection& a, const Selection& b)
a.time == b.time &&
a.lines == b.lines &&
a.playlists == b.playlists &&
- a.midi_notes == b.midi_notes &&
- a.midi_regions == b.midi_regions;
+ a.midi_notes == b.midi_notes;
}
/** Clear everything from the Selection */
@@ -119,7 +118,6 @@ Selection::clear ()
clear_time ();
clear_playlists ();
clear_midi_notes ();
- clear_midi_regions ();
clear_markers ();
pending_midi_note_selection.clear();
}
@@ -132,7 +130,6 @@ Selection::clear_objects (bool with_signal)
clear_lines(with_signal);
clear_playlists (with_signal);
clear_midi_notes (with_signal);
- clear_midi_regions (with_signal);
}
void
@@ -168,6 +165,10 @@ Selection::clear_regions (bool with_signal)
void
Selection::clear_midi_notes (bool with_signal)
{
+ /* Remmeber: MIDI notes are only stored here if we're using a Selection
+ object as a cut buffer.
+ */
+
if (!midi_notes.empty()) {
for (MidiNoteSelection::iterator x = midi_notes.begin(); x != midi_notes.end(); ++x) {
delete *x;
@@ -177,30 +178,6 @@ Selection::clear_midi_notes (bool with_signal)
MidiNotesChanged ();
}
}
-
- // clear note selections for MRV's that have note selections
- // this will cause the MRV to be removed from the list
- for (MidiRegionSelection::iterator i = midi_regions.begin();
- i != midi_regions.end();) {
- MidiRegionSelection::iterator tmp = i;
- ++tmp;
- MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
- if (mrv) {
- mrv->clear_selection();
- }
- i = tmp;
- }
-}
-
-void
-Selection::clear_midi_regions (bool with_signal)
-{
- if (!midi_regions.empty()) {
- midi_regions.clear ();
- if (with_signal) {
- MidiRegionsChanged ();
- }
- }
}
void
@@ -308,23 +285,6 @@ Selection::toggle (RegionView* r)
}
void
-Selection::toggle (MidiRegionView* mrv)
-{
- clear_time(); // enforce object/range exclusivity
- clear_tracks(); // enforce object/track exclusivity
-
- MidiRegionSelection::iterator i;
-
- if ((i = find (midi_regions.begin(), midi_regions.end(), mrv)) == midi_regions.end()) {
- add (mrv);
- } else {
- midi_regions.erase (i);
- }
-
- MidiRegionsChanged ();
-}
-
-void
Selection::toggle (vector<RegionView*>& r)
{
clear_time(); // enforce object/range exclusivity
@@ -474,21 +434,6 @@ Selection::add (RegionView* r)
}
}
-void
-Selection::add (MidiRegionView* mrv)
-{
- DEBUG_TRACE(DEBUG::Selection, string_compose("Selection::add MRV %1\n", mrv));
-
- clear_time(); // enforce object/range exclusivity
- clear_tracks(); // enforce object/track exclusivity
-
- if (find (midi_regions.begin(), midi_regions.end(), mrv) == midi_regions.end()) {
- midi_regions.push_back (mrv);
- /* XXX should we do this? */
- MidiRegionsChanged ();
- }
-}
-
long
Selection::add (samplepos_t start, samplepos_t end)
{
@@ -649,19 +594,6 @@ Selection::remove (RegionView* r)
}
void
-Selection::remove (MidiRegionView* mrv)
-{
- DEBUG_TRACE(DEBUG::Selection, string_compose("Selection::remove MRV %1\n", mrv));
-
- MidiRegionSelection::iterator x;
-
- if ((x = find (midi_regions.begin(), midi_regions.end(), mrv)) != midi_regions.end()) {
- midi_regions.erase (x);
- MidiRegionsChanged ();
- }
-}
-
-void
Selection::remove (uint32_t selection_id)
{
if (time.empty()) {
@@ -738,17 +670,6 @@ Selection::set (const RegionSelection& rs)
}
void
-Selection::set (MidiRegionView* mrv)
-{
- if (mrv) {
- clear_time(); // enforce region/object exclusivity
- clear_tracks(); // enforce object/track exclusivity
- }
- clear_objects ();
- add (mrv);
-}
-
-void
Selection::set (RegionView* r, bool /*also_clear_tracks*/)
{
if (r) {
@@ -872,8 +793,7 @@ Selection::empty (bool internal_selection)
lines.empty () &&
time.empty () &&
playlists.empty () &&
- markers.empty() &&
- midi_regions.empty()
+ markers.empty()
;
if (!internal_selection) {
@@ -1702,3 +1622,18 @@ Selection::core_selection_changed (PropertyChange const & what_changed)
TracksChanged();
}
+
+MidiRegionSelection
+Selection::midi_regions ()
+{
+ MidiRegionSelection ms;
+
+ for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
+ MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
+ if (mrv) {
+ ms.add (mrv);
+ }
+ }
+
+ return ms;
+}