Changeset 9807
- Timestamp:
- Dec 20, 2009, 9:02:58 PM (12 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/GroupsPrefsController.m
r9800 r9807 225 225 } 226 226 227 [self refreshCustomLocation ];227 [self refreshCustomLocationWithSingleGroup]; 228 228 229 229 [fCustomLocationPopUp selectItemAtIndex: 0]; -
trunk/macosx/TorrentCell.m
r9764 r9807 31 31 #import "TorrentTableView.h" 32 32 33 #define BAR_HEIGHT 12.0 f34 35 #define IMAGE_SIZE_REG 32.0 f36 #define IMAGE_SIZE_MIN 16.0 f37 #define ERROR_IMAGE_SIZE 20.0 f38 39 #define NORMAL_BUTTON_WIDTH 14.0 f40 #define ACTION_BUTTON_WIDTH 16.0 f41 42 #define PRIORITY_ICON_WIDTH 14.0 f43 #define PRIORITY_ICON_HEIGHT 14.0 f33 #define BAR_HEIGHT 12.0 34 35 #define IMAGE_SIZE_REG 32.0 36 #define IMAGE_SIZE_MIN 16.0 37 #define ERROR_IMAGE_SIZE 20.0 38 39 #define NORMAL_BUTTON_WIDTH 14.0 40 #define ACTION_BUTTON_WIDTH 16.0 41 42 #define PRIORITY_ICON_WIDTH 14.0 43 #define PRIORITY_ICON_HEIGHT 14.0 44 44 45 45 //ends up being larger than font height 46 #define HEIGHT_TITLE 16.0 f47 #define HEIGHT_STATUS 12.0 f48 49 #define PADDING_HORIZONTAL 3.0 f50 #define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0 f51 #define PADDING_BETWEEN_IMAGE_AND_BAR 7.0 f52 #define PADDING_BETWEEN_TITLE_AND_PRIORITY 4.0 f53 #define PADDING_ABOVE_TITLE 4.0 f54 #define PADDING_ABOVE_MIN_STATUS 4.0 f55 #define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0 f56 #define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0 f57 #define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0 f58 #define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0 f59 #define PADDING_BETWEEN_BAR_AND_STATUS 2.0 f60 61 #define PIECES_TOTAL_PERCENT 0.6 f46 #define HEIGHT_TITLE 16.0 47 #define HEIGHT_STATUS 12.0 48 49 #define PADDING_HORIZONTAL 3.0 50 #define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0 51 #define PADDING_BETWEEN_IMAGE_AND_BAR 7.0 52 #define PADDING_BETWEEN_TITLE_AND_PRIORITY 4.0 53 #define PADDING_ABOVE_TITLE 4.0 54 #define PADDING_ABOVE_MIN_STATUS 4.0 55 #define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0 56 #define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0 57 #define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0 58 #define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0 59 #define PADDING_BETWEEN_BAR_AND_STATUS 2.0 60 61 #define PIECES_TOTAL_PERCENT 0.6 62 62 63 63 #define MAX_PIECES (18*18) … … 101 101 NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; 102 102 [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail]; 103 104 fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: 105 [NSFont messageFontOfSize: 12.0f], NSFontAttributeName, 106 paragraphStyle, NSParagraphStyleAttributeName, nil]; 107 fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: 108 [NSFont messageFontOfSize: 9.0f], NSFontAttributeName, 109 paragraphStyle, NSParagraphStyleAttributeName, nil]; 103 104 fTitleAttributes = [[NSMutableDictionary alloc] initWithCapacity: 3]; 105 [fTitleAttributes setObject: [NSFont messageFontOfSize: 12.0] forKey: NSFontAttributeName]; 106 [fTitleAttributes setObject: paragraphStyle forKey: NSParagraphStyleAttributeName]; 107 108 fStatusAttributes = [[NSMutableDictionary alloc] initWithCapacity: 3]; 109 [fStatusAttributes setObject: [NSFont messageFontOfSize: 9.0] forKey: NSFontAttributeName]; 110 [fStatusAttributes setObject: paragraphStyle forKey: NSParagraphStyleAttributeName]; 111 110 112 [paragraphStyle release]; 111 113 112 fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 f green: 0.4f blue: 0.8f alpha: 1.0f] retain];113 fBarBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 f alpha: 0.2f] retain];114 fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain]; 115 fBarBorderColor = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.2] retain]; 114 116 } 115 117 return self; … … 120 122 const CGFloat imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG; 121 123 122 NSRect result = bounds; 123 result.origin.x += PADDING_HORIZONTAL; 124 result.origin.y += floor((result.size.height - imageSize) * 0.5); 125 result.size = NSMakeSize(imageSize, imageSize); 126 127 return result; 124 return NSMakeRect(NSMinX(bounds) + PADDING_HORIZONTAL, floor(NSMidY(bounds) - imageSize * 0.5), 125 imageSize, imageSize); 128 126 } 129 127 … … 238 236 { 239 237 controlOptions |= NSTrackingAssumeInside; 240 [(TorrentTableView *)controlView setControlButtonHover: [[userInfo objectForKey: @"Row"] int Value]];238 [(TorrentTableView *)controlView setControlButtonHover: [[userInfo objectForKey: @"Row"] integerValue]]; 241 239 } 242 240 … … 255 253 { 256 254 revealOptions |= NSTrackingAssumeInside; 257 [(TorrentTableView *)controlView setRevealButtonHover: [[userInfo objectForKey: @"Row"] int Value]];255 [(TorrentTableView *)controlView setRevealButtonHover: [[userInfo objectForKey: @"Row"] integerValue]]; 258 256 } 259 257 … … 271 269 { 272 270 actionOptions |= NSTrackingAssumeInside; 273 [(TorrentTableView *)controlView setActionButtonHover: [[userInfo objectForKey: @"Row"] int Value]];271 [(TorrentTableView *)controlView setActionButtonHover: [[userInfo objectForKey: @"Row"] integerValue]]; 274 272 } 275 273 … … 309 307 310 308 //group coloring 311 NSRect iconRect = [self iconRectForBounds: cellFrame];312 313 NSInteger groupValue = [torrent groupValue];309 const NSRect iconRect = [self iconRectForBounds: cellFrame]; 310 311 const NSInteger groupValue = [torrent groupValue]; 314 312 if (groupValue != -1) 315 313 { 316 NSRect groupRect = NSInsetRect(iconRect, -1.0 f, -2.0f);314 NSRect groupRect = NSInsetRect(iconRect, -1.0, -2.0); 317 315 if (!minimal) 318 316 { 319 groupRect.size.height -= 1.0 f;320 groupRect.origin.y -= 1.0 f;321 } 322 const CGFloat radius = minimal ? 3.0 f : 6.0f;317 groupRect.size.height -= 1.0; 318 groupRect.origin.y -= 1.0; 319 } 320 const CGFloat radius = minimal ? 3.0 : 6.0; 323 321 324 322 NSColor * groupColor = [[GroupsController groups] colorForIndex: groupValue], 325 * darkGroupColor = [groupColor blendedColorWithFraction: 0.2 fofColor: [NSColor whiteColor]];323 * darkGroupColor = [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]; 326 324 327 325 //border 328 326 NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect xRadius: radius yRadius: radius]; 329 327 [darkGroupColor set]; 330 [bp setLineWidth: 2.0 f];328 [bp setLineWidth: 2.0]; 331 329 [bp stroke]; 332 330 333 331 //inside 334 332 bp = [NSBezierPath bezierPathWithRoundedRect: groupRect xRadius: radius yRadius: radius]; 335 NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [groupColor blendedColorWithFraction: 0.7 f333 NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [groupColor blendedColorWithFraction: 0.7 336 334 ofColor: [NSColor whiteColor]] endingColor: darkGroupColor]; 337 [gradient drawInBezierPath: bp angle: 90.0 f];335 [gradient drawInBezierPath: bp angle: 90.0]; 338 336 [gradient release]; 339 337 } … … 390 388 NSImage * priorityImage = [torrent priority] == TR_PRI_HIGH ? [NSImage imageNamed: @"PriorityHigh.png"] 391 389 : [NSImage imageNamed: @"PriorityLow.png"]; 392 priorityImage = [NSApp isOnSnowLeopardOrBetter] ? [priorityImage retain] : [priorityImage copy]; //take line out completely when 10.6-only 390 //take line out completely when 10.6-only 391 priorityImage = [NSApp isOnSnowLeopardOrBetter] ? [priorityImage retain] : [priorityImage copy]; 393 392 394 393 NSRect priorityRect = NSMakeRect(NSMaxX(titleRect) + PADDING_BETWEEN_TITLE_AND_PRIORITY, 395 titleRect.origin.y - (PRIORITY_ICON_HEIGHT - titleRect.size.height) / 2.0,396 PRIORITY_ICON_WIDTH, PRIORITY_ICON_HEIGHT);394 NSMidY(titleRect) - PRIORITY_ICON_HEIGHT * 0.5, 395 PRIORITY_ICON_WIDTH, PRIORITY_ICON_HEIGHT); 397 396 398 397 [self drawImage: priorityImage inRect: priorityRect]; … … 638 637 { 639 638 result.size.width -= PRIORITY_ICON_WIDTH + PADDING_BETWEEN_TITLE_AND_PRIORITY; 640 result.size.width = MIN( result.size.width, [string size].width); //only need to force it smaller for the priority icon639 result.size.width = MIN(NSWidth(result), [string size].width); //only need to force it smaller for the priority icon 641 640 } 642 641 … … 693 692 result.size.height = NORMAL_BUTTON_WIDTH; 694 693 result.size.width = NORMAL_BUTTON_WIDTH; 695 result.origin.x = NSMaxX(bounds) - 2.0 f* (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);696 697 result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5 f;694 result.origin.x = NSMaxX(bounds) - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH); 695 696 result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5; 698 697 if ([fDefaults boolForKey: @"SmallView"]) 699 698 result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN; … … 711 710 result.origin.x = NSMaxX(bounds) - (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH); 712 711 713 result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5 f;712 result.origin.y = NSMinY(bounds) + PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5; 714 713 if ([fDefaults boolForKey: @"SmallView"]) 715 714 result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN; … … 722 721 - (NSRect) actionButtonRectForBounds: (NSRect) bounds 723 722 { 724 NSRect result = [self iconRectForBounds: bounds]; 725 if (![fDefaults boolForKey: @"SmallView"]) 726 { 727 result.origin.x += (result.size.width - ACTION_BUTTON_WIDTH) * 0.5f; 728 result.origin.y += (result.size.height - ACTION_BUTTON_WIDTH) * 0.5f; 729 result.size.width = ACTION_BUTTON_WIDTH; 730 result.size.height = ACTION_BUTTON_WIDTH; 731 } 732 733 return result; 723 const NSRect iconRect = [self iconRectForBounds: bounds]; 724 725 //in minimal view the rect will be the icon rect, but avoid the extra defaults lookup with some cheap math 726 return NSMakeRect(NSMidX(iconRect) - ACTION_BUTTON_WIDTH * 0.5, NSMidY(iconRect) - ACTION_BUTTON_WIDTH * 0.5, 727 ACTION_BUTTON_WIDTH, ACTION_BUTTON_WIDTH); 734 728 } 735 729 -
trunk/macosx/TorrentTableView.m
r9674 r9807 241 241 continue; 242 242 243 NSDictionary * userInfo = [NSDictionary dictionaryWithObject: [NSNumber numberWith Int: row] forKey: @"Row"];243 NSDictionary * userInfo = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedInteger: row] forKey: @"Row"]; 244 244 TorrentCell * cell = (TorrentCell *)[self preparedCellAtColumn: -1 row: row]; 245 245 [cell addTrackingAreasForView: self inRect: [self rectOfRow: row] withUserInfo: userInfo mouseLocation: mouseLocation];
Note: See TracChangeset
for help on using the changeset viewer.