-windowForSheet
(which doesn't tell you the window associated with a particular sheet, but instead returns the window to be used for showing sheets, which is usually what you want when talking about the document's window - Thanks to Peter Hosey for this one).
For folks stuck in 10.2 land, or who want to do it themselves, there's always this:
- (NSWindow *) window { NSArray *windowControllers; windowControllers = [self windowControllers]; NSWindowController *controller; controller = [windowControllers objectAtIndex: 0]; NSWindow *window; window = [controller window]; return (window); } // window
defaults write com.flyingmeat.acorn NSRecentDocumentsLimit 137(thanks to Gus Mueller for this one)
keepBackupFile
:
- (BOOL) keepBackupFile { return (YES); } // keepBackupFileThis will do the tilde thing to the older version of the file.
NSDocumentController *documentController; documentController = [NSDocumentController sharedDocumentController]; BWBorkStitchDocument *noteDocument; noteDocument = [documentController documentForWindow: noteWindow];
[window frame]
of the window in question. (That's left as an exercise to the reader, based on how you're storing your document contents.) When restoring the window location, you have to turn of NSWindowController
's cascading, otherwise it'll honor your width and height, but not your origin. In your document's windowControllerDidLoadNib
method, you'll need:[[self windowController] setShouldCascadeWindows: NO]; NSWindow *window; window = [self window]; [window setFrame: loadedWindowBounds display: YES];
- (NSString *) windowTitleForDocumentDisplayName: (NSString *) displayName { NSString *string; string = [NSString stringWithFormat: @"Overview of %@", displayName]; return (string); } // windowTitleForDocumentDisplayName
- (void) windowDidLoad { [super windowDidLoad]; [self setShouldCascadeWindows: NO]; [self setWindowFrameAutosaveName: @"pannerWindow"]; // and any other windowDidLoad work to be done } // windowDidLoad