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;
35 RouteProcessorSelection::RouteProcessorSelection()
36 : _no_route_change_signal (false)
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 for (AxisViewSelection::iterator i = axes.begin(); i != axes.end(); ++i) {
75 (*i)->set_selected (false);
79 if (!_no_route_change_signal) {
85 RouteProcessorSelection::add (XMLNode* node)
87 // XXX check for duplicate
88 processors.add (node);
93 RouteProcessorSelection::set (XMLNode* node)
96 processors.set (node);
101 RouteProcessorSelection::add (AxisView* r)
103 if (axes.insert (r).second) {
105 r->set_selected (true);
107 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
110 ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
113 if (!_no_route_change_signal) {
120 RouteProcessorSelection::remove (AxisView* r)
122 ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r);
124 AxisViewSelection::iterator i;
125 if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) {
126 (*i)->set_selected (false);
128 if (!_no_route_change_signal) {
135 RouteProcessorSelection::set (AxisView* r)
142 RouteProcessorSelection::selected (AxisView* r)
144 return find (axes.begin(), axes.end(), r) != axes.end();
148 RouteProcessorSelection::empty ()
150 return processors.empty () && axes.empty ();
154 RouteProcessorSelection::block_routes_changed (bool yn)
156 _no_route_change_signal = yn;