view TopButtonViewController.mm @ 25:f42a00e3f22d

Logs condensed slightly. Questionnaire button enable. double precision location!!!
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 01 Feb 2013 17:39:19 +0000
parents a4908ad8c78e
children 2e1fdac115af
line wrap: on
line source
//
//  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;
    self.qButton.enabled = false;

}

- (void)enableQuestionButton{
    self.qButton.enabled = true;
}
- (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)randomise:(id)sender {
    ((testApp *)self.theOFAppRef)->randomise();
}

- (IBAction)show:(id)sender
{
    self.theOFAppRef = sender;
    self.view.hidden = NO;
}

- (void)dealloc {
    [_playButton release];
    [_pauseButton release];
    [_qButton release];
    [super dealloc];
}
- (void)viewDidUnload {
    [self setPlayButton:nil];
    [self setPauseButton:nil];
    [self setQButton:nil];
    [super viewDidUnload];
}
@end