Skip to content

Commit 88a3492

Browse files
committed
• Removed the ivar documentWindow from SSYAlert because, since macOS 10.9 and some earlier commit, we now have -[NSWindow sheetParent] and are not using it. Also changed names of such local variables to sheetParent, to match the new Apple symbology.
1 parent 185dfc7 commit 88a3492

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

SSYAlert.h

+4-12
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ extern NSObject <SSYAlertErrorHideManager> * gSSYAlertErrorHideManager ;
389389
NSButton* buttonPrototype ;
390390
NSString* wordAlert ;
391391
NSString* m_whyDisabled ;
392-
NSWindow* documentWindow ;
393392
NSInvocation* m_checkboxInvocation ;
394393

395394
BOOL m_isEnabled ;
@@ -461,13 +460,6 @@ extern NSObject <SSYAlertErrorHideManager> * gSSYAlertErrorHideManager ;
461460
*/
462461
@property (copy) NSString* whyDisabled ;
463462

464-
/*!
465-
@brief A stupid patch for the fact that when a modal sheet ends,
466-
the action method only gives me the button and not the documentWindow
467-
or its sheet which I need to forward to endSheet:.
468-
*/
469-
@property (retain) NSWindow* documentWindow ;
470-
471463
/*!
472464
@brief Indicates which button was last clicked
473465
@@ -791,8 +783,8 @@ extern NSObject <SSYAlertErrorHideManager> * gSSYAlertErrorHideManager ;
791783
This method also posts an SSYAlertDidProcessErrorNotification, unless
792784
the error -isOnlyInformational.
793785
794-
@param error The error to be presented, or nil.
795-
@param documentWindow The document window to which to attach the sheet.
786+
@param error The error to be presented, or nil
787+
@param sheetParent The window upon which to attach the sheet
796788
@param modalDelegate The object which will receive and must respond to
797789
the didEndSelector, or nil if you want the receiver to handle it. If the
798790
receiver handles it, its alertReturn will be set to the NSAlertReturn value
@@ -803,10 +795,10 @@ extern NSObject <SSYAlertErrorHideManager> * gSSYAlertErrorHideManager ;
803795
to make the sheet go away, the didEndSelector must send -orderOut: to the
804796
'sheet' argument it receives.
805797
@param contextInfo Pointer to data which will be returned as the
806-
third element of the didEndSelector.
798+
third element of the didEndSelector
807799
*/
808800
+ (void)alertError:(NSError*)error
809-
onWindow:(NSWindow*)documentWindow
801+
onWindow:(NSWindow*)sheetParent
810802
modalDelegate:(id)modalDelegate
811803
didEndSelector:(SEL)didEndSelector
812804
contextInfo:(void*)contextInfo ;

SSYAlert.m

+10-16
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ - (void)setClickObject:(id)value {
375375
@synthesize iconCritical ;
376376
@synthesize buttonPrototype ;
377377
@synthesize wordAlert ;
378-
@synthesize documentWindow ;
379378

380379
@synthesize isVisible ;
381380
@synthesize nDone ;
@@ -1433,7 +1432,7 @@ - (void)setButton1IfNeeded {
14331432
}
14341433
}
14351434

1436-
- (void)prepareAsSheetOnWindow:(NSWindow*)docWindow {
1435+
- (void)prepareAsSheetOnWindow:(NSWindow*)sheetParent {
14371436
[self setButton1IfNeeded] ;
14381437

14391438
/* Button1 target and action should always be set by setButton1Title: */
@@ -1451,7 +1450,7 @@ - (void)prepareAsSheetOnWindow:(NSWindow*)docWindow {
14511450
[[NSNotificationCenter defaultCenter] addObserver:self
14521451
selector:@selector(parentWindowWillClose:)
14531452
name:NSWindowWillCloseNotification
1454-
object:docWindow] ;
1453+
object:sheetParent] ;
14551454

14561455
[self doooLayout] ;
14571456

@@ -1460,8 +1459,6 @@ - (void)prepareAsSheetOnWindow:(NSWindow*)docWindow {
14601459
}
14611460

14621461
[self setIsDoingModalDialog:YES] ;
1463-
1464-
[self setDocumentWindow:docWindow] ;
14651462
}
14661463

14671464
- (void)parentWindowWillClose:(NSNotification*)note {
@@ -1478,11 +1475,11 @@ - (void)runModalSheetOnWindow:(NSWindow*)docWindow
14781475
}
14791476
}
14801477

