[Cin] Batchrender GUI changes, third try ...
Andrew Randrianasulu
randrianasulu at gmail.com
Wed Jan 13 11:01:17 CET 2021
Oh, trying to get it right ....
So far this version survived 'Load with unsafe GUI disabled, enable it, try render,
try to check 'Do not show this warning' checkbox, try render again, re-check checkbox,
disable Usafe GUI feature, try to render again ....'
---
diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C
index 1f878835..313339df 100644
--- a/cinelerra-5.1/cinelerra/appearanceprefs.C
+++ b/cinelerra-5.1/cinelerra/appearanceprefs.C
@@ -649,15 +649,15 @@ int UseWarnIndecies::handle_event()
}
UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
- : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
- _("EDL version warns if mismatched"))
+ : BC_CheckBox(x, y, pwindow->thread->preferences->unsafe_gui,
+ _("Unsafe GUI in batchrender"))
{
this->pwindow = pwindow;
}
int UseWarnVersion::handle_event()
{
- pwindow->thread->preferences->warn_version = get_value();
+ pwindow->thread->preferences->unsafe_gui = get_value();
return 1;
}
diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C
index 6dcdbc62..d98dcc07 100644
--- a/cinelerra-5.1/cinelerra/batchrender.C
+++ b/cinelerra-5.1/cinelerra/batchrender.C
@@ -60,6 +60,8 @@
#include "dvdcreate.h"
#include "bdcreate.h"
+#define UNSAFE_BUTTON 0
+
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")
@@ -198,6 +200,7 @@ BatchRenderThread::BatchRenderThread(MWindow *mwindow)
boot_defaults = 0;
preferences = 0;
warn = 1;
+
render = 0;
batch_path[0] = 0;
do_farmed = 0;
@@ -268,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->preferences->unsafe_gui)
warn = file.tag.get_property("WARN", 1);
+ if (!mwindow->preferences->unsafe_gui)
+ warn = 0;
}
else if( file.tag.title_is("JOB") ) {
BatchRenderJob *job = new BatchRenderJob(preferences, 0,0);
@@ -293,6 +299,7 @@ void BatchRenderThread::save_jobs(char *path)
{
FileXML file;
file.tag.set_title("JOBS");
+ if (mwindow->preferences->unsafe_gui)
file.tag.set_property("WARN", warn);
file.append_tag();
file.append_newline();
@@ -382,6 +389,7 @@ void BatchRenderThread::use_current_edl()
gui->edl_path_text->update(get_current_edl());
}
+
void BatchRenderThread::update_selected_edl()
{
FileXML xml_file;
@@ -508,10 +516,13 @@ int BatchRenderThread::test_edl_files()
ret = 1;
}
+
if( !ret && warn && mwindow ) {
ret = test_errmsg(not_equiv, _("%d job EDLs do not match session edl\n"), &warn);
if( !warn ) gui->warning->update(0);
}
+
+
if( !ret && mwindow )
ret = test_errmsg(empty_jobs, _("%d job EDLs begin position beyond end of media\n"), 0);
if( !ret && mwindow )
@@ -792,8 +803,12 @@ 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();
@@ -805,8 +820,12 @@ 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;
@@ -835,6 +854,7 @@ void BatchRenderGUI::button_disable()
new_batch->disable();
delete_batch->disable();
use_current_edl->disable();
+ if (mwindow->preferences->unsafe_gui)
update_selected_edl->disable();
}
@@ -844,6 +864,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();
}
@@ -876,8 +897,12 @@ 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);
@@ -889,9 +914,12 @@ 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;
@@ -1236,6 +1264,7 @@ int BatchRenderCurrentEDL::handle_event()
return 1;
}
+
BatchRenderUpdateEDL::BatchRenderUpdateEDL(BatchRenderThread *thread,
int x,
int y)
@@ -1244,8 +1273,10 @@ BatchRenderUpdateEDL::BatchRenderUpdateEDL(BatchRenderThread *thread,
this->thread = thread;
}
+
int BatchRenderUpdateEDL::handle_event()
{
+ //if (thread->preferences->unsafe_gui)
thread->update_selected_edl();
return 1;
}
@@ -1374,6 +1405,7 @@ BatchRenderWarning::BatchRenderWarning(BatchRenderThread *thread, int x, int y)
int BatchRenderWarning::handle_event()
{
+ //if (thread->preferences->unsafe_gui)
thread->warn = get_value();
return 1;
}
diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C
index ad92bac8..bb603b6e 100644
--- a/cinelerra-5.1/cinelerra/preferences.C
+++ b/cinelerra-5.1/cinelerra/preferences.C
@@ -93,7 +93,7 @@ Preferences::Preferences()
ffmpeg_marker_indexes = 1;
memset(&use_hw_dev, 0, sizeof(use_hw_dev));
warn_indexes = 1;
- warn_version = 1;
+ unsafe_gui = 1;
warn_fileref = 1;
bd_warn_root = 1;
popupmenu_btnup = 1;
@@ -220,7 +220,7 @@ void Preferences::copy_from(Preferences *that)
ffmpeg_marker_indexes = that->ffmpeg_marker_indexes;
strcpy(use_hw_dev, &that->use_hw_dev[0]);
warn_indexes = that->warn_indexes;
- warn_version = that->warn_version;
+ unsafe_gui = that->unsafe_gui;
warn_fileref = that->warn_fileref;
bd_warn_root = that->bd_warn_root;
popupmenu_btnup = that->popupmenu_btnup;
@@ -371,7 +371,7 @@ int Preferences::load_defaults(BC_Hash *defaults)
memset(&use_hw_dev, 0, sizeof(use_hw_dev));
defaults->get("USE_HW_DEV", use_hw_dev);
warn_indexes = defaults->get("WARN_INDEXES", warn_indexes);
- warn_version = defaults->get("WARN_VERSION", warn_version);
+ unsafe_gui = defaults->get("UNSAFE_GUI", unsafe_gui);
warn_fileref = defaults->get("WARN_FILEREF", warn_fileref);
bd_warn_root = defaults->get("BD_WARN_ROOT", bd_warn_root);
popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup);
@@ -522,7 +522,7 @@ int Preferences::save_defaults(BC_Hash *defaults)
defaults->update("FFMPEG_MARKER_INDEXES", ffmpeg_marker_indexes);
defaults->update("USE_HW_DEV", use_hw_dev);
defaults->update("WARN_INDEXES", warn_indexes);
- defaults->update("WARN_VERSION", warn_version);
+ defaults->update("UNSAFE_GUI", unsafe_gui);
defaults->update("WARN_FILEREF", warn_fileref);
defaults->update("BD_WARN_ROOT", bd_warn_root);
defaults->update("POPUPMENU_BTNUP", popupmenu_btnup);
diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h
index 4b60577a..980e55e0 100644
--- a/cinelerra-5.1/cinelerra/preferences.h
+++ b/cinelerra-5.1/cinelerra/preferences.h
@@ -118,7 +118,7 @@ public:
char use_hw_dev[BCSTRLEN];
// warning
int warn_indexes;
- int warn_version;
+ int unsafe_gui;
int warn_stack;
int warn_fileref;
int bd_warn_root;
---
Naming still a bit off (UseWarnVersion::UseWarnVersion should say UseUnsafeGUI, in appearanceprefs.C)
but at least it *appear* to work ..
PS: this is my first attempt at dynamic GUI changes inside CinGG ..or any other program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2st_try_batchrender_gui_toggle.diff
Type: text/x-diff
Size: 8188 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210113/ebd7445c/attachment-0001.bin>
More information about the Cin
mailing list