Optimize automation-event process splitting
[ardour.git] / gtk2_ardour / export_dialog.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __export_dialog_h__
22 #define __export_dialog_h__
23
24 #include <string>
25 #include <boost/scoped_ptr.hpp>
26
27 #include <gtkmm/box.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/notebook.h>
31 #include <gtkmm/progressbar.h>
32
33 #include "ardour/export_profile_manager.h"
34
35 #include "public_editor.h"
36 #include "export_timespan_selector.h"
37 #include "export_channel_selector.h"
38 #include "export_file_notebook.h"
39 #include "export_preset_selector.h"
40 #include "ardour_dialog.h"
41 #include "soundcloud_export_selector.h"
42
43 namespace ARDOUR {
44         class ExportStatus;
45         class ExportHandler;
46 }
47
48 class ExportTimespanSelector;
49 class ExportChannelSelector;
50
51 class ExportDialog : public ArdourDialog, public PBD::ScopedConnectionList
52 {
53 public:
54
55         ExportDialog (PublicEditor & editor, std::string title, ARDOUR::ExportProfileManager::ExportType type);
56         ~ExportDialog ();
57
58         void set_session (ARDOUR::Session* s);
59
60         /* Responses */
61
62         enum Responses {
63                 RESPONSE_RT,
64                 RESPONSE_FAST,
65                 RESPONSE_CANCEL
66         };
67
68 protected:
69
70         void on_response (int response_id) {
71                 Gtk::Dialog::on_response (response_id);
72         }
73
74         typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
75         typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
76
77         ARDOUR::ExportProfileManager::ExportType type;
78         HandlerPtr      handler;
79         ManagerPtr      profile_manager;
80
81         // initializes GUI layout
82         virtual void init_gui ();
83
84         // Must initialize all the shared_ptrs below
85         virtual void init_components ();
86
87         boost::scoped_ptr<ExportPresetSelector>   preset_selector;
88         boost::scoped_ptr<ExportTimespanSelector> timespan_selector;
89         boost::scoped_ptr<ExportChannelSelector>  channel_selector;
90         boost::scoped_ptr<ExportFileNotebook>     file_notebook;
91
92         boost::shared_ptr<SoundcloudExportSelector> soundcloud_selector;
93
94         Gtk::VBox                                 warning_widget;
95         Gtk::VBox                                 progress_widget;
96
97         /*** GUI components ***/
98         Gtk::Notebook export_notebook;
99
100 private:
101
102         void init ();
103
104         void notify_errors (bool force = false);
105         void close_dialog ();
106
107         void sync_with_manager ();
108         void update_warnings_and_example_filename ();
109         void show_conflicting_files ();
110
111         void do_export ();
112
113         void update_realtime_selection ();
114         void parameter_changed (std::string const&);
115
116         void show_progress ();
117         gint progress_timeout ();
118
119         typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr;
120
121         PublicEditor &  editor;
122         StatusPtr       status;
123
124
125
126         /* Warning area */
127
128         Gtk::HBox           warn_hbox;
129         Gtk::Label          warn_label;
130         std::string         warn_string;
131
132         Gtk::HBox           list_files_hbox;
133         Gtk::Label          list_files_label;
134         Gtk::Button         list_files_button;
135         std::string         list_files_string;
136
137         void add_error (std::string const & text);
138         void add_warning (std::string const & text);
139
140         /* Progress bar */
141
142         Gtk::ProgressBar        progress_bar;
143         sigc::connection        progress_connection;
144
145         float previous_progress; // Needed for gtk bug workaround
146
147         void soundcloud_upload_progress(double total, double now, std::string title);
148
149         /* Buttons */
150
151         Gtk::Button *           cancel_button;
152         Gtk::Button *           export_button;
153
154 };
155
156 class ExportRangeDialog : public ExportDialog
157 {
158   public:
159         ExportRangeDialog (PublicEditor & editor, std::string range_id);
160
161   private:
162         void init_components ();
163
164         std::string range_id;
165 };
166
167 class ExportSelectionDialog : public ExportDialog
168 {
169   public:
170         ExportSelectionDialog (PublicEditor & editor);
171
172   private:
173         void init_components ();
174 };
175
176 class ExportRegionDialog : public ExportDialog
177 {
178   public:
179         ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track);
180
181   private:
182         void init_gui ();
183         void init_components ();
184
185         ARDOUR::AudioRegion const & region;
186         ARDOUR::AudioTrack & track;
187 };
188
189 class StemExportDialog : public ExportDialog
190 {
191   public:
192         StemExportDialog (PublicEditor & editor);
193
194   private:
195         void init_components ();
196 };
197
198 #endif /* __ardour_export_dialog_h__ */