/[gnustep]/gnustep/usr-apps/gworkspace/GWorkspace/main.m
ViewVC logotype

Contents of /gnustep/usr-apps/gworkspace/GWorkspace/main.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Aug 25 17:19:14 2003 UTC (20 years, 9 months ago) by esersale
Branch: MAIN
Changes since 1.3: +19 -17 lines
*** empty log message ***

1 /* main.m
2 *
3 * Copyright (C) 2003 Free Software Foundation, Inc.
4 *
5 * Author: Enrico Sersale <enrico@imago.ro>
6 * Date: August 2001
7 *
8 * This file is part of the GNUstep GWorkspace application
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25
26 #include <Foundation/Foundation.h>
27 #include <AppKit/AppKit.h>
28 #ifdef GNUSTEP
29 #include "GWFunctions.h"
30 #endif
31 #include "GWorkspace.h"
32 #include "GNUstep.h"
33
34 #ifdef GNUSTEP
35 void createMenu();
36 #endif
37
38 int main(int argc, char **argv, char **env)
39 {
40 CREATE_AUTORELEASE_POOL (pool);
41 GWorkspace *gw = [GWorkspace gworkspace];
42 NSApplication *app = [NSApplication sharedApplication];
43
44 #ifdef GNUSTEP
45 createMenu();
46 #else
47 [NSBundle loadNibNamed: @"MainMenu-OSX" owner: gw];
48 #endif
49
50 [app setDelegate: gw];
51 [app run];
52 RELEASE (pool);
53
54 return 0;
55 }
56
57 #ifdef GNUSTEP
58 void createMenu()
59 {
60 NSMenu *mainMenu;
61 NSMenu *info, *file, *edit, *view, *tools;
62 NSMenu *inspmenu, *fiendmenu, *tshelfmenu, *hismenu;
63 NSMenu *windows, *services;
64 NSMenuItem *menuItem;
65
66 // Main
67 mainMenu = AUTORELEASE ([[NSMenu alloc] initWithTitle: @"GWorkspace"]);
68
69 // Info
70 menuItem = addItemToMenu(mainMenu, @"Info", @"", nil, @"");
71 info = AUTORELEASE ([NSMenu new]);
72 [mainMenu setSubmenu: info forItem: menuItem];
73 addItemToMenu(info, @"Info Panel...", @"", @"showInfo:", @"");
74 addItemToMenu(info, @"Preferences...", @"", @"showPreferences:", @"");
75 addItemToMenu(info, @"Help...", @"", nil, @"?");
76
77 // File
78 menuItem = addItemToMenu(mainMenu, @"File", @"", nil, @"");
79 file = AUTORELEASE ([NSMenu new]);
80 [mainMenu setSubmenu: file forItem: menuItem];
81 addItemToMenu(file, @"Open", @"", @"openSelection:", @"o");
82 addItemToMenu(file, @"Open as Folder", @"", @"openSelectionAsFolder:", @"O");
83 addItemToMenu(file, @"Open With...", @"", @"openWith:", @"");
84 addItemToMenu(file, @"New Folder", @"", @"newFolder:", @"n");
85 addItemToMenu(file, @"New File", @"", @"newFile:", @"N");
86 addItemToMenu(file, @"Duplicate", @"", @"duplicateFiles:", @"u");
87 addItemToMenu(file, @"Destroy", @"", @"deleteFiles:", @"d");
88 addItemToMenu(file, @"Empty Recycler", @"", @"emptyRecycler:", @"");
89 addItemToMenu(file, @"Put Away", @"", @"putAway:", @"");
90 addItemToMenu(file, @"Run...", @"", @"runCommand:", @"");
91 addItemToMenu(file, @"Print...", @"", @"print:", @"p");
92
93 // Edit
94 menuItem = addItemToMenu(mainMenu, @"Edit", @"", nil, @"");
95 edit = AUTORELEASE ([NSMenu new]);
96 [mainMenu setSubmenu: edit forItem: menuItem];
97 addItemToMenu(edit, @"Cut", @"", @"cut:", @"x");
98 addItemToMenu(edit, @"Copy", @"", @"copy:", @"c");
99 addItemToMenu(edit, @"Paste", @"", @"paste:", @"v");
100 addItemToMenu(edit, @"Select All", @"", @"selectAllInViewer:", @"a");
101
102 // View
103 menuItem = addItemToMenu(mainMenu, @"View", @"", nil, @"");
104 view = AUTORELEASE ([NSMenu new]);
105 [mainMenu setSubmenu: view forItem: menuItem];
106
107 // Tools
108 menuItem = addItemToMenu(mainMenu, @"Tools", @"", nil, @"");
109 tools = AUTORELEASE ([NSMenu new]);
110 [mainMenu setSubmenu: tools forItem: menuItem];
111 addItemToMenu(tools, @"Viewer", @"", @"showViewer:", @"V");
112 menuItem = addItemToMenu(tools, @"Inspectors", @"", nil, @"");
113 inspmenu = AUTORELEASE ([NSMenu new]);
114 [tools setSubmenu: inspmenu forItem: menuItem];
115 addItemToMenu(inspmenu, @"Show Inspectors", @"", nil, @"");
116 addItemToMenu(inspmenu, @"Attributes", @"", @"showAttributesInspector:", @"1");
117 addItemToMenu(inspmenu, @"Contents", @"", @"showContentsInspector:", @"2");
118 addItemToMenu(inspmenu, @"Tools", @"", @"showToolsInspector:", @"3");
119 addItemToMenu(inspmenu, @"Permissions", @"", @"showPermissionsInspector:", @"4");
120 menuItem = addItemToMenu(tools, @"History", @"", nil, @"");
121 hismenu = AUTORELEASE ([NSMenu new]);
122 [tools setSubmenu: hismenu forItem: menuItem];
123 addItemToMenu(hismenu, @"Show History", @"", @"showHistory:", @"H");
124 addItemToMenu(hismenu, @"Go backward", @"", @"goBackwardInHistory:", @"");
125 addItemToMenu(hismenu, @"Go forward", @"", @"goForwardInHistory:", @"");
126 addItemToMenu(tools, @"Finder", @"", @"showFinder:", @"f");
127 addItemToMenu(tools, @"Applications...", @"", @"showApps:", @"");
128 addItemToMenu(tools, @"File Operations...", @"", @"showFileOps:", @"");
129 menuItem = addItemToMenu(tools, @"Fiend", @"", nil, @"");
130 fiendmenu = AUTORELEASE ([NSMenu new]);
131 [tools setSubmenu: fiendmenu forItem: menuItem];
132 menuItem = addItemToMenu(tools, @"Tabbed Shelf", @"", nil, @"");
133 tshelfmenu = AUTORELEASE ([NSMenu new]);
134 [tools setSubmenu: tshelfmenu forItem: menuItem];
135 addItemToMenu(tools, @"XTerm", @"", @"startXTerm:", @"t");
136
137 // Windows
138 menuItem = addItemToMenu(mainMenu, @"Windows", @"", nil, @"");
139 windows = AUTORELEASE ([NSMenu new]);
140 [mainMenu setSubmenu: windows forItem: menuItem];
141 addItemToMenu(windows, @"Arrange in Front", @"", nil, @"");
142 addItemToMenu(windows, @"Miniaturize Window", @"", nil, @"");
143 addItemToMenu(windows, @"Close Window", @"", @"closeMainWin:", @"w");
144
145 // Services
146 menuItem = addItemToMenu(mainMenu, @"Services", @"", nil, @"");
147 services = AUTORELEASE ([NSMenu new]);
148 [mainMenu setSubmenu: services forItem: menuItem];
149
150 // Hide
151 addItemToMenu(mainMenu, @"Hide", @"", @"hide:", @"h");
152
153 // Quit
154 addItemToMenu(mainMenu, @"Quit", @"", @"terminate:", @"q");
155
156 [mainMenu update];
157
158 [[NSApplication sharedApplication] setServicesMenu: services];
159 [[NSApplication sharedApplication] setWindowsMenu: windows];
160 [[NSApplication sharedApplication] setMainMenu: mainMenu];
161 }
162 #endif
163

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26