Changeset 821
- Timestamp:
- 04/04/03 18:49:55 (6 years ago)
- Files:
-
- Nuku/trunk/Controller.h (modified) (2 diffs)
- Nuku/trunk/Session.h (modified) (2 diffs)
- Nuku/trunk/Session.m (modified) (2 diffs)
- Nuku/trunk/Settings.h (modified) (2 diffs)
- Nuku/trunk/Tutor.h (modified) (2 diffs)
- Nuku/trunk/Tutor.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Nuku/trunk/Controller.h
r815 r821 1 /* $Id: Controller.h,v 1. 4 2003/04/02 23:11:29morris Exp $ */1 /* $Id: Controller.h,v 1.5 2003/04/04 16:49:55 morris Exp $ */ 2 2 3 3 /* … … 31 31 32 32 #import <Cocoa/Cocoa.h> 33 #import "Tutor.h"34 #import "Settings.h"35 33 36 @class Session;34 @class Tutor, Session; 37 35 38 36 @interface Controller : NSObject { 39 IBOutlet Session *sessionOutlet;37 IBOutlet Session *sessionOutlet; 40 38 41 IBOutlet NSWindow *windowTutor; 42 IBOutlet NSWindow *windowLines; 39 IBOutlet NSWindow *windowTutor; 40 IBOutlet NSWindow *windowLines; 41 42 IBOutlet NSMenu *menuSettings; 43 43 44 IBOutlet NSMenu *menuSettings; 44 IBOutlet NSMatrix *buttonsKana; 45 IBOutlet NSTextField *fieldKana; 46 IBOutlet NSImageView *imageKana; 47 IBOutlet NSTextField *textAnswer; 48 IBOutlet NSTextField *textCorrect; 49 IBOutlet NSTextField *textPercent; 50 IBOutlet NSTextField *textScore; 51 52 IBOutlet NSMenuItem *itemQuizMode; 53 IBOutlet NSMenuItem *itemLearningMode; 54 IBOutlet NSMenuItem *itemHiragana; 55 IBOutlet NSMenuItem *itemKatakana; 56 IBOutlet NSMenuItem *itemMixed; 57 IBOutlet NSMenuItem *itemHepburn; 58 IBOutlet NSMenuItem *itemKunreiSiki; 59 IBOutlet NSMenuItem *itemNihonSiki; 60 61 IBOutlet NSButtonCell *kanaDi; 62 IBOutlet NSButtonCell *kanaDu; 63 IBOutlet NSButtonCell *kanaHu; 64 IBOutlet NSButtonCell *kanaSi; 65 IBOutlet NSButtonCell *kanaTi; 66 IBOutlet NSButtonCell *kanaTu; 67 IBOutlet NSButtonCell *kanaZi; 68 69 IBOutlet NSButton *linesA; 70 IBOutlet NSButton *linesBa; 71 IBOutlet NSButton *linesDa; 72 IBOutlet NSButton *linesGa; 73 IBOutlet NSButton *linesHa; 74 IBOutlet NSButton *linesKa; 75 IBOutlet NSButton *linesMa; 76 IBOutlet NSButton *linesNa; 77 IBOutlet NSButton *linesPa; 78 IBOutlet NSButton *linesRa; 79 IBOutlet NSButton *linesSa; 80 IBOutlet NSButton *linesTa; 81 IBOutlet NSButton *linesWa; 82 IBOutlet NSButton *linesYa; 83 IBOutlet NSButton *linesZa; 45 84 46 IBOutlet NSMatrix *buttonsKana; 47 IBOutlet NSTextField *fieldKana; 48 IBOutlet NSImageView *imageKana; 49 IBOutlet NSTextField *textAnswer; 50 IBOutlet NSTextField *textCorrect; 51 IBOutlet NSTextField *textPercent; 52 IBOutlet NSTextField *textScore; 53 54 IBOutlet NSMenuItem *itemQuizMode; 55 IBOutlet NSMenuItem *itemLearningMode; 56 IBOutlet NSMenuItem *itemHiragana; 57 IBOutlet NSMenuItem *itemKatakana; 58 IBOutlet NSMenuItem *itemMixed; 59 IBOutlet NSMenuItem *itemHepburn; 60 IBOutlet NSMenuItem *itemKunreiSiki; 61 IBOutlet NSMenuItem *itemNihonSiki; 62 63 IBOutlet NSButtonCell *kanaDi; 64 IBOutlet NSButtonCell *kanaDu; 65 IBOutlet NSButtonCell *kanaHu; 66 IBOutlet NSButtonCell *kanaSi; 67 IBOutlet NSButtonCell *kanaTi; 68 IBOutlet NSButtonCell *kanaTu; 69 IBOutlet NSButtonCell *kanaZi; 70 71 IBOutlet NSButton *linesA; 72 IBOutlet NSButton *linesBa; 73 IBOutlet NSButton *linesDa; 74 IBOutlet NSButton *linesGa; 75 IBOutlet NSButton *linesHa; 76 IBOutlet NSButton *linesKa; 77 IBOutlet NSButton *linesMa; 78 IBOutlet NSButton *linesNa; 79 IBOutlet NSButton *linesPa; 80 IBOutlet NSButton *linesRa; 81 IBOutlet NSButton *linesSa; 82 IBOutlet NSButton *linesTa; 83 IBOutlet NSButton *linesWa; 84 IBOutlet NSButton *linesYa; 85 IBOutlet NSButton *linesZa; 86 87 Tutor *tutor; 88 NSTimer *timer; 85 Tutor *_tutor; 86 NSTimer *_timer; 89 87 90 int startTime, stopTime,diffTime;91 bool waitingForUser;88 int _startTime, _stopTime, _diffTime; 89 bool _waitingForUser; 92 90 } 93 91 94 92 95 - (void) openTutor;96 - (void) resetTutor;97 - (void) sessionShouldFinish;93 - (void) openTutor; 94 - (void) resetTutor; 95 - (void) sessionShouldFinish; 98 96 99 - (IBAction) clickKana:(NSMatrix *)sender;100 - (IBAction) writeKana:(NSButton *)sender;101 - (void) userWasCorrect:(NSString *)kana;102 - (void) userWasIncorrect:(NSString *)kana;97 - (IBAction) clickKana:(NSMatrix *)sender; 98 - (IBAction) writeKana:(NSButton *)sender; 99 - (void) userWasCorrect:(NSString *)kana; 100 - (void) userWasIncorrect:(NSString *)kana; 103 101 104 - (IBAction) openLines:(id)sender;105 - (IBAction) linesOK:(NSButton *)sender;106 - (IBAction) linesSelectAll:(NSButton *)sender;102 - (IBAction) openLines:(id)sender; 103 - (IBAction) linesOK:(NSButton *)sender; 104 - (IBAction) linesSelectAll:(NSButton *)sender; 107 105 108 - (void) start;109 - (void) startNewQuiz;110 - (void) startNewLearning;106 - (void) start; 107 - (void) startNewQuiz; 108 - (void) startNewLearning; 111 109 112 - (void) updateSettings;113 - (void) updateScore;114 - (void) updateButtonTitles;115 - (void) updateButtons;110 - (void) updateSettings; 111 - (void) updateScore; 112 - (void) updateButtonTitles; 113 - (void) updateButtons; 116 114 117 - (void) setImageByKanaName:(NSString *)kanaName;118 - (void) userConfirmed;115 - (void) setImageByKanaName:(NSString *)kanaName; 116 - (void) userConfirmed; 119 117 120 - (IBAction) changeMode:(id)sender;121 - (IBAction) changeKanaType:(id)sender;122 - (IBAction) changeRomanisationSystem:(id)sender;118 - (IBAction) changeMode:(id)sender; 119 - (IBAction) changeKanaType:(id)sender; 120 - (IBAction) changeRomanisationSystem:(id)sender; 123 121 124 - (int) getQuestions;125 - (int) getCorrect;126 - (int) getTime;122 - (int) getQuestions; 123 - (int) getCorrect; 124 - (int) getTime; 127 125 128 126 @end Nuku/trunk/Session.h
r815 r821 1 /* $Id: Session.h,v 1. 3 2003/04/02 23:11:29morris Exp $ */1 /* $Id: Session.h,v 1.4 2003/04/04 16:49:55 morris Exp $ */ 2 2 3 3 /* … … 31 31 32 32 #import <Cocoa/Cocoa.h> 33 #import "Settings.h"34 33 35 @class Controller ;34 @class Controller, Settings; 36 35 37 36 @interface Session : NSObject { 38 IBOutlet Controller *controllerOutlet;37 IBOutlet Controller *controllerOutlet; 39 38 40 IBOutlet NSWindow *windowSession;41 IBOutlet NSWindow *windowReport;39 IBOutlet NSWindow *windowSession; 40 IBOutlet NSWindow *windowReport; 42 41 43 IBOutlet NSView *viewPrint;44 IBOutlet NSTextView *viewText;42 IBOutlet NSView *viewPrint; 43 IBOutlet NSTextView *viewText; 45 44 46 IBOutlet NSPopUpButton *selectSession;47 IBOutlet NSTextField *fieldTime;48 IBOutlet NSTextField *fieldKana;49 IBOutlet NSStepper *stepperTime;50 IBOutlet NSStepper *stepperKana;51 IBOutlet NSButton *boxLock;52 IBOutlet NSButton *boxAwait;45 IBOutlet NSPopUpButton *selectSession; 46 IBOutlet NSTextField *fieldTime; 47 IBOutlet NSTextField *fieldKana; 48 IBOutlet NSStepper *stepperTime; 49 IBOutlet NSStepper *stepperKana; 50 IBOutlet NSButton *boxLock; 51 IBOutlet NSButton *boxAwait; 53 52 54 IBOutlet NSTextField *reportAnswered;55 IBOutlet NSTextField *reportMissed;56 IBOutlet NSTextField *reportCorrect;57 IBOutlet NSTextField *reportIncorrect;58 IBOutlet NSTextField *reportPercent;59 IBOutlet NSTextField *reportTime;60 IBOutlet NSTextView *reportComment;53 IBOutlet NSTextField *reportAnswered; 54 IBOutlet NSTextField *reportMissed; 55 IBOutlet NSTextField *reportCorrect; 56 IBOutlet NSTextField *reportIncorrect; 57 IBOutlet NSTextField *reportPercent; 58 IBOutlet NSTextField *reportTime; 59 IBOutlet NSTextView *reportComment; 61 60 62 Settings *settings;61 Settings *_settings; 63 62 64 BOOL done;63 BOOL _done; 65 64 } 66 65 67 66 68 - (IBAction) newSession:(id)sender;69 - (IBAction) start:(id)sender;67 - (IBAction) newSession:(id)sender; 68 - (IBAction) start:(id)sender; 70 69 71 - (IBAction) switchType:(id)sender;72 - (IBAction) enterTime:(id)sender;73 - (IBAction) enterKana:(id)sender;74 - (IBAction) stepTime:(id)sender;75 - (IBAction) stepKana:(id)sender;70 - (IBAction) switchType:(id)sender; 71 - (IBAction) enterTime:(id)sender; 72 - (IBAction) enterKana:(id)sender; 73 - (IBAction) stepTime:(id)sender; 74 - (IBAction) stepKana:(id)sender; 76 75 77 - (void) showReport;78 - (IBAction) print:(id)sender;76 - (void) showReport; 77 - (IBAction) print:(id)sender; 79 78 80 - (BOOL) isDone;81 - (void) done;79 - (BOOL) isDone; 80 - (void) done; 82 81 83 82 @end Nuku/trunk/Session.m
r815 r821 1 /* $Id: Session.m,v 1. 4 2003/04/02 23:11:29morris Exp $ */1 /* $Id: Session.m,v 1.5 2003/04/04 16:46:15 morris Exp $ */ 2 2 3 3 /* … … 324 324 } 325 325 326 327 326 @end Nuku/trunk/Settings.h
r815 r821 1 /* $Id: Settings.h,v 1. 3 2003/04/02 23:11:29morris Exp $ */1 /* $Id: Settings.h,v 1.4 2003/04/04 16:46:58 morris Exp $ */ 2 2 3 3 /* … … 77 77 78 78 @interface Settings : NSObject { 79 ;80 79 } 81 80 Nuku/trunk/Tutor.h
r815 r821 1 /* $Id: Tutor.h,v 1. 4 2003/04/02 23:10:04morris Exp $ */1 /* $Id: Tutor.h,v 1.5 2003/04/04 16:49:55 morris Exp $ */ 2 2 3 3 /* … … 41 41 42 42 @interface Tutor : NSObject { 43 NSString *currentKana;43 NSString *_currentKana; 44 44 45 NSMutableDictionary *hiraganaImages;46 NSMutableDictionary *katakanaImages;45 NSMutableDictionary *_hiraganaImages; 46 NSMutableDictionary *_katakanaImages; 47 47 48 NSMutableDictionary *currentStrings;49 NSDictionary *hepburnStrings;50 NSDictionary *kunreiSikiStrings;51 NSDictionary *nihonSikiStrings;48 NSMutableDictionary *_currentStrings; 49 NSDictionary *_hepburnStrings; 50 NSDictionary *_kunreiSikiStrings; 51 NSDictionary *_nihonSikiStrings; 52 52 53 int correct;54 int questions;53 int _correct; 54 int _questions; 55 55 } 56 56 57 57 58 - (NSMutableDictionary *) loadImageSet:(NSString *)which;59 - (void) loadKanaNames;58 - (NSMutableDictionary *) loadImageSet:(NSString *)which; 59 - (void) loadKanaNames; 60 60 61 - (void) switchRomanisationStrings:(int)to;62 - (void) reduceRomanisationStrings:(NSString *)which;61 - (void) switchRomanisationStrings:(int)to; 62 - (void) reduceRomanisationStrings:(NSString *)which; 63 63 64 - (NSString *) getExpandedKanaName:(NSString*)fromKana;64 - (NSString *) getExpandedKanaName:(NSString*)fromKana; 65 65 66 - (NSString *) getCurrentKanaName; 67 - (void) setCurrentKanaName:(NSString *)kanaName; 66 - (NSString *) getCurrentKanaName; 67 - (void) setCurrentKanaName:(NSString *)kanaName; 68 69 - (NSString *) getRandomKanaName; 70 - (NSImage *) getKanaImageByName:(NSString *)kanaName; 68 71 69 - (NSString *) getRandomKanaName; 70 - (NSImage *) getKanaImageByName:(NSString *)kanaName; 71 72 - (void) setCorrect:(int)value; 73 - (int) getCorrect; 74 75 - (void) setQuestions:(int)value; 76 - (int) getQuestions; 72 - (void) setCorrect:(int)value; 73 - (int) getCorrect; 74 75 - (void) setQuestions:(int)value; 76 - (int) getQuestions; 77 77 78 78 @end Nuku/trunk/Tutor.m
r815 r821 1 /* $Id: Tutor.m,v 1. 4 2003/04/02 23:11:29morris Exp $ */1 /* $Id: Tutor.m,v 1.5 2003/04/04 16:46:06 morris Exp $ */ 2 2 3 3 /* … … 43 43 44 44 // --- load all our images 45 hiraganaImages = [self loadImageSet:kPathHiraganaImages];46 katakanaImages = [self loadImageSet:kPathKatakanaImages];45 hiraganaImages = [self loadImageSet:kPathHiraganaImages]; 46 katakanaImages = [self loadImageSet:kPathKatakanaImages]; 47 47 48 48 // --- load our kana names … … 145 145 146 146 /* 147 147 Remove the string from the set of kana strings. 148 148 */ 149 149 … … 197 197 NSArray *keys; 198 198 NSString *kana; 199 int rand; 200 bool found = false; 201 202 keys = [currentStrings allKeys]; 199 int count; 200 BOOL found = NO; 201 202 keys = [currentStrings allKeys]; 203 count = [keys count]; 203 204 204 205 do { 205 rand = random() % [keys count]; 206 kana = [keys objectAtIndex:rand]; 206 kana = [keys objectAtIndex:random() % count]; 207 207 208 208 // --- always force a new kana … … 224 224 case kDefaultsKanaTypeHiragana: 225 225 return [hiraganaImages objectForKey:kanaName]; 226 break; 226 227 227 228 case kDefaultsKanaTypeKatakana: 228 229 return [katakanaImages objectForKey:kanaName]; 230 break; 229 231 230 232 case kDefaultsKanaTypeMixed: … … 233 235 else 234 236 return [katakanaImages objectForKey:kanaName]; 237 break; 235 238 } 236 239
