ardour
export_channel_selector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Sakari Bergen
4 
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.
9 
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.
14 
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.
18 
19 */
20 
21 #ifndef __export_channel_selector_h__
22 #define __export_channel_selector_h__
23 
24 #include <list>
25 
27 
28 #ifdef interface
29 #undef interface
30 #endif
31 
32 #include <gtkmm.h>
33 #include <sigc++/signal.h>
34 #include <boost/shared_ptr.hpp>
35 
36 namespace ARDOUR {
37  class Session;
38  class ExportChannelConfiguration;
39  class RegionExportChannelFactory;
40  class ExportHandler;
41  class AudioPort;
42  class IO;
43  class AudioRegion;
44  class AudioTrack;
45 }
46 
47 class XMLNode;
48 
49 class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
50 {
51  protected:
53  typedef std::list<ChannelConfigPtr> ChannelConfigList;
55 
56  ProfileManagerPtr manager;
57 
58  public:
59  ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
60  : SessionHandlePtr (session)
61  , manager (manager)
62  {}
63 
64  virtual ~ExportChannelSelector () {}
65 
66  virtual void sync_with_manager () = 0;
67 
68  sigc::signal<void> CriticalSelectionChanged;
69 };
70 
72 {
73 
74  public:
75 
78 
79  void sync_with_manager ();
80 
81  private:
82 
83  void fill_route_list ();
84  void update_channel_count ();
85  void update_split_state ();
86 
87  typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
88 
90 
91  /*** GUI stuff ***/
92 
93  Gtk::VBox channels_vbox;
94  Gtk::HBox channels_hbox;
95 
96  Gtk::Label channels_label;
97  Gtk::SpinButton channels_spinbutton;
98  Gtk::CheckButton split_checkbox;
99 
100  /* Column record for channel selector view */
101 
102  class RouteCols : public Gtk::TreeModelColumnRecord
103  {
104  public:
105 
106  struct Channel;
107 
109  { add (selected); add (name); add (io); add (port_list_col); }
110 
111  void add_channels (uint32_t chans);
112  uint32_t n_channels;
113 
114  /* Channel count starts from one! */
115 
116  Channel & get_channel (uint32_t channel);
117 
118  /* Static columns */
119 
120  Gtk::TreeModelColumn<bool> selected;
121  Gtk::TreeModelColumn<std::string> name;
122  Gtk::TreeModelColumn<ARDOUR::IO *> io;
123 
124  /* Combo list column (shared by all channels) */
125 
126  typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
127  ComboCol port_list_col;
128 
129  /* Channel struct, that represents the selected port and its name */
130 
131  struct Channel {
132  public:
133  Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
134 
135  Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
136  Gtk::TreeModelColumn<std::string> label;
137  };
138  std::list<Channel> channels;
139 
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
143  */
144 
145  /* Column record for selecting ports for a channel from a route */
146 
147  class PortCols : public Gtk::TreeModel::ColumnRecord
148  {
149  public:
150  PortCols () { add(selected); add(port); add(label); }
151 
152  Gtk::TreeModelColumn<bool> selected; // not used ATM
153  Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
154  Gtk::TreeModelColumn<std::string> label;
155  };
157  };
158 
159  /* Channels view */
160 
161  class ChannelTreeView : public Gtk::TreeView {
162  public:
163 
164  ChannelTreeView (uint32_t max_channels);
165  void set_config (ChannelConfigPtr c);
166 
167  /* Routes have to be added before adding channels */
168 
169  void clear_routes () { route_list->clear (); }
170  void add_route (ARDOUR::IO * route);
171  void set_channel_count (uint32_t channels);
172 
173  sigc::signal<void> CriticalSelectionChanged;
174 
175  private:
176 
178  void update_config ();
179 
180  /* Signal handlers for selections changes in the view */
181 
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);
184 
186  Glib::RefPtr<Gtk::ListStore> route_list;
187 
188  uint32_t static_columns;
189  uint32_t n_channels;
190  };
191 
192  uint32_t max_channels;
193 
194  Gtk::ScrolledWindow channel_scroller;
195  Gtk::Alignment channel_alignment;
197 
198 };
199 
201 {
202  public:
205  ARDOUR::AudioRegion const & region,
207 
208  virtual void sync_with_manager ();
209 
210  private:
211 
212  void handle_selection ();
213 
218 
219  uint32_t region_chans;
220  uint32_t track_chans;
221 
222  /*** GUI components ***/
223 
224  Gtk::VBox vbox;
225 
226  Gtk::RadioButtonGroup type_group;
227  Gtk::RadioButton raw_button;
228  Gtk::RadioButton fades_button;
229  Gtk::RadioButton processed_button;
230 };
231 
233 {
234  public:
236 
237  virtual void sync_with_manager ();
238 
239  private:
240 
241  void fill_list();
243  void update_config();
245 
246  Gtk::VBox main_layout;
247 
248  struct TrackCols : public Gtk::TreeModelColumnRecord
249  {
250  public:
251  Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
252  Gtk::TreeModelColumn<std::string> label;
253  Gtk::TreeModelColumn<bool> selected;
254  Gtk::TreeModelColumn<uint32_t> order_key;
255 
256  TrackCols () { add (route); add(label); add(selected); add(order_key); }
257  };
259 
260  Glib::RefPtr<Gtk::ListStore> track_list;
261  Gtk::TreeView track_view;
262 
263  Gtk::ScrolledWindow track_scroller;
264 
265  Gtk::HBox options_box;
266  Gtk::RadioButton::Group source_group;
267  Gtk::RadioButton region_contents_button;
268  Gtk::RadioButton track_output_button;
269 };
270 
271 #endif /* __export_channel_selector_h__ */
void update_selection_text(std::string const &path, std::string const &new_text, uint32_t channel)
Glib::RefPtr< Gtk::ListStore > track_list
ARDOUR::AudioRegion const & region
TrackExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
Gtk::TreeModelColumn< Glib::RefPtr< Gtk::ListStore > > ComboCol
Gtk::TreeModelColumn< boost::weak_ptr< ARDOUR::AudioPort > > port
Gtk::TreeModelColumn< boost::weak_ptr< ARDOUR::AudioPort > > port
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state
Gtk::TreeModelColumn< std::string > name
Gtk::ScrolledWindow channel_scroller
std::list< ARDOUR::ExportChannelPtr > CahnnelList
Gtk::TreeModelColumn< uint32_t > order_key
Definition: amp.h:29
virtual void sync_with_manager()=0
Gtk::TreeModelColumn< boost::shared_ptr< ARDOUR::Route > > route
void update_toggle_selection(std::string const &path)
boost::shared_ptr< ARDOUR::ExportProfileManager > ProfileManagerPtr
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state
std::list< ChannelConfigPtr > ChannelConfigList
boost::shared_ptr< ARDOUR::ExportChannelConfiguration > ChannelConfigPtr
ExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
RegionExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager, ARDOUR::AudioRegion const &region, ARDOUR::AudioTrack &track)
Definition: xml++.h:95
PortExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
boost::shared_ptr< ARDOUR::RegionExportChannelFactory > factory
Gtk::RadioButton::Group source_group
Gtk::TreeModelColumn< ARDOUR::IO * > io
sigc::signal< void > CriticalSelectionChanged
void add_track(boost::shared_ptr< ARDOUR::Route > route)
Definition: io.h:67
Gtk::TreeModelColumn< std::string > label