diff --git a/Source/English.lproj/preferences.xib b/Source/English.lproj/preferences.xib index 9cd33e7f..a390d438 100644 --- a/Source/English.lproj/preferences.xib +++ b/Source/English.lproj/preferences.xib @@ -1,14 +1,14 @@ - 1060 - 10K549 - 1910 - 1038.36 - 461.00 + 1070 + 11B26 + 1617 + 1138 + 566.00 com.apple.InterfaceBuilder.CocoaPlugin - 1910 + 1617 YES @@ -18,6 +18,7 @@ NSMenu NSTextFieldCell NSButtonCell + NSButton NSMatrix NSCustomObject NSView @@ -30,8 +31,11 @@ com.apple.InterfaceBuilder.CocoaPlugin - PluginDependencyRecalculationVersion - + YES + + YES + + YES @@ -47,11 +51,12 @@ 7 2 - {{809, 539}, {410, 193}} + {{809, 539}, {435, 227}} 544735232 Bopomofo Preferences NSWindow + 256 @@ -60,7 +65,7 @@ 268 - {{174, 149}, {151, 26}} + {{174, 183}, {151, 26}} @@ -80,29 +85,30 @@ 400 75 - + + + Standard + + 1048576 + 2147483647 + 1 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + YES OtherViews YES - - - Standard - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - _popUpItemAction: - - + ETen @@ -164,7 +170,7 @@ 268 - {{58, 155}, {114, 17}} + {{58, 189}, {114, 17}} @@ -198,7 +204,7 @@ 268 - {{17, 115}, {155, 17}} + {{17, 149}, {155, 17}} @@ -216,7 +222,7 @@ 268 - {{34, 69}, {138, 17}} + {{34, 103}, {138, 17}} @@ -234,7 +240,7 @@ 268 - {{38, 22}, {134, 17}} + {{38, 56}, {134, 17}} @@ -252,7 +258,7 @@ 268 - {{177, 94}, {213, 38}} + {{177, 128}, {213, 38}} @@ -455,7 +461,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 - {{177, 48}, {207, 38}} + {{177, 82}, {207, 38}} @@ -649,10 +655,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 - {{174, 16}, {86, 26}} + {{174, 50}, {86, 26}} - + YES -2076049856 @@ -778,14 +784,46 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2 + + + 268 + {{175, 18}, {242, 18}} + + + + _NS:239 + YES + + -2080244224 + 0 + Use spce key to choose candidates + + _NS:239 + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + - {410, 193} + {435, 227} - {{0, 0}, {1440, 878}} - {1e+13, 1e+13} + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES YES @@ -802,14 +840,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 30 - - - fontSizePopUpButton - - - - 108 - selectedTag: values.KeyboardLayout @@ -874,15 +904,37 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 107 + + + fontSizePopUpButton + + + + 108 + + + + value: values.ChooseCandidateUsingSpaceKey + + + + + + value: values.ChooseCandidateUsingSpaceKey + value + values.ChooseCandidateUsingSpaceKey + 2 + + + 112 + YES 0 - - YES - + @@ -927,6 +979,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + @@ -1173,6 +1226,20 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + 109 + + + YES + + + + + + 110 + + + @@ -1190,7 +1257,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 10.IBPluginDependency 100.IBPluginDependency 101.IBPluginDependency + 109.IBPluginDependency 11.IBPluginDependency + 110.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency 14.IBPluginDependency @@ -1272,6 +1341,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -1286,7 +1357,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 108 + 112 @@ -1295,14 +1366,35 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA PreferencesWindowController NSWindowController - fontSizePopUpButton - NSPopUpButton + YES + + YES + _fontSizePopUpButton + fontSizePopUpButton + + + YES + NSPopUpButton + NSPopUpButton + - fontSizePopUpButton - - fontSizePopUpButton - NSPopUpButton + YES + + YES + _fontSizePopUpButton + fontSizePopUpButton + + + YES + + _fontSizePopUpButton + NSPopUpButton + + + fontSizePopUpButton + NSPopUpButton + @@ -1326,11 +1418,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES NSMenuCheckmark NSMenuMixedState + NSSwitch YES {9, 8} {7, 2} + {15, 15} diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 689124d6..6c46601f 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -69,6 +69,7 @@ static NSString *const kSelectPhraseAfterCursorAsCandidatePreferenceKey = @"Sele static NSString *const kUseHorizontalCandidateListPreferenceKey = @"UseHorizontalCandidateList"; static NSString *const kComposingBufferSizePreferenceKey = @"ComposingBufferSize"; static NSString *const kDisableUserCandidateSelectionLearning = @"DisableUserCandidateSelectionLearning"; +static NSString *const kChooseCandidateUsingSpaceKey = @"ChooseCandidateUsingSpaceKey"; // a global object for saving the "learned" user candidate selections NSMutableDictionary *TLCandidateLearningDictionary = nil; @@ -251,7 +252,10 @@ public: if (textSize != previousTextSize) { [[NSUserDefaults standardUserDefaults] setInteger:textSize forKey:kCandidateListTextSizeKey]; } - + if (![[NSUserDefaults standardUserDefaults] objectForKey:kChooseCandidateUsingSpaceKey]) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kChooseCandidateUsingSpaceKey]; + } + [(AppDelegate *)[NSApp delegate] checkForUpdate]; } @@ -500,7 +504,24 @@ public: // keyCode 125 = Down, charCode 32 = Space if (_bpmfReadingBuffer->isEmpty() && [_composingBuffer length] > 0 && (keyCode == 125 || charCode == 32)) { - // candidate + if (charCode == 32) { + if (![[NSUserDefaults standardUserDefaults] boolForKey:kChooseCandidateUsingSpaceKey]) { + if (_builder->cursorIndex() >= _builder->length()) { + [_composingBuffer appendString:@" "]; + [self commitComposition:client]; + _bpmfReadingBuffer->clear(); + } + else if (LTLanguageModel.hasUnigramsForKey(" ")) { + _builder->insertReadingAtCursor(" "); + [self popOverflowComposingTextAndWalk:client]; + [self updateClientComposingBuffer:client]; + } + return YES; + + } + } + + // candidate [LTSharedCandidates setDismissesAutomatically:YES]; // wrap NSNumber; we only allow number keys 1-9 as selection keys in this project @@ -528,7 +549,7 @@ public: // update the composing text, set the client [self updateClientComposingBuffer:client]; _currentCandidateClient = client; - return YES; + return YES; } // Esc @@ -898,6 +919,7 @@ void LTLoadLanguageModel() } } ifs.close(); + LTLanguageModel.add(" ", " ", 0.0); // initialize the singleton learning dictionary // putting singleton in @synchronized is the standard way in Objective-C diff --git a/Source/Lettuce.xcodeproj/project.pbxproj b/Source/Lettuce.xcodeproj/project.pbxproj index 927e49c3..43dfb0a4 100644 --- a/Source/Lettuce.xcodeproj/project.pbxproj +++ b/Source/Lettuce.xcodeproj/project.pbxproj @@ -224,7 +224,6 @@ 6A8515A8137277C80066B1BD = { isa = PBXGroup; children = ( - 6ACF37E813A7C159008798F2 /* QuartzCore.framework */, 6A43430813727B230094187C /* Data */, 6ABE4FE2137285F900981680 /* Engine */, 6A43430713727B1B0094187C /* Lettuce */, @@ -247,6 +246,7 @@ 6A8515B8137277DB0066B1BD /* Frameworks */ = { isa = PBXGroup; children = ( + 6ACF37E813A7C159008798F2 /* QuartzCore.framework */, 6ADF4DB713727BEC00A7C57B /* Carbon.framework */, 6A8515B9137277DB0066B1BD /* Cocoa.framework */, 6ADF4DB513727BD200A7C57B /* InputMethodKit.framework */, diff --git a/Source/zh-Hant.lproj/preferences.xib b/Source/zh-Hant.lproj/preferences.xib index 346d87be..5590cf7f 100644 --- a/Source/zh-Hant.lproj/preferences.xib +++ b/Source/zh-Hant.lproj/preferences.xib @@ -1,14 +1,14 @@ - 1060 - 10K549 - 1910 - 1038.36 - 461.00 + 1070 + 11B26 + 1617 + 1138 + 566.00 com.apple.InterfaceBuilder.CocoaPlugin - 1910 + 1617 YES @@ -18,6 +18,7 @@ NSMenu NSTextFieldCell NSButtonCell + NSButton NSMatrix NSCustomObject NSView @@ -30,8 +31,11 @@ com.apple.InterfaceBuilder.CocoaPlugin - PluginDependencyRecalculationVersion - + YES + + YES + + YES @@ -47,11 +51,12 @@ 7 2 - {{809, 539}, {386, 193}} + {{809, 539}, {409, 227}} 544735232 注音偏好設定 NSWindow + 256 @@ -60,7 +65,7 @@ 268 - {{179, 149}, {125, 26}} + {{179, 183}, {125, 26}} @@ -80,23 +85,21 @@ 400 75 - + - 漢語拼音 + 標準 - 1048576 2147483647 1 - + NSImage NSMenuCheckmark - + NSImage NSMenuMixedState _popUpItemAction: - 4 YES @@ -104,25 +107,15 @@ OtherViews YES - - - 標準 - - 2147483647 - 1 - - - _popUpItemAction: - - + 倚天 1048576 2147483647 - - + + _popUpItemAction: 1 @@ -133,8 +126,8 @@ 1048576 2147483647 - - + + _popUpItemAction: 2 @@ -145,13 +138,25 @@ 1048576 2147483647 - - + + _popUpItemAction: 3 - + + + 漢語拼音 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + 4 + + @@ -165,7 +170,7 @@ 268 - {{82, 155}, {95, 17}} + {{82, 189}, {95, 17}} @@ -203,7 +208,7 @@ 268 - {{17, 115}, {160, 17}} + {{17, 149}, {160, 17}} @@ -221,7 +226,7 @@ 268 - {{39, 69}, {138, 17}} + {{39, 103}, {138, 17}} @@ -239,7 +244,7 @@ 268 - {{69, 22}, {108, 17}} + {{69, 56}, {108, 17}} @@ -257,7 +262,7 @@ 268 - {{182, 94}, {184, 38}} + {{182, 128}, {184, 38}} @@ -460,7 +465,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 - {{182, 48}, {207, 38}} + {{182, 82}, {207, 38}} @@ -654,10 +659,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 - {{179, 16}, {86, 26}} + {{179, 50}, {86, 26}} - + YES -2076049856 @@ -677,8 +682,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 1 - - + + _popUpItemAction: 18 @@ -694,8 +699,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 12 @@ -706,8 +711,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 14 @@ -718,8 +723,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 16 @@ -731,8 +736,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 24 @@ -743,8 +748,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 32 @@ -755,8 +760,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 64 @@ -767,8 +772,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 1048576 2147483647 - - + + _popUpItemAction: 96 @@ -783,14 +788,50 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 2 + + + 268 + {{180, 18}, {113, 18}} + + + + _NS:239 + YES + + -2080244224 + 0 + 使用空白鍵選字 + + LiHeiPro + 13 + 16 + + _NS:239 + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + - {386, 193} + {409, 227} - {{0, 0}, {1440, 878}} - {1e+13, 1e+13} + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES YES @@ -807,14 +848,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 30 - - - fontSizePopUpButton - - - - 108 - selectedTag: values.KeyboardLayout @@ -879,15 +912,37 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 107 + + + fontSizePopUpButton + + + + 108 + + + + value: values.ChooseCandidateUsingSpaceKey + + + + + + value: values.ChooseCandidateUsingSpaceKey + value + values.ChooseCandidateUsingSpaceKey + 2 + + + 111 + YES 0 - - YES - + @@ -932,6 +987,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + @@ -1178,6 +1234,20 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + 109 + + + YES + + + + + + 110 + + + @@ -1195,7 +1265,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 10.IBPluginDependency 100.IBPluginDependency 101.IBPluginDependency + 109.IBPluginDependency 11.IBPluginDependency + 110.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency 14.IBPluginDependency @@ -1277,6 +1349,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -1291,7 +1365,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 108 + 111 @@ -1300,14 +1374,35 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA PreferencesWindowController NSWindowController - fontSizePopUpButton - NSPopUpButton + YES + + YES + _fontSizePopUpButton + fontSizePopUpButton + + + YES + NSPopUpButton + NSPopUpButton + - fontSizePopUpButton - - fontSizePopUpButton - NSPopUpButton + YES + + YES + _fontSizePopUpButton + fontSizePopUpButton + + + YES + + _fontSizePopUpButton + NSPopUpButton + + + fontSizePopUpButton + NSPopUpButton + @@ -1331,11 +1426,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES NSMenuCheckmark NSMenuMixedState + NSSwitch YES {9, 8} {7, 2} + {15, 15}