Revision: 24083
http://sourceforge.net/p/bibdesk/svn/24083
Author: hofman
Date: 2019-07-26 12:14:58 +0000 (Fri, 26 Jul 2019)
Log Message:
-----------
define sheet methods in window controller category where we use it
Modified Paths:
--------------
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
trunk/bibdesk/NSWindowController_BDSKExtensions.m
Removed 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-26 06:30:01 UTC
(rev 24082)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2019-07-26 12:14:58 UTC
(rev 24083)
@@ -622,8 +622,6 @@
CEBC676F0B4A845F00CE0B2D /* BDSKSearchGroupViewController.m in
Sources */ = {isa = PBXBuildFile; fileRef = CEBC676D0B4A845F00CE0B2D /*
BDSKSearchGroupViewController.m */; };
CEBF7AE818F2EB6300012ECD /* WokSearchLiteService.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CEBF7AE618F2EB6300012ECD /*
WokSearchLiteService.m */; };
CEC1CEA80F51D2CE00D18921 /* BDSKReadWriteLock.m in Sources */ =
{isa = PBXBuildFile; fileRef = CEC1CEA60F51D2CE00D18921 /* BDSKReadWriteLock.m
*/; };
- CEC240AB22EA64AD00E3C52C /* NSWindow_BDSKExtensions.h in
Headers */ = {isa = PBXBuildFile; fileRef = CEC240A922EA64AD00E3C52C /*
NSWindow_BDSKExtensions.h */; };
- CEC240AC22EA64AD00E3C52C /* NSWindow_BDSKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CEC240AA22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.m */; };
CEC46E311629743200B51A9D /* NSPasteboard_BDSKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CEC46E2F1629743200B51A9D /*
NSPasteboard_BDSKExtensions.m */; };
CEC7CDE10F6725890051794E /* BDSKFilePathCell.m in Sources */ =
{isa = PBXBuildFile; fileRef = CEC7CDDF0F6725890051794E /* BDSKFilePathCell.m
*/; };
CEC9B8A52172418D00108617 /* BDSKServerInfo+Scripting.m in
Sources */ = {isa = PBXBuildFile; fileRef = CEC9B8A32172418D00108617 /*
BDSKServerInfo+Scripting.m */; };
@@ -1712,8 +1710,6 @@
CEBF7AE618F2EB6300012ECD /* WokSearchLiteService.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= WokSearchLiteService.m; sourceTree = "<group>"; };
CEC1CEA50F51D2CE00D18921 /* BDSKReadWriteLock.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKReadWriteLock.h; sourceTree = "<group>"; };
CEC1CEA60F51D2CE00D18921 /* BDSKReadWriteLock.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKReadWriteLock.m; sourceTree = "<group>"; };
- CEC240A922EA64AD00E3C52C /* NSWindow_BDSKExtensions.h */ = {isa
= PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
NSWindow_BDSKExtensions.h; sourceTree = "<group>"; };
- CEC240AA22EA64AD00E3C52C /* NSWindow_BDSKExtensions.m */ = {isa
= PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
NSWindow_BDSKExtensions.m; sourceTree = "<group>"; };
CEC3158A0F24D0B9008D2C75 /* BDSKRichTextForCommand.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= BDSKRichTextForCommand.h; sourceTree = "<group>"; };
CEC3158B0F24D0B9008D2C75 /* BDSKRichTextForCommand.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = BDSKRichTextForCommand.m; sourceTree = "<group>"; };
CEC46E2E1629743200B51A9D /* NSPasteboard_BDSKExtensions.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = NSPasteboard_BDSKExtensions.h; sourceTree = "<group>"; };
@@ -2167,7 +2163,6 @@
children = (
CE38FABE091D2D0E00BCB69D /* Document */,
CE38FA81091D242E00BCB69D /* Data */,
- CEFF6CCF10C14774006CFC80 /* Groups */,
CE38FA8C091D260400BCB69D /* Managers */,
CE38FA80091D241600BCB69D /* Controllers */,
CE38FA8D091D267A00BCB69D /* Parsers */,
@@ -2466,6 +2461,7 @@
CE2E0F4B203E339400FD39A8 /* Web Parsers */ = {
isa = PBXGroup;
children = (
+ CEFF6CCF10C14774006CFC80 /* Groups */,
CE3A254E0B75FF09006B64D3 /* BDSKWebParser.m */,
CE77963F20372B90009C6A52 /*
BDSKAsynchronousWebParser.m */,
45DB3E480CAADFC3001EACDA /* BDSKACMDLParser.m
*/,
@@ -2571,7 +2567,6 @@
F9022CA10758038000C3F701 /*
NSTextView_BDSKExtensions.m */,
CEDBE0580F4CDAD900190AF5 /*
NSView_BDSKExtensions.m */,
CE4376F50D24341E00C993CF /*
NSViewAnimation_BDSKExtensions.m */,
- CEC240AA22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.m */,
CE7EA95B0AAC55B2000FE8FD /*
NSWindowController_BDSKExtensions.m */,
F97073AE0911592000526FC8 /*
NSWorkspace_BDSKExtensions.m */,
F947A01B09AA80E4004C27FF /*
PDFDocument_BDSKExtensions.m */,
@@ -3279,7 +3274,6 @@
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 */,
@@ -3671,7 +3665,6 @@
CE2A0A8B22459A3600A8F31C /*
BDSKTextImportController.h in Headers */,
CE2A0A5E22459A0A00A8F31C /*
BDSKScriptHook+Scripting.h in Headers */,
CE2A09CE2245997A00A8F31C /*
BDSKCiteULikeParser.h in Headers */,
- CEC240AB22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.h in Headers */,
CE2A0A0A224599E900A8F31C /*
BDSKFormatStringFieldEditor.h in Headers */,
CE2A0AB422459A4500A8F31C /* BibPref_AutoFile.h
in Headers */,
CE2A09BD2245997A00A8F31C /*
BDSKAutoFileCommand.h in Headers */,
@@ -4412,7 +4405,6 @@
CED5203122846D6100F87B8A /*
BDSKTouchBarButtonGroup.m in Sources */,
F9937E250AD82690001D1DFB /*
PDFDocument_BDSKExtensions.m in Sources */,
CE95AF180ADBE7C000CB20E7 /*
BDSKTemplateObjectProxy.m in Sources */,
- CEC240AC22EA64AD00E3C52C /*
NSWindow_BDSKExtensions.m in Sources */,
CE7596000ADDB0E1009C1329 /* BDSKContainerView.m
in Sources */,
F9A2245D0AE02C8E0046CA3D /* BDSKFileSearch.m in
Sources */,
CE5C29CE0AE14FEC00C3E6B5 /*
BibDocument_Actions.m in Sources */,
Modified: trunk/bibdesk/NSWindowController_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSWindowController_BDSKExtensions.m 2019-07-26 06:30:01 UTC
(rev 24082)
+++ trunk/bibdesk/NSWindowController_BDSKExtensions.m 2019-07-26 12:14:58 UTC
(rev 24083)
@@ -38,8 +38,15 @@
#import "NSWindowController_BDSKExtensions.h"
#import "NSInvocation_BDSKExtensions.h"
-#import "NSWindow_BDSKExtensions.h"
+#if SDK_BEFORE(10_9)
+@interface NSWindow (BDSKMavericksDeclarations)
+- (void)beginSheet:(NSWindow *)sheetWindow completionHandler:(void
(^)(NSInteger returnCode))handler;
+- (void)endSheet:(NSWindow *)sheetWindow;
+- (void)endSheet:(NSWindow *)sheetWindow returnCode:(NSInteger)returnCode;
+- (NSWindow *)sheetParent;
+@end
+#endif
@implementation NSWindowController (BDSKExtensions)
@@ -94,9 +101,25 @@
#pragma mark Sheet methods
+- (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)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void
(^)(NSInteger result))handler {
[self retain]; // make sure we stay around long enough
- [window beginSheet:[self window] completionHandler:handler];
+ if ([window respondsToSelector:@selector(beginSheet:completionHandler:)]) {
+ [window beginSheet:[self window] completionHandler:handler];
+ } else {
+ [NSApp beginSheet:[self window]
+ modalForWindow:window
+ modalDelegate:handler ? self : nil
+ didEndSelector:handler ?
@selector(didEndSheet:returnCode:completionHandler:) : NULL
+ contextInfo:handler ? Block_copy(handler) : NULL];
+ }
}
- (IBAction)dismiss:(id)sender {
Deleted: trunk/bibdesk/NSWindow_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSWindow_BDSKExtensions.h 2019-07-26 06:30:01 UTC (rev
24082)
+++ trunk/bibdesk/NSWindow_BDSKExtensions.h 2019-07-26 12:14:58 UTC (rev
24083)
@@ -1,52 +0,0 @@
-//
-// 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
Deleted: trunk/bibdesk/NSWindow_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSWindow_BDSKExtensions.m 2019-07-26 06:30:01 UTC (rev
24082)
+++ trunk/bibdesk/NSWindow_BDSKExtensions.m 2019-07-26 12:14:58 UTC (rev
24083)
@@ -1,65 +0,0 @@
-//
-// 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