ardour
export_format_dialog.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_format_dialog_h__
22 #define __export_format_dialog_h__
23 
24 #include "ardour/types.h"
27 #include "ardour/export_formats.h"
28 
29 #include "pbd/xml++.h"
30 #include "pbd/signals.h"
31 
32 #include "ardour_dialog.h"
33 #include "audio_clock.h"
34 
35 #ifdef interface
36 #undef interface
37 #endif
38 
39 #include <gtkmm.h>
40 
42  private:
43 
50 
52 
53 
54  public:
55 
56  explicit ExportFormatDialog (FormatPtr format, bool new_dialog = false);
58 
59  void set_session (ARDOUR::Session* s);
60 
61  private:
62 
63  FormatPtr format;
65 
67 
70 
71  void end_dialog ();
72  void revert ();
73 
74  /*** Init functions ***/
75 
76  void load_state (FormatPtr spec);
77  void init_format_table ();
79 
80  /*** Interactive selections ***/
81 
82  /* These are connected to signals from GUI components, and should change element states */
83 
84  void update_compatibility_selection (std::string const & path);
90 
91  template<typename ColsT>
92  void update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
93 
94  /* These are connected to signals from elements, and should only update the gui */
95 
96  void change_compatibility_selection (bool select, WeakCompatPtr compat);
97 
98  void change_quality_selection (bool select, WeakQualityPtr quality);
99  void change_format_selection (bool select, WeakFormatPtr format);
100  void change_sample_rate_selection (bool select, WeakSampleRatePtr rate);
101  void change_sample_format_selection (bool select, WeakSampleFormatPtr format);
102  void change_dither_type_selection (bool select, WeakDitherTypePtr type);
103 
104  template<typename T, typename ColsT>
105  void change_selection (bool select, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
106 
107  void change_quality_compatibility (bool compatibility, WeakQualityPtr quality);
108  void change_format_compatibility (bool compatibility, WeakFormatPtr format);
109  void change_sample_rate_compatibility (bool compatibility, WeakSampleRatePtr rate);
110  void change_sample_format_compatibility (bool compatibility, WeakSampleFormatPtr format);
111  void change_dither_type_compatibility (bool compatibility, WeakDitherTypePtr type);
112 
113  template<typename T, typename ColsT>
114  void change_compatibility (bool compatibility, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols,
115  std::string const & c_incompatible = "red", std::string const & c_compatible = "white");
116 
117  void update_description();
118 
120 
121  /*** Non-interactive selections ***/
122 
123  void update_name ();
124 
127 
131 
132  void update_clock (AudioClock & clock, ARDOUR::AnyTime const & time);
133  void update_time (ARDOUR::AnyTime & time, AudioClock const & clock);
134 
136  void update_tagging_selection ();
137 
138  /*** Encoding options */
139 
141 
143  void remove_widget (Gtk::Widget & to_remove, Gtk::Container * remove_from);
144 
149 
151 
152  /*** GUI components ***/
153 
154  /* Name, new and remove */
155 
156  Gtk::HBox name_hbox;
157 
158  Gtk::Label name_label;
159  Gtk::Entry name_entry;
161 
162  /* Normalize */
163 
164  Gtk::HBox normalize_hbox;
165  Gtk::CheckButton normalize_checkbox;
166  Gtk::SpinButton normalize_spinbutton;
167  Gtk::Adjustment normalize_adjustment;
168  Gtk::Label normalize_db_label;
169 
170  /* Silence */
171 
172  Gtk::Table silence_table;
173 
174  Gtk::CheckButton trim_start_checkbox;
175  Gtk::CheckButton silence_start_checkbox;
177 
178  Gtk::CheckButton trim_end_checkbox;
179  Gtk::CheckButton silence_end_checkbox;
181 
182  /* Post-export hook */
183 
184  Gtk::Label command_label;
185  Gtk::Entry command_entry;
186 
187  /* Format table */
188 
189  struct CompatibilityCols : public Gtk::TreeModelColumnRecord
190  {
191  public:
192  Gtk::TreeModelColumn<ARDOUR::ExportFormatCompatibilityPtr> ptr;
193  Gtk::TreeModelColumn<bool> selected;
194  Gtk::TreeModelColumn<std::string> label;
195 
196  CompatibilityCols () { add(ptr); add(selected); add(label); }
197  };
199  Glib::RefPtr<Gtk::ListStore> compatibility_list;
200 
201  /* Hack to disallow row selection in compatibilities */
204 
205  struct QualityCols : public Gtk::TreeModelColumnRecord
206  {
207  public:
208  Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::QualityPtr> ptr;
209  Gtk::TreeModelColumn<std::string> color;
210  Gtk::TreeModelColumn<std::string> label;
211 
212  QualityCols () { add(ptr); add(color); add(label); }
213  };
215  Glib::RefPtr<Gtk::ListStore> quality_list;
216 
217  struct FormatCols : public Gtk::TreeModelColumnRecord
218  {
219  public:
220  Gtk::TreeModelColumn<ARDOUR::ExportFormatPtr> ptr;
221  Gtk::TreeModelColumn<std::string> color;
222  Gtk::TreeModelColumn<std::string> label;
223 
224  FormatCols () { add(ptr); add(color); add(label); }
225  };
227  Glib::RefPtr<Gtk::ListStore> format_list;
228 
229  struct SampleRateCols : public Gtk::TreeModelColumnRecord
230  {
231  public:
232  Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::SampleRatePtr> ptr;
233  Gtk::TreeModelColumn<std::string> color;
234  Gtk::TreeModelColumn<std::string> label;
235 
236  SampleRateCols () { add(ptr); add(color); add(label); }
237  };
239  Glib::RefPtr<Gtk::ListStore> sample_rate_list;
240 
241  Gtk::Table format_table;
242 
244  Gtk::Label quality_label;
245  Gtk::Label format_label;
246  Gtk::Label sample_rate_label;
247 
248  Gtk::TreeView compatibility_view;
249  Gtk::TreeView quality_view;
250  Gtk::TreeView format_view;
251  Gtk::TreeView sample_rate_view;
252 
253  /* SRC quality combo */
254 
255  struct SRCQualityCols : public Gtk::TreeModelColumnRecord
256  {
257  public:
258  Gtk::TreeModelColumn<ARDOUR::ExportFormatBase::SRCQuality> id;
259  Gtk::TreeModelColumn<std::string> label;
260 
261  SRCQualityCols () { add(id); add(label); }
262  };
264  Glib::RefPtr<Gtk::ListStore> src_quality_list;
265 
266  Gtk::Label src_quality_label;
267  Gtk::ComboBox src_quality_combo;
268 
269  /* Common encoding option components */
270 
273 
275 
276  /* Other common components */
277 
278  Gtk::Button * revert_button;
279  Gtk::Button * close_button;
280 
281  /*** Changing encoding option stuff ***/
282 
283  /* Linear */
284 
285  struct SampleFormatCols : public Gtk::TreeModelColumnRecord
286  {
287  public:
288  Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::SampleFormatPtr> ptr;
289  Gtk::TreeModelColumn<std::string> color;
290  Gtk::TreeModelColumn<std::string> label;
291 
292  SampleFormatCols () { add(ptr); add(color); add(label); }
293  };
295  Glib::RefPtr<Gtk::ListStore> sample_format_list;
296 
297  struct DitherTypeCols : public Gtk::TreeModelColumnRecord
298  {
299  public:
300  Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::DitherTypePtr> ptr;
301  Gtk::TreeModelColumn<std::string> color;
302  Gtk::TreeModelColumn<std::string> label;
303 
304  DitherTypeCols () { add(ptr); add (color); add(label); }
305  };
307  Glib::RefPtr<Gtk::ListStore> dither_type_list;
308 
310  Gtk::Label dither_label;
311 
312  Gtk::CheckButton with_cue;
313  Gtk::CheckButton with_toc;
314  Gtk::CheckButton with_mp4chaps;
315 
316  Gtk::VBox cue_toc_vbox;
317 
318  void update_with_toc ();
319  void update_with_cue ();
320  void update_with_mp4chaps();
321  void update_command ();
322 
323  Gtk::TreeView sample_format_view;
324  Gtk::TreeView dither_type_view;
325 
326  /* Tagging */
327 
328  Gtk::CheckButton tag_checkbox;
329 
330 };
331 
332 #endif /* __export_format_dialog_h__ */
Gtk::TreeModelColumn< std::string > label
Gtk::ComboBox src_quality_combo
Gtk::TreeModelColumn< std::string > color
void change_compatibility(bool compatibility, boost::weak_ptr< T > w_ptr, Glib::RefPtr< Gtk::ListStore > &list, ColsT &cols, std::string const &c_incompatible="red", std::string const &c_compatible="white")
void change_sample_rate_selection(bool select, WeakSampleRatePtr rate)
void remove_widget(Gtk::Widget &to_remove, Gtk::Container *remove_from)
boost::shared_ptr< ARDOUR::ExportFormatSpecification > FormatPtr
Glib::RefPtr< Gtk::ListStore > src_quality_list
Gtk::TreeModelColumn< std::string > label
Gtk::TreeView dither_type_view
Gtk::TreeModelColumn< ARDOUR::ExportFormatCompatibilityPtr > ptr
Gtk::TreeView sample_format_view
Gtk::TreeView sample_rate_view
ARDOUR::WeakExportFormatPtr WeakFormatPtr
Gtk::TreeModelColumn< ARDOUR::HasSampleFormat::DitherTypePtr > ptr
void change_format_compatibility(bool compatibility, WeakFormatPtr format)
void change_dither_type_selection(bool select, WeakDitherTypePtr type)
DitherTypeCols dither_type_cols
void change_sample_rate_compatibility(bool compatibility, WeakSampleRatePtr rate)
ARDOUR::ExportFormatManager::WeakQualityPtr WeakQualityPtr
void load_state(FormatPtr spec)
CompatibilityCols compatibility_cols
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< ARDOUR::HasSampleFormat::SampleFormatPtr > ptr
Gtk::TreeModelColumn< std::string > label
ARDOUR::ExportFormatManager manager
SampleRateCols sample_rate_cols
Gtk::CheckButton tag_checkbox
void set_session(ARDOUR::Session *s)
Gtk::CheckButton silence_end_checkbox
ARDOUR::AnyTime silence_end
Gtk::TreeModelColumn< ARDOUR::ExportFormatManager::SampleRatePtr > ptr
Gtk::TreeModelColumn< std::string > label
void change_compatibility_selection(bool select, WeakCompatPtr compat)
Gtk::CheckButton trim_end_checkbox
Gtk::TreeModelColumn< ARDOUR::ExportFormatBase::SRCQuality > id
Gtk::CheckButton normalize_checkbox
ARDOUR::WeakExportFormatCompatibilityPtr WeakCompatPtr
Gtk::Adjustment normalize_adjustment
Gtk::TreeModelColumn< std::string > color
Gtk::CheckButton with_cue
void change_sample_format_selection(bool select, WeakSampleFormatPtr format)
Gtk::CheckButton with_mp4chaps
Gtk::TreeView compatibility_view
ARDOUR::ExportFormatManager::WeakSampleFormatPtr WeakSampleFormatPtr
void update_clock(AudioClock &clock, ARDOUR::AnyTime const &time)
void show_flac_enconding_options(boost::shared_ptr< ARDOUR::ExportFormatFLAC > ptr)
void show_bwf_enconding_options(boost::shared_ptr< ARDOUR::ExportFormatBWF > ptr)
void fill_sample_format_lists(boost::shared_ptr< ARDOUR::HasSampleFormat > ptr)
Gtk::TreeModelColumn< ARDOUR::ExportFormatManager::QualityPtr > ptr
Gtk::TreeModelColumn< bool > selected
ARDOUR::ExportFormatManager::WeakSampleRatePtr WeakSampleRatePtr
void change_selection(bool select, boost::weak_ptr< T > w_ptr, Glib::RefPtr< Gtk::ListStore > &list, Gtk::TreeView &view, ColsT &cols)
Glib::RefPtr< Gtk::ListStore > format_list
Gtk::TreeModelColumn< ARDOUR::ExportFormatPtr > ptr
SRCQualityCols src_quality_cols
void change_sample_format_compatibility(bool compatibility, WeakSampleFormatPtr format)
Glib::RefPtr< Gtk::ListStore > quality_list
void change_dither_type_compatibility(bool compatibility, WeakDitherTypePtr type)
Gtk::CheckButton silence_start_checkbox
void change_quality_selection(bool select, WeakQualityPtr quality)
sigc::connection compatibility_select_connection
Gtk::SpinButton normalize_spinbutton
void change_format_selection(bool select, WeakFormatPtr format)
Gtk::TreeModelColumn< std::string > color
Glib::RefPtr< Gtk::ListStore > dither_type_list
Definition: xml++.h:95
void change_encoding_options(ARDOUR::ExportFormatPtr ptr)
ExportFormatDialog(FormatPtr format, bool new_dialog=false)
Gtk::CheckButton with_toc
void show_ogg_enconding_options(boost::shared_ptr< ARDOUR::ExportFormatOggVorbis > ptr)
void change_quality_compatibility(bool compatibility, WeakQualityPtr quality)
void update_compatibility_selection(std::string const &path)
Gtk::TreeModelColumn< std::string > label
LIBARDOUR_API PBD::PropertyDescriptor< bool > select
Definition: route_group.cc:48
ARDOUR::AnyTime silence_start
Glib::RefPtr< Gtk::ListStore > compatibility_list
Gtk::CheckButton trim_start_checkbox
void update_selection(Glib::RefPtr< Gtk::ListStore > &list, Gtk::TreeView &view, ColsT &cols)
ARDOUR::ExportFormatManager::WeakDitherTypePtr WeakDitherTypePtr
SampleFormatCols sample_format_cols
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< std::string > label
void show_linear_enconding_options(boost::shared_ptr< ARDOUR::ExportFormatLinear > ptr)
Glib::RefPtr< Gtk::ListStore > sample_rate_list
void update_time(ARDOUR::AnyTime &time, AudioClock const &clock)
Glib::RefPtr< Gtk::ListStore > sample_format_list