Changeset 972


Ignore:
Timestamp:
Oct 2, 2006, 4:20:05 AM (15 years ago)
Author:
livings124
Message:

draw images using composite to ensure actual width

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r971 r972  
    656656- (void) resumeTorrentsNoWait: (NSArray *) torrents
    657657{
     658    //iterate through instead of all at once to ensure no conflicts
    658659    NSEnumerator * enumerator = [torrents objectEnumerator];
    659660    Torrent * torrent;
  • trunk/macosx/TorrentTableView.h

    r920 r972  
    2626#import <transmission.h>
    2727
    28 #define BUTTONS_TOTAL_WIDTH 42.0
     28#define BUTTONS_TOTAL_WIDTH 39.0
    2929
    3030@class Controller;
  • trunk/macosx/TorrentTableView.m

    r920 r972  
    2828#import "Torrent.h"
    2929
    30 #define BUTTON_TO_TOP_REGULAR 33.5
     30#define BUTTON_TO_TOP_REGULAR 33.0
    3131#define BUTTON_TO_TOP_SMALL 20.0
    3232
     33//button layout (from end of bar) is: padding, button, padding, button, padding
     34//change BUTTONS_TOTAL_WIDTH in .h when changing these values, add 2.0 to that value
    3335#define BUTTON_WIDTH 14.0
    34 #define DISTANCE_FROM_CENTER 2.5
    35 //change BUTTONS_TOTAL_WIDTH when changing this
    36 #define AREA_CENTER 21.0
     36#define PADDING 3.0
    3737
    3838@interface TorrentTableView (Private)
     
    233233    Torrent * torrent;
    234234    NSImage * image;
     235    NSRect buttonRect = NSMakeRect(0, 0, BUTTON_WIDTH, BUTTON_WIDTH);
    235236
    236237    [super drawRect: r];
     
    257258
    258259        if (image)
    259         {
    260             [image setFlipped: YES];
    261             [image drawAtPoint: rect.origin fromRect: NSMakeRect(0, 0, BUTTON_WIDTH, BUTTON_WIDTH)
    262                 operation: NSCompositeSourceOver fraction: 1.0];
    263         }
     260            [image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) fromRect: buttonRect
     261                    operation: NSCompositeSourceOver];
    264262
    265263        rect = [self revealRectForRow: i];
    266264        image = NSPointInRect(fClickPoint, rect) ? fRevealOnIcon : fRevealOffIcon;
    267         [image setFlipped: YES];
    268         [image drawAtPoint: rect.origin fromRect: NSMakeRect(0, 0, BUTTON_WIDTH, BUTTON_WIDTH)
    269             operation: NSCompositeSourceOver fraction: 1.0];
     265        [image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) fromRect: buttonRect
     266                    operation: NSCompositeSourceOver];
    270267    }
    271268}
     
    281278    float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
    282279   
    283     return NSMakeRect(NSMaxX(cellRect) - AREA_CENTER - DISTANCE_FROM_CENTER - BUTTON_WIDTH,
     280    return NSMakeRect(NSMaxX(cellRect) - PADDING - BUTTON_WIDTH - PADDING - BUTTON_WIDTH,
    284281                        cellRect.origin.y + buttonToTop, BUTTON_WIDTH, BUTTON_WIDTH);
    285282}
     
    291288    float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
    292289   
    293     return NSMakeRect(NSMaxX(cellRect) - AREA_CENTER + DISTANCE_FROM_CENTER,
     290    return NSMakeRect(NSMaxX(cellRect) - PADDING - BUTTON_WIDTH,
    294291                        cellRect.origin.y + buttonToTop, BUTTON_WIDTH, BUTTON_WIDTH);
    295292}
Note: See TracChangeset for help on using the changeset viewer.