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.
21 #include <sigc++/bind.h>
22 #include "pbd/error.h"
24 #include "ardour/playlist.h"
25 #include "ardour/processor.h"
26 #include "ardour/route.h"
28 #include "gui_thread.h"
29 #include "mixer_strip.h"
30 #include "route_processor_selection.h"
36 using namespace ARDOUR;
39 RouteRedirectSelection&
40 RouteRedirectSelection::operator= (const RouteRedirectSelection& other)
43 processors = other.processors;
44 routes = other.routes;
50 operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b)
52 // XXX MUST TEST PROCESSORS SOMEHOW
53 return a.routes == b.routes;
57 RouteRedirectSelection::clear ()
64 RouteRedirectSelection::clear_processors ()
71 RouteRedirectSelection::clear_routes ()
73 for (RouteUISelection::iterator i = routes.begin(); i != routes.end(); ++i) {
74 (*i)->set_selected (false);
82 RouteRedirectSelection::add (XMLNode* node)
84 // XXX check for duplicate
85 processors.add (node);
90 RouteRedirectSelection::set (XMLNode* node)
93 processors.set (node);
98 RouteRedirectSelection::add (RouteUI* r)
100 if (find (routes.begin(), routes.end(), r) == routes.end()) {
101 if (routes.insert (r).second) {
102 r->set_selected (true);
104 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
107 ms->CatchDeletion.connect (*this, invalidator (*this), ui_bind (&RouteRedirectSelection::remove, this, _1), gui_context());
116 RouteRedirectSelection::remove (RouteUI* r)
118 ENSURE_GUI_THREAD (*this, &RouteRedirectSelection::remove, r);
120 RouteUISelection::iterator i;
121 if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
123 (*i)->set_selected (false);
129 RouteRedirectSelection::set (RouteUI* r)
136 RouteRedirectSelection::selected (RouteUI* r)
138 return find (routes.begin(), routes.end(), r) != routes.end();
142 RouteRedirectSelection::empty ()
144 return processors.empty () && routes.empty ();