Make send automation work (#4734).
[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 <boost/scoped_ptr.hpp>
25 #include <string>
26
27 #include "ardour/export_profile_manager.h"
28
29 #include "public_editor.h"
30 #include "export_timespan_selector.h"
31 #include "export_channel_selector.h"
32 #include "export_file_notebook.h"
33 #include "export_preset_selector.h"
34 #include "ardour_dialog.h"
35
36 #include <gtkmm.h>
37
38 namespace ARDOUR {
39         class ExportStatus;
40         class ExportHandler;
41 }
42
43 class ExportTimespanSelector;
44 class ExportChannelSelector;
45
46 class ExportDialog : public ArdourDialog {
47
48   public:
49
50         ExportDialog (PublicEditor & editor, std::string title, std::string xml_node_name);
51         ~ExportDialog ();
52
53         void set_session (ARDOUR::Session* s);
54
55         /* Responses */
56
57         enum Responses {
58                 RESPONSE_RT,
59                 RESPONSE_FAST,
60                 RESPONSE_CANCEL
61         };
62
63   protected:
64
65         typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
66         typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
67
68         std::string     xml_node_name;
69         HandlerPtr      handler;
70         ManagerPtr      profile_manager;
71
72         // initializes GUI layout
73         virtual void init_gui ();
74
75         // Must initialize all the shared_ptrs below
76         virtual void init_components ();
77
78         // Override if the channel selector should not be grown
79         virtual bool channel_selector_is_expandable() { return true; }
80
81         boost::scoped_ptr<ExportPresetSelector>   preset_selector;
82         boost::scoped_ptr<ExportTimespanSelector> timespan_selector;
83         boost::scoped_ptr<ExportChannelSelector>  channel_selector;
84         boost::scoped_ptr<ExportFileNotebook>     file_notebook;
85
86         Gtk::VBox                                 warning_widget;
87         Gtk::VBox                                 progress_widget;
88
89         Gtk::Label *                              timespan_label;
90         Gtk::Label *                              channels_label;
91
92   private:
93
94         void init ();
95
96         void expanded_changed();
97
98         void notify_errors ();
99         void close_dialog ();
100
101         void sync_with_manager ();
102         void update_warnings_and_example_filename ();
103         void show_conflicting_files ();
104
105         void do_export ();
106
107         void show_progress ();
108         gint progress_timeout ();
109
110         typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr;
111
112         PublicEditor &  editor;
113         StatusPtr       status;
114         PBD::ScopedConnection abort_connection;
115
116         /*** GUI components ***/
117
118         Glib::RefPtr<Gtk::SizeGroup> advanced_sizegroup;
119         Gtk::Expander * advanced;
120
121         /* Warning area */
122
123         Gtk::HBox           warn_hbox;
124         Gtk::Label          warn_label;
125         std::string       warn_string;
126
127         Gtk::HBox           list_files_hbox;
128         Gtk::Label          list_files_label;
129         Gtk::Button         list_files_button;
130         std::string       list_files_string;
131
132         void add_error (std::string const & text);
133         void add_warning (std::string const & text);
134
135         /* Progress bar */
136
137         Gtk::ProgressBar        progress_bar;
138         sigc::connection        progress_connection;
139
140         float previous_progress; // Needed for gtk bug workaround
141
142         /* Buttons */
143
144         Gtk::Button *           cancel_button;
145         Gtk::Button *           export_button;
146
147 };
148
149 class ExportRangeDialog : public ExportDialog
150 {
151   public:
152         ExportRangeDialog (PublicEditor & editor, std::string range_id);
153
154   private:
155         void init_components ();
156
157         std::string range_id;
158 };
159
160 class ExportSelectionDialog : public ExportDialog
161 {
162   public:
163         ExportSelectionDialog (PublicEditor & editor);
164
165   private:
166         void init_components ();
167 };
168
169 class ExportRegionDialog : public ExportDialog
170 {
171   public:
172         ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track);
173
174   protected:
175         virtual bool channel_selector_is_expandable() { return false; }
176
177   private:
178         void init_gui ();
179         void init_components ();
180
181         ARDOUR::AudioRegion const & region;
182         ARDOUR::AudioTrack & track;
183 };
184
185 class StemExportDialog : public ExportDialog
186 {
187   public:
188         StemExportDialog (PublicEditor & editor);
189
190   private:
191         void init_components ();
192 };
193
194 #endif /* __ardour_export_dialog_h__ */