From 5d01d0bdad4e8ae752545dbbd4936b8a1bd5f01e Mon Sep 17 00:00:00 2001 From: Joe Savage Date: Thu, 13 Nov 2014 13:01:09 +0000 Subject: [PATCH] update comments in SBAppDelegate --- Binspect/SBAppDelegate.m | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Binspect/SBAppDelegate.m b/Binspect/SBAppDelegate.m index 13ee9dc..d3155ab 100644 --- a/Binspect/SBAppDelegate.m +++ b/Binspect/SBAppDelegate.m @@ -11,27 +11,36 @@ @implementation SBAppDelegate +// An application delegate method invoked prior to default re-open behaviour - (BOOL) applicationShouldHandleReopen:(NSApplication *)application hasVisibleWindows:(BOOL)hasVisibleWindows { - if (!hasVisibleWindows) [_windowController initiateWindowAction]; - return YES; // The application has decided to open in response to this reopen request + // Tell the window controller to initiate an action, and return that the application successfully handled the re-open request + if (!hasVisibleWindows) [_windowController initiateWindowAction]; + return YES; } +// An application delegate method invoked when the application has finished launching - (void) applicationDidFinishLaunching:(NSNotification *)notification { - _windowController = [[SBWindowController alloc] init]; - [_windowController initiateWindowAction]; + // Allocate and initialise an SBWindowController instance, calling 'initiateWindowAction' on it to kick things off + _windowController = [[SBWindowController alloc] init]; + [_windowController initiateWindowAction]; } +// An application delegate method invoked when the application is about to terminate - (void) applicationWillTerminate:(NSNotification *)notification { - [_windowController release]; - _windowController = nil; + // Release the NSNotification instance allocated in 'applicationDidFinishLaunching' + [_windowController release]; + _windowController = nil; } +// An application delegate method to handle opening a file with the specified path - (BOOL) application:(NSApplication *)application openFile:(NSString *)filename { - return [_windowController openFile:filename]; + return [_windowController openFile:filename]; } // A method to handle the action sent from the 'Open' command in the menu bar // (Should be available even when the main window is closed, so defined in this file) -- (IBAction) openDocument:(id)sender { [_windowController presentOpenDialog]; } +- (IBAction) openDocument:(id)sender { + [_windowController presentOpenDialog]; +} @end