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 static char gameexp
[255];
54 static char moveexp
[255];
55 struct itimerval clock_timer
;
57 int markstart
= -1, markend
= -1;
59 char loadfile
[FILENAME_MAX
];
63 // Loaded filename from the command line or from the file input dialog.
66 NO_FILE
, PGN_FILE
, FEN_FILE
, EPD_FILE
75 struct file_s
**files
;
77 const char *historyhelp
= {
78 " UP/DOWN - jump to next or previous history *\n" \
79 "RIGHT/LEFT - next or previous history *\n" \
80 " SPACE - toggle half move (ply) stepping\n" \
81 " j - jump to move number (prompt) *\n" \
82 " / - specify a new move text search expression *\n" \
83 " ],[ - find the next/previous move text expression *\n" \
84 " CTRL-a - annotate the previous move\n" \
85 " + - next variation for the previous move\n" \
86 " - - previous variation for the previous move\n" \
87 " CTRL-d - toggle board details\n" \
88 " M - move history menu\n" \
89 " h - exit history mode\n" \
90 " F1 - global and other key help"
93 const char *history_menu_help_str
= {
94 " UP/DOWN - previous/next menu item\n" \
95 " HOME/END - first/last menu item\n" \
96 " PGDN/PGUP - next/previous page\n" \
97 " a-zA-Z0-9 - jump to item\n" \
98 " CTRL-a - annotate the selected move\n" \
99 " ENTER - view annotation\n" \
100 " CTRL-d - toggle board details\n" \
104 const char *mainhelp
= {
105 "p - play mode keys\n" \
106 "h - history mode keys\n" \
107 "e - board edit mode keys\n" \
108 "g - global game keys"
111 const char *edithelp
= {
112 " 0..9 - cursor repeat count\n" \
113 "UP/DOWN/LEFT/RIGHT - position cursor *\n" \
114 " SPACE - select piece under cursor for movement\n" \
115 " ENTER - commit selected piece\n" \
116 " ESCAPE - cancel selected piece\n" \
117 " d - delete the piece under the cursor\n" \
118 " i - insert a new piece\n" \
119 " c - toggle castling availability\n" \
120 " p - this square is the en passant one\n" \
121 " w - switch turn\n" \
122 " e - exit edit mode\n" \
123 " F1 - global and other key help"
126 const char *gamehelp
= {
127 " 0..9 - command repeat count\n" \
128 " T/t - edit/view the current games roster tags\n" \
129 " ? - specify a new roster tag expression *\n" \
130 " },{ - find the next/previous roster tag expression *\n" \
131 " n - start new game or round\n" \
132 " N - start new game from scratch resetting all other games\n" \
133 " >,< - next/previous game or round *\n" \
134 " J - jump to game or round *\n" \
135 " x - toggle game delete flag *\n" \
136 " X - delete the current or all flagged games\n" \
137 " r - resume a saved game\n" \
139 " S - save game and prompt\n" \
142 " F1 - global and other key help"
145 const char *playhelp
= {
146 " 0..9 - cursor repeat count\n" \
147 "UP/DOWN/LEFT/RIGHT - position cursor *\n" \
148 " SPACE - select piece under cursor for movement\n" \
149 " ENTER - commit selected piece\n" \
150 " ESCAPE - cancel selected piece\n" \
152 " CTRL-d - toggle board details\n" \
153 " w - switch playing side\n" \
154 " u - undo previous move *\n" \
155 " g - force engine to make the next move\n" \
156 " | - send a command to the chess engine\n" \
157 " E - toggle engine/engine play\n" \
158 " W - toggle engine input/output window\n" \
159 " H - toggle human/human play\n" \
160 " F1 - global and other key help"
163 const char *filebrowser_help
= {
164 " UP/DOWN - previous/next menu item\n" \
165 " HOME/END - first/last menu item\n" \
166 " PGDN/PGUP - next/previous page\n" \
167 " a-zA-Z0-9 - jump to item\n" \
168 " ENTER - select item\n" \
169 " ~ - change to home directory\n" \
173 const char *naghelp
= {
174 " UP/DOWN - previous/next menu item\n" \
175 " HOME/END - first/last menu item\n" \
176 " PGDN/PGUP - next/previous page\n" \
177 " a-zA-Z0-9 - jump to item\n" \
178 " SPACE - toggle selected item\n" \
179 " CTRL-X - quit with changes"
186 char *notify
; // The status window notification line buffer.
190 MODE_HISTORY
, MODE_PLAY
, MODE_EDIT
193 int curses_initialized
;
195 // When in history mode a full step is to the next move of the same playing
196 // side. Half stepping is alternating sides.
199 void update_all(GAME g
);
200 void parse_engine_output(GAME
*g
, char *str
);
201 void update_status_notify(GAME g
, char *fmt
, ...);
202 void edit_tags(GAME g
, BOARD b
, int edit
);
203 void add_custom_tags(TAG
***t
);
206 void dump_board(int, BOARD
);
207 void dump_flags(int);
208 char *debug_board(BOARD
);