ardour
route_processor_selection.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #include <algorithm>
21 #include <sigc++/bind.h>
22 #include "pbd/error.h"
23 
24 #include "gui_thread.h"
25 #include "mixer_strip.h"
27 #include "route_ui.h"
28 
29 #include "i18n.h"
30 
31 using namespace std;
32 using namespace ARDOUR;
33 using namespace PBD;
34 
36  : _no_route_change_signal (false)
37 {
38 }
39 
42 {
43  if (&other != this) {
44  processors = other.processors;
45  routes = other.routes;
46  }
47  return *this;
48 }
49 
50 bool
52 {
53  // XXX MUST TEST PROCESSORS SOMEHOW
54  return a.routes == b.routes;
55 }
56 
57 void
59 {
61  clear_routes ();
62 }
63 
64 void
66 {
67  processors.clear ();
69 }
70 
71 void
73 {
74  for (RouteUISelection::iterator i = routes.begin(); i != routes.end(); ++i) {
75  (*i)->set_selected (false);
76  }
77  routes.clear ();
80  RoutesChanged ();
81  }
82 }
83 
84 void
86 {
87  // XXX check for duplicate
88  processors.add (node);
90 }
91 
92 void
94 {
96  processors.set (node);
98 }
99 
100 void
102 {
103  if (find (routes.begin(), routes.end(), r) == routes.end()) {
104  if (routes.insert (r).second) {
105  r->set_selected (true);
106 
107  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
108 
109  if (ms) {
110  ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
111  }
112 
114  RoutesChanged();
115  }
116  }
117  }
118 }
119 
120 void
122 {
124 
125  RouteUISelection::iterator i;
126  if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
127  (*i)->set_selected (false);
128  routes.erase (i);
130  RoutesChanged ();
131  }
132  }
133 }
134 
135 void
137 {
138  clear_routes ();
139  add (r);
140 }
141 
142 bool
144 {
145  return find (routes.begin(), routes.end(), r) != routes.end();
146 }
147 
148 bool
150 {
151  return processors.empty () && routes.empty ();
152 }
153 
154 void
156 {
158 }
void set(XMLNode *n)
Definition: Beats.hpp:239
#define ENSURE_GUI_THREAD(obj, method,...)
Definition: gui_thread.h:34
#define invalidator(x)
Definition: gui_thread.h:40
Definition: amp.h:29
#define gui_context()
Definition: gui_thread.h:36
void add(XMLNode *newchild)
RouteProcessorSelection & operator=(const RouteProcessorSelection &other)
Definition: xml++.h:95
bool operator==(const RouteProcessorSelection &a, const RouteProcessorSelection &b)
Definition: debug.h:30
sigc::signal< void > ProcessorsChanged
virtual void set_selected(bool yn)
Definition: selectable.h:34
static PBD::Signal1< void, MixerStrip * > CatchDeletion
Definition: mixer_strip.h:118
sigc::signal< void > RoutesChanged