Note modes: note, percussion.
[ardour.git] / gtk2_ardour / selection.cc
index 8a9d27a4ed2c30762f62ad07e3017dcd8e4d5051..43dd75df61f9606af3d73570cecb9494c926b39d 100644 (file)
@@ -20,6 +20,7 @@
 #include <algorithm>
 #include <sigc++/bind.h>
 #include <pbd/error.h>
+#include <pbd/stacktrace.h>
 
 #include <ardour/playlist.h>
 
@@ -63,9 +64,10 @@ operator== (const Selection& a, const Selection& b)
                a.time == b.time &&
                a.lines == b.lines &&
                a.playlists == b.playlists &&
-               a.redirects == b.redirects;
+               a.processors == b.processors;
 }
 
+/** Clear everything from the Selection */
 void
 Selection::clear ()
 {
@@ -75,7 +77,7 @@ Selection::clear ()
        clear_lines();
        clear_time ();
        clear_playlists ();
-       clear_redirects ();
+       clear_processors ();
 }
 
 void
@@ -89,11 +91,11 @@ Selection::dump_region_layers()
 
 
 void
-Selection::clear_redirects ()
+Selection::clear_processors ()
 {
-       if (!redirects.empty()) {
-               redirects.clear ();
-               RedirectsChanged ();
+       if (!processors.empty()) {
+               processors.clear ();
+               ProcessorsChanged ();
        }
 }
 
@@ -131,6 +133,8 @@ Selection::clear_playlists ()
        /* Selections own their playlists */
 
        for (PlaylistSelection::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+               /* selections own their own regions, which are copies of the "originals". make them go away */
+               (*i)->drop_regions ();
                (*i)->release ();
        }
 
@@ -150,16 +154,16 @@ Selection::clear_lines ()
 }
 
 void
-Selection::toggle (boost::shared_ptr<Redirect> r)
+Selection::toggle (boost::shared_ptr<Processor> r)
 {
-       RedirectSelection::iterator i;
+       ProcessorSelection::iterator i;
 
-       if ((i = find (redirects.begin(), redirects.end(), r)) == redirects.end()) {
-               redirects.push_back (r);
+       if ((i = find (processors.begin(), processors.end(), r)) == processors.end()) {
+               processors.push_back (r);
        } else {
-               redirects.erase (i);
+               processors.erase (i);
        }
-       RedirectsChanged();
+       ProcessorsChanged();
 
 }
 
@@ -250,11 +254,11 @@ Selection::toggle (nframes_t start, nframes_t end)
 
 
 void
-Selection::add (boost::shared_ptr<Redirect> r)
+Selection::add (boost::shared_ptr<Processor> i)
 {
-       if (find (redirects.begin(), redirects.end(), r) == redirects.end()) {
-               redirects.push_back (r);
-               RedirectsChanged();
+       if (find (processors.begin(), processors.end(), i) == processors.end()) {
+               processors.push_back (i);
+               ProcessorsChanged();
        }
 }
 
@@ -391,12 +395,12 @@ Selection::add (AutomationList* ac)
 }
 
 void
-Selection::remove (boost::shared_ptr<Redirect> r)
+Selection::remove (boost::shared_ptr<Processor> r)
 {
-       RedirectSelection::iterator i;
-       if ((i = find (redirects.begin(), redirects.end(), r)) != redirects.end()) {
-               redirects.erase (i);
-               RedirectsChanged ();
+       ProcessorSelection::iterator i;
+       if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) {
+               processors.erase (i);
+               ProcessorsChanged ();
        }
 }
 
@@ -506,10 +510,10 @@ Selection::remove (AutomationList *ac)
 }
 
 void
-Selection::set (boost::shared_ptr<Redirect> r)
+Selection::set (boost::shared_ptr<Processor> i)
 {
-       clear_redirects ();
-       add (r);
+       clear_processors ();
+       add (i);
 }
 
 void
@@ -621,7 +625,7 @@ Selection::empty ()
                lines.empty () &&
                time.empty () &&
                playlists.empty () &&
-               redirects.empty ()
+               processors.empty ()
                ;
 }