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);
95 void reset(const char *path=0);
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=0);
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);
121 static void trap_hook(FILE *fp, void *vp);
124 char batch_path[BCTEXTLEN];
125 double current_start;
127 BatchRenderJob *default_job;
128 ArrayList<BatchRenderJob*> jobs;
129 BC_Hash *boot_defaults;
130 Preferences *preferences;
133 int column_width[BATCHRENDER_COLUMNS];
136 // job being rendered
144 class BatchRenderEDLPath : public BC_TextBox
147 BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w,
150 BatchRenderThread *thread;
154 class BatchRenderCurrentEDL : public BC_GenericButton
157 BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y);
159 BatchRenderThread *thread;
163 class BatchRenderUpdateEDL : public BC_GenericButton
166 BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y);
168 BatchRenderThread *thread;
172 class BatchRenderNew : public BC_GenericButton
175 BatchRenderNew(BatchRenderThread *thread, int x, int y);
177 BatchRenderThread *thread;
180 class BatchRenderDelete : public BC_GenericButton
183 BatchRenderDelete(BatchRenderThread *thread, int x, int y);
185 BatchRenderThread *thread;
190 class BatchRenderSaveList : public BC_GenericButton, public Thread
193 BatchRenderSaveList(BatchRenderThread *thread, int x, int y);
194 ~BatchRenderSaveList();
196 BatchRenderThread *thread;
199 virtual int keypress_event();
203 class BatchRenderLoadList : public BC_GenericButton, public Thread
206 BatchRenderLoadList(BatchRenderThread *thread, int x, int y);
207 ~BatchRenderLoadList();
209 BatchRenderThread *thread;
212 virtual int keypress_event();
218 class BatchRenderList : public BC_ListBox
221 BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h);
223 int selection_changed();
224 int column_resize_event();
225 int drag_start_event();
226 int drag_motion_event();
227 int drag_stop_event();
229 BatchRenderThread *thread;
231 class BatchRenderStart : public BC_GenericButton
234 BatchRenderStart(BatchRenderThread *thread, int x, int y);
236 BatchRenderThread *thread;
239 class BatchRenderStop : public BC_GenericButton
242 BatchRenderStop(BatchRenderThread *thread, int x, int y);
244 BatchRenderThread *thread;
247 class BatchRenderWarning : public BC_CheckBox
250 BatchRenderWarning(BatchRenderThread *thread, int x, int y);
252 BatchRenderThread *thread;
255 class BatchRenderCancel : public BC_GenericButton
258 BatchRenderCancel(BatchRenderThread *thread, int x, int y);
260 int keypress_event();
261 BatchRenderThread *thread;
265 class BatchFormat : public FormatTools
268 BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset);
278 class BatchRenderGUI : public BC_Window
281 BatchRenderGUI(MWindow *mwindow,
282 BatchRenderThread *thread,
289 void create_objects();
290 int resize_event(int w, int h);
291 int translation_event();
293 void create_list(int update_widget);
295 void button_enable();
296 void button_disable();
298 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
301 BatchRenderThread *thread;
302 BC_Title *output_path_title;
303 BatchFormat *format_tools;
304 BrowseButton *edl_path_browse;
305 BatchRenderEDLPath *edl_path_text;
306 BC_Title *edl_path_title;
307 // BC_Title *status_title;
308 // BC_Title *status_text;
309 // BC_ProgressBar *progress_bar;
310 BC_Title *list_title;
311 BC_Title *batch_path;
312 BatchRenderNew *new_batch;
313 BatchRenderDelete *delete_batch;
314 BatchRenderSaveList *savelist_batch;
315 BatchRenderLoadList *loadlist_batch;
316 BatchRenderWarning *warning;
317 BatchRenderList *batch_list;
318 BatchRenderStart *start_button;
319 BatchRenderStop *stop_button;
320 BatchRenderCancel *cancel_button;
321 BatchRenderCurrentEDL *use_current_edl;
322 BatchRenderUpdateEDL *update_selected_edl;