trivial code changes

This commit is contained in:
Mitchell Livingston 2008-11-01 14:26:51 +00:00
parent 8ccc1768e7
commit 201302d7c5
4 changed files with 33 additions and 42 deletions

View File

@ -773,10 +773,10 @@
BEFC1E240C07861A00B0BB3C /* bencode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = bencode.c; path = libtransmission/bencode.c; sourceTree = "<group>"; };
D4AF3B2D0C41F7A500D46B6B /* list.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = list.c; path = libtransmission/list.c; sourceTree = "<group>"; };
D4AF3B2E0C41F7A500D46B6B /* list.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = list.h; path = libtransmission/list.h; sourceTree = "<group>"; };
E138A9730C04D88F00C5426C /* CTGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CTGradient.h; sourceTree = "<group>"; };
E138A9740C04D88F00C5426C /* CTGradient.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CTGradient.m; sourceTree = "<group>"; };
E138A9750C04D88F00C5426C /* ProgressGradients.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ProgressGradients.h; path = ../ProgressGradients.h; sourceTree = "<group>"; };
E138A9760C04D88F00C5426C /* ProgressGradients.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ProgressGradients.m; path = ../ProgressGradients.m; sourceTree = "<group>"; };
E138A9730C04D88F00C5426C /* CTGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CTGradient.h; path = macosx/CTGradient/CTGradient.h; sourceTree = "<group>"; };
E138A9740C04D88F00C5426C /* CTGradient.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = CTGradient.m; path = macosx/CTGradient/CTGradient.m; sourceTree = "<group>"; };
E138A9750C04D88F00C5426C /* ProgressGradients.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ProgressGradients.h; path = macosx/ProgressGradients.h; sourceTree = "<group>"; };
E138A9760C04D88F00C5426C /* ProgressGradients.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ProgressGradients.m; path = macosx/ProgressGradients.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -914,8 +914,11 @@
A26AF2220D2DA42800FF7140 /* File Outline View */,
E1B6FBFD0C0D72430015FE4D /* Prefs Window */,
E1B6FC000C0D72A00015FE4D /* Overlay Window */,
E138A9720C04D88F00C5426C /* CTGradient */,
E1B6FBEB0C0D70AC0015FE4D /* UKKQueue */,
E138A9730C04D88F00C5426C /* CTGradient.h */,
E138A9740C04D88F00C5426C /* CTGradient.m */,
E138A9750C04D88F00C5426C /* ProgressGradients.h */,
E138A9760C04D88F00C5426C /* ProgressGradients.m */,
A21282A50CA6C66800EAEE0F /* StatusBarView.h */,
A21282A60CA6C66800EAEE0F /* StatusBarView.m */,
A2ED7D8D0CEF431B00970975 /* FilterButton.h */,
@ -1309,18 +1312,6 @@
name = daemon;
sourceTree = "<group>";
};
E138A9720C04D88F00C5426C /* CTGradient */ = {
isa = PBXGroup;
children = (
E138A9730C04D88F00C5426C /* CTGradient.h */,
E138A9740C04D88F00C5426C /* CTGradient.m */,
E138A9750C04D88F00C5426C /* ProgressGradients.h */,
E138A9760C04D88F00C5426C /* ProgressGradients.m */,
);
name = CTGradient;
path = macosx/CTGradient;
sourceTree = "<group>";
};
E1B6FBEB0C0D70AC0015FE4D /* UKKQueue */ = {
isa = PBXGroup;
children = (

View File

@ -29,13 +29,13 @@
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#define PADDING_HORIZONAL 2.0
#define IMAGE_FOLDER_SIZE 16.0
#define IMAGE_ICON_SIZE 32.0
#define PADDING_BETWEEN_IMAGE_AND_TITLE 4.0
#define PADDING_ABOVE_TITLE_FILE 2.0
#define PADDING_BELOW_STATUS_FILE 2.0
#define PADDING_BETWEEN_NAME_AND_FOLDER_STATUS 4.0
#define PADDING_HORIZONAL 2.0f
#define IMAGE_FOLDER_SIZE 16.0f
#define IMAGE_ICON_SIZE 32.0f
#define PADDING_BETWEEN_IMAGE_AND_TITLE 4.0f
#define PADDING_ABOVE_TITLE_FILE 2.0f
#define PADDING_BELOW_STATUS_FILE 2.0f
#define PADDING_BETWEEN_NAME_AND_FOLDER_STATUS 4.0f
@interface FileNameCell (Private)
@ -57,11 +57,11 @@
[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];
@ -116,8 +116,8 @@
result.origin.x += PADDING_HORIZONAL;
const float IMAGE_SIZE = [(FileListNode *)[self objectValue] isFolder] ? IMAGE_FOLDER_SIZE : IMAGE_ICON_SIZE;
result.origin.y += (result.size.height - IMAGE_SIZE) * 0.5;
const CGFloat IMAGE_SIZE = [(FileListNode *)[self objectValue] isFolder] ? IMAGE_FOLDER_SIZE : IMAGE_ICON_SIZE;
result.origin.y += (result.size.height - IMAGE_SIZE) * 0.5f;
result.size = NSMakeSize(IMAGE_SIZE, IMAGE_SIZE);
return result;
@ -177,7 +177,7 @@
else
{
result.origin.x += PADDING_HORIZONAL + IMAGE_FOLDER_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE;
result.origin.y += (result.size.height - titleSize.height) * 0.5;
result.origin.y += (result.size.height - titleSize.height) * 0.5f;
}
result.size = titleSize;
result.size.width = MIN(result.size.width, NSMaxX(bounds) - result.origin.x - PADDING_HORIZONAL);
@ -200,7 +200,7 @@
else
{
result.origin.x = NSMaxX(titleRect) + PADDING_BETWEEN_NAME_AND_FOLDER_STATUS;
result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0;
result.origin.y = NSMaxY(titleRect) - statusSize.height - 1.0f;
}
result.size = statusSize;
@ -227,8 +227,8 @@
FileListNode * node = (FileListNode *)[self objectValue];
NSString * percentString;
float progress = [torrent fileProgress: node];
percentString = progress == 1.0 ? @"100%" : [NSString localizedStringWithFormat: @"%.2f%%", progress * 100.0];
CGFloat progress = [torrent fileProgress: node];
percentString = progress == 1.0f ? @"100%" : [NSString localizedStringWithFormat: @"%.2f%%", progress * 100.0f];
NSString * status = [NSString localizedStringWithFormat: NSLocalizedString(@"%@ of %@",

View File

@ -30,7 +30,7 @@
#import "QuickLookController.h"
#import "NSApplicationAdditions.h"
#define ROW_SMALL_HEIGHT 18.0
#define ROW_SMALL_HEIGHT 18.0f
typedef enum
{
@ -97,7 +97,7 @@ typedef enum
[fOutline reloadData];
}
- (int) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
- (NSInteger) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
{
if (!item)
return fTorrent ? [[fTorrent fileList] count] : 0;
@ -113,7 +113,7 @@ typedef enum
return [(FileListNode *)item isFolder];
}
- (id) outlineView: (NSOutlineView *) outlineView child: (int) index ofItem: (id) item
- (id) outlineView: (NSOutlineView *) outlineView child: (NSInteger) index ofItem: (id) item
{
return [(item ? [(FileListNode *)item children] : [fTorrent fileList]) objectAtIndex: index];
}
@ -136,7 +136,7 @@ typedef enum
{
[cell setRepresentedObject: item];
int hoveredRow = [fOutline hoveredRow];
NSInteger hoveredRow = [fOutline hoveredRow];
[(FilePriorityCell *)cell setHovered: hoveredRow != -1 && hoveredRow == [fOutline rowForItem: item]];
}
else;
@ -211,7 +211,7 @@ typedef enum
return nil;
}
- (float) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item
- (CGFloat) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item
{
if ([(FileListNode *)item isFolder])
return ROW_SMALL_HEIGHT;
@ -221,7 +221,7 @@ typedef enum
- (void) setCheck: (id) sender
{
int state = [sender tag] == FILE_UNCHECK_TAG ? NSOffState : NSOnState;
NSInteger state = [sender tag] == FILE_UNCHECK_TAG ? NSOffState : NSOnState;
NSIndexSet * indexSet = [fOutline selectedRowIndexes];
NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
@ -250,7 +250,7 @@ typedef enum
- (void) setPriority: (id) sender
{
int priority;
NSInteger priority;
switch ([sender tag])
{
case FILE_PRIORITY_HIGH_TAG:

View File

@ -80,14 +80,14 @@
start = !start;
}
float newY = NSMaxY([self rectOfRow: i-1]);
CGFloat newY = NSMaxY([self rectOfRow: i-1]);
visibleRect.size.height -= newY - visibleRect.origin.y;
visibleRect.origin.y = newY;
}
//remaining visible rows continue alternating
float height = [self rowHeight] + [self intercellSpacing].height;
int numberOfRects = ceil(visibleRect.size.height / height);
CGFloat height = [self rowHeight] + [self intercellSpacing].height;
NSInteger numberOfRects = ceil(visibleRect.size.height / height);
visibleRect.size.height = height;
for (NSInteger i=0; i<numberOfRects; i++)