changing some constants into #define
This commit is contained in:
parent
ea5390296d
commit
c0010329ab
|
@ -25,6 +25,10 @@
|
||||||
#import "Badger.h"
|
#import "Badger.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
|
#define COMPLETED_BOTTOM_PADDING 5.0
|
||||||
|
#define SPEED_BOTTOM_PADDING 2.0
|
||||||
|
#define SPEED_BETWEEN_PADDING 2.0
|
||||||
|
|
||||||
@interface Badger (Private)
|
@interface Badger (Private)
|
||||||
|
|
||||||
- (void) badgeString: (NSString *) string forRect: (NSRect) rect;
|
- (void) badgeString: (NSString *) string forRect: (NSRect) rect;
|
||||||
|
@ -58,8 +62,8 @@
|
||||||
- (void) updateBadge
|
- (void) updateBadge
|
||||||
{
|
{
|
||||||
//set completed badge to top right
|
//set completed badge to top right
|
||||||
BOOL baseChange = fCompleted != fCompletedBadged;
|
BOOL completedChange = fCompleted != fCompletedBadged;
|
||||||
if (baseChange)
|
if (completedChange)
|
||||||
{
|
{
|
||||||
fCompletedBadged = fCompleted;
|
fCompletedBadged = fCompleted;
|
||||||
|
|
||||||
|
@ -88,9 +92,8 @@
|
||||||
[fBadge compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
[fBadge compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||||
|
|
||||||
//ignore shadow of badge when placing string
|
//ignore shadow of badge when placing string
|
||||||
float badgeBottomExtra = 5.0;
|
badgeRect.size.height -= COMPLETED_BOTTOM_PADDING;
|
||||||
badgeRect.size.height -= badgeBottomExtra;
|
badgeRect.origin.y += COMPLETED_BOTTOM_PADDING;
|
||||||
badgeRect.origin.y += badgeBottomExtra;
|
|
||||||
|
|
||||||
//place badge text
|
//place badge text
|
||||||
[self badgeString: [NSString stringWithFormat: @"%d", fCompleted] forRect: badgeRect];
|
[self badgeString: [NSString stringWithFormat: @"%d", fCompleted] forRect: badgeRect];
|
||||||
|
@ -135,9 +138,8 @@
|
||||||
|
|
||||||
//ignore shadow of badge when placing string
|
//ignore shadow of badge when placing string
|
||||||
NSRect stringRect = badgeRect;
|
NSRect stringRect = badgeRect;
|
||||||
float badgeBottomExtra = 2.0;
|
stringRect.size.height -= SPEED_BOTTOM_PADDING;
|
||||||
stringRect.size.height -= badgeBottomExtra;
|
stringRect.origin.y += SPEED_BOTTOM_PADDING;
|
||||||
stringRect.origin.y += badgeBottomExtra;
|
|
||||||
|
|
||||||
[dockIcon lockFocus];
|
[dockIcon lockFocus];
|
||||||
|
|
||||||
|
@ -153,7 +155,7 @@
|
||||||
//download rate above upload rate
|
//download rate above upload rate
|
||||||
if (uploadRateString)
|
if (uploadRateString)
|
||||||
{
|
{
|
||||||
float spaceBetween = badgeRect.size.height + 2.0;
|
float spaceBetween = badgeRect.size.height + SPEED_BETWEEN_PADDING;
|
||||||
badgeRect.origin.y += spaceBetween;
|
badgeRect.origin.y += spaceBetween;
|
||||||
stringRect.origin.y += spaceBetween;
|
stringRect.origin.y += spaceBetween;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +170,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//update dock badge
|
//update dock badge
|
||||||
if (baseChange || fSpeedBadge || speedBadge)
|
if (completedChange || fSpeedBadge || speedBadge)
|
||||||
{
|
{
|
||||||
[NSApp setApplicationIconImage: dockIcon ? dockIcon : fDockIcon];
|
[NSApp setApplicationIconImage: dockIcon ? dockIcon : fDockIcon];
|
||||||
[dockIcon release];
|
[dockIcon release];
|
||||||
|
|
Loading…
Reference in New Issue