yuv colorspace/range + prefs, ffmpeg colorrange probe, x11 direct force colormodel...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / appearanceprefs.C
index 46badb85276be26b9a0c7e14bdfdcf0bc6b45558..90b39c0028d568a651e4dd368514a7eeac8fb232 100644 (file)
 #include "theme.h"
 
 
-#define MOVE_ALL_EDITS_TITLE N_("Drag all following edits")
-#define MOVE_ONE_EDIT_TITLE N_("Drag only one edit")
-#define MOVE_NO_EDITS_TITLE N_("Drag source only")
-#define MOVE_EDITS_DISABLED_TITLE N_("No effect")
-
-
 AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
  : PreferencesDialog(mwindow, pwindow)
 {
@@ -148,6 +142,20 @@ void AppearancePrefs::create_objects()
         add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
        y += 35;
 
+       x = x0;
+       add_subwindow(title = new BC_Title(x, y, _("YUV color space:")));
+       x += title->get_w() + margin;
+       add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
+       yuv_color_space->create_objects();
+       y += yuv_color_space->get_h() + 5;
+
+       x = x0;
+       add_subwindow(title = new BC_Title(x, y, _("YUV color range:")));
+       x += title->get_w() + margin;
+       add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
+       yuv_color_range->create_objects();
+       y += yuv_color_range->get_h() + 5;
+
        UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
        add_subwindow(tip_win);
        y1 += tip_win->get_h() + 5;
@@ -332,14 +340,15 @@ void ViewPluginIcons::create_objects()
        add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
        FileSystem fs;
        const char *plugin_path = File::get_plugin_path();
-       if( fs.update(plugin_path) ) return;
+       char picon_path[BCTEXTLEN];
+       snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
+       if( fs.update(picon_path) ) return;
        for( int i=0; i<fs.dir_list.total; ++i ) {
                char *fs_path = fs.dir_list[i]->path;
                if( !fs.is_dir(fs_path) ) continue;
                char *cp = strrchr(fs_path,'/');
                cp = !cp ? fs_path : cp+1;
-               if( strncmp("picon_", cp, 6) ) continue;
-               if( !strcmp(cp += 6,DEFAULT_PICON) ) continue;
+               if( !strcmp(cp,DEFAULT_PICON) ) continue;
                add_item(new ViewPluginIconItem(this, cp));
        }
 }
@@ -516,8 +525,99 @@ HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x,
 int HighlightInverseColor::handle_event()
 {
        int inverse_color = strtoul(get_text(),0,16);
-       inverse_color &= 0xffffff;
+       if( (inverse_color &= 0xffffff) == 0 ) {
+               inverse_color = 0xffffff;
+               char string[BCSTRLEN];
+               sprintf(string,"%06x", inverse_color);
+               update(string);
+       }
        pwindow->thread->preferences->highlight_inverse = inverse_color;
        return 1;
 }
 
+
+const char *YuvColorSpace::color_space[] = {
+       N_("BT601"),
+       N_("BT709"),
+};
+
+YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
+ : BC_PopupMenu(x, y, 100,
+       _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
+{
+       this->pwindow = pwindow;
+}
+YuvColorSpace::~YuvColorSpace()
+{
+}
+
+void YuvColorSpace::create_objects()
+{
+       for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
+               add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
+       handle_event();
+}
+
+int YuvColorSpace::handle_event()
+{
+       set_text(color_space[pwindow->thread->preferences->yuv_color_space]);
+       return 1;
+}
+
+YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
+ : BC_MenuItem(text)
+{
+       this->popup = popup;
+       this->id = id;
+}
+
+int YuvColorSpaceItem::handle_event()
+{
+       popup->set_text(get_text());
+       popup->pwindow->thread->preferences->yuv_color_space = id;
+       return popup->handle_event();
+}
+
+
+const char *YuvColorRange::color_range[] = {
+       N_("JPEG"),
+       N_("MPEG"),
+};
+
+YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
+ : BC_PopupMenu(x, y, 100,
+       _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
+{
+       this->pwindow = pwindow;
+}
+YuvColorRange::~YuvColorRange()
+{
+}
+
+void YuvColorRange::create_objects()
+{
+       for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
+               add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
+       handle_event();
+}
+
+int YuvColorRange::handle_event()
+{
+       set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
+       return 1;
+}
+
+YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
+ : BC_MenuItem(text)
+{
+       this->popup = popup;
+       this->id = id;
+}
+
+int YuvColorRangeItem::handle_event()
+{
+       popup->set_text(get_text());
+       popup->pwindow->thread->preferences->yuv_color_range = id;
+       return popup->handle_event();
+}
+