diff --git a/Source/InputMethodController.h b/Source/InputMethodController.h index 19ee2ef9..12c53e7e 100644 --- a/Source/InputMethodController.h +++ b/Source/InputMethodController.h @@ -51,12 +51,16 @@ // the latest composing buffer that is updated to the foreground app NSMutableString *_composingBuffer; + NSInteger _latestReadingCursor; // the current text input client; we need to keep this when candidate panel is on id _currentCandidateClient; // a special deferred client for Terminal.app fix id _currentDeferredClient; + + // currently available candidates + NSMutableArray *_candidates; } @end diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index a80b2b1a..6c3f5fac 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -40,6 +40,8 @@ #import "OVStringHelper.h" #import "OVUTF8Helper.h" #import "AppDelegate.h" +#import "VTHorizontalCandidateController.h" +#import "VTVerticalCandidateController.h" // C++ namespace usages using namespace std; @@ -75,20 +77,24 @@ static NSString *const kChooseCandidateUsingSpaceKey = @"ChooseCandidateUsingSpa NSMutableDictionary *TLCandidateLearningDictionary = nil; NSString *TLUserCandidatesDictionaryPath = nil; +VTCandidateController *LTCurrentCandidateController = nil; + // if DEBUG is defined, a DOT file (GraphViz format) will be written to the // specified path everytime the grid is walked #if DEBUG static NSString *const kGraphVizOutputfile = @"/tmp/lettuce-visualization.dot"; #endif -// IMK candidate panel object, created in main() -extern IMKCandidates *LTSharedCandidates; - // shared language model object that stores our phrase-term probability database SimpleLM LTLanguageModel; // private methods -@interface LettuceInputMethodController () +@interface LettuceInputMethodController () ++ (VTHorizontalCandidateController *)horizontalCandidateController; ++ (VTVerticalCandidateController *)verticalCandidateController; + +- (void)collectCandidates; + - (size_t)actualCandidateCursorIndex; - (NSString *)neighborTrigramString; @@ -120,6 +126,8 @@ public: [_composingBuffer release]; + [_candidates release]; + // the two client pointers are weak pointers (i.e. we don't retain them) // therefore we don't do anything about it @@ -133,6 +141,8 @@ public: self = [super initWithServer:server delegate:delegate client:client]; if (self) { + _candidates = [[NSMutableArray alloc] init]; + // create the reading buffer _bpmfReadingBuffer = new BopomofoReadingBuffer(BopomofoKeyboardLayout::StandardLayout()); @@ -263,6 +273,10 @@ public: [self commitComposition:client]; _currentDeferredClient = nil; _currentCandidateClient = nil; + + LTCurrentCandidateController.delegate = nil; + LTCurrentCandidateController.visible = NO; + [_candidates removeAllObjects]; } #pragma mark - IMKServerInput protocol methods @@ -285,6 +299,8 @@ public: _builder->clear(); _walkedNodes.clear(); [_composingBuffer setString:@""]; + LTCurrentCandidateController.visible = NO; + [_candidates removeAllObjects]; } // TODO: bug #28 is more likely to live in this method. @@ -350,6 +366,8 @@ public: // the selection range is where the cursor is, with the length being 0 and replacement range NSNotFound, // i.e. the client app needs to take care of where to put ths composing buffer [client setMarkedText:attrString selectionRange:NSMakeRange(cursorIndex, 0) replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; + + _latestReadingCursor = cursorIndex; } - (void)walk @@ -477,7 +495,7 @@ public: return YES; } if (flags & NSNumericPadKeyMask) { - if (keyCode != 123 && keyCode != 124 && keyCode != 125 && keyCode != 126 && charCode != 32 ) { + if (keyCode != 123 && keyCode != 124 && keyCode != 125 && keyCode != 126 && charCode != 32 && isprint(charCode)) { if ([_composingBuffer length]) [self commitComposition:client]; NSString *popedText = [inputText lowercaseString]; [client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; @@ -485,6 +503,106 @@ public: } } + if ([_candidates count]) { + if (charCode == 27) { + LTCurrentCandidateController.visible = NO; + [_candidates removeAllObjects]; + return YES; + } + else if (charCode == 13 || keyCode == 127) { + [self candidateController:LTCurrentCandidateController didSelectCandidateAtIndex:LTCurrentCandidateController.selectedCandidateIndex]; + return YES; + } + else if (charCode == 32 || keyCode == 121) { + BOOL updated = [LTCurrentCandidateController showNextPage]; + if (!updated) { + [self beep]; + } + return YES; + } + else if (keyCode == 116) { + BOOL updated = [LTCurrentCandidateController showPreviousPage]; + if (!updated) { + [self beep]; + } + return YES; + } + else if (keyCode == 123) { + if ([LTCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) { + BOOL updated = [LTCurrentCandidateController highlightPreviousCandidate]; + if (!updated) { + [self beep]; + } + return YES; + } + else { + [self beep]; + return YES; + } + } + else if (keyCode == 124) { + if ([LTCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) { + BOOL updated = [LTCurrentCandidateController highlightNextCandidate]; + if (!updated) { + [self beep]; + } + return YES; + } + else { + [self beep]; + return YES; + } + } + else if (keyCode == 126) { + if ([LTCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) { + BOOL updated = [LTCurrentCandidateController showPreviousPage]; + if (!updated) { + [self beep]; + } + return YES; + } + else { + BOOL updated = [LTCurrentCandidateController highlightPreviousCandidate]; + if (!updated) { + [self beep]; + } + return YES; + } + } + else if (keyCode == 125) { + if ([LTCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) { + BOOL updated = [LTCurrentCandidateController showNextPage]; + if (!updated) { + [self beep]; + } + return YES; + } + else { + BOOL updated = [LTCurrentCandidateController highlightNextCandidate]; + if (!updated) { + [self beep]; + } + return YES; + } + } + else { + + NSInteger index = [LTCurrentCandidateController.keyLabels indexOfObject:inputText]; + if (index != NSNotFound) { + NSUInteger candidateIndex = [LTCurrentCandidateController candidateIndexAtKeyLabelIndex:index]; + if (candidateIndex != NSUIntegerMax) { + [self candidateController:LTCurrentCandidateController didSelectCandidateAtIndex:candidateIndex]; + return YES; + } + } + + [self beep]; + return YES; + } + + } + + // see if it's valid BPMF reading if (_bpmfReadingBuffer->isValidKey((char)charCode)) { _bpmfReadingBuffer->combineKey((char)charCode); @@ -741,70 +859,52 @@ public: return NO; } -- (NSArray*)candidates:(id)client +#pragma mark - Private methods + ++ (VTHorizontalCandidateController *)horizontalCandidateController +{ + static VTHorizontalCandidateController *instance = nil; + @synchronized(self) { + if (!instance) { + instance = [[VTHorizontalCandidateController alloc] init]; + } + } + + return instance; +} + ++ (VTVerticalCandidateController *)verticalCandidateController +{ + static VTVerticalCandidateController *instance = nil; + @synchronized(self) { + if (!instance) { + instance = [[VTVerticalCandidateController alloc] init]; + } + } + + return instance; +} + +- (void)collectCandidates { // returns the candidate - - NSMutableArray *results = [NSMutableArray array]; + [_candidates removeAllObjects]; + size_t cursorIndex = [self actualCandidateCursorIndex]; vector nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); - + // sort the nodes, so that longer nodes (representing longer phrases) are placed at the top of the candidate list sort(nodes.begin(), nodes.end(), NodeAnchorDescendingSorter()); - + // then use the C++ trick to retrieve the candidates for each node at/crossing the cursor for (vector::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) { const vector& candidates = (*ni).node->candidates(); for (vector::const_iterator ci = candidates.begin(), ce = candidates.end(); ci != ce; ++ci) { - [results addObject:[NSString stringWithUTF8String:(*ci).value.c_str()]]; + [_candidates addObject:[NSString stringWithUTF8String:(*ci).value.c_str()]]; } } - - return results; } -- (void)candidateSelected:(NSAttributedString *)candidateString -{ - // candidate selected, override the node with selection - - string selectedValue; - - if ([candidateString isKindOfClass:[NSString class]]) { - selectedValue = [(NSString *)candidateString UTF8String]; - } - else { - selectedValue = [[candidateString string] UTF8String]; - } - - if (![[NSUserDefaults standardUserDefaults] boolForKey:kDisableUserCandidateSelectionLearning]) { - NSString *trigram = [self neighborTrigramString]; - NSString *selectedNSString = [NSString stringWithUTF8String:selectedValue.c_str()]; - [TLCandidateLearningDictionary setObject:selectedNSString forKey:trigram]; - [self saveUserCandidatesDictionary]; - } - - size_t cursorIndex = [self actualCandidateCursorIndex]; - vector nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); - - for (vector::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) { - const vector& candidates = (*ni).node->candidates(); - - for (size_t i = 0, c = candidates.size(); i < c; ++i) { - if (candidates[i].value == selectedValue) { - // found our node - const_cast((*ni).node)->selectCandidateAtIndex(i); - break; - } - } - } - - [self walk]; - [self updateClientComposingBuffer:_currentCandidateClient]; - _currentCandidateClient = nil; -} - -#pragma mark - Private methods - - (size_t)actualCandidateCursorIndex { size_t cursorIndex = _builder->cursorIndex(); @@ -900,38 +1000,45 @@ public: - (void)_showCandidateWindowUsingVerticalMode:(BOOL)useVerticalMode client:(id)client { - // candidate - [LTSharedCandidates setDismissesAutomatically:YES]; - - // wrap NSNumber; we only allow number keys 1-9 as selection keys in this project -#define LTUIntObj(x) ([NSNumber numberWithInteger:x]) - [LTSharedCandidates setSelectionKeys:[NSArray arrayWithObjects:LTUIntObj(18), LTUIntObj(19), LTUIntObj(20), LTUIntObj(21), LTUIntObj(23), LTUIntObj(22), LTUIntObj(26), LTUIntObj(28), LTUIntObj(25), nil]]; -#undef LTUIntObj - // set the candidate panel style BOOL useHorizontalCandidateList = [[NSUserDefaults standardUserDefaults] boolForKey:kUseHorizontalCandidateListPreferenceKey]; if (useVerticalMode) { - [LTSharedCandidates setPanelType:kIMKSingleColumnScrollingCandidatePanel]; + LTCurrentCandidateController = [LettuceInputMethodController verticalCandidateController]; } else if (useHorizontalCandidateList) { - [LTSharedCandidates setPanelType:kIMKSingleRowSteppingCandidatePanel]; + LTCurrentCandidateController = [LettuceInputMethodController horizontalCandidateController]; } else { - [LTSharedCandidates setPanelType:kIMKSingleColumnScrollingCandidatePanel]; + LTCurrentCandidateController = [LettuceInputMethodController verticalCandidateController]; } // set the attributes for the candidate panel (which uses NSAttributedString) NSInteger textSize = [[NSUserDefaults standardUserDefaults] integerForKey:kCandidateListTextSizeKey]; - NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize:textSize], NSFontAttributeName, nil]; - [LTSharedCandidates setAttributes:attributes]; - - [LTSharedCandidates updateCandidates]; - [LTSharedCandidates show:useVerticalMode ? kIMKLocateCandidatesLeftHint : kIMKLocateCandidatesBelowHint]; + + LTCurrentCandidateController.keyLabelFont = [NSFont systemFontOfSize:(textSize < 20) ? textSize : 19 + (textSize / 4)]; + LTCurrentCandidateController.candidateFont = [NSFont systemFontOfSize:textSize]; + LTCurrentCandidateController.CJKCandidateFont = [NSFont systemFontOfSize:textSize]; + LTCurrentCandidateController.keyLabels = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", nil]; + [self collectCandidates]; + + LTCurrentCandidateController.delegate = self; + [LTCurrentCandidateController reloadData]; // update the composing text, set the client [self updateClientComposingBuffer:client]; _currentCandidateClient = client; + + NSRect lineHeightRect; + + NSInteger cursor = _latestReadingCursor; + if (cursor == [_composingBuffer length] && cursor != 0) { + cursor--; + } + + [client attributesForCharacterIndex:cursor lineHeightRectangle:&lineHeightRect]; + LTCurrentCandidateController.windowTopLeftPoint = NSMakePoint(lineHeightRect.origin.x, lineHeightRect.origin.y - 4.0); + LTCurrentCandidateController.visible = YES; } #pragma mark - Misc menu items @@ -966,6 +1073,52 @@ public: { NSLog(@"%@", TLCandidateLearningDictionary); } + +- (NSUInteger)candidateCountForController:(VTCandidateController *)controller +{ + return [_candidates count]; +} + +- (NSString *)candidateController:(VTCandidateController *)controller candidateAtIndex:(NSUInteger)index +{ + return [_candidates objectAtIndex:index]; +} + +- (void)candidateController:(VTCandidateController *)controller didSelectCandidateAtIndex:(NSUInteger)index +{ + LTCurrentCandidateController.visible = NO; + + // candidate selected, override the node with selection + string selectedValue = [[_candidates objectAtIndex:index] UTF8String]; + + if (![[NSUserDefaults standardUserDefaults] boolForKey:kDisableUserCandidateSelectionLearning]) { + NSString *trigram = [self neighborTrigramString]; + NSString *selectedNSString = [NSString stringWithUTF8String:selectedValue.c_str()]; + [TLCandidateLearningDictionary setObject:selectedNSString forKey:trigram]; + [self saveUserCandidatesDictionary]; + } + + size_t cursorIndex = [self actualCandidateCursorIndex]; + vector nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); + + for (vector::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) { + const vector& candidates = (*ni).node->candidates(); + + for (size_t i = 0, c = candidates.size(); i < c; ++i) { + if (candidates[i].value == selectedValue) { + // found our node + const_cast((*ni).node)->selectCandidateAtIndex(i); + break; + } + } + } + + [_candidates removeAllObjects]; + + [self walk]; + [self updateClientComposingBuffer:_currentCandidateClient]; +} + @end diff --git a/Source/Lettuce.xcodeproj/project.pbxproj b/Source/Lettuce.xcodeproj/project.pbxproj index 817c58bf..4666e744 100644 --- a/Source/Lettuce.xcodeproj/project.pbxproj +++ b/Source/Lettuce.xcodeproj/project.pbxproj @@ -23,6 +23,12 @@ 6A89E66A13F7647D00DDBF09 /* UpdateNotificationController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A89E66913F7647D00DDBF09 /* UpdateNotificationController.xib */; }; 6ABE50131372864300981680 /* Mandarin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6ABE50111372864300981680 /* Mandarin.cpp */; }; 6ABEDAF313F74D9C00A0825A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ABEDAF513F74D9C00A0825A /* Localizable.strings */; }; + 6AC45E16152413D600C5E259 /* VTCandidateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E0B152413D600C5E259 /* VTCandidateController.m */; }; + 6AC45E17152413D600C5E259 /* VTHorizontalCandidateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E0D152413D600C5E259 /* VTHorizontalCandidateController.m */; }; + 6AC45E18152413D600C5E259 /* VTHorizontalCandidateView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E0F152413D600C5E259 /* VTHorizontalCandidateView.m */; }; + 6AC45E19152413D600C5E259 /* VTVerticalCandidateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E11152413D600C5E259 /* VTVerticalCandidateController.m */; }; + 6AC45E1A152413D600C5E259 /* VTVerticalCandidateTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E13152413D600C5E259 /* VTVerticalCandidateTableView.m */; }; + 6AC45E1B152413D600C5E259 /* VTVerticalKeyLabelStripView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E15152413D600C5E259 /* VTVerticalKeyLabelStripView.m */; }; 6ACF37C413A7BE68008798F2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A8515B9137277DB0066B1BD /* Cocoa.framework */; }; 6ACF37CE13A7BE68008798F2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ACF37CC13A7BE68008798F2 /* InfoPlist.strings */; }; 6ACF37D113A7BE68008798F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ACF37D013A7BE68008798F2 /* main.m */; }; @@ -126,6 +132,18 @@ 6ABEDAF013F74D2F00A0825A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = ""; }; 6ABEDAF413F74D9C00A0825A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; 6ABEDAF613F74DA300A0825A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; + 6AC45E0A152413D600C5E259 /* VTCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTCandidateController.h; sourceTree = ""; }; + 6AC45E0B152413D600C5E259 /* VTCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTCandidateController.m; sourceTree = ""; }; + 6AC45E0C152413D600C5E259 /* VTHorizontalCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTHorizontalCandidateController.h; sourceTree = ""; }; + 6AC45E0D152413D600C5E259 /* VTHorizontalCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTHorizontalCandidateController.m; sourceTree = ""; }; + 6AC45E0E152413D600C5E259 /* VTHorizontalCandidateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTHorizontalCandidateView.h; sourceTree = ""; }; + 6AC45E0F152413D600C5E259 /* VTHorizontalCandidateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTHorizontalCandidateView.m; sourceTree = ""; }; + 6AC45E10152413D600C5E259 /* VTVerticalCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalCandidateController.h; sourceTree = ""; }; + 6AC45E11152413D600C5E259 /* VTVerticalCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalCandidateController.m; sourceTree = ""; }; + 6AC45E12152413D600C5E259 /* VTVerticalCandidateTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalCandidateTableView.h; sourceTree = ""; }; + 6AC45E13152413D600C5E259 /* VTVerticalCandidateTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalCandidateTableView.m; sourceTree = ""; }; + 6AC45E14152413D600C5E259 /* VTVerticalKeyLabelStripView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalKeyLabelStripView.h; sourceTree = ""; }; + 6AC45E15152413D600C5E259 /* VTVerticalKeyLabelStripView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalKeyLabelStripView.m; sourceTree = ""; }; 6ACF37C213A7BE68008798F2 /* IconMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IconMaker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6ACF37C613A7BE68008798F2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 6ACF37C713A7BE68008798F2 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; @@ -227,6 +245,7 @@ 6A8515A8137277C80066B1BD = { isa = PBXGroup; children = ( + 6AC45E09152413D600C5E259 /* CandidateUI */, 6A43430813727B230094187C /* Data */, 6ABE4FE2137285F900981680 /* Engine */, 6A43430713727B1B0094187C /* Lettuce */, @@ -336,6 +355,25 @@ path = Mandarin; sourceTree = ""; }; + 6AC45E09152413D600C5E259 /* CandidateUI */ = { + isa = PBXGroup; + children = ( + 6AC45E0A152413D600C5E259 /* VTCandidateController.h */, + 6AC45E0B152413D600C5E259 /* VTCandidateController.m */, + 6AC45E0C152413D600C5E259 /* VTHorizontalCandidateController.h */, + 6AC45E0D152413D600C5E259 /* VTHorizontalCandidateController.m */, + 6AC45E0E152413D600C5E259 /* VTHorizontalCandidateView.h */, + 6AC45E0F152413D600C5E259 /* VTHorizontalCandidateView.m */, + 6AC45E10152413D600C5E259 /* VTVerticalCandidateController.h */, + 6AC45E11152413D600C5E259 /* VTVerticalCandidateController.m */, + 6AC45E12152413D600C5E259 /* VTVerticalCandidateTableView.h */, + 6AC45E13152413D600C5E259 /* VTVerticalCandidateTableView.m */, + 6AC45E14152413D600C5E259 /* VTVerticalKeyLabelStripView.h */, + 6AC45E15152413D600C5E259 /* VTVerticalKeyLabelStripView.m */, + ); + path = CandidateUI; + sourceTree = ""; + }; 6ACF37C513A7BE68008798F2 /* Other Frameworks */ = { isa = PBXGroup; children = ( @@ -545,6 +583,12 @@ 6A7157FF13728A5000E39343 /* SimpleLM.cpp in Sources */, 6A42C5E113A5584F0080A121 /* PreferencesWindowController.m in Sources */, 6A89E66713F7637200DDBF09 /* UpdateNotificationController.m in Sources */, + 6AC45E16152413D600C5E259 /* VTCandidateController.m in Sources */, + 6AC45E17152413D600C5E259 /* VTHorizontalCandidateController.m in Sources */, + 6AC45E18152413D600C5E259 /* VTHorizontalCandidateView.m in Sources */, + 6AC45E19152413D600C5E259 /* VTVerticalCandidateController.m in Sources */, + 6AC45E1A152413D600C5E259 /* VTVerticalCandidateTableView.m in Sources */, + 6AC45E1B152413D600C5E259 /* VTVerticalKeyLabelStripView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -668,7 +712,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.5; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = McBopomofo; - SDKROOT = macosx10.6; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64 ppc"; WRAPPER_EXTENSION = app; }; @@ -693,7 +737,7 @@ INFOPLIST_FILE = "McBopomofo-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.5; PRODUCT_NAME = McBopomofo; - SDKROOT = macosx10.6; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64 ppc"; WRAPPER_EXTENSION = app; }; diff --git a/Source/PreferencesWindowController.m b/Source/PreferencesWindowController.m index 3fc49cdf..a2ac5b17 100644 --- a/Source/PreferencesWindowController.m +++ b/Source/PreferencesWindowController.m @@ -43,15 +43,15 @@ // return; // } - NSMenu *menu = [_fontSizePopUpButton menu]; - NSArray *menuItems = [menu itemArray]; - - for (NSMenuItem *item in menuItems) { - NSUInteger tag = [item tag]; - - if (tag != 14 && tag != 24) { - [menu removeItem:item]; - } - } +// NSMenu *menu = [_fontSizePopUpButton menu]; +// NSArray *menuItems = [menu itemArray]; +// +// for (NSMenuItem *item in menuItems) { +// NSUInteger tag = [item tag]; +// +// if (tag != 14 && tag != 24) { +// [menu removeItem:item]; +// } +// } } @end diff --git a/Source/main.m b/Source/main.m index c1a5053b..1b4b57b1 100644 --- a/Source/main.m +++ b/Source/main.m @@ -36,7 +36,6 @@ #import "OVInputSourceHelper.h" static NSString *const kConnectionName = @"McBopomofo_1_Connection"; -IMKCandidates *LTSharedCandidates = nil; int main(int argc, char *argv[]) { @@ -120,14 +119,6 @@ int main(int argc, char *argv[]) return -1; } - LTSharedCandidates = [[IMKCandidates alloc] initWithServer:server panelType:kIMKSingleColumnScrollingCandidatePanel]; - if (!LTSharedCandidates) { - NSLog(@"Fatal error: Cannot initialize shared candidate panel with connection %@.", kConnectionName); - [server release]; - [pool drain]; - return -1; - } - [[NSApplication sharedApplication] run]; [server release]; [pool drain];