cut with active speed auto correction, add locale pref, mod prores dft profile to...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / appearanceprefs.C
index ddca255e88b005ebd1b9b94c78a2ee2b1023c406..435f70ad1bf6df6a54397e854a0f4ca2ee2ef3fd 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;
@@ -75,9 +77,10 @@ void AppearancePrefs::create_objects()
        int y0 = mwindow->theme->preferencesoptions_y;
        int x = x0, y = y0, x1 = x + xS(100);
 
-       add_subwindow(new BC_Title(x, y, _("Layout:"), LARGEFONT,
+       BC_Title *title;
+       add_subwindow(title = new BC_Title(x, y, _("Layout:"), LARGEFONT,
                resources->text_default));
-       y += ys35;
+       y += title->get_h() + ys10;
        int y1 = y;
 
        ViewTheme *theme;
@@ -91,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, _("Locale:")));
+       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;
@@ -114,21 +122,14 @@ void AppearancePrefs::create_objects()
        vicon_color_mode->create_objects();
        y += vicon_color_mode->get_h() + ys5;
        y = bmax(y, y2);        
-
        y += ys10;
        add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
        y += ys15;
 
-       add_subwindow(new BC_Title(x, y, _("Time Format:"), LARGEFONT,
-               resources->text_default));
-
-       add_subwindow(new BC_Title(x1, y, _("Flags:"), LARGEFONT,
-               resources->text_default));
-
-       y += get_text_height(LARGEFONT) + ys5;
-       y += ys10;
        y1 = y;
-
+       add_subwindow(title = new BC_Title(x, y, _("Time Format:"), LARGEFONT,
+               resources->text_default));
+       y += title->get_h() + ys10;
        add_subwindow(hms = new TimeFormatHMS(pwindow, this,
                pwindow->thread->edl->session->time_format == TIME_HMS,
                x, y));
@@ -137,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));
@@ -153,7 +158,6 @@ void AppearancePrefs::create_objects()
                pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
                x, y));
        x += feet->get_w() + xS(15);
-       BC_Title *title;
        add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
        x += title->get_w() + margin;
        sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
@@ -164,11 +168,10 @@ void AppearancePrefs::create_objects()
        add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
                pwindow->thread->edl->session->time_format == TIME_SECONDS,
                x, y));
-       x = x0;
        y += ys35;
-       add_subwindow(new BC_Bar(xs5, y, get_w()/2 - xs30));
-       y += ys15;
-
+       y2 = y;
+       
+       x = x1;  y = y1;
        add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
                resources->text_default));
        y += ys35;
@@ -177,73 +180,95 @@ void AppearancePrefs::create_objects()
        char hex_color[BCSTRLEN];
        sprintf(hex_color, "%06x", preferences->highlight_inverse);
         add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
-       x2 = x;  x = x0;
+       x2 = x;  x = x1;
        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));
-       draw_3d_border(x2-2,y-2, 80+4,24+4, 1);
+       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 = x0;
-       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 = x0;
-       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() + ys5;
+       y += yuv_color_range->get_h() + ys35;
+       if( y2 < y ) y2 = y;
 
-       UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
-       add_subwindow(tip_win);
-       y1 += tip_win->get_h() + ys5;
-       AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x1, y1);
+       add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
+       y += ys15;
+
+       x = x0;  y1 = y;
+       add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
+               resources->text_default));
+       y += title->get_h() + ys10;
+       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;
+
+       x = get_w() / 3 + xs30;
+       y = y1;
+       add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
+               resources->text_default));
+       y += title->get_h() + ys10;
+       y1 = y;
+       AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
        add_subwindow(autocolor_assets);
-       y1 += autocolor_assets->get_h() + ys5;
-       UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1);
-       add_subwindow(idx_win);
-       y1 += idx_win->get_h() + ys5;
-       UseWarnVersion *ver_win = new UseWarnVersion(pwindow, x1, y1);
-       add_subwindow(ver_win);
-       y1 += ver_win->get_h() + ys5;
-       BD_WarnRoot *bdwr_win = new BD_WarnRoot(pwindow, x1, y1);
-       add_subwindow(bdwr_win);
-       y1 += bdwr_win->get_h() + ys5;
-       PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
+       y += autocolor_assets->get_h() + ys5;
+       PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
+       add_subwindow(perpetual);
+       y += perpetual->get_h() + ys5;
+       RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
+       add_subwindow(rect_toggle);
+       y += rect_toggle->get_h() + ys5;
+       CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
+       add_subwindow(ctrl_toggle);
+       y += ctrl_toggle->get_h() + ys5;
+       ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
+       add_subwindow(displacement);
+       y += displacement->get_h() + ys5;
+       UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
+       add_subwindow(tip_win);
+       y += tip_win->get_h() + ys5;
+
+       x = 2*get_w() / 3 - xs30;
+       y = y1;
+       add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
+       y += thumbnails->get_h() + ys5;
+       PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
        add_subwindow(pop_win);
-       y1 += pop_win->get_h() + ys5;
-       GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x1, y1);
+       y += pop_win->get_h() + ys5;
+       GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
        add_subwindow(grab_input_focus);
-       y1 += grab_input_focus->get_h() + ys5;
-       ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x1, y1);
+       y += grab_input_focus->get_h() + ys5;
+       ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
        add_subwindow(focus_activate);
-       y1 += focus_activate->get_h() + ys5;
-       DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x1, y1);
+       y += focus_activate->get_h() + ys5;
+       DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
        add_subwindow(focus_deactivate);
-       y1 += focus_deactivate->get_h() + ys5;
-       ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x1, y1);
-       add_subwindow(displacement);
-       y1 += displacement->get_h() + ys5;
-       add_subwindow(thumbnails = new ViewThumbnails(x1, y1, pwindow));
-       y1 += thumbnails->get_h() + ys5;
-       PerpetualSession *perpetual = new PerpetualSession(x1, y1, pwindow);
-       add_subwindow(perpetual);
-       y1 += perpetual->get_h() + ys5;
-       CtrlToggle *ctrl_toggle = new CtrlToggle(x1, y1, pwindow);
-       add_subwindow(ctrl_toggle);
-       y1 += ctrl_toggle->get_h() + ys5;
-       RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x1, y1, pwindow);
-       add_subwindow(rect_toggle);
-       y1 += rect_toggle->get_h() + ys5;
-       if( y < y1 ) y = y1;
+       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)
@@ -252,6 +277,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);
@@ -281,6 +307,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; }
@@ -431,6 +467,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,
@@ -603,6 +675,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"))
@@ -661,6 +747,19 @@ 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;
+}
+
+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"))
@@ -708,13 +807,13 @@ 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)
- : BC_PopupMenu(x, y, xS(100),
+ : BC_PopupMenu(x, y, xS(120),
        _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
 {
        this->pwindow = pwindow;
@@ -752,8 +851,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)