Skip to content
This repository was archived by the owner on Nov 19, 2019. It is now read-only.

Commit b27b0eb

Browse files
author
Frank Dowsett
committed
AdiumTabStyle: Enforce a width for the large image.
This keeps the text lined up and better centres the image.
1 parent 12ee3ec commit b27b0eb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Source/PSMAdiumTabStyle.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// #define Adium_CellPadding 2
1414
#define Adium_MARGIN_X 4
1515
#define kPSMAdiumCounterPadding 3.0
16+
#define kPSMAdiumImageWidth 20.0
1617

1718
@interface PSMTabBarCell(SharedPrivates)
1819

@@ -350,8 +351,8 @@ - (NSRect)titleRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell {
350351

351352
NSRect largeImageRect = [cell largeImageRectForBounds:theRect];
352353
if (!NSEqualRects(largeImageRect, NSZeroRect)) {
353-
constrainedDrawingRect.origin.x += NSWidth(largeImageRect) + kPSMTabBarCellPadding;
354-
constrainedDrawingRect.size.width -= NSWidth(largeImageRect) + kPSMTabBarCellPadding;
354+
constrainedDrawingRect.origin.x += kPSMAdiumImageWidth + kPSMTabBarCellPadding;
355+
constrainedDrawingRect.size.width -= kPSMAdiumImageWidth + kPSMTabBarCellPadding;
355356
}
356357

357358
if (orientation == PSMTabBarHorizontalOrientation) {
@@ -456,8 +457,8 @@ -(NSRect)largeImageRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell
456457
constrainedDrawingRect.origin.y - ((constrainedDrawingRect.size.height - scaledImageSize.height) / 2),
457458
scaledImageSize.width, scaledImageSize.height);
458459

459-
if(scaledImageSize.width < kPSMTabBarIconWidth) {
460-
result.origin.x += (kPSMTabBarIconWidth - scaledImageSize.width) / 2.0;
460+
if(scaledImageSize.width < kPSMAdiumImageWidth) {
461+
result.origin.x += (kPSMTabBarCellPadding + kPSMAdiumImageWidth - scaledImageSize.width) / 2.0;
461462
}
462463
if(scaledImageSize.height < constrainedDrawingRect.size.height) {
463464
result.origin.y += (constrainedDrawingRect.size.height - scaledImageSize.height) / 2.0;

0 commit comments

Comments
 (0)