diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-04-02 18:01:28 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-04-02 18:01:28 +0000 |
| commit | ebc8e55d33f011d9c44a5c76f463c99950f0e973 (patch) | |
| tree | 715e11e8bff5125725a1600efbf3a4912b958a82 /macosx/ConfigurationController.m | |
| parent | 761714b617e99eaa5009ccf73e637367c41e3bb2 (diff) | |
| download | pcsxr-ebc8e55d33f011d9c44a5c76f463c99950f0e973.tar.gz | |
OS X:
Stop the memory card images from animating when the preferences window closes.
Other changes and improvements.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89782 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/ConfigurationController.m')
| -rwxr-xr-x | macosx/ConfigurationController.m | 104 |
1 files changed, 69 insertions, 35 deletions
diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m index ab887d69..aef8f7f4 100755 --- a/macosx/ConfigurationController.m +++ b/macosx/ConfigurationController.m @@ -78,7 +78,7 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey"; } } -+ (void)mcdChangeClicked:(id)sender +- (IBAction)mcdChangeClicked:(id)sender { NSInteger tag = [sender tag]; char *mcd; @@ -91,21 +91,21 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey"; mcd = Config.Mcd2; } - [openDlg setAllowedFileTypes:[PcsxrMemCardHandler supportedUTIs]]; - path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:mcd length:strlen(mcd)]; - + + [openDlg setAllowedFileTypes:[PcsxrMemCardHandler supportedUTIs]]; [openDlg setDirectoryURL:[NSURL fileURLWithPath:[path stringByDeletingLastPathComponent] isDirectory:YES]]; [openDlg setNameFieldStringValue:[path lastPathComponent]]; - - if ([openDlg runModal] == NSFileHandlingPanelOKButton) { - NSURL *mcdURL = [openDlg URLs][0]; - - [ConfigurationController setMemoryCard:tag toURL:mcdURL]; - } + [openDlg beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { + if (result == NSFileHandlingPanelOKButton) { + NSURL *mcdURL = [openDlg URLs][0]; + + [ConfigurationController setMemoryCard:tag toURL:mcdURL]; + } + }]; } -+ (void)mcdNewClicked:(id)sender +- (IBAction)mcdNewClicked:(id)sender { NSInteger tag = [sender tag]; char *mcd; @@ -124,15 +124,24 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey"; [openDlg setNameFieldStringValue:NSLocalizedString(@"New Memory Card.mcd", nil)]; [openDlg setAllowedFileTypes:[PcsxrMemCardHandler supportedUTIs]]; - if ([openDlg runModal] == NSFileHandlingPanelOKButton) { - NSURL *mcdURL = [openDlg URL]; - - //Workaround/kludge to make sure we create a memory card before posting a notification - strlcpy(mcd, [[mcdURL path] fileSystemRepresentation], MAXPATHLEN); - CreateMcd(mcd); - - [ConfigurationController setMemoryCard:tag toURL:mcdURL]; - } + [openDlg beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { + if (result == NSFileHandlingPanelOKButton) { + NSURL *mcdURL = [openDlg URL]; + const char *fileSysRep; + + if ([mcdURL respondsToSelector:@selector(fileSystemRepresentation)]) { + fileSysRep = [mcdURL fileSystemRepresentation]; + } else { + fileSysRep = [[mcdURL path] fileSystemRepresentation]; + } + + //Workaround/kludge to make sure we create a memory card before posting a notification + strlcpy(mcd, fileSysRep, MAXPATHLEN); + CreateMcd(mcd); + + [ConfigurationController setMemoryCard:tag toURL:mcdURL]; + } + }]; } - (IBAction)setVideoType:(id)sender @@ -160,6 +169,16 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey"; } } +- (void)windowWillClose:(NSNotification *)notification +{ + [memCardEdit stopMemoryAnimation]; +} + +- (void)windowDidBecomeMain:(NSNotification *)notification +{ + [memCardEdit beginMemoryAnimation]; +} + - (void)awakeFromNib { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -170,21 +189,36 @@ NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey"; self.checkBoxDefaults = [[NSMutableDictionary alloc] init]; // check that the outlets are active before adding them - if (noXaAudioCell) _checkBoxDefaults[@"NoXaAudio"] = noXaAudioCell; - if (enableNetPlayCell) _checkBoxDefaults[@"NetPlay"] = enableNetPlayCell; - if (sioIrqAlwaysCell) _checkBoxDefaults[@"SioIrqAlways"] = sioIrqAlwaysCell; - if (bwMdecCell) _checkBoxDefaults[@"BlackAndWhiteMDECVideo"] = bwMdecCell; - if (autoVTypeCell) _checkBoxDefaults[@"AutoDetectVideoType"] = autoVTypeCell; - if (vTypePALCell) _checkBoxDefaults[@"VideoTypePAL"] = vTypePALCell; - if (noCDAudioCell) _checkBoxDefaults[@"NoCDAudio"] = noCDAudioCell; - if (usesHleCell) _checkBoxDefaults[@"UseHLE"] = usesHleCell; - if (usesDynarecCell) _checkBoxDefaults[@"NoDynarec"] = usesDynarecCell; - if (consoleOutputCell) _checkBoxDefaults[@"ConsoleOutput"] = consoleOutputCell; - if (spuIrqAlwaysCell) _checkBoxDefaults[@"SpuIrqAlways"] = spuIrqAlwaysCell; - if (rCountFixCell) _checkBoxDefaults[@"RootCounterFix"] = rCountFixCell; - if (vSyncWAFixCell) _checkBoxDefaults[@"VideoSyncWAFix"] = vSyncWAFixCell; - if (noFastBootCell) _checkBoxDefaults[@"NoFastBoot"] = noFastBootCell; - if (widescreen) _checkBoxDefaults[@"Widescreen"] = widescreen; + if (noXaAudioCell) + _checkBoxDefaults[@"NoXaAudio"] = noXaAudioCell; + if (enableNetPlayCell) + _checkBoxDefaults[@"NetPlay"] = enableNetPlayCell; + if (sioIrqAlwaysCell) + _checkBoxDefaults[@"SioIrqAlways"] = sioIrqAlwaysCell; + if (bwMdecCell) + _checkBoxDefaults[@"BlackAndWhiteMDECVideo"] = bwMdecCell; + if (autoVTypeCell) + _checkBoxDefaults[@"AutoDetectVideoType"] = autoVTypeCell; + if (vTypePALCell) + _checkBoxDefaults[@"VideoTypePAL"] = vTypePALCell; + if (noCDAudioCell) + _checkBoxDefaults[@"NoCDAudio"] = noCDAudioCell; + if (usesHleCell) + _checkBoxDefaults[@"UseHLE"] = usesHleCell; + if (usesDynarecCell) + _checkBoxDefaults[@"NoDynarec"] = usesDynarecCell; + if (consoleOutputCell) + _checkBoxDefaults[@"ConsoleOutput"] = consoleOutputCell; + if (spuIrqAlwaysCell) + _checkBoxDefaults[@"SpuIrqAlways"] = spuIrqAlwaysCell; + if (rCountFixCell) + _checkBoxDefaults[@"RootCounterFix"] = rCountFixCell; + if (vSyncWAFixCell) + _checkBoxDefaults[@"VideoSyncWAFix"] = vSyncWAFixCell; + if (noFastBootCell) + _checkBoxDefaults[@"NoFastBoot"] = noFastBootCell; + if (widescreen) + _checkBoxDefaults[@"Widescreen"] = widescreen; // make the visuals match the defaults |
