[MPlayer-cvslog] r36754 - in trunk/gui: dialog/fileselect.c interface.c interface.h

ib subversion at mplayerhq.hu
Sun Jan 26 18:16:29 CET 2014


Author: ib
Date: Sun Jan 26 18:16:29 2014
New Revision: 36754

Log:
Relocate mplayerLoadFont() code.

Add a mplayer() instruction MPLAYER_LOAD_FONT
and make it part of this function.

Modified:
   trunk/gui/dialog/fileselect.c
   trunk/gui/interface.c
   trunk/gui/interface.h

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Sun Jan 26 18:05:33 2014	(r36753)
+++ trunk/gui/dialog/fileselect.c	Sun Jan 26 18:16:29 2014	(r36754)
@@ -507,7 +507,7 @@ static void fs_Ok_released(GtkButton *bu
 
     case FILESELECT_FONT:
         setddup(&font_name, fsSelectedDirectory, fsSelectedFile);
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
 
         if (Preferences)
             gtk_entry_set_text(GTK_ENTRY(prEFontName), font_name);

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Sun Jan 26 18:05:33 2014	(r36753)
+++ trunk/gui/interface.c	Sun Jan 26 18:16:29 2014	(r36754)
@@ -959,38 +959,66 @@ void mplayer(int what, float value, void
 
     case MPLAYER_SET_FONT_FACTOR:
         font_factor = value;
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_OUTLINE:
         subtitle_font_thickness = 8.0 * value / 100.0;   // transform 0..100 to 0..8
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_BLUR:
         subtitle_font_radius = 8.0 * value / 100.0;      // transform 0..100 to 0..8
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_TEXTSCALE:
         text_font_scale_factor = value;
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_OSDSCALE:
         osd_font_scale_factor = value;
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_ENCODING:
         nfree(subtitle_font_encoding);
         subtitle_font_encoding = gstrdup((char *)data);
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
         break;
 
     case MPLAYER_SET_FONT_AUTOSCALE:
         subtitle_autoscale = (int)value;
-        mplayerLoadFont();
+        mplayer(MPLAYER_LOAD_FONT, 0, 0);
+        break;
+
+    case MPLAYER_LOAD_FONT:
+#ifdef CONFIG_FREETYPE
+        set_fontconfig();
+
+        force_load_font = 1;
+#else
+        free_font_desc(vo_font);
+
+        if (font_name) {
+            vo_font = read_font_desc(font_name, font_factor, 0);
+
+            if (!vo_font)
+                gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name);
+        } else {
+            char *fname = get_path("font/font.desc");
+
+            setdup(&font_name, fname);
+            free(fname);
+            vo_font = read_font_desc(font_name, font_factor, 0);
+
+            if (!vo_font) {
+                setdup(&font_name, MPLAYER_DATADIR "/font/font.desc");
+                vo_font = read_font_desc(font_name, font_factor, 0);
+            }
+        }
+#endif
         break;
 
     case MPLAYER_SET_SUB_ENCODING:
@@ -1080,35 +1108,6 @@ void mplayer(int what, float value, void
     }
 }
 
-void mplayerLoadFont(void)
-{
-#ifdef CONFIG_FREETYPE
-    set_fontconfig();
-
-    force_load_font = 1;
-#else
-    free_font_desc(vo_font);
-
-    if (font_name) {
-        vo_font = read_font_desc(font_name, font_factor, 0);
-
-        if (!vo_font)
-            gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name);
-    } else {
-        char *fname = get_path("font/font.desc");
-
-        setdup(&font_name, fname);
-        free(fname);
-        vo_font = read_font_desc(font_name, font_factor, 0);
-
-        if (!vo_font) {
-            setdup(&font_name, MPLAYER_DATADIR "/font/font.desc");
-            vo_font = read_font_desc(font_name, font_factor, 0);
-        }
-    }
-#endif
-}
-
 void mplayerLoadSubtitle(const char *name)
 {
     if (guiInfo.Playing == GUI_STOP)

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Sun Jan 26 18:05:33 2014	(r36753)
+++ trunk/gui/interface.h	Sun Jan 26 18:16:29 2014	(r36754)
@@ -76,6 +76,7 @@ enum {
 /// mplayer() instructions
 enum {
     MPLAYER_EXIT_GUI,
+    MPLAYER_LOAD_FONT,
     MPLAYER_SET_AUTO_QUALITY,
     MPLAYER_SET_BRIGHTNESS,
     MPLAYER_SET_CONTRAST,
@@ -150,7 +151,6 @@ int guiPlaylist(int what, play_tree_t *p
 /// @name GUI -> MPlayer
 //@{
 void mplayer(int what, float value, void *data);
-void mplayerLoadFont(void);
 void mplayerLoadSubtitle(const char *name);
 void gmp_msg(int mod, int lev, const char *format, ...);
 //@}


More information about the MPlayer-cvslog mailing list