mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Refactor and rename graph code
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
F56526240E03D85900F03B52 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56526230E03D85900F03B52 /* WebKit.framework */; };
|
||||
F565262B0E03D89B00F03B52 /* PBWebGitController.m in Sources */ = {isa = PBXBuildFile; fileRef = F565262A0E03D89B00F03B52 /* PBWebGitController.m */; };
|
||||
F565265A0E03E71B00F03B52 /* commit.html in Resources */ = {isa = PBXBuildFile; fileRef = F56526590E03E71B00F03B52 /* commit.html */; };
|
||||
F56CC7290E65E0AD004307B4 /* PBLine.m in Sources */ = {isa = PBXBuildFile; fileRef = F56CC7280E65E0AD004307B4 /* PBLine.m */; };
|
||||
F56CC7290E65E0AD004307B4 /* PBGitGraphLine.m in Sources */ = {isa = PBXBuildFile; fileRef = F56CC7280E65E0AD004307B4 /* PBGitGraphLine.m */; };
|
||||
F56CC7320E65E0E5004307B4 /* PBGraphCellInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = F56CC7310E65E0E5004307B4 /* PBGraphCellInfo.m */; };
|
||||
F57ABE0B0E0442DD00A088B8 /* commit.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABDDE0E0441DE00A088B8 /* commit.js */; };
|
||||
F57ABE2B0E04435100A088B8 /* prototype.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABE180E04431D00A088B8 /* prototype.js */; };
|
||||
@@ -92,8 +92,8 @@
|
||||
F56526290E03D89B00F03B52 /* PBWebGitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBWebGitController.h; sourceTree = "<group>"; };
|
||||
F565262A0E03D89B00F03B52 /* PBWebGitController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebGitController.m; sourceTree = "<group>"; };
|
||||
F56526590E03E71B00F03B52 /* commit.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = commit.html; path = html/commit.html; sourceTree = "<group>"; };
|
||||
F56CC7270E65E0AD004307B4 /* PBLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBLine.h; sourceTree = "<group>"; };
|
||||
F56CC7280E65E0AD004307B4 /* PBLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBLine.m; sourceTree = "<group>"; };
|
||||
F56CC7270E65E0AD004307B4 /* PBGitGraphLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitGraphLine.h; sourceTree = "<group>"; };
|
||||
F56CC7280E65E0AD004307B4 /* PBGitGraphLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitGraphLine.m; sourceTree = "<group>"; };
|
||||
F56CC7300E65E0E5004307B4 /* PBGraphCellInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGraphCellInfo.h; sourceTree = "<group>"; };
|
||||
F56CC7310E65E0E5004307B4 /* PBGraphCellInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGraphCellInfo.m; sourceTree = "<group>"; };
|
||||
F57ABDDE0E0441DE00A088B8 /* commit.js */ = {isa = PBXFileReference; explicitFileType = sourcecode.javascript; fileEncoding = 4; name = commit.js; path = html/commit.js; sourceTree = "<group>"; };
|
||||
@@ -238,8 +238,7 @@
|
||||
F56174540E05887E001DCD79 /* Git */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F56CC7300E65E0E5004307B4 /* PBGraphCellInfo.h */,
|
||||
F56CC7310E65E0E5004307B4 /* PBGraphCellInfo.m */,
|
||||
F5C6F6750E65FE2B00478D97 /* Graphing */,
|
||||
F5FF4E780E082E440006317A /* PBGitGrapher.h */,
|
||||
F5FF4E790E082E440006317A /* PBGitGrapher.m */,
|
||||
F5945E150E02B0C200706420 /* PBGitRepository.h */,
|
||||
@@ -283,10 +282,6 @@
|
||||
F53EE3590E06BBA00022B925 /* CWQuickLook.h */,
|
||||
F51308590E0740F2000C8BCD /* PBQLOutlineView.h */,
|
||||
F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */,
|
||||
F50FE0E10E07BE9600854FCD /* PBGitRevisionCell.h */,
|
||||
F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */,
|
||||
F56CC7270E65E0AD004307B4 /* PBLine.h */,
|
||||
F56CC7280E65E0AD004307B4 /* PBLine.m */,
|
||||
);
|
||||
name = Aux;
|
||||
sourceTree = "<group>";
|
||||
@@ -304,6 +299,19 @@
|
||||
name = HTML;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F5C6F6750E65FE2B00478D97 /* Graphing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F50FE0E10E07BE9600854FCD /* PBGitRevisionCell.h */,
|
||||
F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */,
|
||||
F56CC7270E65E0AD004307B4 /* PBGitGraphLine.h */,
|
||||
F56CC7280E65E0AD004307B4 /* PBGitGraphLine.m */,
|
||||
F56CC7300E65E0E5004307B4 /* PBGraphCellInfo.h */,
|
||||
F56CC7310E65E0E5004307B4 /* PBGraphCellInfo.m */,
|
||||
);
|
||||
name = Graphing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -403,7 +411,7 @@
|
||||
F5FF4E7A0E082E440006317A /* PBGitGrapher.m in Sources */,
|
||||
911111F80E594F3F00BF76B4 /* PBRepositoryDocumentController.m in Sources */,
|
||||
913D5E5F0E556A9300CECEA2 /* PBCLIProxy.mm in Sources */,
|
||||
F56CC7290E65E0AD004307B4 /* PBLine.m in Sources */,
|
||||
F56CC7290E65E0AD004307B4 /* PBGitGraphLine.m in Sources */,
|
||||
F56CC7320E65E0E5004307B4 /* PBGraphCellInfo.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface PBLine : NSObject
|
||||
@interface PBGitGraphLine : NSObject
|
||||
{
|
||||
int upper;
|
||||
int from;
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
@property(readonly) int upper, from, to;
|
||||
- (id)initWithUpper: (int) u From: (int) f to: (int) t;
|
||||
+ (PBLine*) lowerLineFrom:(int) f to: (int) t;
|
||||
+ (PBLine*) upperLineFrom:(int) f to: (int) t;
|
||||
+ (PBGitGraphLine*) lowerLineFrom:(int) f to: (int) t;
|
||||
+ (PBGitGraphLine*) upperLineFrom:(int) f to: (int) t;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// PBLine.m
|
||||
// GitX
|
||||
//
|
||||
// Created by Pieter de Bie on 27-08-08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PBGitGraphLine.h"
|
||||
|
||||
|
||||
@implementation PBGitGraphLine
|
||||
@synthesize upper, from, to;
|
||||
- (id)initWithUpper: (int) u From: (int) f to: (int) t;
|
||||
{
|
||||
upper = u;
|
||||
from = f;
|
||||
to = t;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (PBGitGraphLine*) lowerLineFrom:(int) f to: (int) t
|
||||
{
|
||||
return [[PBGitGraphLine alloc] initWithUpper:0 From:f to:t];
|
||||
}
|
||||
|
||||
+ (PBGitGraphLine*) upperLineFrom:(int) f to: (int) t
|
||||
{
|
||||
return [[PBGitGraphLine alloc] initWithUpper:1 From:f to:t];
|
||||
}
|
||||
@end
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBGitCommit.h"
|
||||
#import "PBLine.h"
|
||||
#import "PBGitGraphLine.h"
|
||||
#import "PBGraphCellInfo.h"
|
||||
|
||||
struct PBGitGraphColumn {
|
||||
|
||||
+8
-8
@@ -40,7 +40,7 @@
|
||||
[currentLanes addObject: [commit.parents objectAtIndex:0]];
|
||||
newPos = [currentLanes count];
|
||||
}
|
||||
[lines addObject: [PBLine upperLineFrom: i to: newPos]];
|
||||
[lines addObject: [PBGitGraphLine upperLineFrom: i to: newPos]];
|
||||
}
|
||||
else {
|
||||
// We are not this commit.
|
||||
@@ -54,7 +54,7 @@
|
||||
continue;
|
||||
if ([column isEqualToString: lane]) {
|
||||
// We already have a column for this commit. use it instead
|
||||
[lines addObject: [PBLine upperLineFrom: i to: j]];
|
||||
[lines addObject: [PBGitGraphLine upperLineFrom: i to: j]];
|
||||
found = YES;
|
||||
break;
|
||||
}
|
||||
@@ -68,13 +68,13 @@
|
||||
// continue;
|
||||
|
||||
[currentLanes addObject: lane];
|
||||
[lines addObject: [PBLine upperLineFrom: [currentLanes count] to: [currentLanes count]]];
|
||||
[lines addObject: [PBLine lowerLineFrom: [currentLanes count] to: [currentLanes count]]];
|
||||
[lines addObject: [PBGitGraphLine upperLineFrom: [currentLanes count] to: [currentLanes count]]];
|
||||
[lines addObject: [PBGitGraphLine lowerLineFrom: [currentLanes count] to: [currentLanes count]]];
|
||||
}
|
||||
}
|
||||
// For existing columns, we always just continue straight down
|
||||
// ^^ I don't know what that means anymore :(
|
||||
[lines addObject:[PBLine lowerLineFrom:newPos to:newPos]];
|
||||
[lines addObject:[PBGitGraphLine lowerLineFrom:newPos to:newPos]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
if (!didFirst) {
|
||||
[currentLanes addObject: [commit.parents objectAtIndex:0]];
|
||||
newPos = [currentLanes count];
|
||||
[lines addObject:[PBLine lowerLineFrom: newPos to: newPos]];
|
||||
[lines addObject:[PBGitGraphLine lowerLineFrom: newPos to: newPos]];
|
||||
}
|
||||
|
||||
// Add all other parents
|
||||
@@ -99,7 +99,7 @@
|
||||
for (NSString* column in currentLanes) {
|
||||
i++;
|
||||
if ([column isEqualToString: parent]) {
|
||||
[lines addObject:[PBLine lowerLineFrom: i to: newPos]];
|
||||
[lines addObject:[PBGitGraphLine lowerLineFrom: i to: newPos]];
|
||||
was_displayed = YES;
|
||||
break;
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
// Really add this parent
|
||||
addedParent = YES;
|
||||
[currentLanes addObject:parent];
|
||||
[lines addObject:[PBLine lowerLineFrom: [currentLanes count] to: newPos]];
|
||||
[lines addObject:[PBGitGraphLine lowerLineFrom: [currentLanes count] to: newPos]];
|
||||
}
|
||||
|
||||
++row;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@
|
||||
NSRect ownRect;
|
||||
NSDivideRect(rect, &ownRect, &rect, pathWidth, NSMinXEdge);
|
||||
|
||||
for (PBLine* line in cellInfo.lines) {
|
||||
for (PBGitGraphLine* line in cellInfo.lines) {
|
||||
if (line.upper == 0)
|
||||
[self drawLineFromColumn: line.from toColumn: line.to inRect:ownRect offset: ownRect.size.height];
|
||||
else
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// PBLine.m
|
||||
// GitX
|
||||
//
|
||||
// Created by Pieter de Bie on 27-08-08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PBLine.h"
|
||||
|
||||
|
||||
@implementation PBLine
|
||||
@synthesize upper, from, to;
|
||||
- (id)initWithUpper: (int) u From: (int) f to: (int) t;
|
||||
{
|
||||
upper = u;
|
||||
from = f;
|
||||
to = t;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (PBLine*) lowerLineFrom:(int) f to: (int) t
|
||||
{
|
||||
return [[PBLine alloc] initWithUpper:0 From:f to:t];
|
||||
}
|
||||
|
||||
+ (PBLine*) upperLineFrom:(int) f to: (int) t
|
||||
{
|
||||
return [[PBLine alloc] initWithUpper:1 From:f to:t];
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user