Revision: 24081
http://sourceforge.net/p/bibdesk/svn/24081
Author: hofman
Date: 2019-07-25 22:40:27 +0000 (Thu, 25 Jul 2019)
Log Message:
-----------
add NSWindow category to define begin sheet method if not available
Modified Paths:
--------------
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/bibdesk/NSWindow_BDSKExtensions.h
trunk/bibdesk/NSWindow_BDSKExtensions.m
Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2019-07-25 22:38:15 UTC
(rev 24080)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2019-07-25 22:40:27 UTC
(rev 24081)
@@ -2571,9 +2571,8 @@
F9022CA10758038000C3F701 /*
NSTextView_BDSKExtensions.m */,
CEDBE0580F4CDAD900190AF5 /*
NSView_BDSKExtensions.m */,
CE4376F50D24341E00C993CF /*
NSViewAnimation_BDSKExtensions.m */,
+ CEC240AA22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.m */,
CE7EA95B0AAC55B2000FE8FD /*
NSWindowController_BDSKExtensions.m */,
- CEC240A922EA64AD00E3C52C /*
NSWindow_BDSKExtensions.h */,
- CEC240AA22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.m */,
F97073AE0911592000526FC8 /*
NSWorkspace_BDSKExtensions.m */,
F947A01B09AA80E4004C27FF /*
PDFDocument_BDSKExtensions.m */,
);
@@ -3280,10 +3279,11 @@
CEF6E21322903C01009058C2 /*
NSURLSession_BDSKForwardDeclarations.h */,
CEDBE0570F4CDAD900190AF5 /*
NSView_BDSKExtensions.h */,
CE4376F40D24341E00C993CF /*
NSViewAnimation_BDSKExtensions.h */,
+ CEC240A922EA64AD00E3C52C /*
NSWindow_BDSKExtensions.h */,
CEFD45860BFFC1F80027B933 /*
NSWindow+Scripting.h */,
+ 45DB3E4B0CAADFC3001EACDA /*
NSXMLNode_BDSKExtensions.h */,
CE7EA95A0AAC55B2000FE8FD /*
NSWindowController_BDSKExtensions.h */,
F97073AD0911592000526FC8 /*
NSWorkspace_BDSKExtensions.h */,
- 45DB3E4B0CAADFC3001EACDA /*
NSXMLNode_BDSKExtensions.h */,
F947A01A09AA80E4004C27FF /*
PDFDocument_BDSKExtensions.h */,
CE05CF5C0D7743940034C2A8 /* WebURLsWithTitles.h
*/,
3B91DD45162225850088206D /*
WOKMWSAuthenticateService.h */,
Added: trunk/bibdesk/NSWindow_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSWindow_BDSKExtensions.h (rev 0)
+++ trunk/bibdesk/NSWindow_BDSKExtensions.h 2019-07-25 22:40:27 UTC (rev
24081)
@@ -0,0 +1,52 @@
+//
+// NSWindow_BDSKMavericksExtensions.h
+// BibDesk
+//
+// Created by Christiaan Hofman on 26/07/2019.
+/*
+ This software is Copyright (c) 2019
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface NSWindow (BDSKExtensions)
+@end
+
+#if SDK_BEFORE(10_9)
+@interface NSWindow (BDSKMavericksExtensions)
+- (void)beginSheet:(NSWindow *)sheetWindow completionHandler:(void
(^)(NSInteger returnCode))handler;
+- (void)endSheet:(NSWindow *)sheetWindow;
+- (void)endSheet:(NSWindow *)sheetWindow returnCode:(NSInteger)returnCode;
+- (NSWindow *)sheetParent;
+@end
+#endif
Added: trunk/bibdesk/NSWindow_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSWindow_BDSKExtensions.m (rev 0)
+++ trunk/bibdesk/NSWindow_BDSKExtensions.m 2019-07-25 22:40:27 UTC (rev
24081)
@@ -0,0 +1,65 @@
+//
+// NSWindow_BDSKExtensions.m
+// BibDesk
+//
+// Created by Christiaan Hofman on 26/07/2019.
+/*
+ This software is Copyright (c) 2019
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSWindow_BDSKExtensions.h"
+#import "BDSKRuntime.h"
+
+
+@implementation NSWindow (BDSKExtensions)
+
+- (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode
completionHandler:(void *)contextInfo {
+ if (contextInfo != NULL) {
+ void (^handler)(NSInteger) = (void(^)(NSInteger))contextInfo;
+ handler(returnCode);
+ Block_release(handler);
+ }
+}
+
+- (void)fallback_beginSheet:(NSWindow *)sheetWindow completionHandler:(void
(^)(NSInteger returnCode))handler {
+ [NSApp beginSheet:sheetWindow
+ modalForWindow:self
+ modalDelegate:handler ? self : nil
+ didEndSelector:handler ?
@selector(didEndSheet:returnCode:completionHandler:) : NULL
+ contextInfo:handler ? Block_copy(handler) : NULL];
+}
+
++ (void)load {
+ BDSKAddInstanceMethodImplementationFromSelector(self,
@selector(beginSheet:completionHandler:),
@selector(fallback_beginSheet:completionHandler:));
+}
+
+@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit