Changeset 835 for trunk/macosx/TorrentCell.m
- Timestamp:
- Aug 29, 2006, 12:09:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/TorrentCell.m
r729 r835 39 39 @implementation TorrentCell 40 40 41 static NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen,42 * fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue,43 * fProgressEndGray, * fProgressEndGreen, * fProgressEndAdvanced;44 45 41 // Used to optimize drawing. They contain packed RGBA pixels for every color needed. 46 42 #define BE OSSwapBigToHostConstInt32 … … 69 65 70 66 NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT); 71 if (!fProgressWhite) 72 { 73 fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"]; 74 [fProgressWhite setScalesWhenResized: YES]; 75 } 76 if (!fProgressBlue) 77 { 78 fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"]; 79 [fProgressBlue setScalesWhenResized: YES]; 80 [fProgressBlue setSize: startSize]; 81 } 82 if (!fProgressGray) 83 { 84 fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"]; 85 [fProgressGray setScalesWhenResized: YES]; 86 [fProgressGray setSize: startSize]; 87 } 88 if (!fProgressGreen) 89 { 90 fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"]; 91 [fProgressGreen setScalesWhenResized: YES]; 92 } 93 if (!fProgressAdvanced) 94 { 95 fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"]; 96 [fProgressAdvanced setScalesWhenResized: YES]; 97 } 98 99 if (!fProgressEndWhite) 100 fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"]; 101 if (!fProgressEndBlue) 102 fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"]; 103 if (!fProgressEndGray) 104 fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"]; 105 if (!fProgressEndGreen) 106 fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"]; 107 if (!fProgressEndAdvanced) 108 fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"]; 67 68 fProgressWhite = [NSImage imageNamed: @"ProgressBarWhite.png"]; 69 [fProgressWhite setScalesWhenResized: YES]; 70 71 72 fProgressBlue = [NSImage imageNamed: @"ProgressBarBlue.png"]; 73 [fProgressBlue setScalesWhenResized: YES]; 74 [fProgressBlue setSize: startSize]; 75 76 fProgressGray = [NSImage imageNamed: @"ProgressBarGray.png"]; 77 [fProgressGray setScalesWhenResized: YES]; 78 [fProgressGray setSize: startSize]; 79 80 fProgressGreen = [NSImage imageNamed: @"ProgressBarGreen.png"]; 81 [fProgressGreen setScalesWhenResized: YES]; 82 83 fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"]; 84 [fProgressAdvanced setScalesWhenResized: YES]; 85 86 87 fProgressEndWhite = [NSImage imageNamed: @"ProgressBarEndWhite.png"]; 88 fProgressEndBlue = [NSImage imageNamed: @"ProgressBarEndBlue.png"]; 89 fProgressEndGray = [NSImage imageNamed: @"ProgressBarEndGray.png"]; 90 fProgressEndGreen = [NSImage imageNamed: @"ProgressBarEndGreen.png"]; 91 fProgressEndAdvanced = [NSImage imageNamed: @"ProgressBarEndAdvanced.png"]; 92 93 fErrorImage = [NSImage imageNamed: @"Error.tiff"]; 94 [fErrorImage setFlipped: YES]; 95 [fErrorImage setScalesWhenResized: YES]; 96 [fErrorImage setSize: NSMakeSize(16.0, 16.0)]; 109 97 } 110 98 return self; … … 314 302 [icon drawAtPoint: pen fromRect: NSMakeRect(0, 0, iconSize.width, iconSize.height) 315 303 operation: NSCompositeSourceOver fraction: 1.0]; 304 305 //error badge 306 if ([fTorrent isError]) 307 { 308 NSSize errorIconSize = [fErrorImage size]; 309 [fErrorImage drawAtPoint: NSMakePoint(pen.x + iconSize.width - errorIconSize.width, 310 pen.y + iconSize.height - errorIconSize.height) 311 fromRect: NSMakeRect(0, 0, errorIconSize.width, errorIconSize.height) 312 operation: NSCompositeSourceOver fraction: 1.0]; 313 } 316 314 317 315 float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT; … … 352 350 { 353 351 //icon 354 NSImage * icon = [fTorrent iconSmall];352 NSImage * icon = ![fTorrent isError] ? [fTorrent iconSmall] : fErrorImage; 355 353 NSSize iconSize = [icon size]; 356 354
Note: See TracChangeset
for help on using the changeset viewer.