diff options
Diffstat (limited to 'Gui')
-rw-r--r-- | Gui/cfg.c | 10 | ||||
-rw-r--r-- | Gui/cfg.h | 14 | ||||
-rw-r--r-- | Gui/interface.c | 21 | ||||
-rw-r--r-- | Gui/mplayer/gtk/common.c | 15 | ||||
-rw-r--r-- | Gui/mplayer/gtk/common.h | 1 | ||||
-rw-r--r-- | Gui/mplayer/gtk/opts.c | 73 |
6 files changed, 134 insertions, 0 deletions
@@ -73,6 +73,10 @@ int gui_main_pos_x = -2; int gui_main_pos_y = -2; int gui_sub_pos_x = -1; int gui_sub_pos_y = -1; + +#ifdef USE_ASS +gtkASS_t gtkASS; +#endif // --- extern char * get_path( const char * filename ); @@ -139,6 +143,12 @@ static m_option_t gui_opts[] = { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,3,NULL }, { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL }, { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL }, +#ifdef USE_ASS + { "ass_enabled",&ass_enabled,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ass_use_margins",&ass_use_margins,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ass_top_margin",&ass_top_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL }, + { "ass_bottom_margin",&ass_bottom_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL }, +#endif { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL }, { "sub_overlap",&suboverlap_enabled,CONF_TYPE_FLAG,0,0,0,NULL }, #ifdef USE_ICONV @@ -57,6 +57,20 @@ extern int gui_main_pos_y; extern int gui_sub_pos_x; extern int gui_sub_pos_y; +#ifdef USE_ASS +typedef struct { + int enabled; + int use_margins; + int top_margin; + int bottom_margin; +} gtkASS_t; +extern gtkASS_t gtkASS; +extern int ass_enabled; +extern int ass_use_margins; +extern int ass_top_margin; +extern int ass_bottom_margin; +#endif + extern int cfg_read( void ); extern int cfg_write( void ); diff --git a/Gui/interface.c b/Gui/interface.c index b2ef7247e0..00b12837a5 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -216,6 +216,13 @@ void guiInit( void ) else if ( stream_cache_size == 0 ) gtkCacheOn = 0; if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; } +#ifdef USE_ASS + gtkASS.enabled = ass_enabled; + gtkASS.use_margins = ass_use_margins; + gtkASS.top_margin = ass_top_margin; + gtkASS.bottom_margin = ass_bottom_margin; +#endif + gtkInit(); // --- initialize X wsXInit( (void *)mDisplay ); @@ -388,6 +395,13 @@ void guiDone( void ) gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y; gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y; } + +#ifdef USE_ASS + ass_enabled = gtkASS.enabled; + ass_use_margins = gtkASS.use_margins; + ass_top_margin = gtkASS.top_margin; + ass_bottom_margin = gtkASS.bottom_margin; +#endif cfg_write(); wsXDone(); @@ -923,6 +937,13 @@ int guiGetEvent( int type,char * arg ) guiIntfStruct.FilenameChanged=0; guiIntfStruct.NewPlay=0; +#ifdef USE_ASS + ass_enabled = gtkASS.enabled; + ass_use_margins = gtkASS.use_margins; + ass_top_margin = gtkASS.top_margin; + ass_bottom_margin = gtkASS.bottom_margin; +#endif + break; } return False; diff --git a/Gui/mplayer/gtk/common.c b/Gui/mplayer/gtk/common.c index d3e0615a6c..7a21969e2f 100644 --- a/Gui/mplayer/gtk/common.c +++ b/Gui/mplayer/gtk/common.c @@ -97,6 +97,21 @@ GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * paren return RB; } +GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ) +{ + GtkWidget * SB; + GtkWidget * label; + label=gtk_label_new( title ); + gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); + gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); + gtk_widget_show( label ); + SB=gtk_spin_button_new( adj,0,0 ); + gtk_widget_set_name( SB,"SB" ); + gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 ); + gtk_widget_show( SB ); + return SB; +} + GtkWidget * AddButton( const char * title,GtkWidget * parent ) { GtkWidget * B; diff --git a/Gui/mplayer/gtk/common.h b/Gui/mplayer/gtk/common.h index 9b26ec9f76..d68a977622 100644 --- a/Gui/mplayer/gtk/common.h +++ b/Gui/mplayer/gtk/common.h @@ -12,6 +12,7 @@ extern GtkWidget * AddVBox( GtkWidget * parent,int type ); extern GtkWidget * AddHBox( GtkWidget * parent,int type ); extern GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ); extern GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent ); +extern GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ); extern GtkWidget * AddButton( const char * title,GtkWidget * parent ); extern GtkWidget * AddHSeparator( GtkWidget * parent ); extern GtkWidget * AddHButtonBox( GtkWidget * parent ); diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c index d082b0d054..6c1af1973c 100644 --- a/Gui/mplayer/gtk/opts.c +++ b/Gui/mplayer/gtk/opts.c @@ -67,6 +67,10 @@ static GtkWidget * CBSubUnicode; static GtkWidget * CBSubOverlap; static GtkWidget * CBDumpMPSub; static GtkWidget * CBDumpSrt; +static GtkWidget * CBUseASS; +static GtkWidget * CBASSUseMargins; +static GtkWidget * SBASSTopMargin; +static GtkWidget * SBASSBottomMargin; static GtkWidget * CBPostprocess; static GtkWidget * CBCache; static GtkWidget * CBLoadFullscreen; @@ -259,6 +263,20 @@ void ShowPreferences( void ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ),gtkSubDumpMPSub ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpSrt ),gtkSubDumpSrt ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubUnicode ),sub_unicode ); +#ifdef USE_ASS + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBUseASS ),gtkASS.enabled ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ),gtkASS.use_margins ); + gtk_spin_button_set_value( (GtkSpinButton *)SBASSTopMargin,(gdouble)gtkASS.top_margin ); + gtk_spin_button_set_value( (GtkSpinButton *)SBASSBottomMargin,(gdouble)gtkASS.bottom_margin ); + + if ( !gtkASS.enabled ) + { + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); + } +#endif + gtk_adjustment_set_value( HSSubDelayadj,sub_delay ); gtk_adjustment_set_value( HSSubFPSadj,sub_fps ); gtk_adjustment_set_value( HSSubPositionadj,sub_pos ); @@ -394,6 +412,13 @@ void ShowPreferences( void ) gtk_widget_set_sensitive( HSSubFPS,FALSE ); #endif +#ifndef USE_ASS + gtk_widget_set_sensitive( CBUseASS,FALSE ); + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); +#endif + #ifndef USE_OSD gtk_widget_set_sensitive( RBOSDNone,FALSE ); gtk_widget_set_sensitive( RBOSDTandP,FALSE ); @@ -421,6 +446,9 @@ void ShowPreferences( void ) #endif gtk_signal_connect( GTK_OBJECT( CBCache ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)8); gtk_signal_connect( GTK_OBJECT( CBAutoSync ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)9); +#ifdef USE_ASS + gtk_signal_connect( GTK_OBJECT( CBUseASS ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)10); +#endif gtk_signal_connect( GTK_OBJECT( HSExtraStereoMul ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)0 ); gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)1 ); @@ -539,6 +567,12 @@ void prButton( GtkButton * button,gpointer user_data ) gtkSubDumpMPSub=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ) ); gtkSubDumpSrt=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpSrt ) ); sub_unicode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubUnicode ) ); +#ifdef USE_ASS + gtkASS.enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ); + gtkASS.use_margins=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ) ); + gtkASS.top_margin=gtk_spin_button_get_value( GTK_SPIN_BUTTON( SBASSTopMargin ) ); + gtkASS.bottom_margin=gtk_spin_button_get_value( GTK_SPIN_BUTTON( SBASSBottomMargin ) ); +#endif sub_delay=HSSubDelayadj->value; sub_fps=HSSubFPSadj->value; sub_pos=(int)HSSubPositionadj->value; @@ -721,6 +755,22 @@ static void prToggled( GtkToggleButton * togglebutton,gpointer user_data ) if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) gtk_widget_set_sensitive( SBAutoSync,TRUE ); else gtk_widget_set_sensitive( SBAutoSync,FALSE ); break; +#ifdef USE_ASS + case 10: + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ) ) + { + gtk_widget_set_sensitive( CBASSUseMargins,TRUE ); + gtk_widget_set_sensitive( SBASSTopMargin,TRUE ); + gtk_widget_set_sensitive( SBASSBottomMargin,TRUE ); + } + else + { + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); + } + break; +#endif } } @@ -790,6 +840,10 @@ GtkWidget * create_Preferences( void ) GtkWidget * hbuttonbox1; GtkAccelGroup * accel_group; + GtkWidget * hbox9; + GtkWidget * hbox91; + GtkWidget * hbox92; + accel_group=gtk_accel_group_new(); Preferences=gtk_window_new( GTK_WINDOW_TOPLEVEL ); @@ -1028,6 +1082,25 @@ GtkWidget * create_Preferences( void ) CBDumpMPSub=AddCheckButton( MSGTR_PREFERENCES_SUB_MPSUB,vbox9 ); CBDumpSrt=AddCheckButton( MSGTR_PREFERENCES_SUB_SRT,vbox9 ); + AddHSeparator( vbox9 ); + CBUseASS=AddCheckButton( MSGTR_PREFERENCES_SUB_USE_ASS,vbox9 ); + hbox9=AddHBox( vbox9,0 ); + CBASSUseMargins=AddCheckButton( MSGTR_PREFERENCES_SUB_ASS_USE_MARGINS,hbox9 ); + + hbox91=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox91,"hbox91" ); + gtk_box_pack_start( GTK_BOX( hbox9 ),hbox91,TRUE,FALSE,0 ); + gtk_widget_show( hbox91 ); + SBASSTopMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_TOP_MARGIN, + (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox91 ); + + hbox92=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox92,"hbox92" ); + gtk_box_pack_start( GTK_BOX( hbox9 ),hbox92,TRUE,FALSE,0 ); + gtk_widget_show( hbox92 ); + SBASSBottomMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_BOTTOM_MARGIN, + (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox92 ); + label=AddLabel( MSGTR_PREFERENCES_SubtitleOSD,NULL ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),2 ),label ); vbox601=AddVBox( notebook1,0 ); |