macosx: add a11y option to increase playlist table font size

Dimensions match the iTunes counter-part setting
This commit is contained in:
Felix Paul Kühne 2014-04-27 18:56:04 +02:00
parent 0af6ed5956
commit 37fb48bc77
4 changed files with 40 additions and 2 deletions

1
NEWS
View File

@ -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

View File

@ -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)

View File

@ -64,6 +64,7 @@
- (playlist_item_t *)currentPlaylistRoot;
- (playlist_item_t *)selectedPlaylistItem;
- (NSOutlineView *)outlineView;
- (void)reloadStyles;
@end
/*****************************************************************************

View File

@ -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