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, PortGroupList::Mask);
52 virtual void setup ();
53 void set_offer_inputs (bool);
54 void set_type (ARDOUR::DataType);
55 bool offering_input () const { return _offer_inputs; }
56 void disassociate_all ();
63 sigc::signal<void, Result> Finished;
65 /** @param ab Our bundle.
66 * @param ac Channel on our bundle.
67 * @param bb Other bundle.
68 * @arapm bc Channel on other bundle.
72 virtual void set_state (
73 boost::shared_ptr<ARDOUR::Bundle> ab,
75 boost::shared_ptr<ARDOUR::Bundle> bb,
81 /** @param ab Our bundle.
82 * @param ac Channel on our bundle.
83 * @param bb Other bundle.
84 * @arapm bc Channel on other bundle.
85 * @return true if r is connected to p, otherwise false.
87 virtual bool get_state (
88 boost::shared_ptr<ARDOUR::Bundle> ab,
90 boost::shared_ptr<ARDOUR::Bundle> bb,
94 virtual void add_channel (boost::shared_ptr<ARDOUR::Bundle>) = 0;
95 virtual void remove_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t) = 0;
96 virtual bool can_rename_channels () const = 0;
97 virtual void rename_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t) {}
99 void setup_scrollbars ();
103 boost::shared_ptr<ARDOUR::Bundle> _our_bundle;
107 void hscroll_changed ();
108 void vscroll_changed ();
109 std::string common_prefix (std::vector<std::string> const &) const;
111 /// true to offer inputs, otherwise false
113 /// list of port groups
114 PortGroupList _port_group_list;
115 /// port type that we are working with
116 ARDOUR::DataType _type;
118 PortMatrixBody _body;
119 Gtk::HScrollbar _hscroll;
120 Gtk::VScrollbar _vscroll;
121 std::list<PortGroupUI*> _port_group_uis;