From 5c8a9b1a15ffd1ecf96340d3f43a4ca916665b9b Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 10 Feb 2014 01:38:10 +0000 Subject: Fix run-time warnings due to use of deprecated [NSImage compositeToPoint:...] operations --- Frameworks/PSMTabBar/PSMOverflowPopUpButton.m | 14 ++++---------- Frameworks/PSMTabBar/PSMTabBarCell.m | 3 ++- Frameworks/PSMTabBar/PSMTabDragAssistant.m | 6 ++++-- Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m | 14 +++----------- Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m | 15 ++++----------- Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m | 16 +++++----------- Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m | 13 +++++-------- Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m | 14 +++----------- Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m | 16 +++++----------- 9 files changed, 35 insertions(+), 76 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m index 8ce50464..dd3f09d9 100644 --- a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m +++ b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m @@ -47,23 +47,17 @@ NSRect bounds = [self bounds]; NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f)); + NSRect drawRect = NSMakeRect(drawPoint.x, drawPoint.y, imageSize.width, imageSize.height); - if ([self isFlipped]) { - drawPoint.y += imageSize.height; - } - - [image compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f)]; + [image drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f) respectFlipped:YES hints:nil]; if (_animatingAlternateImage) { NSImage *alternateImage = [self alternateImage]; NSSize altImageSize = [alternateImage size]; drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f), NSMidY(bounds) - (altImageSize.height * 0.5f)); + drawRect = NSMakeRect(drawPoint.x, drawPoint.y, altImageSize.width, altImageSize.height); - if ([self isFlipped]) { - drawPoint.y += altImageSize.height; - } - - [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sinf(_animationValue * (float)M_PI)]; + [[self alternateImage] drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:sinf(_animationValue * (float)M_PI) respectFlipped:YES hints:nil]; } } diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.m b/Frameworks/PSMTabBar/PSMTabBarCell.m index ab330c5c..003c1220 100644 --- a/Frameworks/PSMTabBar/PSMTabBarCell.m +++ b/Frameworks/PSMTabBar/PSMTabBarCell.m @@ -441,7 +441,8 @@ NSImage *pieImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]]; [image lockFocus]; NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y); - [pieImage compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:1.0f]; + NSRect indicatorRect = NSMakeRect(indicatorPoint.x, indicatorPoint.y, [pieImage size].width, [pieImage size].height); + [pieImage drawInRect:indicatorRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; [image unlockFocus]; [pieImage release]; } diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.m b/Frameworks/PSMTabBar/PSMTabDragAssistant.m index 21e014da..db993b81 100644 --- a/Frameworks/PSMTabBar/PSMTabDragAssistant.m +++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.m @@ -668,6 +668,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil; //get a custom image representation of the view to drag from the delegate NSImage *tabImage = [_draggedTab image]; NSPoint drawPoint; + NSRect drawRect; _dragWindowOffset = NSZeroSize; viewImage = [[control delegate] tabView:[control tabView] imageForTabViewItem:[cell representedObject] offset:&_dragWindowOffset styleMask:outMask]; [viewImage lockFocus]; @@ -681,9 +682,10 @@ static PSMTabDragAssistant *sharedDragAssistant = nil; } else { drawPoint.x += [control frame].size.width - [tabImage size].width; } + drawRect = NSMakeRect(drawPoint.x, drawPoint.y, [tabImage size].width, [tabImage size].height); - [tabImage compositeToPoint:drawPoint operation:NSCompositeSourceOver]; - + [tabImage drawInRect:drawRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + [viewImage unlockFocus]; } else { //the delegate doesn't give a custom image, so use an image of the view diff --git a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m index 3bda9cf5..758ebe21 100644 --- a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m @@ -623,13 +623,9 @@ closeButtonOrIcon = ([cell isEdited] ? _closeDirtyButton : _closeButton); drawingRect = closeButtonRect; } - - if ([controlView isFlipped]) { - drawingRect.origin.y += drawingRect.size.height; - } - [closeButtonOrIcon compositeToPoint:drawingRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [closeButtonOrIcon drawInRect:drawingRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over switch (orientation) { @@ -662,12 +658,8 @@ NSRect iconRect = [self iconRectForTabCell:cell]; NSImage *icon = [[[cell representedObject] identifier] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y += iconRect.size.height; - } + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - // scoot label over by the size of the standard close button switch (orientation) { diff --git a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m index 901f3b4a..161dbe8d 100644 --- a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m @@ -451,12 +451,8 @@ closeButtonSize = [closeButton size]; - if ([controlView isFlipped]) { - closeButtonRect.origin.y += closeButtonRect.size.height; - } - - [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; } @@ -465,9 +461,6 @@ if ([cell hasIcon]) { NSRect iconRect = [self iconRectForTabCell:cell]; NSImage *icon = [[[cell representedObject] identifier] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y += iconRect.size.height; - } // center in available space (in case icon image is smaller than kPSMTabBarIconWidth) if ([icon size].width < kPSMTabBarIconWidth) { @@ -478,8 +471,8 @@ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0; } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += iconRect.size.width + kPSMTabBarCellPadding; } diff --git a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m index 56c3a173..44f5b098 100644 --- a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m @@ -455,12 +455,9 @@ if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonDown : unifiedCloseButtonDown; closeButtonSize = [closeButton size]; - if ([controlView isFlipped]) { - closeButtonRect.origin.y += closeButtonRect.size.height; - } - - [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; } @@ -469,9 +466,6 @@ if ([cell hasIcon]) { NSRect iconRect = [self iconRectForTabCell:cell]; NSImage *icon = [[[cell representedObject] identifier] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y += iconRect.size.height; - } // center in available space (in case icon image is smaller than kPSMTabBarIconWidth) if ([icon size].width < kPSMTabBarIconWidth) { @@ -481,8 +475,8 @@ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0; } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += iconRect.size.width + kPSMTabBarCellPadding; } diff --git a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m index db9bbd86..ace79cf0 100644 --- a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m @@ -462,12 +462,9 @@ if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? metalCloseDirtyButtonDown : metalCloseButtonDown; closeButtonSize = [closeButton size]; - if ([controlView isFlipped]) { - closeButtonRect.origin.y += closeButtonRect.size.height; - } - - [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; } @@ -489,8 +486,8 @@ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0; } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += iconRect.size.width + kPSMTabBarCellPadding; } diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m index 9a4026ec..cf393bdb 100644 --- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m @@ -717,11 +717,7 @@ if ([cell closeButtonOver]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonOver : sequelProCloseButtonOver; if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonDown : sequelProCloseButtonDown; - if ([controlView isFlipped]) { - closeButtonRect.origin.y += closeButtonRect.size.height; - } - - [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0f]; + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; } // icon @@ -729,10 +725,6 @@ NSRect iconRect = [self iconRectForTabCell:cell]; NSImage *icon = [(id)[[cell representedObject] identifier] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y += iconRect.size.height; - } - // center in available space (in case icon image is smaller than kPSMTabBarIconWidth) if ([icon size].width < kPSMTabBarIconWidth) { iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width)/2.0f; @@ -741,8 +733,8 @@ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0f; } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0f]; - + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over insetLabelWidth += iconRect.size.width + kPSMTabBarCellPadding; } diff --git a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m index 76b5efc1..dcf99545 100644 --- a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m @@ -430,12 +430,9 @@ if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonDown : unifiedCloseButtonDown; closeButtonSize = [closeButton size]; - if ([controlView isFlipped]) { - closeButtonRect.origin.y += closeButtonRect.size.height; - } - - [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; } @@ -444,9 +441,6 @@ if ([cell hasIcon]) { NSRect iconRect = [self iconRectForTabCell:cell]; NSImage *icon = [[[cell representedObject] identifier] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y += iconRect.size.height; - } // center in available space (in case icon image is smaller than kPSMTabBarIconWidth) if ([icon size].width < kPSMTabBarIconWidth) { @@ -456,8 +450,8 @@ iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0; } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - + [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil]; + // scoot label over labelPosition += iconRect.size.width + kPSMTabBarCellPadding; } -- cgit v1.2.3