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 "gui_thread.h"
25 #include "mixer_strip.h"
26 #include "route_processor_selection.h"
32 using namespace ARDOUR;
36 RouteProcessorSelection::RouteProcessorSelection()
40 RouteProcessorSelection&
41 RouteProcessorSelection::operator= (const RouteProcessorSelection& other)
44 processors = other.processors;
51 operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b)
53 // XXX MUST TEST PROCESSORS SOMEHOW
54 return a.axes == b.axes;
58 RouteProcessorSelection::clear ()
65 RouteProcessorSelection::clear_processors ()
72 RouteProcessorSelection::clear_routes ()
74 PresentationInfo::ChangeSuspender cs;
76 for (AxisViewSelection::iterator i = axes.begin(); i != axes.end(); ++i) {
77 (*i)->set_selected (false);
84 RouteProcessorSelection::add (XMLNode* node)
86 // XXX check for duplicate
87 processors.add (node);
92 RouteProcessorSelection::set (XMLNode* node)
95 processors.set (node);
100 RouteProcessorSelection::add (AxisView* r)
102 if (axes.insert (r).second) {
104 r->set_selected (true);
106 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
109 ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
115 RouteProcessorSelection::remove (AxisView* r)
117 ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r);
118 PresentationInfo::ChangeSuspender cs;
120 AxisViewSelection::iterator i;
121 if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) {
124 av->set_selected (false);
129 RouteProcessorSelection::set (AxisView* r)
131 PresentationInfo::ChangeSuspender cs;
137 RouteProcessorSelection::selected (AxisView* r)
139 return find (axes.begin(), axes.end(), r) != axes.end();
143 RouteProcessorSelection::empty ()
145 return processors.empty () && axes.empty ();