17.1. Trimming the Menus
When we created the Linear project, the MainMenu.nib we got was generic for a document-based application. Most of the contents of the menu bar in that Nib do apply to Linear, but a few items will never be used, and a handful still refer to NewApplication. Now that we've settled on a final feature set, we can edit the menu bar to reflect what Linear does.
Double-click MainMenu.nib in either the Groups &Files list or the Finder. When the file opens, double-click the MainMenu icon in the Nib window to make sure that the prototype menu bar is visible.
The Application menu is named NewApplication in the Nib. If you've been observant, you've seen that when Linear is running, this menu is named Linear. That's because Cocoa substitutes the localized CFBundleName from an application's Info.plist as the title of the application menu. So even though it doesn't change anything, double-click the menu title and change it to Linear. Three items in the application menu use the dummy name NewApplication: About, Hide, and Quit. (All three are handled automatically by NSApplication, by the way.) Edit each so that NewApplication becomes Linear. We don't have a Preferences panel, so delete the Preferences . . . item and one of the gray-line separator items to either side of it. In the File menu, NSApplication, NSDocument, and NSPersistenDocument handle almost every item. Alas, Linear doesn't print. Delete the last three items (Print . . . , Page Setup . . . , and the separator above them). In the Edit menu, to the extent that we use text fields, we support Cut, Copy, Paste, Delete, and Select All. Switching to Core Data gave us Undo/Redo support. Linear doesn't support finding text or checking spelling, however, so once again, delete the last three items in this menu. The Window menu is managed, and filled, automatically by Cocoa. No changes are needed. The Help menu can be deleted, as we don't have a help system.
Save MainMenu.nib and quit Interface Builder.
|
No comments:
Post a Comment