Skip to content

Commit

Permalink
Updated for latest Xcode and integrate PR #9
Browse files Browse the repository at this point in the history
  • Loading branch information
sbooth committed Feb 10, 2018
1 parent 3a7bcb5 commit 40b683d
Show file tree
Hide file tree
Showing 14 changed files with 1,187 additions and 5,945 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
All Rights Reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion ExampleAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion ExampleAppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 3 additions & 3 deletions SFBPopover.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -59,8 +59,8 @@ typedef NS_ENUM(NSUInteger, SFBPopoverPosition) {

// ========================================
// Creation
- (nullable id) initWithContentView:(nonnull NSView *)contentView;
- (nullable id) initWithContentViewController:(nonnull NSViewController *)contentViewController;
- (nullable instancetype) initWithContentView:(nonnull NSView *)contentView;
- (nullable instancetype) initWithContentViewController:(nonnull NSViewController *)contentViewController;

// ========================================
// Geometry determination
Expand Down
10 changes: 5 additions & 5 deletions SFBPopover.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -33,7 +33,7 @@
#include <QuartzCore/QuartzCore.h>

// A custom delegate class is used since CAAnimation retains its delegate
@interface SFBPopoverAnimationDelegate : NSObject
@interface SFBPopoverAnimationDelegate : NSObject <CAAnimationDelegate>
{
@private
__weak SFBPopoverWindow *_popoverWindow;
Expand Down Expand Up @@ -81,22 +81,22 @@ - (SFBPopoverWindowFrame *) popoverWindowFrame;

@implementation SFBPopover

- (id) initWithContentView:(NSView *)contentView
- (instancetype) initWithContentView:(NSView *)contentView
{
NSViewController *contentViewController = [[NSViewController alloc] init];
[contentViewController setView:contentView];
return [self initWithContentViewController:contentViewController];
}

- (id) initWithContentViewController:(NSViewController *)contentViewController
- (instancetype) initWithContentViewController:(NSViewController *)contentViewController
{
if((self = [super init])) {
_contentViewController = contentViewController;
self.animates = YES;

NSView *contentView = [_contentViewController view];
_popoverWindow = [[SFBPopoverWindow alloc] initWithContentRect:[contentView frame] styleMask:0 backing:NSBackingStoreBuffered defer:YES];
[_popoverWindow setContentView:contentView];
[_popoverWindow setPopoverContentView:contentView];
[_popoverWindow setMinSize:[contentView frame].size];

CAAnimation *animation = [CABasicAnimation animation];
Expand Down
4 changes: 3 additions & 1 deletion SFBPopoverWindow.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -35,6 +35,8 @@
// ========================================
@interface SFBPopoverWindow : NSWindow

@property (nonatomic, strong) NSView * _Nullable popoverContentView;

// ========================================
// Popover window properties
- (SFBPopoverPosition) popoverPosition;
Expand Down
11 changes: 6 additions & 5 deletions SFBPopoverWindow.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -42,7 +42,7 @@ - (SFBPopoverWindowFrame *) popoverWindowFrame;

@implementation SFBPopoverWindow

- (id) initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
- (instancetype) initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
#pragma unused(windowStyle)
if((self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:deferCreation])) {
Expand All @@ -52,6 +52,7 @@ - (id) initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
[self setAlphaValue:1];
[self setOpaque:NO];
[self setHasShadow:YES];
[self setLevel:NSFloatingWindowLevel];

This comment has been minimized.

Copy link
@sbooth

sbooth Feb 10, 2018

Author Owner

Hopefully this will not cause unintended behavior

}

return self;
Expand All @@ -77,12 +78,12 @@ - (BOOL) canBecomeMainWindow
return NO;
}

- (NSView *) contentView
- (void) setContentView:(NSView *)view
{
return _popoverContentView;
[self setPopoverContentView:view];
}

- (void) setContentView:(NSView *)view
- (void) setPopoverContentView:(NSView *)view
{
if([_popoverContentView isEqualTo:view])
return;
Expand Down
2 changes: 1 addition & 1 deletion SFBPopoverWindowFrame.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions SFBPopoverWindowFrame.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -36,7 +36,7 @@ - (void) appendArrowToPath:(NSBezierPath *)path;

@implementation SFBPopoverWindowFrame

- (id) initWithFrame:(NSRect)frame
- (instancetype) initWithFrame:(NSRect)frame
{
if((self = [super initWithFrame:frame])) {
// Set the default appearance
Expand Down
2 changes: 1 addition & 1 deletion SFBPopovers-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2011, 2012, 2013, 2014, 2015 Stephen F. Booth. All rights reserved.</string>
<string>Copyright © 2011 - 2018 Stephen F. Booth. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion SFBPopovers-Prefix.pch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Stephen F. Booth <me@sbooth.org>
* Copyright (C) 2011 - 2018 Stephen F. Booth <me@sbooth.org>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
48 changes: 47 additions & 1 deletion SFBPopovers.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
32CE12BA1367854000CE7985 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = sbooth.org;
};
buildConfigurationList = 32CE12BD1367854000CE7985 /* Build configuration list for PBXProject "SFBPopovers" */;
Expand Down Expand Up @@ -355,8 +355,31 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
};
Expand All @@ -366,7 +389,30 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
};
name = Release;
Expand Down
Loading

0 comments on commit 40b683d

Please sign in to comment.