1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
3 Copyright (C) 2002-2006 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define COPYRIGHT "Copyright (C) 2002-2006 " PACKAGE_BUGREPORT
23 #define LINE_GRAPHIC(c) ((!config.linegraphics) ? ' ' : c)
24 #define ROWTOMATRIX(r) ((8 - r) * 2 + 2 - 1)
25 #define COLTOMATRIX(c) ((c == 1) ? 1 : c * 4 - 3)
26 #define BOARD_HEIGHT 18
27 #define BOARD_WIDTH 34
28 #define STATUS_HEIGHT (BOARD_HEIGHT + HISTORY_HEIGHT - TAG_HEIGHT)
29 #define STATUS_WIDTH (COLS - BOARD_WIDTH)
31 #define TAG_WIDTH (COLS - BOARD_WIDTH)
32 #define HISTORY_HEIGHT (LINES - BOARD_HEIGHT)
33 #define HISTORY_WIDTH (COLS - STATUS_WIDTH)
34 #define MAX_VALUE_WIDTH (COLS - 8)
54 int markstart
= -1, markend
= -1;
59 char loadfile
[FILENAME_MAX
];
64 // The selected piece.
66 unsigned char icon
; // The piece.
67 char row
; // The source rank.
68 char col
; // The source file.
69 char destrow
; // Destination rank.
70 char destcol
; // Destination file.
73 // Loaded filename from the command line or from the file input dialog.
76 NO_FILE
, PGN_FILE
, FEN_FILE
, EPD_FILE
79 struct country_codes
{
84 const char *historyhelp
[] = {
85 " UP/DOWN - jump to next or previous history *",
86 "RIGHT/LEFT - next or previous history *",
87 " SPACE - toggle half move (ply) stepping",
88 " j - jump to move number (prompt) *",
89 " / - specify a new move text search expression *",
90 " ] - find the next move text expression *",
91 " [ - find the previous move text expression *",
92 " a - annotate the previous move",
93 " v - view annotation for the next move",
94 " V - view annotation for the previous move",
95 " + - next variation for the previous move",
96 " - - previous variation for the previous move",
97 " h - exit history mode",
98 " F1 - global and other key help",
102 const char *mainhelp
[] = {
103 "p - play mode keys",
104 "h - history mode keys",
105 "e - board edit mode keys",
106 "g - global game keys",
110 const char *edithelp
[] = {
111 " 0..9 - cursor repeat count",
112 "UP/DOWN/LEFT/RIGHT - position cursor *",
113 " SPACE - select piece under cursor for movement",
114 " ENTER - commit selected piece",
115 " ESCAPE - cancel selected piece",
116 " d - delete the piece under the cursor",
117 " i - insert a new piece",
118 " c - toggle castling availability",
119 " p - this square is the en passant one",
121 " e - exit edit mode",
122 " F1 - global and other key help",
126 const char *gamehelp
[] = {
127 " 0..9 - command repeat count",
128 " T - edit the current games roster tags",
129 " t - view the current games roster tags",
130 " ? - specify a new roster tag expression *",
131 " } - find the next roster tag expression *",
132 " { - find the previous roster tag expression *",
133 " n - start new game or round",
134 " N - start new game from scratch resetting all other games",
135 " > - next game or round *",
136 " < - previous game or round *",
137 " J - jump to game or round *",
138 " x - toggle game delete flag *",
139 " X - delete the current or all flagged games",
140 " r - resume a saved game",
142 " S - save game and prompt",
145 " F1 - global and other key help",
149 const char *playhelp
[] = {
150 " 0..9 - cursor repeat count",
151 "UP/DOWN/LEFT/RIGHT - position cursor *",
152 " SPACE - select piece under cursor for movement",
153 " ENTER - commit selected piece",
154 " ESCAPE - cancel selected piece",
155 " d - show game board details",
156 " w - switch playing side",
157 " u - undo previous move *",
158 " g - force engine to make the next move",
159 " | - send a command to the chess engine",
160 " E - toggle engine/engine play",
161 " W - toggle engine input/output window",
162 " H - toggle human/human play",
163 " F1 - global and other key help",
167 const char *cc_help
[] = {
168 " UP/DOWN - previous/next menu entry",
169 " HOME - first entry",
171 "CTRL-n/PGDN - next page",
172 "CTRL-p/PGUP - previous page",
173 " a-zA-Z0-9 - jump to entry",
174 " ENTER - selected entry",
179 const char *pgn_info_help
[] = {
180 " UP/DOWN - select menu entry",
181 " HOME - first entry",
183 "CTRL-n/PGDN - next page",
184 "CTRL-p/PGUP - previous page",
185 " a-zA-Z0-9 - jump to entry",
186 " ENTER - view selected entry",
191 const char *pgn_edit_help
[] = {
192 " UP/DOWN - select menu entry",
193 " HOME - first entry",
195 "CTRL-n/PGDN - next page",
196 "CTRL-p/PGUP - previous page",
197 " a-zA-Z0-9 - jump to entry",
198 " ENTER - edit selected entry",
199 " CTRL-a - add an entry",
200 " CTRL-f - add FEN tag from current position",
201 " CTRL-r - remove selected entry",
202 " CTRL-t - add custom tags",
213 const char *file_browser_help
[] = {
214 " UP/DOWN - select menu entry",
215 " HOME - first entry",
217 "CTRL-n/PGDN - next page",
218 "CTRL-p/PGUP - previous page",
219 " a-zA-Z0-9 - jump to entry",
220 " CTRL-x - change directory",
221 " ~ - change to home directory",
222 " ENTER - commit selected entry",
227 const char *naghelp
[] = {
228 " UP/DOWN - previous/next item",
229 " LEFT/RIGHT - previous/next selected item",
230 " HOME - first item",
232 "CTRL-p/PGUP - previous page",
233 "CTRL-n/PGDN - next page",
234 " a-zA-Z0-9 - jump to item",
235 " SPACE - toggle current item",
236 " ENTER - quit with changes",
237 " ESCAPE - quit without changes",
245 char *notify
; // The status window notification line buffer.
249 MODE_HISTORY
, MODE_PLAY
, MODE_EDIT
252 int curses_initialized
;
254 // When in history mode a full step is to the next move of the same playing
255 // side. Half stepping is alternating sides.
258 void update_all(GAME g
);
259 void parse_engine_output(GAME
*g
, char *str
);
262 void dump_board(int, BOARD
);
263 void dump_flags(int);
264 char *debug_board(BOARD
);