Uploaded start of CoreAudioSource. More sfdb work.
[ardour.git] / gtk2_ardour / export_dialog.h
1 /*
2     Copyright (C) 1999-2002 Paul Davis 
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __ardour_export_dialog_h__
21 #define __ardour_export_dialog_h__
22
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>
35
36 #include <ardour/export.h>
37 #include <ardour/location.h>
38
39 #include "ardour_dialog.h"
40
41 class PublicEditor;
42
43 namespace ARDOUR {
44         class Session;
45         class AudioRegion;
46         class Port;
47 }
48
49 class ExportDialog : public ArdourDialog
50 {
51   public:
52         ExportDialog (PublicEditor&, ARDOUR::AudioRegion* r = 0);
53         ~ExportDialog ();
54
55         void connect_to_session (ARDOUR::Session*);
56         void set_range (jack_nframes_t start, jack_nframes_t end);
57         void start_export ();
58
59   protected:
60         struct ExportModelColumns : public Gtk::TreeModel::ColumnRecord
61         {
62         public:
63           Gtk::TreeModelColumn<std::string>     output;
64           Gtk::TreeModelColumn<bool>            left;
65           Gtk::TreeModelColumn<bool>            right;
66           Gtk::TreeModelColumn<ARDOUR::Port*>   port;
67
68           ExportModelColumns() { add(output); add(left); add(right); add(port);}
69         };
70
71         ExportModelColumns exp_cols;
72
73   private:
74         PublicEditor&    editor;
75         ARDOUR::Session* session;
76         ARDOUR::AudioRegion* audio_region;
77         Gtk::VBox   track_vpacker;
78         Gtk::HBox   hpacker;
79
80         Gtk::Table  format_table;
81         Gtk::Frame  format_frame;
82
83         Gtk::Label  cue_file_label;
84         Gtk::ComboBoxText cue_file_combo;
85         
86         Gtk::Label  channel_count_label;
87         Gtk::ComboBoxText channel_count_combo;
88
89         Gtk::Label  header_format_label;
90         Gtk::ComboBoxText header_format_combo;
91
92         Gtk::Label  bitdepth_format_label;
93         Gtk::ComboBoxText bitdepth_format_combo;
94
95         Gtk::Label  endian_format_label;
96         Gtk::ComboBoxText endian_format_combo;
97         
98         Gtk::Label  sample_rate_label;
99         Gtk::ComboBoxText sample_rate_combo;
100
101         Gtk::Label  src_quality_label;
102         Gtk::ComboBoxText src_quality_combo;
103
104         Gtk::Label  dither_type_label;
105         Gtk::ComboBoxText dither_type_combo;
106
107         Gtk::CheckButton cuefile_only_checkbox;
108
109         Gtk::Frame  file_frame;
110         Gtk::Entry  file_entry;
111         Gtk::HBox   file_hbox;
112         Gtk::Button file_browse_button;
113
114         Gtk::Button* ok_button;
115         Gtk::Button* cancel_button;
116         Gtk::Label  cancel_label;
117         Gtk::ProgressBar progress_bar;
118         Gtk::ScrolledWindow track_scroll;
119         Gtk::ScrolledWindow master_scroll;
120         Gtk::Button         track_selector_button;
121         Gtk::TreeView  track_selector;
122         Glib::RefPtr<Gtk::ListStore> track_list;
123         Gtk::TreeView  master_selector;
124         Glib::RefPtr<Gtk::ListStore> master_list;
125         Gtk::FileSelection *file_selector;
126         ARDOUR::AudioExportSpecification spec;
127
128         static void *_thread (void *arg);
129         gint progress_timeout ();
130         sigc::connection progress_connection;
131         void build_window ();
132         void end_dialog();
133         void header_chosen ();
134         void channels_chosen ();
135         void bitdepth_chosen ();
136         void sample_rate_chosen ();
137         void cue_file_type_chosen();
138
139         void fill_lists();
140
141         void do_export_cd_markers (const string& path, const string& cuefile_type);
142         void export_cue_file (ARDOUR::Locations::LocationList& locations, const string& path);
143         void export_toc_file (ARDOUR::Locations::LocationList& locations, const string& path);
144         void do_export ();
145         gint window_closed (GdkEventAny *ignored);
146
147         void track_selector_button_click ();
148
149         void initiate_browse ();
150         void finish_browse (int status);
151
152         void set_state();
153         void save_state();
154
155         static void* _export_region_thread (void *);
156         void export_region ();
157 };
158
159 #endif // __ardour_export_dialog_h__
160