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)
50 int markstart
= -1, markend
= -1;
55 char loadfile
[FILENAME_MAX
];
60 // The selected piece.
62 unsigned char icon
; // The piece.
63 char row
; // The source rank.
64 char col
; // The source file.
65 char destrow
; // Destination rank.
66 char destcol
; // Destination file.
69 // Loaded filename from the command line or from the file input dialog.
72 NO_FILE
, PGN_FILE
, FEN_FILE
, EPD_FILE
75 struct country_codes
{
80 const char *historyhelp
[] = {
81 " UP/DOWN - jump to next or previous history *",
82 "RIGHT/LEFT - next or previous history *",
83 " SPACE - toggle half move (ply) stepping",
84 " j - jump to move number (prompt) *",
85 " / - specify a new move text search expression *",
86 " ] - find the next move text expression *",
87 " [ - find the previous move text expression *",
88 " a - annotate the previous move",
89 " v - view annotation for the next move",
90 " V - view annotation for the previous move",
91 " + - next variation for the previous move",
92 " - - previous variation for the previous move",
93 " h - exit history mode",
97 const char *mainhelp
[] = {
99 "h - history mode keys",
100 "e - board edit mode keys",
101 "g - other game keys",
105 const char *edithelp
[] = {
106 " 0..9 - cursor repeat count",
107 "UP/DOWN/LEFT/RIGHT - position cursor *",
108 " !-*A-H - position cursor at rank or file",
109 " SPACE - select piece under cursor for movement",
110 " ENTER - commit selected piece",
111 " ESCAPE - cancel selected piece",
112 " d - delete the piece under the cursor",
113 " i - insert a new piece",
114 " c - toggle castling availability",
115 " p - this square is the en passant one",
117 " e - exit edit mode",
121 const char *gamehelp
[] = {
122 " 0...9 - command repeat count",
123 " T - edit the current games roster tags",
124 " t - view the current games roster tags",
125 " ? - specify a new roster tag expression *",
126 " } - find the next roster tag expression *",
127 " { - find the previous roster tag expression *",
128 " n - start new game or round",
129 " N - start new game from scratch resetting all other games",
130 " > - next game or round *",
131 " < - previous game or round *",
132 " J - jump to game or round *",
133 " x - toggle game delete flag *",
134 " X - delete the current or all flagged games",
135 " r - resume a saved game",
137 " S - save game and prompt",
142 const char *playhelp
[] = {
143 " 0...9 - cursor repeat count",
144 "UP/DOWN/LEFT/RIGHT - position cursor *",
145 " !-*A-H - position cursor at rank or file",
146 " SPACE - select piece under cursor for movement",
147 " ENTER - commit selected piece",
148 " ESCAPE - cancel selected piece",
149 " d - show game board details",
150 " w - switch playing side",
151 " u - undo previous move *",
152 " g - force engine to make the next move",
153 " | - send a command to the chess engine",
154 " o - toggle engine looping",
158 const char *cc_help
[] = {
159 " UP/DOWN - previous/next menu entry",
160 " HOME - first entry",
162 "CTRL-n/PGDN - next page",
163 "CTRL-p/PGUP - previous page",
164 " a-zA-Z0-9 - jump to entry",
165 " ENTER - selected entry",
170 const char *pgn_info_help
[] = {
171 " UP/DOWN - select menu entry",
172 " HOME - first entry",
174 "CTRL-n/PGDN - next page",
175 "CTRL-p/PGUP - previous page",
176 " a-zA-Z0-9 - jump to entry",
177 " ENTER - view selected entry",
182 const char *pgn_edit_help
[] = {
183 " UP/DOWN - select menu entry",
184 " HOME - first entry",
186 "CTRL-n/PGDN - next page",
187 "CTRL-p/PGUP - previous page",
188 " a-zA-Z0-9 - jump to entry",
189 " ENTER - edit selected entry",
190 " CTRL-a - add an entry",
191 " CTRL-f - add FEN tag from current position",
192 " CTRL-r - remove selected entry",
193 " CTRL-t - add custom tags",
204 const char *file_browser_help
[] = {
205 " UP/DOWN - select menu entry",
206 " HOME - first entry",
208 "CTRL-n/PGDN - next page",
209 "CTRL-p/PGUP - previous page",
210 " a-zA-Z0-9 - jump to entry",
211 " CTRL-x - change directory",
212 " ~ - change to home directory",
213 " ENTER - commit selected entry",
218 const char *naghelp
[] = {
219 " UP/DOWN - previous/next item",
220 " LEFT/RIGHT - previous/next selected item",
221 " HOME - first item",
223 "CTRL-p/PGUP - previous page",
224 "CTRL-n/PGDN - next page",
225 " a-zA-Z0-9 - jump to item",
226 " SPACE - toggle current item",
227 " ENTER - quit with changes",
228 " ESCAPE - quit without changes",
238 char *notify
; // The status window notification line buffer.
242 MODE_HISTORY
, MODE_PLAY
, MODE_EDIT
245 int curses_initialized
;
246 // Two human players. FIXME
249 // When in history mode a full step is to the next move of the same playing
250 // side. Half stepping is alternating sides.
253 void update_all(GAME g
);
254 void parse_engine_output(GAME
*g
, char *str
);
257 void dump_board(int, BOARD
);
258 void dump_flags(int);
259 char *debug_board(BOARD
);