textbox/suggestion fixups, update to lossless, canvas scaling
[goodguy/history.git] / cinelerra-5.1 / cinelerra / batchrender.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef BATCHRENDER_H
23 #define BATCHRENDER_H
24
25 #include "arraylist.h"
26 #include "asset.inc"
27 #include "batchrender.inc"
28 #include "bcbutton.h"
29 #include "bcdialog.h"
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 "render.inc"
37 #include "timeentry.h"
38
39 #define BATCHRENDER_COLUMNS 4
40
41
42
43
44 class BatchRenderMenuItem : public BC_MenuItem
45 {
46 public:
47         BatchRenderMenuItem(MWindow *mwindow);
48         int handle_event();
49         MWindow *mwindow;
50 };
51
52
53
54 class BatchRenderJob
55 {
56 public:
57         BatchRenderJob(Preferences *preferences);
58         ~BatchRenderJob();
59
60         void copy_from(BatchRenderJob *src);
61         void load(FileXML *file);
62         void save(FileXML *file);
63         void fix_strategy();
64
65 // Source EDL to render
66         char edl_path[BCTEXTLEN];
67 // Destination file for output
68         Asset *asset;
69         int strategy;
70         int enabled;
71 // Amount of time elapsed in last render operation
72         double elapsed;
73         Preferences *preferences;
74 };
75
76
77
78
79
80
81
82
83 class BatchRenderThread : public BC_DialogThread
84 {
85 public:
86         BatchRenderThread(MWindow *mwindow);
87         BatchRenderThread();
88         ~BatchRenderThread();
89         void handle_close_event(int result);
90         BC_Window* new_gui();
91
92         int test_edl_files();
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);
104         void new_job();
105         void delete_job();
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);
114 // For GUI usage
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);
122
123         MWindow *mwindow;
124         char batch_path[BCTEXTLEN];
125         double current_start;
126         double current_end;
127         BatchRenderJob *default_job;
128         ArrayList<BatchRenderJob*> jobs;
129         BC_Hash *boot_defaults;
130         Preferences *preferences;
131         Render *render;
132         BatchRenderGUI *gui;
133         int column_width[BATCHRENDER_COLUMNS];
134 // job being edited
135         int current_job;
136 // job being rendered
137         int rendering_job;
138         int is_rendering;
139         int warn;
140 };
141
142
143
144 class BatchRenderEDLPath : public BC_TextBox
145 {
146 public:
147         BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w,
148                 char *text);
149         int handle_event();
150         BatchRenderThread *thread;
151 };
152
153
154 class BatchRenderCurrentEDL : public BC_GenericButton
155 {
156 public:
157         BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y);
158         int handle_event();
159         BatchRenderThread *thread;
160 };
161
162
163 class BatchRenderUpdateEDL : public BC_GenericButton
164 {
165 public:
166         BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y);
167         int handle_event();
168         BatchRenderThread *thread;
169 };
170
171
172 class BatchRenderNew : public BC_GenericButton
173 {
174 public:
175         BatchRenderNew(BatchRenderThread *thread, int x, int y);
176         int handle_event();
177         BatchRenderThread *thread;
178 };
179
180 class BatchRenderDelete : public BC_GenericButton
181 {
182 public:
183         BatchRenderDelete(BatchRenderThread *thread, int x, int y);
184         int handle_event();
185         BatchRenderThread *thread;
186 };
187
188
189
190 class BatchRenderSaveList : public BC_GenericButton, public Thread
191 {
192 public:
193         BatchRenderSaveList(BatchRenderThread *thread, int x, int y);
194         ~BatchRenderSaveList();
195         int handle_event();
196         BatchRenderThread *thread;
197         BC_FileBox *gui;
198         void run();
199         virtual int keypress_event();
200         Mutex *startup_lock;
201 };
202
203 class BatchRenderLoadList : public BC_GenericButton, public Thread
204 {
205 public:
206         BatchRenderLoadList(BatchRenderThread *thread, int x, int y);
207         ~BatchRenderLoadList();
208         int handle_event();
209         BatchRenderThread *thread;
210         BC_FileBox *gui;
211         void run();
212         virtual int keypress_event();
213         Mutex *startup_lock;
214 };
215
216
217
218 class BatchRenderList : public BC_ListBox
219 {
220 public:
221         BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h);
222         int handle_event();
223         int selection_changed();
224         int column_resize_event();
225         int drag_start_event();
226         int drag_motion_event();
227         int drag_stop_event();
228         int dragging_item;
229         BatchRenderThread *thread;
230 };
231 class BatchRenderStart : public BC_GenericButton
232 {
233 public:
234         BatchRenderStart(BatchRenderThread *thread, int x, int y);
235         int handle_event();
236         BatchRenderThread *thread;
237 };
238
239 class BatchRenderStop : public BC_GenericButton
240 {
241 public:
242         BatchRenderStop(BatchRenderThread *thread, int x, int y);
243         int handle_event();
244         BatchRenderThread *thread;
245 };
246
247 class BatchRenderWarning : public BC_CheckBox
248 {
249 public:
250         BatchRenderWarning(BatchRenderThread *thread, int x, int y);
251         int handle_event();
252         BatchRenderThread *thread;
253 };
254
255 class BatchRenderCancel : public BC_GenericButton
256 {
257 public:
258         BatchRenderCancel(BatchRenderThread *thread, int x, int y);
259         int handle_event();
260         int keypress_event();
261         BatchRenderThread *thread;
262 };
263
264
265 class BatchFormat : public FormatTools
266 {
267 public:
268         BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset);
269         ~BatchFormat();
270
271         int handle_event();
272
273         BatchRenderGUI *gui;
274         MWindow *mwindow;
275 };
276
277
278 class BatchRenderGUI : public BC_Window
279 {
280 public:
281         BatchRenderGUI(MWindow *mwindow,
282                 BatchRenderThread *thread,
283                 int x,
284                 int y,
285                 int w,
286                 int h);
287         ~BatchRenderGUI();
288
289         void create_objects();
290         int resize_event(int w, int h);
291         int translation_event();
292         int close_event();
293         void create_list(int update_widget);
294         void change_job();
295         void button_enable();
296         void button_disable();
297
298         ArrayList<BC_ListBoxItem*> list_columns[BATCHRENDER_COLUMNS];
299
300         MWindow *mwindow;
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;
323 };
324
325
326 #endif