Double-clicking the icon in the table view will reveal the download.
This commit is contained in:
parent
218ddd0cb9
commit
f4562e3bbd
|
@ -23,6 +23,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "TorrentCell.h"
|
||||
#import "TorrentTableView.h"
|
||||
#import "StringAdditions.h"
|
||||
|
||||
#define BAR_HEIGHT 12
|
||||
|
@ -269,7 +270,7 @@ static uint32_t kGreen[] =
|
|||
pen.x -= extraNameShift;
|
||||
pen.y += [progressString size].height + linePadding;
|
||||
|
||||
float barWidth = mainWidth + extraNameShift - 42.0 + padding;
|
||||
float barWidth = mainWidth + extraNameShift - BUTTONS_TOTAL_WIDTH + padding;
|
||||
|
||||
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes: nil pixelsWide: barWidth
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import <transmission.h>
|
||||
|
||||
#define BUTTONS_TOTAL_WIDTH 42.0
|
||||
|
||||
@class Controller;
|
||||
|
||||
@interface TorrentTableView : NSTableView
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
|
||||
#define BUTTON_WIDTH 14.0
|
||||
#define BUTTON_TO_TOP 33.5
|
||||
#define AREA_CENTER 21.0
|
||||
#define DISTANCE_FROM_CENTER 2.5
|
||||
//change BUTTONS_TOTAL_WIDTH when changing this
|
||||
#define AREA_CENTER 21.0
|
||||
|
||||
@interface TorrentTableView (Private)
|
||||
|
||||
|
@ -38,6 +39,7 @@
|
|||
- (NSRect) revealRectForRow: (int) row;
|
||||
- (BOOL) pointInPauseRect: (NSPoint) point;
|
||||
- (BOOL) pointInRevealRect: (NSPoint) point;
|
||||
- (BOOL) pointInIconRect: (NSPoint) point;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -96,13 +98,15 @@
|
|||
}
|
||||
else if( sameRow && [self pointInRevealRect: point]
|
||||
&& [self pointInRevealRect: fClickPoint] )
|
||||
{
|
||||
torrent = [fTorrents objectAtIndex: row];
|
||||
[torrent reveal];
|
||||
}
|
||||
[[fTorrents objectAtIndex: row] reveal];
|
||||
else
|
||||
if ([e clickCount] == 2)
|
||||
[fController showInfo: nil];
|
||||
{
|
||||
if ([self pointInIconRect: point])
|
||||
[[fTorrents objectAtIndex: row] reveal];
|
||||
else
|
||||
[fController showInfo: nil];
|
||||
}
|
||||
|
||||
[super mouseUp: e];
|
||||
|
||||
|
@ -205,6 +209,20 @@
|
|||
cellRect.origin.y + BUTTON_TO_TOP, BUTTON_WIDTH, BUTTON_WIDTH);
|
||||
}
|
||||
|
||||
- (BOOL) pointInIconRect: (NSPoint) point
|
||||
{
|
||||
int row = [self rowAtPoint: point];
|
||||
NSRect cellRect = [self frameOfCellAtColumn:
|
||||
[self columnWithIdentifier: @"Torrent"] row: row];
|
||||
NSSize iconSize = [[[fTorrents objectAtIndex: row] iconFlipped] size];
|
||||
|
||||
NSRect iconRect = NSMakeRect(cellRect.origin.x + 3.0, cellRect.origin.y
|
||||
+ (cellRect.size.height - iconSize.height) * 0.5,
|
||||
iconSize.width, iconSize.height);
|
||||
|
||||
return NSPointInRect(point, iconRect);
|
||||
}
|
||||
|
||||
- (BOOL) pointInPauseRect: (NSPoint) point
|
||||
{
|
||||
return NSPointInRect( point, [self pauseRectForRow:
|
||||
|
|
Loading…
Reference in New Issue