-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAQTPrefController.m
80 lines (69 loc) · 3.28 KB
/
AQTPrefController.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
#import "AQTPrefController.h"
@implementation AQTPrefController
+ (AQTPrefController *)sharedPrefController
{
static AQTPrefController *sharedPrefController = nil;
if (sharedPrefController == nil) {
sharedPrefController = [[self alloc] init];
} return sharedPrefController;
}
-(id)init
{
if (self = [super init])
{
[NSBundle loadNibNamed:@"Preferences.nib" owner:self];
}
return self;
}
-(void)awakeFromNib
{
[self showPrefs];
}
- (void)showPrefs {
float lw = [preferences floatForKey:@"MinimumLinewidth"];
[imageInterpolateLevel selectItemAtIndex:[preferences integerForKey:@"ImageInterpolationLevel"]];
[crosshairCursorColor selectItemAtIndex:[preferences integerForKey:@"CrosshairCursorColor"]];
[shouldAntialiasSwitch setIntegerValue:[preferences integerForKey:@"ShouldAntialiasDrawing"]];
[minimumLinewidthSlider setDoubleValue:lw];
[linewidthDisplay setStringValue:(lw < 0.04)?@"off":[NSString stringWithFormat:@"%4.2f", lw]];
[minimumLinewidthSlider setDoubleValue:[preferences floatForKey:@"MinimumLinewidth"]];
[convertSymbolFontSwitch setIntegerValue:[preferences integerForKey:@"ShouldConvertSymbolFont"]];
[closeWindowSwitch setIntegerValue:[preferences integerForKey:@"CloseWindowWhenClosingPlot"]];
[confirmCloseWindowSwitch setIntegerValue:[preferences integerForKey:@"ConfirmCloseWindowWhenClosingPlot"]];
[showProcessNameSwitch setIntegerValue:[preferences integerForKey:@"ShowProcessName"]];
[showProcessIdSwitch setIntegerValue:[preferences integerForKey:@"ShowProcessId"]];
[confirmCloseWindowSwitch setEnabled:([closeWindowSwitch integerValue] == 0)?NO:YES];
[self updateTitleExample:self];
[prefWindow makeKeyAndOrderFront:self];
}
- (IBAction)windowClosingChanged:(id)sender
{
[confirmCloseWindowSwitch setEnabled:([closeWindowSwitch integerValue] == 0)?NO:YES];
}
- (IBAction)updateTitleExample:(id)sender
{
[titleExample setStringValue:[NSString stringWithFormat:@"%@%@Figure 1", [showProcessNameSwitch integerValue]?@"gnuplot ":@"", [showProcessIdSwitch integerValue]?@"(1151) ":@""]];
}
- (IBAction)cancelButtonPressed:(id)sender
{
[prefWindow orderOut:self];
}
- (IBAction)OKButtonPressed:(id)sender
{
[preferences setInteger:[imageInterpolateLevel indexOfSelectedItem] forKey:@"ImageInterpolationLevel"];
[preferences setInteger:[crosshairCursorColor indexOfSelectedItem] forKey:@"CrosshairCursorColor"];
[preferences setInteger:[shouldAntialiasSwitch integerValue] forKey:@"ShouldAntialiasDrawing"];
[preferences setFloat:[minimumLinewidthSlider doubleValue] forKey:@"MinimumLinewidth"];
[preferences setInteger:[convertSymbolFontSwitch integerValue] forKey:@"ShouldConvertSymbolFont"];
[preferences setInteger:[closeWindowSwitch integerValue] forKey:@"CloseWindowWhenClosingPlot"];
[preferences setInteger:[confirmCloseWindowSwitch integerValue] forKey:@"ConfirmCloseWindowWhenClosingPlot"];
[preferences setInteger:[showProcessNameSwitch integerValue] forKey:@"ShowProcessName"];
[preferences setInteger:[showProcessIdSwitch integerValue] forKey:@"ShowProcessId"];
[prefWindow orderOut:self];
}
- (IBAction)linewidthSliderMoved:(id)sender
{
float lw = [sender doubleValue];
[linewidthDisplay setStringValue:(lw < 0.04)?@"off":[NSString stringWithFormat:@"%4.2f", lw]];
}
@end