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