Changeset 6959
- Timestamp:
- Oct 25, 2008, 9:34:30 PM (12 years ago)
- Location:
- trunk/macosx
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/AboutWindowController.m
r6737 r6959 54 54 55 55 NSRect buttonFrame = [fLicenseButton frame]; 56 buttonFrame.size.width += 10.0 ;56 buttonFrame.size.width += 10.0f; 57 57 buttonFrame.origin.x -= buttonFrame.size.width - oldButtonWidth; 58 58 [fLicenseButton setFrame: buttonFrame]; -
trunk/macosx/BadgeView.h
r5687 r6959 32 32 NSDictionary * fAttributes; 33 33 34 float fDownloadRate, fUploadRate;34 CGFloat fDownloadRate, fUploadRate; 35 35 BOOL fQuitting; 36 36 } … … 38 38 - (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib; 39 39 40 - (BOOL) setRatesWithDownload: ( float) downloadRate upload: (float) uploadRate;40 - (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate; 41 41 - (void) setQuitting; 42 42 -
trunk/macosx/BadgeView.m
r5740 r6959 26 26 #import "NSStringAdditions.h" 27 27 28 #define BETWEEN_PADDING 2.0 28 #define BETWEEN_PADDING 2.0f 29 29 30 30 @interface BadgeView (Private) 31 31 32 - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: ( float) height adjustForQuit: (BOOL) quit;32 - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit; 33 33 34 34 @end … … 55 55 } 56 56 57 - (BOOL) setRatesWithDownload: ( float) downloadRate upload: (float) uploadRate57 - (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate 58 58 { 59 59 //only needs update if the badges were displayed or are displayed now … … 81 81 NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"]; 82 82 [self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit") 83 atHeight: (rect.size.height - [quitBadge size].height) * 0.5 adjustForQuit: YES];83 atHeight: (rect.size.height - [quitBadge size].height) * 0.5f adjustForQuit: YES]; 84 84 return; 85 85 } 86 86 87 BOOL upload = fUploadRate >= 0.1 ,88 download = fDownloadRate >= 0.1 ;89 float bottom = 0.0;87 BOOL upload = fUploadRate >= 0.1f, 88 download = fDownloadRate >= 0.1f; 89 CGFloat bottom = 0.0f; 90 90 if (upload) 91 91 { … … 105 105 106 106 //dock icon must have locked focus 107 - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: ( float) height adjustForQuit: (BOOL) quit107 - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit 108 108 { 109 109 if (!fAttributes) 110 110 { 111 111 NSShadow * stringShadow = [[NSShadow alloc] init]; 112 [stringShadow setShadowOffset: NSMakeSize(2.0 , -2.0)];113 [stringShadow setShadowBlurRadius: 4.0 ];112 [stringShadow setShadowOffset: NSMakeSize(2.0f, -2.0f)]; 113 [stringShadow setShadowBlurRadius: 4.0f]; 114 114 115 115 fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: 116 116 [NSColor whiteColor], NSForegroundColorAttributeName, 117 [NSFont boldSystemFontOfSize: 26.0 ], NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];117 [NSFont boldSystemFontOfSize: 26.0f], NSFontAttributeName, stringShadow, NSShadowAttributeName, nil]; 118 118 119 119 [stringShadow release]; … … 124 124 badgeRect.origin.y = height; 125 125 126 [badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 ];126 [badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f]; 127 127 128 128 //string is in center of image … … 130 130 131 131 NSRect stringRect = badgeRect; 132 stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5 ;133 stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + (quit ? 2.0 : 1.0); //adjust for shadow, extra for quit132 stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5f; 133 stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5f + (quit ? 2.0f : 1.0f); //adjust for shadow, extra for quit 134 134 stringRect.size = stringSize; 135 135 -
trunk/macosx/MessageWindowController.h
r5628 r6959 33 33 34 34 NSMutableArray * fMessages; 35 unsigned intfIndex;35 NSUInteger fIndex; 36 36 37 37 NSDictionary * fAttributes; -
trunk/macosx/MessageWindowController.m
r6887 r6959 176 176 BOOL shouldScroll = [scroller floatValue] == 1.0 || [scroller isHidden] || [scroller knobProportion] == 1.0; 177 177 178 inttotal = [fMessages count];178 NSUInteger total = [fMessages count]; 179 179 if (total > MAX_MESSAGES) 180 180 { … … 196 196 } 197 197 198 - ( int) numberOfRowsInTableView: (NSTableView *) tableView198 - (NSInteger) numberOfRowsInTableView: (NSTableView *) tableView 199 199 { 200 200 return [fMessages count]; 201 201 } 202 202 203 - (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) column row: ( int) row203 - (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) column row: (NSInteger) row 204 204 { 205 205 NSString * ident = [column identifier]; … … 229 229 230 230 #warning don't cut off end 231 - (float) tableView: (NSTableView *) tableView heightOfRow: ( int) row231 - (float) tableView: (NSTableView *) tableView heightOfRow: (NSInteger) row 232 232 { 233 233 NSTableColumn * column = [tableView tableColumnWithIdentifier: @"Message"]; … … 236 236 fAttributes = [[[[column dataCell] attributedStringValue] attributesAtIndex: 0 effectiveRange: NULL] retain]; 237 237 238 int count = [[[fMessages objectAtIndex: row] objectForKey: @"Message"] sizeWithAttributes: fAttributes].width / [column width]; 239 return [tableView rowHeight] * (float)(count+1); 238 CGFloat count = floorf([[[fMessages objectAtIndex: row] objectForKey: @"Message"] sizeWithAttributes: fAttributes].width 239 / [column width]); 240 return [tableView rowHeight] * (count + 1.0f); 240 241 } 241 242 … … 247 248 248 249 - (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect 249 tableColumn: (NSTableColumn *) column row: ( int) row mouseLocation: (NSPoint) mouseLocation250 tableColumn: (NSTableColumn *) column row: (NSInteger) row mouseLocation: (NSPoint) mouseLocation 250 251 { 251 252 NSDictionary * message = [fMessages objectAtIndex: row]; … … 333 334 } 334 335 335 - (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: ( int) code contextInfo: (NSString *) string336 - (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (NSString *) string 336 337 { 337 338 if (code == NSOKButton) -
trunk/macosx/TorrentCell.m
r6889 r6959 31 31 #import "CTGradientAdditions.h" 32 32 33 #define BAR_HEIGHT 12.0 34 35 #define IMAGE_SIZE_REG 32.0 36 #define IMAGE_SIZE_MIN 16.0 37 38 #define NORMAL_BUTTON_WIDTH 14.0 39 #define ACTION_BUTTON_WIDTH 16.0 33 #define BAR_HEIGHT 12.0f 34 35 #define IMAGE_SIZE_REG 32.0f 36 #define IMAGE_SIZE_MIN 16.0f 37 38 #define NORMAL_BUTTON_WIDTH 14.0f 39 #define ACTION_BUTTON_WIDTH 16.0f 40 40 41 41 //ends up being larger than font height 42 #define HEIGHT_TITLE 16.0 43 #define HEIGHT_STATUS 12.0 44 45 #define PADDING_HORIZONTAL 3.0 46 #define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0 47 #define PADDING_BETWEEN_IMAGE_AND_BAR 7.0 48 #define PADDING_ABOVE_TITLE 4.0 49 #define PADDING_ABOVE_MIN_STATUS 4.0 50 #define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0 51 #define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0 52 #define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0 53 #define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0 54 #define PADDING_BETWEEN_BAR_AND_STATUS 2.0 55 56 #define PIECES_TOTAL_PERCENT 0.6 42 #define HEIGHT_TITLE 16.0f 43 #define HEIGHT_STATUS 12.0f 44 45 #define PADDING_HORIZONTAL 3.0f 46 #define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0f 47 #define PADDING_BETWEEN_IMAGE_AND_BAR 7.0f 48 #define PADDING_ABOVE_TITLE 4.0f 49 #define PADDING_ABOVE_MIN_STATUS 4.0f 50 #define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0f 51 #define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0f 52 #define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0f 53 #define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0f 54 #define PADDING_BETWEEN_BAR_AND_STATUS 2.0f 55 56 #define PIECES_TOTAL_PERCENT 0.6f 57 57 58 58 #define MAX_PIECES (18*18) … … 92 92 93 93 fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: 94 [NSFont messageFontOfSize: 12.0 ], NSFontAttributeName,94 [NSFont messageFontOfSize: 12.0f], NSFontAttributeName, 95 95 paragraphStyle, NSParagraphStyleAttributeName, nil]; 96 96 fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: 97 [NSFont messageFontOfSize: 9.0 ], NSFontAttributeName,97 [NSFont messageFontOfSize: 9.0f], NSFontAttributeName, 98 98 paragraphStyle, NSParagraphStyleAttributeName, nil]; 99 99 [paragraphStyle release]; 100 100 101 fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];102 fBarBorderColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];101 fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0f green: 0.4f blue: 0.8f alpha: 1.0f] retain]; 102 fBarBorderColor = [[NSColor colorWithDeviceWhite: 0.0f alpha: 0.2f] retain]; 103 103 } 104 104 return self; … … 107 107 - (NSRect) iconRectForBounds: (NSRect) bounds 108 108 { 109 float imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG;109 CGFloat imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG; 110 110 111 111 NSRect result = bounds; 112 112 result.origin.x += PADDING_HORIZONTAL; 113 result.origin.y += floorf((result.size.height - imageSize) * 0.5 );113 result.origin.y += floorf((result.size.height - imageSize) * 0.5f); 114 114 result.size = NSMakeSize(imageSize, imageSize); 115 115 … … 155 155 result.origin.y += PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR; 156 156 157 result.size.width = round(NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH));157 result.size.width = round(NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL - 2.0f * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH)); 158 158 159 159 return result; … … 173 173 result.size.height = NORMAL_BUTTON_WIDTH; 174 174 result.size.width = NORMAL_BUTTON_WIDTH; 175 result.origin.x = NSMaxX(bounds) - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);176 177 result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5 ;175 result.origin.x = NSMaxX(bounds) - 2.0f * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH); 176 177 result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f; 178 178 if ([fDefaults boolForKey: @"SmallView"]) 179 179 result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN; … … 191 191 result.origin.x = NSMaxX(bounds) - (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH); 192 192 193 result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5 ;193 result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f; 194 194 if ([fDefaults boolForKey: @"SmallView"]) 195 195 result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN; … … 205 205 if (![fDefaults boolForKey: @"SmallView"]) 206 206 { 207 result.origin.x += (result.size.width - ACTION_BUTTON_WIDTH) * 0.5 ;208 result.origin.y += (result.size.height - ACTION_BUTTON_WIDTH) * 0.5 ;207 result.origin.x += (result.size.width - ACTION_BUTTON_WIDTH) * 0.5f; 208 result.origin.y += (result.size.height - ACTION_BUTTON_WIDTH) * 0.5f; 209 209 result.size.width = ACTION_BUTTON_WIDTH; 210 210 result.size.height = ACTION_BUTTON_WIDTH; … … 384 384 NSRect iconRect = [self iconRectForBounds: cellFrame]; 385 385 386 intgroupValue = [torrent groupValue];386 NSInteger groupValue = [torrent groupValue]; 387 387 if (groupValue != -1) 388 388 { 389 NSRect groupRect = NSInsetRect(iconRect, -1.0 , -2.0);389 NSRect groupRect = NSInsetRect(iconRect, -1.0f, -2.0f); 390 390 if (!minimal) 391 391 { … … 393 393 groupRect.origin.y--; 394 394 } 395 float radius = minimal ? 3.0 : 6.0;395 CGFloat radius = minimal ? 3.0f : 6.0f; 396 396 397 397 NSColor * groupColor = [[GroupsController groups] colorForIndex: groupValue], 398 * darkGroupColor = [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]];398 * darkGroupColor = [groupColor blendedColorWithFraction: 0.2f ofColor: [NSColor whiteColor]]; 399 399 400 400 //border 401 401 NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius]; 402 402 [darkGroupColor set]; 403 [bp setLineWidth: 2.0 ];403 [bp setLineWidth: 2.0f]; 404 404 [bp stroke]; 405 405 406 406 //inside 407 407 bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius]; 408 CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7 408 CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7f 409 409 ofColor: [NSColor whiteColor]] endingColor: darkGroupColor]; 410 [gradient fillBezierPath: bp angle: 90.0 ];410 [gradient fillBezierPath: bp angle: 90.0f]; 411 411 } 412 412 … … 423 423 { 424 424 NSImage * icon = (minimal && error) ? fErrorImage : [torrent icon]; 425 [icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 ];425 [icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f]; 426 426 } 427 427 … … 430 430 NSRect errorRect = NSMakeRect(NSMaxX(iconRect) - IMAGE_SIZE_MIN, NSMaxY(iconRect) - IMAGE_SIZE_MIN, 431 431 IMAGE_SIZE_MIN, IMAGE_SIZE_MIN); 432 [fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 ];432 [fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f]; 433 433 } 434 434 … … 498 498 [controlImage setFlipped: YES]; 499 499 [controlImage drawInRect: [self controlButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver 500 fraction: 1.0 ];500 fraction: 1.0f]; 501 501 502 502 //reveal button … … 512 512 [revealImage setFlipped: YES]; 513 513 [revealImage drawInRect: [self revealButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver 514 fraction: 1.0 ];514 fraction: 1.0f]; 515 515 516 516 //action button … … 528 528 [actionImage setFlipped: YES]; 529 529 [actionImage drawInRect: [self actionButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver 530 fraction: 1.0 ];530 fraction: 1.0f]; 531 531 } 532 532 … … 545 545 - (void) drawBar: (NSRect) barRect 546 546 { 547 float piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent];548 if (piecesBarPercent > 0.0 )547 CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent]; 548 if (piecesBarPercent > 0.0f) 549 549 { 550 550 NSRect regularBarRect = barRect, piecesBarRect = barRect; … … 564 564 565 565 [fBarBorderColor set]; 566 [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5 , 0.5)];566 [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5f, 0.5f)]; 567 567 } 568 568 … … 571 571 Torrent * torrent = [self representedObject]; 572 572 573 intleftWidth = barRect.size.width;574 float progress = [torrent progress];575 576 if (progress < 1.0 )577 { 578 float rightProgress = 1.0- progress, progressLeft = [torrent progressLeft];579 intrightWidth = leftWidth * rightProgress;573 NSInteger leftWidth = barRect.size.width; 574 CGFloat progress = [torrent progress]; 575 576 if (progress < 1.0f) 577 { 578 CGFloat rightProgress = 1.0f - progress, progressLeft = [torrent progressLeft]; 579 NSInteger rightWidth = leftWidth * rightProgress; 580 580 leftWidth -= rightWidth; 581 581 582 582 if (progressLeft < rightProgress) 583 583 { 584 intrightNoIncludeWidth = rightWidth * ((rightProgress - progressLeft) / rightProgress);584 NSInteger rightNoIncludeWidth = rightWidth * ((rightProgress - progressLeft) / rightProgress); 585 585 rightWidth -= rightNoIncludeWidth; 586 586 … … 597 597 && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]) 598 598 { 599 intnotAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]);599 NSInteger notAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]); 600 600 if (notAvailableWidth > 0) 601 601 { … … 632 632 else if ([torrent isSeeding]) 633 633 { 634 int ratioLeftWidth = leftWidth * (1.0- [torrent progressStopRatio]);634 NSInteger ratioLeftWidth = leftWidth * (1.0f - [torrent progressStopRatio]); 635 635 leftWidth -= ratioLeftWidth; 636 636 … … 658 658 if ([torrent waitingToStart]) 659 659 { 660 if ([torrent progressLeft] <= 0.0 )660 if ([torrent progressLeft] <= 0.0f) 661 661 [[CTGradient progressDarkGreenGradient] fillRect: completeRect angle: 90]; 662 662 else … … 673 673 Torrent * torrent = [self representedObject]; 674 674 675 intpieceCount = MIN([torrent pieceCount], MAX_PIECES);676 float * piecesPercent = malloc(pieceCount * sizeof(float));675 NSInteger pieceCount = MIN([torrent pieceCount], MAX_PIECES); 676 CGFloat * piecesPercent = malloc(pieceCount * sizeof(CGFloat)); 677 677 [torrent getAmountFinished: piecesPercent size: pieceCount]; 678 678 … … 687 687 { 688 688 NSColor * pieceColor; 689 if (piecesPercent[i] == 1.0 )689 if (piecesPercent[i] == 1.0f) 690 690 { 691 691 if (previousFinishedIndexes && ![previousFinishedIndexes containsIndex: i])
Note: See TracChangeset
for help on using the changeset viewer.