2 Copyright (C) 2009 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.
20 #include "global_port_matrix.h"
22 #include "ardour/bundle.h"
23 #include "ardour/session.h"
24 #include "ardour/audioengine.h"
25 #include "ardour/port.h"
27 GlobalPortMatrix::GlobalPortMatrix (ARDOUR::Session& s, ARDOUR::DataType t)
28 : PortMatrix (s, t, true),
30 _our_port_group_list (t, false)
34 _column_ports.VisibilityChanged.connect (sigc::mem_fun (*this, &GlobalPortMatrix::group_visibility_changed));
38 GlobalPortMatrix::group_visibility_changed ()
40 _row_ports.take_visibility_from (_column_ports);
46 GlobalPortMatrix::setup ()
48 _row_ports.gather (_session);
53 GlobalPortMatrix::set_state (
54 boost::shared_ptr<ARDOUR::Bundle> ab,
56 boost::shared_ptr<ARDOUR::Bundle> bb,
62 ARDOUR::Bundle::PortList const& our_ports = ab->channel_ports (ac);
63 ARDOUR::Bundle::PortList const& other_ports = bb->channel_ports (bc);
65 for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
66 for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
68 ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
69 ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
85 /* we don't handle connections between two non-Ardour ports */
92 GlobalPortMatrix::get_state (
93 boost::shared_ptr<ARDOUR::Bundle> ab,
95 boost::shared_ptr<ARDOUR::Bundle> bb,
99 ARDOUR::Bundle::PortList const& our_ports = ab->channel_ports (ac);
100 ARDOUR::Bundle::PortList const& other_ports = bb->channel_ports (bc);
102 for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
103 for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
105 ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
106 ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
108 /* we don't know the state of connections between two non-Ardour ports */
113 if (p && p->connected_to (*j) == false) {
114 return NOT_ASSOCIATED;
115 } else if (q && q->connected_to (*i) == false) {
116 return NOT_ASSOCIATED;
126 GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::DataType t)
128 t == ARDOUR::DataType::AUDIO ?
129 _("Audio Connections Manager") :
130 _("MIDI Connections Manager")),
133 get_vbox()->pack_start (_port_matrix);