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;
45
routes = other.routes;
51
operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b)
53
// XXX MUST TEST PROCESSORS SOMEHOW
54
return a.routes == b.routes;
58
RouteProcessorSelection::clear ()
65
RouteProcessorSelection::clear_processors ()
72
RouteProcessorSelection::clear_routes ()
74
for (RouteUISelection::iterator i = routes.begin(); i != routes.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 (RouteUI* r)
103
if (find (routes.begin(), routes.end(), r) == routes.end()) {
104
if (routes.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) {
121
RouteProcessorSelection::remove (RouteUI* r)
123
ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r);
125
RouteUISelection::iterator i;
126
if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
128
(*i)->set_selected (false);
129
if (!_no_route_change_signal) {
136
RouteProcessorSelection::set (RouteUI* r)
143
RouteProcessorSelection::selected (RouteUI* r)
145
return find (routes.begin(), routes.end(), r) != routes.end();
149
RouteProcessorSelection::empty ()
151
return processors.empty () && routes.empty ();
155
RouteProcessorSelection::block_routes_changed (bool yn)
157
_no_route_change_signal = yn;