comparison TopButtonViewController.mm @ 24:a4908ad8c78e

Top and bottom toolbars. Intro page.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 01 Feb 2013 11:16:56 +0000
parents
children f42a00e3f22d
comparison
equal deleted inserted replaced
23:dae6d77657a0 24:a4908ad8c78e
1 //
2 // TopButtonViewController.m
3 // sonicZoom
4 //
5 // Created by Robert Tubb on 31/01/2013.
6 //
7 //
8
9 #import "TopButtonViewController.h"
10 #import "testApp.h"
11 #import "presetManager.h"
12
13 extern PresetManager presetManager;
14
15
16 @interface TopButtonViewController ()
17
18 @end
19
20 @implementation TopButtonViewController
21
22 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
23 {
24 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
25 if (self) {
26 // Custom initialization
27 }
28 return self;
29 }
30
31 - (void)viewDidLoad
32 {
33 [super viewDidLoad];
34 // Do any additional setup after loading the view from its nib.
35 self.playButton.enabled = true;
36 self.pauseButton.enabled = false;
37 }
38
39 - (void)didReceiveMemoryWarning
40 {
41 [super didReceiveMemoryWarning];
42 // Dispose of any resources that can be recreated.
43 }
44
45 - (void)setAppRef:(id)theOFApp{
46 self.theOFAppRef = theOFApp;
47
48 }
49
50 - (IBAction)playPressed:(id)sender {
51 ((testApp *)self.theOFAppRef)->seqStartStop(true);
52 self.playButton.enabled = false;
53 self.pauseButton.enabled = true;
54 }
55
56 - (IBAction)pausePressed:(id)sender {
57 ((testApp *)self.theOFAppRef)->seqStartStop(false);
58 self.pauseButton.enabled = false;
59 self.playButton.enabled = true;
60 }
61
62 - (IBAction)savePressed:(id)sender {
63 cout << "SAVE PRESET\n";
64 presetManager.showNameDialog();
65 }
66
67 - (IBAction)lockSequencePressed:(id)sender {
68 UIBarButtonItem *button = (UIBarButtonItem *)sender;
69 if([button.title isEqualToString:@"Lock Sequence (X)"]){
70 ((testApp *)self.theOFAppRef)->lockSequencerPressed(true);
71 button.title = @"Unlock Sequence (X)";
72 }else if([button.title isEqualToString:@"Unlock Sequence (X)"]){
73 ((testApp *)self.theOFAppRef)->lockSequencerPressed(false);
74 button.title = @"Lock Sequence (X)";
75 }else{
76 NSLog(@"button title error");
77 }
78 }
79
80 - (IBAction)lockSynthPressed:(id)sender {
81 UIBarButtonItem *button = (UIBarButtonItem *)sender;
82 if([button.title isEqualToString:@"Lock Synth (Y)"]){
83 ((testApp *)self.theOFAppRef)->lockSynthPressed(true);
84 button.title = @"Unlock Synth (Y)";
85 }else if([button.title isEqualToString:@"Unlock Synth (Y)"]){
86 ((testApp *)self.theOFAppRef)->lockSynthPressed(false);
87 button.title = @"Lock Synth (Y)";
88 }else{
89 NSLog(@"button title error");
90 }
91 }
92
93 - (IBAction)qPressed:(id)sender {
94 ((testApp *)self.theOFAppRef)->showQuestionnaire();
95 }
96
97 - (IBAction)show:(id)sender
98 {
99 self.theOFAppRef = sender;
100 self.view.hidden = NO;
101 }
102
103 - (void)dealloc {
104 [_playButton release];
105 [_pauseButton release];
106 [super dealloc];
107 }
108 - (void)viewDidUnload {
109 [self setPlayButton:nil];
110 [self setPauseButton:nil];
111 [super viewDidUnload];
112 }
113 @end