[vlc-commits] macosx: Reenable subtitles menu, use "sub-text-scale" for size

David Fuhrmann git at videolan.org
Sun Jun 18 22:57:51 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Jun 16 13:54:57 2017 +0200| [7870972d9fd5ac1456f4c0ef166b0b6f31012b6b] | committer: David Fuhrmann

macosx: Reenable subtitles menu, use "sub-text-scale" for size

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

refs #16185

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7870972d9fd5ac1456f4c0ef166b0b6f31012b6b
---

 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 502e101980..98f7db0ae8 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -262,14 +262,29 @@
     [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 @@
         [[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];



More information about the vlc-commits mailing list