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__
25 #include <ardour/export.h>
26 #include <ardour/location.h>
28 #include "ardour_dialog.h"
38 class ExportDialog
: public ArdourDialog
41 ExportDialog (PublicEditor
&);
44 void connect_to_session (ARDOUR::Session
*);
45 virtual void set_range (nframes_t start
, nframes_t end
);
48 virtual Gtk::FileChooserAction
browse_action() const { return Gtk::FILE_CHOOSER_ACTION_SAVE
; }
51 ARDOUR::AudioExportSpecification spec
;
52 Gtk::Frame file_frame
;
54 struct ExportModelColumns
: public Gtk::TreeModel::ColumnRecord
57 Gtk::TreeModelColumn
<std::string
> output
;
58 Gtk::TreeModelColumn
<bool> left
;
59 Gtk::TreeModelColumn
<bool> right
;
60 Gtk::TreeModelColumn
<ARDOUR::Port
*> port
;
62 ExportModelColumns() { add(output
); add(left
); add(right
); add(port
);}
65 ExportModelColumns exp_cols
;
67 // These methods are intended to be used in constructors of subclasses
68 void do_not_allow_track_and_master_selection();
69 void do_not_allow_channel_count_selection();
70 void do_not_allow_export_cd_markers();
72 // Checks the given filename for validity when export gets started.
73 // Export will interrupt when this method returns 'false'.
74 // Method is responsible for informing user.
75 virtual bool is_filepath_valid(string
&filepath
);
77 // Gets called from within do_export. Is responsible for exporting the
78 // audio data. spec has already been filled with user input before calling
79 // this method. The dialog will be closed after this function exited.
80 virtual void export_audio_data() = 0;
82 virtual bool wants_dir() { return false; }
84 // reads the user input and fills spec with the according values
85 // filepath: complete path to the target file, including filename
86 void initSpec(string
&filepath
);
88 void set_progress_fraction(double progress
) {
89 progress_bar
.set_fraction (progress
); }
91 ARDOUR::Session
& getSession() { return *session
; };
92 string
get_selected_header_format() {
93 return header_format_combo
.get_active_text(); };
94 string
get_selected_file_name() { return file_entry
.get_text(); };
98 ARDOUR::Session
* session
;
99 bool track_and_master_selection_allowed
;
100 bool channel_count_selection_allowed
;
101 bool export_cd_markers_allowed
;
103 Gtk::VBox track_vpacker
;
106 Gtk::Table format_table
;
107 Gtk::Frame format_frame
;
109 Gtk::Label cue_file_label
;
110 Gtk::ComboBoxText cue_file_combo
;
112 Gtk::Label channel_count_label
;
113 Gtk::ComboBoxText channel_count_combo
;
115 Gtk::Label header_format_label
;
116 Gtk::ComboBoxText header_format_combo
;
118 Gtk::Label bitdepth_format_label
;
119 Gtk::ComboBoxText bitdepth_format_combo
;
121 Gtk::Label endian_format_label
;
122 Gtk::ComboBoxText endian_format_combo
;
124 Gtk::Label sample_rate_label
;
125 Gtk::ComboBoxText sample_rate_combo
;
127 Gtk::Label src_quality_label
;
128 Gtk::ComboBoxText src_quality_combo
;
130 Gtk::Label dither_type_label
;
131 Gtk::ComboBoxText dither_type_combo
;
133 Gtk::CheckButton cuefile_only_checkbox
;
135 Gtk::Entry file_entry
;
137 Gtk::Button file_browse_button
;
139 Gtk::Button
* ok_button
;
140 Gtk::Button
* cancel_button
;
141 Gtk::Label cancel_label
;
142 Gtk::ProgressBar progress_bar
;
143 Gtk::ScrolledWindow track_scroll
;
144 Gtk::ScrolledWindow master_scroll
;
145 Gtk::Button track_selector_button
;
146 Gtk::TreeView track_selector
;
147 Glib::RefPtr
<Gtk::ListStore
> track_list
;
148 Gtk::TreeView master_selector
;
149 Glib::RefPtr
<Gtk::ListStore
> master_list
;
151 static void *_thread (void *arg
);
152 // sets the export progress in the progress bar
153 virtual gint
progress_timeout ();
154 sigc::connection progress_connection
;
155 void build_window ();
157 void header_chosen ();
158 void channels_chosen ();
159 void bitdepth_chosen ();
160 void sample_rate_chosen ();
161 void cue_file_type_chosen();
164 void write_track_and_master_selection_to_spec();
166 void do_export_cd_markers (const string
& path
, const string
& cuefile_type
);
167 void export_cue_file (ARDOUR::Locations::LocationList
& locations
, const string
& path
);
168 void export_toc_file (ARDOUR::Locations::LocationList
& locations
, const string
& path
);
170 gint
window_closed (GdkEventAny
*ignored
);
171 std::string
get_suffixed_filepath ();
173 void track_selector_button_click ();
181 #endif // __ardour_export_dialog_h__