[vlc-devel] [PATCH 1/5] macosx: Reenable subtitles menu, use "sub-text-scale" for size

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Fri Jun 16 15:46:28 CEST 2017


From: David Fuhrmann <dfuhrmann at videolan.org>

Use "sub-text-scale" to switch between different text sizes.
This replaces the "freetype-rel-fontsize" config which was used
before.

refs #16185
---
 modules/gui/macosx/VLCMainMenu.m | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 502e101..98f7db0 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -262,14 +262,29 @@ - (void)awakeFromNib
     [self refreshAudioDeviceList];
 
     /* setup subtitles menu */
-#warning subtitles styles menu disabled due to missing adaptation to VLC 3.0
-#if 0
-    [self setupMenu: _subtitle_sizeMenu withIntList:"freetype-rel-fontsize" andSelector:@selector(switchSubtitleOption:)];
     [self setupMenu: _subtitle_textcolorMenu withIntList:"freetype-color" andSelector:@selector(switchSubtitleOption:)];
     [_subtitle_bgopacity_sld setIntValue: config_GetInt(VLC_OBJECT(p_intf), "freetype-background-opacity")];
     [self setupMenu: _subtitle_bgcolorMenu withIntList:"freetype-background-color" andSelector:@selector(switchSubtitleOption:)];
     [self setupMenu: _subtitle_outlinethicknessMenu withIntList:"freetype-outline-thickness" andSelector:@selector(switchSubtitleOption:)];
-#endif
+
+    /* Build size menu based on different scale factors */
+    struct {
+        const char *const name;
+        int scaleValue;
+    } scaleValues[] = {
+        { N_("Smaller"), 50},
+        { N_("Small"),   75},
+        { N_("Normal"), 100},
+        { N_("Large"),  125},
+        { N_("Larger"), 150},
+        { NULL, 0 }
+    };
+
+    for(int i = 0; scaleValues[i].name; i++) {
+        NSMenuItem *menuItem = [_subtitle_sizeMenu addItemWithTitle: _NS(scaleValues[i].name) action:@selector(switchSubtitleSize:) keyEquivalent:@""];
+        [menuItem setTag:scaleValues[i].scaleValue];
+        [menuItem setTarget: self];
+    }
 }
 
 - (void)setupMenu: (NSMenu*)menu withIntList: (char *)psz_name andSelector:(SEL)selector
@@ -1018,6 +1033,18 @@ - (IBAction)addSubtitleFile:(id)sender
         [[VLCCoreInteraction sharedInstance] addSubtitlesToCurrentInput:[openPanel URLs]];
 }
 
+- (void)switchSubtitleSize:(id)sender
+{
+    int intValue = [sender tag];
+
+    vout_thread_t *vout = getVout();
+    if (vout) {
+        var_SetInteger(vout, "sub-text-scale", intValue);
+        vlc_object_release(vout);
+    }
+}
+
+
 - (void)switchSubtitleOption:(id)sender
 {
     int intValue = [sender tag];
-- 
2.7.4 (Apple Git-66)



More information about the vlc-devel mailing list