Changeset 340


Ignore:
Timestamp:
Jun 12, 2006, 3:26:24 PM (17 years ago)
Author:
livings124
Message:

Double-clicking the icon in the table view will reveal the download.

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r315 r340  
    2424
    2525#import "TorrentCell.h"
     26#import "TorrentTableView.h"
    2627#import "StringAdditions.h"
    2728
     
    270271    pen.y += [progressString size].height + linePadding;
    271272   
    272     float barWidth = mainWidth + extraNameShift - 42.0 + padding;
     273    float barWidth = mainWidth + extraNameShift - BUTTONS_TOTAL_WIDTH + padding;
    273274   
    274275    NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
  • trunk/macosx/TorrentTableView.h

    r272 r340  
    2626#import <transmission.h>
    2727
     28#define BUTTONS_TOTAL_WIDTH 42.0
     29
    2830@class Controller;
    2931
  • trunk/macosx/TorrentTableView.m

    r339 r340  
    3030#define BUTTON_WIDTH 14.0
    3131#define BUTTON_TO_TOP 33.5
     32#define DISTANCE_FROM_CENTER 2.5
     33//change BUTTONS_TOTAL_WIDTH when changing this
    3234#define AREA_CENTER 21.0
    33 #define DISTANCE_FROM_CENTER 2.5
    3435
    3536@interface TorrentTableView (Private)
     
    3940- (BOOL) pointInPauseRect: (NSPoint) point;
    4041- (BOOL) pointInRevealRect: (NSPoint) point;
     42- (BOOL) pointInIconRect: (NSPoint) point;
    4143
    4244@end
     
    9799    else if( sameRow && [self pointInRevealRect: point]
    98100                && [self pointInRevealRect: fClickPoint] )
    99     {
    100         torrent = [fTorrents objectAtIndex: row];
    101         [torrent reveal];
    102     }
     101        [[fTorrents objectAtIndex: row] reveal];
    103102        else
    104103        if ([e clickCount] == 2)
    105             [fController showInfo: nil];
     104        {
     105            if ([self pointInIconRect: point])
     106                [[fTorrents objectAtIndex: row] reveal];
     107            else
     108                [fController showInfo: nil];
     109        }
    106110   
    107111        [super mouseUp: e];
     
    206210}
    207211
     212- (BOOL) pointInIconRect: (NSPoint) point
     213{
     214    int row = [self rowAtPoint: point];
     215    NSRect cellRect = [self frameOfCellAtColumn:
     216                [self columnWithIdentifier: @"Torrent"] row: row];
     217    NSSize iconSize = [[[fTorrents objectAtIndex: row] iconFlipped] size];
     218   
     219    NSRect iconRect = NSMakeRect(cellRect.origin.x + 3.0, cellRect.origin.y
     220                        + (cellRect.size.height - iconSize.height) * 0.5,
     221                        iconSize.width, iconSize.height);
     222   
     223    return NSPointInRect(point, iconRect);
     224}
     225
    208226- (BOOL) pointInPauseRect: (NSPoint) point
    209227{
Note: See TracChangeset for help on using the changeset viewer.