Bugfix: fix the contextual menu and drag-n-drop of refs

When the Subject column is not the first column in the git history table the contextual menu for refs and dragging and dropping refs don't work.

Offset the mouse click's x value by the x origin of the Subject column.

In PBRefController look up the column index of the subject column and check that it's the clicked column (don't assume it's the first one).
This commit is contained in:
Nathan Kinsinger
2010-02-19 22:54:25 -07:00
parent cfcbec788a
commit 87f76fd5a1
3 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -61,8 +61,9 @@
int row = [self rowAtPoint:location];
int column = [self columnAtPoint:location];
PBGitRevisionCell *cell = (PBGitRevisionCell *)[self preparedCellAtColumn:column row:row];
NSRect cellFrame = [self frameOfCellAtColumn:column row:row];
int index = [cell indexAtX:location.x];
int index = [cell indexAtX:(location.x - cellFrame.origin.x)];
if (index == -1)
return [super dragImageForRowsWithIndexes:dragRows tableColumns:tableColumns event:dragEvent offset:dragImageOffset];
+1 -1
View File
@@ -283,7 +283,7 @@
if (!contextMenuDelegate)
return [self menu];
int i = [self indexAtX:[view convertPointFromBase:[event locationInWindow]].x];
int i = [self indexAtX:[view convertPointFromBase:[event locationInWindow]].x - rect.origin.x];
if (i < 0)
return [self menu];
+4 -2
View File
@@ -94,12 +94,14 @@
NSPoint location = [tv convertPointFromBase:[(PBCommitList *)tv mouseDownPoint]];
int row = [tv rowAtPoint:location];
int column = [tv columnAtPoint:location];
if (column != 0)
int subjectColumn = [tv columnWithIdentifier:@"SubjectColumn"];
if (column != subjectColumn)
return NO;
PBGitRevisionCell *cell = (PBGitRevisionCell *)[tv preparedCellAtColumn:column row:row];
NSRect cellFrame = [tv frameOfCellAtColumn:column row:row];
int index = [cell indexAtX:location.x];
int index = [cell indexAtX:(location.x - cellFrame.origin.x)];
if (index == -1)
return NO;