# HG changeset patch # User ib # Date 1390483203 0 # Node ID 28953f22251784e20383fd05f5d4a9ee163d6f66 # Parent 6b17e4932555354f213c690c4b2baf3458e8f34b 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. diff -r 6b17e4932555 -r 28953f222517 gui/dialog/preferences.c --- 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 ) {