2 Copyright (C) 1999-2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_export_dialog_h__
21 #define __ardour_export_dialog_h__
23 #include <gtkmm/alignment.h>
24 #include <gtkmm/box.h>
25 #include <gtkmm/table.h>
26 #include <gtkmm/frame.h>
27 #include <gtkmm/frame.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/progressbar.h>
30 #include <gtkmm/scrolledwindow.h>
31 #include <gtkmm/fileselection.h>
32 #include <gtkmm/comboboxtext.h>
33 #include <gtkmm/treeview.h>
34 #include <gtkmm/liststore.h>
36 #include <ardour/export.h>
37 #include <ardour/location.h>
39 #include "ardour_dialog.h"
49 class ExportDialog : public ArdourDialog
52 ExportDialog (PublicEditor&);
55 void connect_to_session (ARDOUR::Session*);
56 virtual void set_range (nframes_t start, nframes_t end);
60 ARDOUR::AudioExportSpecification spec;
62 struct ExportModelColumns : public Gtk::TreeModel::ColumnRecord
65 Gtk::TreeModelColumn<std::string> output;
66 Gtk::TreeModelColumn<bool> left;
67 Gtk::TreeModelColumn<bool> right;
68 Gtk::TreeModelColumn<ARDOUR::Port*> port;
70 ExportModelColumns() { add(output); add(left); add(right); add(port);}
73 ExportModelColumns exp_cols;
75 // These methods are intended to be used in constructors of subclasses
76 void do_not_allow_track_and_master_selection();
77 void do_not_allow_channel_count_selection();
78 void do_not_allow_export_cd_markers();
80 // Checks the given filename for validity when export gets started.
81 // Export will interrupt when this method returns 'false'.
82 // Method is responsible for informing user.
83 virtual bool is_filepath_valid(string &filepath);
85 // Gets called from within do_export. Is responsible for exporting the
86 // audio data. spec has already been filled with user input before calling
87 // this method. The dialog will be closed after this function exited.
88 virtual void export_audio_data() = 0;
90 // reads the user input and fills spec with the according values
91 // filepath: complete path to the target file, including filename
92 void initSpec(string &filepath);
94 void set_progress_fraction(double progress) {
95 progress_bar.set_fraction (progress); }
97 ARDOUR::Session& getSession() { return *session; };
98 string get_selected_header_format() {
99 return header_format_combo.get_active_text(); };
100 string get_selected_file_name() { return file_entry.get_text(); };
103 PublicEditor& editor;
104 ARDOUR::Session* session;
105 bool track_and_master_selection_allowed;
106 bool channel_count_selection_allowed;
107 bool export_cd_markers_allowed;
109 Gtk::VBox track_vpacker;
112 Gtk::Table format_table;
113 Gtk::Frame format_frame;
115 Gtk::Label cue_file_label;
116 Gtk::ComboBoxText cue_file_combo;
118 Gtk::Label channel_count_label;
119 Gtk::ComboBoxText channel_count_combo;
121 Gtk::Label header_format_label;
122 Gtk::ComboBoxText header_format_combo;
124 Gtk::Label bitdepth_format_label;
125 Gtk::ComboBoxText bitdepth_format_combo;
127 Gtk::Label endian_format_label;
128 Gtk::ComboBoxText endian_format_combo;
130 Gtk::Label sample_rate_label;
131 Gtk::ComboBoxText sample_rate_combo;
133 Gtk::Label src_quality_label;
134 Gtk::ComboBoxText src_quality_combo;
136 Gtk::Label dither_type_label;
137 Gtk::ComboBoxText dither_type_combo;
139 Gtk::CheckButton cuefile_only_checkbox;
141 Gtk::Frame file_frame;
142 Gtk::Entry file_entry;
144 Gtk::Button file_browse_button;
146 Gtk::Button* ok_button;
147 Gtk::Button* cancel_button;
148 Gtk::Label cancel_label;
149 Gtk::ProgressBar progress_bar;
150 Gtk::ScrolledWindow track_scroll;
151 Gtk::ScrolledWindow master_scroll;
152 Gtk::Button track_selector_button;
153 Gtk::TreeView track_selector;
154 Glib::RefPtr<Gtk::ListStore> track_list;
155 Gtk::TreeView master_selector;
156 Glib::RefPtr<Gtk::ListStore> master_list;
158 static void *_thread (void *arg);
159 // sets the export progress in the progress bar
160 virtual gint progress_timeout ();
161 sigc::connection progress_connection;
162 void build_window ();
164 void header_chosen ();
165 void channels_chosen ();
166 void bitdepth_chosen ();
167 void sample_rate_chosen ();
168 void cue_file_type_chosen();
171 void write_track_and_master_selection_to_spec();
173 void do_export_cd_markers (const string& path, const string& cuefile_type);
174 void export_cue_file (ARDOUR::Locations::LocationList& locations, const string& path);
175 void export_toc_file (ARDOUR::Locations::LocationList& locations, const string& path);
177 gint window_closed (GdkEventAny *ignored);
179 void track_selector_button_click ();
187 #endif // __ardour_export_dialog_h__