Changeset 10412


Ignore:
Timestamp:
Mar 21, 2010, 2:59:46 PM (12 years ago)
Author:
livings124
Message:

in compact view, center fields instead of using offsets from the top

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r10410 r10412  
    5050#define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0
    5151#define PADDING_BETWEEN_IMAGE_AND_BAR 7.0
    52 #define PADDING_BETWEEN_TITLE_AND_PRIORITY 4.0
     52#define PADDING_BETWEEN_TITLE_AND_PRIORITY 3.0
    5353#define PADDING_ABOVE_TITLE 4.0
    54 #define PADDING_ABOVE_MIN_STATUS 6.0
    55 #define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0
     54#define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 3.0
    5655#define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0
    5756#define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0
     
    122121    const CGFloat imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG;
    123122   
    124     return NSMakeRect(NSMinX(bounds) + PADDING_HORIZONTAL, floor(NSMidY(bounds) - imageSize * 0.5),
     123    return NSMakeRect(NSMinX(bounds) + PADDING_HORIZONTAL, ceil(NSMidY(bounds) - imageSize * 0.5),
    125124                        imageSize, imageSize);
    126125}
     
    665664   
    666665    result.origin.x = NSMaxX(bounds) - (NSWidth(result) + PADDING_HORIZONTAL * 2.0);
    667     result.origin.y = NSMinY(bounds) + PADDING_ABOVE_MIN_STATUS;
     666    result.origin.y = ceil(NSMidY(bounds) - NSHeight(result) * 0.5);
    668667   
    669668    return result;
     
    675674   
    676675    NSRect result;
    677     result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE;
    678676    result.origin.x = NSMinX(bounds) + PADDING_HORIZONTAL
    679677                        + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_TITLE;
    680    
    681678    result.size.height = HEIGHT_TITLE;
     679   
    682680    if (minimal)
     681    {
     682        result.origin.y = ceil(NSMidY(bounds) - NSHeight(result) * 0.5);
    683683        result.size.width = rightBound - NSMinX(result) - PADDING_BETWEEN_TITLE_AND_MIN_STATUS;
    684     else
     684    }
     685    else
     686    {
     687        result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE;
    685688        result.size.width = NSMaxX(bounds) - NSMinX(result) - PADDING_HORIZONTAL;
     689    }
    686690   
    687691    if ([[self representedObject] priority] != TR_PRI_NORMAL)
     
    726730    {
    727731        result.origin.x = NSMinX(bounds) + IMAGE_SIZE_MIN + PADDING_BETWEEN_IMAGE_AND_BAR;
     732        #warning use constant
    728733        result.origin.y = NSMinY(bounds) + 3.0;
    729734        result.size.height = NSHeight(bounds) - 2.0 * 3.0;
     
    757762    else
    758763    {
    759         #warning make constant
    760         result.origin.y = NSMinY(bounds) + 6.0;
     764        result.origin.y = ceil(NSMidY(bounds) - NSHeight(result) * 0.5);
    761765        result.origin.x -= PADDING_HORIZONTAL;
    762766    }
     
    777781    else
    778782    {
    779         #warning make constant
    780         result.origin.y = NSMinY(bounds) + 6.0;
     783        result.origin.y = ceil(NSMidY(bounds) - NSHeight(result) * 0.5);
    781784        result.origin.x -= PADDING_HORIZONTAL;
    782785    }
Note: See TracChangeset for help on using the changeset viewer.