[MPlayer-cvslog] r38615 - trunk/gui/dialog/preferences.c

ib subversion at mplayerhq.hu
Mon Jun 24 21:15:13 EEST 2024


Author: ib
Date: Mon Jun 24 21:15:13 2024
New Revision: 38615

Log:
Keep old osd_font_scale_factor value when canceling the preferences dialog.

Check its current value and reset it if necessary when canceling the
dialog.

Also, do not set it when pressing OK, because prHScaleChanged() will
have already done so if it has been changed.

Moreover, set its initial value when creating the dialog.

Modified:
   trunk/gui/dialog/preferences.c

Modified: trunk/gui/dialog/preferences.c
==============================================================================
--- trunk/gui/dialog/preferences.c	Mon Jun 24 21:14:23 2024	(r38614)
+++ trunk/gui/dialog/preferences.c	Mon Jun 24 21:15:13 2024	(r38615)
@@ -224,6 +224,7 @@ static int old_sub_pos;
 static float old_subtitle_font_radius;
 static float old_subtitle_font_thickness;
 static float old_text_font_scale_factor;
+static float old_osd_font_scale_factor;
 #endif
 
 static GtkWidget *AudioConfig;
@@ -372,7 +373,6 @@ static void prButton( GtkButton * button
         /* 4th page */
         setdup( &font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) );
 #ifdef CONFIG_FREETYPE
-        mplayer( MPLAYER_SET_FONT_OSDSCALE,gtk_adjustment_get_value(HSFontOSDScaleadj),0 );
         if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ) ) ) mplayer( MPLAYER_SET_FONT_AUTOSCALE,0,0 );
         if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ) ) ) mplayer( MPLAYER_SET_FONT_AUTOSCALE,1,0 );
         if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ) ) ) mplayer( MPLAYER_SET_FONT_AUTOSCALE,2,0 );
@@ -442,6 +442,7 @@ static void prButton( GtkButton * button
         if (subtitle_font_radius != old_subtitle_font_radius) mplayer(MPLAYER_SET_FONT_BLUR, old_subtitle_font_radius / 8.0 * 100.0, 0); // transform 0..8 to 0..100
         if (subtitle_font_thickness != old_subtitle_font_thickness) mplayer(MPLAYER_SET_FONT_OUTLINE, old_subtitle_font_thickness  / 8.0 * 100.0, 0); // transform 0..8 to 0..100
         if (text_font_scale_factor != old_text_font_scale_factor) mplayer(MPLAYER_SET_FONT_TEXTSCALE, old_text_font_scale_factor, 0);
+        if (osd_font_scale_factor != old_osd_font_scale_factor) mplayer(MPLAYER_SET_FONT_OSDSCALE, old_osd_font_scale_factor, 0);
 #endif
 destroy:
         gtk_widget_destroy( Preferences );
@@ -1063,7 +1064,8 @@ static GtkWidget * CreatePreferences( vo
   label=gtkAddLabelColon( _(MSGTR_GUI_SizeOSD),NULL );
     gtk_table_attach( GTK_TABLE( table1 ),label,0,1,5,6,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
 
-  HSFontOSDScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) );
+  old_osd_font_scale_factor = osd_font_scale_factor;
+  HSFontOSDScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( osd_font_scale_factor,0,100,0.1,0,0 ) );
   HSFontOSDScale=gtkAddHScale( HSFontOSDScaleadj,NULL,1 );
     gtk_table_attach( GTK_TABLE( table1 ),HSFontOSDScale,1,2,5,6,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
 #else
@@ -1442,7 +1444,6 @@ void ShowPreferences( void )
  /* font ... */
  if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
 #ifdef CONFIG_FREETYPE
- gtk_adjustment_set_value( HSFontOSDScaleadj,osd_font_scale_factor );
  {
   int i;
   const char *s = (subtitle_font_encoding ? subtitle_font_encoding : ENC_UNICODE);


More information about the MPlayer-cvslog mailing list