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(int warn=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);
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
138 ArrayList<BC_ListBoxItem*> *file_entries;
143 class BatchRenderEDLPath : public BC_TextBox
146 BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w,
149 BatchRenderThread *thread;
153 class BatchRenderCurrentEDL : public BC_GenericButton
156 BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y);
158 BatchRenderThread *thread;
162 class BatchRenderUpdateEDL : public BC_GenericButton
165 BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y);
167 BatchRenderThread *thread;
171 class BatchRenderNew : public BC_GenericButton
174 BatchRenderNew(BatchRenderThread *thread, int x, int y);
176 BatchRenderThread *thread;
179 class BatchRenderDelete : public BC_GenericButton
182 BatchRenderDelete(BatchRenderThread *thread, int x, int y);
184 BatchRenderThread *thread;
189 class BatchRenderSaveList : public BC_GenericButton, public Thread
192 BatchRenderSaveList(BatchRenderThread *thread, int x, int y);
193 ~BatchRenderSaveList();
195 BatchRenderThread *thread;
198 virtual int keypress_event();
202 class BatchRenderLoadList : public BC_GenericButton, public Thread
205 BatchRenderLoadList(BatchRenderThread *thread, int x, int y);
206 ~BatchRenderLoadList();
208 BatchRenderThread *thread;
211 virtual int keypress_event();
217 class BatchRenderList : public BC_ListBox
220 BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h);
222 int selection_changed();
223 int column_resize_event();
224 int drag_start_event();
225 int drag_motion_event();
226 int drag_stop_event();
228 BatchRenderThread *thread;
230 class BatchRenderStart : public BC_GenericButton
233 BatchRenderStart(BatchRenderThread *thread, int x, int y);
235 BatchRenderThread *thread;
238 class BatchRenderStop : public BC_GenericButton
241 BatchRenderStop(BatchRenderThread *thread, int x, int y);
243 BatchRenderThread *thread;
246 class BatchRenderWarning : public BC_CheckBox
249 BatchRenderWarning(BatchRenderThread *thread, int x, int y);
251 BatchRenderThread *thread;
254 class BatchRenderCancel : public BC_GenericButton
257 BatchRenderCancel(BatchRenderThread *thread, int x, int y);
259 int keypress_event();
260 BatchRenderThread *thread;
264 class BatchFormat : public FormatTools
267 BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset);
277 class BatchRenderGUI : public BC_Window
280 BatchRenderGUI(MWindow *mwindow,
281 BatchRenderThread *thread,
288 void create_objects();
289 int resize_event(int w, int h);
290 int translation_event();
292 void create_list(int update_widget);
294 void button_enable();
295 void button_disable();
297 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
300 BatchRenderThread *thread;
301 BC_Title *output_path_title;
302 BatchFormat *format_tools;
303 BrowseButton *edl_path_browse;
304 BatchRenderEDLPath *edl_path_text;
305 BC_Title *edl_path_title;
306 // BC_Title *status_title;
307 // BC_Title *status_text;
308 // BC_ProgressBar *progress_bar;
309 BC_Title *list_title;
310 BatchRenderNew *new_batch;
311 BatchRenderDelete *delete_batch;
312 BatchRenderSaveList *savelist_batch;
313 BatchRenderLoadList *loadlist_batch;
314 BatchRenderWarning *warning;
315 BatchRenderList *batch_list;
316 BatchRenderStart *start_button;
317 BatchRenderStop *stop_button;
318 BatchRenderCancel *cancel_button;
319 BatchRenderCurrentEDL *use_current_edl;
320 BatchRenderUpdateEDL *update_selected_edl;