Commit 84c65822 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx: Fix font chooser.

Switch back to quartztext, and use the NSFontPanel.
parent 722cd536
...@@ -2,39 +2,22 @@ ...@@ -2,39 +2,22 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <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> <key>IBFramework Version</key>
<string>489.0</string> <string>644</string>
<key>IBLastKnownRelativeProjectPath</key> <key>IBLastKnownRelativeProjectPath</key>
<string>../../vlc.xcodeproj</string> <string>../../vlc.xcodeproj</string>
<key>IBOldestOS</key> <key>IBOldestOS</key>
<integer>5</integer> <integer>5</integer>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>1530</integer>
<integer>2677</integer> <integer>2677</integer>
<integer>2330</integer> <integer>2330</integer>
<integer>2668</integer> <integer>2311</integer>
<integer>2523</integer>
<integer>1530</integer>
<integer>2562</integer> <integer>2562</integer>
<integer>2537</integer>
<integer>2265</integer> <integer>2265</integer>
<integer>2311</integer> <integer>2668</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>9E17</string> <string>9E17</string>
......
...@@ -193,6 +193,7 @@ ...@@ -193,6 +193,7 @@
/* OSD / subtitles */ /* OSD / subtitles */
- (IBAction)osdSettingChanged:(id)sender; - (IBAction)osdSettingChanged:(id)sender;
- (IBAction)showFontPicker:(id)sender;
- (void)showOSDSettings; - (void)showOSDSettings;
/* input & codecs */ /* input & codecs */
......
...@@ -269,7 +269,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -269,7 +269,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
/* Subtitles and OSD */ /* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")]; [o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
[o_osd_font_box setTitle: _NS("Display Settings")]; [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_color_txt setStringValue: _NS("Font Color")];
[o_osd_font_size_txt setStringValue: _NS("Font Size")]; [o_osd_font_size_txt setStringValue: _NS("Font Size")];
[o_osd_font_txt setStringValue: _NS("Font")]; [o_osd_font_txt setStringValue: _NS("Font")];
...@@ -569,11 +569,11 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -569,11 +569,11 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"]; [self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"];
[o_osd_lang_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "sub-language" ) ?: ""]]; [o_osd_lang_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "sub-language" ) ?: ""]];
if( config_GetPsz( p_intf, "freetype-font" ) != NULL ) if( config_GetPsz( p_intf, "quartztext-font" ) != NULL )
[o_osd_font_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "freetype-font" ) ?: ""]]; [o_osd_font_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "quartztext-font" ) ?: ""]];
[self setupButton: o_osd_font_color_pop forIntList: "freetype-color"]; [self setupButton: o_osd_font_color_pop forIntList: "quartztext-color"];
[self setupButton: o_osd_font_size_pop forIntList: "freetype-rel-fontsize"]; [self setupButton: o_osd_font_size_pop forIntList: "quartztext-rel-fontsize"];
/******************** /********************
* hotkeys settings * * hotkeys settings *
...@@ -930,10 +930,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -930,10 +930,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutPsz( p_intf, "subsdec-encoding", [[[o_osd_encoding_pop selectedItem] title] UTF8String] ); config_PutPsz( p_intf, "subsdec-encoding", [[[o_osd_encoding_pop selectedItem] title] UTF8String] );
config_PutPsz( p_intf, "sub-language", [[o_osd_lang_fld stringValue] UTF8String] ); config_PutPsz( p_intf, "sub-language", [[o_osd_lang_fld stringValue] UTF8String] );
config_PutPsz( p_intf, "freetype-font", [[o_osd_font_fld stringValue] UTF8String] ); config_PutPsz( p_intf, "quartztext-font", [[o_osd_font_fld stringValue] UTF8String] );
SaveIntList( o_osd_font_color_pop, "freetype-color" ); SaveIntList( o_osd_font_color_pop, "quartztext-color" );
SaveIntList( o_osd_font_size_pop, "freetype-rel-fontsize" ); SaveIntList( o_osd_font_size_pop, "quartztext-rel-fontsize" );
i = config_SaveConfigFile( p_intf, NULL ); i = config_SaveConfigFile( p_intf, NULL );
...@@ -1096,23 +1096,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1096,23 +1096,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
- (IBAction)osdSettingChanged:(id)sender - (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; b_osdSettingChanged = YES;
} }
...@@ -1121,6 +1104,28 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1121,6 +1104,28 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
[self showSettingsForCategory: o_osd_view]; [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 - (IBAction)inputSettingChanged:(id)sender
{ {
if( sender == o_input_cachelevel_pop ) 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