Permalink
Browse files

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.
  • Loading branch information...
1 parent 25150b0 commit 259f4dee7cd3318b9a303f1234e745178fe08f6e @b4winckler committed Aug 17, 2012
No changes.
No changes.
@@ -333,7 +333,7 @@ - (void)drawTabCell:(PSMTabBarCell *)cell;
}
[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 @@ - (void)drawTabCell:(PSMTabBarCell *)cell;
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 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
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)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
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 @@ - (void)drawRect:(NSRect)rect
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 @@ - (NSSize)stringSize
- (NSAttributedString *)attributedStringValue
{
- return [(id <PSMTabStyle>)[_controlView style] attributedStringValueForTabCell:self];
+ return [[_controlView psmTabStyle] attributedStringValueForTabCell:self];
}
- (int)tabState
@@ -271,22 +271,22 @@ - (void)setToolTip:(NSString *)tip
- (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 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
return;
}
- [(id <PSMTabStyle>)[_controlView style] drawTabCell:self];
+ [[_controlView psmTabStyle] drawTabCell:self];
}
#pragma mark -
@@ -344,15 +344,15 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
[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"]];
[returnImage lockFocus];
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 @@ - (void)setTabView:(NSTabView *)view
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 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control
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 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control
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 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
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;

0 comments on commit 259f4de

Please sign in to comment.