Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 83 lines (67 sloc) 2.325 kB
84d929d @pieter Allow scrolling of the webView by pressing space
authored
1 //
2 // PBCommitList.m
3 // GitX
4 //
5 // Created by Pieter de Bie on 9/11/08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "PBCommitList.h"
4cefe8e @pieter HistoryView: Allow dragging of refs to move them
authored
10 #import "PBGitRevisionCell.h"
e02ee52 @pieter WebHistoryController: Move ref deletion to RefController
authored
11 #import "PBWebHistoryController.h"
84d929d @pieter Allow scrolling of the webView by pressing space
authored
12
13 @implementation PBCommitList
14
4cefe8e @pieter HistoryView: Allow dragging of refs to move them
authored
15 @synthesize mouseDownPoint;
16 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL) local
17 {
18 return NSDragOperationCopy;
19 }
20
193b834 @heipei PBCollapsibleSplitView: Enable collapse/uncollapse using keys
heipei authored
21 - (void)keyDown:(NSEvent *)event
84d929d @pieter Allow scrolling of the webView by pressing space
authored
22 {
23 NSString* character = [event charactersIgnoringModifiers];
24
193b834 @heipei PBCollapsibleSplitView: Enable collapse/uncollapse using keys
heipei authored
25 // Pass on command-shift up/down to the responder. We want the splitview to capture this.
26 if ([event modifierFlags] & NSShiftKeyMask && [event modifierFlags] & NSCommandKeyMask && ([event keyCode] == 0x7E || [event keyCode] == 0x7D)) {
27 [self.nextResponder keyDown:event];
28 return;
29 }
30
84d929d @pieter Allow scrolling of the webView by pressing space
authored
31 if ([character isEqualToString:@" "])
32 {
33 if ([event modifierFlags] & NSShiftKeyMask)
34 [webView scrollPageUp: self];
35 else
36 [webView scrollPageDown: self];
37 }
38f16a2 @pieter Allow copy and pasting of web source by pressing 'c'
authored
38 else if ([character rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"jkcv"]].location == 0)
c12e8b9 @d0k Get rid of some unnecessary casts
d0k authored
39 [webController sendKey: character];
84d929d @pieter Allow scrolling of the webView by pressing space
authored
40 else
41 [super keyDown: event];
42 }
43
de9f4dd @pieter HistoryView: Add copy behaviour in commit list
authored
44 - (void) copy:(id)sender
45 {
46 [controller copyCommitInfo];
47 };
48
4cefe8e @pieter HistoryView: Allow dragging of refs to move them
authored
49 - (void)mouseDown:(NSEvent *)theEvent
50 {
51 mouseDownPoint = [[self window] mouseLocationOutsideOfEventStream];
52 [super mouseDown:theEvent];
53 }
54
55 - (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows
56 tableColumns:(NSArray *)tableColumns
57 event:(NSEvent *)dragEvent
58 offset:(NSPointPointer)dragImageOffset
59 {
60 NSPoint location = [self convertPointFromBase:mouseDownPoint];
61 int row = [self rowAtPoint:location];
62 int column = [self columnAtPoint:location];
63 PBGitRevisionCell *cell = (PBGitRevisionCell *)[self preparedCellAtColumn:column row:row];
64
65 int index = [cell indexAtX:location.x];
66 if (index == -1)
67 return [super dragImageForRowsWithIndexes:dragRows tableColumns:tableColumns event:dragEvent offset:dragImageOffset];
68
69 NSRect rect = [cell rectAtIndex:index];
70
71 NSImage *newImage = [[NSImage alloc] initWithSize:NSMakeSize(rect.size.width + 3, rect.size.height + 3)];
72 rect.origin = NSMakePoint(0.5, 0.5);
73
74 [newImage lockFocus];
75 [cell drawLabelAtIndex:index inRect:rect];
76 [newImage unlockFocus];
77
78 *dragImageOffset = NSMakePoint(rect.size.width / 2 + 10, 0);
79 return newImage;
80
81 }
84d929d @pieter Allow scrolling of the webView by pressing space
authored
82 @end
Something went wrong with that request. Please try again.