-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIFMiscSettings.m
105 lines (84 loc) · 2.4 KB
/
IFMiscSettings.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// IFMiscSettings.m
// Inform
//
// Created by Andrew Hunter on 10/10/2004.
// Copyright 2004 Andrew Hunter. All rights reserved.
//
#import "IFMiscSettings.h"
@implementation IFMiscSettings
- (id) init {
return [self initWithNibName: @"MiscSettings"];
}
- (NSString*) title {
return [[NSBundle mainBundle] localizedStringForKey: @"Misc Settings"
value: @"Misc Settings"
table: nil];
}
// = Setting up =
- (void) updateFromCompilerSettings {
[strictMode setState: [self strict]?NSOnState:NSOffState];
[infixMode setState: [self infix]?NSOnState:NSOffState];
[debugMode setState: [self debug]?NSOnState:NSOffState];
if ([[self compilerSettings] usingNaturalInform]) {
[infixMode setEnabled: NO];
[infixMode setState: NSOffState];
[[self dictionary] setObject: [NSNumber numberWithBool: NO]
forKey: IFSettingInfix];
} else {
[infixMode setEnabled: YES];
}
}
- (void) setSettings {
[self setStrict: [strictMode state]==NSOnState];
[self setInfix: [infixMode state]==NSOnState];
[self setDebug: [debugMode state]==NSOnState];
}
// = The settings =
- (void) setStrict: (BOOL) setting {
[[self dictionary] setObject: [NSNumber numberWithBool: setting]
forKey: IFSettingStrict];
[self settingsHaveChanged: self];
}
- (BOOL) strict {
NSNumber* setting = [[self dictionary] objectForKey: IFSettingStrict];
if (setting) {
return [setting boolValue];
} else {
return YES;
}
}
- (void) setInfix: (BOOL) setting {
[[self dictionary] setObject: [NSNumber numberWithBool: setting]
forKey: IFSettingInfix];
[self settingsHaveChanged: self];
}
- (BOOL) infix {
NSNumber* setting = [[self dictionary] objectForKey: IFSettingInfix];
if (setting) {
return [setting boolValue];
} else {
return NO;
}
}
- (void) setDebug: (BOOL) setting {
[[self dictionary] setObject: [NSNumber numberWithBool: setting]
forKey: IFSettingDEBUG];
[self settingsHaveChanged: self];
}
- (BOOL) debug {
NSNumber* setting = [[self dictionary] objectForKey: IFSettingDEBUG];
if (setting) {
return [setting boolValue];
} else {
return YES;
}
}
- (BOOL) enableForCompiler: (NSString*) compiler {
// These settings are unsafe to change while using Natural Inform
if ([compiler isEqualToString: IFCompilerNaturalInform])
return NO;
else
return YES;
}
@end