add app controller
This commit is contained in:
parent
aeb3638e1f
commit
c60d2f92fa
19
tools/Quickdev16/AppController.h
Normal file
19
tools/Quickdev16/AppController.h
Normal file
@ -0,0 +1,19 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface AppController : NSObject {
|
||||
IBOutlet NSTextField *textField;
|
||||
IBOutlet NSColorWell *colorWell;
|
||||
IBOutlet NSButton *stopButton;
|
||||
IBOutlet NSTableView *tableView;
|
||||
NSSpeechSynthesizer *speechSynth;
|
||||
}
|
||||
- (IBAction)sayIt:(id)sender;
|
||||
- (IBAction)stopIt:(id)sender;
|
||||
- (IBAction)changeTextColor:(id)sender;
|
||||
- (void)speechSynthesizer:(NSSpeechSynthesizer *)send
|
||||
didFinishSpeaking:(BOOL)finishedSpeaking;
|
||||
- (int)numberOfRowsInTableView:(NSTableView *) aTableView;
|
||||
-(id)tableView:(NSTableView*) aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *) aTableColumn row:(int)row;
|
||||
|
||||
@end
|
||||
106
tools/Quickdev16/AppController.m
Normal file
106
tools/Quickdev16/AppController.m
Normal file
@ -0,0 +1,106 @@
|
||||
#import "AppController.h"
|
||||
|
||||
@implementation AppController
|
||||
- (id) init {
|
||||
[super init];
|
||||
NSLog(@"init");
|
||||
speechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
|
||||
[speechSynth setDelegate:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib{
|
||||
NSColor *initialColor = [ textField textColor];
|
||||
NSLog(@"setting init color %@",initialColor);
|
||||
[colorWell setColor:initialColor];
|
||||
NSString *defaultVoice = [NSSpeechSynthesizer defaultVoice];
|
||||
NSArray *voices = [NSSpeechSynthesizer availableVoices];
|
||||
int defaultRow = [voices indexOfObject:defaultVoice];
|
||||
[tableView selectRow:defaultRow byExtendingSelection:NO];
|
||||
[tableView scrollRowToVisible:defaultRow];
|
||||
|
||||
}
|
||||
- (IBAction)sayIt:(id)sender {
|
||||
NSString *string = [textField stringValue];
|
||||
if ( [string length] == 0) {
|
||||
NSLog(@"No message");
|
||||
return;
|
||||
}
|
||||
[speechSynth startSpeakingString:string];
|
||||
NSLog(@"Have started speaking: %@", string);
|
||||
[stopButton setEnabled:YES];
|
||||
}
|
||||
|
||||
- (IBAction)stopIt:(id)sender {
|
||||
NSLog(@"stopping");
|
||||
[speechSynth stopSpeaking];
|
||||
|
||||
}
|
||||
|
||||
- (void)speechSynthesizer:(NSSpeechSynthesizer *)send
|
||||
didFinishSpeaking:(BOOL)finishedSpeaking
|
||||
{
|
||||
NSLog(@"didFinished=%d",finishedSpeaking);
|
||||
[stopButton setEnabled:NO];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)changeTextColor:(id)sender{
|
||||
NSColor *newColor = [sender color];
|
||||
NSLog(@"Change Color %@",newColor);
|
||||
[textField setTextColor:newColor];
|
||||
|
||||
}
|
||||
|
||||
- (int)numberOfRowsInTableView:(NSTableView *) aTableView{
|
||||
NSLog(@"numberOfRowsInTableView %d", [[NSSpeechSynthesizer availableVoices] count]);
|
||||
|
||||
return [[NSSpeechSynthesizer availableVoices] count];
|
||||
}
|
||||
-(id)tableView:(NSTableView*) aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *) aTableColumn row:(int)row{
|
||||
NSString *voice = [[NSSpeechSynthesizer availableVoices] objectAtIndex:row ];
|
||||
return [[NSSpeechSynthesizer attributesForVoice:voice] valueForKey:NSVoiceName];
|
||||
}
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)nofication{
|
||||
NSArray *availableVoices = [NSSpeechSynthesizer availableVoices];
|
||||
int row = [tableView selectedRow];
|
||||
if ( row == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *selectedVoice = [availableVoices objectAtIndex:row];
|
||||
[speechSynth setVoice:selectedVoice];
|
||||
NSLog(@"new voice=%@",selectedVoice);
|
||||
}
|
||||
|
||||
-(BOOL)selectionShouldChangeInTableView:(NSTableView *) aTableView
|
||||
{
|
||||
if ([speechSynth isSpeaking]){
|
||||
NSBeep();
|
||||
return NO;
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSSize)windowWillResize:(NSWindow *)send toSize:(NSSize) framesize;
|
||||
{
|
||||
float w = framesize.width;
|
||||
float h = framesize.height;
|
||||
NSLog(@"called willResize %f x %f ",w,h);
|
||||
|
||||
w = w*2;
|
||||
framesize.width = w;
|
||||
return framesize;
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
NSLog(@"dealloc");
|
||||
[speechSynth release];
|
||||
[super dealloc];
|
||||
|
||||
}
|
||||
@end
|
||||
@ -13,7 +13,6 @@
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="29"/>
|
||||
<integer value="534"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@ -1318,21 +1317,21 @@
|
||||
<object class="NSWindowTemplate" id="59616572">
|
||||
<int key="NSWindowStyleMask">263</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{157, 191}, {480, 270}}</string>
|
||||
<string key="NSWindowRect">{{157, -335}, {504, 796}}</string>
|
||||
<int key="NSWTFlags">611844096</int>
|
||||
<string key="NSWindowTitle">Quickdev16</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<object class="NSView" key="NSWindowView" id="986949344">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSTabView" id="77078538">
|
||||
<reference key="NSNextResponder" ref="986949344"/>
|
||||
<int key="NSvFlags">12</int>
|
||||
<string key="NSFrame">{{13, 5}, {454, 213}}</string>
|
||||
<string key="NSFrame">{{13, 531}, {454, 213}}</string>
|
||||
<reference key="NSSuperview" ref="986949344"/>
|
||||
<object class="NSMutableArray" key="NSTabViewItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@ -1441,7 +1440,7 @@
|
||||
<object class="NSButton" id="595445563">
|
||||
<reference key="NSNextResponder" ref="986949344"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{20, 248}, {106, 23}}</string>
|
||||
<string key="NSFrame">{{20, 774}, {106, 23}}</string>
|
||||
<reference key="NSSuperview" ref="986949344"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="773521235">
|
||||
@ -1461,7 +1460,7 @@
|
||||
<object class="NSButton" id="744367094">
|
||||
<reference key="NSNextResponder" ref="986949344"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{20, 219}, {106, 23}}</string>
|
||||
<string key="NSFrame">{{20, 745}, {106, 23}}</string>
|
||||
<reference key="NSSuperview" ref="986949344"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="1047137768">
|
||||
@ -1481,7 +1480,7 @@
|
||||
<object class="NSButton" id="784593682">
|
||||
<reference key="NSNextResponder" ref="986949344"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{354, 248}, {106, 23}}</string>
|
||||
<string key="NSFrame">{{354, 774}, {106, 23}}</string>
|
||||
<reference key="NSSuperview" ref="986949344"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="71987855">
|
||||
@ -1499,8 +1498,7 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{480, 270}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<string key="NSFrameSize">{504, 796}</string>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
@ -3610,7 +3608,6 @@
|
||||
<string>588.IBPluginDependency</string>
|
||||
<string>589.IBPluginDependency</string>
|
||||
<string>590.IBPluginDependency</string>
|
||||
<string>591.IBPluginDependency</string>
|
||||
<string>72.IBPluginDependency</string>
|
||||
<string>72.ImportedFromIB2</string>
|
||||
<string>73.IBPluginDependency</string>
|
||||
@ -3849,9 +3846,9 @@
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{338, 221}, {480, 270}}</string>
|
||||
<string>{{936, 60}, {504, 796}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{338, 221}, {480, 270}}</string>
|
||||
<string>{{936, 60}, {504, 796}}</string>
|
||||
<boolean value="YES"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@ -3878,7 +3875,6 @@
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
|
||||
@ -63,6 +63,21 @@
|
||||
userBuildSettings = {
|
||||
};
|
||||
};
|
||||
631A51A6104CF59900E73564 /* AppController.h */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {593, 449}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRange = "{0, 614}";
|
||||
};
|
||||
};
|
||||
631A51A9104CF5B700E73564 /* AppController.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {933, 1261}}";
|
||||
sepNavSelRange = "{782, 0}";
|
||||
sepNavVisRange = "{597, 1402}";
|
||||
sepNavWindowFrame = "{{15, 60}, {992, 818}}";
|
||||
};
|
||||
};
|
||||
631E1874104C5D72001A8B18 /* Quickdev16 */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||
256AC3DA0F4B6AC300CF3369 /* Quickdev16AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* Quickdev16AppDelegate.m */; };
|
||||
631A5181104CF44F00E73564 /* BGHUDAppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 631A5180104CF44F00E73564 /* BGHUDAppKit.framework */; };
|
||||
631A51AA104CF5B700E73564 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 631A51A9104CF5B700E73564 /* AppController.m */; };
|
||||
631A5252104CF9FB00E73564 /* BGHUDAppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 631A5251104CF9FB00E73564 /* BGHUDAppKit.framework */; };
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
@ -27,9 +27,9 @@
|
||||
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
631A5180104CF44F00E73564 /* BGHUDAppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BGHUDAppKit.framework; path = /Users/david/Devel/arch/osx/code/BGHUDAppKit/BGHUDAppKit.framework; sourceTree = "<absolute>"; };
|
||||
631A51A6104CF59900E73564 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
|
||||
631A51A9104CF5B700E73564 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
|
||||
631A5251104CF9FB00E73564 /* BGHUDAppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BGHUDAppKit.framework; path = /Users/david/Devel/arch/osx/code/BGHUDAppKit/build/Release/BGHUDAppKit.framework; sourceTree = "<absolute>"; };
|
||||
8D1107310486CEB800E47090 /* Quickdev16-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Quickdev16-Info.plist"; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* Quickdev16.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Quickdev16.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
@ -40,7 +40,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
631A5181104CF44F00E73564 /* BGHUDAppKit.framework in Frameworks */,
|
||||
631A5252104CF9FB00E73564 /* BGHUDAppKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -120,7 +120,7 @@
|
||||
children = (
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||
631A5180104CF44F00E73564 /* BGHUDAppKit.framework */,
|
||||
631A5251104CF9FB00E73564 /* BGHUDAppKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@ -216,6 +216,7 @@
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../../../../osx/code/BGHUDAppKit\"",
|
||||
"\"$(SRCROOT)/../../../../../osx/code/BGHUDAppKit/build/Release\"",
|
||||
);
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
@ -237,6 +238,7 @@
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../../../../osx/code/BGHUDAppKit\"",
|
||||
"\"$(SRCROOT)/../../../../../osx/code/BGHUDAppKit/build/Release\"",
|
||||
);
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user