diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-01-21 19:12:46 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-01-21 19:12:46 +0000 |
commit | ebdb38271ec4b4045c4e3db4408489a52729d050 (patch) | |
tree | c2b197cbd5fb82bac5a95fcab7f6b9f36b1c9974 /Gui | |
parent | 337542a33163ccb9d836219f8ed202db65401efd (diff) |
- add subcp
- fix some 10l in gui
- fix one 10l bug in subreader
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9057 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r-- | Gui/cfg.c | 1 | ||||
-rw-r--r-- | Gui/interface.c | 9 | ||||
-rw-r--r-- | Gui/interface.h | 1 | ||||
-rw-r--r-- | Gui/mplayer/gtk/fs.c | 7 | ||||
-rw-r--r-- | Gui/mplayer/gtk/opts.c | 88 |
5 files changed, 90 insertions, 16 deletions
@@ -116,6 +116,7 @@ static config_t gui_opts[] = { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL }, { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL }, { "sub_overlap",&suboverlap_enabled,CONF_TYPE_FLAG,0,0,0,NULL }, + { "sub_cp",&sub_cp,CONF_TYPE_STRING,0,0,0,NULL }, { "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL }, { "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL }, #ifdef HAVE_FREETYPE diff --git a/Gui/interface.c b/Gui/interface.c index f757a5cc01..a1c762955d 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -386,6 +386,7 @@ void guiLoadSubtitle( char * name ) mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name ); sub_name=gstrdup( name ); subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); + if ( !subtitles ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); } } #endif @@ -862,7 +863,6 @@ void * gtkSet( int cmd,float fparam, void * vparam ) } else { url_item->next=NULL; URLList=url_item; } return NULL; // --- subtitle -#if defined( USE_OSD ) || defined( USE_SUB ) #ifndef HAVE_FREETYPE case gtkSetFontFactor: font_factor=fparam; @@ -886,7 +886,7 @@ void * gtkSet( int cmd,float fparam, void * vparam ) guiLoadFont(); return NULL; case gtkSetFontEncoding: - if ( subtitle_font_encoding ) free( subtitle_font_encoding ); + gfree( (void **)&subtitle_font_encoding ); subtitle_font_encoding=gstrdup( (char *)vparam ); guiLoadFont(); return NULL; @@ -895,6 +895,11 @@ void * gtkSet( int cmd,float fparam, void * vparam ) guiLoadFont(); return NULL; #endif +#ifdef USE_ICONV + case gtkSetSubEncoding: + gfree( (void **)&sub_cp ); + sub_cp=gstrdup( (char *)vparam ); + break; #endif // --- misc case gtkClearStruct: diff --git a/Gui/interface.h b/Gui/interface.h index 4a4aea6d8a..b2be1f8b82 100644 --- a/Gui/interface.h +++ b/Gui/interface.h @@ -195,6 +195,7 @@ extern char * fsHistory[fsPersistant_MaxPos]; #define gtkSetFontOSDScale 19 #define gtkSetFontEncoding 20 #define gtkSetFontAutoScale 21 +#define gtkSetSubEncoding 22 extern float gtkEquChannels[6][10]; diff --git a/Gui/mplayer/gtk/fs.c b/Gui/mplayer/gtk/fs.c index db91bf739f..98d9c219cb 100644 --- a/Gui/mplayer/gtk/fs.c +++ b/Gui/mplayer/gtk/fs.c @@ -334,7 +334,12 @@ int fs_PersistantHistory( char * subject ) { int i; - for ( i=0;i < fsPersistant_MaxPos;i++ ) if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) return 0; + for ( i=0;i < fsPersistant_MaxPos;i++ ) + if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) + { + char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; + return 0; + } gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] ); for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; fsHistory[0]=gstrdup( subject ); diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c index 897bf7a8c8..6adfd79c2a 100644 --- a/Gui/mplayer/gtk/opts.c +++ b/Gui/mplayer/gtk/opts.c @@ -106,7 +106,11 @@ static GtkWidget * RBFontNoAutoScale, * BRFontAutoScaleWidth, * RBFontAutoSc //static GtkWidget * AutoScale; #endif -#ifdef HAVE_FREETYPE +#ifdef USE_ICONV +static GtkWidget * CBSubEncoding, * ESubEncoding; +#endif + +#if defined( HAVE_FREETYPE ) || defined( USE_ICONV ) static struct { char * name; @@ -137,6 +141,7 @@ static struct { NULL,NULL } }; char * lCEncoding = NULL; +char * lSEncoding = NULL; #endif static int old_audio_driver = 0; @@ -160,7 +165,7 @@ static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer u static void prToggled( GtkToggleButton * togglebutton,gpointer user_data ); static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ); #ifdef HAVE_FREETYPE -static void prEntry( GtkContainer * container,GtkWidget * widget,gpointer user_data ); +static void prEntry( GtkContainer * container,gpointer user_data ); #endif extern int muted; @@ -248,7 +253,7 @@ void ShowPreferences( void ) #endif } - gtk_adjustment_set_value( HSFPS,force_fps ); + gtk_adjustment_set_value( HSFPSadj,force_fps ); // -- 3. page gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled ); @@ -270,6 +275,17 @@ void ShowPreferences( void ) if ( guiIntfStruct.Subtitlename ) gtk_entry_set_text( GTK_ENTRY( ESubtitleName ),guiIntfStruct.Subtitlename ); #endif +#ifdef USE_ICONV + if ( sub_cp ) + { + int i; + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break; + if ( lEncoding[i].name ) lSEncoding=lEncoding[i].comment; + gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lSEncoding ); + } +#endif + // --- 4. page // font ... if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); @@ -411,7 +427,10 @@ void ShowPreferences( void ) gtk_signal_connect( GTK_OBJECT( HSFontOutLine ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)7 ); gtk_signal_connect( GTK_OBJECT( HSFontTextScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)8 ); gtk_signal_connect( GTK_OBJECT( HSFontOSDScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)9 ); - gtk_signal_connect( GTK_OBJECT( EFontEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),NULL ); + gtk_signal_connect( GTK_OBJECT( EFontEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)0 ); +#endif +#ifdef USE_ICONV + gtk_signal_connect( GTK_OBJECT( ESubEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)1 ); #endif gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)10 ); @@ -447,16 +466,32 @@ void HidePreferences( void ) #endif } -#ifdef HAVE_FREETYPE -static void prEntry( GtkContainer * container,GtkWidget * widget,gpointer user_data ) +#if defined( HAVE_FREETYPE ) || defined( USE_ICONV ) +static void prEntry( GtkContainer * container,gpointer user_data ) { - char * comment = gtk_entry_get_text( GTK_ENTRY( EFontEncoding ) ); + char * comment; int i; - - for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; - - if ( lEncoding[i].comment ) gtkSet( gtkSetFontEncoding,0,lEncoding[i].name ); + + switch( (int)user_data ) + { +#ifdef HAVE_FREETYPE + case 0: // font encoding + comment=gtk_entry_get_text( GTK_ENTRY( EFontEncoding ) ); + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; + if ( lEncoding[i].comment ) gtkSet( gtkSetFontEncoding,0,lEncoding[i].name ); + break; +#endif +#ifdef USE_ICONV + case 1: // sub encoding + comment=gtk_entry_get_text( GTK_ENTRY( ESubEncoding ) ); + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; + if ( lEncoding[i].comment ) gtkSet( gtkSetSubEncoding,0,lEncoding[i].name ); + else gtkSet( gtkSetSubEncoding,0,NULL ); + break; +#endif + } } #endif @@ -492,6 +527,8 @@ void prButton( GtkButton * button,gpointer user_data ) flip=-1; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFlip ) ) ) flip=1; + + force_fps=HSFPSadj->value; // -- 3. page suboverlap_enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubOverlap ) ); @@ -502,11 +539,11 @@ void prButton( GtkButton * button,gpointer user_data ) sub_delay=HSSubDelayadj->value; sub_fps=HSSubFPSadj->value; sub_pos=(int)HSSubPositionadj->value; - force_fps=HSFPSadj->value; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDNone ) ) ) osd_level=0; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ) ) ) osd_level=1; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTandP ) ) ) osd_level=2; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ) ) ) osd_level=3; + // --- 4. page guiSetFilename( font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) ); @@ -712,6 +749,7 @@ GtkWidget * create_Preferences( void ) GSList * OSD_group = NULL; GSList * Font_group = NULL; GList * CBFontEncoding_items = NULL; + GList * CBSubEncoding_items = NULL; GtkWidget * vbox7; GtkWidget * vbox8; GtkWidget * table1; @@ -917,6 +955,11 @@ GtkWidget * create_Preferences( void ) label=AddLabel( MSGTR_PREFERENCES_SUB_FPS,NULL ); gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); +#ifdef USE_ICONV + label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); +#endif + HSSubDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10.0,10,0.01,0,0 ) ); HSSubDelay=AddHScaler( HSSubDelayadj,NULL,1 ); gtk_table_attach( GTK_TABLE( table1 ),HSSubDelay,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); @@ -933,6 +976,25 @@ GtkWidget * create_Preferences( void ) gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSSubFPS ),TRUE ); gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); +#ifdef USE_ICONV + CBSubEncoding=gtk_combo_new(); + gtk_widget_set_name( CBSubEncoding,"CBSubEncoding" ); + gtk_widget_show( CBSubEncoding ); + gtk_table_attach( GTK_TABLE( table1 ),CBSubEncoding,1,2,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None ); + { + int i; + for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment ); + } + gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items ); + g_list_free( CBSubEncoding_items ); + + ESubEncoding=GTK_COMBO( CBSubEncoding )->entry; + gtk_widget_set_name( ESubEncoding,"ESubEncoding" ); + gtk_entry_set_editable( GTK_ENTRY( ESubEncoding ),FALSE ); + gtk_widget_show( ESubEncoding ); +#endif + vbox9=AddVBox( vbox8,0 ); CBSubOverlap=AddCheckButton( MSGTR_PREFERENCES_SUB_Overlap,vbox9 ); |