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