[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[728] trunk/fuse/fusepb/controllers
Brought to you by:
fredm
From: <fr...@us...> - 2013-02-09 05:02:42
|
Revision: 728 http://sourceforge.net/p/fuse-for-macosx/code/728 Author: fredm Date: 2013-02-09 05:02:38 +0000 (Sat, 09 Feb 2013) Log Message: ----------- Properly handle opening and closing windows more than once. Modified Paths: -------------- trunk/fuse/fusepb/controllers/KeyboardController.m trunk/fuse/fusepb/controllers/MemoryBrowserController.m trunk/fuse/fusepb/controllers/PokeFinderController.m Modified: trunk/fuse/fusepb/controllers/KeyboardController.m =================================================================== --- trunk/fuse/fusepb/controllers/KeyboardController.m 2013-01-21 11:50:05 UTC (rev 727) +++ trunk/fuse/fusepb/controllers/KeyboardController.m 2013-02-09 05:02:38 UTC (rev 728) @@ -35,20 +35,12 @@ - (id)init { - NSNotificationCenter *nc; - self = [super initWithWindowNibName:@"Keyboard"]; [self setWindowFrameAutosaveName:@"KeyboardWindow"]; window_open = 0; - nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self - selector:@selector(handleWillClose:) - name:@"NSWindowWillCloseNotification" - object:[self window]]; - return self; } @@ -70,6 +62,14 @@ - (void)showWindow:(id)sender { + NSNotificationCenter *nc; + + nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self + selector:@selector(handleWillClose:) + name:@"NSWindowWillCloseNotification" + object:[self window]]; + [super showWindow:sender]; /* The TC2068 has a different keyboard layout */ Modified: trunk/fuse/fusepb/controllers/MemoryBrowserController.m =================================================================== --- trunk/fuse/fusepb/controllers/MemoryBrowserController.m 2013-01-21 11:50:05 UTC (rev 727) +++ trunk/fuse/fusepb/controllers/MemoryBrowserController.m 2013-02-09 05:02:38 UTC (rev 728) @@ -36,21 +36,37 @@ - (id)init { - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; - tableContents = nil; self = [super initWithWindowNibName:@"MemoryBrowser"]; [self setWindowFrameAutosaveName:@"MemoryBrowserWindow"]; - + + return self; +} + +- (void)dealloc +{ + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc removeObserver:notificationObserver]; + + [super dealloc]; +} + +- (void)showWindow:(id)sender +{ + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; + size_t i, j; + NSString *address; + NSMutableString *hex, *data; + notificationObserver = [nc addObserverForName:@"NSWindowWillCloseNotification" object:[self window] queue:mainQueue usingBlock:^(NSNotification *note) { [nc removeObserver:notificationObserver]; - + [NSApp stopModal]; [tableContents removeAllObjects]; @@ -63,24 +79,7 @@ [[DisplayOpenGLView instance] unpause]; }]; - - return self; -} - -- (void)dealloc -{ - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc removeObserver:notificationObserver]; - - [super dealloc]; -} - -- (void)showWindow:(id)sender -{ - size_t i, j; - NSString *address; - NSMutableString *hex, *data; - + [[DisplayOpenGLView instance] pause]; tableContents = [NSMutableArray arrayWithCapacity:0xfff]; Modified: trunk/fuse/fusepb/controllers/PokeFinderController.m =================================================================== --- trunk/fuse/fusepb/controllers/PokeFinderController.m 2013-01-21 11:50:05 UTC (rev 727) +++ trunk/fuse/fusepb/controllers/PokeFinderController.m 2013-02-09 05:02:38 UTC (rev 728) @@ -39,17 +39,9 @@ - (id)init { - NSNotificationCenter *nc; - [super init]; self = [super initWithWindowNibName:@"PokeFinder"]; - nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self - selector:@selector(handleWillClose:) - name:@"NSWindowWillCloseNotification" - object:[self window]]; - [self setWindowFrameAutosaveName:@"PokeFinderWindow"]; tableContents = nil; @@ -117,6 +109,14 @@ - (void)showWindow:(id)sender { + NSNotificationCenter *nc; + + nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self + selector:@selector(handleWillClose:) + name:@"NSWindowWillCloseNotification" + object:[self window]]; + [[DisplayOpenGLView instance] pause]; [super showWindow:sender]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |