RafaMar + programmer friend Help button in Batch Render addition
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / batchrender.C
index 8a89c92560af3aceda806fe923ea3d1a722931e6..6238d6d6808386c2aaf3edd04c2b488b363e4cb5 100644 (file)
@@ -60,6 +60,8 @@
 #include "dvdcreate.h"
 #include "bdcreate.h"
 
+#include <stdlib.h>
+
 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")
@@ -268,9 +270,9 @@ 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)
+                               if (mwindow && mwindow->preferences->unsafe_gui)
                                warn = file.tag.get_property("WARN", 1);
-                               if (!mwindow->preferences->unsafe_gui)
+                               if (mwindow && !mwindow->preferences->unsafe_gui)
                                warn = 0;
                        }
                        else if( file.tag.title_is("JOB") ) {
@@ -296,7 +298,7 @@ void BatchRenderThread::save_jobs(char *path)
 {
        FileXML file;
        file.tag.set_title("JOBS");
-       if (mwindow->preferences->unsafe_gui)
+       if (mwindow && mwindow->preferences->unsafe_gui)
        file.tag.set_property("WARN", warn);
        file.append_tag();
        file.append_newline();
@@ -833,8 +835,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));
 
@@ -919,10 +923,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;
 }
 
@@ -1430,6 +1436,20 @@ int BatchRenderCancel::keypress_event()
        return 0;
 }
 
+//new help button
+BatchRenderHelp::BatchRenderHelp(BatchRenderThread *thread, int x, int y)
+ : BC_GenericButton(x, y, _("?"))
+{
+       this->thread = thread;
+       set_tooltip(_("Open quick start guide"));
+}
+
+int BatchRenderHelp::handle_event()
+{
+       system("$CIN_BROWSER file://$CIN_DAT/doc/help_br_index.html");
+       return 0;
+}
+
 BatchRenderUseFarm::BatchRenderUseFarm(BatchRenderThread *thread, int x, int y, int *output)
  : BC_CheckBox(x, y, *output, _("Use render farm"))
 {