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"
33 #include <sigc++/signal.h>
34 #include <boost/shared_ptr.hpp>
38 class ExportChannelConfiguration;
39 class RegionExportChannelFactory;
49 class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
52 typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
53 typedef std::list<ChannelConfigPtr> ChannelConfigList;
54 typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
56 ProfileManagerPtr manager;
59 ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
60 : SessionHandlePtr (session)
64 virtual ~ExportChannelSelector () {}
66 virtual void sync_with_manager () = 0;
68 sigc::signal<void> CriticalSelectionChanged;
71 class PortExportChannelSelector : public ExportChannelSelector
76 PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
77 ~PortExportChannelSelector ();
79 void sync_with_manager ();
83 void fill_route_list ();
84 void update_channel_count ();
85 void update_split_state ();
87 typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
89 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
93 Gtk::VBox channels_vbox;
94 Gtk::HBox channels_hbox;
96 Gtk::Label channels_label;
97 Gtk::SpinButton channels_spinbutton;
98 Gtk::CheckButton split_checkbox;
100 /* Column record for channel selector view */
102 class RouteCols : public Gtk::TreeModelColumnRecord
108 RouteCols () : n_channels (0)
109 { add (selected); add (name); add (io); add (port_list_col); }
111 void add_channels (uint32_t chans);
114 /* Channel count starts from one! */
116 Channel & get_channel (uint32_t channel);
120 Gtk::TreeModelColumn<bool> selected;
121 Gtk::TreeModelColumn<std::string> name;
122 Gtk::TreeModelColumn<ARDOUR::IO *> io;
124 /* Combo list column (shared by all channels) */
126 typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
127 ComboCol port_list_col;
129 /* Channel struct, that represents the selected port and its name */
133 Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
135 Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
136 Gtk::TreeModelColumn<std::string> label;
138 std::list<Channel> channels;
140 /* List of available ports
141 * Note: We need only one list of selectable ports per route,
142 * so the list is kept in the column record
145 /* Column record for selecting ports for a channel from a route */
147 class PortCols : public Gtk::TreeModel::ColumnRecord
150 PortCols () { add(selected); add(port); add(label); }
152 Gtk::TreeModelColumn<bool> selected; // not used ATM
153 Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
154 Gtk::TreeModelColumn<std::string> label;
161 class ChannelTreeView : public Gtk::TreeView {
164 ChannelTreeView (uint32_t max_channels);
165 void set_config (ChannelConfigPtr c);
167 /* Routes have to be added before adding channels */
169 void clear_routes () { route_list->clear (); }
170 void add_route (ARDOUR::IO * route);
171 void set_channel_count (uint32_t channels);
173 sigc::signal<void> CriticalSelectionChanged;
177 ChannelConfigPtr config;
178 void update_config ();
180 /* Signal handlers for selections changes in the view */
182 void update_toggle_selection (std::string const & path);
183 void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
185 RouteCols route_cols;
186 Glib::RefPtr<Gtk::ListStore> route_list;
188 uint32_t static_columns;
192 uint32_t max_channels;
194 Gtk::ScrolledWindow channel_scroller;
195 Gtk::Alignment channel_alignment;
196 ChannelTreeView channel_view;
200 class RegionExportChannelSelector : public ExportChannelSelector
203 RegionExportChannelSelector (ARDOUR::Session * session,
204 ProfileManagerPtr manager,
205 ARDOUR::AudioRegion const & region,
206 ARDOUR::AudioTrack & track);
208 virtual void sync_with_manager ();
212 void handle_selection ();
214 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
215 boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
216 ARDOUR::AudioRegion const & region;
217 ARDOUR::AudioTrack & track;
219 uint32_t region_chans;
220 uint32_t track_chans;
222 /*** GUI components ***/
226 Gtk::RadioButtonGroup type_group;
227 Gtk::RadioButton raw_button;
228 Gtk::RadioButton fades_button;
229 Gtk::RadioButton processed_button;
232 class TrackExportChannelSelector : public ExportChannelSelector
235 TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
237 virtual void sync_with_manager ();
242 void add_track (boost::shared_ptr<ARDOUR::Route> route);
243 void update_config();
245 ChannelConfigList configs;
247 Gtk::VBox main_layout;
249 struct TrackCols : public Gtk::TreeModelColumnRecord
252 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
253 Gtk::TreeModelColumn<std::string> label;
254 Gtk::TreeModelColumn<bool> selected;
256 TrackCols () { add (route); add(label); add(selected); }
258 TrackCols track_cols;
260 Glib::RefPtr<Gtk::ListStore> track_list;
261 Gtk::TreeView track_view;
263 Gtk::ScrolledWindow track_scroller;
265 Gtk::HBox options_box;
266 Gtk::RadioButton::Group source_group;
267 Gtk::RadioButton region_contents_button;
268 Gtk::RadioButton track_output_button;
271 #endif /* __export_channel_selector_h__ */