From 259f4dee7cd3318b9a303f1234e745178fe08f6e Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Fri, 17 Aug 2012 18:37:44 +0200 Subject: [PATCH] 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. --- .../source/NSBezierPath_AMShading.h | 0 .../source/NSBezierPath_AMShading.m | 0 .../PSMTabBarControl/source/PSMAquaTabStyle.m | 11 ++++------- .../PSMTabBarControl/source/PSMMetalTabStyle.m | 7 ++----- .../source/PSMOverflowPopUpButton.m | 6 ++---- .../PSMTabBarControl/source/PSMTabBarCell.h | 2 +- .../PSMTabBarControl/source/PSMTabBarCell.m | 16 ++++++++-------- .../PSMTabBarControl/source/PSMTabBarControl.m | 2 +- .../source/PSMTabDragAssistant.h | 2 +- .../source/PSMTabDragAssistant.m | 6 +++--- .../PSMTabBarControl/source/PSMUnifiedTabStyle.m | 7 ++----- 11 files changed, 24 insertions(+), 35 deletions(-) mode change 100755 => 100644 src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h mode change 100755 => 100644 src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m diff --git a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h b/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h old mode 100755 new mode 100644 diff --git a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m b/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m old mode 100755 new mode 100644 diff --git a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m index a6c66a5195..158f79b9cb 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m @@ -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; diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m index bbc6b87085..c3140ef3f7 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m @@ -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; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index d3623f1edc..5e8265f91a 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -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 diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h index 5d98eff3f2..d51163196f 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h @@ -100,6 +100,6 @@ @interface PSMTabBarControl (CellAccessors) -- (id)style; +- (id)psmTabStyle; @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m index a826953836..9e57a7f42b 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m @@ -137,7 +137,7 @@ - (NSAttributedString *)attributedStringValue { - return [(id )[_controlView style] attributedStringValueForTabCell:self]; + return [[_controlView psmTabStyle] attributedStringValueForTabCell:self]; } - (int)tabState @@ -271,22 +271,22 @@ - (NSRect)indicatorRectForFrame:(NSRect)cellFrame { - return [(id )[_controlView style] indicatorRectForTabCell:self]; + return [[_controlView psmTabStyle] indicatorRectForTabCell:self]; } - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame { - return [(id )[_controlView style] closeButtonRectForTabCell:self]; + return [[_controlView psmTabStyle] closeButtonRectForTabCell:self]; } - (float)minimumWidthOfCell { - return [(id )[_controlView style] minimumWidthOfTabCell:self]; + return [[_controlView psmTabStyle] minimumWidthOfTabCell:self]; } - (float)desiredWidthOfCell { - return [(id )[_controlView style] desiredWidthOfTabCell:self]; + return [[_controlView psmTabStyle] desiredWidthOfTabCell:self]; } #pragma mark - @@ -300,7 +300,7 @@ return; } - [(id )[_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]; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index 5b17c3cc08..05ed3b4700 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -242,7 +242,7 @@ tabView = view; } -- (id)style +- (id)psmTabStyle { return style; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h index e89692a7e3..8c756c7233 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h @@ -74,7 +74,7 @@ @interface PSMTabBarControl (DragAccessors) -- (id)style; +- (id)psmTabStyle; - (NSMutableArray *)cells; - (void)setControlView:(id)view; - (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m index c5b937693c..9adee1c281 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m @@ -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){ diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m index 6e778d9c2e..c16264f40e 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m @@ -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;