aboutsummaryrefslogtreecommitdiff
path: root/osx.m
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2008-09-06 09:27:56 +0000
committerSimon Tatham <anakin@pobox.com>2008-09-06 09:27:56 +0000
commita7431c0b7ce232f296ebcd70172ca64e58300105 (patch)
tree8f02add581cf4b0d0d69d4ad5490b124a322a0ad /osx.m
parentc6b1d4472b2f339c54c9c9de06c6ebef2a92dba9 (diff)
downloadpuzzles-a7431c0b7ce232f296ebcd70172ca64e58300105.zip
puzzles-a7431c0b7ce232f296ebcd70172ca64e58300105.tar.gz
puzzles-a7431c0b7ce232f296ebcd70172ca64e58300105.tar.bz2
puzzles-a7431c0b7ce232f296ebcd70172ca64e58300105.tar.xz
New infrastructure feature. Games are now permitted to be
_conditionally_ able to format the current puzzle as text to be sent to the clipboard. For instance, if a game were to support playing on a square grid and on other kinds of grid such as hexagonal, then it might reasonably feel that only the former could be sensibly rendered in ASCII art; so it can now arrange for the "Copy" menu item to be greyed out depending on the game_params. To do this I've introduced a new backend function (can_format_as_text_now()), and renamed the existing static backend field "can_format_as_text" to "can_format_as_text_ever". The latter will cause compile errors for anyone maintaining a third-party front end; if any such person is reading this, I apologise to them for the inconvenience, but I did do it deliberately so that they'd know to update their front end. As yet, no checked-in game actually uses this feature; all current games can still either copy always or copy never. [originally from svn r8161]
Diffstat (limited to 'osx.m')
-rw-r--r--osx.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/osx.m b/osx.m
index ec9b6f9..33031e3 100644
--- a/osx.m
+++ b/osx.m
@@ -806,7 +806,8 @@ struct frontend {
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(copy:))
- return (ourgame->can_format_as_text ? YES : NO);
+ return (ourgame->can_format_as_text_ever &&
+ midend_can_format_as_text_now(me) ? YES : NO);
else if ([item action] == @selector(solveGame:))
return (ourgame->can_solve ? YES : NO);
else