Removed command line option -N.
[cboard.git] / src / cboard.h
blob33e8619f8582ec2a2fb324f1e99ce9084be11a9d
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
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
19 #ifndef CBOARD_H
20 #define CBOARD_H
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)
30 #define TAG_HEIGHT 10
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)
36 enum {
37 UP, DOWN, LEFT, RIGHT
40 WINDOW *boardw;
41 PANEL *boardp;
42 WINDOW *tagw;
43 PANEL *tagp;
44 WINDOW *statusw;
45 PANEL *statusp;
46 WINDOW *historyw;
47 PANEL *historyp;
49 int delete_count = 0;
50 int markstart = -1, markend = -1;
51 int board_details;
52 int c_row, c_col;
53 int pushkey;
54 int keycount;
55 char loadfile[FILENAME_MAX];
56 int quit;
57 char **agony;
58 int paused;
60 // The selected piece.
61 struct {
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.
67 } sp;
69 // Loaded filename from the command line or from the file input dialog.
70 int filetype;
71 enum {
72 NO_FILE, PGN_FILE, FEN_FILE, EPD_FILE
75 struct country_codes {
76 char code[4];
77 char country[64];
78 } *ccodes;
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",
94 NULL
97 const char *mainhelp[] = {
98 "p - play mode keys",
99 "h - history mode keys",
100 "e - board edit mode keys",
101 "g - other game keys",
102 NULL
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",
116 " w - switch turn",
117 " e - exit edit mode",
118 NULL,
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",
136 " s - save game",
137 " S - save game and prompt",
138 " Q - quit",
139 NULL
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 move looping",
155 " U - toggle two human play",
156 NULL
159 const char *cc_help[] = {
160 " UP/DOWN - previous/next menu entry",
161 " HOME - first entry",
162 " END - last entry",
163 "CTRL-n/PGDN - next page",
164 "CTRL-p/PGUP - previous page",
165 " a-zA-Z0-9 - jump to entry",
166 " ENTER - selected entry",
167 " ESCAPE - cancel",
168 NULL
171 const char *pgn_info_help[] = {
172 " UP/DOWN - select menu entry",
173 " HOME - first entry",
174 " END - last entry",
175 "CTRL-n/PGDN - next page",
176 "CTRL-p/PGUP - previous page",
177 " a-zA-Z0-9 - jump to entry",
178 " ENTER - view selected entry",
179 " ESCAPE - quit",
180 NULL
183 const char *pgn_edit_help[] = {
184 " UP/DOWN - select menu entry",
185 " HOME - first entry",
186 " END - last entry",
187 "CTRL-n/PGDN - next page",
188 "CTRL-p/PGUP - previous page",
189 " a-zA-Z0-9 - jump to entry",
190 " ENTER - edit selected entry",
191 " CTRL-a - add an entry",
192 " CTRL-f - add FEN tag from current position",
193 " CTRL-r - remove selected entry",
194 " CTRL-t - add custom tags",
195 " ESCAPE - quit",
196 NULL
199 struct d_entries {
200 char *name;
201 char *fancy;
202 char desc[25];
205 const char *file_browser_help[] = {
206 " UP/DOWN - select menu entry",
207 " HOME - first entry",
208 " END - last entry",
209 "CTRL-n/PGDN - next page",
210 "CTRL-p/PGUP - previous page",
211 " a-zA-Z0-9 - jump to entry",
212 " CTRL-x - change directory",
213 " ~ - change to home directory",
214 " ENTER - commit selected entry",
215 " ESCAPE - quit",
216 NULL
219 const char *naghelp[] = {
220 " UP/DOWN - previous/next item",
221 " LEFT/RIGHT - previous/next selected item",
222 " HOME - first item",
223 " END - last item",
224 "CTRL-p/PGUP - previous page",
225 "CTRL-n/PGDN - next page",
226 " a-zA-Z0-9 - jump to item",
227 " SPACE - toggle current item",
228 " ENTER - quit with changes",
229 " ESCAPE - quit without changes",
230 NULL
233 struct nag_s {
234 char *line;
235 } *nags;
237 // Status window.
238 struct {
239 char *notify; // The status window notification line buffer.
240 } status;
242 enum {
243 MODE_HISTORY, MODE_PLAY, MODE_EDIT
246 int curses_initialized;
248 // When in history mode a full step is to the next move of the same playing
249 // side. Half stepping is alternating sides.
250 int movestep;
252 void update_all(GAME g);
253 void parse_engine_output(GAME *g, char *str);
255 #ifdef DEBUG
256 void dump_board(int, BOARD);
257 void dump_flags(int);
258 char *debug_board(BOARD);
259 #endif
261 #endif