File tree 8 files changed +134
-83
lines changed
8 files changed +134
-83
lines changed Original file line number Diff line number Diff line change 207
207
F5EF8C8D0E9D4A5D0050906B /* PBWebController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebController.m; sourceTree = "<group>"; };
208
208
F5FC41F20EBCBD4300191D80 /* PBGitXProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitXProtocol.h; sourceTree = "<group>"; };
209
209
F5FC41F30EBCBD4300191D80 /* PBGitXProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitXProtocol.m; sourceTree = "<group>"; };
210
+ F5FC43C30EBD050800191D80 /* PBRefContextDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBRefContextDelegate.h; sourceTree = "<group>"; };
210
211
F5FE6C010EB13BC900F30D12 /* PBServicesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBServicesController.h; sourceTree = "<group>"; };
211
212
F5FE6C020EB13BC900F30D12 /* PBServicesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBServicesController.m; sourceTree = "<group>"; };
212
213
F5FF4E160E0829C20006317A /* PBGitRevList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevList.h; sourceTree = "<group>"; };
469
470
F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */,
470
471
F56174550E058893001DCD79 /* PBGitTree.h */,
471
472
F56174560E058893001DCD79 /* PBGitTree.m */,
473
+ F5FC43C30EBD050800191D80 /* PBRefContextDelegate.h */,
472
474
);
473
475
name = History;
474
476
sourceTree = "<group>";
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 10
10
#import " PBGitGrapher.h"
11
11
#import " PBGraphCellInfo.h"
12
12
#import " PBGitHistoryController.h"
13
+ #import " PBRefContextDelegate.h"
13
14
14
15
@interface PBGitRevisionCell : NSActionCell {
15
16
id objectValue;
16
17
PBGraphCellInfo *cellInfo;
17
18
NSTextFieldCell *textCell;
18
19
IBOutlet PBGitHistoryController *controller;
20
+ IBOutlet id <PBRefContextDelegate> contextMenuDelegate;
19
21
}
20
22
21
23
- (int ) indexAtX : (float )x ;
Original file line number Diff line number Diff line change @@ -278,4 +278,27 @@ - (NSRect) rectAtIndex:(int)index
278
278
return [[[self rectsForRefsinRect: refRect] objectAtIndex: index ] rectValue ];
279
279
}
280
280
281
+ # pragma mark context menu delegate methods
282
+
283
+ - (NSMenu *) menuForEvent : (NSEvent *)event inRect : (NSRect )rect ofView : (NSView *)view
284
+ {
285
+ if (!contextMenuDelegate)
286
+ return [self menu ];
287
+
288
+ int i = [self indexAtX: [view convertPointFromBase: [event locationInWindow ]].x];
289
+ if (i < 0 )
290
+ return [self menu ];
291
+
292
+ id ref = [[[self objectValue ] refs ] objectAtIndex: i];
293
+ if (!ref)
294
+ return [self menu ];
295
+
296
+ NSArray *items = [contextMenuDelegate menuItemsForRef: ref commit: [self objectValue ]];
297
+ NSMenu *menu = [[NSMenu alloc ] init ];
298
+ for (NSMenuItem *item in items)
299
+ [menu addItem: item];
300
+ return menu;
301
+
302
+ return [self menu ];
303
+ }
281
304
@end
Original file line number Diff line number Diff line change
1
+ //
2
+ // PBRefContextDelegate.m
3
+ // GitX
4
+ //
5
+ // Created by Pieter de Bie on 01-11-08.
6
+ // Copyright 2008 Pieter de Bie. All rights reserved.
7
+ //
8
+
9
+
10
+
11
+ @protocol PBRefContextDelegate
12
+ - (NSArray *) menuItemsForRef : (PBGitRef *)ref commit : (PBGitCommit *)commit ;
13
+ @end
Original file line number Diff line number Diff line change 11
11
#import " PBCommitList.h"
12
12
#import " PBGitRef.h"
13
13
#import " PBGitCommit.h"
14
+ #import " PBRefContextDelegate.h"
14
15
15
- @interface PBRefController : NSObject {
16
+ @interface PBRefController : NSObject <PBRefContextDelegate> {
16
17
IBOutlet __weak PBGitHistoryController *historyController;
17
18
IBOutlet NSArrayController *commitController;
18
19
IBOutlet PBCommitList *commitList;
Original file line number Diff line number Diff line change 11
11
12
12
#import " PBGitCommit.h"
13
13
#import " PBGitHistoryController.h"
14
- #import " PBRefController .h"
14
+ #import " PBRefContextDelegate .h"
15
15
16
16
@interface PBWebHistoryController : PBWebController {
17
17
IBOutlet PBGitHistoryController* historyController;
18
- IBOutlet PBRefController *refController ;
18
+ IBOutlet id <PBRefContextDelegate> contextMenuDelegate ;
19
19
20
20
NSString * currentSha;
21
21
NSString * diff;
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ - (NSArray *) webView:(WebView *)sender
86
86
for (PBGitRef *ref in historyController.webCommit .refs )
87
87
{
88
88
if ([[ref shortName ] isEqualToString: selectedRefString])
89
- return [refController menuItemsForRef: ref commit: historyController.webCommit];
89
+ return [contextMenuDelegate menuItemsForRef: ref commit: historyController.webCommit];
90
90
}
91
91
NSLog (@" Could not find selected ref!" );
92
92
You can’t perform that action at this time.
0 commit comments