1481-
- (void)runModalSheetOnWindow:(NSWindow*)docWindow
1478+
- (void)runModalSheetOnWindow:(NSWindow*)sheetParent
14821479
modalDelegate:(id)modalDelegate
14831480
didEndSelector:(SEL)didEndSelector
14841481
contextInfo:(void*)contextInfo {
1485-
if (docWindow) {
1482+
if (sheetParent) {
14861483
NSAssert(((modalDelegate != nil) == (didEndSelector != nil)), @"222 modalDelegate vs. didEndSelector inconsistency.") ;
14871484
if (!modalDelegate) {
14881485
modalDelegate = self ;
@@ -1492,9 +1489,9 @@ - (void)runModalSheetOnWindow:(NSWindow*)docWindow
14921489
didEndSelector = @selector(sheetDidEnd:returnCode:contextInfo:) ;
14931490
}
14941491

1495-
[self prepareAsSheetOnWindow:docWindow];
1492+
[self prepareAsSheetOnWindow:sheetParent];
14961493

1497-
[docWindow beginSheet:[self window]
1494+
[sheetParent beginSheet:[self window]
14981495
completionHandler:^void(NSModalResponse modalResponse) {
14991496
NSWindow* window = [self window] ;
15001497
NSInvocation* invocation = [NSInvocation invocationWithTarget:modalDelegate
@@ -2122,8 +2119,6 @@ - (void)goAway {
21222119
object:self.window.sheetParent] ;
21232120
}
21242121

2125-
[self setDocumentWindow:nil] ;
2126-
21272122
if (self.window) {
21282123
[self.window.sheetParent endSheet:self.window
21292124
returnCode:[self alertReturn]] ;
@@ -2377,7 +2372,7 @@ - (void)alertError:(NSError*)error
23772372
}
23782373

23792374
- (void)alertError:(NSError*)error
2380-
onWindow:(NSWindow*)documentWindow_
2375+
onWindow:(NSWindow*)sheetParent
23812376
modalDelegate:(id)modalDelegate
23822377
didEndSelector:(SEL)didEndSelector
23832378
contextInfo:(void*)contextInfo {
@@ -2405,7 +2400,7 @@ - (void)alertError:(NSError*)error
24052400
didEndSelector = @selector(errorSheetDidEnd:returnCode:contextInfo:) ;
24062401
}
24072402

2408-
[self runModalSheetOnWindow:documentWindow_
2403+
[self runModalSheetOnWindow:sheetParent
24092404
modalDelegate:modalDelegate
24102405
didEndSelector:didEndSelector
24112406
contextInfo:contextInfo] ;
@@ -2472,7 +2467,7 @@ + (SSYAlertRecovery)alertError:(NSError*)error {
24722467
}
24732468

24742469
+ (void)alertError:(NSError*)error
2475-
onWindow:(NSWindow*)documentWindow_
2470+
onWindow:(NSWindow*)sheetParent
24762471
modalDelegate:(id)modalDelegate
24772472
didEndSelector:(SEL)didEndSelector
24782473
contextInfo:(void*)contextInfo {
@@ -2481,7 +2476,7 @@ + (void)alertError:(NSError*)error
24812476
SSYAlert* alert = [SSYAlert alert] ;
24822477

24832478
[alert alertError:error
2484-
onWindow:documentWindow_
2479+
onWindow:sheetParent
24852480
modalDelegate:modalDelegate
24862481
didEndSelector:didEndSelector
24872482
contextInfo:contextInfo] ;
@@ -2570,7 +2565,6 @@ - (void)dealloc {
25702565
[iconCritical release] ;
25712566
[buttonPrototype release] ;
25722567
[wordAlert release] ;
2573-
[documentWindow release] ;
25742568
[otherSubviews release] ;
25752569
[clickTarget release] ;
25762570
[clickObject release] ;

0 commit comments

Comments
 (0)