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>
27 #include <ardour/export_channel.h>
30 #include <sigc++/signal.h>
31 #include <boost/shared_ptr.hpp>
35 class ExportChannelConfiguration;
36 class RegionExportChannelFactory;
46 class ExportChannelSelector : public Gtk::HBox
49 typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
50 typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
53 virtual ~ExportChannelSelector () {}
55 virtual void set_state (ARDOUR::ExportProfileManager::ChannelConfigStatePtr const state_, ARDOUR::Session * session_) = 0;
56 sigc::signal<void> CriticalSelectionChanged;
59 class PortExportChannelSelector : public ExportChannelSelector
64 PortExportChannelSelector ();
65 ~PortExportChannelSelector ();
67 void set_state (ARDOUR::ExportProfileManager::ChannelConfigStatePtr const state_, ARDOUR::Session * session_);
71 void fill_route_list ();
72 void update_channel_count ();
73 void update_split_state ();
75 typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
77 ARDOUR::Session * session;
78 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
82 Gtk::VBox channels_vbox;
83 Gtk::HBox channels_hbox;
85 Gtk::Label channels_label;
86 Gtk::SpinButton channels_spinbutton;
87 Gtk::CheckButton split_checkbox;
89 /* Column record for channel selector view */
91 class RouteCols : public Gtk::TreeModelColumnRecord
97 RouteCols () : n_channels (0)
98 { add (selected); add (name); add (io); add (port_list_col); }
100 void add_channels (uint32_t chans);
103 /* Channel count starts from one! */
105 Channel & get_channel (uint32_t channel);
109 Gtk::TreeModelColumn<bool> selected;
110 Gtk::TreeModelColumn<Glib::ustring> name;
111 Gtk::TreeModelColumn<ARDOUR::IO *> io;
113 /* Combo list column (shared by all channels) */
115 typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
116 ComboCol port_list_col;
118 /* Channel struct, that represents the selected port and it's name */
122 Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
124 Gtk::TreeModelColumn<ARDOUR::AudioPort *> port;
125 Gtk::TreeModelColumn<Glib::ustring> label;
127 std::list<Channel> channels;
129 /* List of available ports
130 * Note: We need only one list of selectable ports per route,
131 * so the list is kept in the column record
134 /* Column record for selecting ports for a channel from a route */
136 class PortCols : public Gtk::TreeModel::ColumnRecord
139 PortCols () { add (selected); add(port); add(label); }
141 Gtk::TreeModelColumn<bool> selected; // not used ATM
142 Gtk::TreeModelColumn<ARDOUR::AudioPort *> port;
143 Gtk::TreeModelColumn<Glib::ustring> label;
150 class ChannelTreeView : public Gtk::TreeView {
153 ChannelTreeView (uint32_t max_channels);
154 void set_config (ChannelConfigPtr c);
156 /* Routes have to be added before adding channels */
158 void clear_routes () { route_list->clear (); }
159 void add_route (ARDOUR::IO * route);
160 void set_channel_count (uint32_t channels);
162 sigc::signal<void> CriticalSelectionChanged;
166 ChannelConfigPtr config;
167 void update_config ();
169 /* Signal handlers for selections changes in the view */
171 void update_toggle_selection (Glib::ustring const & path);
172 void update_selection_text (Glib::ustring const & path, Glib::ustring const & new_text, uint32_t channel);
174 RouteCols route_cols;
175 Glib::RefPtr<Gtk::ListStore> route_list;
177 uint32_t static_columns;
181 uint32_t max_channels;
183 Gtk::ScrolledWindow channel_scroller;
184 Gtk::Alignment channel_alignment;
185 ChannelTreeView channel_view;
189 class RegionExportChannelSelector : public ExportChannelSelector
192 RegionExportChannelSelector (ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track);
194 virtual void set_state (ARDOUR::ExportProfileManager::ChannelConfigStatePtr const state_, ARDOUR::Session * session_);
198 void handle_selection ();
200 ARDOUR::Session * session;
201 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
202 boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
203 ARDOUR::AudioRegion const & region;
204 ARDOUR::AudioTrack & track;
206 uint32_t region_chans;
207 uint32_t track_chans;
209 /*** GUI components ***/
213 Gtk::RadioButtonGroup type_group;
214 Gtk::RadioButton raw_button;
215 Gtk::RadioButton fades_button;
216 Gtk::RadioButton processed_button;
219 #endif /* __export_channel_selector_h__ */