X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fbatchrender.C;h=20d817b5df222837f07ff18320cf28aa483b5449;hb=HEAD;hp=9703361cb8b04167e26dc8e21c7f55a78e808b55;hpb=bfd8c9032015896999473fba40d5f2948c81894f;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C index 9703361c..c010f185 100644 --- a/cinelerra-5.1/cinelerra/batchrender.C +++ b/cinelerra-5.1/cinelerra/batchrender.C @@ -2,6 +2,7 @@ /* * CINELERRA * Copyright (C) 2011 Adam Williams + * Copyright (C) 2003-2016 Cinelerra CV contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,6 +61,8 @@ #include "dvdcreate.h" #include "bdcreate.h" +#include + int BatchRenderThread::column_widths[] = { 42, 42, 42, 222, 222, 150 }; const char *BatchRenderThread::column_titles[] = { N_("Enabled"), N_("Labeled"), N_("Farmed"), N_("Output"), N_("EDL"), N_("Elapsed") @@ -121,6 +124,8 @@ BatchRenderJob *BatchRenderJob::copy() void BatchRenderJob::load(FileXML *file) { int result = 0; + char job_title[BCSTRLEN]; + strcpy(job_title, file->tag.title); enabled = file->tag.get_property("ENABLED", enabled); farmed = file->tag.get_property("FARMED", farmed); @@ -138,7 +143,7 @@ void BatchRenderJob::load(FileXML *file) // coding maintenance. The defaults must now be stuffed into the XML for // unique storage. BC_Hash defaults; - defaults.load_string(file->read_text()); + defaults.load_string(file->read_text(job_title)); asset->load_defaults(&defaults, "", 0, 1, 0, 0, 0); } @@ -179,7 +184,9 @@ char *BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls) int BatchRenderJob::get_strategy() { - return Render::get_strategy(farmed, labeled); + int range = File::is_image_render(asset->format) ? + RANGE_1FRAME : RANGE_SELECTION; + return Render::get_strategy(farmed, labeled, range); } @@ -193,7 +200,7 @@ BatchRenderThread::BatchRenderThread(MWindow *mwindow) default_job = 0; boot_defaults = 0; preferences = 0; - warn = 1; + warn = 0; render = 0; batch_path[0] = 0; do_farmed = 0; @@ -264,7 +271,10 @@ void BatchRenderThread::load_jobs(char *path, Preferences *preferences) while( !result ) { if( !(result = file.read_tag()) ) { if( file.tag.title_is("JOBS") ) { + if (mwindow && mwindow->preferences->unsafe_gui) warn = file.tag.get_property("WARN", 1); + if (mwindow && !mwindow->preferences->unsafe_gui) + warn = 0; } else if( file.tag.title_is("JOB") ) { BatchRenderJob *job = new BatchRenderJob(preferences, 0,0); @@ -289,6 +299,7 @@ void BatchRenderThread::save_jobs(char *path) { FileXML file; file.tag.set_title("JOBS"); + if (mwindow && mwindow->preferences->unsafe_gui) file.tag.set_property("WARN", warn); file.append_tag(); file.append_newline(); @@ -383,6 +394,9 @@ void BatchRenderThread::update_selected_edl() FileXML xml_file; char *path = get_current_edl(); EDL *edl = mwindow->edl; + // result = 1 if user cancelled operation + int result = ConfirmSave::test_file(mwindow, path); + if (!result) { edl->save_xml(&xml_file, path); xml_file.terminate_string(); if( xml_file.write_to_file(path) ) { @@ -390,6 +404,7 @@ void BatchRenderThread::update_selected_edl() sprintf(msg, _("Unable to save: %s"), path); MainError::show_error(msg); } + } } BatchRenderJob* BatchRenderThread::get_current_job() @@ -528,7 +543,7 @@ void BatchRenderThread::calculate_dest_paths(ArrayList *paths, PackageDispatcher *packages = new PackageDispatcher; // Load EDL - TransportCommand *command = new TransportCommand; + TransportCommand *command = new TransportCommand(preferences); FileXML *file = new FileXML; file->read_from_file(job->edl_path); @@ -583,8 +598,10 @@ void BatchRenderThread::start_rendering(char *config_path, else { BC_Trace::disable_locks(); } - +// In batch mode there is no mwindow, so init_plugins is called with +// mwindow* = NULL. MWindow::init_plugins(0, preferences); + MWindow::init_ladspa_plugins(0, preferences); char font_path[BCTEXTLEN]; strcpy(font_path, preferences->plugin_dir); strcat(font_path, "/" FONT_SEARCHPATH); @@ -729,6 +746,8 @@ BatchRenderGUI::BatchRenderGUI(MWindow *mwindow, this->mwindow = mwindow; this->thread = thread; use_renderfarm = 0; +// *** CONTEXT_HELP *** + context_help_set_keyword("Batch Rendering"); } BatchRenderGUI::~BatchRenderGUI() @@ -788,8 +807,10 @@ void BatchRenderGUI::create_objects() y2 = y + edl_path_browse->get_h() + mwindow->theme->widget_border; x = x2; y = y2; + if (mwindow->preferences->unsafe_gui) { add_subwindow(update_selected_edl = new BatchRenderUpdateEDL(thread, x, y)); y += update_selected_edl->get_h() + mwindow->theme->widget_border; + } add_subwindow(use_current_edl = new BatchRenderCurrentEDL(thread, x, y)); y += use_current_edl->get_h() + mwindow->theme->widget_border; if( !mwindow->edl || !mwindow->edl->path[0] ) use_current_edl->disable(); @@ -801,8 +822,10 @@ void BatchRenderGUI::create_objects() x += savelist_batch->get_w() + mwindow->theme->widget_border; add_subwindow(loadlist_batch = new BatchRenderLoadList(thread, x, y)); y += loadlist_batch->get_h() + mwindow->theme->widget_border; + if (mwindow->preferences->unsafe_gui) { add_subwindow(warning = new BatchRenderWarning(thread, x2, y)); y2 = y + warning->get_h() + mwindow->theme->widget_border; + } if( y2 > y1 ) y1 = y2; x = mwindow->theme->batchrender_x1, y = y1; @@ -817,8 +840,10 @@ void BatchRenderGUI::create_objects() y += batch_list->get_h() + mwindow->theme->widget_border; add_subwindow(start_button = new BatchRenderStart(thread, x, y)); - x = get_w() / 2 - BC_GenericButton::calculate_w(this, _("Stop")) / 2; + x = get_w() / 3 - BC_GenericButton::calculate_w(this, _("Stop")) / 3; add_subwindow(stop_button = new BatchRenderStop(thread, x, y)); + x = get_w() / 1.5 - BC_GenericButton::calculate_w(this, _("?")) / 1.5; + add_subwindow(help_button = new BatchRenderHelp(thread, x, y)); x = get_w() - BC_GenericButton::calculate_w(this, _("Close")) - xs10; add_subwindow(cancel_button = new BatchRenderCancel(thread, x, y)); @@ -831,6 +856,7 @@ void BatchRenderGUI::button_disable() new_batch->disable(); delete_batch->disable(); use_current_edl->disable(); + if (mwindow->preferences->unsafe_gui) update_selected_edl->disable(); } @@ -840,6 +866,7 @@ void BatchRenderGUI::button_enable() delete_batch->enable(); if( mwindow->edl && mwindow->edl->path[0] ) use_current_edl->enable(); + if (mwindow->preferences->unsafe_gui) update_selected_edl->enable(); } @@ -872,8 +899,10 @@ int BatchRenderGUI::resize_event(int w, int h) y2 = y + edl_path_browse->get_h() + mwindow->theme->widget_border; x = x2; y = y2; + if (mwindow->preferences->unsafe_gui) { update_selected_edl->reposition_window(x, y); y += update_selected_edl->get_h() + mwindow->theme->widget_border; + } use_current_edl->reposition_window(x, y); y += use_current_edl->get_h() + mwindow->theme->widget_border; new_batch->reposition_window(x, y); @@ -885,8 +914,9 @@ int BatchRenderGUI::resize_event(int w, int h) x += savelist_batch->get_w() + mwindow->theme->widget_border; loadlist_batch->reposition_window(x, y); y += loadlist_batch->get_h() + mwindow->theme->widget_border; + if (mwindow->preferences->unsafe_gui) { warning->reposition_window(x2, y); - + } y1 = ys15 + BC_GenericButton::calculate_h() + mwindow->theme->widget_border; y2 = get_h() - y1 - batch_list->get_h(); y2 -= list_title->get_h() + mwindow->theme->widget_border; @@ -898,10 +928,12 @@ int BatchRenderGUI::resize_event(int w, int h) y += batch_list->get_h() + mwindow->theme->widget_border; start_button->reposition_window(x, y); - x = w / 2 - stop_button->get_w() / 2; + x = w / 3 - stop_button->get_w() / 3; stop_button->reposition_window(x, y); x = w - cancel_button->get_w() - xs10; cancel_button->reposition_window(x, y); + x = w / 1.5 - help_button->get_w() / 1.5; + help_button->reposition_window(x, y); return 1; } @@ -1040,6 +1072,7 @@ BatchRenderNew::BatchRenderNew(BatchRenderThread *thread, : BC_GenericButton(x, y, _("New")) { this->thread = thread; + set_tooltip(_("Create a new batch")); } int BatchRenderNew::handle_event() @@ -1052,6 +1085,7 @@ BatchRenderDelete::BatchRenderDelete(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Delete")) { this->thread = thread; + set_tooltip(_("Delete loaded (highlighted) batch")); } int BatchRenderDelete::handle_event() @@ -1134,7 +1168,7 @@ void BatchRenderSaveList::run() int BatchRenderSaveList::keypress_event() { if( get_keypress() == 's' || get_keypress() == 'S' ) return handle_event(); - return 0; + return context_help_check_and_show(); } @@ -1196,6 +1230,7 @@ void BatchRenderLoadList::run() int result2 = filewindow.run_window(); if( !result2 ) { + thread->gui->lock_window("BatchRenderLoadList::run"); strcpy(thread->batch_path, filewindow.get_submitted_path()); thread->gui->batch_path->update(thread->batch_path); thread->mwindow->defaults->update("DEFAULT_BATCHLOADPATH", thread->batch_path); @@ -1203,6 +1238,7 @@ void BatchRenderLoadList::run() thread->gui->create_list(1); thread->current_job = 0; thread->gui->change_job(); + thread->gui->unlock_window(); } startup_lock->lock("BatchRenderLoadList::run"); @@ -1213,7 +1249,7 @@ void BatchRenderLoadList::run() int BatchRenderLoadList::keypress_event() { if( get_keypress() == 'o' || get_keypress() == 'O' ) return handle_event(); - return 0; + return context_help_check_and_show(); } BatchRenderCurrentEDL::BatchRenderCurrentEDL(BatchRenderThread *thread, @@ -1222,6 +1258,7 @@ BatchRenderCurrentEDL::BatchRenderCurrentEDL(BatchRenderThread *thread, : BC_GenericButton(x, y, _("Use Current EDL")) { this->thread = thread; + set_tooltip(_("Replaces highlighted batch job with session currently on timeline. File on disk NOT changed!")); } int BatchRenderCurrentEDL::handle_event() @@ -1236,6 +1273,7 @@ BatchRenderUpdateEDL::BatchRenderUpdateEDL(BatchRenderThread *thread, : BC_GenericButton(x, y, _("Save to EDL Path")) { this->thread = thread; + set_tooltip(_("WARNING - saves to loaded (highlighted) EDL, *overwrites* highlighted project!")); } int BatchRenderUpdateEDL::handle_event() @@ -1337,6 +1375,7 @@ BatchRenderStart::BatchRenderStart(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Start")) { this->thread = thread; + set_tooltip(_("Start batch rendering")); } int BatchRenderStart::handle_event() @@ -1349,6 +1388,7 @@ BatchRenderStop::BatchRenderStop(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Stop")) { this->thread = thread; + set_tooltip(_("Stops currently active batch rendering")); } int BatchRenderStop::handle_event() @@ -1364,6 +1404,7 @@ BatchRenderWarning::BatchRenderWarning(BatchRenderThread *thread, int x, int y) : BC_CheckBox(x, y, thread->warn, _("warn if jobs/session mismatched")) { this->thread = thread; + set_tooltip(_("Prevents rendering if loaded session and batch job(s) differ")); } int BatchRenderWarning::handle_event() @@ -1376,6 +1417,7 @@ BatchRenderCancel::BatchRenderCancel(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Close")) { this->thread = thread; + set_tooltip(_("Closes this window")); } int BatchRenderCancel::handle_event() @@ -1396,6 +1438,20 @@ int BatchRenderCancel::keypress_event() thread->gui->set_done(1); return 1; } + return context_help_check_and_show(); +} + +//new help button +BatchRenderHelp::BatchRenderHelp(BatchRenderThread *thread, int x, int y) + : BC_GenericButton(x, y, _("?")) +{ + this->thread = thread; + set_tooltip(_("Open quick start guide in default browser")); +} + +int BatchRenderHelp::handle_event() +{ + system("xdg-open file://$CIN_DAT/doc/help_br_index.html"); return 0; }