diff options
Diffstat (limited to 'frontends/cocoa/URLFieldCell.m')
-rw-r--r-- | frontends/cocoa/URLFieldCell.m | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/frontends/cocoa/URLFieldCell.m b/frontends/cocoa/URLFieldCell.m index e9e66476e..e08ba3efc 100644 --- a/frontends/cocoa/URLFieldCell.m +++ b/frontends/cocoa/URLFieldCell.m @@ -36,11 +36,10 @@ @synthesize favicon; -- (void) setFavicon: (NSImage *)newIcon; +- (void) setFavicon: (NSImage *)newIcon { if (favicon != newIcon) { - [favicon release]; - favicon = [newIcon retain]; + favicon = newIcon ; [[self controlView] setNeedsDisplay: YES]; } } @@ -48,10 +47,10 @@ #define BUTTON_SIZE 32 #define PADDING 2 -- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView *)controlView; +- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView *)controlView { [favicon drawInRect: [self iconFrame: cellFrame] fromRect: NSZeroRect - operation: NSCompositeSourceOver fraction: 1.0]; + operation: NSCompositingOperationSourceOver fraction: 1.0]; [super drawInteriorWithFrame: [self urlFrame: cellFrame] inView: controlView]; @@ -60,7 +59,7 @@ } - (void) selectWithFrame: (NSRect)aRect inView: (NSView *)controlView editor: (NSText *)textObj - delegate: (id)anObject start: (NSInteger)selStart length: (NSInteger)selLength; + delegate: (id)anObject start: (NSInteger)selStart length: (NSInteger)selLength { const NSRect textFrame = [self urlFrame: aRect]; [super selectWithFrame: textFrame inView: controlView editor: textObj @@ -68,14 +67,14 @@ } - (void) editWithFrame: (NSRect)aRect inView: (NSView *)controlView editor: (NSText *)textObj - delegate: (id)anObject event: (NSEvent *)theEvent; + delegate: (id)anObject event: (NSEvent *)theEvent { const NSRect textFrame = [self urlFrame: aRect]; [super editWithFrame: textFrame inView: controlView editor: textObj delegate: anObject event: theEvent]; } -- (void) startDragURLAt: (NSPoint) point inView: (NSView *) view; +- (void) startDragURLAt: (NSPoint) point inView: (NSView *) view { NSString *url = [self stringValue]; NSString *title = url; @@ -106,7 +105,7 @@ [image lockFocus]; [favicon drawInRect: NSMakeRect( urlBounds.origin.x, urlBounds.origin.y, urlBounds.size.height, urlBounds.size.height ) - fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0]; + fromRect: NSZeroRect operation: NSCompositingOperationCopy fraction: 1.0]; urlBounds.origin.x += urlBounds.size.height + 2; [title drawInRect: urlBounds withAttributes: nil]; [image unlockFocus]; @@ -116,8 +115,6 @@ [view dragImage: image at: point offset: NSZeroSize event: [NSApp currentEvent] pasteboard: pb source: self slideBack: YES]; - - [image release]; } - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal @@ -125,7 +122,7 @@ return NSDragOperationCopy | NSDragOperationGeneric; } -- (BOOL) trackMouse: (NSEvent *)theEvent inRect: (NSRect)cellFrame ofView: (NSView *)controlView untilMouseUp: (BOOL)flag; +- (BOOL) trackMouse: (NSEvent *)theEvent inRect: (NSRect)cellFrame ofView: (NSView *)controlView untilMouseUp: (BOOL)flag { const NSPoint point = [controlView convertPoint: [theEvent locationInWindow] fromView: nil]; const NSRect buttonRect = [self buttonFrame: cellFrame]; @@ -141,14 +138,8 @@ } } -- (void) dealloc; -{ - [refreshCell release]; - - [super dealloc]; -} -- (NSRect) buttonFrame: (NSRect) cellFrame; +- (NSRect) buttonFrame: (NSRect) cellFrame { NSRect buttonRect = cellFrame; buttonRect.origin.x = NSMaxX( cellFrame ) - BUTTON_SIZE; @@ -156,7 +147,7 @@ return buttonRect; } -- (NSRect) urlFrame: (NSRect) cellFrame; +- (NSRect) urlFrame: (NSRect) cellFrame { NSRect textFrame = cellFrame; textFrame.origin.x += cellFrame.size.height; @@ -164,7 +155,7 @@ return textFrame; } -- (NSRect) iconFrame: (NSRect)cellFrame; +- (NSRect) iconFrame: (NSRect)cellFrame { NSRect iconFrame = { .origin = { @@ -176,7 +167,7 @@ return NSInsetRect( iconFrame, 2 * PADDING, 2 * PADDING ); } -- (NSButtonCell *) refreshCell; +- (NSButtonCell *) refreshCell { if (nil == refreshCell) { refreshCell = [[NSButtonCell alloc] initImageCell: [NSImage imageNamed: NSImageNameRefreshTemplate]]; @@ -186,22 +177,22 @@ return refreshCell; } -- (void) setRefreshTarget: (id) newTarget; +- (void) setRefreshTarget: (id) newTarget { [[self refreshCell] setTarget: newTarget]; } -- (id) refreshTarget; +- (id) refreshTarget { return [[self refreshCell] target]; } -- (void) setRefreshAction: (SEL) newAction; +- (void) setRefreshAction: (SEL) newAction { [[self refreshCell] setAction: newAction]; } -- (SEL) refreshAction; +- (SEL) refreshAction { return [[self refreshCell] action]; } |