1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 22:20:39 +00:00

#851 extra adjustment of text placement when quitting

This commit is contained in:
Mitchell Livingston 2008-04-07 21:25:31 +00:00
parent dd1a319d2d
commit 4a146b75c1
2 changed files with 7 additions and 8 deletions

View file

@ -29,7 +29,7 @@
@interface BadgeView (Private) @interface BadgeView (Private)
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height; - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height adjustForQuit: (BOOL) quit;
@end @end
@ -64,7 +64,7 @@
{ {
NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"]; NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"];
[self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit") [self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit")
atHeight: (rect.size.height - [quitBadge size].height) * 0.5]; atHeight: (rect.size.height - [quitBadge size].height) * 0.5 adjustForQuit: YES];
return; return;
} }
@ -81,13 +81,13 @@
if (upload) if (upload)
{ {
NSImage * uploadBadge = [NSImage imageNamed: @"UploadBadge.png"]; NSImage * uploadBadge = [NSImage imageNamed: @"UploadBadge.png"];
[self badge: uploadBadge string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: bottom]; [self badge: uploadBadge string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: bottom adjustForQuit: NO];
if (download) if (download)
bottom += [uploadBadge size].height + BETWEEN_PADDING; //download rate above upload rate bottom += [uploadBadge size].height + BETWEEN_PADDING; //download rate above upload rate
} }
if (download) if (download)
[self badge: [NSImage imageNamed: @"DownloadBadge.png"] string: [NSString stringForSpeedAbbrev: downloadRate] [self badge: [NSImage imageNamed: @"DownloadBadge.png"] string: [NSString stringForSpeedAbbrev: downloadRate]
atHeight: bottom]; atHeight: bottom adjustForQuit: NO];
} }
} }
@ -96,7 +96,7 @@
@implementation BadgeView (Private) @implementation BadgeView (Private)
//dock icon must have locked focus //dock icon must have locked focus
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height adjustForQuit: (BOOL) quit
{ {
if (!fAttributes) if (!fAttributes)
{ {
@ -122,7 +122,7 @@
NSRect stringRect = badgeRect; NSRect stringRect = badgeRect;
stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5; stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5;
stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + 1.0; //adjust for shadow stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + (quit ? 2.0 : 1.0); //adjust for shadow, extra for quit
stringRect.size = stringSize; stringRect.size = stringSize;
[string drawInRect: stringRect withAttributes: fAttributes]; [string drawInRect: stringRect withAttributes: fAttributes];

View file

@ -167,8 +167,7 @@
- (NSToolbarItem *) toolbar: (NSToolbar *) toolbar itemForItemIdentifier: (NSString *) ident willBeInsertedIntoToolbar: (BOOL) flag - (NSToolbarItem *) toolbar: (NSToolbar *) toolbar itemForItemIdentifier: (NSString *) ident willBeInsertedIntoToolbar: (BOOL) flag
{ {
NSToolbarItem * item; NSToolbarItem * item = [[NSToolbarItem alloc] initWithItemIdentifier: ident];
item = [[NSToolbarItem alloc] initWithItemIdentifier: ident];
if ([ident isEqualToString: TOOLBAR_GENERAL]) if ([ident isEqualToString: TOOLBAR_GENERAL])
{ {