├── Speech Translator ├── BGHUDAppKit.framework │ ├── Versions │ │ ├── Current │ │ ├── .DS_Store │ │ └── A │ │ │ ├── .DS_Store │ │ │ ├── BGHUDAppKit │ │ │ ├── Headers │ │ │ ├── BGHUDStepperCell.h │ │ │ ├── BGHUDTableCornerView.h │ │ │ ├── NSTokenAttachment.h │ │ │ ├── BGGradientTheme.h │ │ │ ├── NSTokenAttachmentCell.h │ │ │ ├── BGHUDTabViewItem.h │ │ │ ├── BGHUDGeometry.h │ │ │ ├── BGHUDTabView.h │ │ │ ├── BGHUDLabel.h │ │ │ ├── BGHUDScrollView.h │ │ │ ├── BGHUDTableViewHeaderCell.h │ │ │ ├── BGHUDTextFieldCell.h │ │ │ ├── BGHUDSearchFieldCell.h │ │ │ ├── BGHUDProgressIndicator.h │ │ │ ├── BGHUDSecureTextFieldCell.h │ │ │ ├── BGHUDPopUpButtonCell.h │ │ │ ├── BGHUDTableView.h │ │ │ ├── BGHUDOutlineView.h │ │ │ ├── BGHUDColorWell.h │ │ │ ├── BGHUDTokenFieldCell.h │ │ │ ├── BGHUDComboBoxCell.h │ │ │ ├── BGHUDSegmentedCell.h │ │ │ ├── BGThemeManager.h │ │ │ ├── BGHUDTokenAttachmentCell.h │ │ │ ├── BGHUDSliderCell.h │ │ │ ├── BGHUDScroller.h │ │ │ ├── BGHUDButtonCell.h │ │ │ ├── BGHUDAppKit.h │ │ │ ├── BGHUDBox.h │ │ │ ├── BGHUDView.h │ │ │ └── BGTheme.h │ │ │ └── Resources │ │ │ ├── Info.plist │ │ │ └── Theming.rtf │ ├── Headers │ ├── Resources │ ├── BGHUDAppKit │ ├── .DS_Store │ └── Docs │ │ ├── CONTRIB.rtf │ │ ├── License.rtf │ │ ├── Theming.rtf │ │ └── README.rtf ├── ffmpeg ├── .DS_Store ├── icon.icns ├── InfoPlist.strings ├── Speech Translator-Prefix.pch ├── main.m ├── Localizable.strings ├── en.lproj │ └── Credits.rtf ├── GoogleASR.h ├── MicrosoftTTS.h ├── GoogleTranslate.h ├── Speech_TranslatorAppDelegate.h ├── Speech Translator-Info.plist ├── MicrosoftTTS.m ├── NSString+SBJSON.m ├── NSObject+SBJSON.m ├── JSON.h ├── NSString+SBJSON.h ├── GTMNSString+HTML.h ├── NSObject+SBJSON.h ├── SBJsonBase.m ├── SBJSON.h ├── SBJsonBase.h ├── SBJsonParser.h ├── GoogleTranslate.m ├── GoogleASR.m ├── SBJsonWriter.h ├── SBJSON.m ├── SBJsonWriter.m ├── Speech_TranslatorAppDelegate.m ├── GTMDefines.h ├── SBJsonParser.m └── GTMNSString+HTML.m ├── .DS_Store └── Speech Translator.xcodeproj ├── project.xcworkspace └── contents.xcworkspacedata └── xcuserdata └── yuri.xcuserdatad └── xcschemes ├── xcschememanagement.plist └── Speech Translator.xcscheme /Speech Translator/BGHUDAppKit.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/.DS_Store -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/BGHUDAppKit: -------------------------------------------------------------------------------- 1 | Versions/Current/BGHUDAppKit -------------------------------------------------------------------------------- /Speech Translator/ffmpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/ffmpeg -------------------------------------------------------------------------------- /Speech Translator/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/.DS_Store -------------------------------------------------------------------------------- /Speech Translator/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/icon.icns -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/BGHUDAppKit.framework/.DS_Store -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/BGHUDAppKit.framework/Versions/.DS_Store -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/BGHUDAppKit.framework/Versions/A/.DS_Store -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/BGHUDAppKit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kyrie1965/SpeechTranslator/master/Speech Translator/BGHUDAppKit.framework/Versions/A/BGHUDAppKit -------------------------------------------------------------------------------- /Speech Translator/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | CFBundleName = "Голосовой переводчик"; 2 | CFBundleDisplayName = "Голосовой переводчик"; 3 | NSHumanReadableCopyright = "Copyright © 2011 Юрий Юрьев"; -------------------------------------------------------------------------------- /Speech Translator/Speech Translator-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Speech Translator' target in the 'Speech Translator' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Speech Translator.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Speech Translator/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 14.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDStepperCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDStepperCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 4/6/09. 6 | // Copyright 2009 none. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BGThemeManager.h" 11 | 12 | @interface BGHUDStepperCell : NSStepperCell { 13 | 14 | NSString *themeKey; 15 | int topButtonFlag; 16 | int bottomButtonFlag; 17 | } 18 | 19 | @property (retain) NSString *themeKey; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTableCornerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTableCornerView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/29/08. 6 | // Copyright 2008 none. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BGThemeManager.h" 11 | 12 | @interface BGHUDTableCornerView : NSView { 13 | 14 | NSString *themeKey; 15 | } 16 | 17 | @property (retain) NSString *themeKey; 18 | 19 | - (id)initWithThemeKey:(NSString *)key; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Speech Translator/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Record" = "Запись"; 2 | "Stop" = "Стоп"; 3 | "RUEN" = "Русский > Английский"; 4 | "ENRU" = "Английский > Русский"; 5 | "Title" = "Голосовой переводчик"; 6 | "RecordMessage" = "Запись автоматически остановится через %i сек."; 7 | "AudioError" = "Устройство записи звука не найдено"; 8 | "RecordError" = "Произошёл неизвестный сбой при записи голосовых данных"; 9 | "Continue" = "Продолжить"; 10 | "Error" = "Ошибка"; 11 | "DataHandling" = "Обработка данных..."; 12 | "DataError" = "Ошибка обработки данных"; -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/NSTokenAttachment.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by class-dump 3.1.2. 3 | * 4 | * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. 5 | */ 6 | 7 | #import 8 | 9 | @interface NSTokenAttachment : NSTextAttachment 10 | { 11 | id _delegate; 12 | } 13 | 14 | - (id)initWithDelegate:(id)fp8; 15 | - (void)encodeWithCoder:(id)fp8; 16 | - (id)initWithCoder:(id)fp8; 17 | - (id)attachmentCell; 18 | - (id)delegate; 19 | - (void)setDelegate:(id)fp8; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /Speech Translator/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Speech Translator.xcodeproj/xcuserdata/yuri.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Speech Translator.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | DAEABE1D13570C2E0027D0D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Speech Translator/GoogleASR.h: -------------------------------------------------------------------------------- 1 | // 2 | // GoogleASR.h 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GDataHTTPFetcher.h" 11 | #import "GTMNSString+HTML.h" 12 | #import "JSON.h" 13 | 14 | #define GoogleASRURL @"https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=" 15 | 16 | @protocol GoogleASRDelegate 17 | @optional 18 | - (void)didSR:(NSString *)text; 19 | - (void)didFail; 20 | @end 21 | 22 | 23 | @interface GoogleASR : NSObject 24 | { 25 | GDataHTTPFetcher *fetcher; 26 | 27 | id delegate; 28 | } 29 | 30 | 31 | @property (assign) id delegate; 32 | 33 | 34 | - (void)speechRecognition:(NSString *)flacPath language:(NSString *)language; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Speech Translator/MicrosoftTTS.h: -------------------------------------------------------------------------------- 1 | // 2 | // MicrosoftTTS.h 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GDataHTTPFetcher.h" 11 | #import "GTMNSString+HTML.h" 12 | 13 | 14 | #define SpeechURL @"http://api.microsofttranslator.com/v2/Http.svc/Speak?appId=B514C7B9E882AD6E237621DC437BCBED1902EC4B" 15 | 16 | 17 | @protocol MicrosoftTTSDelegate 18 | @optional 19 | - (void)dataReady:(NSData *)audioData; 20 | - (void)didFail; 21 | @end 22 | 23 | 24 | @interface MicrosoftTTS : NSObject 25 | { 26 | GDataHTTPFetcher *fetcher; 27 | 28 | id delegate; 29 | } 30 | 31 | 32 | @property (assign) id delegate; 33 | 34 | 35 | - (void)textToSpeech:(NSString *)text language:(NSString *)language; 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Speech Translator/GoogleTranslate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GoogleTranslate.h 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GDataHTTPFetcher.h" 11 | #import "GTMNSString+HTML.h" 12 | #import "JSON.h" 13 | 14 | #define GoogleURL @"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0" 15 | 16 | @protocol GoogleTranslateDelegate 17 | @optional 18 | - (void)didTranslate:(NSString *)translatedText; 19 | - (void)didFail; 20 | @end 21 | 22 | 23 | @interface GoogleTranslate : NSObject 24 | { 25 | GDataHTTPFetcher *fetcher; 26 | 27 | id delegate; 28 | } 29 | 30 | 31 | @property (assign) id delegate; 32 | 33 | 34 | - (void)translate:(NSString *)text from:(NSString *)inLanguage to:(NSString *)outLanguage; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 10J869 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | BGHUDAppKit 11 | CFBundleIdentifier 12 | com.binarymethod.BGHUDAppKit 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | DTCompiler 22 | 23 | DTPlatformBuild 24 | 4A304a 25 | DTPlatformVersion 26 | GM 27 | DTSDKBuild 28 | 4A304a 29 | DTSDKName 30 | macosx10.6 31 | DTXcode 32 | 0400 33 | DTXcodeBuild 34 | 4A304a 35 | NSPrincipalClass 36 | BGHUDAppKit 37 | 38 | 39 | -------------------------------------------------------------------------------- /Speech Translator/Speech_TranslatorAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Speech_TranslatorAppDelegate.h 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 14.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "GoogleASR.h" 13 | #import "GoogleTranslate.h" 14 | #import "MicrosoftTTS.h" 15 | 16 | #define recordMAXSec 5 17 | 18 | @interface Speech_TranslatorAppDelegate : NSObject 19 | { 20 | IBOutlet NSWindow *window; 21 | IBOutlet NSButton *button; 22 | IBOutlet NSPopUpButton *popUp; 23 | IBOutlet BGHUDLabel *textLabel; 24 | IBOutlet NSProgressIndicator *indicator; 25 | 26 | QTCaptureSession *mCaptureSession; 27 | QTCaptureMovieFileOutput *mCaptureMovieFileOutput; 28 | QTCaptureDeviceInput *mCaptureAudioDeviceInput; 29 | 30 | NSString *recordPath; 31 | BOOL recording; 32 | 33 | NSTimer *recordTimer; 34 | NSTimeInterval timerInitDate; 35 | 36 | GoogleASR *googleASR; 37 | GoogleTranslate *googleTranslate; 38 | MicrosoftTTS *microsoftTTS; 39 | 40 | NSSound *player; 41 | } 42 | 43 | 44 | @property (assign) IBOutlet NSWindow *window; 45 | 46 | 47 | - (IBAction)buttonAction:(id)sender; 48 | - (IBAction)popUpAction:(id)sender; 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Speech Translator/Speech Translator-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDocumentTypes 8 | 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | icon 13 | CFBundleIdentifier 14 | yuriev.info.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | YYYY 25 | CFBundleURLTypes 26 | 27 | CFBundleVersion 28 | 1 29 | LSMinimumSystemVersion 30 | 10.6.0 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | NSServices 36 | 37 | UTExportedTypeDeclarations 38 | 39 | UTImportedTypeDeclarations 40 | 41 | LSUIElement 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Speech Translator/MicrosoftTTS.m: -------------------------------------------------------------------------------- 1 | // 2 | // MicrosoftTTS.m 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import "MicrosoftTTS.h" 10 | 11 | 12 | @implementation MicrosoftTTS 13 | 14 | 15 | @synthesize delegate; 16 | 17 | 18 | - (void)dealloc 19 | { 20 | if (fetcher) [fetcher stopFetching], [fetcher release], fetcher = nil; 21 | 22 | [super dealloc]; 23 | } 24 | 25 | 26 | - (void)textToSpeech:(NSString *)text language:(NSString *)language 27 | { 28 | NSString *textToSpeech = [text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 29 | 30 | NSString *requestURL = [NSString stringWithFormat:@"%@&text=%@&language=%@", SpeechURL, textToSpeech, language]; 31 | 32 | NSURL *url = [NSURL URLWithString:requestURL]; 33 | NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; 34 | 35 | fetcher = [[GDataHTTPFetcher httpFetcherWithRequest:request] retain]; 36 | 37 | [fetcher beginFetchWithDelegate:self 38 | didFinishSelector:@selector(audioFetcher:finishedWithData:) 39 | didFailSelector:@selector(audioFetcher:didFail:)]; 40 | } 41 | 42 | 43 | - (void)audioFetcher:(GDataHTTPFetcher *)aFetcher finishedWithData:(NSData *)retrievedData 44 | { 45 | [fetcher release], fetcher = nil; 46 | 47 | if([delegate respondsToSelector:@selector(dataReady:)]) 48 | { 49 | [delegate dataReady:retrievedData]; 50 | } 51 | } 52 | 53 | 54 | - (void)audioFetcher:(GDataHTTPFetcher *)aFetcher didFail:(NSError *)error 55 | { 56 | [fetcher release], fetcher = nil; 57 | 58 | NSLog(@"MicrosoftTTS fetcher did failed"); 59 | 60 | if([delegate respondsToSelector:@selector(didFail)]) 61 | { 62 | [delegate didFail]; 63 | } 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGGradientTheme.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGGradientTheme.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/15/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGTheme.h" 37 | 38 | @interface BGGradientTheme : BGTheme { 39 | 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/NSTokenAttachmentCell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by class-dump 3.1.2. 3 | * 4 | * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. 5 | */ 6 | 7 | #import 8 | 9 | @interface NSTokenAttachmentCell : NSTextAttachmentCell 10 | { 11 | id _representedObject; 12 | id _textColor; 13 | id _reserved; 14 | struct { 15 | unsigned int _selected:1; 16 | unsigned int _edgeStyle:2; 17 | unsigned int _reserved:29; 18 | } _tacFlags; 19 | } 20 | 21 | + (void)initialize; 22 | - (id)initTextCell:(id)fp8; 23 | - (id)init; 24 | - (void)dealloc; 25 | - (id)representedObject; 26 | - (void)setRepresentedObject:(id)fp8; 27 | - (int)interiorBackgroundStyle; 28 | - (BOOL)_hasMenu; 29 | - (id)tokenForegroundColor; 30 | - (id)tokenBackgroundColor; 31 | - (id)textColor; 32 | - (void)setTextColor:(id)fp8; 33 | - (id)pullDownImage; 34 | - (id)menu; 35 | - (struct _NSSize)cellSizeForBounds:(NSRect)fp8; 36 | - (struct _NSSize)cellSize; 37 | - (NSRect)drawingRectForBounds:(NSRect)fp8; 38 | - (NSRect)titleRectForBounds:(NSRect)fp8; 39 | - (NSRect)cellFrameForTextContainer:(id)fp8 proposedLineFragment:(NSRect)fp12 glyphPosition:(struct _NSPoint)fp28 characterIndex:(unsigned int)fp36; 40 | - (struct _NSPoint)cellBaselineOffset; 41 | - (NSRect)pullDownRectForBounds:(NSRect)fp8; 42 | - (void)drawTokenWithFrame:(NSRect)fp8 inView:(id)fp24; 43 | - (void)drawInteriorWithFrame:(NSRect)fp8 inView:(id)fp24; 44 | - (void)drawWithFrame:(NSRect)fp8 inView:(id)fp24; 45 | - (void)drawWithFrame:(NSRect)fp8 inView:(id)fp24 characterIndex:(unsigned int)fp28 layoutManager:(id)fp32; 46 | - (void)encodeWithCoder:(id)fp8; 47 | - (id)initWithCoder:(id)fp8; 48 | - (BOOL)wantsToTrackMouseForEvent:(id)fp8 inRect:(NSRect)fp12 ofView:(id)fp28 atCharacterIndex:(unsigned int)fp32; 49 | - (BOOL)trackMouse:(id)fp8 inRect:(NSRect)fp12 ofView:(id)fp28 atCharacterIndex:(unsigned int)fp32 untilMouseUp:(BOOL)fp36; 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTabViewItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTabViewItem.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/10/09. 6 | // Copyright 2009 none. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation and/or 16 | // other materials provided with the distribution. 17 | // 18 | // Neither the name of the BinaryMethod.com nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software without 20 | // specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 23 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | #import "BGThemeManager.h" 35 | 36 | @interface BGHUDTabViewItem : NSTabViewItem { 37 | 38 | NSString *themeKey; 39 | } 40 | 41 | @property (retain) NSString *themeKey; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDGeometry.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDGeometry.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 9/25/08. 6 | // Copyright 2008 none. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation and/or 16 | // other materials provided with the distribution. 17 | // 18 | // Neither the name of the BinaryMethod.com nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software without 20 | // specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 23 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | 35 | 36 | NS_INLINE CGFloat BGCenterX(NSRect aRect) { 37 | return (aRect.size.width / 2); 38 | } 39 | 40 | NS_INLINE CGFloat BGCenterY(NSRect aRect) { 41 | return (aRect.size.height / 2); 42 | } 43 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTabView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTabView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/10/09. 6 | // Copyright 2009 none. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation and/or 16 | // other materials provided with the distribution. 17 | // 18 | // Neither the name of the BinaryMethod.com nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software without 20 | // specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 23 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | #import "BGThemeManager.h" 35 | #import "BGHUDTabViewItem.h" 36 | 37 | @interface BGHUDTabView : NSTabView { 38 | 39 | NSString *themeKey; 40 | } 41 | 42 | @property (retain) NSString *themeKey; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDLabel.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 8/23/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDLabel : NSTextField { 39 | 40 | NSString *themeKey; 41 | } 42 | 43 | @property (retain) NSString *themeKey; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDScrollView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/31/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGHUDScroller.h" 37 | #import "BGThemeManager.h" 38 | 39 | @interface BGHUDScrollView : NSScrollView { 40 | 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTableViewHeaderCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTableViewHeaderCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/17/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDTableViewHeaderCell : NSTableHeaderCell { 39 | 40 | NSString *themeKey; 41 | } 42 | 43 | @property (retain) NSString *themeKey; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Docs/CONTRIB.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330 2 | {\fonttbl\f0\fnil\fcharset0 Verdana;} 3 | {\colortbl;\red255\green255\blue255;\red73\green73\blue73;\red0\green122\blue200;\red0\green98\blue161; 4 | } 5 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} 6 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} 7 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural 8 | 9 | \f0\b\fs24 \cf0 Many thanks to the following people who contributed in some way:\ 10 | \ 11 | \pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural 12 | \ls1\ilvl0\cf0 {\listtext \'95 } 13 | \b0 \cf2 Matt Gemmell of {\field{\*\fldinst{HYPERLINK "http://mattgemmell.com/"}}{\fldrslt \cf3 MatGemmell.com}}\cf3 \ 14 | \ls1\ilvl0 15 | \b \cf0 {\listtext \'95 } 16 | \b0 \cf2 Vincent Esche of {\field{\*\fldinst{HYPERLINK "http://www.satsumac.com/"}}{\fldrslt Satsumac Software}}\ 17 | \ls1\ilvl0 18 | \b \cf0 {\listtext \'95 } 19 | \b0 \cf2 Marc Charbonneau of {\field{\*\fldinst{HYPERLINK "http://www.downtownsoftwarehouse.com/"}}{\fldrslt \cf4 \ul \ulc4 Downtown Software House}}\cf4 \ul \ulc4 \ 20 | \pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural 21 | \ls1\ilvl0 22 | \b \cf0 \ulnone {\listtext \'95 } 23 | \b0 \cf2 Danny Greg of {\field{\*\fldinst{HYPERLINK "http://www.realmacsoftware.com"}}{\fldrslt Realmac Software}}\ 24 | \ls1\ilvl0 25 | \b \cf0 {\listtext \'95 } 26 | \b0 \cf2 Matthew Brewer of {\field{\*\fldinst{HYPERLINK "http://www.macfanatic.net"}}{\fldrslt Mac Fanatic}}\ 27 | \ls1\ilvl0 28 | \b \cf0 {\listtext \'95 } 29 | \b0 \cf2 Jonathan Dann of {\field{\*\fldinst{HYPERLINK "http://espresso-served-here.com/"}}{\fldrslt Espresso Served Here}} 30 | \b \cf0 \ 31 | } -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTextFieldCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/2/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDTextFieldCell : NSTextFieldCell { 39 | 40 | BOOL fillsBackground; 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDSearchFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDSearchFieldCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 7/21/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDSearchFieldCell : NSSearchFieldCell { 39 | 40 | BOOL fillsBackground; 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDProgressIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDProgressIndicator.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/6/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDProgressIndicator : NSProgressIndicator { 39 | 40 | NSBezierPath *progressPath; 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDSecureTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDSecureTextFieldCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/12/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDSecureTextFieldCell : NSSecureTextFieldCell { 39 | 40 | BOOL fillsBackground; 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDPopUpButtonCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDPopUpButtonCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/31/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDPopUpButtonCell : NSPopUpButtonCell { 39 | 40 | NSString *themeKey; 41 | } 42 | 43 | @property (retain) NSString *themeKey; 44 | 45 | - (void)drawArrowsInRect:(NSRect) frame; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTableView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/17/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | #import "BGHUDTableViewHeaderCell.h" 38 | #import "BGHUDTableCornerView.h" 39 | 40 | @interface BGHUDTableView : NSTableView { 41 | 42 | NSString *themeKey; 43 | } 44 | 45 | @property (retain) NSString *themeKey; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDOutlineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDOutlineView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/20/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | #import "BGHUDTableViewHeaderCell.h" 38 | #import "BGHUDTableCornerView.h" 39 | 40 | @interface BGHUDOutlineView : NSOutlineView { 41 | 42 | NSString *themeKey; 43 | } 44 | 45 | @property (retain) NSString *themeKey; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDColorWell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDColorWell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 8/9/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDColorWell : NSColorWell { 39 | 40 | NSString *themeKey; 41 | BOOL useTransparentWell; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | - (BOOL)useTransparentWell; 47 | - (void)setUseTransparentWell:(BOOL) flag; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTokenFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTokenFieldCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/10/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGHUDTokenAttachmentCell.h" 37 | #import "NSTokenAttachmentCell.h" 38 | #import "BGThemeManager.h" 39 | 40 | @interface BGHUDTokenFieldCell : NSTokenFieldCell { 41 | 42 | BOOL fillsBackground; 43 | NSString *themeKey; 44 | } 45 | 46 | @property (retain) NSString *themeKey; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDComboBoxCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // NGHUDComboBoxCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by Alan Rogers on 10/11/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | 38 | @interface BGHUDComboBoxCell : NSComboBoxCell { 39 | 40 | BOOL fillsBackground; 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | - (void)drawArrowsInRect:(NSRect) frame; 47 | -(void)drawButtonInRect:(NSRect) cellFrame; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDSegmentedCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDSegmentedCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 7/1/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | #import "BGHUDGeometry.h" 38 | 39 | @interface BGHUDSegmentedCell : NSSegmentedCell { 40 | 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | -(void)drawInteriorForSegment:(int)segment withFrame:(NSRect)rect; 47 | -(BOOL)hasText; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGThemeManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGThemeManager.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/15/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGTheme.h" 37 | #import "BGGradientTheme.h" 38 | 39 | @interface BGThemeManager : NSObject { 40 | 41 | NSMutableDictionary *themes; 42 | } 43 | 44 | + (BGThemeManager *)keyedManager; 45 | -(void)initDefaultThemes; 46 | - (BGTheme *)themeForKey:(NSString *)key; 47 | - (void)setTheme:(BGTheme *)theme forKey:(NSString *)key; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDTokenAttachmentCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDTokenAttachmentCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/11/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "NSTokenAttachmentCell.h" 37 | 38 | @interface BGHUDTokenAttachmentCell : NSTokenAttachmentCell { 39 | 40 | NSColor *tokenFillNormal; 41 | NSColor *tokenFillHighlight; 42 | NSColor *tokenBorder; 43 | } 44 | 45 | @property (copy) NSColor *tokenFillNormal; 46 | @property (copy) NSColor *tokenFillHighlight; 47 | @property (copy) NSColor *tokenBorder; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDSliderCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDSliderCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/30/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | #import "BGHUDGeometry.h" 38 | 39 | @interface BGHUDSliderCell : NSSliderCell { 40 | 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | -(void)drawHorizontalBarInFrame:(NSRect)frame; 47 | -(void)drawVerticalBarInFrame:(NSRect)frame; 48 | -(void)drawHorizontalKnobInFrame:(NSRect)frame; 49 | -(void)drawVerticalKnobInFrame:(NSRect)frame; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Docs/License.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350 2 | {\fonttbl\f0\fnil\fcharset0 Verdana;} 3 | {\colortbl;\red255\green255\blue255;\red73\green73\blue73;} 4 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} 5 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} 6 | \vieww10580\viewh10540\viewkind0 7 | \deftab720 8 | \pard\pardeftab720\sl400\sa280\ql\qnatural 9 | 10 | \f0\fs24 \cf2 BGHUDAppKit - Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com)\uc0\u8232 All rights reserved.\ 11 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ 12 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sl400\sa20\ql\qnatural 13 | \ls1\ilvl0\cf2 {\listtext \'95 }Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ 14 | {\listtext \'95 }Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ 15 | {\listtext \'95 }Neither the name of BinaryMethod.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\ 16 | \ 17 | \ 18 | \pard\pardeftab720\sl400\sa280\ql\qnatural 19 | \cf2 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.} -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDScroller.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHudScroller.h 3 | // HUDScroller 4 | // 5 | // Created by BinaryGod on 5/22/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | 36 | // Special thanks to Matt Gemmell (http://mattgemmell.com/) for helping me solve the 37 | // transparent drawing issues. Your awesome man!!! 38 | 39 | #import 40 | #import "BGThemeManager.h" 41 | #import "BGHUDGeometry.h" 42 | 43 | @interface BGHUDScroller : NSScroller { 44 | 45 | NSString *arrowPosition; 46 | NSString *themeKey; 47 | } 48 | 49 | @property (copy) NSString *themeKey; 50 | 51 | - (void)drawDecrementArrow:(BOOL)highlighted; 52 | - (void)drawIncrementArrow:(BOOL)highlighted; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDButtonCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDButtonCell.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/25/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | #import "BGThemeManager.h" 37 | #import "BGHUDGeometry.h" 38 | 39 | @interface BGHUDButtonCell : NSButtonCell { 40 | 41 | NSString *themeKey; 42 | } 43 | 44 | @property (retain) NSString *themeKey; 45 | 46 | -(void)drawCheckInFrame:(NSRect)frame isRadio:(BOOL)radio; 47 | -(void)drawTexturedRoundedButtonInFrame:(NSRect)frame; 48 | -(void)drawRoundRectButtonInFrame:(NSRect)frame; 49 | -(void)drawSmallSquareButtonInFrame:(NSRect)frame; 50 | -(void)drawRoundedButtonInFrame:(NSRect)frame; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Speech Translator/NSString+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSString+SBJSON.h" 31 | #import "SBJsonParser.h" 32 | 33 | @implementation NSString (NSString_SBJSON) 34 | 35 | - (id)JSONFragmentValue 36 | { 37 | SBJsonParser *jsonParser = [SBJsonParser new]; 38 | id repr = [jsonParser fragmentWithString:self]; 39 | if (!repr) 40 | NSLog(@"-JSONFragmentValue failed. Error trace is: %@", [jsonParser errorTrace]); 41 | [jsonParser release]; 42 | return repr; 43 | } 44 | 45 | - (id)JSONValue 46 | { 47 | SBJsonParser *jsonParser = [SBJsonParser new]; 48 | id repr = [jsonParser objectWithString:self]; 49 | if (!repr) 50 | NSLog(@"-JSONValue failed. Error trace is: %@", [jsonParser errorTrace]); 51 | [jsonParser release]; 52 | return repr; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Speech Translator/NSObject+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSObject+SBJSON.h" 31 | #import "SBJsonWriter.h" 32 | 33 | @implementation NSObject (NSObject_SBJSON) 34 | 35 | - (NSString *)JSONFragment { 36 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 37 | NSString *json = [jsonWriter stringWithFragment:self]; 38 | if (!json) 39 | NSLog(@"-JSONFragment failed. Error trace is: %@", [jsonWriter errorTrace]); 40 | [jsonWriter release]; 41 | return json; 42 | } 43 | 44 | - (NSString *)JSONRepresentation { 45 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 46 | NSString *json = [jsonWriter stringWithObject:self]; 47 | if (!json) 48 | NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]); 49 | [jsonWriter release]; 50 | return json; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Speech Translator/JSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | @mainpage A strict JSON parser and generator for Objective-C 32 | 33 | JSON (JavaScript Object Notation) is a lightweight data-interchange 34 | format. This framework provides two apis for parsing and generating 35 | JSON. One standard object-based and a higher level api consisting of 36 | categories added to existing Objective-C classes. 37 | 38 | Learn more on the http://code.google.com/p/json-framework project site. 39 | 40 | This framework does its best to be as strict as possible, both in what it 41 | accepts and what it generates. For example, it does not support trailing commas 42 | in arrays or objects. Nor does it support embedded comments, or 43 | anything else not in the JSON specification. This is considered a feature. 44 | 45 | */ 46 | 47 | #import "SBJSON.h" 48 | #import "NSObject+SBJSON.h" 49 | #import "NSString+SBJSON.h" 50 | 51 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDAppKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDAppKit.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 5/25/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | 36 | #import "BGHUDScroller.h" 37 | #import "BGHUDButtonCell.h" 38 | #import "BGHUDSliderCell.h" 39 | #import "BGHUDScrollView.h" 40 | #import "BGHUDPopUpButtonCell.h" 41 | #import "BGHUDTextFieldCell.h" 42 | #import "BGHUDProgressIndicator.h" 43 | #import "BGHUDTokenFieldCell.h" 44 | #import "BGHUDSecureTextFieldCell.h" 45 | #import "BGHUDOutlineView.h" 46 | #import "BGHUDTableView.h" 47 | #import "BGThemeManager.h" 48 | #import "BGHUDTableCornerView.h" 49 | #import "BGHUDSearchFieldCell.h" 50 | #import "BGHUDSegmentedCell.h" 51 | #import "BGHUDColorWell.h" 52 | #import "BGHUDLabel.h" 53 | #import "BGHUDBox.h" 54 | #import "BGHUDView.h" 55 | #import "BGHUDComboBoxCell.h" 56 | #import "BGHUDStepperCell.h" -------------------------------------------------------------------------------- /Speech Translator/NSString+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | /** 33 | @brief Adds JSON parsing methods to NSString 34 | 35 | This is a category on NSString that adds methods for parsing the target string. 36 | */ 37 | @interface NSString (NSString_SBJSON) 38 | 39 | 40 | /** 41 | @brief Returns the object represented in the receiver, or nil on error. 42 | 43 | Returns a a scalar object represented by the string's JSON fragment representation. 44 | 45 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 46 | */ 47 | - (id)JSONFragmentValue; 48 | 49 | /** 50 | @brief Returns the NSDictionary or NSArray represented by the current string's JSON representation. 51 | 52 | Returns the dictionary or array represented in the receiver, or nil on error. 53 | 54 | Returns the NSDictionary or NSArray represented by the current string's JSON representation. 55 | */ 56 | - (id)JSONValue; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Speech Translator/GTMNSString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+HTML.h 3 | // Dealing with NSStrings that contain HTML 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import 21 | 22 | /// Utilities for NSStrings containing HTML 23 | @interface NSString (GTMNSStringHTMLAdditions) 24 | 25 | /// Get a string where internal characters that need escaping for HTML are escaped 26 | // 27 | /// For example, '&' become '&'. This will only cover characters from table 28 | /// A.2.2 of http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 29 | /// which is what you want for a unicode encoded webpage. If you have a ascii 30 | /// or non-encoded webpage, please use stringByEscapingAsciiHTML which will 31 | /// encode all characters. 32 | /// 33 | /// For obvious reasons this call is only safe once. 34 | // 35 | // Returns: 36 | // Autoreleased NSString 37 | // 38 | - (NSString *)gtm_stringByEscapingForHTML; 39 | 40 | /// Get a string where internal characters that need escaping for HTML are escaped 41 | // 42 | /// For example, '&' become '&' 43 | /// All non-mapped characters (unicode that don't have a &keyword; mapping) 44 | /// will be converted to the appropriate &#xxx; value. If your webpage is 45 | /// unicode encoded (UTF16 or UTF8) use stringByEscapingHTML instead as it is 46 | /// faster, and produces less bloated and more readable HTML (as long as you 47 | /// are using a unicode compliant HTML reader). 48 | /// 49 | /// For obvious reasons this call is only safe once. 50 | // 51 | // Returns: 52 | // Autoreleased NSString 53 | // 54 | - (NSString *)gtm_stringByEscapingForAsciiHTML; 55 | 56 | /// Get a string where internal characters that are escaped for HTML are unescaped 57 | // 58 | /// For example, '&' becomes '&' 59 | /// Handles and 2 cases as well 60 | /// 61 | // Returns: 62 | // Autoreleased NSString 63 | // 64 | - (NSString *)gtm_stringByUnescapingFromHTML; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Speech Translator/NSObject+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | 33 | /** 34 | @brief Adds JSON generation to Foundation classes 35 | 36 | This is a category on NSObject that adds methods for returning JSON representations 37 | of standard objects to the objects themselves. This means you can call the 38 | -JSONRepresentation method on an NSArray object and it'll do what you want. 39 | */ 40 | @interface NSObject (NSObject_SBJSON) 41 | 42 | /** 43 | @brief Returns a string containing the receiver encoded as a JSON fragment. 44 | 45 | This method is added as a category on NSObject but is only actually 46 | supported for the following objects: 47 | @li NSDictionary 48 | @li NSArray 49 | @li NSString 50 | @li NSNumber (also used for booleans) 51 | @li NSNull 52 | 53 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 54 | */ 55 | - (NSString *)JSONFragment; 56 | 57 | /** 58 | @brief Returns a string containing the receiver encoded in JSON. 59 | 60 | This method is added as a category on NSObject but is only actually 61 | supported for the following objects: 62 | @li NSDictionary 63 | @li NSArray 64 | */ 65 | - (NSString *)JSONRepresentation; 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDBox.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDBox.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 2/16/09. 6 | // Copyright 2009 none. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation and/or 16 | // other materials provided with the distribution. 17 | // 18 | // Neither the name of the BinaryMethod.com nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software without 20 | // specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 23 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | #import "BGThemeManager.h" 35 | 36 | @interface BGHUDBox : NSBox { 37 | 38 | BOOL flipGradient; 39 | BOOL drawTopBorder; 40 | BOOL drawBottomBorder; 41 | BOOL drawLeftBorder; 42 | BOOL drawRightBorder; 43 | NSColor *borderColor; 44 | BOOL drawTopShadow; 45 | BOOL drawBottomShadow; 46 | BOOL drawLeftShadow; 47 | BOOL drawRightShadow; 48 | NSColor *shadowColor; 49 | NSGradient *customGradient; 50 | 51 | NSColor *color1; 52 | NSColor *color2; 53 | 54 | NSString *themeKey; 55 | BOOL useTheme; 56 | } 57 | 58 | @property BOOL flipGradient; 59 | @property BOOL drawTopBorder; 60 | @property BOOL drawBottomBorder; 61 | @property BOOL drawLeftBorder; 62 | @property BOOL drawRightBorder; 63 | @property (retain) NSColor *borderColor; 64 | @property BOOL drawTopShadow; 65 | @property BOOL drawBottomShadow; 66 | @property BOOL drawLeftShadow; 67 | @property BOOL drawRightShadow; 68 | @property (retain) NSColor *shadowColor; 69 | @property (retain) NSGradient *customGradient; 70 | @property (retain) NSColor *color1; 71 | @property (retain) NSColor *color2; 72 | 73 | @property (retain) NSString *themeKey; 74 | @property BOOL useTheme; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGHUDView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGHUDView.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 2/15/09. 6 | // Copyright 2009 none. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation and/or 16 | // other materials provided with the distribution. 17 | // 18 | // Neither the name of the BinaryMethod.com nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software without 20 | // specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 23 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | #import "BGThemeManager.h" 35 | 36 | @interface BGHUDView : NSView { 37 | 38 | BOOL flipGradient; 39 | BOOL drawTopBorder; 40 | BOOL drawBottomBorder; 41 | BOOL drawLeftBorder; 42 | BOOL drawRightBorder; 43 | NSColor *borderColor; 44 | BOOL drawTopShadow; 45 | BOOL drawBottomShadow; 46 | BOOL drawLeftShadow; 47 | BOOL drawRightShadow; 48 | NSColor *shadowColor; 49 | NSGradient *customGradient; 50 | 51 | NSColor *color1; 52 | NSColor *color2; 53 | 54 | NSString *themeKey; 55 | BOOL useTheme; 56 | } 57 | 58 | @property BOOL flipGradient; 59 | @property BOOL drawTopBorder; 60 | @property BOOL drawBottomBorder; 61 | @property BOOL drawLeftBorder; 62 | @property BOOL drawRightBorder; 63 | @property (retain) NSColor *borderColor; 64 | @property BOOL drawTopShadow; 65 | @property BOOL drawBottomShadow; 66 | @property BOOL drawLeftShadow; 67 | @property BOOL drawRightShadow; 68 | @property (retain) NSColor *shadowColor; 69 | @property (retain) NSGradient *customGradient; 70 | @property (retain) NSColor *color1; 71 | @property (retain) NSColor *color2; 72 | 73 | @property (retain) NSString *themeKey; 74 | @property BOOL useTheme; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonBase.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonBase.h" 31 | NSString * SBJSONErrorDomain = @"org.brautaset.JSON.ErrorDomain"; 32 | 33 | 34 | @implementation SBJsonBase 35 | 36 | @synthesize errorTrace; 37 | @synthesize maxDepth; 38 | 39 | - (id)init { 40 | self = [super init]; 41 | if (self) 42 | self.maxDepth = 512; 43 | return self; 44 | } 45 | 46 | - (void)dealloc { 47 | [errorTrace release]; 48 | [super dealloc]; 49 | } 50 | 51 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str { 52 | NSDictionary *userInfo; 53 | if (!errorTrace) { 54 | errorTrace = [NSMutableArray new]; 55 | userInfo = [NSDictionary dictionaryWithObject:str forKey:NSLocalizedDescriptionKey]; 56 | 57 | } else { 58 | userInfo = [NSDictionary dictionaryWithObjectsAndKeys: 59 | str, NSLocalizedDescriptionKey, 60 | [errorTrace lastObject], NSUnderlyingErrorKey, 61 | nil]; 62 | } 63 | 64 | NSError *error = [NSError errorWithDomain:SBJSONErrorDomain code:code userInfo:userInfo]; 65 | 66 | [self willChangeValueForKey:@"errorTrace"]; 67 | [errorTrace addObject:error]; 68 | [self didChangeValueForKey:@"errorTrace"]; 69 | } 70 | 71 | - (void)clearErrorTrace { 72 | [self willChangeValueForKey:@"errorTrace"]; 73 | [errorTrace release]; 74 | errorTrace = nil; 75 | [self didChangeValueForKey:@"errorTrace"]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Speech Translator/SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonParser.h" 32 | #import "SBJsonWriter.h" 33 | 34 | /** 35 | @brief Facade for SBJsonWriter/SBJsonParser. 36 | 37 | Requests are forwarded to instances of SBJsonWriter and SBJsonParser. 38 | */ 39 | @interface SBJSON : SBJsonBase { 40 | 41 | @private 42 | SBJsonParser *jsonParser; 43 | SBJsonWriter *jsonWriter; 44 | } 45 | 46 | 47 | /// Return the fragment represented by the given string 48 | - (id)fragmentWithString:(NSString*)jsonrep 49 | error:(NSError**)error; 50 | 51 | /// Return the object represented by the given string 52 | - (id)objectWithString:(NSString*)jsonrep 53 | error:(NSError**)error; 54 | 55 | /// Parse the string and return the represented object (or scalar) 56 | - (id)objectWithString:(id)value 57 | allowScalar:(BOOL)x 58 | error:(NSError**)error; 59 | 60 | 61 | /// Return JSON representation of an array or dictionary 62 | - (NSString*)stringWithObject:(id)value 63 | error:(NSError**)error; 64 | 65 | /// Return JSON representation of any legal JSON value 66 | - (NSString*)stringWithFragment:(id)value 67 | error:(NSError**)error; 68 | 69 | /// Return JSON representation (or fragment) for the given object 70 | - (NSString*)stringWithObject:(id)value 71 | allowScalar:(BOOL)x 72 | error:(NSError**)error; 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Speech Translator.xcodeproj/xcuserdata/yuri.xcuserdatad/xcschemes/Speech Translator.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | extern NSString * SBJSONErrorDomain; 33 | 34 | 35 | enum { 36 | EUNSUPPORTED = 1, 37 | EPARSENUM, 38 | EPARSE, 39 | EFRAGMENT, 40 | ECTRL, 41 | EUNICODE, 42 | EDEPTH, 43 | EESCAPE, 44 | ETRAILCOMMA, 45 | ETRAILGARBAGE, 46 | EEOF, 47 | EINPUT 48 | }; 49 | 50 | /** 51 | @brief Common base class for parsing & writing. 52 | 53 | This class contains the common error-handling code and option between the parser/writer. 54 | */ 55 | @interface SBJsonBase : NSObject { 56 | NSMutableArray *errorTrace; 57 | 58 | @protected 59 | NSUInteger depth, maxDepth; 60 | } 61 | 62 | /** 63 | @brief The maximum recursing depth. 64 | 65 | Defaults to 512. If the input is nested deeper than this the input will be deemed to be 66 | malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can 67 | turn off this security feature by setting the maxDepth value to 0. 68 | */ 69 | @property NSUInteger maxDepth; 70 | 71 | /** 72 | @brief Return an error trace, or nil if there was no errors. 73 | 74 | Note that this method returns the trace of the last method that failed. 75 | You need to check the return value of the call you're making to figure out 76 | if the call actually failed, before you know call this method. 77 | */ 78 | @property(copy,readonly) NSArray* errorTrace; 79 | 80 | /// @internal for use in subclasses to add errors to the stack trace 81 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str; 82 | 83 | /// @internal for use in subclasess to clear the error before a new parsing attempt 84 | - (void)clearErrorTrace; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonBase.h" 32 | 33 | /** 34 | @brief Options for the parser class. 35 | 36 | This exists so the SBJSON facade can implement the options in the parser without having to re-declare them. 37 | */ 38 | @protocol SBJsonParser 39 | 40 | /** 41 | @brief Return the object represented by the given string. 42 | 43 | Returns the object represented by the passed-in string or nil on error. The returned object can be 44 | a string, number, boolean, null, array or dictionary. 45 | 46 | @param repr the json string to parse 47 | */ 48 | - (id)objectWithString:(NSString *)repr; 49 | 50 | @end 51 | 52 | 53 | /** 54 | @brief The JSON parser class. 55 | 56 | JSON is mapped to Objective-C types in the following way: 57 | 58 | @li Null -> NSNull 59 | @li String -> NSMutableString 60 | @li Array -> NSMutableArray 61 | @li Object -> NSMutableDictionary 62 | @li Boolean -> NSNumber (initialised with -initWithBool:) 63 | @li Number -> NSDecimalNumber 64 | 65 | Since Objective-C doesn't have a dedicated class for boolean values, these turns into NSNumber 66 | instances. These are initialised with the -initWithBool: method, and 67 | round-trip back to JSON properly. (They won't silently suddenly become 0 or 1; they'll be 68 | represented as 'true' and 'false' again.) 69 | 70 | JSON numbers turn into NSDecimalNumber instances, 71 | as we can thus avoid any loss of precision. (JSON allows ridiculously large numbers.) 72 | 73 | */ 74 | @interface SBJsonParser : SBJsonBase { 75 | 76 | @private 77 | const char *c; 78 | } 79 | 80 | @end 81 | 82 | // don't use - exists for backwards compatibility with 2.1.x only. Will be removed in 2.3. 83 | @interface SBJsonParser (Private) 84 | - (id)fragmentWithString:(id)repr; 85 | @end 86 | 87 | 88 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Docs/Theming.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270 2 | {\fonttbl\f0\fnil\fcharset0 Verdana;\f1\fnil\fcharset0 Monaco;} 3 | {\colortbl;\red255\green255\blue255;\red73\green73\blue73;\red170\green13\blue145;\red92\green38\blue153; 4 | \red46\green13\blue110;\red63\green110\blue116;\red196\green26\blue22;} 5 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{decimal\}.}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} 6 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} 7 | \margl1440\margr1440\vieww17480\viewh13340\viewkind0 8 | \deftab720 9 | \pard\pardeftab720\sl400\sa280\ql\qnatural 10 | 11 | \f0\b\fs24 \cf2 \ul \ulc2 Theming 12 | \b0 \ulnone \ 13 | BGHUDAppKit is more powerful than it first appears to be. I have designed the classes with the mentality of reinvention. Why should everyone have to reinvent the NSScroller if they want to apply iTunes style colors to it? You shouldn't have to. I've done the hard work and research for you. My purpose in life as a developer is to make life easier, programmers are lazy :) Every control in BGHUDAppKit uses a theme, you can have one theme for every control or you could have 10 different themes for 10 different controls.\ 14 | \ 15 | 16 | \b \ul Creating a Theme 17 | \b0 \ulnone \ 18 | Creating a theme does take a little bit of work. If you look inside the Headers directory of BGHUDAppKit.framework you will see a file name " 19 | \b BGTheme.h 20 | \b0 ". This is the master theme file. Inside of it will see every theme method available and a short description of each explaining where it is used at.\ 21 | Just create a subclass of BGTheme and start overriding whatever methods you need to change.\ 22 | \ 23 | 24 | \b \ul Adding to ThemeManager 25 | \b0 \ulnone \ 26 | BGHUDAppKit uses a singleton BGThemeManager obect. This makes it so that there is only ever one instance of the theme allocated, thus saving memory. In this example my subclassed theme is myTheme.m. This code is in my main AppController object.\ 27 | 28 | \b\fs20 Code 29 | \fs24 \ 30 | \pard\tx480\pardeftab480\ql\qnatural\pardirnatural 31 | 32 | \f1\b0\fs20 \cf0 \CocoaLigature0 - (\cf3 void\cf0 )awakeFromNib \{\ 33 | \ 34 | [[\cf4 BGThemeManager\cf0 \cf5 keyedManager\cf0 ] \cf5 setTheme\cf0 : [[\cf6 myTheme\cf0 \cf5 alloc\cf0 ] \cf5 init\cf0 ] \cf5 forKey\cf0 : \cf7 @"myTheme"\cf0 ];\ 35 | \} 36 | \f0\fs24 \cf2 \CocoaLigature1 \ 37 | \pard\tx0\tx0\tx0\pardeftab720\sl400\sa280\ql\qnatural 38 | \ls1\ilvl0\cf2 \ 39 | Whats happening? We are telling BGThemeManagers keyedManager object that we want to add a new theme instance to its memory with a key of "myTheme". You can add as many as you like.\ 40 | Two default themes are provided for you. The one you'll see when you Drag'n'Drop from the IB palette is "gradientTheme", this is also the theme you will 41 | \b always 42 | \b0 see when you simulate the interface in IB. This is because your custom theme object doesn't exist yet. The second default theme is "flatTheme", this theme is just a slight dark gradient, giving the controls a less 'candy' look.\ 43 | \ 44 | \ls1\ilvl0 45 | \b \ul Using the new theme 46 | \b0 \ulnone \ 47 | Making the controls use this theme is even easier. In IB a new inspector panel will present itself when you are in the proper focus for that control. Some controls, like buttons, have this panel in the Cell focus. Click on a button once, and then again and it will get a halo around it. You will see a new section called "Theme" with a text box labeled "Theme Key". Just type your theme key in there and when you build the app that control (and only that control) will use your custom theme.\ 48 | \ls1\ilvl0 49 | \i\b Hint: 50 | \b0 Controls that are a combination of two controls, such as NSOutlineView, NSTableView, will have to have the theme set for the ScrollView and the underlying object, in the example above they would be OutlineView, and TableView respectively. 51 | \i0 \ 52 | } -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Resources/Theming.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270 2 | {\fonttbl\f0\fnil\fcharset0 Verdana;\f1\fnil\fcharset0 Monaco;} 3 | {\colortbl;\red255\green255\blue255;\red73\green73\blue73;\red170\green13\blue145;\red92\green38\blue153; 4 | \red46\green13\blue110;\red63\green110\blue116;\red196\green26\blue22;} 5 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{decimal\}.}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} 6 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} 7 | \margl1440\margr1440\vieww17480\viewh13340\viewkind0 8 | \deftab720 9 | \pard\pardeftab720\sl400\sa280\ql\qnatural 10 | 11 | \f0\b\fs24 \cf2 \ul \ulc2 Theming 12 | \b0 \ulnone \ 13 | BGHUDAppKit is more powerful than it first appears to be. I have designed the classes with the mentality of reinvention. Why should everyone have to reinvent the NSScroller if they want to apply iTunes style colors to it? You shouldn't have to. I've done the hard work and research for you. My purpose in life as a developer is to make life easier, programmers are lazy :) Every control in BGHUDAppKit uses a theme, you can have one theme for every control or you could have 10 different themes for 10 different controls.\ 14 | \ 15 | 16 | \b \ul Creating a Theme 17 | \b0 \ulnone \ 18 | Creating a theme does take a little bit of work. If you look inside the Headers directory of BGHUDAppKit.framework you will see a file name " 19 | \b BGTheme.h 20 | \b0 ". This is the master theme file. Inside of it will see every theme method available and a short description of each explaining where it is used at.\ 21 | Just create a subclass of BGTheme and start overriding whatever methods you need to change.\ 22 | \ 23 | 24 | \b \ul Adding to ThemeManager 25 | \b0 \ulnone \ 26 | BGHUDAppKit uses a singleton BGThemeManager obect. This makes it so that there is only ever one instance of the theme allocated, thus saving memory. In this example my subclassed theme is myTheme.m. This code is in my main AppController object.\ 27 | 28 | \b\fs20 Code 29 | \fs24 \ 30 | \pard\tx480\pardeftab480\ql\qnatural\pardirnatural 31 | 32 | \f1\b0\fs20 \cf0 \CocoaLigature0 - (\cf3 void\cf0 )awakeFromNib \{\ 33 | \ 34 | [[\cf4 BGThemeManager\cf0 \cf5 keyedManager\cf0 ] \cf5 setTheme\cf0 : [[\cf6 myTheme\cf0 \cf5 alloc\cf0 ] \cf5 init\cf0 ] \cf5 forKey\cf0 : \cf7 @"myTheme"\cf0 ];\ 35 | \} 36 | \f0\fs24 \cf2 \CocoaLigature1 \ 37 | \pard\tx0\tx0\tx0\pardeftab720\sl400\sa280\ql\qnatural 38 | \ls1\ilvl0\cf2 \ 39 | Whats happening? We are telling BGThemeManagers keyedManager object that we want to add a new theme instance to its memory with a key of "myTheme". You can add as many as you like.\ 40 | Two default themes are provided for you. The one you'll see when you Drag'n'Drop from the IB palette is "gradientTheme", this is also the theme you will 41 | \b always 42 | \b0 see when you simulate the interface in IB. This is because your custom theme object doesn't exist yet. The second default theme is "flatTheme", this theme is just a slight dark gradient, giving the controls a less 'candy' look.\ 43 | \ 44 | \ls1\ilvl0 45 | \b \ul Using the new theme 46 | \b0 \ulnone \ 47 | Making the controls use this theme is even easier. In IB a new inspector panel will present itself when you are in the proper focus for that control. Some controls, like buttons, have this panel in the Cell focus. Click on a button once, and then again and it will get a halo around it. You will see a new section called "Theme" with a text box labeled "Theme Key". Just type your theme key in there and when you build the app that control (and only that control) will use your custom theme.\ 48 | \ls1\ilvl0 49 | \i\b Hint: 50 | \b0 Controls that are a combination of two controls, such as NSOutlineView, NSTableView, will have to have the theme set for the ScrollView and the underlying object, in the example above they would be OutlineView, and TableView respectively. 51 | \i0 \ 52 | } -------------------------------------------------------------------------------- /Speech Translator/GoogleTranslate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GoogleTranslate.m 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import "GoogleTranslate.h" 10 | 11 | 12 | @implementation GoogleTranslate 13 | 14 | 15 | @synthesize delegate; 16 | 17 | 18 | - (void)dealloc 19 | { 20 | if (fetcher) [fetcher stopFetching], [fetcher release], fetcher = nil; 21 | 22 | [super dealloc]; 23 | } 24 | 25 | 26 | - (void)translate:(NSString *)text from:(NSString *)inLanguage to:(NSString *)outLanguage 27 | { 28 | NSString *sourceText = [text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 29 | NSString *langs = [[NSString stringWithFormat:@"%@|%@", inLanguage, outLanguage] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 30 | NSString *requestURL = [NSString stringWithFormat:@"%@&q=%@&langpair=%@", GoogleURL, sourceText, langs]; 31 | 32 | NSURL *url = [NSURL URLWithString:requestURL]; 33 | NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; 34 | 35 | fetcher = [[GDataHTTPFetcher httpFetcherWithRequest:request] retain]; 36 | [fetcher beginFetchWithDelegate:self 37 | didFinishSelector:@selector(httpFetcher:finishedWithData:) 38 | didFailSelector:@selector(httpFetcher:didFail:)]; 39 | 40 | } 41 | 42 | 43 | - (void)httpFetcher:(GDataHTTPFetcher *)aFetcher finishedWithData:(NSData *)retrievedData 44 | { 45 | [fetcher release], fetcher = nil; 46 | 47 | NSString *jsonResponse = [[NSString alloc] initWithData:retrievedData encoding:NSUTF8StringEncoding]; 48 | 49 | if ((!jsonResponse) || ([jsonResponse length] == 0)) 50 | { 51 | NSLog(@"GT ParseServerResponse: Response is empty."); 52 | 53 | if([delegate respondsToSelector:@selector(didFail)]) 54 | { 55 | [delegate didFail]; 56 | } 57 | 58 | if (jsonResponse) [jsonResponse release]; 59 | 60 | return; 61 | } 62 | 63 | NSDictionary *responseData = [jsonResponse JSONValue]; 64 | [jsonResponse release]; 65 | 66 | if ((!responseData) || (![responseData isKindOfClass:[NSDictionary class]])) 67 | { 68 | 69 | NSLog(@"GT ParseServerResponse: JSONReader failed or Unexpected response type"); 70 | 71 | if([delegate respondsToSelector:@selector(didFail)]) 72 | { 73 | [delegate didFail]; 74 | } 75 | 76 | return; 77 | } 78 | 79 | NSDictionary *rData = [responseData objectForKey:@"responseData"]; 80 | 81 | if ((!rData) || (![rData isKindOfClass:[NSDictionary class]])) 82 | { 83 | 84 | NSLog(@"GT ParseServerResponse: No responseData or Unexpected response type"); 85 | 86 | if([delegate respondsToSelector:@selector(didFail)]) 87 | { 88 | [delegate didFail]; 89 | } 90 | 91 | return; 92 | } 93 | 94 | NSString *translatedText = [rData objectForKey:@"translatedText"]; 95 | 96 | if ((!translatedText) || (![translatedText isKindOfClass:[NSString class]])) 97 | { 98 | 99 | NSLog(@"GT ParseServerResponse: No translatedText or Unexpected response type"); 100 | 101 | if([delegate respondsToSelector:@selector(didFail)]) 102 | { 103 | [delegate didFail]; 104 | } 105 | 106 | return; 107 | } 108 | 109 | NSLog(@"GT ParseServerResponse: Translated (%@)", translatedText); 110 | 111 | if([delegate respondsToSelector:@selector(didTranslate:)]) 112 | { 113 | [delegate didTranslate:translatedText]; 114 | } 115 | } 116 | 117 | - (void)httpFetcher:(GDataHTTPFetcher *)aFetcher didFail:(NSError *)error 118 | { 119 | [fetcher release], fetcher = nil; 120 | 121 | NSLog(@"GoogleTranslate fetcher did failed"); 122 | 123 | if([delegate respondsToSelector:@selector(didFail)]) 124 | { 125 | [delegate didFail]; 126 | } 127 | } 128 | 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /Speech Translator/GoogleASR.m: -------------------------------------------------------------------------------- 1 | // 2 | // GoogleASR.m 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 15.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import "GoogleASR.h" 10 | 11 | 12 | @implementation GoogleASR 13 | 14 | 15 | @synthesize delegate; 16 | 17 | 18 | - (void)dealloc 19 | { 20 | if (fetcher) [fetcher stopFetching], [fetcher release], fetcher = nil; 21 | 22 | [super dealloc]; 23 | } 24 | 25 | - (void)speechRecognition:(NSString *)flacPath language:(NSString *)language 26 | { 27 | NSData *data = [NSData dataWithContentsOfFile:flacPath]; 28 | 29 | NSMutableString *requestURL = [NSMutableString stringWithString:GoogleASRURL]; 30 | [requestURL appendString:language]; 31 | 32 | NSURL *url = [NSURL URLWithString:requestURL]; 33 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0]; 34 | [request setHTTPMethod:@"POST"]; 35 | [request setValue:@"audio/x-flac; rate=16000" forHTTPHeaderField:@"Content-Type"]; 36 | [request setValue:[NSString stringWithFormat:@"%i", [data length]] forHTTPHeaderField:@"Content-Length"]; 37 | [request setHTTPBody:data]; 38 | 39 | fetcher = [[GDataHTTPFetcher httpFetcherWithRequest:request] retain]; 40 | [fetcher beginFetchWithDelegate:self 41 | didFinishSelector:@selector(httpFetcher:finishedWithData:) 42 | didFailSelector:@selector(httpFetcher:didFail:)]; 43 | } 44 | 45 | 46 | - (void)httpFetcher:(GDataHTTPFetcher *)aFetcher finishedWithData:(NSData *)retrievedData 47 | { 48 | [fetcher release], fetcher = nil; 49 | 50 | NSString *jsonResponse = [[NSString alloc] initWithData:retrievedData encoding:NSUTF8StringEncoding]; 51 | 52 | if ((!jsonResponse) || ([jsonResponse length] == 0)) 53 | { 54 | NSLog(@"GA ParseServerResponse: Response is empty."); 55 | 56 | if([delegate respondsToSelector:@selector(didFail)]) 57 | { 58 | [delegate didFail]; 59 | } 60 | 61 | if (jsonResponse) [jsonResponse release]; 62 | 63 | return; 64 | } 65 | 66 | NSDictionary *responseData = [jsonResponse JSONValue]; 67 | [jsonResponse release]; 68 | 69 | if ((!responseData) || (![responseData isKindOfClass:[NSDictionary class]])) 70 | { 71 | 72 | NSLog(@"GA ParseServerResponse: JSONReader failed or Unexpected response type"); 73 | 74 | if([delegate respondsToSelector:@selector(didFail)]) 75 | { 76 | [delegate didFail]; 77 | } 78 | 79 | return; 80 | } 81 | 82 | NSArray *tmpArray = [responseData objectForKey:@"hypotheses"]; 83 | 84 | if ((!tmpArray) || (![tmpArray isKindOfClass:[NSArray class]]) || ([tmpArray count] == 0)) 85 | { 86 | 87 | NSLog(@"GA ParseServerResponse: No hypotheses array or Unexpected response type"); 88 | 89 | if([delegate respondsToSelector:@selector(didFail)]) 90 | { 91 | [delegate didFail]; 92 | } 93 | 94 | return; 95 | } 96 | 97 | NSString *result = nil; 98 | 99 | for (int i = 0; i < [tmpArray count]; i++) 100 | { 101 | NSDictionary *hypothesesDict = [tmpArray objectAtIndex:i]; 102 | 103 | if ((hypothesesDict) && ([hypothesesDict isKindOfClass:[NSDictionary class]])) 104 | { 105 | NSString *utterance = [hypothesesDict objectForKey:@"utterance"]; 106 | 107 | if ((utterance) && ([utterance isKindOfClass:[NSString class]])) 108 | { 109 | result = utterance; 110 | } 111 | 112 | } 113 | 114 | } 115 | 116 | if (!result) 117 | { 118 | NSLog(@"GA ParseServerResponse: No utterance string or Unexpected response type"); 119 | 120 | if([delegate respondsToSelector:@selector(didFail)]) 121 | { 122 | [delegate didFail]; 123 | } 124 | 125 | return; 126 | } 127 | 128 | NSLog(@"GA ParseServerResponse: SR (%@)", result); 129 | 130 | if([delegate respondsToSelector:@selector(didSR:)]) 131 | { 132 | [delegate didSR:result]; 133 | } 134 | } 135 | 136 | 137 | - (void)httpFetcher:(GDataHTTPFetcher *)aFetcher didFail:(NSError *)error 138 | { 139 | [fetcher release], fetcher = nil; 140 | 141 | NSLog(@"GoogleASR fetcher did failed"); 142 | 143 | if([delegate respondsToSelector:@selector(didFail)]) 144 | { 145 | [delegate didFail]; 146 | } 147 | } 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonBase.h" 32 | 33 | /** 34 | @brief Options for the writer class. 35 | 36 | This exists so the SBJSON facade can implement the options in the writer without having to re-declare them. 37 | */ 38 | @protocol SBJsonWriter 39 | 40 | /** 41 | @brief Whether we are generating human-readable (multiline) JSON. 42 | 43 | Set whether or not to generate human-readable JSON. The default is NO, which produces 44 | JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable 45 | JSON with linebreaks after each array value and dictionary key/value pair, indented two 46 | spaces per nesting level. 47 | */ 48 | @property BOOL humanReadable; 49 | 50 | /** 51 | @brief Whether or not to sort the dictionary keys in the output. 52 | 53 | If this is set to YES, the dictionary keys in the JSON output will be in sorted order. 54 | (This is useful if you need to compare two structures, for example.) The default is NO. 55 | */ 56 | @property BOOL sortKeys; 57 | 58 | /** 59 | @brief Return JSON representation (or fragment) for the given object. 60 | 61 | Returns a string containing JSON representation of the passed in value, or nil on error. 62 | If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. 63 | 64 | @param value any instance that can be represented as a JSON fragment 65 | 66 | */ 67 | - (NSString*)stringWithObject:(id)value; 68 | 69 | @end 70 | 71 | 72 | /** 73 | @brief The JSON writer class. 74 | 75 | Objective-C types are mapped to JSON types in the following way: 76 | 77 | @li NSNull -> Null 78 | @li NSString -> String 79 | @li NSArray -> Array 80 | @li NSDictionary -> Object 81 | @li NSNumber (-initWithBool:) -> Boolean 82 | @li NSNumber -> Number 83 | 84 | In JSON the keys of an object must be strings. NSDictionary keys need 85 | not be, but attempting to convert an NSDictionary with non-string keys 86 | into JSON will throw an exception. 87 | 88 | NSNumber instances created with the +initWithBool: method are 89 | converted into the JSON boolean "true" and "false" values, and vice 90 | versa. Any other NSNumber instances are converted to a JSON number the 91 | way you would expect. 92 | 93 | */ 94 | @interface SBJsonWriter : SBJsonBase { 95 | 96 | @private 97 | BOOL sortKeys, humanReadable; 98 | } 99 | 100 | @end 101 | 102 | // don't use - exists for backwards compatibility. Will be removed in 2.3. 103 | @interface SBJsonWriter (Private) 104 | - (NSString*)stringWithFragment:(id)value; 105 | @end 106 | 107 | /** 108 | @brief Allows generation of JSON for otherwise unsupported classes. 109 | 110 | If you have a custom class that you want to create a JSON representation for you can implement 111 | this method in your class. It should return a representation of your object defined 112 | in terms of objects that can be translated into JSON. For example, a Person 113 | object might implement it like this: 114 | 115 | @code 116 | - (id)jsonProxyObject { 117 | return [NSDictionary dictionaryWithObjectsAndKeys: 118 | name, @"name", 119 | phone, @"phone", 120 | email, @"email", 121 | nil]; 122 | } 123 | @endcode 124 | 125 | */ 126 | @interface NSObject (SBProxyForJson) 127 | - (id)proxyForJson; 128 | @end 129 | 130 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Versions/A/Headers/BGTheme.h: -------------------------------------------------------------------------------- 1 | // 2 | // BGThemeManager.h 3 | // BGHUDAppKit 4 | // 5 | // Created by BinaryGod on 6/15/08. 6 | // 7 | // Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god@gmail.com) 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, 11 | // are permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this 14 | // list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright notice, 17 | // this list of conditions and the following disclaimer in the documentation and/or 18 | // other materials provided with the distribution. 19 | // 20 | // Neither the name of the BinaryMethod.com nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software without 22 | // specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND 25 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 30 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #import 36 | 37 | 38 | @interface BGTheme : NSObject { 39 | 40 | BOOL useAlpha; 41 | } 42 | 43 | //Scroller Theme 44 | -(NSColor *)scrollerStroke; //Color for Arrows/Knob Border 45 | -(NSGradient *)scrollerKnobGradient; //Gradient used to draw knob 46 | -(NSGradient *)scrollerTrackGradient; //Gradient used to draw knob track 47 | -(NSGradient *)scrollerArrowNormalGradient; //Gradient used on normal Arrow button 48 | -(NSGradient *)scrollerArrowPushedGradient; //Gradient used on pushed Arrow button 49 | -(float)scrollerAlphaValue; 50 | 51 | //Slider Theme 52 | -(NSColor *)sliderTrackColor; //Color used to draw slider track 53 | -(NSColor *)disabledSliderTrackColor; //Color used to draw disabled slider track 54 | -(NSGradient *)knobColor; //Gradient used to draw the knob 55 | -(NSGradient *)highlightKnobColor; //Gradient used to draw highlighted knob 56 | -(NSGradient *)disabledKnobColor; //Gradient used to draw disabled knob 57 | 58 | //Text Based Theme 59 | -(NSColor *)textFillColor; //Color of background if drawbackground set to ON 60 | -(NSColor *)selectionHighlightActiveColor; //Background color of higlighted text (active app) 61 | -(NSColor *)selectionHighlightInActiveColor; //Background color of higlighted text (inactive app) 62 | -(NSColor *)selectionTextActiveColor; //Selection text color (active app) 63 | -(NSColor *)selectionTextInActiveColor; //Selection text color (inactive app) 64 | -(NSColor *)placeholderTextColor; //Placeholder text color 65 | 66 | //Progress Theme 67 | -(NSGradient *)progressTrackGradient; //Gradient used to draw progress bar track 68 | 69 | //Token Theme 70 | -(NSColor *)tokenFillNormal; //Color used to fill normal token background 71 | -(NSColor *)tokenFillHighlight; //Color used to fill highlighted token background 72 | -(NSColor *)tokenBorder; //Color used to draw token border 73 | -(NSColor *)tokenTextColor; //Color used to draw token text 74 | 75 | //Table Theme 76 | -(NSColor *)cellHighlightColor; //Color used to highlight selected row 77 | -(NSArray *)cellAlternatingRowColors; //NSArray with 2 Colors used to draw alternating rows 78 | -(NSColor *)cellSelectedTextColor; //Color used to draw text when row selected 79 | -(NSColor *)cellEditingFillColor; //Color used to draw background of editing cell 80 | -(NSColor *)tableBackgroundColor; //Color used to fill table background 81 | -(NSColor *)tableHeaderCellBorderColor; //Color used to draw border in column headers 82 | -(NSGradient *)tableHeaderCellNormalFill; //Gradient used to draw normal column header 83 | -(NSGradient *)tableHeaderCellPushedFill; //Gradient used to draw pushed column header 84 | -(NSGradient *)tableHeaderCellSelectedFill; //Gradient used to draw selected column header 85 | 86 | //General Theme 87 | -(NSGradient *)normalGradient; //Gradient used to draw normal background 88 | -(NSGradient *)disabledNormalGradient; //Gradient used for disabled background 89 | -(NSGradient *)pushedGradient; //Gradient used to draw pushed background 90 | -(NSGradient *)highlightGradient; //Gradient used to draw highlight background 91 | -(NSGradient *)normalComplexGradient; //Gradient used to draw normal 4 tone gradient 92 | -(NSGradient *)disabledNormalComplexGradient; //Gradient used to draw disabled 4 tone gradient 93 | -(NSGradient *)pushedComplexGradient; //Gradient used to draw pushed 4 tone gradient 94 | -(NSGradient *)highlightComplexGradient; //Gradient used to draw highlight 4 tone gradient 95 | -(NSColor *)normalSolidFill; //Solid color used to draw normal background 96 | -(NSColor *)disabledNormalSolidFill; //Solid color used to draw disabled background 97 | -(NSColor *)pushedSolidFill; //Solid color used to draw pushed background 98 | -(NSColor *)highlightSolidFill; //Solid color used to draw highlight background 99 | -(NSColor *)strokeColor; //Color used to draw border 100 | -(NSColor *)disabledStrokeColor; //Color used for disabled border 101 | -(NSColor *)darkStrokeColor; //Color used to draw dark shadow border 102 | -(NSColor *)textColor; //Color used to draw text 103 | -(NSColor *)disabledTextColor; //Color used to draw disabled text 104 | -(NSShadow *)dropShadow; //Drop shadow used on all controls 105 | -(float)alphaValue; //Alpha value that is an optional paremeter, used only 106 | //if you want certain colors to be draw with the same 107 | //alpha value. 108 | -(float)disabledAlphaValue; //Same as above but the disabled varient 109 | -(NSShadow *)focusRing; //Shadow used for the focus rings 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /Speech Translator/BGHUDAppKit.framework/Docs/README.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270 2 | {\fonttbl\f0\fnil\fcharset0 Verdana;\f1\fnil\fcharset0 LucidaGrande;} 3 | {\colortbl;\red255\green255\blue255;\red73\green73\blue73;} 4 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc3\levelnfcn3\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{upper-alpha\}.}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1} 5 | {\list\listtemplateid2\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{decimal\}.}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid1\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid2}} 6 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} 7 | \deftab720 8 | \pard\pardeftab720\sl400\sa280\ql\qnatural 9 | 10 | \f0\i\b\fs24 \cf2 This document contains information on Embedding, Using and a section on how to reduce the final size of your distributed app when using BGHUDAppKit. See \ul Shrinking\ulnone for details. 11 | \i0 \ul \ 12 | BGHUDAppKit 13 | \b0 \ulnone \ 14 | BGHUDAppKit is a small framework I designed to fill the gap left by Apple when they released the nifty HUD window but forgot to release their controls that match it. There are few really good frameworks out there that will provide you with the HUD style interface. This is where the big change in BGHUDAppKit becomes clear. I use absolutely 15 | \b \ul NO 16 | \b0 \ulnone resources or images to give these controls the HUD appearance. BGHUDAppKit uses 100% native Cocoa drawing functions like NSColor, NSGradient and NSBezierPath. Because of this the framework is much smaller, provides a cleaner interface and the biggie...it is already Resolution Independence ready. And of course it is free and open-source.\ 17 | Homepage: http://www.binarymethod.com\ 18 | Source can be acquired by pointing your Subversion client to:\ 19 | 20 | \i http://binarymethod.svnrepository.com/bghudappkit/svn/trunk 21 | \i0 \ 22 | See License.rtf for details on licensing. Short synopsis, use BGHUDAppKit as you see fit, give me credit and keep license intact.\ 23 | \ 24 | 25 | \b \ul Goals 26 | \b0 \ulnone \ 27 | When I was designing BGHUDAppKit I had four goals in mind to keep me on track in the project:\ 28 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sl400\sa280\ql\qnatural 29 | \ls1\ilvl0\cf2 {\listtext A. }HUD Style Controls that function exactly like their Apple counterparts do, using as much of the original functionality of the parent as possible. Why reinvent the wheel?\ 30 | {\listtext B. }Ease of use, try to make the framework Drag'n'Drop. My biggest pet peeve is having an -(void)awakeFromNib\{\} FILLED with a bunch of control initialization setup code. I hate having to do that, Apple made all their controls IB compatible, why can't I?\ 31 | {\listtext C. }No Images or other external resources, use ONLY native Cocoa API.\ 32 | {\listtext D. }Controls that can be themed to any style of UI. I've done the hard drawing work, why should you do it all over again? See Theming.rtf for details on this subject.\ 33 | \ 34 | \pard\pardeftab720\sl400\sa280\ql\qnatural 35 | 36 | \b \cf2 \ul \ulc2 Embedding 37 | \b0 \ulnone \ 38 | BGHUDAppKit is very easy to use. The framework can be embedded in your distributed app. There are three steps to achieve this.\ 39 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sl400\sa280\ql\qnatural 40 | \ls2\ilvl0\cf2 {\listtext 1. }Add BGHUDAppKit to your project\ 41 | \pard\tx940\tx1440\pardeftab720\li1440\fi-1440\sl400\sa280\ql\qnatural 42 | \ls2\ilvl1\cf2 {\listtext 43 | \f1 \uc0\u8259 44 | \f0 }Right-Click (Ctrl-Click) on your "Frameworks" group in XCode\ 45 | {\listtext 46 | \f1 \uc0\u8259 47 | \f0 }Select "Add 48 | \b \'9b 49 | \b0 Existing Frameworks..."\ 50 | {\listtext 51 | \f1 \uc0\u8259 52 | \f0 }Navigate to BGHUDAppKit.framework and hit "Add"\ 53 | \pard\tx220\tx720\tx1120\pardeftab720\li720\fi-720\sl400\sa280\ql\qnatural 54 | \ls2\ilvl0\cf2 {\listtext 2. }In your active target add a new "Copy Files Build Phase"\ 55 | \pard\tx940\tx1440\pardeftab720\li1440\fi-1440\sl400\sa280\ql\qnatural 56 | \ls2\ilvl1\cf2 {\listtext 57 | \f1 \uc0\u8259 58 | \f0 }Right-Click (Ctrl-Click) on project Target under "Targets" group in XCode.\ 59 | {\listtext 60 | \f1 \uc0\u8259 61 | \f0 }Select "Add 62 | \b \'9b 63 | \b0 New Build Phase 64 | \b \'9b 65 | \b0 New Copy Files Build Phase"\ 66 | {\listtext 67 | \f1 \uc0\u8259 68 | \f0 }Double-Click new "Copy Files" build phase\ 69 | {\listtext 70 | \f1 \uc0\u8259 71 | \f0 }Select "Frameworks" from Destination drop down. (Close the window)\ 72 | \pard\tx220\tx720\tx1120\pardeftab720\li720\fi-720\sl400\sa280\ql\qnatural 73 | \ls2\ilvl0\cf2 {\listtext 3. }Add BGHUDAppKit.framework to newly created build phase\ 74 | \pard\tx940\tx1440\pardeftab720\li1440\fi-1440\sl400\sa280\ql\qnatural 75 | \ls2\ilvl1\cf2 {\listtext 76 | \f1 \uc0\u8259 77 | \f0 }Drag BGHUDAppKit.framework from "Frameworks" group in XCode to "Copy Files" build phase under "Targets" group in XCode.\ 78 | \pard\tx0\tx720\tx1120\pardeftab720\sl400\sa280\ql\qnatural 79 | \ls2\ilvl0\cf2 Build and go. If you inspect your .APP you should now see BGHUDAppKit.framework sitting peacefully in your \{APP\}Contents/Frameworks directory.\ 80 | \ 81 | \pard\tx0\tx720\tx1120\pardeftab720\sl400\sa280\ql\qnatural 82 | \ls2\ilvl0 83 | \b \cf2 \ul Usage 84 | \b0 \ulnone \ 85 | Using BGHUDAppKit is a breeze. After you have embedded the framework just open your MainMenu.nib like normal and start designing your app. BGHUDAppKit comes with a IB Plugin already in the framework. Just look for the Library item called "BGHUDAppKit", now you can use it like any other control in Apple. Drag and Drop, setup your properties and run.\ 86 | \ 87 | \ls2\ilvl0 88 | \b \ul Shrinking 89 | \b0 \ulnone \ 90 | BGHUDAppKit is appox 1.0 Mb in size. This is quite large for a framework this simple. The extra disk space is taken up by the BGHUDAppKitPlugin which is the IB Plugin. This really doesn't need to be in your distributed app, the framework will function normally without it. 91 | \b Do NOT delete BGHUDAppKitPlugin from your 92 | \i source 93 | \i0 BGHUDAppKit.framework. 94 | \b0 \ 95 | The reason the framework is build this way is because IB will automatically look in a linked framework for a plugin. This seemed, to me at least, the most logical and easiest way to distribute the plugin to you the developer.\ 96 | A way to shrink your final APP size is really simple. Create a new "Run Script" build phase and copy the following line to it.\ 97 | \pard\tx0\tx720\tx1120\pardeftab720\sl400\sa280\ql\qnatural 98 | \ls2\ilvl0 99 | \i \cf2 rm -fR "$\{CONFIGURATION_BUILD_DIR\}/$\{WRAPPER_NAME\}/Contents/Frameworks/BGHUDAppKit.framework/Versions/Current/Resources"\ 100 | \pard\tx0\tx720\tx1120\pardeftab720\sl400\sa280\ql\qnatural 101 | \ls2\ilvl0 102 | \i0 \cf2 What happens is this: When you build XCode will look in your final .APP folder and remove the unneeded Resources directory that BGHUDAppKitPlugin resides in. This shrinks BGHUDAppKit.framework down to approx 400k. Quite a big difference.\ 103 | \pard\tx0\tx0\tx0\pardeftab720\sl400\sa280\ql\qnatural 104 | \ls2\ilvl0\cf2 \ 105 | } -------------------------------------------------------------------------------- /Speech Translator/SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJSON.h" 31 | 32 | @implementation SBJSON 33 | 34 | - (id)init { 35 | self = [super init]; 36 | if (self) { 37 | jsonWriter = [SBJsonWriter new]; 38 | jsonParser = [SBJsonParser new]; 39 | [self setMaxDepth:512]; 40 | 41 | } 42 | return self; 43 | } 44 | 45 | - (void)dealloc { 46 | [jsonWriter release]; 47 | [jsonParser release]; 48 | [super dealloc]; 49 | } 50 | 51 | #pragma mark Writer 52 | 53 | 54 | - (NSString *)stringWithObject:(id)obj { 55 | NSString *repr = [jsonWriter stringWithObject:obj]; 56 | if (repr) 57 | return repr; 58 | 59 | [errorTrace release]; 60 | errorTrace = [[jsonWriter errorTrace] mutableCopy]; 61 | return nil; 62 | } 63 | 64 | /** 65 | Returns a string containing JSON representation of the passed in value, or nil on error. 66 | If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error. 67 | 68 | @param value any instance that can be represented as a JSON fragment 69 | @param allowScalar wether to return json fragments for scalar objects 70 | @param error used to return an error by reference (pass NULL if this is not desired) 71 | 72 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 73 | */ 74 | - (NSString*)stringWithObject:(id)value allowScalar:(BOOL)allowScalar error:(NSError**)error { 75 | 76 | NSString *json = allowScalar ? [jsonWriter stringWithFragment:value] : [jsonWriter stringWithObject:value]; 77 | if (json) 78 | return json; 79 | 80 | [errorTrace release]; 81 | errorTrace = [[jsonWriter errorTrace] mutableCopy]; 82 | 83 | if (error) 84 | *error = [errorTrace lastObject]; 85 | return nil; 86 | } 87 | 88 | /** 89 | Returns a string containing JSON representation of the passed in value, or nil on error. 90 | If nil is returned and @p error is not NULL, @p error can be interrogated to find the cause of the error. 91 | 92 | @param value any instance that can be represented as a JSON fragment 93 | @param error used to return an error by reference (pass NULL if this is not desired) 94 | 95 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 96 | */ 97 | - (NSString*)stringWithFragment:(id)value error:(NSError**)error { 98 | return [self stringWithObject:value 99 | allowScalar:YES 100 | error:error]; 101 | } 102 | 103 | /** 104 | Returns a string containing JSON representation of the passed in value, or nil on error. 105 | If nil is returned and @p error is not NULL, @p error can be interrogated to find the cause of the error. 106 | 107 | @param value a NSDictionary or NSArray instance 108 | @param error used to return an error by reference (pass NULL if this is not desired) 109 | */ 110 | - (NSString*)stringWithObject:(id)value error:(NSError**)error { 111 | return [self stringWithObject:value 112 | allowScalar:NO 113 | error:error]; 114 | } 115 | 116 | #pragma mark Parsing 117 | 118 | - (id)objectWithString:(NSString *)repr { 119 | id obj = [jsonParser objectWithString:repr]; 120 | if (obj) 121 | return obj; 122 | 123 | [errorTrace release]; 124 | errorTrace = [[jsonParser errorTrace] mutableCopy]; 125 | 126 | return nil; 127 | } 128 | 129 | /** 130 | Returns the object represented by the passed-in string or nil on error. The returned object can be 131 | a string, number, boolean, null, array or dictionary. 132 | 133 | @param value the json string to parse 134 | @param allowScalar whether to return objects for JSON fragments 135 | @param error used to return an error by reference (pass NULL if this is not desired) 136 | 137 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 138 | */ 139 | - (id)objectWithString:(id)value allowScalar:(BOOL)allowScalar error:(NSError**)error { 140 | 141 | id obj = allowScalar ? [jsonParser fragmentWithString:value] : [jsonParser objectWithString:value]; 142 | if (obj) 143 | return obj; 144 | 145 | [errorTrace release]; 146 | errorTrace = [[jsonParser errorTrace] mutableCopy]; 147 | 148 | if (error) 149 | *error = [errorTrace lastObject]; 150 | return nil; 151 | } 152 | 153 | /** 154 | Returns the object represented by the passed-in string or nil on error. The returned object can be 155 | a string, number, boolean, null, array or dictionary. 156 | 157 | @param repr the json string to parse 158 | @param error used to return an error by reference (pass NULL if this is not desired) 159 | 160 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 161 | */ 162 | - (id)fragmentWithString:(NSString*)repr error:(NSError**)error { 163 | return [self objectWithString:repr 164 | allowScalar:YES 165 | error:error]; 166 | } 167 | 168 | /** 169 | Returns the object represented by the passed-in string or nil on error. The returned object 170 | will be either a dictionary or an array. 171 | 172 | @param repr the json string to parse 173 | @param error used to return an error by reference (pass NULL if this is not desired) 174 | */ 175 | - (id)objectWithString:(NSString*)repr error:(NSError**)error { 176 | return [self objectWithString:repr 177 | allowScalar:NO 178 | error:error]; 179 | } 180 | 181 | 182 | 183 | #pragma mark Properties - parsing 184 | 185 | - (NSUInteger)maxDepth { 186 | return jsonParser.maxDepth; 187 | } 188 | 189 | - (void)setMaxDepth:(NSUInteger)d { 190 | jsonWriter.maxDepth = jsonParser.maxDepth = d; 191 | } 192 | 193 | 194 | #pragma mark Properties - writing 195 | 196 | - (BOOL)humanReadable { 197 | return jsonWriter.humanReadable; 198 | } 199 | 200 | - (void)setHumanReadable:(BOOL)x { 201 | jsonWriter.humanReadable = x; 202 | } 203 | 204 | - (BOOL)sortKeys { 205 | return jsonWriter.sortKeys; 206 | } 207 | 208 | - (void)setSortKeys:(BOOL)x { 209 | jsonWriter.sortKeys = x; 210 | } 211 | 212 | @end 213 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonWriter.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonWriter.h" 31 | 32 | @interface SBJsonWriter () 33 | 34 | - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json; 35 | - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json; 36 | - (BOOL)appendDictionary:(NSDictionary*)fragment into:(NSMutableString*)json; 37 | - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json; 38 | 39 | - (NSString*)indent; 40 | 41 | @end 42 | 43 | @implementation SBJsonWriter 44 | 45 | static NSMutableCharacterSet *kEscapeChars; 46 | 47 | + (void)initialize { 48 | kEscapeChars = [[NSMutableCharacterSet characterSetWithRange: NSMakeRange(0,32)] retain]; 49 | [kEscapeChars addCharactersInString: @"\"\\"]; 50 | } 51 | 52 | 53 | @synthesize sortKeys; 54 | @synthesize humanReadable; 55 | 56 | /** 57 | @deprecated This exists in order to provide fragment support in older APIs in one more version. 58 | It should be removed in the next major version. 59 | */ 60 | - (NSString*)stringWithFragment:(id)value { 61 | [self clearErrorTrace]; 62 | depth = 0; 63 | NSMutableString *json = [NSMutableString stringWithCapacity:128]; 64 | 65 | if ([self appendValue:value into:json]) 66 | return json; 67 | 68 | return nil; 69 | } 70 | 71 | 72 | - (NSString*)stringWithObject:(id)value { 73 | 74 | if ([value isKindOfClass:[NSDictionary class]] || [value isKindOfClass:[NSArray class]]) { 75 | return [self stringWithFragment:value]; 76 | } 77 | 78 | if ([value respondsToSelector:@selector(proxyForJson)]) { 79 | NSString *tmp = [self stringWithObject:[value proxyForJson]]; 80 | if (tmp) 81 | return tmp; 82 | } 83 | 84 | 85 | [self clearErrorTrace]; 86 | [self addErrorWithCode:EFRAGMENT description:@"Not valid type for JSON"]; 87 | return nil; 88 | } 89 | 90 | 91 | - (NSString*)indent { 92 | return [@"\n" stringByPaddingToLength:1 + 2 * depth withString:@" " startingAtIndex:0]; 93 | } 94 | 95 | - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json { 96 | if ([fragment isKindOfClass:[NSDictionary class]]) { 97 | if (![self appendDictionary:fragment into:json]) 98 | return NO; 99 | 100 | } else if ([fragment isKindOfClass:[NSArray class]]) { 101 | if (![self appendArray:fragment into:json]) 102 | return NO; 103 | 104 | } else if ([fragment isKindOfClass:[NSString class]]) { 105 | if (![self appendString:fragment into:json]) 106 | return NO; 107 | 108 | } else if ([fragment isKindOfClass:[NSNumber class]]) { 109 | if ('c' == *[fragment objCType]) 110 | [json appendString:[fragment boolValue] ? @"true" : @"false"]; 111 | else 112 | [json appendString:[fragment stringValue]]; 113 | 114 | } else if ([fragment isKindOfClass:[NSNull class]]) { 115 | [json appendString:@"null"]; 116 | } else if ([fragment respondsToSelector:@selector(proxyForJson)]) { 117 | [self appendValue:[fragment proxyForJson] into:json]; 118 | 119 | } else { 120 | [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"JSON serialisation not supported for %@", [fragment class]]]; 121 | return NO; 122 | } 123 | return YES; 124 | } 125 | 126 | - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json { 127 | if (maxDepth && ++depth > maxDepth) { 128 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 129 | return NO; 130 | } 131 | [json appendString:@"["]; 132 | 133 | BOOL addComma = NO; 134 | for (id value in fragment) { 135 | if (addComma) 136 | [json appendString:@","]; 137 | else 138 | addComma = YES; 139 | 140 | if ([self humanReadable]) 141 | [json appendString:[self indent]]; 142 | 143 | if (![self appendValue:value into:json]) { 144 | return NO; 145 | } 146 | } 147 | 148 | depth--; 149 | if ([self humanReadable] && [fragment count]) 150 | [json appendString:[self indent]]; 151 | [json appendString:@"]"]; 152 | return YES; 153 | } 154 | 155 | - (BOOL)appendDictionary:(NSDictionary*)fragment into:(NSMutableString*)json { 156 | if (maxDepth && ++depth > maxDepth) { 157 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 158 | return NO; 159 | } 160 | [json appendString:@"{"]; 161 | 162 | NSString *colon = [self humanReadable] ? @" : " : @":"; 163 | BOOL addComma = NO; 164 | NSArray *keys = [fragment allKeys]; 165 | if (self.sortKeys) 166 | keys = [keys sortedArrayUsingSelector:@selector(compare:)]; 167 | 168 | for (id value in keys) { 169 | if (addComma) 170 | [json appendString:@","]; 171 | else 172 | addComma = YES; 173 | 174 | if ([self humanReadable]) 175 | [json appendString:[self indent]]; 176 | 177 | if (![value isKindOfClass:[NSString class]]) { 178 | [self addErrorWithCode:EUNSUPPORTED description: @"JSON object key must be string"]; 179 | return NO; 180 | } 181 | 182 | if (![self appendString:value into:json]) 183 | return NO; 184 | 185 | [json appendString:colon]; 186 | if (![self appendValue:[fragment objectForKey:value] into:json]) { 187 | [self addErrorWithCode:EUNSUPPORTED description:[NSString stringWithFormat:@"Unsupported value for key %@ in object", value]]; 188 | return NO; 189 | } 190 | } 191 | 192 | depth--; 193 | if ([self humanReadable] && [fragment count]) 194 | [json appendString:[self indent]]; 195 | [json appendString:@"}"]; 196 | return YES; 197 | } 198 | 199 | - (BOOL)appendString:(NSString*)fragment into:(NSMutableString*)json { 200 | 201 | [json appendString:@"\""]; 202 | 203 | NSRange esc = [fragment rangeOfCharacterFromSet:kEscapeChars]; 204 | if ( !esc.length ) { 205 | // No special chars -- can just add the raw string: 206 | [json appendString:fragment]; 207 | 208 | } else { 209 | NSUInteger length = [fragment length]; 210 | for (NSUInteger i = 0; i < length; i++) { 211 | unichar uc = [fragment characterAtIndex:i]; 212 | switch (uc) { 213 | case '"': [json appendString:@"\\\""]; break; 214 | case '\\': [json appendString:@"\\\\"]; break; 215 | case '\t': [json appendString:@"\\t"]; break; 216 | case '\n': [json appendString:@"\\n"]; break; 217 | case '\r': [json appendString:@"\\r"]; break; 218 | case '\b': [json appendString:@"\\b"]; break; 219 | case '\f': [json appendString:@"\\f"]; break; 220 | default: 221 | if (uc < 0x20) { 222 | [json appendFormat:@"\\u%04x", uc]; 223 | } else { 224 | CFStringAppendCharacters((CFMutableStringRef)json, &uc, 1); 225 | } 226 | break; 227 | 228 | } 229 | } 230 | } 231 | 232 | [json appendString:@"\""]; 233 | return YES; 234 | } 235 | 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /Speech Translator/Speech_TranslatorAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // Speech_TranslatorAppDelegate.m 3 | // Speech Translator 4 | // 5 | // Created by Yuri Yuriev on 14.04.11. 6 | // Copyright 2011 Yuri Yuriev. All rights reserved. 7 | // 8 | 9 | #import "Speech_TranslatorAppDelegate.h" 10 | #import "GoogleASR.h" 11 | 12 | @implementation Speech_TranslatorAppDelegate 13 | 14 | @synthesize window; 15 | 16 | 17 | - (void)awakeFromNib 18 | { 19 | [textLabel setHidden:YES]; 20 | [indicator setUsesThreadedAnimation:YES]; 21 | [indicator setDisplayedWhenStopped:NO]; 22 | 23 | [button setTitle:NSLocalizedString(@"Record", @"")]; 24 | [window setTitle:NSLocalizedString(@"Title", @"")]; 25 | 26 | [popUp removeAllItems]; 27 | [popUp addItemWithTitle:NSLocalizedString(@"RUEN", @"")]; 28 | [popUp addItemWithTitle:NSLocalizedString(@"ENRU", @"")]; 29 | 30 | [window center]; 31 | } 32 | 33 | 34 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 35 | { 36 | googleASR = [[GoogleASR alloc] init]; 37 | googleASR.delegate = self; 38 | googleTranslate = [[GoogleTranslate alloc] init]; 39 | googleTranslate.delegate = self; 40 | microsoftTTS = [[MicrosoftTTS alloc] init]; 41 | microsoftTTS.delegate = self; 42 | 43 | recording = NO; 44 | recordPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:@"SpeechTranslator"] retain]; 45 | 46 | BOOL success = NO; 47 | 48 | mCaptureSession = [[QTCaptureSession alloc] init]; 49 | 50 | QTCaptureDevice *audioDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeSound]; 51 | 52 | if (!audioDevice) 53 | { 54 | [mCaptureSession release], mCaptureSession = nil; 55 | 56 | [textLabel setStringValue:NSLocalizedString(@"AudioError", @"")]; 57 | [button setHidden:YES]; 58 | [popUp setHidden:YES]; 59 | [textLabel setHidden:NO]; 60 | } 61 | 62 | success = [audioDevice open:NULL]; 63 | 64 | if (!success) 65 | { 66 | [mCaptureSession release], mCaptureSession = nil; 67 | 68 | [textLabel setStringValue:NSLocalizedString(@"AudioError", @"")]; 69 | [button setHidden:YES]; 70 | [popUp setHidden:YES]; 71 | [textLabel setHidden:NO]; 72 | } 73 | 74 | mCaptureAudioDeviceInput = [[QTCaptureDeviceInput alloc] initWithDevice:audioDevice]; 75 | success = [mCaptureSession addInput:mCaptureAudioDeviceInput error:NULL]; 76 | 77 | if (!success) 78 | { 79 | [mCaptureSession release], mCaptureSession = nil; 80 | [mCaptureAudioDeviceInput release], mCaptureAudioDeviceInput = nil; 81 | 82 | [textLabel setStringValue:NSLocalizedString(@"AudioError", @"")]; 83 | [button setHidden:YES]; 84 | [popUp setHidden:YES]; 85 | [textLabel setHidden:NO]; 86 | } 87 | 88 | mCaptureMovieFileOutput = [[QTCaptureMovieFileOutput alloc] init]; 89 | success = [mCaptureSession addOutput:mCaptureMovieFileOutput error:NULL]; 90 | 91 | if (!success) 92 | { 93 | [mCaptureSession release], mCaptureSession = nil; 94 | [mCaptureAudioDeviceInput release], mCaptureAudioDeviceInput = nil; 95 | [mCaptureMovieFileOutput release], mCaptureMovieFileOutput = nil; 96 | 97 | //error handler 98 | } 99 | 100 | [mCaptureMovieFileOutput setDelegate:self]; 101 | 102 | [mCaptureMovieFileOutput setCompressionOptions:[QTCompressionOptions compressionOptionsWithIdentifier:@"QTCompressionOptionsHighQualityAACAudio"] forConnection:[[mCaptureMovieFileOutput connections] objectAtIndex:0]]; 103 | 104 | [mCaptureSession startRunning]; 105 | } 106 | 107 | 108 | - (void)dealloc 109 | { 110 | if (recordTimer) 111 | { 112 | [recordTimer invalidate]; 113 | [recordTimer release]; 114 | recordTimer = nil; 115 | } 116 | 117 | if (mCaptureSession) [mCaptureSession release], mCaptureSession = nil; 118 | if (mCaptureAudioDeviceInput)[mCaptureAudioDeviceInput release], mCaptureAudioDeviceInput = nil; 119 | if (mCaptureMovieFileOutput) [mCaptureMovieFileOutput release], mCaptureMovieFileOutput = nil; 120 | if (recordPath) [recordPath release]; 121 | 122 | [super dealloc]; 123 | } 124 | 125 | 126 | - (IBAction)popUpAction:(id)sender 127 | { 128 | 129 | } 130 | 131 | 132 | - (IBAction)buttonAction:(id)sender 133 | { 134 | if (recording) 135 | { 136 | [recordTimer invalidate]; 137 | [recordTimer release]; 138 | recordTimer = nil; 139 | 140 | recording = NO; 141 | [button setTitle:NSLocalizedString(@"Record", @"")]; 142 | [popUp setHidden:NO]; 143 | [textLabel setHidden:YES]; 144 | 145 | [mCaptureMovieFileOutput recordToOutputFileURL:nil]; 146 | } 147 | else 148 | { 149 | NSFileManager *fileManager = [NSFileManager defaultManager]; 150 | [fileManager removeItemAtPath:recordPath error:NULL]; 151 | [fileManager createDirectoryAtPath:recordPath withIntermediateDirectories:YES attributes:nil error:NULL]; 152 | 153 | [mCaptureMovieFileOutput recordToOutputFileURL:[NSURL fileURLWithPath:[recordPath stringByAppendingPathComponent:@"record.m4a"]]]; 154 | 155 | recording = YES; 156 | [button setTitle:NSLocalizedString(@"Stop", @"")]; 157 | [textLabel setStringValue:[NSString stringWithFormat:NSLocalizedString(@"RecordMessage", @""), recordMAXSec]]; 158 | [popUp setHidden:YES]; 159 | [textLabel setHidden:NO]; 160 | 161 | timerInitDate = [[NSDate date] timeIntervalSince1970]; 162 | 163 | recordTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(recordTimerAction:) userInfo:nil repeats:YES] retain]; 164 | } 165 | } 166 | 167 | 168 | - (void)captureOutput:(QTCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL forConnections:(NSArray *)connections dueToError:(NSError *)error 169 | { 170 | NSTask *aTask = [[NSTask alloc] init]; 171 | NSMutableArray *args = [NSMutableArray array]; 172 | 173 | [args addObject:@"-i"]; 174 | [args addObject:@"record.m4a"]; 175 | [args addObject:@"-acodec"]; 176 | [args addObject:@"flac"]; 177 | [args addObject:@"-ac"]; 178 | [args addObject:@"1"]; 179 | [args addObject:@"-ar"]; 180 | [args addObject:@"16000"]; 181 | [args addObject:@"record.flac"]; 182 | [aTask setCurrentDirectoryPath:recordPath]; 183 | [aTask setLaunchPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ffmpeg"]]; 184 | [aTask setArguments:args]; 185 | [aTask launch]; 186 | [aTask waitUntilExit]; 187 | [aTask release]; 188 | 189 | NSFileManager *fileManager = [NSFileManager defaultManager]; 190 | 191 | if ([fileManager fileExistsAtPath:[recordPath stringByAppendingPathComponent:@"record.flac"]]) 192 | { 193 | [popUp setHidden:YES]; 194 | [button setHidden:YES]; 195 | [textLabel setStringValue:NSLocalizedString(@"DataHandling", @"")]; 196 | [textLabel setHidden:NO]; 197 | [indicator startAnimation:self]; 198 | 199 | NSString *language; 200 | 201 | if ([popUp indexOfSelectedItem] == 0) 202 | language = @"ru-RU"; 203 | else 204 | language = @"en-US"; 205 | 206 | [googleASR speechRecognition:[recordPath stringByAppendingPathComponent:@"record.flac"] language:language]; 207 | } 208 | else 209 | { 210 | NSRunCriticalAlertPanel(NSLocalizedString(@"Error", @""), NSLocalizedString(@"RecordError", @""), NSLocalizedString(@"Continue", @"") ,nil, nil); 211 | } 212 | } 213 | 214 | 215 | - (void)recordTimerAction:(NSTimer *)timer 216 | { 217 | NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970]; 218 | 219 | int t = currentTime - timerInitDate; 220 | 221 | if (t < recordMAXSec) 222 | { 223 | [textLabel setStringValue:[NSString stringWithFormat:NSLocalizedString(@"RecordMessage", @""), recordMAXSec - t]]; 224 | } 225 | else 226 | { 227 | [recordTimer invalidate]; 228 | [recordTimer release]; 229 | recordTimer = nil; 230 | 231 | recording = NO; 232 | [button setTitle:NSLocalizedString(@"Record", @"")]; 233 | [popUp setHidden:NO]; 234 | [textLabel setHidden:YES]; 235 | 236 | [mCaptureMovieFileOutput recordToOutputFileURL:nil]; 237 | } 238 | } 239 | 240 | 241 | - (void)didSR:(NSString *)text 242 | { 243 | NSString *inLanguage; 244 | NSString *outLanguage; 245 | 246 | if ([popUp indexOfSelectedItem] == 0) 247 | { 248 | inLanguage = @"ru"; 249 | outLanguage = @"en"; 250 | } 251 | else 252 | { 253 | inLanguage = @"en"; 254 | outLanguage = @"ru"; 255 | } 256 | 257 | [googleTranslate translate:text from:inLanguage to:outLanguage]; 258 | } 259 | 260 | 261 | - (void)didTranslate:(NSString *)translatedText 262 | { 263 | NSString *language; 264 | 265 | if ([popUp indexOfSelectedItem] == 0) 266 | language = @"en"; 267 | else 268 | language = @"ru"; 269 | 270 | [microsoftTTS textToSpeech:translatedText language:language]; 271 | } 272 | 273 | 274 | - (void)dataReady:(NSData *)audioData 275 | { 276 | [popUp setHidden:NO]; 277 | [button setHidden:NO]; 278 | [textLabel setHidden:YES]; 279 | [indicator stopAnimation:self]; 280 | 281 | if (player) 282 | { 283 | [player stop]; 284 | [player release]; 285 | player = nil; 286 | } 287 | 288 | player = [[NSSound alloc] initWithData:audioData]; 289 | [player play]; 290 | } 291 | 292 | 293 | - (void)didFail 294 | { 295 | [popUp setHidden:NO]; 296 | [button setHidden:NO]; 297 | [textLabel setHidden:YES]; 298 | [indicator stopAnimation:self]; 299 | 300 | NSRunCriticalAlertPanel(NSLocalizedString(@"Error", @""), NSLocalizedString(@"DataError", @""), NSLocalizedString(@"Continue", @"") ,nil, nil); 301 | } 302 | 303 | 304 | - (BOOL)windowShouldClose:(id)sender 305 | { 306 | [NSApp terminate:self]; 307 | return YES; 308 | } 309 | 310 | 311 | @end 312 | -------------------------------------------------------------------------------- /Speech Translator/GTMDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMDefines.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | // ============================================================================ 20 | 21 | #include 22 | #include 23 | 24 | // Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs 25 | #ifndef MAC_OS_X_VERSION_10_5 26 | #define MAC_OS_X_VERSION_10_5 1050 27 | #endif 28 | #ifndef MAC_OS_X_VERSION_10_6 29 | #define MAC_OS_X_VERSION_10_6 1060 30 | #endif 31 | 32 | // ---------------------------------------------------------------------------- 33 | // CPP symbols that can be overridden in a prefix to control how the toolbox 34 | // is compiled. 35 | // ---------------------------------------------------------------------------- 36 | 37 | 38 | // By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and 39 | // GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens 40 | // when a validation fails. If you implement your own validators, you may want 41 | // to control their internals using the same macros for consistency. 42 | #ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 43 | #define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0 44 | #endif 45 | 46 | // Give ourselves a consistent way to do inlines. Apple's macros even use 47 | // a few different actual definitions, so we're based off of the foundation 48 | // one. 49 | #if !defined(GTM_INLINE) 50 | #if defined (__GNUC__) && (__GNUC__ == 4) 51 | #define GTM_INLINE static __inline__ __attribute__((always_inline)) 52 | #else 53 | #define GTM_INLINE static __inline__ 54 | #endif 55 | #endif 56 | 57 | // Give ourselves a consistent way of doing externs that links up nicely 58 | // when mixing objc and objc++ 59 | #if !defined (GTM_EXTERN) 60 | #if defined __cplusplus 61 | #define GTM_EXTERN extern "C" 62 | #else 63 | #define GTM_EXTERN extern 64 | #endif 65 | #endif 66 | 67 | // Give ourselves a consistent way of exporting things if we have visibility 68 | // set to hidden. 69 | #if !defined (GTM_EXPORT) 70 | #define GTM_EXPORT __attribute__((visibility("default"))) 71 | #endif 72 | 73 | // _GTMDevLog & _GTMDevAssert 74 | // 75 | // _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for 76 | // developer level errors. This implementation simply macros to NSLog/NSAssert. 77 | // It is not intended to be a general logging/reporting system. 78 | // 79 | // Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert 80 | // for a little more background on the usage of these macros. 81 | // 82 | // _GTMDevLog log some error/problem in debug builds 83 | // _GTMDevAssert assert if conditon isn't met w/in a method/function 84 | // in all builds. 85 | // 86 | // To replace this system, just provide different macro definitions in your 87 | // prefix header. Remember, any implementation you provide *must* be thread 88 | // safe since this could be called by anything in what ever situtation it has 89 | // been placed in. 90 | // 91 | 92 | // We only define the simple macros if nothing else has defined this. 93 | #ifndef _GTMDevLog 94 | 95 | #ifdef DEBUG 96 | #define _GTMDevLog(...) NSLog(__VA_ARGS__) 97 | #else 98 | #define _GTMDevLog(...) do { } while (0) 99 | #endif 100 | 101 | #endif // _GTMDevLog 102 | 103 | // Declared here so that it can easily be used for logging tracking if 104 | // necessary. See GTMUnitTestDevLog.h for details. 105 | @class NSString; 106 | GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...); 107 | 108 | #ifndef _GTMDevAssert 109 | // we directly invoke the NSAssert handler so we can pass on the varargs 110 | // (NSAssert doesn't have a macro we can use that takes varargs) 111 | #if !defined(NS_BLOCK_ASSERTIONS) 112 | #define _GTMDevAssert(condition, ...) \ 113 | do { \ 114 | if (!(condition)) { \ 115 | [[NSAssertionHandler currentHandler] \ 116 | handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ 117 | file:[NSString stringWithUTF8String:__FILE__] \ 118 | lineNumber:__LINE__ \ 119 | description:__VA_ARGS__]; \ 120 | } \ 121 | } while(0) 122 | #else // !defined(NS_BLOCK_ASSERTIONS) 123 | #define _GTMDevAssert(condition, ...) do { } while (0) 124 | #endif // !defined(NS_BLOCK_ASSERTIONS) 125 | 126 | #endif // _GTMDevAssert 127 | 128 | // _GTMCompileAssert 129 | // _GTMCompileAssert is an assert that is meant to fire at compile time if you 130 | // want to check things at compile instead of runtime. For example if you 131 | // want to check that a wchar is 4 bytes instead of 2 you would use 132 | // _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X) 133 | // Note that the second "arg" is not in quotes, and must be a valid processor 134 | // symbol in it's own right (no spaces, punctuation etc). 135 | 136 | // Wrapping this in an #ifndef allows external groups to define their own 137 | // compile time assert scheme. 138 | #ifndef _GTMCompileAssert 139 | // We got this technique from here: 140 | // http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html 141 | 142 | #define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg 143 | #define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg) 144 | #define _GTMCompileAssert(test, msg) \ 145 | typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ] 146 | #endif // _GTMCompileAssert 147 | 148 | // Macro to allow you to create NSStrings out of other macros. 149 | // #define FOO foo 150 | // NSString *fooString = GTM_NSSTRINGIFY(FOO); 151 | #if !defined (GTM_NSSTRINGIFY) 152 | #define GTM_NSSTRINGIFY_INNER(x) @#x 153 | #define GTM_NSSTRINGIFY(x) GTM_NSSTRINGIFY_INNER(x) 154 | #endif 155 | 156 | // Macro to allow fast enumeration when building for 10.5 or later, and 157 | // reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration 158 | // does keys, so pick the right thing, nothing is done on the FastEnumeration 159 | // side to be sure you're getting what you wanted. 160 | #ifndef GTM_FOREACH_OBJECT 161 | #if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) 162 | #define GTM_FOREACH_ENUMEREE(element, enumeration) \ 163 | for (element in enumeration) 164 | #define GTM_FOREACH_OBJECT(element, collection) \ 165 | for (element in collection) 166 | #define GTM_FOREACH_KEY(element, collection) \ 167 | for (element in collection) 168 | #else 169 | #define GTM_FOREACH_ENUMEREE(element, enumeration) \ 170 | for (NSEnumerator *_ ## element ## _enum = enumeration; \ 171 | (element = [_ ## element ## _enum nextObject]) != nil; ) 172 | #define GTM_FOREACH_OBJECT(element, collection) \ 173 | GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator]) 174 | #define GTM_FOREACH_KEY(element, collection) \ 175 | GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator]) 176 | #endif 177 | #endif 178 | 179 | // ============================================================================ 180 | 181 | // ---------------------------------------------------------------------------- 182 | // CPP symbols defined based on the project settings so the GTM code has 183 | // simple things to test against w/o scattering the knowledge of project 184 | // setting through all the code. 185 | // ---------------------------------------------------------------------------- 186 | 187 | // Provide a single constant CPP symbol that all of GTM uses for ifdefing 188 | // iPhone code. 189 | #if TARGET_OS_IPHONE // iPhone SDK 190 | // For iPhone specific stuff 191 | #define GTM_IPHONE_SDK 1 192 | #if TARGET_IPHONE_SIMULATOR 193 | #define GTM_IPHONE_SIMULATOR 1 194 | #else 195 | #define GTM_IPHONE_DEVICE 1 196 | #endif // TARGET_IPHONE_SIMULATOR 197 | #else 198 | // For MacOS specific stuff 199 | #define GTM_MACOS_SDK 1 200 | #endif 201 | 202 | // Some of our own availability macros 203 | #if GTM_MACOS_SDK 204 | #define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE 205 | #define GTM_AVAILABLE_ONLY_ON_MACOS 206 | #else 207 | #define GTM_AVAILABLE_ONLY_ON_IPHONE 208 | #define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE 209 | #endif 210 | 211 | // Provide a symbol to include/exclude extra code for GC support. (This mainly 212 | // just controls the inclusion of finalize methods). 213 | #ifndef GTM_SUPPORT_GC 214 | #if GTM_IPHONE_SDK 215 | // iPhone never needs GC 216 | #define GTM_SUPPORT_GC 0 217 | #else 218 | // We can't find a symbol to tell if GC is supported/required, so best we 219 | // do on Mac targets is include it if we're on 10.5 or later. 220 | #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 221 | #define GTM_SUPPORT_GC 0 222 | #else 223 | #define GTM_SUPPORT_GC 1 224 | #endif 225 | #endif 226 | #endif 227 | 228 | // To simplify support for 64bit (and Leopard in general), we provide the type 229 | // defines for non Leopard SDKs 230 | #if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 231 | // NSInteger/NSUInteger and Max/Mins 232 | #ifndef NSINTEGER_DEFINED 233 | #if __LP64__ || NS_BUILD_32_LIKE_64 234 | typedef long NSInteger; 235 | typedef unsigned long NSUInteger; 236 | #else 237 | typedef int NSInteger; 238 | typedef unsigned int NSUInteger; 239 | #endif 240 | #define NSIntegerMax LONG_MAX 241 | #define NSIntegerMin LONG_MIN 242 | #define NSUIntegerMax ULONG_MAX 243 | #define NSINTEGER_DEFINED 1 244 | #endif // NSINTEGER_DEFINED 245 | // CGFloat 246 | #ifndef CGFLOAT_DEFINED 247 | #if defined(__LP64__) && __LP64__ 248 | // This really is an untested path (64bit on Tiger?) 249 | typedef double CGFloat; 250 | #define CGFLOAT_MIN DBL_MIN 251 | #define CGFLOAT_MAX DBL_MAX 252 | #define CGFLOAT_IS_DOUBLE 1 253 | #else /* !defined(__LP64__) || !__LP64__ */ 254 | typedef float CGFloat; 255 | #define CGFLOAT_MIN FLT_MIN 256 | #define CGFLOAT_MAX FLT_MAX 257 | #define CGFLOAT_IS_DOUBLE 0 258 | #endif /* !defined(__LP64__) || !__LP64__ */ 259 | #define CGFLOAT_DEFINED 1 260 | #endif // CGFLOAT_DEFINED 261 | #endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 262 | 263 | // Some support for advanced clang static analysis functionality 264 | // See http://clang-analyzer.llvm.org/annotations.html 265 | #ifndef __has_feature // Optional. 266 | #define __has_feature(x) 0 // Compatibility with non-clang compilers. 267 | #endif 268 | 269 | #ifndef NS_RETURNS_RETAINED 270 | #if __has_feature(attribute_ns_returns_retained) 271 | #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) 272 | #else 273 | #define NS_RETURNS_RETAINED 274 | #endif 275 | #endif 276 | 277 | #ifndef CF_RETURNS_RETAINED 278 | #if __has_feature(attribute_cf_returns_retained) 279 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) 280 | #else 281 | #define CF_RETURNS_RETAINED 282 | #endif 283 | #endif 284 | 285 | #ifndef GTM_NONNULL 286 | #define GTM_NONNULL(x) __attribute__((nonnull(x))) 287 | #endif 288 | -------------------------------------------------------------------------------- /Speech Translator/SBJsonParser.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonParser.h" 31 | 32 | @interface SBJsonParser () 33 | 34 | - (BOOL)scanValue:(NSObject **)o; 35 | 36 | - (BOOL)scanRestOfArray:(NSMutableArray **)o; 37 | - (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o; 38 | - (BOOL)scanRestOfNull:(NSNull **)o; 39 | - (BOOL)scanRestOfFalse:(NSNumber **)o; 40 | - (BOOL)scanRestOfTrue:(NSNumber **)o; 41 | - (BOOL)scanRestOfString:(NSMutableString **)o; 42 | 43 | // Cannot manage without looking at the first digit 44 | - (BOOL)scanNumber:(NSNumber **)o; 45 | 46 | - (BOOL)scanHexQuad:(unichar *)x; 47 | - (BOOL)scanUnicodeChar:(unichar *)x; 48 | 49 | - (BOOL)scanIsAtEnd; 50 | 51 | @end 52 | 53 | #define skipWhitespace(c) while (isspace(*c)) c++ 54 | #define skipDigits(c) while (isdigit(*c)) c++ 55 | 56 | 57 | @implementation SBJsonParser 58 | 59 | static char ctrl[0x22]; 60 | 61 | 62 | + (void)initialize { 63 | ctrl[0] = '\"'; 64 | ctrl[1] = '\\'; 65 | for (int i = 1; i < 0x20; i++) 66 | ctrl[i+1] = i; 67 | ctrl[0x21] = 0; 68 | } 69 | 70 | /** 71 | @deprecated This exists in order to provide fragment support in older APIs in one more version. 72 | It should be removed in the next major version. 73 | */ 74 | - (id)fragmentWithString:(id)repr { 75 | [self clearErrorTrace]; 76 | 77 | if (!repr) { 78 | [self addErrorWithCode:EINPUT description:@"Input was 'nil'"]; 79 | return nil; 80 | } 81 | 82 | depth = 0; 83 | c = [repr UTF8String]; 84 | 85 | id o; 86 | if (![self scanValue:&o]) { 87 | return nil; 88 | } 89 | 90 | // We found some valid JSON. But did it also contain something else? 91 | if (![self scanIsAtEnd]) { 92 | [self addErrorWithCode:ETRAILGARBAGE description:@"Garbage after JSON"]; 93 | return nil; 94 | } 95 | 96 | NSAssert1(o, @"Should have a valid object from %@", repr); 97 | return o; 98 | } 99 | 100 | - (id)objectWithString:(NSString *)repr { 101 | 102 | id o = [self fragmentWithString:repr]; 103 | if (!o) 104 | return nil; 105 | 106 | // Check that the object we've found is a valid JSON container. 107 | if (![o isKindOfClass:[NSDictionary class]] && ![o isKindOfClass:[NSArray class]]) { 108 | [self addErrorWithCode:EFRAGMENT description:@"Valid fragment, but not JSON"]; 109 | return nil; 110 | } 111 | 112 | return o; 113 | } 114 | 115 | /* 116 | In contrast to the public methods, it is an error to omit the error parameter here. 117 | */ 118 | - (BOOL)scanValue:(NSObject **)o 119 | { 120 | skipWhitespace(c); 121 | 122 | switch (*c++) { 123 | case '{': 124 | return [self scanRestOfDictionary:(NSMutableDictionary **)o]; 125 | break; 126 | case '[': 127 | return [self scanRestOfArray:(NSMutableArray **)o]; 128 | break; 129 | case '"': 130 | return [self scanRestOfString:(NSMutableString **)o]; 131 | break; 132 | case 'f': 133 | return [self scanRestOfFalse:(NSNumber **)o]; 134 | break; 135 | case 't': 136 | return [self scanRestOfTrue:(NSNumber **)o]; 137 | break; 138 | case 'n': 139 | return [self scanRestOfNull:(NSNull **)o]; 140 | break; 141 | case '-': 142 | case '0'...'9': 143 | c--; // cannot verify number correctly without the first character 144 | return [self scanNumber:(NSNumber **)o]; 145 | break; 146 | case '+': 147 | [self addErrorWithCode:EPARSENUM description: @"Leading + disallowed in number"]; 148 | return NO; 149 | break; 150 | case 0x0: 151 | [self addErrorWithCode:EEOF description:@"Unexpected end of string"]; 152 | return NO; 153 | break; 154 | default: 155 | [self addErrorWithCode:EPARSE description: @"Unrecognised leading character"]; 156 | return NO; 157 | break; 158 | } 159 | 160 | NSAssert(0, @"Should never get here"); 161 | return NO; 162 | } 163 | 164 | - (BOOL)scanRestOfTrue:(NSNumber **)o 165 | { 166 | if (!strncmp(c, "rue", 3)) { 167 | c += 3; 168 | *o = [NSNumber numberWithBool:YES]; 169 | return YES; 170 | } 171 | [self addErrorWithCode:EPARSE description:@"Expected 'true'"]; 172 | return NO; 173 | } 174 | 175 | - (BOOL)scanRestOfFalse:(NSNumber **)o 176 | { 177 | if (!strncmp(c, "alse", 4)) { 178 | c += 4; 179 | *o = [NSNumber numberWithBool:NO]; 180 | return YES; 181 | } 182 | [self addErrorWithCode:EPARSE description: @"Expected 'false'"]; 183 | return NO; 184 | } 185 | 186 | - (BOOL)scanRestOfNull:(NSNull **)o { 187 | if (!strncmp(c, "ull", 3)) { 188 | c += 3; 189 | *o = [NSNull null]; 190 | return YES; 191 | } 192 | [self addErrorWithCode:EPARSE description: @"Expected 'null'"]; 193 | return NO; 194 | } 195 | 196 | - (BOOL)scanRestOfArray:(NSMutableArray **)o { 197 | if (maxDepth && ++depth > maxDepth) { 198 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 199 | return NO; 200 | } 201 | 202 | *o = [NSMutableArray arrayWithCapacity:8]; 203 | 204 | for (; *c ;) { 205 | id v; 206 | 207 | skipWhitespace(c); 208 | if (*c == ']' && c++) { 209 | depth--; 210 | return YES; 211 | } 212 | 213 | if (![self scanValue:&v]) { 214 | [self addErrorWithCode:EPARSE description:@"Expected value while parsing array"]; 215 | return NO; 216 | } 217 | 218 | [*o addObject:v]; 219 | 220 | skipWhitespace(c); 221 | if (*c == ',' && c++) { 222 | skipWhitespace(c); 223 | if (*c == ']') { 224 | [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in array"]; 225 | return NO; 226 | } 227 | } 228 | } 229 | 230 | [self addErrorWithCode:EEOF description: @"End of input while parsing array"]; 231 | return NO; 232 | } 233 | 234 | - (BOOL)scanRestOfDictionary:(NSMutableDictionary **)o 235 | { 236 | if (maxDepth && ++depth > maxDepth) { 237 | [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; 238 | return NO; 239 | } 240 | 241 | *o = [NSMutableDictionary dictionaryWithCapacity:7]; 242 | 243 | for (; *c ;) { 244 | id k, v; 245 | 246 | skipWhitespace(c); 247 | if (*c == '}' && c++) { 248 | depth--; 249 | return YES; 250 | } 251 | 252 | if (!(*c == '\"' && c++ && [self scanRestOfString:&k])) { 253 | [self addErrorWithCode:EPARSE description: @"Object key string expected"]; 254 | return NO; 255 | } 256 | 257 | skipWhitespace(c); 258 | if (*c != ':') { 259 | [self addErrorWithCode:EPARSE description: @"Expected ':' separating key and value"]; 260 | return NO; 261 | } 262 | 263 | c++; 264 | if (![self scanValue:&v]) { 265 | NSString *string = [NSString stringWithFormat:@"Object value expected for key: %@", k]; 266 | [self addErrorWithCode:EPARSE description: string]; 267 | return NO; 268 | } 269 | 270 | [*o setObject:v forKey:k]; 271 | 272 | skipWhitespace(c); 273 | if (*c == ',' && c++) { 274 | skipWhitespace(c); 275 | if (*c == '}') { 276 | [self addErrorWithCode:ETRAILCOMMA description: @"Trailing comma disallowed in object"]; 277 | return NO; 278 | } 279 | } 280 | } 281 | 282 | [self addErrorWithCode:EEOF description: @"End of input while parsing object"]; 283 | return NO; 284 | } 285 | 286 | - (BOOL)scanRestOfString:(NSMutableString **)o 287 | { 288 | *o = [NSMutableString stringWithCapacity:16]; 289 | do { 290 | // First see if there's a portion we can grab in one go. 291 | // Doing this caused a massive speedup on the long string. 292 | size_t len = strcspn(c, ctrl); 293 | if (len) { 294 | // check for 295 | id t = [[NSString alloc] initWithBytesNoCopy:(char*)c 296 | length:len 297 | encoding:NSUTF8StringEncoding 298 | freeWhenDone:NO]; 299 | if (t) { 300 | [*o appendString:t]; 301 | [t release]; 302 | c += len; 303 | } 304 | } 305 | 306 | if (*c == '"') { 307 | c++; 308 | return YES; 309 | 310 | } else if (*c == '\\') { 311 | unichar uc = *++c; 312 | switch (uc) { 313 | case '\\': 314 | case '/': 315 | case '"': 316 | break; 317 | 318 | case 'b': uc = '\b'; break; 319 | case 'n': uc = '\n'; break; 320 | case 'r': uc = '\r'; break; 321 | case 't': uc = '\t'; break; 322 | case 'f': uc = '\f'; break; 323 | 324 | case 'u': 325 | c++; 326 | if (![self scanUnicodeChar:&uc]) { 327 | [self addErrorWithCode:EUNICODE description: @"Broken unicode character"]; 328 | return NO; 329 | } 330 | c--; // hack. 331 | break; 332 | default: 333 | [self addErrorWithCode:EESCAPE description: [NSString stringWithFormat:@"Illegal escape sequence '0x%x'", uc]]; 334 | return NO; 335 | break; 336 | } 337 | CFStringAppendCharacters((CFMutableStringRef)*o, &uc, 1); 338 | c++; 339 | 340 | } else if (*c < 0x20) { 341 | [self addErrorWithCode:ECTRL description: [NSString stringWithFormat:@"Unescaped control character '0x%x'", *c]]; 342 | return NO; 343 | 344 | } else { 345 | NSLog(@"should not be able to get here"); 346 | } 347 | } while (*c); 348 | 349 | [self addErrorWithCode:EEOF description:@"Unexpected EOF while parsing string"]; 350 | return NO; 351 | } 352 | 353 | - (BOOL)scanUnicodeChar:(unichar *)x 354 | { 355 | unichar hi, lo; 356 | 357 | if (![self scanHexQuad:&hi]) { 358 | [self addErrorWithCode:EUNICODE description: @"Missing hex quad"]; 359 | return NO; 360 | } 361 | 362 | if (hi >= 0xd800) { // high surrogate char? 363 | if (hi < 0xdc00) { // yes - expect a low char 364 | 365 | if (!(*c == '\\' && ++c && *c == 'u' && ++c && [self scanHexQuad:&lo])) { 366 | [self addErrorWithCode:EUNICODE description: @"Missing low character in surrogate pair"]; 367 | return NO; 368 | } 369 | 370 | if (lo < 0xdc00 || lo >= 0xdfff) { 371 | [self addErrorWithCode:EUNICODE description:@"Invalid low surrogate char"]; 372 | return NO; 373 | } 374 | 375 | hi = (hi - 0xd800) * 0x400 + (lo - 0xdc00) + 0x10000; 376 | 377 | } else if (hi < 0xe000) { 378 | [self addErrorWithCode:EUNICODE description:@"Invalid high character in surrogate pair"]; 379 | return NO; 380 | } 381 | } 382 | 383 | *x = hi; 384 | return YES; 385 | } 386 | 387 | - (BOOL)scanHexQuad:(unichar *)x 388 | { 389 | *x = 0; 390 | for (int i = 0; i < 4; i++) { 391 | unichar uc = *c; 392 | c++; 393 | int d = (uc >= '0' && uc <= '9') 394 | ? uc - '0' : (uc >= 'a' && uc <= 'f') 395 | ? (uc - 'a' + 10) : (uc >= 'A' && uc <= 'F') 396 | ? (uc - 'A' + 10) : -1; 397 | if (d == -1) { 398 | [self addErrorWithCode:EUNICODE description:@"Missing hex digit in quad"]; 399 | return NO; 400 | } 401 | *x *= 16; 402 | *x += d; 403 | } 404 | return YES; 405 | } 406 | 407 | - (BOOL)scanNumber:(NSNumber **)o 408 | { 409 | const char *ns = c; 410 | 411 | // The logic to test for validity of the number formatting is relicensed 412 | // from JSON::XS with permission from its author Marc Lehmann. 413 | // (Available at the CPAN: http://search.cpan.org/dist/JSON-XS/ .) 414 | 415 | if ('-' == *c) 416 | c++; 417 | 418 | if ('0' == *c && c++) { 419 | if (isdigit(*c)) { 420 | [self addErrorWithCode:EPARSENUM description: @"Leading 0 disallowed in number"]; 421 | return NO; 422 | } 423 | 424 | } else if (!isdigit(*c) && c != ns) { 425 | [self addErrorWithCode:EPARSENUM description: @"No digits after initial minus"]; 426 | return NO; 427 | 428 | } else { 429 | skipDigits(c); 430 | } 431 | 432 | // Fractional part 433 | if ('.' == *c && c++) { 434 | 435 | if (!isdigit(*c)) { 436 | [self addErrorWithCode:EPARSENUM description: @"No digits after decimal point"]; 437 | return NO; 438 | } 439 | skipDigits(c); 440 | } 441 | 442 | // Exponential part 443 | if ('e' == *c || 'E' == *c) { 444 | c++; 445 | 446 | if ('-' == *c || '+' == *c) 447 | c++; 448 | 449 | if (!isdigit(*c)) { 450 | [self addErrorWithCode:EPARSENUM description: @"No digits after exponent"]; 451 | return NO; 452 | } 453 | skipDigits(c); 454 | } 455 | 456 | id str = [[NSString alloc] initWithBytesNoCopy:(char*)ns 457 | length:c - ns 458 | encoding:NSUTF8StringEncoding 459 | freeWhenDone:NO]; 460 | [str autorelease]; 461 | if (str && (*o = [NSDecimalNumber decimalNumberWithString:str])) 462 | return YES; 463 | 464 | [self addErrorWithCode:EPARSENUM description: @"Failed creating decimal instance"]; 465 | return NO; 466 | } 467 | 468 | - (BOOL)scanIsAtEnd 469 | { 470 | skipWhitespace(c); 471 | return !*c; 472 | } 473 | 474 | 475 | @end 476 | -------------------------------------------------------------------------------- /Speech Translator/GTMNSString+HTML.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+HTML.m 3 | // Dealing with NSStrings that contain HTML 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import "GTMDefines.h" 21 | #import "GTMNSString+HTML.h" 22 | 23 | typedef struct { 24 | NSString *escapeSequence; 25 | unichar uchar; 26 | } HTMLEscapeMap; 27 | 28 | // Taken from http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 29 | // Ordered by uchar lowest to highest for bsearching 30 | static HTMLEscapeMap gAsciiHTMLEscapeMap[] = { 31 | // A.2.2. Special characters 32 | { @""", 34 }, 33 | { @"&", 38 }, 34 | { @"'", 39 }, 35 | { @"<", 60 }, 36 | { @">", 62 }, 37 | 38 | // A.2.1. Latin-1 characters 39 | { @" ", 160 }, 40 | { @"¡", 161 }, 41 | { @"¢", 162 }, 42 | { @"£", 163 }, 43 | { @"¤", 164 }, 44 | { @"¥", 165 }, 45 | { @"¦", 166 }, 46 | { @"§", 167 }, 47 | { @"¨", 168 }, 48 | { @"©", 169 }, 49 | { @"ª", 170 }, 50 | { @"«", 171 }, 51 | { @"¬", 172 }, 52 | { @"­", 173 }, 53 | { @"®", 174 }, 54 | { @"¯", 175 }, 55 | { @"°", 176 }, 56 | { @"±", 177 }, 57 | { @"²", 178 }, 58 | { @"³", 179 }, 59 | { @"´", 180 }, 60 | { @"µ", 181 }, 61 | { @"¶", 182 }, 62 | { @"·", 183 }, 63 | { @"¸", 184 }, 64 | { @"¹", 185 }, 65 | { @"º", 186 }, 66 | { @"»", 187 }, 67 | { @"¼", 188 }, 68 | { @"½", 189 }, 69 | { @"¾", 190 }, 70 | { @"¿", 191 }, 71 | { @"À", 192 }, 72 | { @"Á", 193 }, 73 | { @"Â", 194 }, 74 | { @"Ã", 195 }, 75 | { @"Ä", 196 }, 76 | { @"Å", 197 }, 77 | { @"Æ", 198 }, 78 | { @"Ç", 199 }, 79 | { @"È", 200 }, 80 | { @"É", 201 }, 81 | { @"Ê", 202 }, 82 | { @"Ë", 203 }, 83 | { @"Ì", 204 }, 84 | { @"Í", 205 }, 85 | { @"Î", 206 }, 86 | { @"Ï", 207 }, 87 | { @"Ð", 208 }, 88 | { @"Ñ", 209 }, 89 | { @"Ò", 210 }, 90 | { @"Ó", 211 }, 91 | { @"Ô", 212 }, 92 | { @"Õ", 213 }, 93 | { @"Ö", 214 }, 94 | { @"×", 215 }, 95 | { @"Ø", 216 }, 96 | { @"Ù", 217 }, 97 | { @"Ú", 218 }, 98 | { @"Û", 219 }, 99 | { @"Ü", 220 }, 100 | { @"Ý", 221 }, 101 | { @"Þ", 222 }, 102 | { @"ß", 223 }, 103 | { @"à", 224 }, 104 | { @"á", 225 }, 105 | { @"â", 226 }, 106 | { @"ã", 227 }, 107 | { @"ä", 228 }, 108 | { @"å", 229 }, 109 | { @"æ", 230 }, 110 | { @"ç", 231 }, 111 | { @"è", 232 }, 112 | { @"é", 233 }, 113 | { @"ê", 234 }, 114 | { @"ë", 235 }, 115 | { @"ì", 236 }, 116 | { @"í", 237 }, 117 | { @"î", 238 }, 118 | { @"ï", 239 }, 119 | { @"ð", 240 }, 120 | { @"ñ", 241 }, 121 | { @"ò", 242 }, 122 | { @"ó", 243 }, 123 | { @"ô", 244 }, 124 | { @"õ", 245 }, 125 | { @"ö", 246 }, 126 | { @"÷", 247 }, 127 | { @"ø", 248 }, 128 | { @"ù", 249 }, 129 | { @"ú", 250 }, 130 | { @"û", 251 }, 131 | { @"ü", 252 }, 132 | { @"ý", 253 }, 133 | { @"þ", 254 }, 134 | { @"ÿ", 255 }, 135 | 136 | // A.2.2. Special characters cont'd 137 | { @"Œ", 338 }, 138 | { @"œ", 339 }, 139 | { @"Š", 352 }, 140 | { @"š", 353 }, 141 | { @"Ÿ", 376 }, 142 | 143 | // A.2.3. Symbols 144 | { @"ƒ", 402 }, 145 | 146 | // A.2.2. Special characters cont'd 147 | { @"ˆ", 710 }, 148 | { @"˜", 732 }, 149 | 150 | // A.2.3. Symbols cont'd 151 | { @"Α", 913 }, 152 | { @"Β", 914 }, 153 | { @"Γ", 915 }, 154 | { @"Δ", 916 }, 155 | { @"Ε", 917 }, 156 | { @"Ζ", 918 }, 157 | { @"Η", 919 }, 158 | { @"Θ", 920 }, 159 | { @"Ι", 921 }, 160 | { @"Κ", 922 }, 161 | { @"Λ", 923 }, 162 | { @"Μ", 924 }, 163 | { @"Ν", 925 }, 164 | { @"Ξ", 926 }, 165 | { @"Ο", 927 }, 166 | { @"Π", 928 }, 167 | { @"Ρ", 929 }, 168 | { @"Σ", 931 }, 169 | { @"Τ", 932 }, 170 | { @"Υ", 933 }, 171 | { @"Φ", 934 }, 172 | { @"Χ", 935 }, 173 | { @"Ψ", 936 }, 174 | { @"Ω", 937 }, 175 | { @"α", 945 }, 176 | { @"β", 946 }, 177 | { @"γ", 947 }, 178 | { @"δ", 948 }, 179 | { @"ε", 949 }, 180 | { @"ζ", 950 }, 181 | { @"η", 951 }, 182 | { @"θ", 952 }, 183 | { @"ι", 953 }, 184 | { @"κ", 954 }, 185 | { @"λ", 955 }, 186 | { @"μ", 956 }, 187 | { @"ν", 957 }, 188 | { @"ξ", 958 }, 189 | { @"ο", 959 }, 190 | { @"π", 960 }, 191 | { @"ρ", 961 }, 192 | { @"ς", 962 }, 193 | { @"σ", 963 }, 194 | { @"τ", 964 }, 195 | { @"υ", 965 }, 196 | { @"φ", 966 }, 197 | { @"χ", 967 }, 198 | { @"ψ", 968 }, 199 | { @"ω", 969 }, 200 | { @"ϑ", 977 }, 201 | { @"ϒ", 978 }, 202 | { @"ϖ", 982 }, 203 | 204 | // A.2.2. Special characters cont'd 205 | { @" ", 8194 }, 206 | { @" ", 8195 }, 207 | { @" ", 8201 }, 208 | { @"‌", 8204 }, 209 | { @"‍", 8205 }, 210 | { @"‎", 8206 }, 211 | { @"‏", 8207 }, 212 | { @"–", 8211 }, 213 | { @"—", 8212 }, 214 | { @"‘", 8216 }, 215 | { @"’", 8217 }, 216 | { @"‚", 8218 }, 217 | { @"“", 8220 }, 218 | { @"”", 8221 }, 219 | { @"„", 8222 }, 220 | { @"†", 8224 }, 221 | { @"‡", 8225 }, 222 | // A.2.3. Symbols cont'd 223 | { @"•", 8226 }, 224 | { @"…", 8230 }, 225 | 226 | // A.2.2. Special characters cont'd 227 | { @"‰", 8240 }, 228 | 229 | // A.2.3. Symbols cont'd 230 | { @"′", 8242 }, 231 | { @"″", 8243 }, 232 | 233 | // A.2.2. Special characters cont'd 234 | { @"‹", 8249 }, 235 | { @"›", 8250 }, 236 | 237 | // A.2.3. Symbols cont'd 238 | { @"‾", 8254 }, 239 | { @"⁄", 8260 }, 240 | 241 | // A.2.2. Special characters cont'd 242 | { @"€", 8364 }, 243 | 244 | // A.2.3. Symbols cont'd 245 | { @"ℑ", 8465 }, 246 | { @"℘", 8472 }, 247 | { @"ℜ", 8476 }, 248 | { @"™", 8482 }, 249 | { @"ℵ", 8501 }, 250 | { @"←", 8592 }, 251 | { @"↑", 8593 }, 252 | { @"→", 8594 }, 253 | { @"↓", 8595 }, 254 | { @"↔", 8596 }, 255 | { @"↵", 8629 }, 256 | { @"⇐", 8656 }, 257 | { @"⇑", 8657 }, 258 | { @"⇒", 8658 }, 259 | { @"⇓", 8659 }, 260 | { @"⇔", 8660 }, 261 | { @"∀", 8704 }, 262 | { @"∂", 8706 }, 263 | { @"∃", 8707 }, 264 | { @"∅", 8709 }, 265 | { @"∇", 8711 }, 266 | { @"∈", 8712 }, 267 | { @"∉", 8713 }, 268 | { @"∋", 8715 }, 269 | { @"∏", 8719 }, 270 | { @"∑", 8721 }, 271 | { @"−", 8722 }, 272 | { @"∗", 8727 }, 273 | { @"√", 8730 }, 274 | { @"∝", 8733 }, 275 | { @"∞", 8734 }, 276 | { @"∠", 8736 }, 277 | { @"∧", 8743 }, 278 | { @"∨", 8744 }, 279 | { @"∩", 8745 }, 280 | { @"∪", 8746 }, 281 | { @"∫", 8747 }, 282 | { @"∴", 8756 }, 283 | { @"∼", 8764 }, 284 | { @"≅", 8773 }, 285 | { @"≈", 8776 }, 286 | { @"≠", 8800 }, 287 | { @"≡", 8801 }, 288 | { @"≤", 8804 }, 289 | { @"≥", 8805 }, 290 | { @"⊂", 8834 }, 291 | { @"⊃", 8835 }, 292 | { @"⊄", 8836 }, 293 | { @"⊆", 8838 }, 294 | { @"⊇", 8839 }, 295 | { @"⊕", 8853 }, 296 | { @"⊗", 8855 }, 297 | { @"⊥", 8869 }, 298 | { @"⋅", 8901 }, 299 | { @"⌈", 8968 }, 300 | { @"⌉", 8969 }, 301 | { @"⌊", 8970 }, 302 | { @"⌋", 8971 }, 303 | { @"⟨", 9001 }, 304 | { @"⟩", 9002 }, 305 | { @"◊", 9674 }, 306 | { @"♠", 9824 }, 307 | { @"♣", 9827 }, 308 | { @"♥", 9829 }, 309 | { @"♦", 9830 } 310 | }; 311 | 312 | // Taken from http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 313 | // This is table A.2.2 Special Characters 314 | static HTMLEscapeMap gUnicodeHTMLEscapeMap[] = { 315 | // C0 Controls and Basic Latin 316 | { @""", 34 }, 317 | { @"&", 38 }, 318 | { @"'", 39 }, 319 | { @"<", 60 }, 320 | { @">", 62 }, 321 | 322 | // Latin Extended-A 323 | { @"Œ", 338 }, 324 | { @"œ", 339 }, 325 | { @"Š", 352 }, 326 | { @"š", 353 }, 327 | { @"Ÿ", 376 }, 328 | 329 | // Spacing Modifier Letters 330 | { @"ˆ", 710 }, 331 | { @"˜", 732 }, 332 | 333 | // General Punctuation 334 | { @" ", 8194 }, 335 | { @" ", 8195 }, 336 | { @" ", 8201 }, 337 | { @"‌", 8204 }, 338 | { @"‍", 8205 }, 339 | { @"‎", 8206 }, 340 | { @"‏", 8207 }, 341 | { @"–", 8211 }, 342 | { @"—", 8212 }, 343 | { @"‘", 8216 }, 344 | { @"’", 8217 }, 345 | { @"‚", 8218 }, 346 | { @"“", 8220 }, 347 | { @"”", 8221 }, 348 | { @"„", 8222 }, 349 | { @"†", 8224 }, 350 | { @"‡", 8225 }, 351 | { @"‰", 8240 }, 352 | { @"‹", 8249 }, 353 | { @"›", 8250 }, 354 | { @"€", 8364 }, 355 | }; 356 | 357 | 358 | // Utility function for Bsearching table above 359 | static int EscapeMapCompare(const void *ucharVoid, const void *mapVoid) { 360 | const unichar *uchar = (const unichar*)ucharVoid; 361 | const HTMLEscapeMap *map = (const HTMLEscapeMap*)mapVoid; 362 | int val; 363 | if (*uchar > map->uchar) { 364 | val = 1; 365 | } else if (*uchar < map->uchar) { 366 | val = -1; 367 | } else { 368 | val = 0; 369 | } 370 | return val; 371 | } 372 | 373 | @implementation NSString (GTMNSStringHTMLAdditions) 374 | 375 | - (NSString *)gtm_stringByEscapingHTMLUsingTable:(HTMLEscapeMap*)table 376 | ofSize:(NSUInteger)size 377 | escapingUnicode:(BOOL)escapeUnicode { 378 | NSUInteger length = [self length]; 379 | if (!length) { 380 | return self; 381 | } 382 | 383 | NSMutableString *finalString = [NSMutableString string]; 384 | NSMutableData *data2 = [NSMutableData dataWithCapacity:sizeof(unichar) * length]; 385 | 386 | // this block is common between GTMNSString+HTML and GTMNSString+XML but 387 | // it's so short that it isn't really worth trying to share. 388 | const unichar *buffer = CFStringGetCharactersPtr((CFStringRef)self); 389 | if (!buffer) { 390 | // We want this buffer to be autoreleased. 391 | NSMutableData *data = [NSMutableData dataWithLength:length * sizeof(UniChar)]; 392 | if (!data) { 393 | // COV_NF_START - Memory fail case 394 | _GTMDevLog(@"couldn't alloc buffer"); 395 | return nil; 396 | // COV_NF_END 397 | } 398 | [self getCharacters:[data mutableBytes]]; 399 | buffer = [data bytes]; 400 | } 401 | 402 | if (!buffer || !data2) { 403 | // COV_NF_START 404 | _GTMDevLog(@"Unable to allocate buffer or data2"); 405 | return nil; 406 | // COV_NF_END 407 | } 408 | 409 | unichar *buffer2 = (unichar *)[data2 mutableBytes]; 410 | 411 | NSUInteger buffer2Length = 0; 412 | 413 | for (NSUInteger i = 0; i < length; ++i) { 414 | HTMLEscapeMap *val = bsearch(&buffer[i], table, 415 | size / sizeof(HTMLEscapeMap), 416 | sizeof(HTMLEscapeMap), EscapeMapCompare); 417 | if (val || (escapeUnicode && buffer[i] > 127)) { 418 | if (buffer2Length) { 419 | CFStringAppendCharacters((CFMutableStringRef)finalString, 420 | buffer2, 421 | buffer2Length); 422 | buffer2Length = 0; 423 | } 424 | if (val) { 425 | [finalString appendString:val->escapeSequence]; 426 | } 427 | else { 428 | _GTMDevAssert(escapeUnicode && buffer[i] > 127, @"Illegal Character"); 429 | [finalString appendFormat:@"&#%d;", buffer[i]]; 430 | } 431 | } else { 432 | buffer2[buffer2Length] = buffer[i]; 433 | buffer2Length += 1; 434 | } 435 | } 436 | if (buffer2Length) { 437 | CFStringAppendCharacters((CFMutableStringRef)finalString, 438 | buffer2, 439 | buffer2Length); 440 | } 441 | return finalString; 442 | } 443 | 444 | - (NSString *)gtm_stringByEscapingForHTML { 445 | return [self gtm_stringByEscapingHTMLUsingTable:gUnicodeHTMLEscapeMap 446 | ofSize:sizeof(gUnicodeHTMLEscapeMap) 447 | escapingUnicode:NO]; 448 | } // gtm_stringByEscapingHTML 449 | 450 | - (NSString *)gtm_stringByEscapingForAsciiHTML { 451 | return [self gtm_stringByEscapingHTMLUsingTable:gAsciiHTMLEscapeMap 452 | ofSize:sizeof(gAsciiHTMLEscapeMap) 453 | escapingUnicode:YES]; 454 | } // gtm_stringByEscapingAsciiHTML 455 | 456 | - (NSString *)gtm_stringByUnescapingFromHTML { 457 | NSRange range = NSMakeRange(0, [self length]); 458 | NSRange subrange = [self rangeOfString:@"&" options:NSBackwardsSearch range:range]; 459 | 460 | // if no ampersands, we've got a quick way out 461 | if (subrange.length == 0) return self; 462 | NSMutableString *finalString = [NSMutableString stringWithString:self]; 463 | do { 464 | NSRange semiColonRange = NSMakeRange(subrange.location, NSMaxRange(range) - subrange.location); 465 | semiColonRange = [self rangeOfString:@";" options:0 range:semiColonRange]; 466 | range = NSMakeRange(0, subrange.location); 467 | // if we don't find a semicolon in the range, we don't have a sequence 468 | if (semiColonRange.location == NSNotFound) { 469 | continue; 470 | } 471 | NSRange escapeRange = NSMakeRange(subrange.location, semiColonRange.location - subrange.location + 1); 472 | NSString *escapeString = [self substringWithRange:escapeRange]; 473 | NSUInteger length = [escapeString length]; 474 | // a squence must be longer than 3 (<) and less than 11 (ϑ) 475 | if (length > 3 && length < 11) { 476 | if ([escapeString characterAtIndex:1] == '#') { 477 | unichar char2 = [escapeString characterAtIndex:2]; 478 | if (char2 == 'x' || char2 == 'X') { 479 | // Hex escape squences £ 480 | NSString *hexSequence = [escapeString substringWithRange:NSMakeRange(3, length - 4)]; 481 | NSScanner *scanner = [NSScanner scannerWithString:hexSequence]; 482 | unsigned value; 483 | if ([scanner scanHexInt:&value] && 484 | value < USHRT_MAX && 485 | value > 0 486 | && [scanner scanLocation] == length - 4) { 487 | unichar uchar = value; 488 | NSString *charString = [NSString stringWithCharacters:&uchar length:1]; 489 | [finalString replaceCharactersInRange:escapeRange withString:charString]; 490 | } 491 | 492 | } else { 493 | // Decimal Sequences { 494 | NSString *numberSequence = [escapeString substringWithRange:NSMakeRange(2, length - 3)]; 495 | NSScanner *scanner = [NSScanner scannerWithString:numberSequence]; 496 | int value; 497 | if ([scanner scanInt:&value] && 498 | value < USHRT_MAX && 499 | value > 0 500 | && [scanner scanLocation] == length - 3) { 501 | unichar uchar = value; 502 | NSString *charString = [NSString stringWithCharacters:&uchar length:1]; 503 | [finalString replaceCharactersInRange:escapeRange withString:charString]; 504 | } 505 | } 506 | } else { 507 | // "standard" sequences 508 | for (unsigned i = 0; i < sizeof(gAsciiHTMLEscapeMap) / sizeof(HTMLEscapeMap); ++i) { 509 | if ([escapeString isEqualToString:gAsciiHTMLEscapeMap[i].escapeSequence]) { 510 | [finalString replaceCharactersInRange:escapeRange withString:[NSString stringWithCharacters:&gAsciiHTMLEscapeMap[i].uchar length:1]]; 511 | break; 512 | } 513 | } 514 | } 515 | } 516 | } while ((subrange = [self rangeOfString:@"&" options:NSBackwardsSearch range:range]).length != 0); 517 | return finalString; 518 | } // gtm_stringByUnescapingHTML 519 | 520 | 521 | 522 | @end 523 | --------------------------------------------------------------------------------