/
ISFPropFloatTableCellView.m
71 lines (52 loc) · 1.8 KB
/
ISFPropFloatTableCellView.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
#import "ISFPropFloatTableCellView.h"
#import "JSONGUIController.h"
@implementation ISFPropFloatTableCellView
- (void) dealloc {
[defaultField setTarget:nil];
[minField setTarget:nil];
[maxField setTarget:nil];
[identityField setTarget:nil];
[super dealloc];
}
- (void) refreshWithInput:(JSONGUIInput *)n {
//NSLog(@"%s ... %@",__func__,n);
[super refreshWithInput:n];
if (n==nil)
return;
NSString *tmpString = nil;
NSNumber *tmpNum = nil;
tmpString = [n objectForKey:@"DEFAULT"];
tmpNum = [self parseNumberFromString:tmpString];
[defaultField setStringValue:(tmpNum==nil) ? @"" : VVFMTSTRING(@"%f",[tmpNum doubleValue])];
tmpString = [n objectForKey:@"MIN"];
tmpNum = [self parseNumberFromString:tmpString];
[minField setStringValue:(tmpNum==nil) ? @"" : VVFMTSTRING(@"%f",[tmpNum doubleValue])];
tmpString = [n objectForKey:@"MAX"];
tmpNum = [self parseNumberFromString:tmpString];
[maxField setStringValue:(tmpNum==nil) ? @"" : VVFMTSTRING(@"%f",[tmpNum doubleValue])];
tmpString = [n objectForKey:@"IDENTITY"];
tmpNum = [self parseNumberFromString:tmpString];
[identityField setStringValue:(tmpNum==nil) ? @"" : VVFMTSTRING(@"%f",[tmpNum doubleValue])];
}
- (IBAction) uiItemUsed:(id)sender {
//NSLog(@"%s",__func__);
JSONGUIInput *myInput = [self input];
if (myInput == nil)
return;
// parse the string into a number value
NSNumber *newNum = [self parseNumberFromString:[sender stringValue]];
if (sender == defaultField) {
[myInput setObject:newNum forKey:@"DEFAULT"];
}
else if (sender == minField) {
[myInput setObject:newNum forKey:@"MIN"];
}
else if (sender == maxField) {
[myInput setObject:newNum forKey:@"MAX"];
}
else if (sender == identityField) {
[myInput setObject:newNum forKey:@"IDENTITY"];
}
[_globalJSONGUIController recreateJSONAndExport];
}
@end