2 Copyright (C) 2008 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __export_channel_selector_h__
22 #define __export_channel_selector_h__
26 #include <ardour/export_profile_manager.h>
29 #include <sigc++/signal.h>
30 #include <boost/shared_ptr.hpp>
35 class ExportChannelConfiguration;
44 class ExportChannelSelector : public Gtk::HBox {
47 typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
49 typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
53 ExportChannelSelector ();
54 ~ExportChannelSelector ();
56 void set_state (ARDOUR::ExportProfileManager::ChannelConfigStatePtr const state_, ARDOUR::Session * session_);
58 sigc::signal<void> CriticalSelectionChanged;
62 void fill_route_list ();
63 void update_channel_count ();
64 void update_split_state ();
66 typedef boost::shared_ptr<ARDOUR::ExportChannel> ChannelPtr;
67 typedef std::list<ChannelPtr> CahnnelList;
69 ARDOUR::Session * session;
70 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
74 Gtk::VBox channels_vbox;
75 Gtk::HBox channels_hbox;
77 Gtk::Label channels_label;
78 Gtk::SpinButton channels_spinbutton;
79 Gtk::CheckButton split_checkbox;
81 /* Column record for channel selector view */
83 class RouteCols : public Gtk::TreeModelColumnRecord
89 RouteCols () : n_channels (0)
90 { add (selected); add (name); add (io); add (port_list_col); }
92 void add_channels (uint32_t chans);
95 /* Channel count starts from one! */
97 Channel & get_channel (uint32_t channel);
101 Gtk::TreeModelColumn<bool> selected;
102 Gtk::TreeModelColumn<Glib::ustring> name;
103 Gtk::TreeModelColumn<ARDOUR::IO *> io;
105 /* Combo list column (shared by all channels) */
107 typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
108 ComboCol port_list_col;
110 /* Channel struct, that represents the selected port and it's name */
114 Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
116 Gtk::TreeModelColumn<ARDOUR::AudioPort *> port;
117 Gtk::TreeModelColumn<Glib::ustring> label;
119 std::list<Channel> channels;
121 /* List of available ports
122 * Note: We need only one list of selectable ports per route,
123 * so the list is kept in the column record
126 /* Column record for selecting ports for a channel from a route */
128 class PortCols : public Gtk::TreeModel::ColumnRecord
131 PortCols () { add (selected); add(port); add(label); }
133 Gtk::TreeModelColumn<bool> selected; // not used ATM
134 Gtk::TreeModelColumn<ARDOUR::AudioPort *> port;
135 Gtk::TreeModelColumn<Glib::ustring> label;
142 class ChannelTreeView : public Gtk::TreeView {
145 ChannelTreeView (uint32_t max_channels);
146 void set_config (ChannelConfigPtr c);
148 /* Routes have to be added before adding channels */
150 void clear_routes () { route_list->clear (); }
151 void add_route (ARDOUR::IO * route);
152 void set_channel_count (uint32_t channels);
154 sigc::signal<void> CriticalSelectionChanged;
158 ChannelConfigPtr config;
159 void update_config ();
161 /* Signal handlers for selections changes in the view */
163 void update_toggle_selection (Glib::ustring const & path);
164 void update_selection_text (Glib::ustring const & path, Glib::ustring const & new_text, uint32_t channel);
166 RouteCols route_cols;
167 Glib::RefPtr<Gtk::ListStore> route_list;
169 uint32_t static_columns;
173 uint32_t max_channels;
175 Gtk::ScrolledWindow channel_scroller;
176 Gtk::Alignment channel_alignment;
177 ChannelTreeView channel_view;
181 #endif /* __export_channel_selector_h__ */