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__
26 #include <gtkmm/widget.h>
27 #include <gtkmm/checkbutton.h>
29 #include <ardour/data_type.h>
39 /// A list of port names, grouped by some aspect of their type e.g. busses, tracks, system
43 /** PortGroup constructor.
45 * @param p Port name prefix (including trailing :)
46 * @param v true if group should be visible in the UI, otherwise false.
48 PortGroup (std::string const & n, std::string const & p, bool v)
49 : name (n), prefix (p), visible (v) {}
51 void add (std::string const & p);
53 std::string name; ///< name for the group
54 std::string prefix; ///< prefix e.g. "ardour:"
55 std::vector<std::string> ports; ///< port names
56 bool visible; ///< true if the group is visible in the UI
59 /// The UI for a PortGroup
63 PortGroupUI (PortMatrix&, PortGroup&);
65 Gtk::Widget& get_visibility_checkbutton ();
66 PortGroup& port_group () { return _port_group; }
67 void setup_visibility ();
70 void port_checkbutton_toggled (Gtk::CheckButton*, int, int);
71 bool port_checkbutton_release (GdkEventButton* ev, Gtk::CheckButton* b, int r, int c);
72 void visibility_checkbutton_toggled ();
74 PortMatrix& _port_matrix; ///< the PortMatrix that we are working for
75 PortGroup& _port_group; ///< the PortGroup that we are representing
76 bool _ignore_check_button_toggle;
77 Gtk::CheckButton _visibility_checkbutton;
80 /// A list of PortGroups
81 class PortGroupList : public std::list<PortGroup*>
91 PortGroupList (ARDOUR::Session &, ARDOUR::DataType, bool, Mask);
94 int n_visible_ports () const;
95 std::string get_port_by_index (int, bool with_prefix = true) const;
96 void set_type (ARDOUR::DataType);
97 void set_offer_inputs (bool);
100 ARDOUR::Session& _session;
101 ARDOUR::DataType _type;
110 #endif /* __gtk_ardour_port_group_h__ */