forked from KosmicTask/Fragaria
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MGSFragariaFontsAndColoursPrefsViewController.m
62 lines (45 loc) · 1.42 KB
/
MGSFragariaFontsAndColoursPrefsViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// MGSFragariaFontsAndColoursPrefsViewController.m
// Fragaria
//
// Created by Jonathan on 14/09/2012.
//
//
#import "MGSFragaria.h"
#import "MGSFragariaFramework.h"
@interface MGSFragariaFontsAndColoursPrefsViewController ()
@end
@implementation MGSFragariaFontsAndColoursPrefsViewController
/*
- init
*/
- (id)init {
self = [super initWithNibName:@"MGSPreferencesFontsAndColours" bundle:[NSBundle bundleForClass:[self class]]];
if (self) {
}
return self;
}
/*
- setFontAction:
*/
- (IBAction)setFontAction:(id)sender
{
#pragma unused(sender)
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSData *fontData = [[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:MGSFragariaPrefsTextFont];
NSFont *font = [NSUnarchiver unarchiveObjectWithData:fontData];
[fontManager setSelectedFont:font isMultiple:NO];
[fontManager orderFrontFontPanel:nil];
}
/*
- changeFont:
*/
- (void)changeFont:(id)sender
{
/* changeFont: is sent up the responder chain by the fontManager so we have to call this
method from say the preferences window controller which has been configured as the window delegate */
NSFontManager *fontManager = sender;
NSFont *panelFont = [fontManager convertFont:[fontManager selectedFont]];
[SMLDefaults setValue:[NSArchiver archivedDataWithRootObject:panelFont] forKey:MGSFragariaPrefsTextFont];
}
@end