1/* 2 * main.m: main function of Fractal.app 3 * 4 * Copyright (c) 2002 Free Software Foundation, Inc. 5 * 6 * Author: Marko Riedel 7 * Date: May 2002 8 * 9 * With code fragments from MemoryPanel, ImageViewer, Finger, GDraw 10 * and GShisen. 11 * 12 * This sample program is part of GNUstep. 13 * 14 * This program is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of the License, or 17 * (at your option) any later version. 18 * 19 * This program is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to the Free Software 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27 */ 28 29#import <Foundation/Foundation.h> 30#import <AppKit/AppKit.h> 31#import <AppKit/GSHbox.h> 32#import <AppKit/GSVbox.h> 33 34#import "Controller.h" 35 36int main(int argc, const char **argv, char** env) 37{ 38 NSAutoreleasePool *pool; 39 NSApplication *app; 40 NSMenu *mainMenu, *subMenu; 41 NSMenu *menu; 42 NSMenuItem *menuItem, *subMenuItem; 43 Controller *controller; 44 45 pool = [NSAutoreleasePool new]; 46 app = [NSApplication sharedApplication]; 47 48 // 49 // Create the Menu 50 // 51 52 // Main Menu 53 mainMenu = AUTORELEASE ([NSMenu new]); 54 55 // Info SubMenu 56 menuItem = [mainMenu addItemWithTitle: @"Info" 57 action: NULL 58 keyEquivalent: @""]; 59 menu = AUTORELEASE ([NSMenu new]); 60 [mainMenu setSubmenu: menu forItem: menuItem]; 61 [menu addItemWithTitle: @"Info Panel..." 62 action: @selector (orderFrontStandardInfoPanel:) 63 keyEquivalent: @""]; 64 [menu addItemWithTitle: @"Preferences..." 65 action: @selector (runPreferencesPanel:) 66 keyEquivalent: @""]; 67 [menu addItemWithTitle: @"Help..." 68 action: @selector (orderFrontHelpPanel:) 69 keyEquivalent: @"?"]; 70 71 // Restore MenuItem. 72 menuItem = [mainMenu addItemWithTitle: @"Restore" 73 action: @selector(restore:) 74 keyEquivalent: @""]; 75 76 // Scramble MenuItem. 77 menuItem = [mainMenu addItemWithTitle: @"Scramble" 78 action: @selector(scramble:) 79 keyEquivalent: @""]; 80 81 // Hide MenuItem 82 [mainMenu addItemWithTitle: @"Hide" 83 action: @selector (hide:) 84 keyEquivalent: @"h"]; 85 86 // Quit MenuItem 87 [mainMenu addItemWithTitle: @"Quit" 88 action: @selector (terminate:) 89 keyEquivalent: @"q"]; 90 91 [app setMainMenu: mainMenu]; 92 93 controller = [Controller new]; 94 [app setDelegate: controller]; 95 96 NSApplicationMain(argc, argv); 97 98 [[NSUserDefaults standardUserDefaults] synchronize]; 99 100 // RELEASE (controller); 101 // RELEASE (pool); 102 return 0; 103} 104 105