2 Copyright (C) 2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sigc++/bind.h>
23 #include <pbd/error.h>
25 #include <ardour/playlist.h>
26 #include <ardour/redirect.h>
27 #include <ardour/route.h>
29 #include "route_redirect_selection.h"
33 using namespace ARDOUR;
37 RouteRedirectSelection&
38 RouteRedirectSelection::operator= (const RouteRedirectSelection& other)
41 redirects = other.redirects;
42 routes = other.routes;
48 operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b)
50 return a.redirects == b.redirects &&
55 RouteRedirectSelection::clear ()
62 RouteRedirectSelection::clear_redirects ()
69 RouteRedirectSelection::clear_routes ()
76 RouteRedirectSelection::add (boost::shared_ptr<Redirect> r)
78 if (find (redirects.begin(), redirects.end(), r) == redirects.end()) {
79 redirects.push_back (r);
81 // XXX SHAREDPTR FIXME
82 // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove;
83 // r->GoingAway.connect (mem_fun(*this, pmf));
90 RouteRedirectSelection::add (const vector<boost::shared_ptr<Redirect> >& rlist)
94 for (vector<boost::shared_ptr<Redirect> >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) {
95 if (find (redirects.begin(), redirects.end(), *i) == redirects.end()) {
96 redirects.push_back (*i);
98 // XXX SHAREDPTR FIXME
100 //void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove;
101 // (*i)->GoingAway.connect (mem_fun(*this, pmf));
112 RouteRedirectSelection::remove (boost::shared_ptr<Redirect> r)
114 list<boost::shared_ptr<Redirect> >::iterator i;
115 if ((i = find (redirects.begin(), redirects.end(), r)) != redirects.end()) {
122 RouteRedirectSelection::set (boost::shared_ptr<Redirect> r)
129 RouteRedirectSelection::set (const vector<boost::shared_ptr<Redirect> >& rlist)
136 RouteRedirectSelection::add (boost::shared_ptr<Route> r)
138 if (find (routes.begin(), routes.end(), r) == routes.end()) {
139 routes.push_back (r);
141 // XXX SHAREDPTR FIXME
142 // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove;
143 // r->GoingAway.connect (bind (mem_fun(*this, pmf), r));
150 RouteRedirectSelection::remove (boost::shared_ptr<Route> r)
152 list<boost::shared_ptr<Route> >::iterator i;
153 if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
160 RouteRedirectSelection::set (boost::shared_ptr<Route> r)
167 RouteRedirectSelection::selected (boost::shared_ptr<Route> r)
169 return find (routes.begin(), routes.end(), r) != routes.end();
173 RouteRedirectSelection::empty ()
175 return redirects.empty () && routes.empty ();