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
, public ARDOUR::SessionHandlePtr
49 typedef boost::shared_ptr
<ARDOUR::ExportChannelConfiguration
> ChannelConfigPtr
;
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
<Glib::ustring
> 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
<ARDOUR::AudioPort
*> port
;
132 Gtk::TreeModelColumn
<Glib::ustring
> 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
<ARDOUR::AudioPort
*> port
;
150 Gtk::TreeModelColumn
<Glib::ustring
> 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 (Glib::ustring
const & path
);
179 void update_selection_text (Glib::ustring
const & path
, Glib::ustring
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 #endif /* __export_channel_selector_h__ */