-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathStructureMakerUI.m
60 lines (50 loc) · 1.4 KB
/
StructureMakerUI.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
#import "StructureMakerUI.h"
#import "StructureMaker.h"
@implementation StructureMakerUI
/* This method returns the NIB file to use for the inspector panel */
+(NSString*)viewNibName
{
return @"StructureMakerUI";
}
/* This method specifies the title for the patch */
+(NSString*)viewTitle
{
return @"Settings";
}
- (void)setupViewForPatch:(StructureMaker*)patch
{
[textField setIntValue: [patch inputCount]];
[stepper setIntValue: [patch inputCount]];
[super setupViewForPatch:patch];
}
- (IBAction)stepInputCount:(id)sender
{
NSStepper *step = (NSStepper*)sender;
if( [sender intValue] > 0)
[textField setIntValue:[step intValue]];
else
[sender setIntValue: 1];
StructureMaker *patch = (StructureMaker *)[self patch];
while( [sender intValue] > [patch inputCount] )
{
//NSLog(@"Adding input; Currently at %i, going to %i",[[self patch] inputCount], [sender intValue]);
[patch addInput];
}
while( [sender intValue] < [patch inputCount] && [sender intValue] > 0)
[patch delInput];
}
- (IBAction)textInputCount:(id)sender
{
StructureMaker *patch = (StructureMaker *)[self patch];
[patch disableNotifications];
[stepper setIntValue:[sender intValue]];
while( [sender intValue] > [patch inputCount] )
[patch addInput];
while( [sender intValue] < [patch inputCount] && [sender intValue] > 0)
[patch delInput];
[patch enableNotifications];
}
- (IBAction)emptyInputPort:(id)sender
{
}
@end