3 * \brief This is a minimal implementation of the OS X front end.
5 * Use this file to rebuild the .nib file with Xcode without having to pull
6 * in all of the Hengband source. This is the procedure with Xcode 11.3:
8 * 1) Create a new Xcode project for a macOS App.
9 * 2) You can set the "Product Name", "Team", "Organization Name",
10 * "Organization Identifier" as you wish. Setting the product name to
11 * "hengband" and the "Organization Identifier" to "jp.osdn" will match
12 * the bundle identifier used in the full builds for Hengband. Set
13 * "Language" to "Objective-C" and "User Interface" to "XIB". Leave
14 * "Create Document-Based Application" and "Use Core Data" off.
15 * The settings for "Include Unit Tests" and "Include UI Tests" don't
16 * matter; you can turn them off to avoid extra clutter.
17 * 3) When Xcode loads the project, select the topmost category in the file
18 * view ("hengband" with an application icon) and in the Info tab for it
19 * set the deployment target to what's used in Hengband's src/Makefile.am.
20 * When this was written, that was 10.8 and 10.8 is necessary for Base
21 * localization. In the localizations part of that tab, click the '+' and
22 * add a Japanese localization. That will prompt you for the files
23 * involved. Leave that as is: one file, "MainMenu.xib", with Base as the
24 * reference language and localizable strings as the file type.
25 * 4) Copy src/cocoa/AppDelegate.h and src/cocoa/AppDelegate.m from the
26 * Hengband source files to the directory in the project with main.m. Copy
27 * src/cocoa/MainMenu.xib to the Base.lproj subdirectory of that directory.
28 * Copy src/cocoa/ja.lproj/MainMenu.strings to the ja.lproj subdirectory of
30 * 5) If you modify MainMenu.xib after copying it over, you may want to
31 * set it so that it can open in older versions of Xcode. Select it in
32 * Xcode, and select one of the things, like "File's Owner" from it. In
33 * the file information panel for it, there will be a section labeled
34 * "Document Editing" with an option menu for "Opens in". Choosing one of
35 * the options other than "Latest Xcode" will close the file and save it
36 * with the appropriate flags. Note that reopening that MainMenu.xib in
37 * Xcode will cause the version to revert to the latest Xcode.
38 * 6) If you want to change the Japanese strings for the menus, one way to
39 * partly do it in Xcode is to export the localizations: from the file view
40 * select topmost category ("hengband" with an application icon) and then
41 * select Editor->Export for Localization... in Xcode's menu bar. That
42 * will prompt you for where to save the exported localizations. That
43 * export is done as a directory tree. Within it, you'll find a
44 * ja.xcloc/Localized Contents/ja.xliff file. The strings bracketed with
45 * <source></source> in that file are the English strings. The strings
46 * bracketed with <target></target> give what's currently used for the
47 * Japanese version. Adjust the strings bracketed with <target></target>,
48 * save the modified file, and use Editor->Import Localizations... from
49 * within Xcode to import the localization from the ja.xloc directory.
50 * The result of that will be to regenerate ja.lproj/MainMenu.strings in the
51 * Xcode project files which you can use to replace the version in
52 * src/cocoa/ja.lproj/MainMenu.strings in the Hengband source code.
53 * 7) Use Xcode's Product->Build For->Running menu entry to build the project.
54 * 8) The generated .nib file for English will be
55 * Contents/Resources/Base.lproj/MainMenu.nib in the product directory which
57 * ~/Library/Developer/Xcode/DerivedData/<product_name>-<some_string>/Build/Products/Debug/<product_name>.app
58 * You can use that to replace the src/cocoa/base.lproj/MainMenu.nib in the
59 * Hengband source files.
61 * This work is free software; you can redistribute it and/or modify it
62 * under the terms of either:
64 * a) the GNU General Public License as published by the Free Software
65 * Foundation, version 2, or
67 * b) the "Angband licence":
68 * This software may be copied and distributed for educational, research,
69 * and not for profit purposes provided that this copyright and statement
70 * are included in all such copies. Other copyrights may also apply.
73 #import "AppDelegate.h"
75 @implementation AngbandAppDelegate
77 @synthesize graphicsMenu=_graphicsMenu;
78 @synthesize commandMenu=_commandMenu;
79 @synthesize commandMenuTagMap=_comandMenuTagMap;
81 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
82 // Insert code here to initialize your application
86 - (void)applicationWillTerminate:(NSNotification *)aNotification {
87 // Insert code here to tear down your application
91 - (IBAction)newGame:(id)sender {
94 - (IBAction)editFont:(id)sender {
97 - (IBAction)openGame:(id)sender {
100 - (IBAction)saveGame:(id)sender {
103 - (IBAction)setRefreshRate:(NSMenuItem *)sender {
106 - (IBAction)toggleSound:(NSMenuItem*)menuItem {
109 - (IBAction)toggleWideTiles:(NSMenuItem *)sender {
112 - (IBAction)setGraphicsMode:(NSMenuItem *)sender {
115 - (void)selectWindow:(id)sender {