Ardour  8.12
export_channel_selector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2008-2013 Sakari Bergen <sakari.bergen@beatwaves.net>
4  * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
5  * Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
6  * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef __export_channel_selector_h__
24 #define __export_channel_selector_h__
25 
26 #include <list>
27 #include <memory>
28 
30 
31 #ifdef interface
32 #undef interface
33 #endif
34 
35 #include <sigc++/signal.h>
36 
37 
38 #include <gtkmm/alignment.h>
39 #include <gtkmm/box.h>
41 #include <gtkmm/checkbutton.h>
42 #include <gtkmm/label.h>
43 #include <gtkmm/liststore.h>
44 #include <gtkmm/scrolledwindow.h>
45 #include <gtkmm/spinbutton.h>
46 #include <gtkmm/treemodel.h>
47 #include <gtkmm/treeview.h>
48 
50 
51 namespace ARDOUR {
52  class Session;
53  class ExportChannelConfiguration;
54  class RegionExportChannelFactory;
55  class ExportHandler;
56  class AudioPort;
57  class IO;
58  class AudioRegion;
59  class AudioTrack;
60 }
61 
62 class XMLNode;
63 
65 {
66 protected:
67  typedef std::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
68  typedef std::list<ChannelConfigPtr> ChannelConfigList;
69  typedef std::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
70 
72 
73 public:
76  , manager (manager)
77  {}
78 
79  virtual ~ExportChannelSelector () {}
80 
81  virtual void sync_with_manager () = 0;
82  virtual bool channel_limit_reached () const = 0;
83 
84  sigc::signal<void> CriticalSelectionChanged;
85 };
86 
88 {
89 public:
90 
93 
95  bool channel_limit_reached () const;
96 
97 private:
98 
99  void fill_route_list ();
102 
103  typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
104 
106 
107  /*** GUI stuff ***/
108 
111 
115 
116  /* Column record for channel selector view */
117 
119  {
120  public:
121 
122  struct Channel;
123 
125  { add (selected); add (name); add (io); add (port_list_col); }
126 
127  void add_channels (uint32_t chans);
128  uint32_t n_channels;
129 
130  /* Channel count starts from one! */
131 
132  Channel & get_channel (uint32_t channel);
133 
134  /* Static columns */
135 
139 
140  /* Combo list column (shared by all channels) */
141 
144 
145  /* Channel struct, that represents the selected port and its name */
146 
147  struct Channel {
148  public:
149  Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
150 
153  };
154  std::list<Channel> channels;
155 
156  /* List of available ports
157  * Note: We need only one list of selectable ports per route,
158  * so the list is kept in the column record
159  */
160 
161  /* Column record for selecting ports for a channel from a route */
162 
164  {
165  public:
167 
171  };
173  };
174 
175  /* Channels view */
176 
178  {
179  public:
180 
183 
184  /* Routes have to be added before adding channels */
185 
186  void clear_routes () { route_list->clear (); }
187  void add_route (ARDOUR::IO * route);
188  void set_channel_count (uint32_t channels);
189  uint32_t channel_count () const { return n_channels; }
190  uint32_t max_route_channel_count () const;
191 
192  sigc::signal<void> CriticalSelectionChanged;
193 
194  private:
195 
197  void update_config ();
198 
199  /* Signal handlers for selections changes in the view */
200 
201  void update_toggle_selection (std::string const & path);
202  void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
203 
205  Glib::RefPtr<Gtk::ListStore> route_list;
206 
207  uint32_t static_columns;
208  uint32_t n_channels;
209  };
210 
211  uint32_t max_channels;
212 
216 
217 };
218 
220 {
221 public:
224  ARDOUR::AudioRegion const & region,
226 
227  virtual void sync_with_manager ();
228  bool channel_limit_reached () const { return false; }
229 
230 private:
231 
233 
235  std::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
238 
239  uint32_t region_chans;
240 
241  /*** GUI components ***/
242 
244 
248 };
249 
251 {
252  public:
255 
257 
258  bool track_output () const { return track_output_button.get_active(); }
259  bool channel_limit_reached () const { return false; }
260 
261  private:
262 
263  void fill_list();
265  void add_track (std::shared_ptr<ARDOUR::Route> route, bool selected);
268 
270 
272  {
273  public:
278 
280  };
282 
283  Glib::RefPtr<Gtk::ListStore> track_list;
285 
287 
293  void select_tracks (int);
294  void select_busses ();
295  void select_none ();
296 
299 };
300 
301 #endif /* __export_channel_selector_h__ */
std::shared_ptr< ChannelConfigState > ChannelConfigStatePtr
Definition: io.h:73
virtual ARDOUR::Session * session() const
virtual bool channel_limit_reached() const =0
sigc::signal< void > CriticalSelectionChanged
std::shared_ptr< ARDOUR::ExportChannelConfiguration > ChannelConfigPtr
std::shared_ptr< ARDOUR::ExportProfileManager > ProfileManagerPtr
ExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
virtual void sync_with_manager()=0
std::list< ChannelConfigPtr > ChannelConfigList
bool get_active() const
void add(TreeModelColumnBase &column)
void path(Glib::ustring &path, Glib::ustring &path_reversed)
Compute a widget's path of the form "GtkWindow.MyLabel".
void update_toggle_selection(std::string const &path)
void update_selection_text(std::string const &path, std::string const &new_text, uint32_t channel)
void set_channel_count(uint32_t channels)
Gtk::TreeModelColumn< std::weak_ptr< ARDOUR::AudioPort > > port
Gtk::TreeModelColumn< Glib::RefPtr< Gtk::ListStore > > ComboCol
Channel & get_channel(uint32_t channel)
Gtk::TreeModelColumn< ARDOUR::IO * > io
Gtk::TreeModelColumn< std::string > name
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state
bool channel_limit_reached() const
std::list< ARDOUR::ExportChannelPtr > CahnnelList
PortExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
Gtk::ScrolledWindow channel_scroller
ARDOUR::AudioRegion const & region
std::shared_ptr< ARDOUR::RegionExportChannelFactory > factory
RegionExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager, ARDOUR::AudioRegion const &region, ARDOUR::AudioTrack &track)
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state
virtual void sync_with_manager()
TrackExportChannelSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
void add_track(std::shared_ptr< ARDOUR::Route > route, bool selected)
Glib::RefPtr< Gtk::ListStore > track_list
ArdourWidgets::ArdourDropdown select_menu
Definition: xml++.h:114
PBD::PropertyDescriptor< bool > selected
Gtk::TreeModelColumn< std::weak_ptr< ARDOUR::AudioPort > > port
Gtk::TreeModelColumn< std::shared_ptr< ARDOUR::Route > > route
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< uint32_t > order_key