diff --git a/ChangeLog b/ChangeLog index 19d373b48..f0c4e95f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-07 Eric Wasylishen + + * Source/GSCharacterPanel.m: Double click inserts character into + main window + 2011-07-07 Eric Wasylishen * Source/GSCharacterPanel.m (-characterForRow:): Fix off-by-1 error diff --git a/Source/GSCharacterPanel.m b/Source/GSCharacterPanel.m index fda0d2dae..09f81d263 100644 --- a/Source/GSCharacterPanel.m +++ b/Source/GSCharacterPanel.m @@ -31,6 +31,7 @@ #import #import #import +#import "AppKit/NSApplication.h" #import "AppKit/NSStringDrawing.h" #import "AppKit/NSPasteboard.h" #import "AppKit/NSTableView.h" @@ -186,6 +187,8 @@ static NSIndexSet *CodepointsWithNameContainingSubstring(NSString *str) [table setRowHeight: 32]; [table setDataSource: self]; [table setDelegate: self]; + [table setTarget: self]; + [table setDoubleAction: @selector(doubleClickRow:)]; // Allow dragging out of the application [table setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO]; @@ -273,6 +276,20 @@ static NSIndexSet *CodepointsWithNameContainingSubstring(NSString *str) return @""; } +- (void) doubleClickRow: (id)sender +{ + NSWindow *mainWindow = [NSApp mainWindow]; + NSResponder *firstResponder = [mainWindow firstResponder]; + NSString *str = [self characterForRow: [table clickedRow]]; + + [firstResponder insertText: str]; +} + +- (BOOL) tableView: (NSTableView *)aTable shouldEditTableColumn: (NSTableColumn *)aColumn row: (NSInteger)row +{ + return NO; +} + // NSTableViewDataSource protocol - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView