batch render solution for unsafe buttons by Andrew +
authorGood Guy <[email protected]>
Mon, 18 Jan 2021 05:36:34 +0000 (22:36 -0700)
committerGood Guy <[email protected]>
Mon, 18 Jan 2021 05:36:34 +0000 (22:36 -0700)
cinelerra-5.1/cinelerra/appearanceprefs.C
cinelerra-5.1/cinelerra/appearanceprefs.h
cinelerra-5.1/cinelerra/batchrender.C
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/preferences.h

index 1f87883551ba69b5096b71932046dd05437ec904..31729d576569edf7126b65acfa93ddd52096e75d 100644 (file)
@@ -214,15 +214,25 @@ void AppearancePrefs::create_objects()
        UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
        add_subwindow(idx_warn);
        y += idx_warn->get_h() + ys5;
-       UseWarnVersion *ver_warn = new UseWarnVersion(pwindow, x, y);
-       add_subwindow(ver_warn);
-       y += ver_warn->get_h() + ys5;
        BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
        add_subwindow(bdwr_warn);
        y += bdwr_warn->get_h() + ys5;
        UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
        add_subwindow(warn_ref);
        y += warn_ref->get_h() + ys5;
+       
+       add_subwindow(new BC_Bar(x0, y, warn_ref->get_w()-x0 - xs30));
+       y += ys15;
+
+       add_subwindow(title = new BC_Title(x, y, _("Dangerous:"), LARGEFONT,
+               resources->text_default));
+       y += title->get_h() + ys10;
+
+       
+       UseUnsafeGUI *unsafe_gui = new UseUnsafeGUI(pwindow, x, y);
+       add_subwindow(unsafe_gui);
+       y += unsafe_gui->get_h() + ys5;
+
 
        x = get_w() / 3 + xs30;
        y = y1;
@@ -648,16 +658,16 @@ int UseWarnIndecies::handle_event()
        return 1;
 }
 
-UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
- : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
-       _("EDL version warns if mismatched"))
+UseUnsafeGUI::UseUnsafeGUI(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->unsafe_gui,
+       _("Unsafe GUI in batchrender"))
 {
        this->pwindow = pwindow;
 }
 
-int UseWarnVersion::handle_event()
+int UseUnsafeGUI::handle_event()
 {
-       pwindow->thread->preferences->warn_version = get_value();
+       pwindow->thread->preferences->unsafe_gui = get_value();
        return 1;
 }
 
@@ -751,6 +761,7 @@ AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
        _("Auto rotate ffmpeg media"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("Automatically rotates media if legal rotation metadata included."));
 }
 
 int AutoRotate::handle_event()
@@ -777,6 +788,7 @@ AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
        _("Autocolor assets"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("Displays automatically generated color overlay for the \n edits on the timeline that belong to the same media file."));
 }
 
 int AutocolorAssets::handle_event()
@@ -896,6 +908,7 @@ PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
        pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("Resume previous session on startup with undo/redo stack saved between sessions. \n On startup, previous project is loaded as if there was no stoppage."));
 }
 
 int PerpetualSession::handle_event()
@@ -909,6 +922,7 @@ CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
        pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("Drag and Drop editing - when using LMB on edit,\n clears all selected edits except this one."));
 }
 
 int CtrlToggle::handle_event()
@@ -922,6 +936,7 @@ RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
        pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("Displays rectified audio showing only positive half of the waveform \n resulting in waveform stretched more over the height of the track."));
 }
 
 int RectifyAudioToggle::handle_event()
index c7d95ecbfea6db90745662e54ba15acb8202514f..5bde37be400496afceb760aee7137a71288a4dce 100644 (file)
@@ -278,10 +278,10 @@ public:
        PreferencesWindow *pwindow;
 };
 
-class UseWarnVersion : public BC_CheckBox
+class UseUnsafeGUI : public BC_CheckBox
 {
 public:
-       UseWarnVersion(PreferencesWindow *pwindow, int x, int y);
+       UseUnsafeGUI(PreferencesWindow *pwindow, int x, int y);
        int handle_event();
        PreferencesWindow *pwindow;
 };
index 6dcdbc62f69fd7bf8fcd0015f011de87b2e93786..27cd834288e78a1d79c25bffbdee0eb6ec1b42fb 100644 (file)
@@ -268,7 +268,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 +296,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();
@@ -387,6 +391,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) ) {
@@ -394,6 +401,7 @@ void BatchRenderThread::update_selected_edl()
                sprintf(msg, _("Unable to save: %s"), path);
                MainError::show_error(msg);
        }
+       }
 }
 
 BatchRenderJob* BatchRenderThread::get_current_job()
@@ -792,8 +800,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();
@@ -805,8 +815,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;
 
@@ -835,6 +847,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 +857,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 +890,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);
@@ -889,8 +905,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;
@@ -1044,6 +1061,7 @@ BatchRenderNew::BatchRenderNew(BatchRenderThread *thread,
  : BC_GenericButton(x, y, _("New"))
 {
        this->thread = thread;
+       set_tooltip(_("Create a new batch"));
 }
 
 int BatchRenderNew::handle_event()
@@ -1056,6 +1074,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()
@@ -1228,6 +1247,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()
@@ -1242,6 +1262,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()
@@ -1343,6 +1364,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()
@@ -1355,6 +1377,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()
@@ -1370,6 +1393,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()
@@ -1382,6 +1406,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()
index ad92bac8bd9979b2acb629fab291da7cef8d102c..e517f2f3dadb72390ef228ee4fc7c80dc493d973 100644 (file)
@@ -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 = 0;
        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);
index 4b60577ab9f2b7dab56422b3a831b1ee6d2b2e1b..980e55e0889a4bdd1af208d221d3ad93b44cadcb 100644 (file)
@@ -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;