Skip to content

Commit

Permalink
convenience method for common procedure of getting event location in …
Browse files Browse the repository at this point in the history
…a view
  • Loading branch information
hofman committed Nov 9, 2011
1 parent 983daa8 commit 7583fd1
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 37 deletions.
5 changes: 5 additions & 0 deletions NSEvent_SKExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ enum {
};

@interface NSEvent (SKExtensions)

+ (NSUInteger)standardModifierFlags;
- (NSUInteger)deviceIndependentModifierFlags;
- (NSUInteger)standardModifierFlags;

- (unichar)firstCharacter;

- (NSPoint)locationInView:(NSView *)view;

@end

@interface NSEvent (SKLeopardGestures)
Expand Down
4 changes: 4 additions & 0 deletions NSEvent_SKExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ - (unichar)firstCharacter {
return [characters length] > 0 ? [characters characterAtIndex:0] : 0;
}

- (NSPoint)locationInView:(NSView *)view {
return [view convertPoint:[self locationInWindow] fromView:nil];
}

@end
4 changes: 2 additions & 2 deletions SKColorSwatch.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ - (void)setKeyboardFocusRingNeedsDisplayInRect:(NSRect)rect {
}

- (void)mouseDown:(NSEvent *)theEvent {
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
NSInteger i = [self colorIndexAtPoint:mouseLoc];

if ([self isEnabled]) {
Expand Down Expand Up @@ -220,7 +220,7 @@ - (void)mouseDown:(NSEvent *)theEvent {
[color drawSwatchInRect:NSInsetRect(rect, 1.0, 1.0)];
[image unlockFocus];

mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
mouseLoc = [theEvent locationInView:self];
mouseLoc.x -= 6.0;
mouseLoc.y -= 6.0;
[self dragImage:image at:mouseLoc offset:NSZeroSize event:theEvent pasteboard:pboard source:self slideBack:YES];
Expand Down
3 changes: 2 additions & 1 deletion SKDragImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This software is Copyright (c) 2005-2011

#import "SKDragImageView.h"
#import "NSMenu_SKExtensions.h"
#import "NSEvent_SKExtensions.h"

@implementation SKDragImageView

Expand Down Expand Up @@ -111,7 +112,7 @@ - (void)mouseDown:(NSEvent *)theEvent {
NSPoint mouseLoc;
while(keepOn){
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
mouseLoc = [theEvent locationInView:self];
isInside = [self mouse:mouseLoc inRect:[self bounds]];
switch ([theEvent type]) {
case NSLeftMouseDragged:
Expand Down
6 changes: 3 additions & 3 deletions SKNoteOutlineView.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ - (void)awakeFromNib {

- (void)resizeRow:(NSInteger)row withEvent:(NSEvent *)theEvent {
id item = [self itemAtRow:row];
NSPoint startPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint startPoint = [theEvent locationInView:self];
CGFloat startHeight = [[self delegate] outlineView:self heightOfRowByItem:item];

[[NSCursor resizeUpDownCursor] push];

while ([theEvent type] != NSLeftMouseUp) {
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
if ([theEvent type] == NSLeftMouseDragged) {
NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint currentPoint = [theEvent locationInView:self];
CGFloat currentHeight = fmax([self rowHeight], startHeight + currentPoint.y - startPoint.y);

[[self delegate] outlineView:self setHeight:currentHeight ofRowByItem:item];
Expand All @@ -77,7 +77,7 @@ - (void)resizeRow:(NSInteger)row withEvent:(NSEvent *)theEvent {

- (void)mouseDown:(NSEvent *)theEvent {
if ([theEvent clickCount] == 1 && [[self delegate] respondsToSelector:@selector(outlineView:canResizeRowByItem:)] && [[self delegate] respondsToSelector:@selector(outlineView:setHeight:ofRowByItem:)]) {
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
NSInteger row = [self rowAtPoint:mouseLoc];

if (row != -1 && [[self delegate] outlineView:self canResizeRowByItem:[self itemAtRow:row]]) {
Expand Down
40 changes: 20 additions & 20 deletions SKPDFView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ - (void)mouseDown:(NSEvent *)theEvent{
[self doPdfsyncWithEvent:theEvent];
} else {
PDFAreaOfInterest area = [self areaOfInterestForMouse:theEvent];
NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint p = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:p nearest:YES];
p = [self convertPoint:p toPage:page];
BOOL hitAnnotation = NO;
Expand Down Expand Up @@ -1354,7 +1354,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)theEvent {

[menu insertItem:[NSMenuItem separatorItem] atIndex:0];

NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint point = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:point nearest:YES];
PDFAnnotation *annotation = nil;

Expand Down Expand Up @@ -1493,7 +1493,7 @@ - (void)rotatePageAtIndex:(NSUInteger)idx by:(NSInteger)rotation {
- (void)beginGestureWithEvent:(NSEvent *)theEvent {
if ([[SKPDFView superclass] instancesRespondToSelector:_cmd])
[super beginGestureWithEvent:theEvent];
PDFPage *page = [self pageForPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil] nearest:YES];
PDFPage *page = [self pageForPoint:[theEvent locationInView:self] nearest:YES];
gestureRotation = 0.0;
gesturePageIndex = [(page ?: [self currentPage]) pageIndex];
}
Expand Down Expand Up @@ -2934,7 +2934,7 @@ - (void)doMoveAnnotationWithEvent:(NSEvent *)theEvent offset:(NSPoint)offset {
// Move annotation.
[[self documentView] autoscroll:theEvent];

NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
PDFPage *newActivePage = [self pageForPoint:mouseLoc nearest:YES];

if (newActivePage) { // newActivePage should never be nil, but just to be sure
Expand All @@ -2957,7 +2957,7 @@ - (void)doMoveAnnotationWithEvent:(NSEvent *)theEvent offset:(NSPoint)offset {
- (void)doResizeLineAnnotationWithEvent:(NSEvent *)theEvent fromPoint:(NSPoint)originalPagePoint originalStartPoint:(NSPoint)originalStartPoint originalEndPoint:(NSPoint)originalEndPoint resizeHandle:(SKRectEdges)resizeHandle {
PDFPage *page = [activeAnnotation page];
NSRect pageBounds = [page boundsForBox:[self displayBox]];
NSPoint currentPagePoint = [self convertPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil] toPage:page];
NSPoint currentPagePoint = [self convertPoint:[theEvent locationInView:self] toPage:page];
NSPoint relPoint = SKSubstractPoints(currentPagePoint, originalPagePoint);
NSPoint endPoint = originalEndPoint;
NSPoint startPoint = originalStartPoint;
Expand Down Expand Up @@ -3004,7 +3004,7 @@ - (void)doResizeAnnotationWithEvent:(NSEvent *)theEvent fromPoint:(NSPoint)origi
PDFPage *page = [activeAnnotation page];
NSRect newBounds = originalBounds;
NSRect pageBounds = [page boundsForBox:[self displayBox]];
NSPoint currentPagePoint = [self convertPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil] toPage:page];
NSPoint currentPagePoint = [self convertPoint:[theEvent locationInView:self] toPage:page];
NSPoint relPoint = SKSubstractPoints(currentPagePoint, originalPagePoint);

if (NSEqualSizes(originalBounds.size, NSZeroSize)) {
Expand Down Expand Up @@ -3112,7 +3112,7 @@ - (void)doDragAnnotationWithEvent:(NSEvent *)theEvent {
// Old (current) annotation location and click point relative to it
NSRect originalBounds = [activeAnnotation bounds];
BOOL isLine = [[activeAnnotation type] isEqualToString:SKNLineString];
NSPoint mouseDownLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseDownLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseDownLoc nearest:YES];
NSPoint pagePoint = [self convertPoint:mouseDownLoc toPage:page];

Expand Down Expand Up @@ -3182,7 +3182,7 @@ - (void)doSelectLinkAnnotationWithEvent:(NSEvent *)theEvent {
while (YES) {
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];

p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
p = [theEvent locationInView:self];
page = [self pageForPoint:p nearest:NO];

if (page == annotationPage && NSPointInRect([self convertPoint:p toPage:page], bounds))
Expand All @@ -3205,7 +3205,7 @@ - (BOOL)doSelectAnnotationWithEvent:(NSEvent *)theEvent hitAnnotation:(BOOL *)hi
PDFPage *page;

// Mouse in display view coordinates.
NSPoint mouseDownOnPage = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseDownOnPage = [theEvent locationInView:self];
BOOL mouseDownInAnnotation = NO;
BOOL isInk = toolMode == SKNoteToolMode && annotationMode == SKInkNote;

Expand Down Expand Up @@ -3314,7 +3314,7 @@ - (BOOL)doSelectAnnotationWithEvent:(NSEvent *)theEvent hitAnnotation:(BOOL *)hi
}

- (void)doDrawFreehandNoteWithEvent:(NSEvent *)theEvent {
NSPoint mouseDownLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseDownLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseDownLoc nearest:YES];
BOOL didDraw = NO;

Expand Down Expand Up @@ -3345,7 +3345,7 @@ - (void)doDrawFreehandNoteWithEvent:(NSEvent *)theEvent {
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
if ([theEvent type] == NSLeftMouseUp)
break;
[bezierPath lineToPoint:[self convertPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil] toPage:page]];
[bezierPath lineToPoint:[self convertPoint:[theEvent locationInView:self] toPage:page]];
[self setNeedsDisplayInRect:[self convertRect:NSInsetRect([bezierPath nonEmptyBounds], -8.0, -8.0) fromPage:page]];
didDraw = YES;
}
Expand Down Expand Up @@ -3413,7 +3413,7 @@ - (void)doDragWithEvent:(NSEvent *)theEvent {
}

- (void)doSelectWithEvent:(NSEvent *)theEvent {
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];

PDFPage *page = [self pageForPoint:mouseLoc nearest:NO];
if (page == nil) {
Expand Down Expand Up @@ -3465,7 +3465,7 @@ - (void)doSelectWithEvent:(NSEvent *)theEvent {
NSRect newRect = initialRect;
NSPoint delta;

newPoint = [self convertPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil] toPage:page];
newPoint = [self convertPoint:[theEvent locationInView:self] toPage:page];
delta = SKSubstractPoints(newPoint, initialPoint);

if (resizeHandle == 0) {
Expand Down Expand Up @@ -3597,7 +3597,7 @@ - (void)doSelectTextWithEvent:(NSEvent *)theEvent {
[self setCurrentSelection:nil];
} else if ([theEvent clickCount] > 1) {
extendSelection = YES;
NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint p = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:p nearest:YES];
p = [self convertPoint:p toPage:page];
if ([theEvent clickCount] == 2)
Expand All @@ -3611,7 +3611,7 @@ - (void)doSelectTextWithEvent:(NSEvent *)theEvent {
extendSelection = YES;
if ([[self currentSelection] hasCharacters])
wasSelection = [[self currentSelection] retain];
NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint p = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:p nearest:YES];
p = [self convertPoint:p toPage:page];
[self setCurrentSelection:[[self document] selectionByExtendingSelection:wasSelection toPage:page atPoint:p]];
Expand All @@ -3635,7 +3635,7 @@ - (void)doSelectTextWithEvent:(NSEvent *)theEvent {
PDFPage *page1 = [self pageForPoint:p1 nearest:YES];
p1 = [self convertPoint:p1 toPage:page1];

NSPoint p2 = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint p2 = [theEvent locationInView:self];
PDFPage *page2 = [self pageForPoint:p2 nearest:YES];
p2 = [self convertPoint:p2 toPage:page2];

Expand Down Expand Up @@ -3676,7 +3676,7 @@ - (void)doDragReadingBarWithEvent:(NSEvent *)theEvent {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:page, SKPDFViewOldPageKey, nil];

NSEvent *lastMouseEvent = theEvent;
NSPoint lastMouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint lastMouseLoc = [theEvent locationInView:self];
NSPoint point = [self convertPoint:lastMouseLoc toPage:page];
NSInteger lineOffset = SKIndexOfRectAtYInOrderedRects(point.y, lineRects, YES) - [readingBar currentLine];
NSDate *lastPageChangeDate = [NSDate distantPast];
Expand Down Expand Up @@ -3770,7 +3770,7 @@ - (void)doResizeReadingBarWithEvent:(NSEvent *)theEvent {
break;

// dragging
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
if ([[self pageForPoint:mouseLoc nearest:YES] isEqual:page] == NO)
continue;

Expand Down Expand Up @@ -4056,7 +4056,7 @@ - (void)doPdfsyncWithEvent:(NSEvent *)theEvent {

if ([document respondsToSelector:@selector(synchronizer)]) {

NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
NSPoint location = [self convertPoint:mouseLoc toPage:page];
NSUInteger pageIndex = [page pageIndex];
Expand Down Expand Up @@ -4114,7 +4114,7 @@ - (NSCursor *)cursorForResizeHandle:(SKRectEdges)mask rotation:(NSInteger)rotati
}

- (NSCursor *)getCursorForEvent:(NSEvent *)theEvent {
NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint p = [theEvent locationInView:self];
NSCursor *cursor = nil;

if ([[self document] isLocked]) {
Expand Down
6 changes: 3 additions & 3 deletions SKSecondaryPDFView.m
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ - (void)mouseDown:(NSEvent *)theEvent{
[NSCursor pop];
[self performSelector:@selector(mouseMoved:) withObject:lastEvent afterDelay:0];

NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
NSPoint location = [self convertPoint:mouseLoc toPage:page];
[synchronizedPDFView goToDestination:[[[PDFDestination alloc] initWithPage:page atPoint:location] autorelease]];
Expand All @@ -576,7 +576,7 @@ - (void)mouseDown:(NSEvent *)theEvent{

if ([document respondsToSelector:@selector(synchronizer)]) {

NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
NSPoint location = [self convertPoint:mouseLoc toPage:page];
NSUInteger pageIndex = [page pageIndex];
Expand All @@ -597,7 +597,7 @@ - (void)mouseUp:(NSEvent *)theEvent{

- (void)mouseMoved:(NSEvent *)theEvent {
NSView *view = [self documentView];
NSPoint mouseLoc = [view convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:view];
if (NSMouseInRect(mouseLoc, [view visibleRect], [view isFlipped]))
[[NSCursor openHandCursor] set];
else
Expand Down
2 changes: 1 addition & 1 deletion SKSideWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ - (void)drawRect:(NSRect)aRect {
}

- (void)mouseDown:(NSEvent *)theEvent {
if (NSMouseInRect([self convertPoint:[theEvent locationInWindow] fromView:nil], [self resizeHandleRect], [self isFlipped]))
if (NSMouseInRect([theEvent locationInView:self], [self resizeHandleRect], [self isFlipped]))
[(SKSideWindow *)[self window] resizeWithEvent:theEvent];
else
[super mouseDown:theEvent];
Expand Down
4 changes: 2 additions & 2 deletions SKSnapshotPDFView.m
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ - (void)mouseDown:(NSEvent *)theEvent{

if ([document respondsToSelector:@selector(synchronizer)]) {

NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
PDFPage *page = [self pageForPoint:mouseLoc nearest:YES];
NSPoint location = [self convertPoint:mouseLoc toPage:page];
NSUInteger pageIndex = [page pageIndex];
Expand All @@ -448,7 +448,7 @@ - (void)mouseDown:(NSEvent *)theEvent{
- (void)mouseUp:(NSEvent *)theEvent{
[NSCursor pop];
NSView *view = [self documentView];
NSPoint mouseLoc = [view convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:view];
if (NSMouseInRect(mouseLoc, [view visibleRect], [view isFlipped]))
[[NSCursor openHandCursor] set];
else
Expand Down
7 changes: 4 additions & 3 deletions SKStatusBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ This software is Copyright (c) 2007-2011
#import "SKStatusBar.h"
#import "NSGeometry_SKExtensions.h"
#import "SKStringConstants.h"
#import "NSEvent_SKExtensions.h"

#define LEFT_MARGIN 5.0
#define RIGHT_MARGIN 15.0
Expand Down Expand Up @@ -237,21 +238,21 @@ - (void)toggleBelowView:(NSView *)view animate:(BOOL)animate {
}

- (void)mouseDown:(NSEvent *)theEvent {
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSPoint mouseLoc = [theEvent locationInView:self];
NSRect leftRect, rightRect;
[self getLeftFrame:&leftRect rightFrame:&rightRect];
if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped]) && [rightCell action]) {
while ([theEvent type] != NSLeftMouseUp)
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseDraggedMask | NSLeftMouseUpMask];
mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
mouseLoc = [theEvent locationInView:self];
if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped])) {
[rightCell setNextState];
[NSApp sendAction:[rightCell action] to:[rightCell target] from:self];
}
} else if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped]) && [leftCell action]) {
while ([theEvent type] != NSLeftMouseUp)
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseDraggedMask | NSLeftMouseUpMask];
mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
mouseLoc = [theEvent locationInView:self];
if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped])) {
[leftCell setNextState];
[NSApp sendAction:[leftCell action] to:[leftCell target] from:self];
Expand Down
3 changes: 2 additions & 1 deletion SKTextWithIconCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ This software is Copyright (c) 2007-2011
#import "SKTextWithIconCell.h"
#import "NSImage_SKExtensions.h"
#import "NSGeometry_SKExtensions.h"
#import "NSEvent_SKExtensions.h"

NSString *SKTextWithIconCellStringKey = @"string";
NSString *SKTextWithIconCellImageKey = @"image";
Expand Down Expand Up @@ -153,7 +154,7 @@ - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSTex

- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView {
NSRect textRect = [self textRectForBounds:cellFrame];
NSPoint mouseLoc = [controlView convertPoint:[event locationInWindow] fromView:nil];
NSPoint mouseLoc = [event locationInView:controlView];
NSUInteger hit = NSCellHitNone;
if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
hit = [super hitTestForEvent:event inRect:textRect ofView:controlView];
Expand Down
3 changes: 2 additions & 1 deletion SKThumbnailTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ This software is Copyright (c) 2007-2011
#import "SKThumbnailTableView.h"
#import "SKTypeSelectHelper.h"
#import "NSColor_SKExtensions.h"
#import "NSEvent_SKExtensions.h"

#define SKScrollerWillScrollNotification @"SKScrollerWillScrollNotification"
#define SKScrollerDidScrollNotification @"SKScrollerDidScrollNotification"
Expand Down Expand Up @@ -156,7 +157,7 @@ - (void)setFrameSize:(NSSize)frameSize {

- (void)mouseDown:(NSEvent *)theEvent {
if (([theEvent modifierFlags] & NSCommandKeyMask) && [[self delegate] respondsToSelector:@selector(tableView:commandSelectRow:)]) {
NSInteger row = [self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]];
NSInteger row = [self rowAtPoint:[theEvent locationInView:self]];
if (row != -1 && [[self delegate] tableView:self commandSelectRow:row])
return;
}
Expand Down

0 comments on commit 7583fd1

Please sign in to comment.