use new syntax for connecting to backend signals that enforces explicit connection...
[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/shared_ptr.hpp>
25
26 #include "ardour/export_profile_manager.h"
27
28 #include "public_editor.h"
29 #include "export_timespan_selector.h"
30 #include "export_channel_selector.h"
31 #include "export_file_notebook.h"
32 #include "export_preset_selector.h"
33 #include "ardour_dialog.h"
34
35 #include <gtkmm.h>
36
37 #include "i18n.h"
38
39 namespace ARDOUR {
40         class ExportStatus;
41         class ExportHandler;
42 }
43
44 class ExportTimespanSelector;
45 class ExportChannelSelector;
46
47 class ExportDialog : public ArdourDialog {
48
49   public:
50
51         explicit ExportDialog (PublicEditor & editor, Glib::ustring title = _("Export"));
52         ~ExportDialog ();
53
54         void set_session (ARDOUR::Session* s);
55
56         /* Responses */
57
58         enum Responses {
59                 RESPONSE_RT,
60                 RESPONSE_FAST,
61                 RESPONSE_CANCEL
62         };
63
64   protected:
65
66         typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
67         typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
68
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         boost::shared_ptr<ExportPresetSelector>   preset_selector;
79         boost::shared_ptr<ExportTimespanSelector> timespan_selector;
80         boost::shared_ptr<ExportChannelSelector>  channel_selector;
81         boost::shared_ptr<ExportFileNotebook>     file_notebook;
82
83         Gtk::VBox                                 warning_widget;
84         Gtk::VBox                                 progress_widget;
85
86         Gtk::Label *                              timespan_label;
87         Gtk::Label *                              channels_label;
88
89   private:
90
91         void init ();
92
93         void notify_errors ();
94         void close_dialog ();
95
96         void sync_with_manager ();
97         void update_warnings ();
98         void show_conflicting_files ();
99
100         void export_rt ();
101         void export_fw ();
102
103         void show_progress ();
104         gint progress_timeout ();
105
106         typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr;
107
108         PublicEditor &  editor;
109         StatusPtr       status;
110         PBD::ScopedConnection abort_connection;
111
112         /*** GUI components ***/
113
114         /* Warning area */
115
116         Gtk::HBox           warn_hbox;
117         Gtk::Label          warn_label;
118         Glib::ustring       warn_string;
119
120         Gtk::HBox           list_files_hbox;
121         Gtk::Label          list_files_label;
122         Gtk::Button         list_files_button;
123         Glib::ustring       list_files_string;
124
125         void add_error (Glib::ustring const & text);
126         void add_warning (Glib::ustring const & text);
127
128         /* Progress bar */
129
130         Gtk::Label              progress_label;
131         Gtk::ProgressBar        progress_bar;
132         sigc::connection        progress_connection;
133
134         /* Buttons */
135
136         Gtk::Button *           cancel_button;
137         Gtk::Button *           rt_export_button;
138         Gtk::Button *           fast_export_button;
139
140 };
141
142 class ExportRangeDialog : public ExportDialog
143 {
144   public:
145         ExportRangeDialog (PublicEditor & editor, Glib::ustring range_id);
146
147   private:
148         void init_components ();
149
150         Glib::ustring range_id;
151 };
152
153 class ExportSelectionDialog : public ExportDialog
154 {
155   public:
156         ExportSelectionDialog (PublicEditor & editor);
157
158   private:
159         void init_components ();
160 };
161
162 class ExportRegionDialog : public ExportDialog
163 {
164         public:
165         ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track);
166
167   private:
168         void init_gui ();
169         void init_components ();
170
171         ARDOUR::AudioRegion const & region;
172         ARDOUR::AudioTrack & track;
173 };
174
175 #endif /* __ardour_export_dialog_h__ */