changeset 36608:28953f222517

Improve the dialog for font encodings. Allow a (preset) encoding that is not part of the list of available encodings. Insert this encoding into the selection list.
author ib
date Thu, 23 Jan 2014 13:20:03 +0000
parents 6b17e4932555
children d1c130f9ce61
files gui/dialog/preferences.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/preferences.c	Thu Jan 23 12:09:37 2014 +0000
+++ b/gui/dialog/preferences.c	Thu Jan 23 13:20:03 2014 +0000
@@ -232,6 +232,7 @@
         for ( i=0;lEncoding[i].name;i++ )
 	  if ( !gstrcmp( lEncoding[i].comment,comment ) ) break;
 	if ( lEncoding[i].comment ) mplayer( MPLAYER_SET_FONT_ENCODING,0,lEncoding[i].name );
+	else mplayer( MPLAYER_SET_FONT_ENCODING,0,(char *)comment );
 	break;
 #endif
 #ifdef CONFIG_ICONV
@@ -909,7 +910,7 @@
   gtk_widget_show( CBFontEncoding );
   gtk_table_attach( GTK_TABLE( table1 ),CBFontEncoding,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
   {
-   int i, append;
+   int i, append, listed=(subtitle_font_encoding == NULL);
    for ( i=0;lEncoding[i].name;i++ )
    {
     append=(strcasecmp( lEncoding[i].name,"UNICODE" ) == 0);
@@ -922,8 +923,15 @@
      append=True;
     }
 #endif
-    if ( append ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment );
+    if ( append )
+    {
+     CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment );
+
+     if ( !listed )
+      if ( strcasecmp ( lEncoding[i].name, subtitle_font_encoding ) == 0 ) listed=True;
+    }
    }
+   if ( !listed ) CBFontEncoding_items=g_list_insert( CBFontEncoding_items,subtitle_font_encoding,1 );
   }
   gtk_combo_set_popdown_strings( GTK_COMBO( CBFontEncoding ),CBFontEncoding_items );
   g_list_free( CBFontEncoding_items );
@@ -1304,6 +1312,7 @@
   for ( i=0;lEncoding[i].name;i++ )
    if ( !strcasecmp( s,lEncoding[i].name ) ) break;
   if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lEncoding[i].comment );
+  else gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),s );
  }
  switch ( subtitle_autoscale )
   {