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, int strategy=-1);
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
72 // Amount of time elapsed in last render operation
74 Preferences *preferences;
84 class BatchRenderThread : public BC_DialogThread
87 BatchRenderThread(MWindow *mwindow);
90 void handle_close_event(int result);
94 void calculate_dest_paths(ArrayList<char*> *paths,
95 Preferences *preferences);
96 void reset(const char *path=0);
97 // Load batch rendering jobs
98 void load_jobs(char *path, Preferences *preferences);
99 // Not applicable to western civilizations
100 void save_jobs(char *path=0);
101 void load_defaults(BC_Hash *defaults);
102 void save_defaults(BC_Hash *defaults);
103 // Create path for persistent storage functions
104 char* create_path(char *string);
107 void update_selected_edl();
108 void use_current_edl();
109 // Conditionally returns the job or the default job based on current_job
110 BatchRenderJob* get_current_job();
111 Asset* get_current_asset();
112 char* get_current_edl();
113 // For command line usage
114 void start_rendering(char *config_path, char *batch_path);
116 void start_rendering();
117 void stop_rendering();
118 // Highlight the currently rendering job.
119 void update_active(int number);
120 void update_done(int number, int create_list, double elapsed_time);
121 void move_batch(int src, int dst);
122 static void trap_hook(FILE *fp, void *vp);
125 char batch_path[BCTEXTLEN];
126 double current_start;
128 BatchRenderJob *default_job;
129 ArrayList<BatchRenderJob*> jobs;
130 BC_Hash *boot_defaults;
131 Preferences *preferences;
134 int column_width[BATCHRENDER_COLUMNS];
137 // job being rendered
145 class BatchRenderEDLPath : public BC_TextBox
148 BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w,
151 BatchRenderThread *thread;
155 class BatchRenderCurrentEDL : public BC_GenericButton
158 BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y);
160 BatchRenderThread *thread;
164 class BatchRenderUpdateEDL : public BC_GenericButton
167 BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y);
169 BatchRenderThread *thread;
173 class BatchRenderNew : public BC_GenericButton
176 BatchRenderNew(BatchRenderThread *thread, int x, int y);
178 BatchRenderThread *thread;
181 class BatchRenderDelete : public BC_GenericButton
184 BatchRenderDelete(BatchRenderThread *thread, int x, int y);
186 BatchRenderThread *thread;
191 class BatchRenderSaveList : public BC_GenericButton, public Thread
194 BatchRenderSaveList(BatchRenderThread *thread, int x, int y);
195 ~BatchRenderSaveList();
197 BatchRenderThread *thread;
200 virtual int keypress_event();
204 class BatchRenderLoadList : public BC_GenericButton, public Thread
207 BatchRenderLoadList(BatchRenderThread *thread, int x, int y);
208 ~BatchRenderLoadList();
210 BatchRenderThread *thread;
213 virtual int keypress_event();
219 class BatchRenderList : public BC_ListBox
222 BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h);
224 int selection_changed();
225 int column_resize_event();
226 int drag_start_event();
227 int drag_motion_event();
228 int drag_stop_event();
230 BatchRenderThread *thread;
232 class BatchRenderStart : public BC_GenericButton
235 BatchRenderStart(BatchRenderThread *thread, int x, int y);
237 BatchRenderThread *thread;
240 class BatchRenderStop : public BC_GenericButton
243 BatchRenderStop(BatchRenderThread *thread, int x, int y);
245 BatchRenderThread *thread;
248 class BatchRenderWarning : public BC_CheckBox
251 BatchRenderWarning(BatchRenderThread *thread, int x, int y);
253 BatchRenderThread *thread;
256 class BatchRenderCancel : public BC_GenericButton
259 BatchRenderCancel(BatchRenderThread *thread, int x, int y);
261 int keypress_event();
262 BatchRenderThread *thread;
266 class BatchFormat : public FormatTools
269 BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset);
279 class BatchRenderGUI : public BC_Window
282 BatchRenderGUI(MWindow *mwindow,
283 BatchRenderThread *thread,
290 void create_objects();
291 int resize_event(int w, int h);
292 int translation_event();
294 void create_list(int update_widget);
296 void button_enable();
297 void button_disable();
299 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
302 BatchRenderThread *thread;
303 BC_Title *output_path_title;
304 BatchFormat *format_tools;
305 BrowseButton *edl_path_browse;
306 BatchRenderEDLPath *edl_path_text;
307 BC_Title *edl_path_title;
308 // BC_Title *status_title;
309 // BC_Title *status_text;
310 // BC_ProgressBar *progress_bar;
311 BC_Title *list_title;
312 BC_Title *batch_path;
313 BatchRenderNew *new_batch;
314 BatchRenderDelete *delete_batch;
315 BatchRenderSaveList *savelist_batch;
316 BatchRenderLoadList *loadlist_batch;
317 BatchRenderWarning *warning;
318 BatchRenderList *batch_list;
319 BatchRenderStart *start_button;
320 BatchRenderStop *stop_button;
321 BatchRenderCancel *cancel_button;
322 BatchRenderCurrentEDL *use_current_edl;
323 BatchRenderUpdateEDL *update_selected_edl;