annotate TopButtonViewController.mm @ 37:8ed7522deaaa

Interpolation.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 09 Apr 2013 17:14:31 +0100
parents a42903c61558
children 0dfe9e0c01aa
rev   line source
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@36 37 self.qButton.enabled = false;
rt300@29 38 self.newUserButton.enabled = true;
rt300@29 39 //------------------------
rt300@29 40 // Get the reference to the current toolbar buttons
rt300@36 41 //NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy];
rt300@29 42
rt300@29 43 // This is how you remove the button from the toolbar and animate it
rt300@36 44 //[toolbarButtons removeObject:self.qButton];
rt300@36 45 //[self setToolbarItems:toolbarButtons animated:YES];
rt300@29 46
rt300@29 47 // This is how you add the button to the toolbar and animate it
rt300@29 48 /*
rt300@29 49 if (![toolbarButtons containsObject:self.qButton]) {
rt300@29 50 [toolbarButtons addObject:self.qButton];
rt300@29 51 [self setToolbarItems:toolbarButtons animated:YES];
rt300@29 52 }
rt300@29 53 */
rt300@29 54
rt300@24 55 }
rt300@24 56
rt300@25 57 - (void)enableQuestionButton{
rt300@25 58 self.qButton.enabled = true;
rt300@25 59 }
rt300@24 60 - (void)didReceiveMemoryWarning
rt300@24 61 {
rt300@24 62 [super didReceiveMemoryWarning];
rt300@24 63 // Dispose of any resources that can be recreated.
rt300@24 64 }
rt300@24 65
rt300@24 66 - (void)setAppRef:(id)theOFApp{
rt300@24 67 self.theOFAppRef = theOFApp;
rt300@24 68
rt300@24 69 }
rt300@24 70
rt300@24 71 - (IBAction)playPressed:(id)sender {
rt300@24 72 ((testApp *)self.theOFAppRef)->seqStartStop(true);
rt300@24 73 self.playButton.enabled = false;
rt300@24 74 self.pauseButton.enabled = true;
rt300@24 75 }
rt300@24 76
rt300@24 77 - (IBAction)pausePressed:(id)sender {
rt300@24 78 ((testApp *)self.theOFAppRef)->seqStartStop(false);
rt300@24 79 self.pauseButton.enabled = false;
rt300@24 80 self.playButton.enabled = true;
rt300@24 81 }
rt300@24 82
rt300@24 83 - (IBAction)savePressed:(id)sender {
rt300@24 84 cout << "SAVE PRESET\n";
rt300@24 85 presetManager.showNameDialog();
rt300@24 86 }
rt300@24 87
rt300@24 88 - (IBAction)lockSequencePressed:(id)sender {
rt300@24 89 UIBarButtonItem *button = (UIBarButtonItem *)sender;
rt300@37 90 if([button.title isEqualToString:@"Lock X"]){
rt300@24 91 ((testApp *)self.theOFAppRef)->lockSequencerPressed(true);
rt300@37 92 button.title = @"Unlock X";
rt300@37 93 }else if([button.title isEqualToString:@"Unlock X"]){
rt300@24 94 ((testApp *)self.theOFAppRef)->lockSequencerPressed(false);
rt300@37 95 button.title = @"Lock X";
rt300@24 96 }else{
rt300@24 97 NSLog(@"button title error");
rt300@24 98 }
rt300@24 99 }
rt300@24 100
rt300@24 101 - (IBAction)lockSynthPressed:(id)sender {
rt300@24 102 UIBarButtonItem *button = (UIBarButtonItem *)sender;
rt300@37 103 if([button.title isEqualToString:@"Lock Y"]){
rt300@24 104 ((testApp *)self.theOFAppRef)->lockSynthPressed(true);
rt300@37 105 button.title = @"Unlock Y";
rt300@37 106 }else if([button.title isEqualToString:@"Unlock Y"]){
rt300@24 107 ((testApp *)self.theOFAppRef)->lockSynthPressed(false);
rt300@37 108 button.title = @"Lock Y";
rt300@24 109 }else{
rt300@24 110 NSLog(@"button title error");
rt300@24 111 }
rt300@24 112 }
rt300@32 113 -(void)unlockAll{
rt300@32 114
rt300@32 115 }
rt300@24 116 - (IBAction)qPressed:(id)sender {
rt300@24 117 ((testApp *)self.theOFAppRef)->showQuestionnaire();
rt300@24 118 }
rt300@24 119
rt300@25 120 - (IBAction)randomise:(id)sender {
rt300@25 121 ((testApp *)self.theOFAppRef)->randomise();
rt300@25 122 }
rt300@25 123
rt300@26 124 - (IBAction)helpPressed:(id)sender {
rt300@27 125 ((testApp *)self.theOFAppRef)->showHelp();
rt300@26 126
rt300@27 127 }
rt300@27 128
rt300@27 129 - (IBAction)newUser:(id)sender {
rt300@27 130 ((testApp *)self.theOFAppRef)->setupNewUser();
rt300@26 131 }
rt300@26 132
rt300@36 133 - (IBAction)nextSequence:(id)sender {
rt300@36 134 ((testApp *)self.theOFAppRef)->nextSequence();
rt300@36 135 }
rt300@36 136
rt300@24 137 - (IBAction)show:(id)sender
rt300@24 138 {
rt300@24 139 self.theOFAppRef = sender;
rt300@24 140 self.view.hidden = NO;
rt300@24 141 }
rt300@24 142
rt300@26 143 /*
rt300@26 144 helpViewController = [[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:nil];
rt300@26 145 [ofxiPhoneGetGLParentView() addSubview:helpViewController.view];
rt300@26 146 [helpViewController hide:(id)this];
rt300@26 147 */
rt300@24 148 - (void)dealloc {
rt300@24 149 [_playButton release];
rt300@24 150 [_pauseButton release];
rt300@25 151 [_qButton release];
rt300@27 152
rt300@29 153 [_newUserButton release];
rt300@24 154 [super dealloc];
rt300@24 155 }
rt300@24 156 - (void)viewDidUnload {
rt300@24 157 [self setPlayButton:nil];
rt300@24 158 [self setPauseButton:nil];
rt300@25 159 [self setQButton:nil];
rt300@29 160 [self setNewUserButton:nil];
rt300@24 161 [super viewDidUnload];
rt300@24 162 }
rt300@24 163 @end