comparison SliderViewController.mm @ 44:a1e75b94c505

Snap to eval points. Double tap to go to preset (doesn't quite work yet). Coloured locks. Changed Question 2. Fixed some leaks.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 22 Apr 2013 18:32:34 +0100
parents b91a1859829a
children c2fffc8ea84d
comparison
equal deleted inserted replaced
43:b91a1859829a 44:a1e75b94c505
28 } 28 }
29 29
30 - (void)viewDidLoad 30 - (void)viewDidLoad
31 { 31 {
32 int left = 22; 32 int left = 22;
33 int top = 3; 33 int top = 10;
34 const int height = 62; 34 const int height = 50;
35 const int width = 337; 35 const int width = 337;
36 36
37 [super viewDidLoad]; 37 [super viewDidLoad];
38 38
39 for(int i=0;i<10;i++){ 39 for(int i=0;i<10;i++){
40 40
41 if(i==5){ 41 if(i==5){
42 top = 0; 42 top = 10;
43 left = left*3 + width; 43 left = left*3 + width;
44 } 44 }
45 SliderController * sliderV = [[SliderController alloc] initWithNibName:@"SliderController" bundle:nil delegate:self pID:i]; 45 SliderController * sliderV = [[SliderController alloc] initWithNibName:@"SliderController" bundle:nil delegate:self pID:i];
46 46
47 [self.view addSubview:sliderV.view]; 47 [self.view addSubview:sliderV.view];
49 sliderV.view.frame = CGRectMake(left,top,width,height); 49 sliderV.view.frame = CGRectMake(left,top,width,height);
50 [sliderV setPID:i]; 50 [sliderV setPID:i];
51 NSLog(@"setting name to %@", self.paramNames[i]); 51 NSLog(@"setting name to %@", self.paramNames[i]);
52 [sliderV changeLabel:self.paramNames[i] ]; 52 [sliderV changeLabel:self.paramNames[i] ];
53 [sliderV setParamValue:44]; 53 [sliderV setParamValue:44];
54 if(i>=5){
55 [sliderV makeRed];
56 }
54 top += height; 57 top += height;
55 58
56 [self.sliderArray addObject:sliderV]; // not working 59 [self.sliderArray addObject:sliderV]; // not working
57 60
58 } 61 }
94 - (void)slider:(int)which changedTo:(float)value{ 97 - (void)slider:(int)which changedTo:(float)value{
95 // call testApp 98 // call testApp
96 ((testApp *)self.theOFAppRef)->sliderMoved(which,value); 99 ((testApp *)self.theOFAppRef)->sliderMoved(which,value);
97 } 100 }
98 - (void)setSlider:(int)which to:(float)value{ 101 - (void)setSlider:(int)which to:(float)value{
99 NSLog(@"set slider to");
100 [[self.sliderArray objectAtIndex:which] setParamValue:value]; 102 [[self.sliderArray objectAtIndex:which] setParamValue:value];
101 } 103 }
102 - (void)populateParamNames{ 104 - (void)populateParamNames{
103 105
104 106