summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-02-08 21:10:51 +0000
committerVincent Sanders <vince@kyllikki.org>2016-02-08 21:20:13 +0000
commit405965d871d00c2fe679bb066290afa11e23b95b (patch)
tree60bed8dbf0432c833c4e9bae70826c48243fd5aa
parentdf2d62a872ebd9af169f943931c155f12b763c12 (diff)
downloadnetsurf-405965d871d00c2fe679bb066290afa11e23b95b.tar.gz
netsurf-405965d871d00c2fe679bb066290afa11e23b95b.tar.bz2
Update Mac OS X cocoa frontend to build using SDK 10.10
-rw-r--r--cocoa/ArrowBox.m251
-rw-r--r--cocoa/ArrowWindow.m312
-rw-r--r--cocoa/BrowserViewController.h1
-rw-r--r--cocoa/PSMTabBarControl/PSMTabBarControl.h3
-rw-r--r--cocoa/PSMTabBarControl/PSMTabBarControl.m13
-rw-r--r--cocoa/SearchWindowController.h4
-rw-r--r--cocoa/gui.m2
7 files changed, 316 insertions, 270 deletions
diff --git a/cocoa/ArrowBox.m b/cocoa/ArrowBox.m
index 9cf0acbc6..6605fcca9 100644
--- a/cocoa/ArrowBox.m
+++ b/cocoa/ArrowBox.m
@@ -1,15 +1,28 @@
-/* Copyright (c) 1011 Sven Weidauer
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
+/* Copyright 2011 Sven Weidauer
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
#import "ArrowBox.h"
-
@implementation ArrowBox
@synthesize arrowPosition;
@@ -17,128 +30,134 @@
@synthesize arrowEdge;
@synthesize cornerRadius;
-- (void) setArrowEdge: (ArrowEdge)newEdge;
+- (void) setArrowEdge: (ArrowEdge)newEdge
{
- if (arrowEdge == newEdge) return;
-
- arrowEdge = newEdge;
-
- [self setNeedsDisplay: YES];
- updateShadow = YES;
+ if (arrowEdge == newEdge) {
+ return;
+ }
+
+ arrowEdge = newEdge;
+
+ [self setNeedsDisplay: YES];
+ updateShadow = YES;
}
-- (void) setArrowSize: (CGFloat)newSize;
+
+- (void) setArrowSize: (CGFloat)newSize
{
- arrowSize = newSize;
- [self setNeedsDisplay: YES];
- updateShadow = YES;
+ arrowSize = newSize;
+ [self setNeedsDisplay: YES];
+ updateShadow = YES;
}
-- (void) setCornerRadius: (CGFloat)newRadius;
+
+- (void) setCornerRadius: (CGFloat)newRadius
{
- cornerRadius = newRadius;
- [self setNeedsDisplay: YES];
- updateShadow = YES;
+ cornerRadius = newRadius;
+ [self setNeedsDisplay: YES];
+ updateShadow = YES;
}
-- (void) setArrowPosition: (CGFloat)newPosition;
+- (void) setArrowPosition: (CGFloat)newPosition
{
- arrowPosition = newPosition;
-
- [self setNeedsDisplay: YES];
- updateShadow = YES;
+ arrowPosition = newPosition;
+
+ [self setNeedsDisplay: YES];
+ updateShadow = YES;
}
-- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- arrowPosition = 50;
- cornerRadius = 10;
- arrowSize = 15;
- }
- return self;
+
+- (id)initWithFrame:(NSRect)frame
+{
+ self = [super initWithFrame:frame];
+ if (self) {
+ arrowPosition = 50;
+ cornerRadius = 10;
+ arrowSize = 15;
+ }
+ return self;
}
-- (void)drawRect:(NSRect)dirtyRect
+- (void)drawRect:(NSRect)dirtyRect
{
- [[NSColor clearColor] set];
- [NSBezierPath fillRect: dirtyRect];
-
- NSBezierPath *path = [NSBezierPath bezierPath];
-
- NSRect bounds = [self convertRectToBase: NSInsetRect( [self bounds], 2, 2 )];
- bounds.origin.x = floor( bounds.origin.x );
- bounds.origin.y = floor( bounds.origin.y );
- bounds.size.width = floor( bounds.size.width );
- bounds.size.height = floor( bounds.size.height );
- bounds = [self convertRectFromBase: bounds];
-
- const CGFloat right = bounds.size.width - arrowSize;
- const CGFloat top = bounds.size.height - arrowSize;
- const CGFloat left = arrowSize;
- const CGFloat bottom = arrowSize;
-
- [path setLineJoinStyle:NSRoundLineJoinStyle];
-
- [path moveToPoint: NSMakePoint( right - cornerRadius, top )];
-
- if (arrowEdge == ArrowTopEdge) {
- [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, top )];
- [path lineToPoint: NSMakePoint( arrowPosition, top + arrowSize )];
- [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, top )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( left, top )
- toPoint: NSMakePoint( left, top - cornerRadius )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowLeftEdge) {
- [path lineToPoint: NSMakePoint( left, bottom + arrowPosition + arrowSize )];
- [path lineToPoint: NSMakePoint( left - arrowSize, bottom + arrowPosition )];
- [path lineToPoint: NSMakePoint( left, bottom + arrowPosition - arrowSize )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( left, bottom )
- toPoint: NSMakePoint( left + cornerRadius, bottom )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowBottomEdge) {
- [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, bottom )];
- [path lineToPoint: NSMakePoint( arrowPosition, bottom - arrowSize )];
- [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, bottom )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( right, bottom )
- toPoint: NSMakePoint( right, bottom + cornerRadius )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowRightEdge) {
- [path lineToPoint: NSMakePoint( right, bottom + arrowPosition - arrowSize )];
- [path lineToPoint: NSMakePoint( right + arrowSize, bottom + arrowPosition )];
- [path lineToPoint: NSMakePoint( right, bottom + arrowPosition + arrowSize )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( right, top )
- toPoint: NSMakePoint( right - cornerRadius, top )
- radius: cornerRadius];
- [path closePath];
-
- [[NSColor colorWithDeviceWhite: 1.0 alpha: 0.4] set];
- [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.75] setFill];
-
- NSAffineTransform *transform = [NSAffineTransform transform];
- [transform translateXBy: bounds.origin.x yBy: bounds.origin.y];
- [transform concat];
-
- [path setLineWidth: 2.0];
- [path fill];
- [path stroke];
-
- if (updateShadow) {
- [[self window] invalidateShadow];
- [[self window] update];
- updateShadow = NO;
- }
+ [[NSColor clearColor] set];
+ [NSBezierPath fillRect: dirtyRect];
+
+ NSBezierPath *path = [NSBezierPath bezierPath];
+
+ NSRect bounds = [self convertRectToBase: NSInsetRect( [self bounds], 2, 2 )];
+ bounds.origin.x = floor( bounds.origin.x );
+ bounds.origin.y = floor( bounds.origin.y );
+ bounds.size.width = floor( bounds.size.width );
+ bounds.size.height = floor( bounds.size.height );
+ bounds = [self convertRectFromBase: bounds];
+
+ const CGFloat right = bounds.size.width - arrowSize;
+ const CGFloat top = bounds.size.height - arrowSize;
+ const CGFloat left = arrowSize;
+ const CGFloat bottom = arrowSize;
+
+ [path setLineJoinStyle:NSRoundLineJoinStyle];
+
+ [path moveToPoint: NSMakePoint( right - cornerRadius, top )];
+
+ if (arrowEdge == ArrowTopEdge) {
+ [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, top )];
+ [path lineToPoint: NSMakePoint( arrowPosition, top + arrowSize )];
+ [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, top )];
+ }
+
+ [path appendBezierPathWithArcFromPoint: NSMakePoint( left, top )
+ toPoint: NSMakePoint( left, top - cornerRadius )
+ radius: cornerRadius];
+
+ if (arrowEdge == ArrowLeftEdge) {
+ [path lineToPoint: NSMakePoint( left, bottom + arrowPosition + arrowSize )];
+ [path lineToPoint: NSMakePoint( left - arrowSize, bottom + arrowPosition )];
+ [path lineToPoint: NSMakePoint( left, bottom + arrowPosition - arrowSize )];
+ }
+
+ [path appendBezierPathWithArcFromPoint: NSMakePoint( left, bottom )
+ toPoint: NSMakePoint( left + cornerRadius, bottom )
+ radius: cornerRadius];
+
+ if (arrowEdge == ArrowBottomEdge) {
+ [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, bottom )];
+ [path lineToPoint: NSMakePoint( arrowPosition, bottom - arrowSize )];
+ [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, bottom )];
+ }
+
+ [path appendBezierPathWithArcFromPoint: NSMakePoint( right, bottom )
+ toPoint: NSMakePoint( right, bottom + cornerRadius )
+ radius: cornerRadius];
+
+ if (arrowEdge == ArrowRightEdge) {
+ [path lineToPoint: NSMakePoint( right, bottom + arrowPosition - arrowSize )];
+ [path lineToPoint: NSMakePoint( right + arrowSize, bottom + arrowPosition )];
+ [path lineToPoint: NSMakePoint( right, bottom + arrowPosition + arrowSize )];
+ }
+
+ [path appendBezierPathWithArcFromPoint: NSMakePoint( right, top )
+ toPoint: NSMakePoint( right - cornerRadius, top )
+ radius: cornerRadius];
+ [path closePath];
+
+ [[NSColor colorWithDeviceWhite: 1.0 alpha: 0.4] set];
+ [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.75] setFill];
+
+ NSAffineTransform *transform = [NSAffineTransform transform];
+ [transform translateXBy: bounds.origin.x yBy: bounds.origin.y];
+ [transform concat];
+
+ [path setLineWidth: 2.0];
+ [path fill];
+ [path stroke];
+
+ if (updateShadow) {
+ [[self window] invalidateShadow];
+ [[self window] update];
+ updateShadow = NO;
+ }
}
@end
diff --git a/cocoa/ArrowWindow.m b/cocoa/ArrowWindow.m
index d6bd95b19..b322a11b5 100644
--- a/cocoa/ArrowWindow.m
+++ b/cocoa/ArrowWindow.m
@@ -1,10 +1,25 @@
-/* Copyright (c) 1011 Sven Weidauer
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/* Copyright 2011 Sven Weidauer
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
#import "ArrowWindow.h"
#import "ArrowBox.h"
@@ -15,201 +30,208 @@
- (id) initWithContentRect: (NSRect)contentRect styleMask: (NSUInteger)aStyle backing: (NSBackingStoreType)bufferingType defer: (BOOL)flag
{
- if ((self = [super initWithContentRect: contentRect styleMask: NSBorderlessWindowMask backing: bufferingType defer: flag]) == nil) return nil;
-
- [self setBackgroundColor: [NSColor clearColor]];
- [self setOpaque: NO];
- [self setHasShadow: YES];
-
- return self;
-}
-
-- (void) setContentView: (NSView *)aView;
-{
- if (aView == content) return;
-
- [content removeFromSuperview];
- content = aView;
-
- if (content == nil) return;
-
- if (box == nil) {
- box = [[ArrowBox alloc] initWithFrame: NSZeroRect];
- [box setArrowEdge: ArrowTopEdge];
- [super setContentView: box];
- [box release];
- }
-
- [box addSubview: content];
-
- NSRect frame = [self contentRectForFrameRect: [self frame]];
- frame.origin = [self convertScreenToBase: frame.origin];
- frame = [box convertRect: frame fromView: nil];
-
- [content setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
- [content setFrame: frame];
-}
-
-- (void) setContentSize: (NSSize)aSize;
-{
- NSRect frame = [content frame];
- frame.size = aSize;
-
- frame = [box convertRect: frame toView: nil];
- frame.origin = [self convertBaseToScreen: frame.origin];
- frame = [self frameRectForContentRect: frame];
-
- [self setFrame: frame display: YES];
+ if ((self = [super initWithContentRect: contentRect styleMask: NSBorderlessWindowMask backing: bufferingType defer: flag]) == nil) {
+ return nil;
+ }
+
+ [self setBackgroundColor: [NSColor clearColor]];
+ [self setOpaque: NO];
+ [self setHasShadow: YES];
+
+ return self;
+}
+
+- (void) setContentView: (NSView *)aView
+{
+ if (aView == content) return;
+
+ [content removeFromSuperview];
+ content = aView;
+
+ if (content == nil) return;
+
+ if (box == nil) {
+ box = [[ArrowBox alloc] initWithFrame: NSZeroRect];
+ [box setArrowEdge: ArrowTopEdge];
+ [super setContentView: box];
+ [box release];
+ }
+
+ [box addSubview: content];
+
+ NSRect frame = [self contentRectForFrameRect: [self frame]];
+ frame.origin = [self convertScreenToBase: frame.origin];
+ frame = [box convertRect: frame fromView: nil];
+
+ [content setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+ [content setFrame: frame];
+}
+
+- (void) setContentSize: (NSSize)aSize
+{
+ NSRect frame = [content frame];
+ frame.size = aSize;
+
+ frame = [box convertRect: frame toView: nil];
+ frame.origin = [self convertBaseToScreen: frame.origin];
+ frame = [self frameRectForContentRect: frame];
+
+ [self setFrame: frame display: YES];
}
static const CGFloat padding = 0;
-- (NSRect) contentRectForFrameRect: (NSRect)frameRect;
+- (NSRect) contentRectForFrameRect: (NSRect)frameRect
{
- const CGFloat arrowSize = [box arrowSize];
- const CGFloat offset = 2 * (padding + arrowSize );
+ const CGFloat arrowSize = [box arrowSize];
+ const CGFloat offset = 2 * (padding + arrowSize );
- return NSInsetRect( frameRect, offset, offset );
+ return NSInsetRect( frameRect, offset, offset );
}
-- (NSRect) frameRectForContentRect: (NSRect)contentRect;
+- (NSRect) frameRectForContentRect: (NSRect)contentRect
{
- const CGFloat arrowSize = [box arrowSize];
- const CGFloat offset = -2 * (padding + arrowSize );
-
- return NSInsetRect( contentRect, offset, offset );
+ const CGFloat arrowSize = [box arrowSize];
+ const CGFloat offset = -2 * (padding + arrowSize );
+
+ return NSInsetRect( contentRect, offset, offset );
}
-+ (NSRect) frameRectForContentRect: (NSRect)cRect styleMask: (NSUInteger)aStyle;
++ (NSRect) frameRectForContentRect: (NSRect)cRect styleMask: (NSUInteger)aStyle
{
- const CGFloat DefaultArrowSize = 15;
- const CGFloat offset = -2 * (padding + DefaultArrowSize);
-
- return NSInsetRect( cRect, offset, offset );
+ const CGFloat DefaultArrowSize = 15;
+ const CGFloat offset = -2 * (padding + DefaultArrowSize);
+
+ return NSInsetRect( cRect, offset, offset );
}
-- (BOOL) canBecomeKeyWindow;
+- (BOOL) canBecomeKeyWindow
{
- return acceptsKey;
+ return acceptsKey;
}
-- (void) moveToPoint: (NSPoint) screenPoint;
+- (void) moveToPoint: (NSPoint) screenPoint
{
- switch ([box arrowEdge]) {
- case ArrowNone:
- screenPoint.x -= [box arrowSize];
- screenPoint.y += [box arrowSize];
- break;
-
- case ArrowTopEdge:
- screenPoint.x -= [box arrowPosition];
- break;
-
- case ArrowBottomEdge:
- screenPoint.x -= [box arrowPosition];
- screenPoint.y += NSHeight( [self frame] );
- break;
-
- case ArrowLeftEdge:
- screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
- break;
-
- case ArrowRightEdge:
- screenPoint.x -= NSWidth( [self frame] );
- screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
- break;
- }
-
- [self setFrameTopLeftPoint: screenPoint];
+ switch ([box arrowEdge]) {
+ case ArrowNone:
+ screenPoint.x -= [box arrowSize];
+ screenPoint.y += [box arrowSize];
+ break;
+
+ case ArrowTopEdge:
+ screenPoint.x -= [box arrowPosition];
+ break;
+
+ case ArrowBottomEdge:
+ screenPoint.x -= [box arrowPosition];
+ screenPoint.y += NSHeight( [self frame] );
+ break;
+
+ case ArrowLeftEdge:
+ screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
+ break;
+
+ case ArrowRightEdge:
+ screenPoint.x -= NSWidth( [self frame] );
+ screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
+ break;
+ }
+
+ [self setFrameTopLeftPoint: screenPoint];
}
static NSRect ScreenRectForView( NSView *view )
{
- NSRect viewRect = [view bounds]; // in View coordinate system
- viewRect = [view convertRect: viewRect toView: nil]; // translate to window coordinates
- viewRect.origin = [[view window] convertBaseToScreen: viewRect.origin]; // translate to screen coordinates
- return viewRect;
+ NSRect viewRect = [view bounds]; // in View coordinate system
+ viewRect = [view convertRect: viewRect toView: nil]; // translate to window coordinates
+ viewRect.origin = [[view window] convertBaseToScreen: viewRect.origin]; // translate to screen coordinates
+ return viewRect;
}
-- (void) attachToView: (NSView *) view;
+- (void) attachToView: (NSView *) view
{
- if (nil != attachedWindow) [self detach];
-
- NSRect viewRect = ScreenRectForView( view );
- NSPoint arrowPoint;
- switch ([box arrowEdge]) {
- case ArrowNone:
- case ArrowTopEdge:
- arrowPoint = NSMakePoint( NSMidX( viewRect ), NSMinY( viewRect ) );
- break;
-
- case ArrowLeftEdge:
- arrowPoint = NSMakePoint( NSMaxX( viewRect ), NSMidY( viewRect ) );
- break;
+ if (nil != attachedWindow) [self detach];
+
+ NSRect viewRect = ScreenRectForView( view );
+ NSPoint arrowPoint;
+
+ switch ([box arrowEdge]) {
+ case ArrowNone:
+ case ArrowTopEdge:
+ arrowPoint = NSMakePoint( NSMidX( viewRect ),
+ NSMinY( viewRect ) );
+ break;
+
+ case ArrowLeftEdge:
+ arrowPoint = NSMakePoint( NSMaxX( viewRect ),
+ NSMidY( viewRect ) );
+ break;
- case ArrowBottomEdge:
- arrowPoint = NSMakePoint( NSMidX( viewRect ), NSMaxY( viewRect ) );
- break;
+ case ArrowBottomEdge:
+ arrowPoint = NSMakePoint( NSMidX( viewRect ),
+ NSMaxY( viewRect ) );
+ break;
- case ArrowRightEdge:
- arrowPoint = NSMakePoint( NSMinX( viewRect ), NSMidY( viewRect ) );
- break;
- }
- attachedWindow = [view window];
- [self moveToPoint: arrowPoint];
- [attachedWindow addChildWindow: self ordered: NSWindowAbove];
+ case ArrowRightEdge:
+ arrowPoint = NSMakePoint( NSMinX( viewRect ),
+ NSMidY( viewRect ) );
+ break;
+ }
+ attachedWindow = [view window];
+ [self moveToPoint: arrowPoint];
+ [attachedWindow addChildWindow: self ordered: NSWindowAbove];
}
-- (void) detach;
+- (void) detach
{
- [attachedWindow removeChildWindow: self];
- [self close];
- attachedWindow = nil;
+ [attachedWindow removeChildWindow: self];
+ [self close];
+ attachedWindow = nil;
}
//MARK: -
//MARK: Properties
-- (void) setArrowPosition: (CGFloat) newPosition;
+- (void) setArrowPosition: (CGFloat) newPosition
{
- [box setArrowPosition: newPosition];
+ [box setArrowPosition: newPosition];
}
-- (CGFloat) arrowPosition;
+- (CGFloat) arrowPosition
{
- return [box arrowPosition];
+ return [box arrowPosition];
}
-- (void) setArrowSize: (CGFloat)newSize;
+- (void) setArrowSize: (CGFloat)newSize
{
- NSRect contentRect = [self contentRectForFrameRect: [self frame]];
- [box setArrowSize: newSize];
- [self setFrame: [self frameRectForContentRect: contentRect] display: [self isVisible]];
+ NSRect contentRect = [self contentRectForFrameRect: [self frame]];
+ [box setArrowSize: newSize];
+ [self setFrame: [self frameRectForContentRect: contentRect] display: [self isVisible]];
}
-- (CGFloat) arrowSize;
+- (CGFloat) arrowSize
{
- return [box arrowSize];
+ return [box arrowSize];
}
-- (void) setArrowEdge: (ArrowEdge) newEdge;
+- (void) setArrowEdge: (ArrowEdge) newEdge
{
- [box setArrowEdge: newEdge];
+ [box setArrowEdge: newEdge];
}
-- (ArrowEdge) arrowEdge;
+- (ArrowEdge) arrowEdge
{
- return [box arrowEdge];
+ return [box arrowEdge];
}
-- (void) setCornerRadius: (CGFloat)newRadius;
+- (void) setCornerRadius: (CGFloat)newRadius
{
- [box setCornerRadius: newRadius];
+ [box setCornerRadius: newRadius];
}
-- (CGFloat) cornerRadius;
+- (CGFloat) cornerRadius
{
- return [box cornerRadius];
+ return [box cornerRadius];
}
@end
diff --git a/cocoa/BrowserViewController.h b/cocoa/BrowserViewController.h
index 6c498766e..3975ea494 100644
--- a/cocoa/BrowserViewController.h
+++ b/cocoa/BrowserViewController.h
@@ -24,7 +24,6 @@ struct browser_window;
@class BrowserWindowController;
@interface BrowserViewController : NSViewController {
- struct browser_window *browser;
NSString *url;
BrowserView *browserView;
BrowserWindowController *windowController;
diff --git a/cocoa/PSMTabBarControl/PSMTabBarControl.h b/cocoa/PSMTabBarControl/PSMTabBarControl.h
index 5ad02e5c1..980c43d38 100644
--- a/cocoa/PSMTabBarControl/PSMTabBarControl.h
+++ b/cocoa/PSMTabBarControl/PSMTabBarControl.h
@@ -163,7 +163,8 @@ enum {
- (PSMTabBarTearOffStyle)tearOffStyle;
- (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle;
-+ (Class) defaultStyleClass;
+// Factory for default style
++ (Class)defaultStyleClass;
// accessors
- (NSTabView *)tabView;
diff --git a/cocoa/PSMTabBarControl/PSMTabBarControl.m b/cocoa/PSMTabBarControl/PSMTabBarControl.m
index 3a7e0c6d4..cb0e0342c 100644
--- a/cocoa/PSMTabBarControl/PSMTabBarControl.m
+++ b/cocoa/PSMTabBarControl/PSMTabBarControl.m
@@ -6,6 +6,8 @@
// Copyright 2005 Positive Spin Media. All rights reserved.
//
+#import <objc/runtime.h>
+
#import "PSMTabBarControl.h"
#import "PSMTabBarCell.h"
#import "PSMOverflowPopUpButton.h"
@@ -67,7 +69,8 @@
#pragma mark -
#pragma mark Characteristics
-+ (NSBundle *)bundle;
+
++ (NSBundle *)bundle
{
static NSBundle *bundle = nil;
if(!bundle) {
@@ -174,7 +177,7 @@
}
}
-+ (Class) defaultStyleClass;
++ (Class) defaultStyleClass
{
return [PSMUnifiedTabStyle class];
}
@@ -350,7 +353,9 @@
- (void)setStyleNamed:(NSString *)name {
Class styleClass = NSClassFromString( [NSString stringWithFormat: @"PSM%@TabStyle", [name capitalizedString]] );
- if (styleClass == Nil) styleClass = [isa defaultStyleClass];
+ if (styleClass == Nil) {
+ styleClass = object_getClass([PSMTabBarControl defaultStyleClass]);
+ }
id <PSMTabStyle> newStyle = [[styleClass alloc] init];
[self setStyle:newStyle];
@@ -369,7 +374,7 @@
_tabBarWidth = 120;
}
- if(lastOrientation != _orientation) {
+ if (lastOrientation != _orientation) {
[[self style] setOrientation:_orientation];
[self _positionOverflowMenu]; //move the overflow popup button to the right place
diff --git a/cocoa/SearchWindowController.h b/cocoa/SearchWindowController.h
index 896983b30..7ce8c00c9 100644
--- a/cocoa/SearchWindowController.h
+++ b/cocoa/SearchWindowController.h
@@ -49,6 +49,6 @@ typedef enum {
- (void) search: (SearchDirection)direction;
-struct gui_search_table *cocoa_search_table;
-
@end
+
+struct gui_search_table *cocoa_search_table;
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 162d831a4..0cd3d8071 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -249,7 +249,7 @@ static void gui_create_form_select_menu(struct gui_window *g,
struct form_control *control)
{
BrowserViewController * const window = (BrowserViewController *)g;
- FormSelectMenu *menu = [[FormSelectMenu alloc] initWithControl: control forWindow: window->browser];
+ FormSelectMenu *menu = [[FormSelectMenu alloc] initWithControl: control forWindow: [window browser]];
[menu runInView: [window browserView]];
[menu release];
}