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"
36 #include "timeentry.h"
38 #define BATCHRENDER_COLUMNS 4
43 class BatchRenderMenuItem : public BC_MenuItem
46 BatchRenderMenuItem(MWindow *mwindow);
56 BatchRenderJob(Preferences *preferences);
59 void copy_from(BatchRenderJob *src);
60 void load(FileXML *file);
61 void save(FileXML *file);
64 // Source EDL to render
65 char edl_path[BCTEXTLEN];
66 // Destination file for output
70 // Amount of time elapsed in last render operation
72 Preferences *preferences;
82 class BatchRenderThread : public BC_DialogThread
85 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;
128 int column_width[BATCHRENDER_COLUMNS];
131 // job being rendered
134 ArrayList<BC_ListBoxItem*> *file_entries;
146 class BatchRenderEDLPath : public BC_TextBox
149 BatchRenderEDLPath(BatchRenderThread *thread,
155 BatchRenderThread *thread;
159 class BatchRenderCurrentEDL : public BC_GenericButton
162 BatchRenderCurrentEDL(BatchRenderThread *thread,
166 BatchRenderThread *thread;
170 class BatchRenderUpdateEDL : public BC_GenericButton
173 BatchRenderUpdateEDL(BatchRenderThread *thread,
177 BatchRenderThread *thread;
181 class BatchRenderNew : public BC_GenericButton
184 BatchRenderNew(BatchRenderThread *thread,
188 BatchRenderThread *thread;
191 class BatchRenderDelete : public BC_GenericButton
194 BatchRenderDelete(BatchRenderThread *thread,
198 BatchRenderThread *thread;
201 class BatchRenderList : public BC_ListBox
204 BatchRenderList(BatchRenderThread *thread,
210 int selection_changed();
211 int column_resize_event();
212 int drag_start_event();
213 int drag_motion_event();
214 int drag_stop_event();
216 BatchRenderThread *thread;
218 class BatchRenderStart : public BC_GenericButton
221 BatchRenderStart(BatchRenderThread *thread,
225 BatchRenderThread *thread;
228 class BatchRenderStop : public BC_GenericButton
231 BatchRenderStop(BatchRenderThread *thread,
235 BatchRenderThread *thread;
238 class BatchRenderCancel : public BC_GenericButton
241 BatchRenderCancel(BatchRenderThread *thread,
245 int keypress_event();
246 BatchRenderThread *thread;
250 class BatchFormat : public FormatTools
253 BatchFormat(MWindow *mwindow,
265 class BatchRenderGUI : public BC_Window
268 BatchRenderGUI(MWindow *mwindow,
269 BatchRenderThread *thread,
276 void create_objects();
277 int resize_event(int w, int h);
278 int translation_event();
280 void create_list(int update_widget);
282 void button_enable();
283 void button_disable();
285 ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
288 BatchRenderThread *thread;
289 BC_Title *output_path_title;
290 BatchFormat *format_tools;
291 BrowseButton *edl_path_browse;
292 BatchRenderEDLPath *edl_path_text;
293 BC_Title *edl_path_title;
294 // BC_Title *status_title;
295 // BC_Title *status_text;
296 // BC_ProgressBar *progress_bar;
297 BC_Title *list_title;
298 BatchRenderNew *new_batch;
299 BatchRenderDelete *delete_batch;
300 BatchRenderList *batch_list;
301 BatchRenderStart *start_button;
302 BatchRenderStop *stop_button;
303 BatchRenderCancel *cancel_button;
304 BatchRenderCurrentEDL *use_current_edl;
305 BatchRenderUpdateEDL *update_selected_edl;