diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TopButtonViewController.mm	Fri Feb 01 11:16:56 2013 +0000
@@ -0,0 +1,113 @@
+//
+//  TopButtonViewController.m
+//  sonicZoom
+//
+//  Created by Robert Tubb on 31/01/2013.
+//
+//
+
+#import "TopButtonViewController.h"
+#import "testApp.h"
+#import "presetManager.h"
+
+extern PresetManager presetManager;
+
+
+@interface TopButtonViewController ()
+
+@end
+
+@implementation TopButtonViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    // Do any additional setup after loading the view from its nib.
+    self.playButton.enabled = true;
+    self.pauseButton.enabled = false;
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (void)setAppRef:(id)theOFApp{
+    self.theOFAppRef = theOFApp;
+    
+}
+
+- (IBAction)playPressed:(id)sender {
+    ((testApp *)self.theOFAppRef)->seqStartStop(true);
+    self.playButton.enabled = false;
+    self.pauseButton.enabled = true;
+}
+
+- (IBAction)pausePressed:(id)sender {
+    ((testApp *)self.theOFAppRef)->seqStartStop(false);
+    self.pauseButton.enabled = false;
+    self.playButton.enabled = true;
+}
+
+- (IBAction)savePressed:(id)sender {
+    cout << "SAVE PRESET\n";
+    presetManager.showNameDialog();
+}
+
+- (IBAction)lockSequencePressed:(id)sender {
+    UIBarButtonItem *button = (UIBarButtonItem *)sender;
+    if([button.title isEqualToString:@"Lock Sequence (X)"]){
+        ((testApp *)self.theOFAppRef)->lockSequencerPressed(true);
+        button.title = @"Unlock Sequence (X)";
+    }else if([button.title isEqualToString:@"Unlock Sequence (X)"]){
+        ((testApp *)self.theOFAppRef)->lockSequencerPressed(false);
+        button.title = @"Lock Sequence (X)";
+    }else{
+        NSLog(@"button title error");
+    }
+}
+
+- (IBAction)lockSynthPressed:(id)sender {
+    UIBarButtonItem *button = (UIBarButtonItem *)sender;
+    if([button.title isEqualToString:@"Lock Synth (Y)"]){
+        ((testApp *)self.theOFAppRef)->lockSynthPressed(true);
+        button.title = @"Unlock Synth (Y)";
+    }else if([button.title isEqualToString:@"Unlock Synth (Y)"]){
+        ((testApp *)self.theOFAppRef)->lockSynthPressed(false);
+        button.title = @"Lock Synth (Y)";
+    }else{
+        NSLog(@"button title error");
+    }
+}
+
+- (IBAction)qPressed:(id)sender {
+    ((testApp *)self.theOFAppRef)->showQuestionnaire();
+}
+
+- (IBAction)show:(id)sender
+{
+    self.theOFAppRef = sender;
+    self.view.hidden = NO;
+}
+
+- (void)dealloc {
+    [_playButton release];
+    [_pauseButton release];
+    [super dealloc];
+}
+- (void)viewDidUnload {
+    [self setPlayButton:nil];
+    [self setPauseButton:nil];
+    [super viewDidUnload];
+}
+@end