| 1 |
/** |
| 2 |
* \file AppDelegate.m |
| 3 |
* \brief This is a minimal implementation of the OS X front end. |
| 4 |
* |
| 5 |
* Copyright (c) 2020 Eric Branlund |
| 6 |
* |
| 7 |
* This work is free software; you can redistribute it and/or modify it |
| 8 |
* under the terms of either: |
| 9 |
* |
| 10 |
* a) the GNU General Public License as published by the Free Software |
| 11 |
* Foundation, version 2, or |
| 12 |
* |
| 13 |
* b) the "Angband licence": |
| 14 |
* This software may be copied and distributed for educational, research, |
| 15 |
* and not for profit purposes provided that this copyright and statement |
| 16 |
* are included in all such copies. Other copyrights may also apply. |
| 17 |
* |
| 18 |
* Use this file to rebuild the .nib files with Xcode without having to pull |
| 19 |
* in all of the Angband source. This is the procedure with Xcode 11.3: |
| 20 |
* |
| 21 |
* 1) Create a new Xcode project for a macOS App. |
| 22 |
* 2) You can set the "Product Name", "Team", "Organization Name", |
| 23 |
* "Organization Identifier" as you wish. Setting the product name to |
| 24 |
* "angband" and the "Organization Identifier" to "org.rephial" will match |
| 25 |
* the bundle identifier used in the full builds for Angband. Set |
| 26 |
* "Language" to "Objective-C" and "User Interface" to "XIB". Leave |
| 27 |
* "Create Document-Based Application" (no longer present in Xcode 14) |
| 28 |
* and "Use Core Data" off. The settings for "Include Unit Tests" and |
| 29 |
* "Include UI Tests" (that's just one option, "Include Tests", in |
| 30 |
* Xcode 14) don't matter; you can turn them off to avoid extra clutter. |
| 31 |
* 3) In the Angband project settings, set "Main Interface" to "MainMenu" |
| 32 |
* (that setting is no longer present in Xcode 14). Set the deployment |
| 33 |
* target to what's used in Angband's Makefile.osx. When this was |
| 34 |
* written, that was 10.9. |
| 35 |
* 4) Copy src/cocoa/AppDelegate.h and src/cocoa/AppDelegate.m from the |
| 36 |
* Angband source files to the directory in the project with main.m. Copy |
| 37 |
* src/cocoa/Base.lproj/MainMenu.xib to the Base.lproj subdirectory |
| 38 |
* of that directory. |
| 39 |
* 5) (This annoyance seems to have gone away between Xcode 11 and Xcode 13; |
| 40 |
* leaving it here just in case) If you modify MainMenu.xib after copying |
| 41 |
* it over, you may want to set them so that they can be opened in older |
| 42 |
* versions of Xcode. Select the changed file in Xcode, and select one of |
| 43 |
* the things, like "File's Owner" from it. In the file information panel |
| 44 |
* for it, there will be a section labeled "Document Editing" with an |
| 45 |
* option menu for "Opens in". Choosing one of the options other than |
| 46 |
* "Latest Xcode" will close the file and save it with the appropriate |
| 47 |
* flags. Note that reopening the .xib file in Xcode and saving it will |
| 48 |
* cause the version to revert to the latest Xcode. |
| 49 |
* 6) Use Xcode's Product->Build For->Running menu entry to build the project. |
| 50 |
* 7) The generated .nib file will be in |
| 51 |
* Contents/Resources/Base.lproj in the product directory which |
| 52 |
* is something like |
| 53 |
* ~/Library/Developer/Xcode/DerivedData/<product_name>-<some_string>/Build/Products/Debug/<product_name>.app |
| 54 |
* You can use them to replace the .nib file in src/cocoa/en.lproj in the |
| 55 |
* Angband source files. In older versions of Angband, MainMenu.nib is a |
| 56 |
* directory; you'll have to remove it and replace it with the flat file |
| 57 |
* that is generated by the above procedure and adjust the installation |
| 58 |
* rules for it in Makefile.osx. With Xcode 13, the generated .nib files |
| 59 |
* are back to being directories. In the build results from that version |
| 60 |
* of Xcode, copy Contents/Resources/Base.lproj/MainMenu.nib/keyedobjects.nib |
| 61 |
* to replace src/cocoa/en.lproj/MainMenu.nib in the Angband source files |
| 62 |
* (the keyedobjects-101300.nib file in the build results are for macOS |
| 63 |
* 10.13 or later). |
| 64 |
*/ |
| 65 |
|
| 66 |
#import "AppDelegate.h" |
| 67 |
|
| 68 |
@implementation AngbandAppDelegate |
| 69 |
|
| 70 |
@synthesize commandMenu=_commandMenu; |
| 71 |
@synthesize commandMenuTagMap=_comandMenuTagMap; |
| 72 |
|
| 73 |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { |
| 74 |
// Insert code here to initialize your application |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
- (void)applicationWillTerminate:(NSNotification *)aNotification { |
| 79 |
// Insert code here to tear down your application |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
- (IBAction)newGame:(id)sender { |
| 84 |
} |
| 85 |
|
| 86 |
- (IBAction)editFont:(id)sender { |
| 87 |
} |
| 88 |
|
| 89 |
- (IBAction)openGame:(id)sender { |
| 90 |
} |
| 91 |
|
| 92 |
- (IBAction)saveGame:(id)sender { |
| 93 |
} |
| 94 |
|
| 95 |
- (IBAction)setRefreshRate:(NSMenuItem *)sender { |
| 96 |
} |
| 97 |
|
| 98 |
- (void)setGraphicsMode:(NSMenuItem *)sender { |
| 99 |
} |
| 100 |
|
| 101 |
- (void)setTileFraction:(NSMenuItem *)sender { |
| 102 |
} |
| 103 |
|
| 104 |
- (void)selectWindow:(id)sender { |
| 105 |
} |
| 106 |
|
| 107 |
- (void)beginGame { |
| 108 |
} |
| 109 |
|
| 110 |
@end |