From fa17fa055451c0e2d3ee378a4bd3496806b5134c Mon Sep 17 00:00:00 2001 From: rogerman Date: Wed, 15 Aug 2012 22:44:31 +0000 Subject: [PATCH] Cocoa Port: - Show the ROM icon and ROM name in the main window's title bar. - Support OS X's standard document handling UI in the main window's title bar. --- .../src/cocoa/userinterface/appDelegate.mm | 1 + .../cocoa/userinterface/emuWindowDelegate.mm | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/desmume/src/cocoa/userinterface/appDelegate.mm b/desmume/src/cocoa/userinterface/appDelegate.mm index 4d6fb1f96..3d197ce32 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.mm +++ b/desmume/src/cocoa/userinterface/appDelegate.mm @@ -249,6 +249,7 @@ //Bring the application to the front [NSApp activateIgnoringOtherApps:TRUE]; + [mainWindow setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]]; [mainWindow makeKeyAndOrderFront:nil]; [mainWindow makeMainWindow]; diff --git a/desmume/src/cocoa/userinterface/emuWindowDelegate.mm b/desmume/src/cocoa/userinterface/emuWindowDelegate.mm index 8c506f4c3..4efcd6565 100644 --- a/desmume/src/cocoa/userinterface/emuWindowDelegate.mm +++ b/desmume/src/cocoa/userinterface/emuWindowDelegate.mm @@ -1286,6 +1286,16 @@ [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[theRom fileURL]]; // Update the UI to indicate that a ROM has indeed been loaded. +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 + [window setRepresentedFilename:[[theRom fileURL] path]]; +#else + [window setRepresentedURL:[theRom fileURL]]; +#endif + [[window standardWindowButton:NSWindowDocumentIconButton] setImage:[theRom icon]]; + + NSString *newWindowTitle = [theRom internalName]; + [window setTitle:newWindowTitle]; + [dispViewDelegate setViewToWhite]; [self setStatus:NSSTRING_STATUS_ROM_LOADED]; [bindings setValue:[NSNumber numberWithBool:NO] forKey:@"isWorking"]; @@ -1341,6 +1351,15 @@ [CocoaDSCheatManager setMasterCheatList:dummyCheatList]; // Update the UI to indicate that the ROM has finished unloading. +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 + [window setRepresentedFilename:nil]; +#else + [window setRepresentedURL:nil]; +#endif + + NSString *newWindowTitle = (NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; + [window setTitle:newWindowTitle]; + [dispViewDelegate setViewToBlack]; [self setStatus:NSSTRING_STATUS_ROM_UNLOADED]; [bindings setValue:[NSNumber numberWithBool:NO] forKey:@"isWorking"];