Commit dd03469c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx: Fix font chooser.

Switch back to quartztext, and use the NSFontPanel.
(cherry picked from commit 84c65822)
parent c3f723fb
......@@ -2,39 +2,22 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>48 424 356 240 0 0 1280 778 </string>
<key>IBEditorPositions</key>
<dict>
<key>2311</key>
<string>345 425 590 230 0 0 1280 778 </string>
<key>2330</key>
<string>345 221 590 502 0 0 1280 778 </string>
<key>2440</key>
<string>345 307 590 389 0 0 1280 778 </string>
<key>2523</key>
<string>345 348 590 343 0 0 1280 778 </string>
<key>2562</key>
<string>345 219 590 505 0 0 1280 778 </string>
<key>2668</key>
<string>345 255 590 457 0 0 1280 778 </string>
</dict>
<key>IBFramework Version</key>
<string>489.0</string>
<string>644</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../../vlc.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>1530</integer>
<integer>2677</integer>
<integer>2330</integer>
<integer>2668</integer>
<integer>2523</integer>
<integer>1530</integer>
<integer>2311</integer>
<integer>2562</integer>
<integer>2537</integer>
<integer>2265</integer>
<integer>2311</integer>
<integer>2668</integer>
</array>
<key>IBSystem Version</key>
<string>9E17</string>
......
......@@ -193,6 +193,7 @@
/* OSD / subtitles */
- (IBAction)osdSettingChanged:(id)sender;
- (IBAction)showFontPicker:(id)sender;
- (void)showOSDSettings;
/* input & codecs */
......
......@@ -269,7 +269,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
/* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
[o_osd_font_box setTitle: _NS("Display Settings")];
[o_osd_font_btn setTitle: _NS("Browse...")];
[o_osd_font_btn setTitle: _NS("Choose...")];
[o_osd_font_color_txt setStringValue: _NS("Font Color")];
[o_osd_font_size_txt setStringValue: _NS("Font Size")];
[o_osd_font_txt setStringValue: _NS("Font")];
......@@ -1096,23 +1096,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
- (IBAction)osdSettingChanged:(id)sender
{
if( sender == o_osd_font_btn )
{
o_selectFolderPanel = [[NSOpenPanel alloc] init];
[o_selectFolderPanel setCanChooseDirectories: NO];
[o_selectFolderPanel setCanChooseFiles: YES];
[o_selectFolderPanel setResolvesAliases: YES];
[o_selectFolderPanel setAllowsMultipleSelection: NO];
[o_selectFolderPanel setMessage: _NS("Choose the font to display your Subtitles with.")];
[o_selectFolderPanel setCanCreateDirectories: NO];
[o_selectFolderPanel setPrompt: _NS("Choose")];
[o_selectFolderPanel setAllowedFileTypes: [NSArray arrayWithObjects: @"dfont", @"ttf", @"otf", @"FFIL", nil]];
[o_selectFolderPanel beginSheetForDirectory: @"/System/Library/Fonts/" file: nil modalForWindow: o_sprefs_win
modalDelegate: self
didEndSelector: @selector(savePanelDidEnd:returnCode:contextInfo:)
contextInfo: o_osd_font_btn];
}
else
b_osdSettingChanged = YES;
}
......@@ -1121,6 +1104,28 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
[self showSettingsForCategory: o_osd_view];
}
- (IBAction)showFontPicker:(id)sender
{
char * font = config_GetPsz( p_intf, "quartztext-font" );
NSString * fontFamilyName = font ? [NSString stringWithUTF8String: font] : nil;
free(font);
if( fontFamilyName )
{
NSFontDescriptor * fd = [NSFontDescriptor fontDescriptorWithFontAttributes:nil];
NSFont * font = [NSFont fontWithDescriptor:[fd fontDescriptorWithFamily:fontFamilyName] textTransform:nil];
[[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:NO];
}
[[NSFontManager sharedFontManager] setTarget:self];
[[NSFontPanel sharedFontPanel] orderFront:self];
}
- (void)changeFont:(id)sender
{
NSFont * font = [sender convertFont:[[NSFontManager sharedFontManager] selectedFont]];
[o_osd_font_fld setStringValue:[font familyName]];
[self osdSettingChanged:self];
}
- (IBAction)inputSettingChanged:(id)sender
{
if( sender == o_input_cachelevel_pop )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment