-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathSineWaveViewController.m
90 lines (73 loc) · 1.97 KB
/
SineWaveViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// SineWaveViewController.m
// SpeechToText
//
// Created by Sam Bosley on 10/11/11.
// Copyright (c) 2011 Astrid. All rights reserved.
//
#import "SineWaveViewController.h"
#import "SpeechToTextModule.h"
@interface SineWaveViewController ()
@property (retain) NSString *originalDoneText;
@end
@implementation SineWaveViewController
@synthesize delegate;
@synthesize dataPoints;
@synthesize backgroundView;
@synthesize waveDisplay;
@synthesize doneButton;
@synthesize processingView;
@synthesize header;
@synthesize footer;
@synthesize originalDoneText;
@synthesize cancelButton;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
waveDisplay.dataPoints = self.dataPoints;
}
- (void)setDataPoints:(NSArray *)_dataPoints {
// Have to hold on to them here in case the wave display hasn't loaded when they're first set
[dataPoints release];
dataPoints = [_dataPoints retain];
waveDisplay.dataPoints = dataPoints;
}
- (void)dealloc {
delegate = nil;
[dataPoints release];
[header release];
[footer release];
[backgroundImage release];
[waveDisplay release];
[doneButton release];
[cancelButton release];
[processingView release];
self.originalDoneText = nil;
[super dealloc];
}
- (void)resetViewState {
self.header.hidden = NO;
self.header.text = @"Speak now";
self.header.font = [UIFont fontWithName:@"Helvetica-Bold" size:17.0];
self.processingView.hidden = YES;
self.waveDisplay.hidden = NO;
self.doneButton.hidden = NO;
self.doneButton.enabled = YES;
self.cancelButton.hidden = NO;
self.footer.hidden = YES;
}
- (IBAction)done {
[delegate sineWaveDoneAction];
}
-(IBAction)cancel {
[delegate sineWaveCancelAction];
}
- (void)updateWaveDisplay {
[waveDisplay setNeedsDisplay];
}
@end