Changeset 377


Ignore:
Timestamp:
Jun 16, 2006, 12:35:11 AM (16 years ago)
Author:
livings124
Message:

Might as well make size more precise.

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/InfoWindow.nib/info.nib

    r376 r377  
    88        <dict>
    99                <key>549</key>
    10                 <string>69 306 75 68 0 0 1152 842 </string>
     10                <string>364 417 144 49 0 0 1152 842 </string>
    1111        </dict>
    1212        <key>IBFramework Version</key>
     
    2222        <key>IBOpenObjects</key>
    2323        <array>
    24                 <integer>549</integer>
    2524                <integer>5</integer>
    2625        </array>
  • trunk/macosx/InfoWindowController.m

    r366 r377  
    266266            [fStateField setStringValue: [torrent state]];
    267267            [fPercentField setStringValue: [NSString stringWithFormat:
    268                                             @"%.2f%%", 100 * [torrent progress]]];
     268                                            @"%.2f%%", 100.0 * [torrent progress]]];
    269269
    270270            int seeders = [torrent seeders], leechers = [torrent leechers];
  • trunk/macosx/Torrent.m

    r370 r377  
    154154    if ([self progress] < 1.0)
    155155        [fProgressString appendFormat: @"%@ of %@ (%.2f%%)", [NSString stringForFileSize:
    156                 [self downloadedValid]], [NSString stringForFileSize: [self size]], 100 * [self progress]];
     156                [self downloadedValid]], [NSString stringForFileSize: [self size]], 100.0 * [self progress]];
    157157    else
    158158        [fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize:
  • trunk/macosx/TorrentCell.m

    r369 r377  
    3232
    3333- (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point;
    34 - (void) buildSimpleBar: (int) width point: (NSPoint) point;
    35 - (void) buildAdvancedBar: (int) width point: (NSPoint) point;
     34- (void) buildSimpleBar: (float) width point: (NSPoint) point;
     35- (void) buildAdvancedBar: (float) width point: (NSPoint) point;
    3636
    3737@end
     
    120120}
    121121
    122 - (void) buildSimpleBar: (int) width point: (NSPoint) point
     122- (void) buildSimpleBar: (float) width point: (NSPoint) point
    123123{
    124124    width -= 2.0;
     
    135135    else
    136136    {
    137         int completedWidth = [fTorrent progress] * width,
     137        float completedWidth = [fTorrent progress] * width,
    138138                remainingWidth = width - completedWidth;
    139139        BOOL isActive = [fTorrent isActive];
     
    172172}
    173173
    174 - (void) buildAdvancedBar: (int) width point: (NSPoint) point
     174- (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point
    175175{
    176176    //if seeding, there's no need for the advanced bar
    177177    if ([fTorrent isSeeding])
    178178    {
    179         [self buildSimpleBar: width point: point];
     179        [self buildSimpleBar: widthFloat point: point];
    180180        return;
    181181    }
    182182
     183    int width = widthFloat; //integers for bars
     184   
    183185    NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
    184186        initWithBitmapDataPlanes: nil pixelsWide: width
     
    247249    NSImage * img = [[NSImage alloc] initWithSize: [bitmap size]];
    248250    [img addRepresentation: bitmap];
     251   
     252    //bar size with float, not double, to match standard bar
     253    [img setScalesWhenResized: YES];
     254    [img setSize: NSMakeSize(widthFloat, BAR_HEIGHT)];
     255   
    249256    [img compositeToPoint: point operation: NSCompositeSourceOver];
    250257    [img release];
     
    252259   
    253260    //draw overlay over advanced bar
    254     width -= 2.0;
    255    
    256261    [fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
    257262   
     263    widthFloat -= 2.0;
    258264    point.x += 1.0;
    259     [self placeBar: fProgressAdvanced width: width point: point];
    260    
    261     point.x += width;
     265    [self placeBar: fProgressAdvanced width: widthFloat point: point];
     266   
     267    point.x += widthFloat;
    262268    [fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
    263269}
Note: See TracChangeset for help on using the changeset viewer.