Fix warnings etc in PSMTabBarControl framework

This also gets rid of a runtime warning that would get logged on OS X
10.8 regarding the use of a deprecated method.
This commit is contained in:
Bjorn Winckler
2012-08-17 18:37:44 +02:00
parent 25150b07cf
commit 259f4dee7c
11 changed files with 24 additions and 35 deletions
View File
View File
@@ -333,7 +333,7 @@
}
[bgImage drawInRect:cellFrame fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0];
[aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
[aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
aRect.size.height+=0.5;
@@ -353,7 +353,7 @@
NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
}
[aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
[aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
}
[self drawInteriorWithTabCell:cell inView:[cell controlView]];
@@ -408,11 +408,8 @@
if([cell closeButtonPressed]) closeButton = aquaCloseButtonDown;
closeButtonSize = [closeButton size];
if([controlView isFlipped]) {
closeButtonRect.origin.y += closeButtonRect.size.height;
}
[closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
[closeButton setFlipped:YES];
[closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
@@ -393,11 +393,8 @@ void MyNSDrawWindowBackground(NSRect rect)
if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown;
closeButtonSize = [closeButton size];
if ([controlView isFlipped]) {
closeButtonRect.origin.y += closeButtonRect.size.height;
}
[closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
[closeButton setFlipped:YES];
[closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
@@ -43,10 +43,8 @@
NSSize imageSize = [image size];
rect.origin.x = NSMidX(rect) - (imageSize.width * 0.5);
rect.origin.y = NSMidY(rect) - (imageSize.height * 0.5);
if([self isFlipped]) {
rect.origin.y += imageSize.height;
}
[image compositeToPoint:rect.origin operation:NSCompositeSourceOver];
[image setFlipped:YES];
[image drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
}
- (void)mouseDown:(NSEvent *)event
@@ -100,6 +100,6 @@
@interface PSMTabBarControl (CellAccessors)
- (id<PSMTabStyle>)style;
- (id<PSMTabStyle>)psmTabStyle;
@end
@@ -137,7 +137,7 @@
- (NSAttributedString *)attributedStringValue
{
return [(id <PSMTabStyle>)[_controlView style] attributedStringValueForTabCell:self];
return [[_controlView psmTabStyle] attributedStringValueForTabCell:self];
}
- (int)tabState
@@ -271,22 +271,22 @@
- (NSRect)indicatorRectForFrame:(NSRect)cellFrame
{
return [(id <PSMTabStyle>)[_controlView style] indicatorRectForTabCell:self];
return [[_controlView psmTabStyle] indicatorRectForTabCell:self];
}
- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame
{
return [(id <PSMTabStyle>)[_controlView style] closeButtonRectForTabCell:self];
return [[_controlView psmTabStyle] closeButtonRectForTabCell:self];
}
- (float)minimumWidthOfCell
{
return [(id <PSMTabStyle>)[_controlView style] minimumWidthOfTabCell:self];
return [[_controlView psmTabStyle] minimumWidthOfTabCell:self];
}
- (float)desiredWidthOfCell
{
return [(id <PSMTabStyle>)[_controlView style] desiredWidthOfTabCell:self];
return [[_controlView psmTabStyle] desiredWidthOfTabCell:self];
}
#pragma mark -
@@ -300,7 +300,7 @@
return;
}
[(id <PSMTabStyle>)[_controlView style] drawTabCell:self];
[[_controlView psmTabStyle] drawTabCell:self];
}
#pragma mark -
@@ -344,7 +344,7 @@
[image addRepresentation:rep];
NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
[returnImage lockFocus];
[image compositeToPoint:NSMakePoint(0.0, 0.0) operation:NSCompositeSourceOver fraction:0.7];
[image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7];
[returnImage unlockFocus];
if(![[self indicator] isHidden]){
NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
@@ -352,7 +352,7 @@
NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y);
if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
indicatorPoint.y += 1.0;
[pi compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:0.7];
[pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7];
[returnImage unlockFocus];
[pi release];
}
@@ -242,7 +242,7 @@
tabView = view;
}
- (id<PSMTabStyle>)style
- (id<PSMTabStyle>)psmTabStyle
{
return style;
}
@@ -74,7 +74,7 @@
@interface PSMTabBarControl (DragAccessors)
- (id<PSMTabStyle>)style;
- (id<PSMTabStyle>)psmTabStyle;
- (NSMutableArray *)cells;
- (void)setControlView:(id)view;
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
@@ -280,14 +280,14 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
BOOL removeFlag = YES;
NSMutableArray *cells = [control cells];
int i, cellCount = [cells count];
float xPos = [[control style] leftMarginForTabBarControl];
float xPos = [[control psmTabStyle] leftMarginForTabBarControl];
// identify target cell
// mouse at beginning of tabs
NSPoint mouseLoc = [self currentMouseLoc];
if([self destinationTabBar] == control){
removeFlag = NO;
if(mouseLoc.x < [[control style] leftMarginForTabBarControl]){
if(mouseLoc.x < [[control psmTabStyle] leftMarginForTabBarControl]){
[self setTargetCell:[cells objectAtIndex:0]];
goto layout;
}
@@ -342,7 +342,7 @@ layout:
newRect.origin.x = xPos;
[cell setFrame:newRect];
if([cell indicator])
[[cell indicator] setFrame:[[control style] indicatorRectForTabCell:cell]];
[[cell indicator] setFrame:[[control psmTabStyle] indicatorRectForTabCell:cell]];
xPos += newRect.size.width;
}
if(removeFlag){
@@ -389,11 +389,8 @@
if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown;
closeButtonSize = [closeButton size];
if ([controlView isFlipped]) {
closeButtonRect.origin.y += closeButtonRect.size.height;
}
[closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
[closeButton setFlipped:YES];
[closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;