Changeset 3757
- Timestamp:
- Nov 8, 2007, 12:58:05 PM (15 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/FileOutlineView.h
r3475 r3757 26 26 27 27 @class Torrent; 28 @class CTGradient; 28 29 29 30 @interface FileOutlineView : NSOutlineView … … 31 32 Torrent * fTorrent; 32 33 33 NSColor * fHighPriorityColor, * fLowPriorityColor, * fMixedPriorityColor;34 CTGradient * fHighPriorityGradient, * fLowPriorityGradient, * fMixedPriorityGradient; 34 35 35 36 int fHoverRow; -
trunk/macosx/FileOutlineView.m
r3701 r3757 27 27 #import "FilePriorityCell.h" 28 28 #import "Torrent.h" 29 #import "CTGradient.h" 29 30 30 31 @implementation FileOutlineView … … 43 44 [self setIndentationPerLevel: 14.0]; 44 45 45 fHighPriorityColor = [[NSColor colorWithCalibratedRed: 0.8588 green: 0.9961 blue: 0.8311 alpha: 1.0] retain]; 46 fLowPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 0.9529 blue: 0.8078 alpha: 1.0] retain]; 47 fMixedPriorityColor = [[NSColor colorWithCalibratedRed: 0.9216 green: 0.9059 blue: 1.0 alpha: 1.0] retain]; 46 NSColor * beginningColor = [NSColor colorWithCalibratedRed: 217.0/255.0 green: 250.0/255.0 blue: 211.0/255.0 alpha: 1.0]; 47 NSColor * endingColor = [NSColor colorWithCalibratedRed: 200.0/255.0 green: 231.0/255.0 blue: 194.0/255.0 alpha: 1.0]; 48 fHighPriorityGradient = [[CTGradient gradientWithBeginningColor: beginningColor endingColor: endingColor] retain]; 49 50 beginningColor = [NSColor colorWithCalibratedRed: 255.0/255.0 green: 243.0/255.0 blue: 206.0/255.0 alpha: 1.0]; 51 endingColor = [NSColor colorWithCalibratedRed: 235.0/255.0 green: 226.0/255.0 blue: 192.0/255.0 alpha: 1.0]; 52 fLowPriorityGradient = [[CTGradient gradientWithBeginningColor: beginningColor endingColor: endingColor] retain]; 53 54 beginningColor = [NSColor colorWithCalibratedRed: 225.0/255.0 green: 218.0/255.0 blue: 255.0/255.0 alpha: 1.0]; 55 endingColor = [NSColor colorWithCalibratedRed: 214.0/255.0 green: 207.0/255.0 blue: 242.0/255.0 alpha: 1.0]; 56 fMixedPriorityGradient = [[CTGradient gradientWithBeginningColor: beginningColor endingColor: endingColor] retain]; 48 57 49 58 fHoverRow = -1; … … 52 61 - (void) dealloc 53 62 { 54 [fHighPriority Colorrelease];55 [fLowPriority Colorrelease];56 [fMixedPriority Colorrelease];63 [fHighPriorityGradient release]; 64 [fLowPriorityGradient release]; 65 [fMixedPriorityGradient release]; 57 66 58 67 [super dealloc]; … … 124 133 if ([fTorrent checkForFiles: indexes] != NSOffState) 125 134 { 135 CTGradient * gradient = nil; 136 126 137 NSSet * priorities = [fTorrent filePrioritiesForIndexes: indexes]; 127 138 int count = [priorities count]; 128 if (count > 0)139 if (count == 1) 129 140 { 130 BOOL custom = YES; 131 if (count > 1) 132 [fMixedPriorityColor set]; 133 else 141 switch ([[priorities anyObject] intValue]) 134 142 { 135 switch ([[priorities anyObject] intValue]) 136 { 137 case TR_PRI_LOW: 138 [fLowPriorityColor set]; 139 break; 140 case TR_PRI_HIGH: 141 [fHighPriorityColor set]; 142 break; 143 default: 144 custom = NO; 145 } 143 case TR_PRI_LOW: 144 gradient = fLowPriorityGradient; 145 break; 146 case TR_PRI_HIGH: 147 gradient = fHighPriorityGradient; 148 break; 146 149 } 147 148 if (custom) 149 { 150 NSRect rect = [self rectOfRow: row]; 151 rect.size.height -= 1.0; 150 } 151 else if (count > 1) 152 gradient = fMixedPriorityGradient; 153 else; 152 154 153 NSRectFill(rect); 154 } 155 if (gradient) 156 { 157 NSRect rect = [self rectOfRow: row]; 158 rect.size.height -= 1.0; 159 [gradient fillRect: rect angle: 90]; 155 160 } 156 161 }
Note: See TracChangeset
for help on using the changeset viewer.