From de13f7dcbaa84255fa578aafe862f90c46225a01 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Wed, 21 Aug 2013 23:19:04 +0000 Subject: Fix OS X 10.8-only behavior in the XGL plug-in. Remove some commented-out code on Cocoa code. Change some ints passed in Cocoa code to NSIntegers. Replace a deprecated function call to NSRunAlertPanelRelativeToWindow. Other minor fixes and improvements. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86808 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/CheatController.m | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'macosx/CheatController.m') diff --git a/macosx/CheatController.m b/macosx/CheatController.m index 2e5976f2..4b91319d 100644 --- a/macosx/CheatController.m +++ b/macosx/CheatController.m @@ -314,28 +314,37 @@ [self setDocumentEdited:NO]; } +- (void)sheetDidDismiss:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + switch (returnCode) { + case NSAlertDefaultReturn: + [self reloadCheats]; + [self close]; + break; + + default: + [self refreshNSCheatArray]; + [self close]; + break; + + case NSAlertOtherReturn: + break; + } +} + - (BOOL)windowShouldClose:(id)sender { if (![sender isDocumentEdited] || ![[self window] isEqual:sender]) { return YES; } else { - //TODO: properly use a non-deprecated method here. - NSInteger retVal = NSRunAlertPanelRelativeToWindow(NSLocalizedString(@"Unsaved Changes", @"Unsaved changes"), NSLocalizedString(@"The Cheat codes have not been applied. Unapplied cheats will not run nor be saved. Do you wish to save?",nil), NSLocalizedString(@"Save", @"Save"), NSLocalizedString(@"Don't Save",@"Don't Save"), NSLocalizedString(@"Cancel", @"Cancel"), sender); - switch (retVal) { - case NSAlertDefaultReturn: - [self reloadCheats]; - return YES; - break; - - default: - [self refreshNSCheatArray]; - return YES; - break; - - case NSAlertOtherReturn: - return NO; - break; - } + NSBeginAlertSheet(NSLocalizedString(@"Unsaved Changes", @"Unsaved changes"), + NSLocalizedString(@"Save", @"Save"), + NSLocalizedString(@"Don't Save",@"Don't Save"), + NSLocalizedString(@"Cancel", @"Cancel"), [self window], self, + NULL, @selector(sheetDidDismiss:returnCode:contextInfo:), NULL, + NSLocalizedString(@"The cheat codes have not been applied. Unapplied cheats will not run nor be saved. Do you wish to save?",nil)); + + return NO; } } -- cgit v1.2.3