Use Voltaire for candidate UI; use 10.7 base SDK.

This commit is contained in:
Lukhnos D. Liu 2012-03-28 23:28:42 -07:00
parent 7d5cd8173c
commit 9128ef95b2
5 changed files with 284 additions and 92 deletions

View File

@ -51,12 +51,16 @@
// the latest composing buffer that is updated to the foreground app // the latest composing buffer that is updated to the foreground app
NSMutableString *_composingBuffer; NSMutableString *_composingBuffer;
NSInteger _latestReadingCursor;
// the current text input client; we need to keep this when candidate panel is on // the current text input client; we need to keep this when candidate panel is on
id _currentCandidateClient; id _currentCandidateClient;
// a special deferred client for Terminal.app fix // a special deferred client for Terminal.app fix
id _currentDeferredClient; id _currentDeferredClient;
// currently available candidates
NSMutableArray *_candidates;
} }
@end @end

View File

@ -40,6 +40,8 @@
#import "OVStringHelper.h" #import "OVStringHelper.h"
#import "OVUTF8Helper.h" #import "OVUTF8Helper.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "VTHorizontalCandidateController.h"
#import "VTVerticalCandidateController.h"
// C++ namespace usages // C++ namespace usages
using namespace std; using namespace std;
@ -75,20 +77,24 @@ static NSString *const kChooseCandidateUsingSpaceKey = @"ChooseCandidateUsingSpa
NSMutableDictionary *TLCandidateLearningDictionary = nil; NSMutableDictionary *TLCandidateLearningDictionary = nil;
NSString *TLUserCandidatesDictionaryPath = nil; NSString *TLUserCandidatesDictionaryPath = nil;
VTCandidateController *LTCurrentCandidateController = nil;
// if DEBUG is defined, a DOT file (GraphViz format) will be written to the // if DEBUG is defined, a DOT file (GraphViz format) will be written to the
// specified path everytime the grid is walked // specified path everytime the grid is walked
#if DEBUG #if DEBUG
static NSString *const kGraphVizOutputfile = @"/tmp/lettuce-visualization.dot"; static NSString *const kGraphVizOutputfile = @"/tmp/lettuce-visualization.dot";
#endif #endif
// IMK candidate panel object, created in main()
extern IMKCandidates *LTSharedCandidates;
// shared language model object that stores our phrase-term probability database // shared language model object that stores our phrase-term probability database
SimpleLM LTLanguageModel; SimpleLM LTLanguageModel;
// private methods // private methods
@interface LettuceInputMethodController () @interface LettuceInputMethodController () <VTCandidateControllerDelegate>
+ (VTHorizontalCandidateController *)horizontalCandidateController;
+ (VTVerticalCandidateController *)verticalCandidateController;
- (void)collectCandidates;
- (size_t)actualCandidateCursorIndex; - (size_t)actualCandidateCursorIndex;
- (NSString *)neighborTrigramString; - (NSString *)neighborTrigramString;
@ -120,6 +126,8 @@ public:
[_composingBuffer release]; [_composingBuffer release];
[_candidates release];
// the two client pointers are weak pointers (i.e. we don't retain them) // the two client pointers are weak pointers (i.e. we don't retain them)
// therefore we don't do anything about it // therefore we don't do anything about it
@ -133,6 +141,8 @@ public:
self = [super initWithServer:server delegate:delegate client:client]; self = [super initWithServer:server delegate:delegate client:client];
if (self) { if (self) {
_candidates = [[NSMutableArray alloc] init];
// create the reading buffer // create the reading buffer
_bpmfReadingBuffer = new BopomofoReadingBuffer(BopomofoKeyboardLayout::StandardLayout()); _bpmfReadingBuffer = new BopomofoReadingBuffer(BopomofoKeyboardLayout::StandardLayout());
@ -263,6 +273,10 @@ public:
[self commitComposition:client]; [self commitComposition:client];
_currentDeferredClient = nil; _currentDeferredClient = nil;
_currentCandidateClient = nil; _currentCandidateClient = nil;
LTCurrentCandidateController.delegate = nil;
LTCurrentCandidateController.visible = NO;
[_candidates removeAllObjects];
} }
#pragma mark - IMKServerInput protocol methods #pragma mark - IMKServerInput protocol methods
@ -285,6 +299,8 @@ public:
_builder->clear(); _builder->clear();
_walkedNodes.clear(); _walkedNodes.clear();
[_composingBuffer setString:@""]; [_composingBuffer setString:@""];
LTCurrentCandidateController.visible = NO;
[_candidates removeAllObjects];
} }
// TODO: bug #28 is more likely to live in this method. // 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, // 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 // 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)]; [client setMarkedText:attrString selectionRange:NSMakeRange(cursorIndex, 0) replacementRange:NSMakeRange(NSNotFound, NSNotFound)];
_latestReadingCursor = cursorIndex;
} }
- (void)walk - (void)walk
@ -477,7 +495,7 @@ public:
return YES; return YES;
} }
if (flags & NSNumericPadKeyMask) { 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]; if ([_composingBuffer length]) [self commitComposition:client];
NSString *popedText = [inputText lowercaseString]; NSString *popedText = [inputText lowercaseString];
[client insertText:popedText replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; [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 // see if it's valid BPMF reading
if (_bpmfReadingBuffer->isValidKey((char)charCode)) { if (_bpmfReadingBuffer->isValidKey((char)charCode)) {
_bpmfReadingBuffer->combineKey((char)charCode); _bpmfReadingBuffer->combineKey((char)charCode);
@ -741,70 +859,52 @@ public:
return NO; 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 // returns the candidate
[_candidates removeAllObjects];
NSMutableArray *results = [NSMutableArray array];
size_t cursorIndex = [self actualCandidateCursorIndex]; size_t cursorIndex = [self actualCandidateCursorIndex];
vector<NodeAnchor> nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); vector<NodeAnchor> 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 the nodes, so that longer nodes (representing longer phrases) are placed at the top of the candidate list
sort(nodes.begin(), nodes.end(), NodeAnchorDescendingSorter()); sort(nodes.begin(), nodes.end(), NodeAnchorDescendingSorter());
// then use the C++ trick to retrieve the candidates for each node at/crossing the cursor // then use the C++ trick to retrieve the candidates for each node at/crossing the cursor
for (vector<NodeAnchor>::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) { for (vector<NodeAnchor>::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) {
const vector<KeyValuePair>& candidates = (*ni).node->candidates(); const vector<KeyValuePair>& candidates = (*ni).node->candidates();
for (vector<KeyValuePair>::const_iterator ci = candidates.begin(), ce = candidates.end(); ci != ce; ++ci) { for (vector<KeyValuePair>::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<NodeAnchor> nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex);
for (vector<NodeAnchor>::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) {
const vector<KeyValuePair>& 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<Node*>((*ni).node)->selectCandidateAtIndex(i);
break;
}
}
}
[self walk];
[self updateClientComposingBuffer:_currentCandidateClient];
_currentCandidateClient = nil;
}
#pragma mark - Private methods
- (size_t)actualCandidateCursorIndex - (size_t)actualCandidateCursorIndex
{ {
size_t cursorIndex = _builder->cursorIndex(); size_t cursorIndex = _builder->cursorIndex();
@ -900,38 +1000,45 @@ public:
- (void)_showCandidateWindowUsingVerticalMode:(BOOL)useVerticalMode client:(id)client - (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 // set the candidate panel style
BOOL useHorizontalCandidateList = [[NSUserDefaults standardUserDefaults] boolForKey:kUseHorizontalCandidateListPreferenceKey]; BOOL useHorizontalCandidateList = [[NSUserDefaults standardUserDefaults] boolForKey:kUseHorizontalCandidateListPreferenceKey];
if (useVerticalMode) { if (useVerticalMode) {
[LTSharedCandidates setPanelType:kIMKSingleColumnScrollingCandidatePanel]; LTCurrentCandidateController = [LettuceInputMethodController verticalCandidateController];
} }
else if (useHorizontalCandidateList) { else if (useHorizontalCandidateList) {
[LTSharedCandidates setPanelType:kIMKSingleRowSteppingCandidatePanel]; LTCurrentCandidateController = [LettuceInputMethodController horizontalCandidateController];
} }
else { else {
[LTSharedCandidates setPanelType:kIMKSingleColumnScrollingCandidatePanel]; LTCurrentCandidateController = [LettuceInputMethodController verticalCandidateController];
} }
// set the attributes for the candidate panel (which uses NSAttributedString) // set the attributes for the candidate panel (which uses NSAttributedString)
NSInteger textSize = [[NSUserDefaults standardUserDefaults] integerForKey:kCandidateListTextSizeKey]; NSInteger textSize = [[NSUserDefaults standardUserDefaults] integerForKey:kCandidateListTextSizeKey];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize:textSize], NSFontAttributeName, nil];
[LTSharedCandidates setAttributes:attributes]; LTCurrentCandidateController.keyLabelFont = [NSFont systemFontOfSize:(textSize < 20) ? textSize : 19 + (textSize / 4)];
LTCurrentCandidateController.candidateFont = [NSFont systemFontOfSize:textSize];
[LTSharedCandidates updateCandidates]; LTCurrentCandidateController.CJKCandidateFont = [NSFont systemFontOfSize:textSize];
[LTSharedCandidates show:useVerticalMode ? kIMKLocateCandidatesLeftHint : kIMKLocateCandidatesBelowHint]; 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 // update the composing text, set the client
[self updateClientComposingBuffer:client]; [self updateClientComposingBuffer:client];
_currentCandidateClient = 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 #pragma mark - Misc menu items
@ -966,6 +1073,52 @@ public:
{ {
NSLog(@"%@", TLCandidateLearningDictionary); 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<NodeAnchor> nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex);
for (vector<NodeAnchor>::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) {
const vector<KeyValuePair>& 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<Node*>((*ni).node)->selectCandidateAtIndex(i);
break;
}
}
}
[_candidates removeAllObjects];
[self walk];
[self updateClientComposingBuffer:_currentCandidateClient];
}
@end @end

View File

@ -23,6 +23,12 @@
6A89E66A13F7647D00DDBF09 /* UpdateNotificationController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A89E66913F7647D00DDBF09 /* UpdateNotificationController.xib */; }; 6A89E66A13F7647D00DDBF09 /* UpdateNotificationController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A89E66913F7647D00DDBF09 /* UpdateNotificationController.xib */; };
6ABE50131372864300981680 /* Mandarin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6ABE50111372864300981680 /* Mandarin.cpp */; }; 6ABE50131372864300981680 /* Mandarin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6ABE50111372864300981680 /* Mandarin.cpp */; };
6ABEDAF313F74D9C00A0825A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ABEDAF513F74D9C00A0825A /* Localizable.strings */; }; 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 */; }; 6ACF37C413A7BE68008798F2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A8515B9137277DB0066B1BD /* Cocoa.framework */; };
6ACF37CE13A7BE68008798F2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ACF37CC13A7BE68008798F2 /* InfoPlist.strings */; }; 6ACF37CE13A7BE68008798F2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6ACF37CC13A7BE68008798F2 /* InfoPlist.strings */; };
6ACF37D113A7BE68008798F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ACF37D013A7BE68008798F2 /* main.m */; }; 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 = "<group>"; }; 6ABEDAF013F74D2F00A0825A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
6ABEDAF413F74D9C00A0825A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; }; 6ABEDAF413F74D9C00A0825A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
6ABEDAF613F74DA300A0825A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; }; 6ABEDAF613F74DA300A0825A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
6AC45E0A152413D600C5E259 /* VTCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTCandidateController.h; sourceTree = "<group>"; };
6AC45E0B152413D600C5E259 /* VTCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTCandidateController.m; sourceTree = "<group>"; };
6AC45E0C152413D600C5E259 /* VTHorizontalCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTHorizontalCandidateController.h; sourceTree = "<group>"; };
6AC45E0D152413D600C5E259 /* VTHorizontalCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTHorizontalCandidateController.m; sourceTree = "<group>"; };
6AC45E0E152413D600C5E259 /* VTHorizontalCandidateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTHorizontalCandidateView.h; sourceTree = "<group>"; };
6AC45E0F152413D600C5E259 /* VTHorizontalCandidateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTHorizontalCandidateView.m; sourceTree = "<group>"; };
6AC45E10152413D600C5E259 /* VTVerticalCandidateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalCandidateController.h; sourceTree = "<group>"; };
6AC45E11152413D600C5E259 /* VTVerticalCandidateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalCandidateController.m; sourceTree = "<group>"; };
6AC45E12152413D600C5E259 /* VTVerticalCandidateTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalCandidateTableView.h; sourceTree = "<group>"; };
6AC45E13152413D600C5E259 /* VTVerticalCandidateTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalCandidateTableView.m; sourceTree = "<group>"; };
6AC45E14152413D600C5E259 /* VTVerticalKeyLabelStripView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVerticalKeyLabelStripView.h; sourceTree = "<group>"; };
6AC45E15152413D600C5E259 /* VTVerticalKeyLabelStripView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VTVerticalKeyLabelStripView.m; sourceTree = "<group>"; };
6ACF37C213A7BE68008798F2 /* IconMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IconMaker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 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; }; 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; }; 6ACF37C713A7BE68008798F2 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
@ -227,6 +245,7 @@
6A8515A8137277C80066B1BD = { 6A8515A8137277C80066B1BD = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
6AC45E09152413D600C5E259 /* CandidateUI */,
6A43430813727B230094187C /* Data */, 6A43430813727B230094187C /* Data */,
6ABE4FE2137285F900981680 /* Engine */, 6ABE4FE2137285F900981680 /* Engine */,
6A43430713727B1B0094187C /* Lettuce */, 6A43430713727B1B0094187C /* Lettuce */,
@ -336,6 +355,25 @@
path = Mandarin; path = Mandarin;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
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 = "<group>";
};
6ACF37C513A7BE68008798F2 /* Other Frameworks */ = { 6ACF37C513A7BE68008798F2 /* Other Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -545,6 +583,12 @@
6A7157FF13728A5000E39343 /* SimpleLM.cpp in Sources */, 6A7157FF13728A5000E39343 /* SimpleLM.cpp in Sources */,
6A42C5E113A5584F0080A121 /* PreferencesWindowController.m in Sources */, 6A42C5E113A5584F0080A121 /* PreferencesWindowController.m in Sources */,
6A89E66713F7637200DDBF09 /* UpdateNotificationController.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; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -668,7 +712,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5; MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = McBopomofo; PRODUCT_NAME = McBopomofo;
SDKROOT = macosx10.6; SDKROOT = macosx;
VALID_ARCHS = "i386 x86_64 ppc"; VALID_ARCHS = "i386 x86_64 ppc";
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
}; };
@ -693,7 +737,7 @@
INFOPLIST_FILE = "McBopomofo-Info.plist"; INFOPLIST_FILE = "McBopomofo-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.5; MACOSX_DEPLOYMENT_TARGET = 10.5;
PRODUCT_NAME = McBopomofo; PRODUCT_NAME = McBopomofo;
SDKROOT = macosx10.6; SDKROOT = macosx;
VALID_ARCHS = "i386 x86_64 ppc"; VALID_ARCHS = "i386 x86_64 ppc";
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
}; };

View File

@ -43,15 +43,15 @@
// return; // return;
// } // }
NSMenu *menu = [_fontSizePopUpButton menu]; // NSMenu *menu = [_fontSizePopUpButton menu];
NSArray *menuItems = [menu itemArray]; // NSArray *menuItems = [menu itemArray];
//
for (NSMenuItem *item in menuItems) { // for (NSMenuItem *item in menuItems) {
NSUInteger tag = [item tag]; // NSUInteger tag = [item tag];
//
if (tag != 14 && tag != 24) { // if (tag != 14 && tag != 24) {
[menu removeItem:item]; // [menu removeItem:item];
} // }
} // }
} }
@end @end

View File

@ -36,7 +36,6 @@
#import "OVInputSourceHelper.h" #import "OVInputSourceHelper.h"
static NSString *const kConnectionName = @"McBopomofo_1_Connection"; static NSString *const kConnectionName = @"McBopomofo_1_Connection";
IMKCandidates *LTSharedCandidates = nil;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -120,14 +119,6 @@ int main(int argc, char *argv[])
return -1; 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]; [[NSApplication sharedApplication] run];
[server release]; [server release];
[pool drain]; [pool drain];