4 * Copyright (C) 2011 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
23 #include "batchrender.h"
24 #include "bcdisplayinfo.h"
25 #include "bcsignals.h"
26 #include "confirmsave.h"
32 #include "edlsession.h"
34 #include "filesystem.h"
40 #include "mainerror.h"
42 #include "mainsession.h"
45 #include "mwindowgui.h"
46 #include "packagedispatcher.h"
47 #include "packagerenderer.h"
49 #include "pluginset.h"
50 #include "preferences.h"
54 #include "transportque.h"
58 static const char *list_titles[] =
66 static int list_widths[] =
74 BatchRenderMenuItem::BatchRenderMenuItem(MWindow *mwindow)
75 : BC_MenuItem(_("Batch Render..."), _("Shift-B"), 'B')
78 this->mwindow = mwindow;
81 int BatchRenderMenuItem::handle_event()
83 mwindow->batch_render->start();
94 BatchRenderJob::BatchRenderJob(Preferences *preferences)
96 this->preferences = preferences;
104 BatchRenderJob::~BatchRenderJob()
106 asset->Garbage::remove_user();
109 void BatchRenderJob::copy_from(BatchRenderJob *src)
111 asset->copy_from(src->asset, 0);
112 strcpy(edl_path, src->edl_path);
113 strategy = src->strategy;
114 enabled = src->enabled;
118 void BatchRenderJob::load(FileXML *file)
123 file->tag.get_property("EDL_PATH", edl_path);
124 strategy = file->tag.get_property("STRATEGY", strategy);
125 enabled = file->tag.get_property("ENABLED", enabled);
126 elapsed = file->tag.get_property("ELAPSED", elapsed);
129 result = file->read_tag();
132 if(file->tag.title_is("ASSET"))
134 file->tag.get_property("SRC", asset->path);
135 asset->read(file, 0);
136 // The compression parameters are stored in the defaults to reduce
137 // coding maintenance. The defaults must now be stuffed into the XML for
140 defaults.load_string(file->read_text());
141 asset->load_defaults(&defaults,
152 void BatchRenderJob::save(FileXML *file)
154 file->tag.set_property("EDL_PATH", edl_path);
155 file->tag.set_property("STRATEGY", strategy);
156 file->tag.set_property("ENABLED", enabled);
157 file->tag.set_property("ELAPSED", elapsed);
159 file->append_newline();
164 // The compression parameters are stored in the defaults to reduce
165 // coding maintenance. The defaults must now be stuffed into the XML for
168 asset->save_defaults(&defaults,
176 defaults.save_string(string);
177 file->append_text(string);
179 file->tag.set_title("/JOB");
181 file->append_newline();
184 void BatchRenderJob::fix_strategy()
186 strategy = Render::fix_strategy(strategy, preferences->use_renderfarm);
198 BatchRenderThread::BatchRenderThread(MWindow *mwindow)
201 this->mwindow = mwindow;
212 BatchRenderThread::BatchRenderThread()
226 BatchRenderThread::~BatchRenderThread()
229 delete boot_defaults;
233 file_entries->remove_all_objects();
238 void BatchRenderThread::handle_close_event(int result)
241 char path[BCTEXTLEN];
244 save_defaults(mwindow->defaults);
247 jobs.remove_all_objects();
250 file_entries->remove_all_objects();
256 BC_Window* BatchRenderThread::new_gui()
260 default_job = new BatchRenderJob(mwindow->preferences);
265 file_entries = new ArrayList<BC_ListBoxItem*>;
267 char string[BCTEXTLEN];
268 // Load current directory
269 fs.update(getcwd(string, BCTEXTLEN));
270 for(int i = 0; i < fs.total_files(); i++)
272 file_entries->append(
274 fs.get_entry(i)->get_name()));
278 char path[BCTEXTLEN];
280 load_jobs(path, mwindow->preferences);
281 load_defaults(mwindow->defaults);
282 this->gui = new BatchRenderGUI(mwindow,
284 mwindow->session->batchrender_x,
285 mwindow->session->batchrender_y,
286 mwindow->session->batchrender_w,
287 mwindow->session->batchrender_h);
288 this->gui->create_objects();
293 void BatchRenderThread::load_jobs(char *path, Preferences *preferences)
298 jobs.remove_all_objects();
300 file.read_from_file(path);
302 file.read_from_file(create_path(path));
306 if(!(result = file.read_tag()))
308 if(file.tag.title_is("JOB"))
311 jobs.append(job = new BatchRenderJob(preferences));
318 void BatchRenderThread::save_jobs(char *path)
322 for(int i = 0; i < jobs.total; i++)
324 file.tag.set_title("JOB");
325 jobs.values[i]->save(&file);
329 file.write_to_file(path);
331 file.write_to_file(create_path(path));
334 void BatchRenderThread::load_defaults(BC_Hash *defaults)
338 default_job->asset->load_defaults(defaults,
345 default_job->fix_strategy();
348 for(int i = 0; i < BATCHRENDER_COLUMNS; i++)
350 char string[BCTEXTLEN];
351 sprintf(string, "BATCHRENDER_COLUMN%d", i);
352 column_width[i] = defaults->get(string, list_widths[i]);
356 void BatchRenderThread::save_defaults(BC_Hash *defaults)
360 default_job->asset->save_defaults(defaults,
367 defaults->update("BATCHRENDER_STRATEGY", default_job->strategy);
369 for(int i = 0; i < BATCHRENDER_COLUMNS; i++)
371 char string[BCTEXTLEN];
372 sprintf(string, "BATCHRENDER_COLUMN%d", i);
373 defaults->update(string, column_width[i]);
375 // defaults->update("BATCHRENDER_JOB", current_job);
377 mwindow->save_defaults();
382 char* BatchRenderThread::create_path(char *string)
385 sprintf(string, "%s", BCASTDIR);
386 fs.complete_path(string);
387 strcat(string, BATCH_PATH);
391 void BatchRenderThread::new_job()
393 BatchRenderJob *result = new BatchRenderJob(mwindow->preferences);
394 result->copy_from(get_current_job());
396 current_job = jobs.total - 1;
401 void BatchRenderThread::delete_job()
403 if(current_job < jobs.total && current_job >= 0)
405 jobs.remove_object_number(current_job);
406 if(current_job > 0) current_job--;
412 void BatchRenderThread::use_current_edl()
414 // printf("BatchRenderThread::use_current_edl %d %p %s\n",
416 // mwindow->edl->path,
417 // mwindow->edl->path);
419 strcpy(get_current_edl(), mwindow->edl->path);
421 gui->edl_path_text->update(get_current_edl());
424 void BatchRenderThread::update_selected_edl()
427 char *path = get_current_edl();
428 EDL *edl = mwindow->edl;
429 edl->save_xml(&xml_file, path, 0, 0);
430 xml_file.terminate_string();
431 if( xml_file.write_to_file(path) ) {
433 sprintf(msg, _("Unable to save: %s"), path);
434 MainError::show_error(msg);
438 BatchRenderJob* BatchRenderThread::get_current_job()
440 BatchRenderJob *result;
441 if(current_job >= jobs.total || current_job < 0)
443 result = default_job;
447 result = jobs.values[current_job];
453 Asset* BatchRenderThread::get_current_asset()
455 return get_current_job()->asset;
458 char* BatchRenderThread::get_current_edl()
460 return get_current_job()->edl_path;
464 // Test EDL files for existence
465 int BatchRenderThread::test_edl_files()
467 for(int i = 0; i < jobs.total; i++)
469 if(jobs.values[i]->enabled)
471 const char *path = jobs.values[i]->edl_path;
472 if( *path == '@' ) ++path;
473 FILE *fd = fopen(path, "r");
476 char string[BCTEXTLEN];
477 sprintf(string, _("EDL %s not found.\n"), jobs.values[i]->edl_path);
480 ErrorBox error_box(_(PROGRAM_NAME ": Error"),
481 mwindow->gui->get_abs_cursor_x(1),
482 mwindow->gui->get_abs_cursor_y(1));
483 error_box.create_objects(string);
484 error_box.run_window();
485 gui->button_enable();
506 void BatchRenderThread::calculate_dest_paths(ArrayList<char*> *paths,
507 Preferences *preferences)
509 for(int i = 0; i < jobs.total; i++)
511 BatchRenderJob *job = jobs.values[i];
512 if(job->enabled && *job->edl_path != '@')
514 PackageDispatcher *packages = new PackageDispatcher;
517 TransportCommand *command = new TransportCommand;
518 FileXML *file = new FileXML;
519 file->read_from_file(job->edl_path);
521 // Use command to calculate range.
522 command->command = NORMAL_FWD;
523 command->get_edl()->load_xml(file,
525 command->change_type = CHANGE_ALL;
526 command->set_playback_range();
527 command->playback_range_adjust_inout();
529 // Create test packages
530 packages->create_packages(mwindow,
535 command->start_position,
536 command->end_position,
539 // Append output paths allocated to total
540 packages->get_package_paths(paths);
542 // Delete package harness
551 void BatchRenderThread::start_rendering(char *config_path,
554 BC_Hash *boot_defaults;
555 Preferences *preferences;
557 BC_Signals *signals = new BC_Signals;
558 // XXX the above stuff is leaked,
560 // Initialize stuff which MWindow does.
561 signals->initialize();
562 MWindow::init_defaults(boot_defaults, config_path);
563 load_defaults(boot_defaults);
564 preferences = new Preferences;
565 preferences->load_defaults(boot_defaults);
566 MWindow::init_plugins(0, preferences);
567 char font_path[BCTEXTLEN];
568 strcpy(font_path, preferences->plugin_dir);
569 strcat(font_path, "/" FONT_SEARCHPATH);
570 BC_Resources::init_fontconfig(font_path);
571 BC_WindowBase::get_resources()->vframe_shm = 1;
574 load_jobs(batch_path, preferences);
575 save_jobs(batch_path);
576 save_defaults(boot_defaults);
579 // Test EDL files for existence
580 if(test_edl_files()) return;
584 // Predict all destination paths
585 ArrayList<char*> paths;
586 paths.set_array_delete();
587 calculate_dest_paths(&paths, preferences);
590 int result = ConfirmSave::test_files(0, &paths);
591 paths.remove_all_objects();
592 // Abort on any existing file because it's so hard to set this up.
596 render = new Render(0);
598 render->start_batches(&jobs,
604 void BatchRenderThread::start_rendering()
606 if(is_rendering) return;
609 char path[BCTEXTLEN];
612 save_defaults(mwindow->defaults);
613 gui->button_disable();
615 // Test EDL files for existence
616 if(test_edl_files()) return;
618 // Predict all destination paths
619 ArrayList<char*> paths;
620 calculate_dest_paths(&paths,
621 mwindow->preferences);
623 // Test destination files for overwrite
624 int result = ConfirmSave::test_files(mwindow, &paths);
625 paths.remove_all_objects();
631 gui->button_enable();
635 mwindow->render->start_batches(&jobs);
638 void BatchRenderThread::stop_rendering()
640 if(!is_rendering) return;
641 mwindow->render->stop_operation();
645 void BatchRenderThread::update_active(int number)
647 gui->lock_window("BatchRenderThread::update_active");
650 current_job = number;
651 rendering_job = number;
659 gui->unlock_window();
662 void BatchRenderThread::update_done(int number,
666 gui->lock_window("BatchRenderThread::update_done");
669 gui->button_enable();
673 jobs.values[number]->enabled = 0;
674 jobs.values[number]->elapsed = elapsed_time;
675 if(create_list) gui->create_list(1);
677 gui->unlock_window();
680 void BatchRenderThread::move_batch(int src, int dst)
682 BatchRenderJob *src_job = jobs.values[src];
683 if(dst < 0) dst = jobs.total - 1;
687 for(int i = src; i < jobs.total - 1; i++)
688 jobs.values[i] = jobs.values[i + 1];
689 // if(dst > src) dst--;
690 for(int i = jobs.total - 1; i > dst; i--)
691 jobs.values[i] = jobs.values[i - 1];
692 jobs.values[dst] = src_job;
703 BatchRenderGUI::BatchRenderGUI(MWindow *mwindow,
704 BatchRenderThread *thread,
709 : BC_Window(_(PROGRAM_NAME ": Batch Render"),
720 this->mwindow = mwindow;
721 this->thread = thread;
724 BatchRenderGUI::~BatchRenderGUI()
726 lock_window("BatchRenderGUI::~BatchRenderGUI");
732 void BatchRenderGUI::create_objects()
734 lock_window("BatchRenderGUI::create_objects");
735 mwindow->theme->get_batchrender_sizes(this, get_w(), get_h());
738 int x = mwindow->theme->batchrender_x1;
740 int x1 = mwindow->theme->batchrender_x1;
741 int x2 = mwindow->theme->batchrender_x2;
742 //int x3 = mwindow->theme->batchrender_x3;
747 add_subwindow(output_path_title = new BC_Title(x1, y, _("Output path:")));
749 format_tools = new BatchFormat(mwindow,
751 thread->get_current_asset());
752 format_tools->set_w(get_w() / 2);
753 format_tools->create_objects(x,
763 &thread->get_current_job()->strategy,
768 x += format_tools->get_w();
775 add_subwindow(edl_path_title = new BC_Title(x, y, _("EDL Path:")));
777 add_subwindow(edl_path_text = new BatchRenderEDLPath(
782 thread->get_current_edl()));
784 x += edl_path_text->get_w();
785 add_subwindow(edl_path_browse = new BrowseButton(
786 mwindow, this, edl_path_text, x, y, thread->get_current_edl(),
787 _("Input EDL"), _("Select an EDL to load:"), 0));
791 update_selected_edl = new BatchRenderUpdateEDL(thread, x, y);
792 add_subwindow(update_selected_edl);
793 y += update_selected_edl->get_h() + mwindow->theme->widget_border;
795 add_subwindow(new_batch = new BatchRenderNew(thread,
798 x += new_batch->get_w() + 10;
800 add_subwindow(delete_batch = new BatchRenderDelete(thread,
803 x = new_batch->get_x();
804 y += new_batch->get_h() + mwindow->theme->widget_border;
805 use_current_edl = new BatchRenderCurrentEDL(thread, x, y);
806 add_subwindow(use_current_edl);
807 if( !mwindow->edl || !mwindow->edl->path[0] ) use_current_edl->disable();
809 savelist_batch = new BatchRenderSaveList(thread, x, y);
810 add_subwindow(savelist_batch);
811 x += savelist_batch->get_w() + 10;
813 loadlist_batch = new BatchRenderLoadList(thread, x, y);
814 add_subwindow(loadlist_batch);
815 x += loadlist_batch->get_w() + 10;
819 add_subwindow(list_title = new BC_Title(x, y, _("Batches to render:")));
821 add_subwindow(batch_list = new BatchRenderList(thread,
825 get_h() - y - BC_GenericButton::calculate_h() - 15));
827 y += batch_list->get_h() + 10;
828 add_subwindow(start_button = new BatchRenderStart(thread,
832 BC_GenericButton::calculate_w(this, _("Stop")) / 2;
833 add_subwindow(stop_button = new BatchRenderStop(thread,
837 BC_GenericButton::calculate_w(this, _("Close")) -
839 add_subwindow(cancel_button = new BatchRenderCancel(thread,
847 void BatchRenderGUI::button_disable()
849 new_batch->disable();
850 delete_batch->disable();
851 use_current_edl->disable();
852 update_selected_edl->disable();
855 void BatchRenderGUI::button_enable()
858 delete_batch->enable();
859 if( mwindow->edl && mwindow->edl->path[0] )
860 use_current_edl->enable();
861 update_selected_edl->enable();
864 int BatchRenderGUI::resize_event(int w, int h)
866 mwindow->session->batchrender_w = w;
867 mwindow->session->batchrender_h = h;
868 mwindow->theme->get_batchrender_sizes(this, w, h);
870 int x = mwindow->theme->batchrender_x1;
872 int x1 = mwindow->theme->batchrender_x1;
873 int x2 = mwindow->theme->batchrender_x2;
874 //int x3 = mwindow->theme->batchrender_x3;
878 output_path_title->reposition_window(x1, y);
880 format_tools->reposition_window(x, y);
884 x += format_tools->get_w();
889 edl_path_title->reposition_window(x, y);
891 edl_path_text->reposition_window(x, y, w - x - 40);
892 x += edl_path_text->get_w();
893 edl_path_browse->reposition_window(x, y);
897 // status_title->reposition_window(x, y);
899 // status_text->reposition_window(x, y);
902 // progress_bar->reposition_window(x, y, w - x - 10);
905 update_selected_edl->reposition_window(x, y);
906 y += update_selected_edl->get_h() + mwindow->theme->widget_border;
907 new_batch->reposition_window(x, y);
908 x += new_batch->get_w() + 10;
909 delete_batch->reposition_window(x, y);
910 x = new_batch->get_x();
911 y += new_batch->get_h() + mwindow->theme->widget_border;
912 use_current_edl->reposition_window(x, y);
916 int y_margin = get_h() - batch_list->get_h();
917 list_title->reposition_window(x, y);
919 batch_list->reposition_window(x, y, w - x - 10, h - y_margin);
921 y += batch_list->get_h() + 10;
922 start_button->reposition_window(x, y);
924 stop_button->get_w() / 2;
925 stop_button->reposition_window(x, y);
927 cancel_button->get_w() -
929 cancel_button->reposition_window(x, y);
933 int BatchRenderGUI::translation_event()
935 mwindow->session->batchrender_x = get_x();
936 mwindow->session->batchrender_y = get_y();
940 int BatchRenderGUI::close_event()
942 // Stop batch rendering
944 thread->stop_rendering();
945 lock_window("BatchRenderGUI::close_event");
950 void BatchRenderGUI::create_list(int update_widget)
952 for(int i = 0; i < BATCHRENDER_COLUMNS; i++)
954 list_columns[i].remove_all_objects();
957 for(int i = 0; i < thread->jobs.total; i++)
959 BatchRenderJob *job = thread->jobs.values[i];
960 char string[BCTEXTLEN];
961 BC_ListBoxItem *enabled = new BC_ListBoxItem(job->enabled ?
964 BC_ListBoxItem *item1 = new BC_ListBoxItem(job->asset->path);
965 BC_ListBoxItem *item2 = new BC_ListBoxItem(job->edl_path);
966 BC_ListBoxItem *item3;
968 item3 = new BC_ListBoxItem(
969 Units::totext(string,
973 item3 = new BC_ListBoxItem(_("Unknown"));
974 list_columns[0].append(enabled);
975 list_columns[1].append(item1);
976 list_columns[2].append(item2);
977 list_columns[3].append(item3);
978 if(i == thread->current_job)
980 enabled->set_selected(1);
981 item1->set_selected(1);
982 item2->set_selected(1);
983 item3->set_selected(1);
985 if(i == thread->rendering_job)
987 enabled->set_color(RED);
988 item1->set_color(RED);
989 item2->set_color(RED);
990 item3->set_color(RED);
996 batch_list->update(list_columns,
998 thread->column_width,
1000 batch_list->get_xposition(),
1001 batch_list->get_yposition(),
1002 batch_list->get_highlighted_item(), // Flat index of item cursor is over
1003 1, // set all autoplace flags to 1
1008 void BatchRenderGUI::change_job()
1010 BatchRenderJob *job = thread->get_current_job();
1011 format_tools->update(job->asset, &job->strategy);
1012 edl_path_text->update(job->edl_path);
1022 BatchFormat::BatchFormat(MWindow *mwindow,
1023 BatchRenderGUI *gui,
1025 : FormatTools(mwindow, gui, asset)
1028 this->mwindow = mwindow;
1031 BatchFormat::~BatchFormat()
1036 int BatchFormat::handle_event()
1038 gui->create_list(1);
1052 BatchRenderEDLPath::BatchRenderEDLPath(BatchRenderThread *thread,
1063 this->thread = thread;
1067 int BatchRenderEDLPath::handle_event()
1070 calculate_suggestions(thread->file_entries);
1072 strcpy(thread->get_current_edl(), get_text());
1073 thread->gui->create_list(1);
1082 BatchRenderNew::BatchRenderNew(BatchRenderThread *thread,
1085 : BC_GenericButton(x, y, _("New"))
1087 this->thread = thread;
1090 int BatchRenderNew::handle_event()
1096 BatchRenderDelete::BatchRenderDelete(BatchRenderThread *thread,
1099 : BC_GenericButton(x, y, _("Delete"))
1101 this->thread = thread;
1104 int BatchRenderDelete::handle_event()
1106 thread->delete_job();
1112 BatchRenderSaveList::BatchRenderSaveList(BatchRenderThread *thread,
1115 : BC_GenericButton(x, y, _("Save List"))
1117 this->thread = thread;
1118 set_tooltip(_("Save a Batch Render List"));
1120 startup_lock = new Mutex("BatchRenderSaveList::startup_lock");
1123 BatchRenderSaveList::~BatchRenderSaveList()
1125 startup_lock->lock("BatchRenderSaveList::~BrowseButton");
1130 gui->unlock_window();
1132 startup_lock->unlock();
1134 delete startup_lock;
1137 int BatchRenderSaveList::handle_event()
1139 if(Thread::running())
1144 gui->raise_window();
1145 gui->unlock_window();
1149 startup_lock->lock("BatchRenderSaveList::handle_event 1");
1151 startup_lock->lock("BatchRenderSaveList::handle_event 2");
1152 startup_lock->unlock();
1156 void BatchRenderSaveList::run()
1158 char default_path[BCTEXTLEN];
1159 sprintf(default_path, "~");
1160 BC_FileBox filewindow(100,
1162 this->thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path),
1163 _("Save Batch Render List"),
1164 _("Enter a Batch Render filename to save as:"),
1172 startup_lock->unlock();
1173 filewindow.create_objects();
1175 int result2 = filewindow.run_window();
1179 this->thread->save_jobs(filewindow.get_submitted_path());
1180 this->thread->mwindow->defaults->update("DEFAULT_BATCHLOADPATH", filewindow.get_submitted_path());
1183 this->thread->gui->flush();
1184 startup_lock->lock("BatchRenderLoadList::run");
1186 startup_lock->unlock();
1189 int BatchRenderSaveList::keypress_event() {
1190 if (get_keypress() == 's' ||
1191 get_keypress() == 'S') return handle_event();
1198 BatchRenderLoadList::BatchRenderLoadList(BatchRenderThread *thread,
1201 : BC_GenericButton(x, y, _("Load List")),
1204 this->thread = thread;
1205 set_tooltip(_("Load a previously saved Batch Render List"));
1207 startup_lock = new Mutex("BatchRenderLoadList::startup_lock");
1210 BatchRenderLoadList::~BatchRenderLoadList()
1212 startup_lock->lock("BatchRenderLoadList::~BrowseButton");
1217 gui->unlock_window();
1219 startup_lock->unlock();
1221 delete startup_lock;
1224 int BatchRenderLoadList::handle_event()
1226 if(Thread::running())
1231 gui->raise_window();
1232 gui->unlock_window();
1236 startup_lock->lock("BatchRenderLoadList::handle_event 1");
1238 startup_lock->lock("BatchRenderLoadList::handle_event 2");
1239 startup_lock->unlock();
1243 void BatchRenderLoadList::run()
1245 char default_path[BCTEXTLEN];
1246 sprintf(default_path, "~");
1247 BC_FileBox filewindow(100,
1249 this->thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path),
1250 _("Load Batch Render List"),
1251 _("Enter a Batch Render filename to load from:"),
1259 startup_lock->unlock();
1260 filewindow.create_objects();
1262 int result2 = filewindow.run_window();
1266 this->thread->load_jobs(filewindow.get_submitted_path(),this->thread->mwindow->preferences);
1267 this->thread->gui->create_list(1);
1268 this->thread->mwindow->defaults->update("DEFAULT_BATCHLOADPATH", filewindow.get_submitted_path());
1271 this->thread->gui->flush();
1272 startup_lock->lock("BatchRenderLoadList::run");
1274 startup_lock->unlock();
1277 int BatchRenderLoadList::keypress_event() {
1278 if (get_keypress() == 'o' ||
1279 get_keypress() == 'O') return handle_event();
1283 BatchRenderCurrentEDL::BatchRenderCurrentEDL(BatchRenderThread *thread,
1286 : BC_GenericButton(x, y, _("Use Current EDL"))
1288 this->thread = thread;
1291 int BatchRenderCurrentEDL::handle_event()
1293 thread->use_current_edl();
1297 BatchRenderUpdateEDL::BatchRenderUpdateEDL(BatchRenderThread *thread,
1300 : BC_GenericButton(x, y, _("Save to EDL Path"))
1302 this->thread = thread;
1305 int BatchRenderUpdateEDL::handle_event()
1307 thread->update_selected_edl();
1314 BatchRenderList::BatchRenderList(BatchRenderThread *thread,
1324 thread->gui->list_columns,
1326 thread->column_width,
1327 BATCHRENDER_COLUMNS,
1334 this->thread = thread;
1336 set_process_drag(0);
1339 int BatchRenderList::handle_event()
1344 int BatchRenderList::selection_changed()
1346 thread->current_job = get_selection_number(0, 0);
1347 thread->gui->change_job();
1348 if(get_cursor_x() < thread->column_width[0])
1350 BatchRenderJob *job = thread->get_current_job();
1351 job->enabled = !job->enabled;
1352 thread->gui->create_list(1);
1357 int BatchRenderList::column_resize_event()
1359 for(int i = 0; i < BATCHRENDER_COLUMNS; i++)
1361 thread->column_width[i] = get_column_width(i);
1366 int BatchRenderList::drag_start_event()
1368 if(BC_ListBox::drag_start_event())
1377 int BatchRenderList::drag_motion_event()
1379 if(BC_ListBox::drag_motion_event())
1386 int BatchRenderList::drag_stop_event()
1390 int src = get_selection_number(0, 0);
1391 int dst = get_highlighted_item();
1394 thread->move_batch(src, dst);
1396 BC_ListBox::drag_stop_event();
1413 BatchRenderStart::BatchRenderStart(BatchRenderThread *thread,
1416 : BC_GenericButton(x,
1420 this->thread = thread;
1423 int BatchRenderStart::handle_event()
1425 thread->start_rendering();
1429 BatchRenderStop::BatchRenderStop(BatchRenderThread *thread,
1432 : BC_GenericButton(x,
1436 this->thread = thread;
1439 int BatchRenderStop::handle_event()
1442 thread->stop_rendering();
1443 lock_window("BatchRenderStop::handle_event");
1448 BatchRenderCancel::BatchRenderCancel(BatchRenderThread *thread,
1451 : BC_GenericButton(x,
1455 this->thread = thread;
1458 int BatchRenderCancel::handle_event()
1461 thread->stop_rendering();
1462 lock_window("BatchRenderCancel::handle_event");
1463 thread->gui->set_done(1);
1467 int BatchRenderCancel::keypress_event()
1469 if(get_keypress() == ESC)
1472 thread->stop_rendering();
1473 lock_window("BatchRenderCancel::keypress_event");
1474 thread->gui->set_done(1);