add Autosave continuous backups by Andras Reuss and Andrew-R
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / appearanceprefs.C
index b3718b755876affa5e6f5ff72dbc5a43ec8c2690..c80ee26bef23c2a00ff0557087ca65fdbdc33700 100644 (file)
@@ -38,6 +38,7 @@ AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
 {
        hms = 0;
        hmsf = 0;
+       timecode = 0;
        samples = 0;
        frames = 0;
        hex = 0;
@@ -52,6 +53,7 @@ AppearancePrefs::~AppearancePrefs()
 {
        delete hms;
        delete hmsf;
+       delete timecode;
        delete samples;
        delete frames;
        delete hex;
@@ -92,7 +94,12 @@ void AppearancePrefs::create_objects()
        add_subwindow(new BC_Title(x, y, _("Plugin Icons:")));
        add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
        plugin_icons->create_objects();
-       y += plugin_icons->get_h() + ys15;
+       y += plugin_icons->get_h() + ys10;
+       add_subwindow(new BC_Title(x, y, _("Language:")));
+       LayoutLocale *layout_locale;
+       add_subwindow(layout_locale = new LayoutLocale(x1, y, pwindow));
+       layout_locale->create_objects();
+       y += layout_locale->get_h() + ys15;
        x1 = get_w()/2;
 
        int x2 = x1 + xS(160), y2 = y;
@@ -131,6 +138,10 @@ void AppearancePrefs::create_objects()
                pwindow->thread->edl->session->time_format == TIME_HMSF,
                x, y));
        y += ys20;
+       add_subwindow(timecode = new TimeFormatTimecode(pwindow, this,
+               pwindow->thread->edl->session->time_format == TIME_TIMECODE,
+               x, y));
+       y += ys20;
        add_subwindow(samples = new TimeFormatSamples(pwindow, this,
                pwindow->thread->edl->session->time_format == TIME_SAMPLES,
                x, y));
@@ -173,30 +184,28 @@ void AppearancePrefs::create_objects()
        y += ys35;
        add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
        int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
-       int clr_alpha = pwindow->thread->edl->session->cwindow_clear_alpha;
         add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
-               x2, y, xS(80), yS(24), clr_color, clr_alpha));
+               x2, y, xS(80), yS(24), clr_color));
        draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
        cwdw_bg_color->create_objects();
+       x2 += cwdw_bg_color->get_w();
        y += ys35;
 
-       x = x1;
-       add_subwindow(title = new BC_Title(x, y, _("YUV color space:")));
-       x += title->get_w() + margin;
+       add_subwindow(title = new BC_Title(x1, y, _("YUV color space:")));
+       x = x2 - xS(120);
        add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
        yuv_color_space->create_objects();
        y += yuv_color_space->get_h() + ys5;
 
-       x = x1;
-       add_subwindow(title = new BC_Title(x, y, _("YUV color range:")));
-       x += title->get_w() + margin;
+       add_subwindow(title = new BC_Title(x1, y, _("YUV color range:")));
+       x = x2 - xS(100);
        add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
        yuv_color_range->create_objects();
        y += yuv_color_range->get_h() + ys35;
        if( y2 < y ) y2 = y;
 
        add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
-       y += ys15;
+       y += ys35;
 
        x = x0;  y1 = y;
        add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
@@ -205,19 +214,31 @@ 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;
-       UseWarnStack *stack_warn = new UseWarnStack(pwindow, x, y);
-       add_subwindow(stack_warn);
-       y += stack_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;
+       OngoingBackups *ongoing_backups = new OngoingBackups(pwindow, x, y);
+       add_subwindow(ongoing_backups);
+       y += ongoing_backups->get_h() + ys5;
 
        x = get_w() / 3 + xs30;
        y = y1;
-       add_subwindow(title = new BC_Title(x1, y, _("Flags:"), LARGEFONT,
+       add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
                resources->text_default));
        y += title->get_h() + ys10;
        y1 = y;
@@ -256,6 +277,9 @@ void AppearancePrefs::create_objects()
        DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
        add_subwindow(focus_deactivate);
        y += focus_deactivate->get_h() + ys5;
+       AutoRotate *auto_rotate = new AutoRotate(pwindow, x, y);
+       add_subwindow(auto_rotate);
+       y += auto_rotate->get_h() + ys5;
 }
 
 int AppearancePrefs::update(int new_value)
@@ -264,6 +288,7 @@ int AppearancePrefs::update(int new_value)
        pwindow->thread->edl->session->time_format = new_value;
        hms->update(new_value == TIME_HMS);
        hmsf->update(new_value == TIME_HMSF);
+       timecode->update(new_value == TIME_TIMECODE);
        samples->update(new_value == TIME_SAMPLES);
        hex->update(new_value == TIME_SAMPLES_HEX);
        frames->update(new_value == TIME_FRAMES);
@@ -293,6 +318,16 @@ int TimeFormatHMSF::handle_event()
        return 1;
 }
 
+TimeFormatTimecode::TimeFormatTimecode(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
+ : BC_Radial(x, y, value, TIME_TIMECODE_TEXT)
+{ this->pwindow = pwindow; this->tfwindow = tfwindow; }
+
+int TimeFormatTimecode::handle_event()
+{
+       tfwindow->update(TIME_TIMECODE);
+       return 1;
+}
+
 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
  : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
@@ -443,6 +478,42 @@ int ViewPluginIconItem::handle_event()
        return 1;
 }
 
