diff options
author | Sven Weidauer <sven@5sw.de> | 2017-06-05 10:47:34 +0200 |
---|---|---|
committer | Sven Weidauer <sven@5sw.de> | 2017-06-05 10:51:19 +0200 |
commit | 3ee40a10b123c36be3e29602767840a7a71aaafa (patch) | |
tree | 64123d0bf6a6cf5a5a4c1fd8349756db68e09483 /frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m | |
parent | ce4e059ea67cee7f35b4b810a4387f343fa74650 (diff) | |
download | netsurf-3ee40a10b123c36be3e29602767840a7a71aaafa.tar.gz netsurf-3ee40a10b123c36be3e29602767840a7a71aaafa.tar.bz2 |
Fix up cocoa frontend.
- Convert to ARC
- Fix crash due to endless responder chain recursion
- Update makefile to find openssl installed via home-brew
- Fix most compiler warnings
Diffstat (limited to 'frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m')
-rw-r--r-- | frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m index f7a04f202..0f21fe5c3 100644 --- a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m +++ b/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m @@ -11,10 +11,7 @@ #import "PSMTabStyle.h" #import "PSMProgressIndicator.h" #import "PSMTabDragAssistant.h" - -@interface PSMTabBarControl (Private) -- (void)update; -@end +#import "PSMTabBarControl+Private.h" @implementation PSMTabBarCell @@ -73,12 +70,9 @@ } - (void)dealloc { - [_countColor release]; [_indicator removeFromSuperviewWithoutNeedingDisplay]; - [_indicator release]; - [super dealloc]; } #pragma mark - @@ -138,7 +132,7 @@ } - (NSAttributedString *)attributedStringValue { - return [(id < PSMTabStyle >)[_controlView style] attributedStringValueForTabCell:self]; + return [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] attributedStringValueForTabCell:self]; } - (NSInteger)tabState { @@ -175,7 +169,7 @@ } - (BOOL)closeButtonOver { - return(_closeButtonOver && ([_controlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask)); + return(_closeButtonOver && ([_controlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSEventModifierFlagCommand)); } - (void)setCloseButtonOver:(BOOL)value { @@ -186,17 +180,17 @@ return _hasCloseButton; } -- (void)setHasCloseButton:(BOOL)set; +- (void)setHasCloseButton:(BOOL)set { _hasCloseButton = set; } -- (void)setCloseButtonSuppressed:(BOOL)suppress; +- (void)setCloseButtonSuppressed:(BOOL)suppress { _isCloseButtonSuppressed = suppress; } -- (BOOL)isCloseButtonSuppressed; +- (BOOL)isCloseButtonSuppressed { return _isCloseButtonSuppressed; } @@ -233,15 +227,14 @@ } - (void)setCountColor:(NSColor *)color { - [_countColor release]; - _countColor = [color retain]; + _countColor = color; } - (BOOL)isPlaceholder { return _isPlaceholder; } -- (void)setIsPlaceholder:(BOOL)value; +- (void)setIsPlaceholder:(BOOL)value { _isPlaceholder = value; } @@ -285,19 +278,19 @@ #pragma mark Component Attributes - (NSRect)indicatorRectForFrame:(NSRect)cellFrame { - return [(id < PSMTabStyle >)[_controlView style] indicatorRectForTabCell:self]; + return [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] indicatorRectForTabCell:self]; } - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame { - return [(id < PSMTabStyle >)[_controlView style] closeButtonRectForTabCell:self withFrame:cellFrame]; + return [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] closeButtonRectForTabCell:self withFrame:cellFrame]; } - (CGFloat)minimumWidthOfCell { - return [(id < PSMTabStyle >)[_controlView style] minimumWidthOfTabCell:self]; + return [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] minimumWidthOfTabCell:self]; } - (CGFloat)desiredWidthOfCell { - return [(id < PSMTabStyle >)[_controlView style] desiredWidthOfTabCell:self]; + return [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] desiredWidthOfTabCell:self]; } #pragma mark - @@ -306,11 +299,11 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { if(_isPlaceholder) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); + NSRectFillUsingOperation(cellFrame, NSCompositingOperationSourceAtop); return; } - [(id < PSMTabStyle >)[_controlView style] drawTabCell:self]; + [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] drawTabCell:self]; } #pragma mark - @@ -327,7 +320,7 @@ } // scrubtastic - if([_controlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask)) { + if([_controlView allowsScrubbing] && ([theEvent modifierFlags] & NSEventModifierFlagOption)) { [_controlView performSelector:@selector(tabClick:) withObject:self]; } @@ -358,21 +351,20 @@ //NSRect cellFrame = [self frame]; [_controlView lockFocus]; - NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] autorelease]; + NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] ; [_controlView unlockFocus]; - NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *image = [[NSImage alloc] initWithSize:[rep size]]; [image addRepresentation:rep]; - NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *returnImage = [[NSImage alloc] initWithSize:[rep size]]; [returnImage lockFocus]; - [image compositeToPoint:NSMakePoint(0.0, 0.0) operation:NSCompositeSourceOver fraction:1.0]; + [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect: NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; [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); - [pi compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:1.0]; + [pi drawAtPoint:indicatorPoint fromRect: NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; [returnImage unlockFocus]; - [pi release]; } return returnImage; } @@ -416,7 +408,7 @@ _cellTrackingTag = [aDecoder decodeIntegerForKey:@"cellTrackingTag"]; _closeButtonOver = [aDecoder decodeBoolForKey:@"closeButtonOver"]; _closeButtonPressed = [aDecoder decodeBoolForKey:@"closeButtonPressed"]; - _indicator = [[aDecoder decodeObjectForKey:@"indicator"] retain]; + _indicator = [aDecoder decodeObjectForKey:@"indicator"]; _isInOverflowMenu = [aDecoder decodeBoolForKey:@"isInOverflowMenu"]; _hasCloseButton = [aDecoder decodeBoolForKey:@"hasCloseButton"]; _isCloseButtonSuppressed = [aDecoder decodeBoolForKey:@"isCloseButtonSuppressed"]; |