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