update some floats to CGFloats; append "f" to some float constants
This commit is contained in:
parent
46f80eb754
commit
99982b55a8
|
@ -53,7 +53,7 @@ AboutWindowController * fAboutBoxInstance = nil;
|
|||
[fLicenseButton sizeToFit];
|
||||
|
||||
NSRect buttonFrame = [fLicenseButton frame];
|
||||
buttonFrame.size.width += 10.0;
|
||||
buttonFrame.size.width += 10.0f;
|
||||
buttonFrame.origin.x -= buttonFrame.size.width - oldButtonWidth;
|
||||
[fLicenseButton setFrame: buttonFrame];
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
|
||||
NSDictionary * fAttributes;
|
||||
|
||||
float fDownloadRate, fUploadRate;
|
||||
CGFloat fDownloadRate, fUploadRate;
|
||||
BOOL fQuitting;
|
||||
}
|
||||
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib;
|
||||
|
||||
- (BOOL) setRatesWithDownload: (float) downloadRate upload: (float) uploadRate;
|
||||
- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate;
|
||||
- (void) setQuitting;
|
||||
|
||||
@end
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#import "BadgeView.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
#define BETWEEN_PADDING 2.0
|
||||
#define BETWEEN_PADDING 2.0f
|
||||
|
||||
@interface BadgeView (Private)
|
||||
|
||||
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height adjustForQuit: (BOOL) quit;
|
||||
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL) setRatesWithDownload: (float) downloadRate upload: (float) uploadRate
|
||||
- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate
|
||||
{
|
||||
//only needs update if the badges were displayed or are displayed now
|
||||
BOOL needsUpdate = fDownloadRate != downloadRate || fUploadRate != uploadRate;
|
||||
|
@ -80,13 +80,13 @@
|
|||
{
|
||||
NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"];
|
||||
[self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit")
|
||||
atHeight: (rect.size.height - [quitBadge size].height) * 0.5 adjustForQuit: YES];
|
||||
atHeight: (rect.size.height - [quitBadge size].height) * 0.5f adjustForQuit: YES];
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL upload = fUploadRate >= 0.1,
|
||||
download = fDownloadRate >= 0.1;
|
||||
float bottom = 0.0;
|
||||
BOOL upload = fUploadRate >= 0.1f,
|
||||
download = fDownloadRate >= 0.1f;
|
||||
CGFloat bottom = 0.0f;
|
||||
if (upload)
|
||||
{
|
||||
NSImage * uploadBadge = [NSImage imageNamed: @"UploadBadge.png"];
|
||||
|
@ -104,17 +104,17 @@
|
|||
@implementation BadgeView (Private)
|
||||
|
||||
//dock icon must have locked focus
|
||||
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height adjustForQuit: (BOOL) quit
|
||||
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (CGFloat) height adjustForQuit: (BOOL) quit
|
||||
{
|
||||
if (!fAttributes)
|
||||
{
|
||||
NSShadow * stringShadow = [[NSShadow alloc] init];
|
||||
[stringShadow setShadowOffset: NSMakeSize(2.0, -2.0)];
|
||||
[stringShadow setShadowBlurRadius: 4.0];
|
||||
[stringShadow setShadowOffset: NSMakeSize(2.0f, -2.0f)];
|
||||
[stringShadow setShadowBlurRadius: 4.0f];
|
||||
|
||||
fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor whiteColor], NSForegroundColorAttributeName,
|
||||
[NSFont boldSystemFontOfSize: 26.0], NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
|
||||
[NSFont boldSystemFontOfSize: 26.0f], NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
|
||||
|
||||
[stringShadow release];
|
||||
}
|
||||
|
@ -123,14 +123,14 @@
|
|||
badgeRect.size = [badge size];
|
||||
badgeRect.origin.y = height;
|
||||
|
||||
[badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
[badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
|
||||
|
||||
//string is in center of image
|
||||
NSSize stringSize = [string sizeWithAttributes: fAttributes];
|
||||
|
||||
NSRect stringRect = badgeRect;
|
||||
stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5;
|
||||
stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + (quit ? 2.0 : 1.0); //adjust for shadow, extra for quit
|
||||
stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5f;
|
||||
stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5f + (quit ? 2.0f : 1.0f); //adjust for shadow, extra for quit
|
||||
stringRect.size = stringSize;
|
||||
|
||||
[string drawInRect: stringRect withAttributes: fAttributes];
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
IBOutlet NSButton * fSaveButton, * fClearButton;
|
||||
|
||||
NSMutableArray * fMessages;
|
||||
unsigned int fIndex;
|
||||
NSUInteger fIndex;
|
||||
|
||||
NSDictionary * fAttributes;
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@
|
|||
NSScroller * scroller = [[fMessageTable enclosingScrollView] verticalScroller];
|
||||
BOOL shouldScroll = [scroller floatValue] == 1.0 || [scroller isHidden] || [scroller knobProportion] == 1.0;
|
||||
|
||||
int total = [fMessages count];
|
||||
NSUInteger total = [fMessages count];
|
||||
if (total > MAX_MESSAGES)
|
||||
{
|
||||
//remove the oldest
|
||||
|
@ -195,12 +195,12 @@
|
|||
[fMessageTable scrollRowToVisible: total-1];
|
||||
}
|
||||
|
||||
- (int) numberOfRowsInTableView: (NSTableView *) tableView
|
||||
- (NSInteger) numberOfRowsInTableView: (NSTableView *) tableView
|
||||
{
|
||||
return [fMessages count];
|
||||
}
|
||||
|
||||
- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) column row: (int) row
|
||||
- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) column row: (NSInteger) row
|
||||
{
|
||||
NSString * ident = [column identifier];
|
||||
NSDictionary * message = [fMessages objectAtIndex: row];
|
||||
|
@ -228,15 +228,16 @@
|
|||
}
|
||||
|
||||
#warning don't cut off end
|
||||
- (float) tableView: (NSTableView *) tableView heightOfRow: (int) row
|
||||
- (float) tableView: (NSTableView *) tableView heightOfRow: (NSInteger) row
|
||||
{
|
||||
NSTableColumn * column = [tableView tableColumnWithIdentifier: @"Message"];
|
||||
|
||||
if (!fAttributes)
|
||||
fAttributes = [[[[column dataCell] attributedStringValue] attributesAtIndex: 0 effectiveRange: NULL] retain];
|
||||
|
||||
int count = [[[fMessages objectAtIndex: row] objectForKey: @"Message"] sizeWithAttributes: fAttributes].width / [column width];
|
||||
return [tableView rowHeight] * (float)(count+1);
|
||||
CGFloat count = floorf([[[fMessages objectAtIndex: row] objectForKey: @"Message"] sizeWithAttributes: fAttributes].width
|
||||
/ [column width]);
|
||||
return [tableView rowHeight] * (count + 1.0f);
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView *) tableView sortDescriptorsDidChange: (NSArray *) oldDescriptors
|
||||
|
@ -246,7 +247,7 @@
|
|||
}
|
||||
|
||||
- (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
|
||||
tableColumn: (NSTableColumn *) column row: (int) row mouseLocation: (NSPoint) mouseLocation
|
||||
tableColumn: (NSTableColumn *) column row: (NSInteger) row mouseLocation: (NSPoint) mouseLocation
|
||||
{
|
||||
NSDictionary * message = [fMessages objectAtIndex: row];
|
||||
return [NSString stringWithFormat: @"%@:%@", [[message objectForKey: @"File"] lastPathComponent], [message objectForKey: @"Line"]];
|
||||
|
@ -332,7 +333,7 @@
|
|||
didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: fileString];
|
||||
}
|
||||
|
||||
- (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSString *) string
|
||||
- (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (NSString *) string
|
||||
{
|
||||
if (code == NSOKButton)
|
||||
{
|
||||
|
|
|
@ -30,30 +30,30 @@
|
|||
#import "NSBezierPathAdditions.h"
|
||||
#import "CTGradientAdditions.h"
|
||||
|
||||
#define BAR_HEIGHT 12.0
|
||||
#define BAR_HEIGHT 12.0f
|
||||
|
||||
#define IMAGE_SIZE_REG 32.0
|
||||
#define IMAGE_SIZE_MIN 16.0
|
||||
#define IMAGE_SIZE_REG 32.0f
|
||||
#define IMAGE_SIZE_MIN 16.0f
|
||||
|
||||
#define NORMAL_BUTTON_WIDTH 14.0
|
||||
#define ACTION_BUTTON_WIDTH 16.0
|
||||
#define NORMAL_BUTTON_WIDTH 14.0f
|
||||
#define ACTION_BUTTON_WIDTH 16.0f
|
||||
|
||||
//ends up being larger than font height
|
||||
#define HEIGHT_TITLE 16.0
|
||||
#define HEIGHT_STATUS 12.0
|
||||
#define HEIGHT_TITLE 16.0f
|
||||
#define HEIGHT_STATUS 12.0f
|
||||
|
||||
#define PADDING_HORIZONTAL 3.0
|
||||
#define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0
|
||||
#define PADDING_BETWEEN_IMAGE_AND_BAR 7.0
|
||||
#define PADDING_ABOVE_TITLE 4.0
|
||||
#define PADDING_ABOVE_MIN_STATUS 4.0
|
||||
#define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0
|
||||
#define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0
|
||||
#define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0
|
||||
#define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0
|
||||
#define PADDING_BETWEEN_BAR_AND_STATUS 2.0
|
||||
#define PADDING_HORIZONTAL 3.0f
|
||||
#define PADDING_BETWEEN_IMAGE_AND_TITLE 5.0f
|
||||
#define PADDING_BETWEEN_IMAGE_AND_BAR 7.0f
|
||||
#define PADDING_ABOVE_TITLE 4.0f
|
||||
#define PADDING_ABOVE_MIN_STATUS 4.0f
|
||||
#define PADDING_BETWEEN_TITLE_AND_MIN_STATUS 2.0f
|
||||
#define PADDING_BETWEEN_TITLE_AND_PROGRESS 1.0f
|
||||
#define PADDING_BETWEEN_PROGRESS_AND_BAR 2.0f
|
||||
#define PADDING_BETWEEN_TITLE_AND_BAR_MIN 3.0f
|
||||
#define PADDING_BETWEEN_BAR_AND_STATUS 2.0f
|
||||
|
||||
#define PIECES_TOTAL_PERCENT 0.6
|
||||
#define PIECES_TOTAL_PERCENT 0.6f
|
||||
|
||||
#define MAX_PIECES (18*18)
|
||||
|
||||
|
@ -91,26 +91,26 @@
|
|||
[paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
|
||||
|
||||
fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSFont messageFontOfSize: 12.0], NSFontAttributeName,
|
||||
[NSFont messageFontOfSize: 12.0f], NSFontAttributeName,
|
||||
paragraphStyle, NSParagraphStyleAttributeName, nil];
|
||||
fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSFont messageFontOfSize: 9.0], NSFontAttributeName,
|
||||
[NSFont messageFontOfSize: 9.0f], NSFontAttributeName,
|
||||
paragraphStyle, NSParagraphStyleAttributeName, nil];
|
||||
[paragraphStyle release];
|
||||
|
||||
fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
|
||||
fBarBorderColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];
|
||||
fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0f green: 0.4f blue: 0.8f alpha: 1.0f] retain];
|
||||
fBarBorderColor = [[NSColor colorWithDeviceWhite: 0.0f alpha: 0.2f] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSRect) iconRectForBounds: (NSRect) bounds
|
||||
{
|
||||
float imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG;
|
||||
CGFloat imageSize = [fDefaults boolForKey: @"SmallView"] ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG;
|
||||
|
||||
NSRect result = bounds;
|
||||
result.origin.x += PADDING_HORIZONTAL;
|
||||
result.origin.y += floorf((result.size.height - imageSize) * 0.5);
|
||||
result.origin.y += floorf((result.size.height - imageSize) * 0.5f);
|
||||
result.size = NSMakeSize(imageSize, imageSize);
|
||||
|
||||
return result;
|
||||
|
@ -154,7 +154,7 @@
|
|||
else
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_PROGRESS + HEIGHT_STATUS + PADDING_BETWEEN_PROGRESS_AND_BAR;
|
||||
|
||||
result.size.width = round(NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH));
|
||||
result.size.width = round(NSMaxX(bounds) - result.origin.x - PADDING_HORIZONTAL - 2.0f * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -172,9 +172,9 @@
|
|||
NSRect result = bounds;
|
||||
result.size.height = NORMAL_BUTTON_WIDTH;
|
||||
result.size.width = NORMAL_BUTTON_WIDTH;
|
||||
result.origin.x = NSMaxX(bounds) - 2.0 * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
result.origin.x = NSMaxX(bounds) - 2.0f * (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
|
||||
result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5;
|
||||
result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
|
||||
if ([fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
|
||||
else
|
||||
|
@ -190,7 +190,7 @@
|
|||
result.size.width = NORMAL_BUTTON_WIDTH;
|
||||
result.origin.x = NSMaxX(bounds) - (PADDING_HORIZONTAL + NORMAL_BUTTON_WIDTH);
|
||||
|
||||
result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5;
|
||||
result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE - (NORMAL_BUTTON_WIDTH - BAR_HEIGHT) * 0.5f;
|
||||
if ([fDefaults boolForKey: @"SmallView"])
|
||||
result.origin.y += PADDING_BETWEEN_TITLE_AND_BAR_MIN;
|
||||
else
|
||||
|
@ -204,8 +204,8 @@
|
|||
NSRect result = [self iconRectForBounds: bounds];
|
||||
if (![fDefaults boolForKey: @"SmallView"])
|
||||
{
|
||||
result.origin.x += (result.size.width - ACTION_BUTTON_WIDTH) * 0.5;
|
||||
result.origin.y += (result.size.height - ACTION_BUTTON_WIDTH) * 0.5;
|
||||
result.origin.x += (result.size.width - ACTION_BUTTON_WIDTH) * 0.5f;
|
||||
result.origin.y += (result.size.height - ACTION_BUTTON_WIDTH) * 0.5f;
|
||||
result.size.width = ACTION_BUTTON_WIDTH;
|
||||
result.size.height = ACTION_BUTTON_WIDTH;
|
||||
}
|
||||
|
@ -383,31 +383,31 @@
|
|||
//group coloring
|
||||
NSRect iconRect = [self iconRectForBounds: cellFrame];
|
||||
|
||||
int groupValue = [torrent groupValue];
|
||||
NSInteger groupValue = [torrent groupValue];
|
||||
if (groupValue != -1)
|
||||
{
|
||||
NSRect groupRect = NSInsetRect(iconRect, -1.0, -2.0);
|
||||
NSRect groupRect = NSInsetRect(iconRect, -1.0f, -2.0f);
|
||||
if (!minimal)
|
||||
{
|
||||
groupRect.size.height--;
|
||||
groupRect.origin.y--;
|
||||
}
|
||||
float radius = minimal ? 3.0 : 6.0;
|
||||
CGFloat radius = minimal ? 3.0f : 6.0f;
|
||||
|
||||
NSColor * groupColor = [[GroupsController groups] colorForIndex: groupValue],
|
||||
* darkGroupColor = [groupColor blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]];
|
||||
* darkGroupColor = [groupColor blendedColorWithFraction: 0.2f ofColor: [NSColor whiteColor]];
|
||||
|
||||
//border
|
||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
|
||||
[darkGroupColor set];
|
||||
[bp setLineWidth: 2.0];
|
||||
[bp setLineWidth: 2.0f];
|
||||
[bp stroke];
|
||||
|
||||
//inside
|
||||
bp = [NSBezierPath bezierPathWithRoundedRect: groupRect radius: radius];
|
||||
CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7
|
||||
CTGradient * gradient = [CTGradient gradientWithBeginningColor: [groupColor blendedColorWithFraction: 0.7f
|
||||
ofColor: [NSColor whiteColor]] endingColor: darkGroupColor];
|
||||
[gradient fillBezierPath: bp angle: 90.0];
|
||||
[gradient fillBezierPath: bp angle: 90.0f];
|
||||
}
|
||||
|
||||
//error image
|
||||
|
@ -422,14 +422,14 @@
|
|||
if (!minimal || !(!fTracking && fHoverAction)) //don't show in minimal mode when hovered over
|
||||
{
|
||||
NSImage * icon = (minimal && error) ? fErrorImage : [torrent icon];
|
||||
[icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
[icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
|
||||
}
|
||||
|
||||
if (error && !minimal)
|
||||
{
|
||||
NSRect errorRect = NSMakeRect(NSMaxX(iconRect) - IMAGE_SIZE_MIN, NSMaxY(iconRect) - IMAGE_SIZE_MIN,
|
||||
IMAGE_SIZE_MIN, IMAGE_SIZE_MIN);
|
||||
[fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
|
||||
[fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
|
||||
}
|
||||
|
||||
//text color
|
||||
|
@ -497,7 +497,7 @@
|
|||
|
||||
[controlImage setFlipped: YES];
|
||||
[controlImage drawInRect: [self controlButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
fraction: 1.0f];
|
||||
|
||||
//reveal button
|
||||
NSString * revealImageString;
|
||||
|
@ -511,7 +511,7 @@
|
|||
NSImage * revealImage = [NSImage imageNamed: revealImageString];
|
||||
[revealImage setFlipped: YES];
|
||||
[revealImage drawInRect: [self revealButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
fraction: 1.0f];
|
||||
|
||||
//action button
|
||||
NSString * actionImageString;
|
||||
|
@ -527,7 +527,7 @@
|
|||
NSImage * actionImage = [NSImage imageNamed: actionImageString];
|
||||
[actionImage setFlipped: YES];
|
||||
[actionImage drawInRect: [self actionButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
fraction: 1.0f];
|
||||
}
|
||||
|
||||
//status
|
||||
|
@ -544,8 +544,8 @@
|
|||
|
||||
- (void) drawBar: (NSRect) barRect
|
||||
{
|
||||
float piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent];
|
||||
if (piecesBarPercent > 0.0)
|
||||
CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent];
|
||||
if (piecesBarPercent > 0.0f)
|
||||
{
|
||||
NSRect regularBarRect = barRect, piecesBarRect = barRect;
|
||||
piecesBarRect.size.height *= PIECES_TOTAL_PERCENT * piecesBarPercent;
|
||||
|
@ -563,25 +563,25 @@
|
|||
}
|
||||
|
||||
[fBarBorderColor set];
|
||||
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
|
||||
[NSBezierPath strokeRect: NSInsetRect(barRect, 0.5f, 0.5f)];
|
||||
}
|
||||
|
||||
- (void) drawRegularBar: (NSRect) barRect
|
||||
{
|
||||
Torrent * torrent = [self representedObject];
|
||||
|
||||
int leftWidth = barRect.size.width;
|
||||
float progress = [torrent progress];
|
||||
NSInteger leftWidth = barRect.size.width;
|
||||
CGFloat progress = [torrent progress];
|
||||
|
||||
if (progress < 1.0)
|
||||
if (progress < 1.0f)
|
||||
{
|
||||
float rightProgress = 1.0 - progress, progressLeft = [torrent progressLeft];
|
||||
int rightWidth = leftWidth * rightProgress;
|
||||
CGFloat rightProgress = 1.0f - progress, progressLeft = [torrent progressLeft];
|
||||
NSInteger rightWidth = leftWidth * rightProgress;
|
||||
leftWidth -= rightWidth;
|
||||
|
||||
if (progressLeft < rightProgress)
|
||||
{
|
||||
int rightNoIncludeWidth = rightWidth * ((rightProgress - progressLeft) / rightProgress);
|
||||
NSInteger rightNoIncludeWidth = rightWidth * ((rightProgress - progressLeft) / rightProgress);
|
||||
rightWidth -= rightNoIncludeWidth;
|
||||
|
||||
NSRect noIncludeRect = barRect;
|
||||
|
@ -596,7 +596,7 @@
|
|||
if ([torrent isActive] && ![torrent allDownloaded] && ![torrent isChecking]
|
||||
&& [fDefaults boolForKey: @"DisplayProgressBarAvailable"])
|
||||
{
|
||||
int notAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]);
|
||||
NSInteger notAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]);
|
||||
if (notAvailableWidth > 0)
|
||||
{
|
||||
rightWidth -= notAvailableWidth;
|
||||
|
@ -631,7 +631,7 @@
|
|||
[[CTGradient progressYellowGradient] fillRect: completeRect angle: 90];
|
||||
else if ([torrent isSeeding])
|
||||
{
|
||||
int ratioLeftWidth = leftWidth * (1.0 - [torrent progressStopRatio]);
|
||||
NSInteger ratioLeftWidth = leftWidth * (1.0f - [torrent progressStopRatio]);
|
||||
leftWidth -= ratioLeftWidth;
|
||||
|
||||
if (ratioLeftWidth > 0)
|
||||
|
@ -657,7 +657,7 @@
|
|||
{
|
||||
if ([torrent waitingToStart])
|
||||
{
|
||||
if ([torrent progressLeft] <= 0.0)
|
||||
if ([torrent progressLeft] <= 0.0f)
|
||||
[[CTGradient progressDarkGreenGradient] fillRect: completeRect angle: 90];
|
||||
else
|
||||
[[CTGradient progressDarkBlueGradient] fillRect: completeRect angle: 90];
|
||||
|
@ -672,8 +672,8 @@
|
|||
{
|
||||
Torrent * torrent = [self representedObject];
|
||||
|
||||
int pieceCount = MIN([torrent pieceCount], MAX_PIECES);
|
||||
float * piecesPercent = malloc(pieceCount * sizeof(float));
|
||||
NSInteger pieceCount = MIN([torrent pieceCount], MAX_PIECES);
|
||||
CGFloat * piecesPercent = malloc(pieceCount * sizeof(CGFloat));
|
||||
[torrent getAmountFinished: piecesPercent size: pieceCount];
|
||||
|
||||
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: nil
|
||||
|
@ -686,7 +686,7 @@
|
|||
for (NSInteger i = 0; i < pieceCount; i++)
|
||||
{
|
||||
NSColor * pieceColor;
|
||||
if (piecesPercent[i] == 1.0)
|
||||
if (piecesPercent[i] == 1.0f)
|
||||
{
|
||||
if (previousFinishedIndexes && ![previousFinishedIndexes containsIndex: i])
|
||||
pieceColor = [NSColor orangeColor];
|
||||
|
|
Loading…
Reference in New Issue