prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / batchrender.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef BATCHRENDER_H
23 #define BATCHRENDER_H
24
25 #include "arraylist.h"
26 #include "asset.inc"
27 #include "batchrender.inc"
28 #include "bcbutton.h"
29 #include "bcdialog.h"
30 #include "browsebutton.inc"
31 #include "filexml.inc"
32 #include "formattools.h"
33 #include "keyframe.inc"
34 #include "mwindow.inc"
35 #include "preferences.inc"
36 #include "timeentry.h"
37
38 #define BATCHRENDER_COLUMNS 4
39
40
41
42
43 class BatchRenderMenuItem : public BC_MenuItem
44 {
45 public:
46         BatchRenderMenuItem(MWindow *mwindow);
47         int handle_event();
48         MWindow *mwindow;
49 };
50
51
52
53 class BatchRenderJob
54 {
55 public:
56         BatchRenderJob(Preferences *preferences);
57         ~BatchRenderJob();
58
59         void copy_from(BatchRenderJob *src);
60         void load(FileXML *file);
61         void save(FileXML *file);
62         void fix_strategy();
63
64 // Source EDL to render
65         char edl_path[BCTEXTLEN];
66 // Destination file for output
67         Asset *asset;
68         int strategy;
69         int enabled;
70 // Amount of time elapsed in last render operation
71         double elapsed;
72         Preferences *preferences;
73 };
74
75
76
77
78
79
80
81
82 class BatchRenderThread : public BC_DialogThread
83 {
84 public:
85         BatchRenderThread(MWindow *mwindow);
86         BatchRenderThread();
87         ~BatchRenderThread();
88
89         void handle_close_event(int result);
90         BC_Window* new_gui();
91
92         int test_edl_files();
93         void calculate_dest_paths(ArrayList<char*> *paths,
94                 Preferences *preferences);
95
96 // Load batch rendering jobs
97         void load_jobs(char *path, Preferences *preferences);
98 // Not applicable to western civilizations
99         void save_jobs(char *path);
100         void load_defaults(BC_Hash *defaults);
101         void save_defaults(BC_Hash *defaults);
102 // Create path for persistent storage functions
103         char* create_path(char *string);
104         void new_job();
105         void delete_job();
106         void update_selected_edl();
107         void use_current_edl();
108 // Conditionally returns the job or the default job based on current_job
109         BatchRenderJob* get_current_job();
110         Asset* get_current_asset();
111         char* get_current_edl();
112 // For command line usage
113         void start_rendering(char *config_path, char *batch_path);
114 // For GUI usage
115         void start_rendering();
116         void stop_rendering();
117 // Highlight the currently rendering job.
118         void update_active(int number);
119         void update_done(int number, int create_list, double elapsed_time);
120         void move_batch(int src, int dst);
121
122         MWindow *mwindow;
123         double current_start;
124         double current_end;
125         BatchRenderJob *default_job;
126         ArrayList<BatchRenderJob*> jobs;
127         BatchRenderGUI *gui;
128         int column_width[BATCHRENDER_COLUMNS];
129 // job being edited
130         int current_job;
131 // job being rendered
132         int rendering_job;
133         int is_rendering;
134         ArrayList<BC_ListBoxItem*> *file_entries;
135 };
136
137
138
139
140
141
142
143
144
145
146 class BatchRenderEDLPath : public BC_TextBox
147 {
148 public:
149         BatchRenderEDLPath(BatchRenderThread *thread, 
150                 int x, 
151                 int y, 
152                 int w, 
153                 char *text);
154         int handle_event();
155         BatchRenderThread *thread;
156 };
157
158
159 class BatchRenderCurrentEDL : public BC_GenericButton
160 {
161 public:
162         BatchRenderCurrentEDL(BatchRenderThread *thread, 
163                 int x, 
164                 int y);
165         int handle_event();
166         BatchRenderThread *thread;
167 };
168
169
170 class BatchRenderUpdateEDL : public BC_GenericButton
171 {
172 public:
173         BatchRenderUpdateEDL(BatchRenderThread *thread, 
174                 int x, 
175                 int y);
176         int handle_event();
177         BatchRenderThread *thread;
178 };
179
180
181 class BatchRenderNew : public BC_GenericButton
182 {
183 public:
184         BatchRenderNew(BatchRenderThread *thread, 
185                 int x, 
186                 int y);
187         int handle_event();
188         BatchRenderThread *thread;
189 };
190
191 class BatchRenderDelete : public BC_GenericButton
192 {
193 public:
194         BatchRenderDelete(BatchRenderThread *thread, 
195                 int x, 
196                 int y);
197         int handle_event();
198         BatchRenderThread *thread;
199 };
200
201 class BatchRenderList : public BC_ListBox
202 {
203 public:
204         BatchRenderList(BatchRenderThread *thread, 
205                 int x, 
206                 int y,
207                 int w,
208                 int h);
209         int handle_event();
210         int selection_changed();
211         int column_resize_event();
212         int drag_start_event();
213         int drag_motion_event();
214         int drag_stop_event();
215         int dragging_item;
216         BatchRenderThread *thread;
217 };
218 class BatchRenderStart : public BC_GenericButton
219 {
220 public:
221         BatchRenderStart(BatchRenderThread *thread, 
222                 int x, 
223                 int y);
224         int handle_event();
225         BatchRenderThread *thread;
226 };
227
228 class BatchRenderStop : public BC_GenericButton
229 {
230 public:
231         BatchRenderStop(BatchRenderThread *thread, 
232                 int x, 
233                 int y);
234         int handle_event();
235         BatchRenderThread *thread;
236 };
237
238 class BatchRenderCancel : public BC_GenericButton
239 {
240 public:
241         BatchRenderCancel(BatchRenderThread *thread, 
242                 int x, 
243                 int y);
244         int handle_event();
245         int keypress_event();
246         BatchRenderThread *thread;
247 };
248
249
250 class BatchFormat : public FormatTools
251 {
252 public:
253         BatchFormat(MWindow *mwindow,
254                                 BatchRenderGUI *gui,
255                                 Asset *asset);
256         ~BatchFormat();
257
258         int handle_event();
259
260         BatchRenderGUI *gui;
261         MWindow *mwindow;
262 };
263
264
265 class BatchRenderGUI : public BC_Window
266 {
267 public:
268         BatchRenderGUI(MWindow *mwindow, 
269                 BatchRenderThread *thread,
270                 int x,
271                 int y,
272                 int w,
273                 int h);
274         ~BatchRenderGUI();
275
276         void create_objects();
277         int resize_event(int w, int h);
278         int translation_event();
279         int close_event();
280         void create_list(int update_widget);
281         void change_job();
282         void button_enable();
283         void button_disable();
284
285         ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
286
287         MWindow *mwindow;
288         BatchRenderThread *thread;
289         BC_Title *output_path_title;
290         BatchFormat *format_tools;
291         BrowseButton *edl_path_browse;
292         BatchRenderEDLPath *edl_path_text;
293         BC_Title *edl_path_title;
294 //      BC_Title *status_title;
295 //      BC_Title *status_text;
296 //      BC_ProgressBar *progress_bar;
297         BC_Title *list_title;
298         BatchRenderNew *new_batch;
299         BatchRenderDelete *delete_batch;
300         BatchRenderList *batch_list;
301         BatchRenderStart *start_button;
302         BatchRenderStop *stop_button;
303         BatchRenderCancel *cancel_button;
304         BatchRenderCurrentEDL *use_current_edl;
305         BatchRenderUpdateEDL *update_selected_edl;
306 };
307
308
309 #endif