Changeset 353


Ignore:
Timestamp:
Jun 14, 2006, 1:53:24 AM (16 years ago)
Author:
livings124
Message:

Make the right end blue if the whole bar is blue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r348 r353  
    137137        float completedWidth = [fTorrent progress] * width,
    138138                remainingWidth = width - completedWidth;
    139    
    140         NSImage * barActiveEnd, * barActive;
    141         if ([fTorrent isActive])
    142         {
    143             barActiveEnd = fProgressEndBlue;
    144             barActive = fProgressBlue;
    145         }
     139       
     140        NSImage * barLeftEnd, * barRightEnd;
     141        BOOL isActive = [fTorrent isActive];
     142       
     143        //left end
     144        if (remainingWidth == width)
     145            barLeftEnd = fProgressEndWhite;
     146        else if (isActive)
     147            barLeftEnd = fProgressEndBlue;
    146148        else
    147         {
    148             barActiveEnd = fProgressEndGray;
    149             barActive = fProgressGray;
    150         }
    151         if (completedWidth < 1.0)
    152             barActiveEnd = fProgressEndWhite;
    153    
    154         [barActiveEnd compositeToPoint: point operation: NSCompositeSourceOver];
    155        
     149            barLeftEnd = fProgressEndGray;
     150       
     151        [barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];
     152       
     153        //active bar
    156154        point.x += 1.0;
    157         [self placeBar: barActive width: completedWidth point: point];
    158        
     155        [self placeBar: isActive ? fProgressBlue : fProgressGray width: completedWidth point: point];
     156       
     157        //remaining bar
    159158        point.x += completedWidth;
    160159        [self placeBar: fProgressWhite width: remainingWidth point: point];
    161160       
     161        //right end
     162        if (completedWidth < width)
     163            barRightEnd = fProgressEndWhite;
     164        else if (isActive)
     165            barRightEnd = fProgressEndBlue;
     166        else
     167            barRightEnd = fProgressEndGray;
     168       
    162169        point.x += remainingWidth;
    163         [[fTorrent progress] < 1.0 ? fProgressEndWhite : fProgressEndGray
    164                     compositeToPoint: point operation: NSCompositeSourceOver];
     170        [barRightEnd compositeToPoint: point operation: NSCompositeSourceOver];
    165171    }
    166172}
Note: See TracChangeset for help on using the changeset viewer.