Changeset 2792


Ignore:
Timestamp:
Aug 16, 2007, 3:28:01 AM (15 years ago)
Author:
livings124
Message:

streamline and improve action button placement code in TorrentTableView?

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r2791 r2792  
    5555- (void) drawSimpleBar: (NSRect) barRect;
    5656- (void) drawAdvancedBar: (NSRect) barRect;
    57 - (NSImage *) advancedBarSimple;
     57- (NSImage *) advancedBar;
    5858
    5959- (NSRect) rectForMinimalStatusWithString: (NSAttributedString *) string inBounds: (NSRect) bounds;
     
    370370- (void) drawAdvancedBar: (NSRect) barRect
    371371{
    372     [[self advancedBarSimple] drawInRect: barRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
     372    [[self advancedBar] drawInRect: barRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
    373373   
    374374    if (!fTransparentGradient)
     
    380380}
    381381
    382 - (NSImage *) advancedBarSimple
     382- (NSImage *) advancedBar
    383383{
    384384    if (!fBitmap)
  • trunk/macosx/TorrentTableView.h

    r2715 r2792  
    2626#import <transmission.h>
    2727#import <Controller.h>
    28 
    29 #define PADDING 3.0
    3028
    3129//button layout (from end of bar) is: button, padding, button, padding
  • trunk/macosx/TorrentTableView.m

    r2722 r2792  
    2727#import "Controller.h"
    2828#import "Torrent.h"
     29
     30#define PADDING 3.0
    2931
    3032#define BUTTON_TO_TOP_REGULAR 33.0
     
    475477    if (row < 0)
    476478        return NSZeroRect;
    477     else if ([fDefaults boolForKey: @"SmallView"])
    478     {
    479         TorrentCell * cell = [[self tableColumnWithIdentifier: @"Torrent"] dataCell];
    480         return [cell iconRectForBounds: [self frameOfCellAtColumn: 0 row: row]];
    481     }
    482     else;
    483    
    484     NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
    485    
    486     return NSMakeRect(cellRect.origin.x + PADDING +
    487                         ([[[fTorrents objectAtIndex: row] iconFlipped] size].width - ACTION_BUTTON_WIDTH) * 0.5,
     479   
     480    TorrentCell * cell = [[self tableColumnWithIdentifier: @"Torrent"] dataCell];
     481    NSRect cellRect = [self frameOfCellAtColumn: 0 row: row],
     482            iconRect = [cell iconRectForBounds: cellRect];
     483   
     484    if ([fDefaults boolForKey: @"SmallView"])
     485        return iconRect;
     486    else
     487        return NSMakeRect(iconRect.origin.x + (iconRect.size.width - ACTION_BUTTON_WIDTH) * 0.5,
    488488                        cellRect.origin.y + ACTION_BUTTON_TO_TOP, ACTION_BUTTON_WIDTH, ACTION_BUTTON_HEIGHT);
    489489}
Note: See TracChangeset for help on using the changeset viewer.