Save / restore settings from the editor region list context menu.
[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         explicit ExportDialog (PublicEditor & editor, std::string title);
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         HandlerPtr      handler;
69         ManagerPtr      profile_manager;
70
71         // initializes GUI layout
72         virtual void init_gui ();
73
74         // Must initialize all the shared_ptrs below
75         virtual void init_components ();
76
77         boost::scoped_ptr<ExportPresetSelector>   preset_selector;
78         boost::scoped_ptr<ExportTimespanSelector> timespan_selector;
79         boost::scoped_ptr<ExportChannelSelector>  channel_selector;
80         boost::scoped_ptr<ExportFileNotebook>     file_notebook;
81
82         Gtk::VBox                                 warning_widget;
83         Gtk::VBox                                 progress_widget;
84
85         Gtk::Label *                              timespan_label;
86         Gtk::Label *                              channels_label;
87
88   private:
89
90         void init ();
91
92         void notify_errors ();
93         void close_dialog ();
94
95         void sync_with_manager ();
96         void update_warnings ();
97         void show_conflicting_files ();
98
99         void export_rt ();
100         void export_fw ();
101
102         void show_progress ();
103         gint progress_timeout ();
104
105         typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr;
106
107         PublicEditor &  editor;
108         StatusPtr       status;
109         PBD::ScopedConnection abort_connection;
110
111         /*** GUI components ***/
112
113         /* Warning area */
114
115         Gtk::HBox           warn_hbox;
116         Gtk::Label          warn_label;
117         std::string       warn_string;
118
119         Gtk::HBox           list_files_hbox;
120         Gtk::Label          list_files_label;
121         Gtk::Button         list_files_button;
122         std::string       list_files_string;
123
124         void add_error (std::string const & text);
125         void add_warning (std::string const & text);
126
127         /* Progress bar */
128
129         Gtk::Label              progress_label;
130         Gtk::ProgressBar        progress_bar;
131         sigc::connection        progress_connection;
132
133         /* Buttons */
134
135         Gtk::Button *           cancel_button;
136         Gtk::Button *           rt_export_button;
137         Gtk::Button *           fast_export_button;
138
139 };
140
141 class ExportRangeDialog : public ExportDialog
142 {
143   public:
144         ExportRangeDialog (PublicEditor & editor, std::string range_id);
145
146   private:
147         void init_components ();
148         
149         std::string range_id;
150 };
151
152 class ExportSelectionDialog : public ExportDialog
153 {
154   public:
155         ExportSelectionDialog (PublicEditor & editor);
156
157   private:
158         void init_components ();
159 };
160
161 class ExportRegionDialog : public ExportDialog
162 {
163         public:
164         ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track);
165
166   private:
167         void init_gui ();
168         void init_components ();
169
170         ARDOUR::AudioRegion const & region;
171         ARDOUR::AudioTrack & track;
172 };
173
174 #endif /* __ardour_export_dialog_h__ */