added keyframe reticle, fixes: DEL, transition at endtrk, DVD/BD render menu
[goodguy/history.git] / cinelerra-5.1 / 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 "render.inc"
37 #include "timeentry.h"
38
39 #define BATCHRENDER_COLUMNS 4
40
41
42
43
44 class BatchRenderMenuItem : public BC_MenuItem
45 {
46 public:
47         BatchRenderMenuItem(MWindow *mwindow);
48         int handle_event();
49         MWindow *mwindow;
50 };
51
52
53
54 class BatchRenderJob
55 {
56 public:
57         BatchRenderJob(Preferences *preferences);
58         ~BatchRenderJob();
59
60         void copy_from(BatchRenderJob *src);
61         void load(FileXML *file);
62         void save(FileXML *file);
63         void fix_strategy();
64
65 // Source EDL to render
66         char edl_path[BCTEXTLEN];
67 // Destination file for output
68         Asset *asset;
69         int strategy;
70         int enabled;
71 // Amount of time elapsed in last render operation
72         double elapsed;
73         Preferences *preferences;
74 };
75
76
77
78
79
80
81
82
83 class BatchRenderThread : public BC_DialogThread
84 {
85 public:
86         BatchRenderThread(MWindow *mwindow);
87         BatchRenderThread();
88         ~BatchRenderThread();
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         void reset();
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         BC_Hash *boot_defaults;
128         Preferences *preferences;
129         Render *render;
130         BatchRenderGUI *gui;
131         int column_width[BATCHRENDER_COLUMNS];
132 // job being edited
133         int current_job;
134 // job being rendered
135         int rendering_job;
136         int is_rendering;
137         ArrayList<BC_ListBoxItem*> *file_entries;
138 };
139
140
141
142
143
144
145
146
147
148
149 class BatchRenderEDLPath : public BC_TextBox
150 {
151 public:
152         BatchRenderEDLPath(BatchRenderThread *thread,
153                 int x,
154                 int y,
155                 int w,
156                 char *text);
157         int handle_event();
158         BatchRenderThread *thread;
159 };
160
161
162 class BatchRenderCurrentEDL : public BC_GenericButton
163 {
164 public:
165         BatchRenderCurrentEDL(BatchRenderThread *thread,
166                 int x,
167                 int y);
168         int handle_event();
169         BatchRenderThread *thread;
170 };
171
172
173 class BatchRenderUpdateEDL : public BC_GenericButton
174 {
175 public:
176         BatchRenderUpdateEDL(BatchRenderThread *thread,
177                 int x,
178                 int y);
179         int handle_event();
180         BatchRenderThread *thread;
181 };
182
183
184 class BatchRenderNew : public BC_GenericButton
185 {
186 public:
187         BatchRenderNew(BatchRenderThread *thread,
188                 int x,
189                 int y);
190         int handle_event();
191         BatchRenderThread *thread;
192 };
193
194 class BatchRenderDelete : public BC_GenericButton
195 {
196 public:
197         BatchRenderDelete(BatchRenderThread *thread,
198                 int x,
199                 int y);
200         int handle_event();
201         BatchRenderThread *thread;
202 };
203
204
205
206 class BatchRenderSaveList : public BC_GenericButton, public Thread
207 {
208 public:
209         BatchRenderSaveList(BatchRenderThread *thread,
210                             int x,
211                             int y);
212         ~BatchRenderSaveList();
213         int handle_event();
214         BatchRenderThread *thread;
215         BC_FileBox *gui;
216         void run();
217         virtual int keypress_event();
218         Mutex *startup_lock;
219 };
220
221 class BatchRenderLoadList : public BC_GenericButton, public Thread
222 {
223 public:
224         BatchRenderLoadList(BatchRenderThread *thread,
225                             int x,
226                             int y);
227         ~BatchRenderLoadList();
228         int handle_event();
229         BatchRenderThread *thread;
230         BC_FileBox *gui;
231         void run();
232         virtual int keypress_event();
233         Mutex *startup_lock;
234 };
235
236
237
238 class BatchRenderList : public BC_ListBox
239 {
240 public:
241         BatchRenderList(BatchRenderThread *thread,
242                 int x,
243                 int y,
244                 int w,
245                 int h);
246         int handle_event();
247         int selection_changed();
248         int column_resize_event();
249         int drag_start_event();
250         int drag_motion_event();
251         int drag_stop_event();
252         int dragging_item;
253         BatchRenderThread *thread;
254 };
255 class BatchRenderStart : public BC_GenericButton
256 {
257 public:
258         BatchRenderStart(BatchRenderThread *thread,
259                 int x,
260                 int y);
261         int handle_event();
262         BatchRenderThread *thread;
263 };
264
265 class BatchRenderStop : public BC_GenericButton
266 {
267 public:
268         BatchRenderStop(BatchRenderThread *thread,
269                 int x,
270                 int y);
271         int handle_event();
272         BatchRenderThread *thread;
273 };
274
275 class BatchRenderCancel : public BC_GenericButton
276 {
277 public:
278         BatchRenderCancel(BatchRenderThread *thread,
279                 int x,
280                 int y);
281         int handle_event();
282         int keypress_event();
283         BatchRenderThread *thread;
284 };
285
286
287 class BatchFormat : public FormatTools
288 {
289 public:
290         BatchFormat(MWindow *mwindow,
291                                 BatchRenderGUI *gui,
292                                 Asset *asset);
293         ~BatchFormat();
294
295         int handle_event();
296
297         BatchRenderGUI *gui;
298         MWindow *mwindow;
299 };
300
301
302 class BatchRenderGUI : public BC_Window
303 {
304 public:
305         BatchRenderGUI(MWindow *mwindow,
306                 BatchRenderThread *thread,
307                 int x,
308                 int y,
309                 int w,
310                 int h);
311         ~BatchRenderGUI();
312
313         void create_objects();
314         int resize_event(int w, int h);
315         int translation_event();
316         int close_event();
317         void create_list(int update_widget);
318         void change_job();
319         void button_enable();
320         void button_disable();
321
322         ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
323
324         MWindow *mwindow;
325         BatchRenderThread *thread;
326         BC_Title *output_path_title;
327         BatchFormat *format_tools;
328         BrowseButton *edl_path_browse;
329         BatchRenderEDLPath *edl_path_text;
330         BC_Title *edl_path_title;
331 //      BC_Title *status_title;
332 //      BC_Title *status_text;
333 //      BC_ProgressBar *progress_bar;
334         BC_Title *list_title;
335         BatchRenderNew *new_batch;
336         BatchRenderDelete *delete_batch;
337         BatchRenderSaveList *savelist_batch;
338         BatchRenderLoadList *loadlist_batch;
339         BatchRenderList *batch_list;
340         BatchRenderStart *start_button;
341         BatchRenderStop *stop_button;
342         BatchRenderCancel *cancel_button;
343         BatchRenderCurrentEDL *use_current_edl;
344         BatchRenderUpdateEDL *update_selected_edl;
345 };
346
347
348 #endif