4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
25 #include "arraylist.h"
27 #include "batchrender.inc"
30 #include "browsebutton.inc"
31 #include "filexml.inc"
32 #include "formattools.h"
33 #include "keyframe.inc"
34 #include "mwindow.inc"
35 #include "preferences.inc"
37 #include "timeentry.h"
39 #define BATCHRENDER_COLUMNS 4
44 class BatchRenderMenuItem : public BC_MenuItem
47 BatchRenderMenuItem(MWindow *mwindow);
57 BatchRenderJob(Preferences *preferences);
60 void copy_from(BatchRenderJob *src);
61 void load(FileXML *file);
62 void save(FileXML *file);
65 // Source EDL to render
66 char edl_path[BCTEXTLEN];
67 // Destination file for output
71 // Amount of time elapsed in last render operation
73 Preferences *preferences;
83 class BatchRenderThread : public BC_DialogThread
86 BatchRenderThread(MWindow *mwindow);
89 void handle_close_event(int result);
93 void calculate_dest_paths(ArrayList<char*> *paths,
94 Preferences *preferences);
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);
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);
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);
123 double current_start;
125 BatchRenderJob *default_job;
126 ArrayList<BatchRenderJob*> jobs;
127 BC_Hash *boot_defaults;
128 Preferences *preferences;
131 int column_width[BATCHRENDER_COLUMNS];
134 // job being rendered
137 ArrayList<BC_ListBoxItem*> *file_entries;
149 class BatchRenderEDLPath : public BC_TextBox
152 BatchRenderEDLPath(BatchRenderThread *thread,
158 BatchRenderThread *thread;
162 class BatchRenderCurrentEDL : public BC_GenericButton
165 BatchRenderCurrentEDL(BatchRenderThread *thread,
169 BatchRenderThread *thread;
173 class BatchRenderUpdateEDL : public BC_GenericButton
176 BatchRenderUpdateEDL(BatchRenderThread *thread,
180 BatchRenderThread *thread;
184 class BatchRenderNew : public BC_GenericButton
187 BatchRenderNew(BatchRenderThread *thread,
191 BatchRenderThread *thread;
194 class BatchRenderDelete : public BC_GenericButton
197 BatchRenderDelete(BatchRenderThread *thread,
201 BatchRenderThread *thread;
206 class BatchRenderSaveList : public BC_GenericButton, public Thread
209 BatchRenderSaveList(BatchRenderThread *thread,
212 ~BatchRenderSaveList();
214 BatchRenderThread *thread;
217 virtual int keypress_event();
221 class BatchRenderLoadList : public BC_GenericButton, public Thread
224 BatchRenderLoadList(BatchRenderThread *thread,
227 ~BatchRenderLoadList();
229 BatchRenderThread *thread;
232 virtual int keypress_event();
238 class BatchRenderList : public BC_ListBox
241 BatchRenderList(BatchRenderThread *thread,
247 int selection_changed();
248 int column_resize_event();
249 int drag_start_event();
250 int drag_motion_event();
251 int drag_stop_event();
253 BatchRenderThread *thread;
255 class BatchRenderStart : public BC_GenericButton
258 BatchRenderStart(BatchRenderThread *thread,
262 BatchRenderThread *thread;
265 class BatchRenderStop : public BC_GenericButton
268 BatchRenderStop(BatchRenderThread *thread,
272 BatchRenderThread *thread;
275 class BatchRenderCancel : public BC_GenericButton
278 BatchRenderCancel(BatchRenderThread *thread,
282 int keypress_event();
283 BatchRenderThread *thread;
287 class BatchFormat : public FormatTools
290 BatchFormat(MWindow *mwindow,
302 class BatchRenderGUI : public BC_Window
305 BatchRenderGUI(MWindow *mwindow,
306 BatchRenderThread *thread,
313 void create_objects();
314 int resize_event(int w, int h);
315 int translation_event();
317 void create_list(int update_widget);
319 void button_enable();
320 void button_disable();
322 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
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;