1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
/*
* main.m: main function of Finger.app
*
* Copyright (c) 2000 Free Software Foundation, Inc.
*
* Author: Nicola Pero
* Date: February 2000
*
* This sample program is part of GNUstep.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#import <FingerIncludeAll.h>
#import "Finger.h"
#import "Controller.h"
int
main (void)
{
NSAutoreleasePool *pool;
NSApplication *app;
NSMenu *mainMenu;
NSMenu *menu;
NSMenuItem *menuItem;
Controller *controller;
pool = [NSAutoreleasePool new];
app = [NSApplication sharedApplication];
//
// Create the Menu
//
// Main Menu
mainMenu = AUTORELEASE ([NSMenu new]);
// Info SubMenu
menuItem = [mainMenu addItemWithTitle: @"Info"
action: NULL
keyEquivalent: @""];
menu = AUTORELEASE ([NSMenu new]);
[mainMenu setSubmenu: menu forItem: menuItem];
[menu addItemWithTitle: @"Info Panel..."
action: @selector (orderFrontStandardInfoPanel:)
keyEquivalent: @""];
[menu addItemWithTitle: @"Preferences..."
action: @selector (runPreferencesPanel:)
keyEquivalent: @""];
[menu addItemWithTitle: @"Help..."
action: @selector (orderFrontHelpPanel:)
keyEquivalent: @"?"];
// Document Submenu
menuItem = [mainMenu addItemWithTitle: @"Document"
action: NULL
keyEquivalent: @""];
menu = AUTORELEASE ([NSMenu new]);
[mainMenu setSubmenu: menu forItem: menuItem];
[menu addItemWithTitle: @"New Finger Window"
action: @selector (startNewFingerWindow:)
keyEquivalent: @"n"];
[menu addItemWithTitle: @"Save Results As..."
action: @selector (saveResults:)
keyEquivalent: @"s"];
[menu addItemWithTitle: @"Reset Results"
action: @selector (resetResults:)
keyEquivalent: @""];
[menu addItemWithTitle: @"Miniaturize"
action: @selector(performMiniaturize:)
keyEquivalent: @"m"];
[menu addItemWithTitle: @"Close"
action: @selector(performClose:)
keyEquivalent: @"w"];
// Edit SubMenu
menuItem = [mainMenu addItemWithTitle: @"Edit"
action: NULL
keyEquivalent: @""];
menu = AUTORELEASE ([NSMenu new]);
[mainMenu setSubmenu: menu forItem: menuItem];
[menu addItemWithTitle: @"Cut"
action: @selector (cut:)
keyEquivalent: @"x"];
[menu addItemWithTitle: @"Copy"
action: @selector (copy:)
keyEquivalent: @"c"];
[menu addItemWithTitle: @"Paste"
action: @selector (paste:)
keyEquivalent: @"v"];
[menu addItemWithTitle: @"SelectAll"
action: @selector (selectAll:)
keyEquivalent: @"a"];
// Windows SubMenu
menuItem = [mainMenu addItemWithTitle:@"Windows"
action: NULL
keyEquivalent:@""];
menu = AUTORELEASE ([NSMenu new]);
[mainMenu setSubmenu: menu forItem: menuItem];
[menu addItemWithTitle: @"Arrange"
action: @selector(arrangeInFront:)
keyEquivalent: @""];
[menu addItemWithTitle: @"Miniaturize"
action: @selector(performMiniaturize:)
keyEquivalent: @"m"];
[menu addItemWithTitle: @"Close"
action: @selector(performClose:)
keyEquivalent: @"w"];
[app setWindowsMenu: menu];
// Hide MenuItem
[mainMenu addItemWithTitle: @"Hide"
action: @selector (hide:)
keyEquivalent: @"h"];
// Quit MenuItem
[mainMenu addItemWithTitle: @"Quit"
action: @selector (terminate:)
keyEquivalent: @"q"];
[app setMainMenu: mainMenu];
controller = [Controller new];
[app setDelegate: controller];
[app run];
[[NSUserDefaults standardUserDefaults] synchronize];
/* Useless anyway, since everything is automatically released on exit. */
RELEASE (controller);
RELEASE (pool);
return 0;
}
|