rt300@24
|
1 //
|
rt300@24
|
2 // TopButtonViewController.m
|
rt300@24
|
3 // sonicZoom
|
rt300@24
|
4 //
|
rt300@24
|
5 // Created by Robert Tubb on 31/01/2013.
|
rt300@24
|
6 //
|
rt300@24
|
7 //
|
rt300@24
|
8
|
rt300@24
|
9 #import "TopButtonViewController.h"
|
rt300@24
|
10 #import "testApp.h"
|
rt300@24
|
11 #import "presetManager.h"
|
rt300@24
|
12
|
rt300@24
|
13 extern PresetManager presetManager;
|
rt300@24
|
14
|
rt300@24
|
15
|
rt300@24
|
16 @interface TopButtonViewController ()
|
rt300@24
|
17
|
rt300@24
|
18 @end
|
rt300@24
|
19
|
rt300@24
|
20 @implementation TopButtonViewController
|
rt300@24
|
21
|
rt300@24
|
22 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
rt300@24
|
23 {
|
rt300@24
|
24 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
rt300@24
|
25 if (self) {
|
rt300@24
|
26 // Custom initialization
|
rt300@24
|
27 }
|
rt300@24
|
28 return self;
|
rt300@24
|
29 }
|
rt300@24
|
30
|
rt300@24
|
31 - (void)viewDidLoad
|
rt300@24
|
32 {
|
rt300@24
|
33 [super viewDidLoad];
|
rt300@24
|
34 // Do any additional setup after loading the view from its nib.
|
rt300@24
|
35 self.playButton.enabled = true;
|
rt300@24
|
36 self.pauseButton.enabled = false;
|
rt300@25
|
37 self.qButton.enabled = false;
|
rt300@25
|
38
|
rt300@24
|
39 }
|
rt300@24
|
40
|
rt300@25
|
41 - (void)enableQuestionButton{
|
rt300@25
|
42 self.qButton.enabled = true;
|
rt300@25
|
43 }
|
rt300@24
|
44 - (void)didReceiveMemoryWarning
|
rt300@24
|
45 {
|
rt300@24
|
46 [super didReceiveMemoryWarning];
|
rt300@24
|
47 // Dispose of any resources that can be recreated.
|
rt300@24
|
48 }
|
rt300@24
|
49
|
rt300@24
|
50 - (void)setAppRef:(id)theOFApp{
|
rt300@24
|
51 self.theOFAppRef = theOFApp;
|
rt300@24
|
52
|
rt300@24
|
53 }
|
rt300@24
|
54
|
rt300@24
|
55 - (IBAction)playPressed:(id)sender {
|
rt300@24
|
56 ((testApp *)self.theOFAppRef)->seqStartStop(true);
|
rt300@24
|
57 self.playButton.enabled = false;
|
rt300@24
|
58 self.pauseButton.enabled = true;
|
rt300@24
|
59 }
|
rt300@24
|
60
|
rt300@24
|
61 - (IBAction)pausePressed:(id)sender {
|
rt300@24
|
62 ((testApp *)self.theOFAppRef)->seqStartStop(false);
|
rt300@24
|
63 self.pauseButton.enabled = false;
|
rt300@24
|
64 self.playButton.enabled = true;
|
rt300@24
|
65 }
|
rt300@24
|
66
|
rt300@24
|
67 - (IBAction)savePressed:(id)sender {
|
rt300@24
|
68 cout << "SAVE PRESET\n";
|
rt300@24
|
69 presetManager.showNameDialog();
|
rt300@24
|
70 }
|
rt300@24
|
71
|
rt300@24
|
72 - (IBAction)lockSequencePressed:(id)sender {
|
rt300@24
|
73 UIBarButtonItem *button = (UIBarButtonItem *)sender;
|
rt300@24
|
74 if([button.title isEqualToString:@"Lock Sequence (X)"]){
|
rt300@24
|
75 ((testApp *)self.theOFAppRef)->lockSequencerPressed(true);
|
rt300@24
|
76 button.title = @"Unlock Sequence (X)";
|
rt300@24
|
77 }else if([button.title isEqualToString:@"Unlock Sequence (X)"]){
|
rt300@24
|
78 ((testApp *)self.theOFAppRef)->lockSequencerPressed(false);
|
rt300@24
|
79 button.title = @"Lock Sequence (X)";
|
rt300@24
|
80 }else{
|
rt300@24
|
81 NSLog(@"button title error");
|
rt300@24
|
82 }
|
rt300@24
|
83 }
|
rt300@24
|
84
|
rt300@24
|
85 - (IBAction)lockSynthPressed:(id)sender {
|
rt300@24
|
86 UIBarButtonItem *button = (UIBarButtonItem *)sender;
|
rt300@24
|
87 if([button.title isEqualToString:@"Lock Synth (Y)"]){
|
rt300@24
|
88 ((testApp *)self.theOFAppRef)->lockSynthPressed(true);
|
rt300@24
|
89 button.title = @"Unlock Synth (Y)";
|
rt300@24
|
90 }else if([button.title isEqualToString:@"Unlock Synth (Y)"]){
|
rt300@24
|
91 ((testApp *)self.theOFAppRef)->lockSynthPressed(false);
|
rt300@24
|
92 button.title = @"Lock Synth (Y)";
|
rt300@24
|
93 }else{
|
rt300@24
|
94 NSLog(@"button title error");
|
rt300@24
|
95 }
|
rt300@24
|
96 }
|
rt300@24
|
97
|
rt300@24
|
98 - (IBAction)qPressed:(id)sender {
|
rt300@24
|
99 ((testApp *)self.theOFAppRef)->showQuestionnaire();
|
rt300@24
|
100 }
|
rt300@24
|
101
|
rt300@25
|
102 - (IBAction)randomise:(id)sender {
|
rt300@25
|
103 ((testApp *)self.theOFAppRef)->randomise();
|
rt300@25
|
104 }
|
rt300@25
|
105
|
rt300@26
|
106 - (IBAction)helpPressed:(id)sender {
|
rt300@27
|
107 ((testApp *)self.theOFAppRef)->showHelp();
|
rt300@26
|
108
|
rt300@27
|
109 }
|
rt300@27
|
110
|
rt300@27
|
111 - (IBAction)newUser:(id)sender {
|
rt300@27
|
112 ((testApp *)self.theOFAppRef)->setupNewUser();
|
rt300@26
|
113 }
|
rt300@26
|
114
|
rt300@24
|
115 - (IBAction)show:(id)sender
|
rt300@24
|
116 {
|
rt300@24
|
117 self.theOFAppRef = sender;
|
rt300@24
|
118 self.view.hidden = NO;
|
rt300@24
|
119 }
|
rt300@24
|
120
|
rt300@26
|
121 /*
|
rt300@26
|
122 helpViewController = [[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:nil];
|
rt300@26
|
123 [ofxiPhoneGetGLParentView() addSubview:helpViewController.view];
|
rt300@26
|
124 [helpViewController hide:(id)this];
|
rt300@26
|
125 */
|
rt300@24
|
126 - (void)dealloc {
|
rt300@24
|
127 [_playButton release];
|
rt300@24
|
128 [_pauseButton release];
|
rt300@25
|
129 [_qButton release];
|
rt300@27
|
130
|
rt300@24
|
131 [super dealloc];
|
rt300@24
|
132 }
|
rt300@24
|
133 - (void)viewDidUnload {
|
rt300@24
|
134 [self setPlayButton:nil];
|
rt300@24
|
135 [self setPauseButton:nil];
|
rt300@25
|
136 [self setQButton:nil];
|
rt300@24
|
137 [super viewDidUnload];
|
rt300@24
|
138 }
|
rt300@24
|
139 @end
|