forked from amaxwell/tlutility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TLMDocumentationController.m
69 lines (58 loc) · 1.61 KB
/
TLMDocumentationController.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
63
64
65
66
67
68
69
//
// TLMDocumentationController.m
// TeX Live Utility
//
// Created by Adam R. Maxwell on 10/10/15.
//
//
#import "TLMDocumentationController.h"
#import "TLMOptionOperation.h"
@implementation TLMDocumentationController
@synthesize _enableCheckbox;
@synthesize _dismissButton;
@synthesize _installButton;
- (id)init
{
return [super initWithWindowNibName:[self windowNibName]];
}
- (NSString *)windowNibName { return @"DocumentationSheet"; }
- (void)awakeFromNib
{
_shouldInstall = [TLMOptionOperation boolValueOfOption:@"docfiles"];
[_enableCheckbox setState:(_shouldInstall ? NSOnState : NSOffState)];
[_installButton setEnabled:_shouldInstall];
}
- (void)dealloc
{
[_enableCheckbox release];
[_dismissButton release];
[_installButton release];
[super dealloc];
}
- (IBAction)enableAction:(id)sender;
{
_changedOption = YES;
_shouldInstall = [sender state] == NSOnState ? YES : NO;
[_installButton setEnabled:_shouldInstall];
}
- (IBAction)dismiss:(id)sender;
{
TLMDocumentationReturnCode rc = TLMDocumentationUnchanged;
if (_changedOption)
rc |= TLMDocumentationChanged;
if (_shouldInstall)
rc |= TLMDocumentationInstallLater;
[NSApp endSheet:[self window] returnCode:rc];
}
- (IBAction)install:(id)sender;
{
TLMDocumentationReturnCode rc = TLMDocumentationUnchanged;
if (_changedOption)
rc |= TLMDocumentationChanged;
// required; can't install docs unless this is set (duh)
if (_shouldInstall)
rc |= TLMDocumentationInstallLater;
rc |= TLMDocumentationInstallNow;
[NSApp endSheet:[self window] returnCode:rc];
}
@end