[vlc-commits] macosx: add a11y option to increase playlist table font size

Felix Paul Kühne git at videolan.org
Sun Apr 27 18:56:35 CEST 2014


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Apr 27 18:56:04 2014 +0200| [37fb48bc775565b7dcb8de7cb6ac8b7e0b76104d] | committer: Felix Paul Kühne

macosx: add a11y option to increase playlist table font size

Dimensions match the iTunes counter-part setting

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

 NEWS                          |    1 +
 modules/gui/macosx/macosx.m   |    3 +++
 modules/gui/macosx/playlist.h |    1 +
 modules/gui/macosx/playlist.m |   37 +++++++++++++++++++++++++++++++++++--
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 4aa3dd2..67f2819 100644
--- a/NEWS
+++ b/NEWS
@@ -110,6 +110,7 @@ Interfaces:
 Mac OS X Interface:
  * Support to continue media playback where it was left off
  * Fixes for advanced preferences
+ * Option to increase playlist font size
 
 Misc:
  * New module for TLS on OS X and iOS
diff --git a/modules/gui/macosx/macosx.m b/modules/gui/macosx/macosx.m
index b2d0162..b0f99cc 100644
--- a/modules/gui/macosx/macosx.m
+++ b/modules/gui/macosx/macosx.m
@@ -123,6 +123,8 @@ void WindowClose  (vout_window_t *);
 #define ITUNES_TEXT N_("Control external music players")
 #define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players on playback.")
 
+#define LARGE_LISTFONT_TEXT N_("Use large text for list views")
+
 static const int itunes_list[] =
     { 0, 1, 2 };
 static const char *const itunes_list_text[] = {
@@ -160,6 +162,7 @@ vlc_module_begin()
         add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false)
         add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, false)
         add_integer_with_range("macosx-max-volume", 125, 60, 200, VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true)
+        add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, LARGE_LISTFONT_TEXT, false)
 
     set_section(N_("Behavior"), 0)
         add_bool("macosx-autoplay", true, AUTOPLAY_OSX_TEST, AUTOPLAY_OSX_LONGTEXT, false)
diff --git a/modules/gui/macosx/playlist.h b/modules/gui/macosx/playlist.h
index 5afdee7..824e79b 100644
--- a/modules/gui/macosx/playlist.h
+++ b/modules/gui/macosx/playlist.h
@@ -64,6 +64,7 @@
 - (playlist_item_t *)currentPlaylistRoot;
 - (playlist_item_t *)selectedPlaylistItem;
 - (NSOutlineView *)outlineView;
+- (void)reloadStyles;
 @end
 
 /*****************************************************************************
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 961997a..d464763 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -166,6 +166,8 @@
     [[o_tc_name_other headerCell] setStringValue:_NS("Name")];
     [[o_tc_author_other headerCell] setStringValue:_NS("Author")];
     [[o_tc_duration_other headerCell] setStringValue:_NS("Duration")];
+
+    [self reloadStyles];
 }
 
 - (void)setPlaylistRoot: (playlist_item_t *)root_item
@@ -191,6 +193,31 @@
                                                                 pointerValue];
 }
 
+- (void)reloadStyles
+{
+    NSFont *fontToUse;
+    CGFloat rowHeight;
+    if (config_GetInt(VLCIntf, "macosx-large-text")) {
+        fontToUse = [NSFont systemFontOfSize:13.];
+        rowHeight = 21.;
+    } else {
+        fontToUse = [NSFont systemFontOfSize:11.];
+        rowHeight = 16.;
+    }
+
+    NSArray *columns = [o_outline_view tableColumns];
+    NSUInteger count = columns.count;
+    for (NSUInteger x = 0; x < count; x++)
+        [[columns[x] dataCell] setFont:fontToUse];
+    [o_outline_view setRowHeight:rowHeight];
+
+    columns = [o_outline_view_other tableColumns];
+    count = columns.count;
+    for (NSUInteger x = 0; x < count; x++)
+        [[columns[x] dataCell] setFont:fontToUse];
+    [o_outline_view_other setRowHeight:rowHeight];
+}
+
 - (void)dealloc {
     [o_outline_dict release];
     [super dealloc];
@@ -1371,11 +1398,17 @@
     o_playing_item = [o_outline_dict objectForKey: [NSString stringWithFormat:@"%p",  playlist_CurrentPlayingItem(p_playlist)]];
     PL_UNLOCK;
 
+    NSFont *fontToUse;
+    if (config_GetInt(VLCIntf, "macosx-large-text"))
+        fontToUse = [NSFont systemFontOfSize:13.];
+    else
+        fontToUse = [NSFont systemFontOfSize:11.];
+
     if ([self isItem: [o_playing_item pointerValue] inNode: [item pointerValue] checkItemExistence:YES locked:NO]
                         || [o_playing_item isEqual: item])
-        [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toHaveTrait:NSBoldFontMask]];
+        [cell setFont: [[NSFontManager sharedFontManager] convertFont:fontToUse toHaveTrait:NSBoldFontMask]];
     else
-        [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toNotHaveTrait:NSBoldFontMask]];
+        [cell setFont: [[NSFontManager sharedFontManager] convertFont:fontToUse toNotHaveTrait:NSBoldFontMask]];
 }
 
 - (id)playingItem



More information about the vlc-commits mailing list