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>
34 class ExportChannelConfiguration;
35 class RegionExportChannelFactory;
45 class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
48 typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
49 typedef std::list<ChannelConfigPtr> ChannelConfigList;
50 typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
52 ProfileManagerPtr manager;
55 ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
56 : SessionHandlePtr (session)
60 virtual ~ExportChannelSelector () {}
62 virtual void sync_with_manager () = 0;
64 sigc::signal<void> CriticalSelectionChanged;
67 class PortExportChannelSelector : public ExportChannelSelector
72 PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
73 ~PortExportChannelSelector ();
75 void sync_with_manager ();
79 void fill_route_list ();
80 void update_channel_count ();
81 void update_split_state ();
83 typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
85 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
89 Gtk::VBox channels_vbox;
90 Gtk::HBox channels_hbox;
92 Gtk::Label channels_label;
93 Gtk::SpinButton channels_spinbutton;
94 Gtk::CheckButton split_checkbox;
96 /* Column record for channel selector view */
98 class RouteCols : public Gtk::TreeModelColumnRecord
104 RouteCols () : n_channels (0)
105 { add (selected); add (name); add (io); add (port_list_col); }
107 void add_channels (uint32_t chans);
110 /* Channel count starts from one! */
112 Channel & get_channel (uint32_t channel);
116 Gtk::TreeModelColumn<bool> selected;
117 Gtk::TreeModelColumn<std::string> name;
118 Gtk::TreeModelColumn<ARDOUR::IO *> io;
120 /* Combo list column (shared by all channels) */
122 typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
123 ComboCol port_list_col;
125 /* Channel struct, that represents the selected port and it's name */
129 Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
131 Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
132 Gtk::TreeModelColumn<std::string> label;
134 std::list<Channel> channels;
136 /* List of available ports
137 * Note: We need only one list of selectable ports per route,
138 * so the list is kept in the column record
141 /* Column record for selecting ports for a channel from a route */
143 class PortCols : public Gtk::TreeModel::ColumnRecord
146 PortCols () { add(selected); add(port); add(label); }
148 Gtk::TreeModelColumn<bool> selected; // not used ATM
149 Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
150 Gtk::TreeModelColumn<std::string> label;
157 class ChannelTreeView : public Gtk::TreeView {
160 ChannelTreeView (uint32_t max_channels);
161 void set_config (ChannelConfigPtr c);
163 /* Routes have to be added before adding channels */
165 void clear_routes () { route_list->clear (); }
166 void add_route (ARDOUR::IO * route);
167 void set_channel_count (uint32_t channels);
169 sigc::signal<void> CriticalSelectionChanged;
173 ChannelConfigPtr config;
174 void update_config ();
176 /* Signal handlers for selections changes in the view */
178 void update_toggle_selection (std::string const & path);
179 void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
181 RouteCols route_cols;
182 Glib::RefPtr<Gtk::ListStore> route_list;
184 uint32_t static_columns;
188 uint32_t max_channels;
190 Gtk::ScrolledWindow channel_scroller;
191 Gtk::Alignment channel_alignment;
192 ChannelTreeView channel_view;
196 class RegionExportChannelSelector : public ExportChannelSelector
199 RegionExportChannelSelector (ARDOUR::Session * session,
200 ProfileManagerPtr manager,
201 ARDOUR::AudioRegion const & region,
202 ARDOUR::AudioTrack & track);
204 virtual void sync_with_manager ();
208 void handle_selection ();
210 ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
211 boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
212 ARDOUR::AudioRegion const & region;
213 ARDOUR::AudioTrack & track;
215 uint32_t region_chans;
216 uint32_t track_chans;
218 /*** GUI components ***/
222 Gtk::RadioButtonGroup type_group;
223 Gtk::RadioButton raw_button;
224 Gtk::RadioButton fades_button;
225 Gtk::RadioButton processed_button;
228 class TrackExportChannelSelector : public ExportChannelSelector
231 TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
233 virtual void sync_with_manager ();
238 void add_track (boost::shared_ptr<ARDOUR::Route> route);
239 void update_config();
241 ChannelConfigList configs;
243 Gtk::VBox main_layout;
245 struct TrackCols : public Gtk::TreeModelColumnRecord
248 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
249 Gtk::TreeModelColumn<std::string> label;
250 Gtk::TreeModelColumn<bool> selected;
252 TrackCols () { add (route); add(label); add(selected); }
254 TrackCols track_cols;
256 Glib::RefPtr<Gtk::ListStore> track_list;
257 Gtk::TreeView track_view;
259 Gtk::ScrolledWindow track_scroller;
261 Gtk::HBox options_box;
262 Gtk::RadioButton::Group source_group;
263 Gtk::RadioButton region_contents_button;
264 Gtk::RadioButton track_output_button;
267 #endif /* __export_channel_selector_h__ */