summaryrefslogtreecommitdiff
path: root/frontends/cocoa/PSMTabBarControl
diff options
context:
space:
mode:
authorSven Weidauer <sven@5sw.de>2017-06-05 10:47:34 +0200
committerSven Weidauer <sven@5sw.de>2017-06-05 10:51:19 +0200
commit3ee40a10b123c36be3e29602767840a7a71aaafa (patch)
tree64123d0bf6a6cf5a5a4c1fd8349756db68e09483 /frontends/cocoa/PSMTabBarControl
parentce4e059ea67cee7f35b4b810a4387f343fa74650 (diff)
downloadnetsurf-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')
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m2
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m18
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m4
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m17
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m50
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl+Private.h49
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m145
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarController.m10
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m62
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragView.m16
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m6
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m13
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m51
13 files changed, 170 insertions, 273 deletions
diff --git a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m b/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m
index 1a54502e5..a5865cb8a 100644
--- a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m
+++ b/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m
@@ -23,7 +23,7 @@
returnString = [[self substringToIndex:length - 1] stringByAppendingString:[NSString ellipsis]];
} else {
//We don't need to truncate, so don't append an ellipsis
- returnString = [[self copy] autorelease];
+ returnString = [self copy];
}
return returnString;
diff --git a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m b/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m
index c316f6973..8b71b7703 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m
@@ -6,6 +6,7 @@
// Copyright 2005 Positive Spin Media. All rights reserved.
//
+#import <math.h>
#import "PSMOverflowPopUpButton.h"
#import "PSMTabBarControl.h"
@@ -27,12 +28,6 @@
return self;
}
-- (void)dealloc {
- [_PSMTabBarOverflowPopUpImage release];
- [_PSMTabBarOverflowDownPopUpImage release];
- [super dealloc];
-}
-
- (void)drawRect:(NSRect)rect {
if(_PSMTabBarOverflowPopUpImage == nil) {
[super drawRect:rect];
@@ -49,7 +44,7 @@
drawPoint.y += imageSize.height;
}
- [image compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f)];
+ [image drawAtPoint:drawPoint fromRect: CGRectZero operation:NSCompositingOperationSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f)];
if(_animatingAlternateImage) {
NSImage *alternateImage = [self alternateImage];
@@ -60,7 +55,7 @@
drawPoint.y += altImageSize.height;
}
- [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sin(_animationValue * M_PI)];
+ [[self alternateImage] drawAtPoint:drawPoint fromRect: CGRectZero operation:NSCompositingOperationSourceOver fraction:sin(_animationValue * M_PI)];
}
}
@@ -111,7 +106,7 @@
}
}
-- (BOOL)animatingAlternateImage;
+- (BOOL)animatingAlternateImage
{
return _animatingAlternateImage;
}
@@ -141,8 +136,9 @@
- (id)initWithCoder:(NSCoder *)aDecoder {
if((self = [super initWithCoder:aDecoder])) {
if([aDecoder allowsKeyedCoding]) {
- _PSMTabBarOverflowPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"] retain];
- _PSMTabBarOverflowDownPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"] retain];
+ _PSMTabBarOverflowPopUpImage =
+ [aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"];
+ _PSMTabBarOverflowDownPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"];
[self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]];
}
}
diff --git a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m b/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m
index 983609bbc..afc727d7a 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m
@@ -17,10 +17,10 @@
@implementation PSMProgressIndicator
-- (id) initWithFrame: (NSRect)frameRect;
+- (id) initWithFrame: (NSRect)frameRect
{
if ((self = [super initWithFrame: frameRect]) == nil) return nil;
- [self setControlSize: NSSmallControlSize];
+ [self setControlSize: NSControlSizeSmall];
return self;
}
diff --git a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m b/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m
index 8886560c7..1da82c0db 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m
@@ -29,14 +29,10 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self removeTrackingRect];
-
- [super dealloc];
}
// the regular image
- (void)setUsualImage:(NSImage *)newImage {
- [newImage retain];
- [_usualImage release];
_usualImage = newImage;
[self setImage:_usualImage];
@@ -47,8 +43,6 @@
}
- (void)setRolloverImage:(NSImage *)newImage {
- [newImage retain];
- [_rolloverImage release];
_rolloverImage = newImage;
}
@@ -88,8 +82,7 @@
- (void)addTrackingRect {
// assign a tracking rect to watch for mouse enter/exit
NSRect trackRect = [self bounds];
- NSPoint localPoint = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
- fromView:nil];
+ NSPoint localPoint = [self convertPoint: NSPointFromCGPoint([self.window convertRectFromScreen: (NSRect){.origin = NSEvent.mouseLocation, .size = CGSizeMake(1, 1)}].origin) fromView: nil];
BOOL mouseInside = NSPointInRect(localPoint, trackRect);
_myTrackingRectTag = [self addTrackingRect:trackRect owner:self userData:nil assumeInside:mouseInside];
@@ -110,7 +103,7 @@
}
// override for rollover effect
-- (void)mouseEntered:(NSEvent *)theEvent;
+- (void)mouseEntered:(NSEvent *)theEvent
{
// set rollover image
[self setImage:_rolloverImage];
@@ -118,7 +111,7 @@
[super mouseEntered:theEvent];
}
-- (void)mouseExited:(NSEvent *)theEvent;
+- (void)mouseExited:(NSEvent *)theEvent
{
// restore usual image
[self setImage:_usualImage];
@@ -158,8 +151,8 @@
self = [super initWithCoder:aDecoder];
if(self) {
if([aDecoder allowsKeyedCoding]) {
- _rolloverImage = [[aDecoder decodeObjectForKey:@"rolloverImage"] retain];
- _usualImage = [[aDecoder decodeObjectForKey:@"usualImage"] retain];
+ _rolloverImage = [aDecoder decodeObjectForKey:@"rolloverImage"] ;
+ _usualImage = [aDecoder decodeObjectForKey:@"usualImage"] ;
_myTrackingRectTag = [aDecoder decodeInt64ForKey:@"myTrackingRectTag"];
}
}
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"];
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl+Private.h b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl+Private.h
new file mode 100644
index 000000000..8df3fd368
--- /dev/null
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl+Private.h
@@ -0,0 +1,49 @@
+#import "PSMTabBarControl.h"
+
+@interface PSMTabBarControl (Private)
+
+// constructor/destructor
+- (void)initAddedProperties;
+
+// accessors
+- (NSEvent *)lastMouseDownEvent;
+- (void)setLastMouseDownEvent:(NSEvent *)event;
+
+// contents
+- (void)addTabViewItem:(NSTabViewItem *)item;
+- (void)removeTabForCell:(PSMTabBarCell *)cell;
+
+// draw
+- (void)update;
+- (void)update:(BOOL)animate;
+- (void)_setupTrackingRectsForCell:(PSMTabBarCell *)cell;
+- (void)_positionOverflowMenu;
+- (void)_checkWindowFrame;
+
+// actions
+- (void)overflowMenuAction:(id)sender;
+- (void)closeTabClick:(id)sender;
+- (void)tabClick:(id)sender;
+- (void)tabNothing:(id)sender;
+
+// notification handlers
+- (void)frameDidChange:(NSNotification *)notification;
+- (void)windowDidMove:(NSNotification *)aNotification;
+- (void)windowDidUpdate:(NSNotification *)notification;
+
+// NSTabView delegate
+- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
+- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem;
+- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
+- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView;
+
+// archiving
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+- (id)initWithCoder:(NSCoder *)aDecoder;
+
+// convenience
+- (void)_bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
+- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
+
+- (void)_animateCells:(NSTimer *)timer;
+@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m
index cb0e0342c..01df769f1 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m
@@ -17,52 +17,15 @@
#import "PSMTabDragAssistant.h"
#import "PSMTabBarController.h"
-@interface PSMTabBarControl (Private)
-
-// constructor/destructor
-- (void)initAddedProperties;
-
-// accessors
-- (NSEvent *)lastMouseDownEvent;
-- (void)setLastMouseDownEvent:(NSEvent *)event;
-
-// contents
-- (void)addTabViewItem:(NSTabViewItem *)item;
-- (void)removeTabForCell:(PSMTabBarCell *)cell;
-
-// draw
-- (void)update;
-- (void)update:(BOOL)animate;
-- (void)_setupTrackingRectsForCell:(PSMTabBarCell *)cell;
-- (void)_positionOverflowMenu;
-- (void)_checkWindowFrame;
-
-// actions
-- (void)overflowMenuAction:(id)sender;
-- (void)closeTabClick:(id)sender;
-- (void)tabClick:(id)sender;
-- (void)tabNothing:(id)sender;
-
-// notification handlers
-- (void)frameDidChange:(NSNotification *)notification;
-- (void)windowDidMove:(NSNotification *)aNotification;
-- (void)windowDidUpdate:(NSNotification *)notification;
-
-// NSTabView delegate
-- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView;
-
-// archiving
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-// convenience
-- (void)_bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
-- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
-
-- (void)_animateCells:(NSTimer *)timer;
+#import "PSMTabBarControl+Private.h"
+
+@protocol PSMTabBarItem
+@optional
+- (BOOL)isProcessing;
+
+@optional
+- (int)objectCount;
+
@end
@implementation PSMTabBarControl
@@ -202,36 +165,22 @@
//stop any animations that may be running
[_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
[_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
//Also unwind the spring, if it's wound.
[_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
//unbind all the items to prevent crashing
//not sure if this is necessary or not
// http://code.google.com/p/maccode/issues/detail?id=35
- NSEnumerator *enumerator = [[[_cells copy] autorelease] objectEnumerator];
+ NSEnumerator *enumerator = [[_cells copy] objectEnumerator];
PSMTabBarCell *nextCell;
while((nextCell = [enumerator nextObject])) {
[self removeTabForCell:nextCell];
}
- [_overflowPopUpButton release];
- [_cells release];
- [_controller release];
- [tabView release];
- [_addTabButton release];
- [partnerView release];
- [_lastMouseDownEvent release];
- [style release];
-
[self unregisterDraggedTypes];
-
- [super dealloc];
}
- (void)awakeFromNib {
@@ -256,7 +205,7 @@
if(_showHideAnimationTimer) {
[_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
+ _showHideAnimationTimer = nil;
}
if(aWindow) {
@@ -283,8 +232,6 @@
}
- (void)setLastMouseDownEvent:(NSEvent *)event {
- [event retain];
- [_lastMouseDownEvent release];
_lastMouseDownEvent = event;
}
@@ -310,8 +257,6 @@
}
- (void)setTabView:(NSTabView *)view {
- [view retain];
- [tabView release];
tabView = view;
}
@@ -325,8 +270,6 @@
- (void)setStyle:(id <PSMTabStyle>)newStyle {
if(style != newStyle) {
- [style autorelease];
- style = [newStyle retain];
// restyle add tab button
if(_addTabButton) {
@@ -359,7 +302,6 @@
id <PSMTabStyle> newStyle = [[styleClass alloc] init];
[self setStyle:newStyle];
- [newStyle release];
}
- (PSMTabBarOrientation)orientation {
@@ -568,7 +510,6 @@
// add to collection
[_cells addObject:cell];
- [cell release];
if([_cells count] == (NSUInteger)[tabView numberOfTabViewItems]) {
[self update]; // don't update unless all are accounted for!
}
@@ -822,9 +763,8 @@
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithDouble:myOriginalOrigin], @"myOriginalOrigin", [NSNumber numberWithDouble:partnerOriginalOrigin], @"partnerOriginalOrigin", [NSNumber numberWithDouble:myOriginalSize], @"myOriginalSize", [NSNumber numberWithDouble:partnerOriginalSize], @"partnerOriginalSize", [NSNumber numberWithDouble:myTargetOrigin], @"myTargetOrigin", [NSNumber numberWithDouble:partnerTargetOrigin], @"partnerTargetOrigin", [NSNumber numberWithDouble:myTargetSize], @"myTargetSize", [NSNumber numberWithDouble:partnerTargetSize], @"partnerTargetSize", nil];
if(_showHideAnimationTimer) {
[_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release];
}
- _showHideAnimationTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(animateShowHide:) userInfo:userInfo repeats:YES] retain];
+ _showHideAnimationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(animateShowHide:) userInfo:userInfo repeats:YES];
}
- (void)animateShowHide:(NSTimer *)timer {
@@ -888,7 +828,7 @@
}
[_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
+ _showHideAnimationTimer = nil;
}
[[self window] display];
}
@@ -906,8 +846,6 @@
}
- (void)setPartnerView:(id)view {
- [partnerView release];
- [view retain];
partnerView = view;
}
@@ -949,10 +887,8 @@
[_overflowPopUpButton setHidden:(overflowMenu == nil)];
[_overflowPopUpButton setMenu:overflowMenu];
- if(_animationTimer) {
[_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
- }
+ _animationTimer = nil;
if(animate) {
NSMutableArray *targetFrames = [NSMutableArray arrayWithCapacity:[_cells count]];
@@ -969,12 +905,11 @@
NSAnimation *animation = [[NSAnimation alloc] initWithDuration:0.50 animationCurve:NSAnimationEaseInOut];
[animation setAnimationBlockingMode:NSAnimationNonblocking];
[animation startAnimation];
- _animationTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0
+ _animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0
target:self
selector:@selector(_animateCells:)
userInfo:[NSArray arrayWithObjects:targetFrames, animation, nil]
- repeats:YES] retain];
- [animation release];
+ repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
[self _animateCells:_animationTimer];
} else {
@@ -1067,7 +1002,7 @@
}
[_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
+ _animationTimer = nil;
for(NSUInteger i = 0; i < cellCount; i++) {
currentCell = [_cells objectAtIndex:i];
@@ -1143,7 +1078,7 @@
if([window showsResizeIndicator] && NSIntersectsRect([self frame], resizeWidgetFrame)) {
//the resize widgets are larger on metal windows
- _resizeAreaCompensation = [window styleMask] & NSTexturedBackgroundWindowMask ? 20 : 8;
+ _resizeAreaCompensation = [window styleMask] & NSWindowStyleMaskTexturedBackground ? 20 : 8;
} else {
_resizeAreaCompensation = 0;
}
@@ -1183,7 +1118,7 @@
if(overClose &&
![self disableTabClose] &&
![cell isCloseButtonSuppressed] &&
- ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]] || [theEvent modifierFlags] & NSCommandKeyMask)) {
+ ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]] || [theEvent modifierFlags] & NSEventModifierFlagCommand)) {
[cell setCloseButtonOver:NO];
[cell setCloseButtonPressed:YES];
_closeClicked = YES;
@@ -1269,9 +1204,9 @@
NSRect iconRect = [mouseDownCell closeButtonRectForFrame:mouseDownCellFrame];
if((NSMouseInRect(mousePt, iconRect, [self isFlipped])) && ![self disableTabClose] && ![cell isCloseButtonSuppressed] && [mouseDownCell closeButtonPressed]) {
- if(([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) {
+ if(([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagOption) != 0) {
//If the user is holding Option, close all other tabs
- NSEnumerator *enumerator = [[[[self cells] copy] autorelease] objectEnumerator];
+ NSEnumerator *enumerator = [[[self cells] copy] objectEnumerator];
PSMTabBarCell *otherCell;
while((otherCell = [enumerator nextObject])) {
@@ -1386,18 +1321,18 @@
//If the user has dragged to a different tab, reset the timer.
if(_tabViewItemWithSpring != [cell representedObject]) {
[_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
+ _springTimer = nil;
_tabViewItemWithSpring = [cell representedObject];
}
if(!_springTimer) {
//Finder's default delay time, as of Tiger, is 668 ms. If the user has never changed it, there's no setting in its defaults, so we default to that amount.
- NSNumber *delayNumber = [(NSNumber *)CFPreferencesCopyAppValue((CFStringRef)@"SpringingDelayMilliseconds", (CFStringRef)@"com.apple.finder") autorelease];
+ NSNumber *delayNumber = (__bridge_transfer NSNumber *)CFPreferencesCopyAppValue((CFStringRef)@"SpringingDelayMilliseconds", (CFStringRef)@"com.apple.finder");
NSTimeInterval delaySeconds = delayNumber ?[delayNumber doubleValue] / 1000.0 : 0.668;
- _springTimer = [[NSTimer scheduledTimerWithTimeInterval:delaySeconds
+ _springTimer = [NSTimer scheduledTimerWithTimeInterval:delaySeconds
target:self
selector:@selector(fireSpring:)
userInfo:sender
- repeats:NO] retain];
+ repeats:NO];
}
return NSDragOperationCopy;
}
@@ -1407,7 +1342,7 @@
- (void)draggingExited:(id <NSDraggingInfo>)sender {
[_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
+ _springTimer = nil;
[[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
}
@@ -1447,7 +1382,7 @@
_tabViewItemWithSpring = nil;
[_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
+ _springTimer = nil;
}
#pragma mark -
@@ -1460,7 +1395,6 @@
- (void)closeTabClick:(id)sender {
NSTabViewItem *item = [sender representedObject];
- [sender retain];
if(([_cells count] == 1) && (![self canCloseOnlyTab])) {
return;
}
@@ -1473,11 +1407,8 @@
}
}
- [item retain];
[tabView removeTabViewItem:item];
- [item release];
- [sender release];
}
- (void)tabClick:(id)sender {
@@ -1633,16 +1564,12 @@
[aTabView setDelegate:nil];
// move it all around first
- [tabViewItem retain];
- [thisCell retain];
[aTabView removeTabViewItem:tabViewItem];
[aTabView insertTabViewItem:tabViewItem atIndex:0];
[_cells removeObjectAtIndex:tabIndex];
[_cells insertObject:thisCell atIndex:0];
[thisCell setIsInOverflowMenu:NO]; //very important else we get a fun recursive loop going
[[_cells objectAtIndex:[_cells count] - 1] setIsInOverflowMenu:YES]; //these 2 lines are pretty uncool and this logic needs to be updated
- [thisCell release];
- [tabViewItem release];
[aTabView setDelegate:tempDelegate];
@@ -1677,7 +1604,7 @@
- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView {
NSArray *tabItems = [tabView tabViewItems];
// go through cells, remove any whose representedObjects are not in [tabView tabViewItems]
- NSEnumerator *e = [[[_cells copy] autorelease] objectEnumerator];
+ NSEnumerator *e = [[_cells copy] objectEnumerator];
PSMTabBarCell *cell;
while((cell = [e nextObject])) {
//remove the observer binding
@@ -1769,11 +1696,11 @@
[self setPostsFrameChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self];
if ([aDecoder allowsKeyedCoding]) {
- _cells = [[aDecoder decodeObjectForKey:@"PSMcells"] retain];
- tabView = [[aDecoder decodeObjectForKey:@"PSMtabView"] retain];
- _overflowPopUpButton = [[aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"] retain];
- _addTabButton = [[aDecoder decodeObjectForKey:@"PSMaddTabButton"] retain];
- style = [[aDecoder decodeObjectForKey:@"PSMstyle"] retain];
+ _cells = [aDecoder decodeObjectForKey:@"PSMcells"] ;
+ tabView = [aDecoder decodeObjectForKey:@"PSMtabView"] ;
+ _overflowPopUpButton = [aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"] ;
+ _addTabButton = [aDecoder decodeObjectForKey:@"PSMaddTabButton"] ;
+ style = [aDecoder decodeObjectForKey:@"PSMstyle"] ;
_orientation = (PSMTabBarOrientation)[aDecoder decodeIntegerForKey:@"PSMorientation"];
_canCloseOnlyTab = [aDecoder decodeBoolForKey:@"PSMcanCloseOnlyTab"];
_disableTabClose = [aDecoder decodeBoolForKey:@"PSMdisableTabClose"];
@@ -1788,13 +1715,13 @@
_cellOptimumWidth = [aDecoder decodeIntegerForKey:@"PSMcellOptimumWidth"];
_currentStep = [aDecoder decodeIntegerForKey:@"PSMcurrentStep"];
_isHidden = [aDecoder decodeBoolForKey:@"PSMisHidden"];
- partnerView = [[aDecoder decodeObjectForKey:@"PSMpartnerView"] retain];
+ partnerView = [aDecoder decodeObjectForKey:@"PSMpartnerView"] ;
_awakenedFromNib = [aDecoder decodeBoolForKey:@"PSMawakenedFromNib"];
- _lastMouseDownEvent = [[aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"] retain];
+ _lastMouseDownEvent = [aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"] ;
_useOverflowMenu = [aDecoder decodeBoolForKey:@"PSMuseOverflowMenu"];
_automaticallyAnimates = [aDecoder decodeBoolForKey:@"PSMautomaticallyAnimates"];
_alwaysShowActiveTab = [aDecoder decodeBoolForKey:@"PSMalwaysShowActiveTab"];
- delegate = [[aDecoder decodeObjectForKey:@"PSMdelegate"] retain];
+ delegate = [aDecoder decodeObjectForKey:@"PSMdelegate"] ;
}
}
[self setTarget:self];
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m
index 68e1bc498..ea3f5baa3 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m
@@ -11,6 +11,7 @@
#import "PSMTabBarCell.h"
#import "PSMTabStyle.h"
#import "NSString_AITruncation.h"
+#import "PSMRolloverButton.h"
#define MAX_OVERFLOW_MENUITEM_TITLE_LENGTH 60
@@ -41,13 +42,6 @@
return self;
}
-- (void)dealloc {
- [_cellTrackingRects release];
- [_closeButtonTrackingRects release];
- [_cellFrames release];
- [super dealloc];
-}
-
/*!
@method addButtonRect
@abstract Returns the position for the add tab button.
@@ -507,7 +501,7 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum){
NSTabViewItem *selectedTabViewItem = [[_control tabView] selectedTabViewItem];
NSMenuItem *menuItem;
- [_overflowMenu release], _overflowMenu = nil;
+ _overflowMenu = nil;
for(i = 0; i < cellCount; i++) {
cell = [cells objectAtIndex:i];
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m
index 4542e8d02..1e3e3684e 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m
@@ -10,6 +10,8 @@
#import "PSMTabBarCell.h"
#import "PSMTabStyle.h"
#import "PSMTabDragWindowController.h"
+#import "PSMOverflowPopUpButton.h"
+#import "PSMRolloverButton.h"
#define PI 3.1417
@@ -53,16 +55,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
return self;
}
-- (void)dealloc {
- [_sourceTabBar release];
- [_destinationTabBar release];
- [_participatingTabBars release];
- [_draggedCell release];
- [_animationTimer release];
- [_sineCurveWidths release];
- [_targetCell release];
- [super dealloc];
-}
#pragma mark -
#pragma mark Accessors
@@ -72,8 +64,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
- (void)setSourceTabBar:(PSMTabBarControl *)tabBar {
- [tabBar retain];
- [_sourceTabBar release];
_sourceTabBar = tabBar;
}
@@ -82,8 +72,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
- (void)setDestinationTabBar:(PSMTabBarControl *)tabBar {
- [tabBar retain];
- [_destinationTabBar release];
_destinationTabBar = tabBar;
}
@@ -92,8 +80,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
- (void)setDraggedCell:(PSMTabBarCell *)cell {
- [cell retain];
- [_draggedCell release];
_draggedCell = cell;
}
@@ -126,8 +112,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
- (void)setTargetCell:(PSMTabBarCell *)cell {
- [cell retain];
- [_targetCell release];
_targetCell = cell;
}
@@ -175,20 +159,18 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidBeginNotification object:nil];
//retain the control in case the drag operation causes the control to be released
- [control retain];
if([control delegate] && [[control delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] &&
[[control delegate] tabView:[control tabView] shouldDropTabViewItem:[[self draggedCell] representedObject] inTabBar:nil]) {
_currentTearOffStyle = [control tearOffStyle];
- _draggedTab = [[PSMTabDragWindowController alloc] initWithImage:dragImage styleMask:NSBorderlessWindowMask tearOffStyle:_currentTearOffStyle];
+ _draggedTab = [[PSMTabDragWindowController alloc] initWithImage:dragImage styleMask:NSWindowStyleMaskBorderless tearOffStyle:_currentTearOffStyle];
cellFrame.origin.y -= cellFrame.size.height;
- [control dragImage:[[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] autorelease] at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:NO];
+ [control dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:NO];
} else {
[control dragImage:dragImage at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:YES];
}
- [control release];
}
- (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc {
@@ -360,7 +342,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
//temporarily disable the delegate in order to move the tab to a different index
id tempDelegate = [tabView delegate];
[tabView setDelegate:nil];
- [item retain];
[tabView removeTabViewItem:item];
[tabView insertTabViewItem:item atIndex:index];
if(reselect) {
@@ -440,13 +421,11 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
if(_draggedTab) {
[[_draggedTab window] orderOut:nil];
- [_draggedTab release];
_draggedTab = nil;
}
if(_draggedView) {
[[_draggedView window] orderOut:nil];
- [_draggedView release];
_draggedView = nil;
}
@@ -548,7 +527,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
NSImage *viewImage = nil;
if(outMask) {
- *outMask = NSBorderlessWindowMask;
+ *outMask = NSWindowStyleMaskBorderless;
}
if([control delegate] && [[control delegate] respondsToSelector:@selector(tabView:imageForTabViewItem:offset:styleMask:)]) {
@@ -569,19 +548,19 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
drawPoint.x += [control frame].size.width - [tabImage size].width;
}
- [tabImage compositeToPoint:drawPoint operation:NSCompositeSourceOver];
+ [tabImage drawAtPoint:drawPoint fromRect: NSZeroRect operation:NSCompositingOperationSourceOver fraction: 1.0];
[viewImage unlockFocus];
} else {
//the delegate doesn't give a custom image, so use an image of the view
NSView *tabView = [[cell representedObject] view];
- viewImage = [[[NSImage alloc] initWithSize:[tabView frame].size] autorelease];
+ viewImage = [[NSImage alloc] initWithSize:[tabView frame].size] ;
[viewImage lockFocus];
[tabView drawRect:[tabView bounds]];
[viewImage unlockFocus];
}
- if(*outMask | NSBorderlessWindowMask) {
+ if(*outMask | NSWindowStyleMaskBorderless) {
_dragWindowOffset.height += 22;
}
@@ -590,7 +569,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
- (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window {
NSRect rect = [window frame];
- NSImage *image = [[[NSImage alloc] initWithSize:rect.size] autorelease];
+ NSImage *image = [[NSImage alloc] initWithSize:rect.size] ;
[image lockFocus];
rect.origin = NSZeroPoint;
CGContextCopyWindowCaptureContentsToRect([[NSGraphicsContext currentContext] graphicsPort], *(CGRect *)&rect, [NSApp contextID], [window windowNumber], 0);
@@ -637,7 +616,6 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
if(![animation isAnimating]) {
[timer invalidate];
- [animation release];
}
}
@@ -645,7 +623,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
#pragma mark Animation
- (void)animateDrag:(NSTimer *)timer {
- NSEnumerator *e = [[[_participatingTabBars copy] autorelease] objectEnumerator];
+ NSEnumerator *e = [[_participatingTabBars copy] objectEnumerator];
PSMTabBarControl *tabBar;
while((tabBar = [e nextObject])) {
[self calculateDragAnimationForTabBar:tabBar];
@@ -754,7 +732,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
// replace dragged cell with a placeholder, and clean up surrounding cells
NSInteger cellIndex = [cells indexOfObject:cell];
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control] autorelease];
+ PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control] ;
[cells replaceObjectAtIndex:cellIndex withObject:pc];
[cells removeObjectAtIndex:(cellIndex + 1)];
[cells removeObjectAtIndex:(cellIndex - 1)];
@@ -768,11 +746,11 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control {
NSUInteger i, numVisibleTabs = [control numberOfVisibleTabs];
for(i = 0; i < numVisibleTabs; i++) {
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
+ PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] ;
[[control cells] insertObject:pc atIndex:(2 * i)];
}
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
+ PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] ;
if([[control cells] count] > (2 * numVisibleTabs)) {
[[control cells] insertObject:pc atIndex:(2 * numVisibleTabs)];
} else {
@@ -815,16 +793,16 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
//self = [super initWithCoder:aDecoder];
//if (self) {
if([aDecoder allowsKeyedCoding]) {
- _sourceTabBar = [[aDecoder decodeObjectForKey:@"sourceTabBar"] retain];
- _destinationTabBar = [[aDecoder decodeObjectForKey:@"destinationTabBar"] retain];
- _participatingTabBars = [[aDecoder decodeObjectForKey:@"participatingTabBars"] retain];
- _draggedCell = [[aDecoder decodeObjectForKey:@"draggedCell"] retain];
+ _sourceTabBar = [aDecoder decodeObjectForKey:@"sourceTabBar"] ;
+ _destinationTabBar = [aDecoder decodeObjectForKey:@"destinationTabBar"] ;
+ _participatingTabBars = [aDecoder decodeObjectForKey:@"participatingTabBars"] ;
+ _draggedCell = [aDecoder decodeObjectForKey:@"draggedCell"] ;
_draggedCellIndex = [aDecoder decodeIntegerForKey:@"draggedCellIndex"];
_isDragging = [aDecoder decodeBoolForKey:@"isDragging"];
- _animationTimer = [[aDecoder decodeObjectForKey:@"animationTimer"] retain];
- _sineCurveWidths = [[aDecoder decodeObjectForKey:@"sineCurveWidths"] retain];
+ _animationTimer = [aDecoder decodeObjectForKey:@"animationTimer"] ;
+ _sineCurveWidths = [aDecoder decodeObjectForKey:@"sineCurveWidths"] ;
_currentMouseLoc = [aDecoder decodePointForKey:@"currentMouseLoc"];
- _targetCell = [[aDecoder decodeObjectForKey:@"targetCell"] retain];
+ _targetCell = [aDecoder decodeObjectForKey:@"targetCell"] ;
}
//}
return self;
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m
index 2c9781dbc..8f901646c 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m
@@ -18,12 +18,6 @@
return self;
}
-- (void)dealloc {
- [_image release];
- [_alternateImage release];
- [super dealloc];
-}
-
- (void)drawRect:(NSRect)rect {
//1.0 fade means show the primary image
//0.0 fade means show the secondary image
@@ -32,9 +26,9 @@
srcRect.origin = NSZeroPoint;
srcRect.size = [_image size];
- [_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:primaryAlpha];
+ [_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositingOperationSourceOver fraction:primaryAlpha];
srcRect.size = [_alternateImage size];
- [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha];
+ [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositingOperationSourceOver fraction:alternateAlpha];
}
- (void)setFadeValue:(CGFloat)value {
@@ -46,8 +40,7 @@
}
- (void)setImage:(NSImage *)image {
- [_image release];
- _image = [image retain];
+ _image = image;
}
- (NSImage *)alternateImage {
@@ -55,8 +48,7 @@
}
- (void)setAlternateImage:(NSImage *)image {
- [_alternateImage release];
- _alternateImage = [image retain];
+ _alternateImage = image;
}
@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m
index d6fcc95a3..8bf51f6dd 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m
@@ -12,14 +12,14 @@
@implementation PSMTabDragWindow
+ (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask {
- return [[[PSMTabDragWindow alloc] initWithImage:image styleMask:styleMask] autorelease];
+ return [[PSMTabDragWindow alloc] initWithImage:image styleMask:styleMask] ;
}
- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask {
NSSize size = [image size];
if((self = [super initWithContentRect:NSMakeRect(0, 0, size.width, size.height) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO])) {
- _dragView = [[[PSMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)] autorelease];
+ _dragView = [[PSMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)] ;
[self setContentView:_dragView];
[self setLevel:NSStatusWindowLevel];
[self setIgnoresMouseEvents:YES];
@@ -32,7 +32,7 @@
windowFrame.origin.y += windowFrame.size.height - size.height;
windowFrame.size = size;
- if(styleMask | NSBorderlessWindowMask) {
+ if(styleMask | NSWindowStyleMaskBorderless) {
windowFrame.size.height += 22;
}
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m
index 3a6e8c663..59e52deb7 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m
@@ -15,7 +15,7 @@
- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle {
PSMTabDragWindow *window = [PSMTabDragWindow dragWindowWithImage:image styleMask:styleMask];
if((self = [super initWithWindow:window])) {
- _view = [[window dragView] retain];
+ _view = [window dragView] ;
_tearOffStyle = tearOffStyle;
if(tearOffStyle == PSMTabBarTearOffMiniwindow) {
@@ -29,16 +29,8 @@
}
- (void)dealloc {
- if(_timer) {
[_timer invalidate];
- }
-
- if(_animation) {
- [_animation release];
- }
- [_view release];
- [super dealloc];
}
- (NSImage *)image {
@@ -69,7 +61,6 @@
//An animation already exists, get the current progress
progress = 1.0f - [_animation currentProgress];
[_animation stopAnimation];
- [_animation release];
}
//begin animating
@@ -102,7 +93,7 @@
[[self window] setFrame:frame display:YES];
if(![_animation isAnimating]) {
- [_animation release], _animation = nil;
+ _animation = nil;
[timer invalidate];
_timer = nil;
}
diff --git a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m b/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m
index 77be601be..98bf6c1e4 100644
--- a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m
+++ b/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m
@@ -50,21 +50,6 @@
return self;
}
-- (void)dealloc {
- [unifiedCloseButton release];
- [unifiedCloseButtonDown release];
- [unifiedCloseButtonOver release];
- [unifiedCloseDirtyButton release];
- [unifiedCloseDirtyButtonDown release];
- [unifiedCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
#pragma mark -
#pragma mark Control Specific
@@ -264,13 +249,13 @@
- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell {
NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
+ return [[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] ;
}
- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell {
NSMutableAttributedString *attrStr;
NSString * contents = [cell stringValue];
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
+ attrStr = [[NSMutableAttributedString alloc] initWithString:contents] ;
NSRange range = NSMakeRange(0, [contents length]);
[attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
@@ -278,7 +263,7 @@
// Paragraph Style for Truncating Long Text
static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
if(!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
+ TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy] ;
[TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
}
[attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
@@ -353,7 +338,7 @@
// rollover
if([cell isHighlighted]) {
[[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set];
- NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
+ NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop);
}
// frame
@@ -412,7 +397,7 @@
closeButtonRect.origin.y += closeButtonRect.size.height;
}
- [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
+ [closeButton drawAtPoint: closeButtonRect.origin fromRect: CGRectZero operation:NSCompositingOperationSourceOver fraction:1.0];
// scoot label over
labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
@@ -434,7 +419,7 @@
iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0;
}
- [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0];
+ [icon drawAtPoint:iconRect.origin fromRect: NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0];
// scoot label over
labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
@@ -511,13 +496,13 @@
labelRect.origin.y += 4.0;
NSMutableAttributedString *attrStr;
NSString *contents = @"PSMTabBarControl";
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
+ attrStr = [[NSMutableAttributedString alloc] initWithString:contents] ;
NSRange range = NSMakeRange(0, [contents length]);
[attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
NSMutableParagraphStyle *centeredParagraphStyle = nil;
if(!centeredParagraphStyle) {
- centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
+ centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy] ;
+ [centeredParagraphStyle setAlignment: NSTextAlignmentCenter];
}
[attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
[attrStr drawInRect:labelRect];
@@ -556,15 +541,15 @@
// self = [super initWithCoder:aDecoder];
//if (self) {
if([aDecoder allowsKeyedCoding]) {
- unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain];
- unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain];
- unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain];
- unifiedCloseDirtyButton = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] retain];
- unifiedCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] retain];
- unifiedCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
+ unifiedCloseButton = [aDecoder decodeObjectForKey:@"unifiedCloseButton"] ;
+ unifiedCloseButtonDown = [aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] ;
+ unifiedCloseButtonOver = [aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"];
+ unifiedCloseDirtyButton = [aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] ;
+ unifiedCloseDirtyButtonDown = [aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] ;
+ unifiedCloseDirtyButtonOver = [aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] ;
+ _addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"];
+ _addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] ;
+ _addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] ;
}
//}
return self;