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)
53 struct itimerval clock_timer
;
55 int markstart
= -1, markend
= -1;
58 char loadfile
[FILENAME_MAX
];
62 // Loaded filename from the command line or from the file input dialog.
65 NO_FILE
, PGN_FILE
, FEN_FILE
, EPD_FILE
68 struct country_codes
{
73 const char *historyhelp
[] = {
74 " UP/DOWN - jump to next or previous history *",
75 "RIGHT/LEFT - next or previous history *",
76 " SPACE - toggle half move (ply) stepping",
77 " j - jump to move number (prompt) *",
78 " / - specify a new move text search expression *",
79 " ] - find the next move text expression *",
80 " [ - find the previous move text expression *",
81 " a - annotate the previous move",
82 " v - view annotation for the next move",
83 " V - view annotation for the previous move",
84 " + - next variation for the previous move",
85 " - - previous variation for the previous move",
86 " d - toggle board details",
87 " h - exit history mode",
88 " F1 - global and other key help",
92 const char *mainhelp
[] = {
94 "h - history mode keys",
95 "e - board edit mode keys",
96 "g - global game keys",
100 const char *edithelp
[] = {
101 " 0..9 - cursor repeat count",
102 "UP/DOWN/LEFT/RIGHT - position cursor *",
103 " SPACE - select piece under cursor for movement",
104 " ENTER - commit selected piece",
105 " ESCAPE - cancel selected piece",
106 " d - delete the piece under the cursor",
107 " i - insert a new piece",
108 " c - toggle castling availability",
109 " p - this square is the en passant one",
111 " e - exit edit mode",
112 " F1 - global and other key help",
116 const char *gamehelp
[] = {
117 " 0..9 - command repeat count",
118 " T - edit the current games roster tags",
119 " t - view the current games roster tags",
120 " ? - specify a new roster tag expression *",
121 " } - find the next roster tag expression *",
122 " { - find the previous roster tag expression *",
123 " n - start new game or round",
124 " N - start new game from scratch resetting all other games",
125 " > - next game or round *",
126 " < - previous game or round *",
127 " J - jump to game or round *",
128 " x - toggle game delete flag *",
129 " X - delete the current or all flagged games",
130 " r - resume a saved game",
132 " S - save game and prompt",
135 " F1 - global and other key help",
139 const char *playhelp
[] = {
140 " 0..9 - cursor repeat count",
141 "UP/DOWN/LEFT/RIGHT - position cursor *",
142 " SPACE - select piece under cursor for movement",
143 " ENTER - commit selected piece",
144 " ESCAPE - cancel selected piece",
146 " d - toggle board details",
147 " w - switch playing side",
148 " u - undo previous move *",
149 " g - force engine to make the next move",
150 " | - send a command to the chess engine",
151 " E - toggle engine/engine play",
152 " W - toggle engine input/output window",
153 " H - toggle human/human play",
154 " F1 - global and other key help",
158 const char *cc_help
[] = {
159 " UP/DOWN - previous/next menu item",
160 " HOME/END - first/last menu item",
161 " PGDN/PGUP - next/previous page",
162 " a-zA-Z0-9 - jump to item",
163 " ENTER - select item",
168 const char *pgn_info_help
[] = {
169 " UP/DOWN - previous/next menu item",
170 " HOME/END - first/last menu item",
171 " PGDN/PGUP - next/previous page",
172 " a-zA-Z0-9 - jump to item",
173 " ENTER - view selected item",
178 const char *pgn_edit_help
[] = {
179 " UP/DOWN - previous/next menu item",
180 " HOME/END - first/last menu item",
181 " PGDN/PGUP - next/previous page",
182 " a-zA-Z0-9 - jump to item",
183 " ENTER - edit select item",
184 " CTRL-a - add an entry",
185 " CTRL-f - add FEN tag from current position",
186 " CTRL-r - remove selected entry",
187 " CTRL-t - add custom tags",
188 " CTRL-x - quit without changes",
189 " ESCAPE - quit with changes",
199 const char *file_browser_help
[] = {
200 " UP/DOWN - previous/next menu item",
201 " HOME/END - first/last menu item",
202 " PGDN/PGUP - next/previous page",
203 " a-zA-Z0-9 - jump to item",
204 " ENTER - select item",
205 " CTRL-x - change directory",
206 " ~ - change to home directory",
211 const char *naghelp
[] = {
212 " UP/DOWN - previous/next menu item",
213 " HOME/END - first/last menu item",
214 " PGDN/PGUP - next/previous page",
215 " a-zA-Z0-9 - jump to item",
216 " SPACE - toggle selected item",
217 " ENTER - quit with changes",
218 " ESCAPE - quit without changes",
226 char *notify
; // The status window notification line buffer.
230 MODE_HISTORY
, MODE_PLAY
, MODE_EDIT
233 int curses_initialized
;
235 // When in history mode a full step is to the next move of the same playing
236 // side. Half stepping is alternating sides.
239 void update_all(GAME g
);
240 void parse_engine_output(GAME
*g
, char *str
);
243 void dump_board(int, BOARD
);
244 void dump_flags(int);
245 char *debug_board(BOARD
);