Skip to content

Commit

Permalink
update comments in SBAppDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
joesavage committed Nov 13, 2014
1 parent c1f1b18 commit 5d01d0b
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Binspect/SBAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5d01d0b

Please sign in to comment.