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_group_h__
21 #define __gtk_ardour_port_group_h__
25 #include <gtkmm/widget.h>
26 #include <gtkmm/checkbutton.h>
27 #include <boost/shared_ptr.hpp>
28 #include <ardour/data_type.h>
37 /** A list of bundles and ports, grouped by some aspect of their
38 * type e.g. busses, tracks, system. Each group has 0 or more bundles
39 * and 0 or more ports, where the ports are not in the bundles.
41 class PortGroup : public sigc::trackable
44 /** PortGroup constructor.
46 * @param v true if group should be visible in the UI, otherwise false.
48 PortGroup (std::string const & n, bool v)
49 : name (n), _visible (v) {}
51 void add_bundle (boost::shared_ptr<ARDOUR::Bundle>);
52 void add_port (std::string const &);
55 std::string name; ///< name for the group
56 std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles;
57 std::vector<std::string> ports;
58 bool visible () const {
62 void set_visible (bool v) {
67 bool has_port (std::string const &) const;
69 sigc::signal<void> VisibilityChanged;
72 bool _visible; ///< true if the group is visible in the UI
75 /// The UI for a PortGroup
79 PortGroupUI (PortMatrix*, PortGroup*);
81 Gtk::Widget& visibility_checkbutton () {
82 return _visibility_checkbutton;
86 void visibility_checkbutton_toggled ();
87 void setup_visibility_checkbutton ();
89 PortMatrix* _port_matrix; ///< the PortMatrix that we are working for
90 PortGroup* _port_group; ///< the PortGroup that we are representing
91 Gtk::CheckButton _visibility_checkbutton;
94 /// A list of PortGroups
95 class PortGroupList : public std::list<PortGroup*>, public sigc::trackable
105 PortGroupList (ARDOUR::Session &, ARDOUR::DataType, bool, Mask);
108 void set_type (ARDOUR::DataType);
109 void set_offer_inputs (bool);
110 std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
111 void take_visibility_from (PortGroupList const &);
113 sigc::signal<void> VisibilityChanged;
116 void maybe_add_session_bundle (boost::shared_ptr<ARDOUR::Bundle>);
117 bool port_has_prefix (std::string const &, std::string const &) const;
118 std::string common_prefix (std::vector<std::string> const &) const;
119 void visibility_changed ();
121 ARDOUR::Session& _session;
122 ARDOUR::DataType _type;
131 #endif /* __gtk_ardour_port_group_h__ */