Skip to content

Commit

Permalink
Merge pull request #3 from xlc/master
Browse files Browse the repository at this point in the history
fix compiler warnings, memory leaks
  • Loading branch information
zachwaugh committed Dec 20, 2011
2 parents 17bee76 + 2132a53 commit 5363c69
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 217 deletions.
67 changes: 0 additions & 67 deletions English.lproj/Window.nib/classes.nib

This file was deleted.

24 changes: 0 additions & 24 deletions English.lproj/Window.nib/info.nib

This file was deleted.

Binary file modified English.lproj/Window.nib/keyedobjects.nib
Binary file not shown.
2 changes: 1 addition & 1 deletion PSMTabBarControl.xcodeproj/project.pbxproj
Expand Up @@ -483,7 +483,7 @@
0259C573FE90428111CA0C5A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0410;
LastUpgradeCheck = 0420;
};
buildConfigurationList = C056398B08A954F8003078D8 /* Build configuration list for PBXProject "PSMTabBarControl" */;
compatibilityVersion = "Xcode 3.2";
Expand Down
6 changes: 3 additions & 3 deletions source/PSMMetalTabStyle.m
Expand Up @@ -399,15 +399,15 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
// close button - only show if mouse over cell
if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed] && [cell isHighlighted])
{
NSSize closeButtonSize = NSZeroSize;
// NSSize closeButtonSize = NSZeroSize;
NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
NSImage *closeButton = nil;

closeButton = [cell isEdited] ? metalCloseDirtyButton : metalCloseButton;
if ([cell closeButtonOver]) closeButton = [cell isEdited] ? metalCloseDirtyButtonOver : metalCloseButtonOver;
if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? metalCloseDirtyButtonDown : metalCloseButtonDown;

closeButtonSize = [closeButton size];
// closeButtonSize = [closeButton size];
if ([controlView isFlipped]) {
closeButtonRect.origin.y += closeButtonRect.size.height;
}
Expand Down Expand Up @@ -525,7 +525,7 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
[attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
NSMutableParagraphStyle *centeredParagraphStyle = nil;
if (!centeredParagraphStyle) {
centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[centeredParagraphStyle setAlignment:NSCenterTextAlignment];
}
[attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
Expand Down
2 changes: 1 addition & 1 deletion source/PSMTabBarControl.m
Expand Up @@ -912,7 +912,7 @@ - (void)update:(BOOL)animate
NSMutableArray *targetFrames = [NSMutableArray arrayWithCapacity:[_cells count]];

for (NSInteger i = 0; i < [_cells count]; i++) {
currentCell = [_cells objectAtIndex:i];
// currentCell = [_cells objectAtIndex:i];

//we're going from NSRect -> NSValue -> NSRect -> NSValue here - oh well
[targetFrames addObject:[NSValue valueWithRect:[_controller cellFrameAtIndex:i]]];
Expand Down
2 changes: 1 addition & 1 deletion source/PSMTabBarController.h
Expand Up @@ -10,7 +10,7 @@

@class PSMTabBarControl, PSMTabBarCell;

@interface PSMTabBarController : NSObject {
@interface PSMTabBarController : NSObject <NSMenuDelegate> {
PSMTabBarControl *_control;
NSMutableArray *_cellTrackingRects, *_closeButtonTrackingRects;
NSMutableArray *_cellFrames;
Expand Down
8 changes: 6 additions & 2 deletions source/PSMTabBarController.m
Expand Up @@ -87,6 +87,8 @@ - (NSRect)cellTrackingRectAtIndex:(NSInteger)index
NSRect rect;
if (index > -1 && index < [_cellTrackingRects count]) {
rect = [[_cellTrackingRects objectAtIndex:index] rectValue];
} else if (index >= [_cellTrackingRects count]) {
rect = [[_cellTrackingRects lastObject] rectValue];
} else {
NSLog(@"cellTrackingRectAtIndex: Invalid index (%ld)", (long)index);
rect = NSZeroRect;
Expand All @@ -107,6 +109,8 @@ - (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index
NSRect rect;
if (index > -1 && index < [_closeButtonTrackingRects count]) {
rect = [[_closeButtonTrackingRects objectAtIndex:index] rectValue];
} else if (index >= [_closeButtonTrackingRects count]) {
rect = [[_closeButtonTrackingRects lastObject] rectValue];
} else {
NSLog(@"closeButtonTrackingRectAtIndex: Invalid index (%ld)", (long)index);
rect = NSZeroRect;
Expand Down Expand Up @@ -342,7 +346,7 @@ - (NSArray *)_generateWidthsFromCells:(NSArray *)cells
[newWidths addObject:[NSNumber numberWithDouble:(desiredWidth < averageWidth && [_control sizeCellsToFit]) ? desiredWidth : averageWidth]];
}

totalOccupiedWidth = [[newWidths valueForKeyPath:@"@sum.intValue"] integerValue];
// totalOccupiedWidth = [[newWidths valueForKeyPath:@"@sum.intValue"] integerValue];
break;
}

Expand Down Expand Up @@ -503,7 +507,7 @@ - (NSArray *)_generateWidthsFromCells:(NSArray *)cells
[newWidths replaceObjectAtIndex:0 withObject:[NSNumber numberWithDouble:availableWidth - [cellWidth doubleValue]]];
}

numberOfVisibleCells = 2;
// numberOfVisibleCells = 2;
}
}

Expand Down

0 comments on commit 5363c69

Please sign in to comment.