shithub: puzzles

Download patch

ref: 28f655c821d2d1ed37e8500586abacb0062df17b
parent: 850a70a03c3744ab595aba5296f9e905ed03de1a
author: Simon Tatham <anakin@pobox.com>
date: Sun May 1 10:05:03 EDT 2005

The addition of a `Copy' menu item on OS X was really beginning to
strain my unconventional menu organisation, so I've reverted to
having `File' and `Edit' menus like everyone else.

[originally from svn r5727]

--- a/osx.m
+++ b/osx.m
@@ -60,13 +60,9 @@
  *    nested sheet. On the other hand I think there are good
  *    practical reasons for wanting it that way. Uncertain.
  * 
- *  - User feedback suggests we should have `File' and `Edit' menus
- *    like everyone else, so some menu reorg is probably required,
- *    along with some documentation rewording.
- * 
- *  - User feedback also dislikes nothing happening when you start
- *    the app; they suggest a finder-like window containing an icon
- *    for each puzzle type, enabling you to start one easily. Needs
+ *  - User feedback dislikes nothing happening when you start the
+ *    app; they suggest a finder-like window containing an icon for
+ *    each puzzle type, enabling you to start one easily. Needs
  *    thought.
  * 
  * Grotty implementation details that could probably be improved:
@@ -1151,12 +1147,12 @@
 @interface AppController : NSObject
 {
 }
-- (void)newGame:(id)sender;
+- (void)newGameWindow:(id)sender;
 @end
 
 @implementation AppController
 
-- (void)newGame:(id)sender
+- (void)newGameWindow:(id)sender
 {
     const game *g = [sender getPayload];
     id win;
@@ -1175,7 +1171,7 @@
 	    id item =
 		initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]],
 			    menu, gamelist[i]->name, "", self,
-			    @selector(newGame:));
+			    @selector(newGameWindow:));
 	    [item setPayload:(void *)gamelist[i]];
 	}
     }
@@ -1216,30 +1212,31 @@
     item = newitem(menu, "Quit", "q", NSApp, @selector(terminate:));
     [NSApp setAppleMenu: menu];
 
-    menu = newsubmenu([NSApp mainMenu], "Open");
+    menu = newsubmenu([NSApp mainMenu], "File");
+    item = newitem(menu, "New Game", "n", NULL, @selector(newGame:));
+    item = newitem(menu, "Restart Game", "r", NULL, @selector(restartGame:));
+    item = newitem(menu, "Specific Game", "", NULL, @selector(specificGame:));
+    [menu addItem:[NSMenuItem separatorItem]];
     {
+	NSMenu *submenu = newsubmenu(menu, "New Window");
 	int i;
 
 	for (i = 0; i < gamecount; i++) {
 	    id item =
 		initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]],
-			    menu, gamelist[i]->name, "", controller,
-			    @selector(newGame:));
+			    submenu, gamelist[i]->name, "", controller,
+			    @selector(newGameWindow:));
 	    [item setPayload:(void *)gamelist[i]];
 	}
     }
-
-    menu = newsubmenu([NSApp mainMenu], "Game");
-    item = newitem(menu, "New", "n", NULL, @selector(newGame:));
-    item = newitem(menu, "Restart", "r", NULL, @selector(restartGame:));
-    item = newitem(menu, "Specific", "", NULL, @selector(specificGame:));
     [menu addItem:[NSMenuItem separatorItem]];
+    item = newitem(menu, "Close", "w", NULL, @selector(performClose:));
+
+    menu = newsubmenu([NSApp mainMenu], "Edit");
     item = newitem(menu, "Undo", "z", NULL, @selector(undoMove:));
     item = newitem(menu, "Redo", "S-z", NULL, @selector(redoMove:));
     [menu addItem:[NSMenuItem separatorItem]];
     item = newitem(menu, "Copy", "c", NULL, @selector(copy:));
-    [menu addItem:[NSMenuItem separatorItem]];
-    item = newitem(menu, "Close", "w", NULL, @selector(performClose:));
 
     menu = newsubmenu([NSApp mainMenu], "Type");
     typemenu = menu;
--- a/puzzles.but
+++ b/puzzles.but
@@ -82,6 +82,10 @@
 and via \I{keys}keyboard shortcuts, in addition to any game-specific
 actions.
 
+(On Mac OS X, to conform with local user interface standards, these
+actions are situated on the \I{File menu}\q{File} and \q{Edit
+menu}\q{Edit} menus instead.)
+
 \dt \ii\e{New game} (\q{N}, Ctrl+\q{N})
 
 \dd Starts a new game, with a random initial state.
@@ -99,6 +103,13 @@
 
 \dd Redoes a previous undone move.
 
+\dt \ii\e{Copy}
+
+\dd Copies the current state of your game to the clipboard in text
+format, so that you can paste it into (say) an e-mail client or a
+web message board if you're discussing the game with someone else.
+(Not all games support this feature.)
+
 \dt \I{exit}\ii\e{Quit} (\q{Q}, Ctrl+\q{Q})
 
 \dd Closes the application entirely.
@@ -106,8 +117,8 @@
 \H{common-id} Recreating games with the \ii{game ID}
 
 The \q{\i{Specific...}} option from the \I{Game menu}\q{Game} menu
-lets you see a short string (the \q{game ID}) that captures the
-initial state of the current game.
+(or the \q{File} menu, on Mac OS X) lets you see a short string (the
+\q{game ID}) that captures the initial state of the current game.
 
 The precise \I{ID format}format of the ID is specific to each game.
 It consists of two parts delimited by a colon (e.g., \c{c4x4:4F01,0});
@@ -151,11 +162,11 @@
 
 The easiest way to do this is to set up the parameters you want
 using the \q{Type} menu (see \k{common-type}), and then to select
-\q{Specific} from the \q{Game} menu (see \k{common-id}). The text in
-the \q{Game ID} box will be composed of two parts, separated by a
-colon. The first of these parts represents the game parameters (the
-size of the playing area, for example, and anything else you set
-using the \q{Type} menu).
+\q{Specific} from the \q{Game} or \q{File} menu (see \k{common-id}).
+The text in the \q{Game ID} box will be composed of two parts,
+separated by a colon. The first of these parts represents the game
+parameters (the size of the playing area, for example, and anything
+else you set using the \q{Type} menu).
 
 If you run the game with just that parameter text on the command
 line, it will start up with the settings you specified.