Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
24 
25 #include <list>
26 #include <memory>
27 
29 
30 #ifdef interface
31 #undef interface
32 #endif
33 
34 #include <sigc++/signal.h>
35 
36 
37 #include <gtkmm/alignment.h>
38 #include <gtkmm/box.h>
40 #include <gtkmm/checkbutton.h>
41 #include <gtkmm/label.h>
42 #include <gtkmm/liststore.h>
43 #include <gtkmm/scrolledwindow.h>
44 #include <gtkmm/spinbutton.h>
45 #include <gtkmm/treemodel.h>
46 #include <gtkmm/treeview.h>
47 
49 
50 namespace ARDOUR {
51  class Session;
52  class ExportChannelConfiguration;
53  class RegionExportChannelFactory;
54  class ExportHandler;
55  class AudioPort;
56  class IO;
57  class AudioRegion;
58  class AudioTrack;
59 }
60 
61 class XMLNode;
62 
64 {
65 protected:
66  typedef std::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
67  typedef std::list<ChannelConfigPtr> ChannelConfigList;
68  typedef std::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
69 
71 
72 public:
75  , manager (manager)
76  {}
77 
78  virtual ~ExportChannelSelector () {}
79 
80  virtual void sync_with_manager () = 0;
81  virtual bool channel_limit_reached () const = 0;
82 
83  sigc::signal<void> CriticalSelectionChanged;
84 };
85 
87 {
88 public:
89 
92 
94  bool channel_limit_reached () const;
95 
96 private:
97 
98  void fill_route_list ();
101 
102  typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
103 
105 
106  /*** GUI stuff ***/
107 
110 
114 
115  /* Column record for channel selector view */
116 
118  {
119  public:
120 
121  struct Channel;
122 
124  { add (selected); add (name); add (io); add (port_list_col); }
125 
126  void add_channels (uint32_t chans);
127  uint32_t n_channels;
128 
129  /* Channel count starts from one! */
130 
131  Channel & get_channel (uint32_t channel);
132 
133  /* Static columns */
134 
138 
139  /* Combo list column (shared by all channels) */
140 
143 
144  /* Channel struct, that represents the selected port and its name */
145 
146  struct Channel {
147  public:
148  Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
149 
152  };
153  std::list<Channel> channels;
154 
155  /* List of available ports
156  * Note: We need only one list of selectable ports per route,
157  * so the list is kept in the column record
158  */
159 
160  /* Column record for selecting ports for a channel from a route */
161 
163  {
164  public:
166 
170  };
172  };
173 
174  /* Channels view */
175 
177  {
178  public:
179 
182 
183  /* Routes have to be added before adding channels */
184 
185  void clear_routes () { route_list->clear (); }
186  void add_route (ARDOUR::IO * route);
187  void set_channel_count (uint32_t channels);
188  uint32_t channel_count () const { return n_channels; }
189  uint32_t max_route_channel_count () const;
190 
191  sigc::signal<void> CriticalSelectionChanged;
192 
193  private:
194 
196  void update_config ();
197 
198  /* Signal handlers for selections changes in the view */
199 
200  void update_toggle_selection (std::string const & path);
201  void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
202 
204  Glib::RefPtr<Gtk::ListStore> route_list;
205 
206  uint32_t static_columns;
207  uint32_t n_channels;
208  };
209 
210  uint32_t max_channels;
211 
215 
216 };
217 
219 {
220 public:
223  ARDOUR::AudioRegion const & region,
225 
226  virtual void sync_with_manager ();
227  bool channel_limit_reached () const { return false; }
228 
229 private:
230 
232 
234  std::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
237 
238  uint32_t region_chans;
239 
240  /*** GUI components ***/
241 
243 
247 };
248 
250 {
251  public:
254 
256 
257  bool track_output () const { return track_output_button.get_active(); }
258  bool channel_limit_reached () const { return false; }
259 
260  private:
261 
262  void fill_list();
264  void add_track (std::shared_ptr<ARDOUR::Route> route, bool selected);
267 
269 
271  {
272  public:
277 
279  };
281 
282  Glib::RefPtr<Gtk::ListStore> track_list;
284 
286 
292  void select_tracks (int);
293  void select_busses ();
294  void select_none ();
295 
298 };
299 
std::shared_ptr< ChannelConfigState > ChannelConfigStatePtr
Definition: io.h:72
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