Revision: 24080
          http://sourceforge.net/p/bibdesk/svn/24080
Author:   hofman
Date:     2019-07-25 22:38:15 +0000 (Thu, 25 Jul 2019)
Log Message:
-----------
use window method to begin a sheet if available, otherwise provide the method, 
and use window methods to end a sheet if available

Modified Paths:
--------------
    trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
    trunk/bibdesk/NSWindowController_BDSKExtensions.m

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2019-07-25 06:30:24 UTC 
(rev 24079)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2019-07-25 22:38:15 UTC 
(rev 24080)
@@ -622,6 +622,8 @@
                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 */; };
@@ -1710,6 +1712,8 @@
                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>"; };
@@ -2568,6 +2572,8 @@
                                CEDBE0580F4CDAD900190AF5 /* 
NSView_BDSKExtensions.m */,
                                CE4376F50D24341E00C993CF /* 
NSViewAnimation_BDSKExtensions.m */,
                                CE7EA95B0AAC55B2000FE8FD /* 
NSWindowController_BDSKExtensions.m */,
+                               CEC240A922EA64AD00E3C52C /* 
NSWindow_BDSKExtensions.h */,
+                               CEC240AA22EA64AD00E3C52C /* 
NSWindow_BDSKExtensions.m */,
                                F97073AE0911592000526FC8 /* 
NSWorkspace_BDSKExtensions.m */,
                                F947A01B09AA80E4004C27FF /* 
PDFDocument_BDSKExtensions.m */,
                        );
@@ -3665,6 +3671,7 @@
                                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 */,
@@ -4405,6 +4412,7 @@
                                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-25 06:30:24 UTC 
(rev 24079)
+++ trunk/bibdesk/NSWindowController_BDSKExtensions.m   2019-07-25 22:38:15 UTC 
(rev 24080)
@@ -38,6 +38,7 @@
 
 #import "NSWindowController_BDSKExtensions.h"
 #import "NSInvocation_BDSKExtensions.h"
+#import "NSWindow_BDSKExtensions.h"
 
 
 @implementation NSWindowController (BDSKExtensions)
@@ -93,27 +94,19 @@
 
 #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
-       
-       [NSApp beginSheet:[self window]
-          modalForWindow:window
-        modalDelegate:handler ? self : nil
-       didEndSelector:handler ? 
@selector(didEndSheet:returnCode:completionHandler:) : NULL
-                 contextInfo:handler ? Block_copy(handler) : NULL];
+    [window beginSheet:[self window] completionHandler:handler];
 }
 
 - (IBAction)dismiss:(id)sender {
-    [NSApp endSheet:[self window] returnCode:[sender tag]];
-    [[self window] orderOut:self];
+    if ([[self window] respondsToSelector:@selector(sheetParent)] &&
+        [[self window] respondsToSelector:@selector(endSheet:returnCode:)]) {
+        [[[self window] sheetParent] endSheet:[self window] returnCode:[sender 
tag]];
+    } else {
+        [NSApp endSheet:[self window] returnCode:[sender tag]];
+        [[self window] orderOut:self];
+    }
     [self autorelease];
 }
 

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

Reply via email to