+LayoutLocale::LayoutLocale(int x, int y, PreferencesWindow *pwindow)
+ : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->locale, 1)
+{
+       this->pwindow = pwindow;
+}
+LayoutLocale::~LayoutLocale()
+{
+}
+
+const char *LayoutLocale::locale_list[] = { LOCALE_LIST, 0 };
+
+void LayoutLocale::create_objects()
+{
+       for( const char *tp, **lp=locale_list; (tp=*lp)!=0; ++lp )
+               add_item(new LayoutLocaleItem(this, tp));
+}
+
+int LayoutLocale::handle_event()
+{
+       return 1;
+}
+
+LayoutLocaleItem::LayoutLocaleItem(LayoutLocale *popup, const char *text)
+ : BC_MenuItem(text)
+{
+       this->popup = popup;
+}
+
+int LayoutLocaleItem::handle_event()
+{
+       popup->set_text(get_text());
+       strcpy(popup->pwindow->thread->preferences->locale, get_text());
+       popup->handle_event();
+       return 1;
+}
+
 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
                AppearancePrefs *aprefs, int x, int y)
  : BC_TumbleTextBox(aprefs,
@@ -589,29 +660,31 @@ 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;
+       set_tooltip(_("Save to EDL path option becomes available and will overwrite EDL on disk. \n Warn if jobs/session mismatch option is available but can be unchecked."));
 }
 
-int UseWarnVersion::handle_event()
+int UseUnsafeGUI::handle_event()
 {
-       pwindow->thread->preferences->warn_version = get_value();
+       pwindow->thread->preferences->unsafe_gui = get_value();
        return 1;
 }
 
-UseWarnStack::UseWarnStack(PreferencesWindow *pwindow, int x, int y)
- : BC_CheckBox(x, y, pwindow->thread->preferences->warn_stack,
-       _("Stack warns if reference not modified"))
+OngoingBackups::OngoingBackups(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->ongoing_backups,
+       _("Autosave continuous backups"))
 {
        this->pwindow = pwindow;
+       set_tooltip(_("When you stop Cinelerra, all but the newest 50 will be deleted but you risk \n running out of disk space if you do a lot of work without restarting."));
 }
 
-int UseWarnStack::handle_event()
+int OngoingBackups::handle_event()
 {
-       pwindow->thread->preferences->warn_stack = get_value();
+       pwindow->thread->preferences->ongoing_backups = get_value();
        return 1;
 }
 
@@ -628,6 +701,20 @@ int BD_WarnRoot::handle_event()
        return 1;
 }
 
+UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
+       _("Warn on creating file references"))
+{
+       this->pwindow = pwindow;
+}
+
+int UseWarnFileRef::handle_event()
+{
+       pwindow->thread->preferences->warn_fileref = get_value();
+       return 1;
+}
+
+
 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
  : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
        _("Popups activate on button up"))
@@ -686,6 +773,20 @@ int DeactivateFocusPolicy::handle_event()
        return 1;
 }
 
+AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->auto_rotate != 0,
+       _("Auto rotate ffmpeg media"))
+{
+       this->pwindow = pwindow;
+       set_tooltip(_("Automatically rotates media if legal rotation metadata in file."));
+}
+
+int AutoRotate::handle_event()
+{
+       pwindow->thread->preferences->auto_rotate = get_value();
+       return 1;
+}
+
 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
  : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
        _("Always show next frame"))
@@ -704,6 +805,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()
@@ -733,9 +835,9 @@ int HighlightInverseColor::handle_event()
 
 
 const char *YuvColorSpace::color_space[] = {
-       N_("BT601"),
-       N_("BT709"),
-       N_("BT2020"),
+       N_("BT601"), // COLOR_SPACE_BT601
+       N_("BT709"), // COLOR_SPACE_BT709
+       N_("BT2020"), // COLOR_SPACE_BT2020
 };
 
 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
@@ -777,8 +879,8 @@ int YuvColorSpaceItem::handle_event()
 
 
 const char *YuvColorRange::color_range[] = {
-       N_("JPEG"),
-       N_("MPEG"),
+       N_("JPEG"), // COLOR_RANGE_JPEG
+       N_("MPEG"), // COLOR_RANGE_MPEG
 };
 
 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
@@ -823,6 +925,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()
@@ -836,6 +939,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()
@@ -849,6 +953,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()
@@ -858,8 +963,8 @@ int RectifyAudioToggle::handle_event()
 }
 
 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
-               int x, int y, int w, int h, int color, int alpha)
- : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
+               int x, int y, int w, int h, int color)
+ : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, -1, 1)
 {
        this->pwindow = pwindow;
 }
@@ -881,7 +986,6 @@ void Composer_BG_Color::handle_done_event(int result)
 int Composer_BG_Color::handle_new_color(int color, int alpha)
 {
        pwindow->thread->edl->session->cwindow_clear_color = color;
-       pwindow->thread->edl->session->cwindow_clear_alpha = alpha;
        return 1;
 }