2 Copyright (C) 2002-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 #ifndef __gtk_ardour_port_matrix_h__
21 #define __gtk_ardour_port_matrix_h__
24 #include <gtkmm/box.h>
25 #include <gtkmm/scrollbar.h>
26 #include <boost/shared_ptr.hpp>
27 #include "port_matrix_body.h"
28 #include "port_group.h"
30 /** The `port matrix' UI. This is a widget which lets the user alter
31 * associations between one set of ports and another. e.g. to connect
34 * The columns are labelled with various ports from around Ardour and the
37 * It is made up of a body, PortMatrixBody, which is rendered using cairo,
38 * and some scrollbars. All of this is arranged inside the VBox that we
46 class PortMatrix : public Gtk::VBox
49 PortMatrix (ARDOUR::Session&, ARDOUR::DataType, bool);
52 virtual void setup ();
53 void set_offer_inputs (bool);
54 void set_type (ARDOUR::DataType);
56 ARDOUR::DataType type () const {
60 bool offering_input () const {
64 void disassociate_all ();
71 sigc::signal<void, Result> Finished;
73 /** @param ab Our bundle.
74 * @param ac Channel on our bundle.
75 * @param bb Other bundle.
76 * @arapm bc Channel on other bundle.
80 virtual void set_state (
81 boost::shared_ptr<ARDOUR::Bundle> ab,
83 boost::shared_ptr<ARDOUR::Bundle> bb,
95 /** @param ab Our bundle.
96 * @param ac Channel on our bundle.
97 * @param bb Other bundle.
98 * @arapm bc Channel on other bundle.
101 virtual State get_state (
102 boost::shared_ptr<ARDOUR::Bundle> ab,
104 boost::shared_ptr<ARDOUR::Bundle> bb,
108 virtual void add_channel (boost::shared_ptr<ARDOUR::Bundle>) = 0;
109 virtual void remove_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t) = 0;
110 virtual bool can_rename_channels () const = 0;
111 virtual void rename_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t) {}
113 void setup_scrollbars ();
117 PortGroupList _row_ports;
118 PortGroupList _column_ports;
122 void hscroll_changed ();
123 void vscroll_changed ();
124 void routes_changed ();
126 ARDOUR::Session& _session;
127 /// true to offer inputs, otherwise false
129 /// port type that we are working with
130 ARDOUR::DataType _type;
132 PortMatrixBody _body;
133 Gtk::HScrollbar _hscroll;
134 Gtk::VScrollbar _vscroll;
135 std::list<PortGroupUI*> _port_group_uis;
136 std::vector<sigc::connection> _route_connections;