f974af26a1053414b9e18fddb77780a77832c3f3
[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 <gtk--.h>
24
25 #include <ardour/export.h>
26 #include "ardour_dialog.h"
27 #include <ardour/location.h>
28
29
30 class PublicEditor;
31
32 namespace ARDOUR {
33         class Session;
34         class AudioRegion;
35 }
36
37 class ExportDialog : public ArdourDialog
38 {
39   public:
40         ExportDialog (PublicEditor&, ARDOUR::AudioRegion* r = 0);
41         ~ExportDialog ();
42
43         void connect_to_session (ARDOUR::Session*);
44         void set_range (jack_nframes_t start, jack_nframes_t end);
45         void start_export ();
46
47   private:
48         PublicEditor&    editor;
49         ARDOUR::Session* session;
50         ARDOUR::AudioRegion* audio_region;
51         Gtk::VBox   vpacker;
52         Gtk::VBox   track_vpacker;
53         Gtk::HBox   hpacker;
54         Gtk::HBox   button_box;
55
56         Gtk::Table  format_table;
57         Gtk::Frame  format_frame;
58
59         Gtk::Label  sample_rate_label;
60         Gtk::Combo  sample_rate_combo;
61         Gtk::Label  src_quality_label;
62         Gtk::Combo  src_quality_combo;
63         Gtk::Label  dither_type_label;
64         Gtk::Combo  dither_type_combo;
65         Gtk::Label  cue_file_label;
66         Gtk::Combo  cue_file_combo;
67         Gtk::Label  channel_count_label;
68         Gtk::Combo  channel_count_combo;
69         Gtk::Label  header_format_label;
70         Gtk::Combo  header_format_combo;
71         Gtk::Label  bitdepth_format_label;
72         Gtk::Combo  bitdepth_format_combo;
73         Gtk::Label  endian_format_label;
74         Gtk::Combo  endian_format_combo;
75         Gtk::CheckButton cuefile_only_checkbox;
76
77         Gtk::Frame  file_frame;
78         Gtk::Entry  file_entry;
79         Gtk::HBox   file_hbox;
80         Gtk::Button file_browse_button;
81
82         Gtk::Button ok_button;
83         Gtk::Button cancel_button;
84         Gtk::Label  cancel_label;
85         Gtk::ProgressBar progress_bar;
86         Gtk::ScrolledWindow track_scroll;
87         Gtk::ScrolledWindow master_scroll;
88         Gtk::Button         track_selector_button;
89         Gtk::CList  track_selector;
90         Gtk::CList  master_selector;
91         Gtk::FileSelection *file_selector;
92         ARDOUR::AudioExportSpecification spec;
93
94         static GdkPixmap *check_pixmap;
95         static GdkBitmap *check_mask;
96         static GdkPixmap *empty_pixmap;
97         static GdkBitmap *empty_mask;
98
99         static void *_thread (void *arg);
100         gint progress_timeout ();
101         SigC::Connection progress_connection;
102         void build_window ();
103         void end_dialog();
104         gint header_chosen (GdkEventAny *ignored);
105         gint channels_chosen (GdkEventAny *ignored);
106         gint bitdepth_chosen (GdkEventAny *ignored);
107         gint sample_rate_chosen (GdkEventAny *ignored);
108         gint cue_file_type_chosen(GdkEventAny *ignored);
109         gint track_selector_button_press_event (GdkEventButton *ev);
110         gint master_selector_button_press_event (GdkEventButton *ev);
111
112         void do_export_cd_markers (const string& path, const string& cuefile_type);
113         void export_cue_file (ARDOUR::Locations::LocationList& locations, const string& path);
114         void export_toc_file (ARDOUR::Locations::LocationList& locations, const string& path);
115         void do_export ();
116         gint change_focus_policy (GdkEventAny *, bool);
117         gint window_closed (GdkEventAny *ignored);
118
119         void track_selector_button_click ();
120
121         void initiate_browse ();
122         void finish_browse (int status);
123
124         void set_state();
125         void save_state();
126
127         static void* _export_region_thread (void *);
128         void export_region ();
129 };
130
131 #endif // __ardour_export_dialog_h__
132