Added customizable key bindings for any game mode. The only
[cboard.git] / src / cboard.h
blob178a5db2c8e6c284050ff75111e2a0a5a9614384
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;
48 WINDOW *loadingw;
49 PANEL *loadingp;
50 WINDOW *enginew;
51 PANEL *enginep;
53 static char gameexp[255];
54 static char moveexp[255];
55 struct itimerval clock_timer;
56 int delete_count = 0;
57 int markstart = -1, markend = -1;
58 int keycount;
59 char loadfile[FILENAME_MAX];
60 int quit;
61 time_t now;
62 int input_c;
64 // Loaded filename from the command line or from the file input dialog.
65 int filetype;
66 enum {
67 NO_FILE, PGN_FILE, FEN_FILE, EPD_FILE
70 struct file_s {
71 char *path;
72 char *name;
73 char *st;
76 struct file_s **files;
78 const char *history_menu_help_str = {
79 " UP/DOWN - previous/next menu item\n" \
80 " HOME/END - first/last menu item\n" \
81 " PGDN/PGUP - next/previous page\n" \
82 " a-zA-Z0-9 - jump to item\n" \
83 " CTRL-a - annotate the selected move\n" \
84 " ENTER - view annotation\n" \
85 " CTRL-d - toggle board details\n" \
86 " ESCAPE - quit"
89 const char *mainhelp = {
90 "p - play mode keys\n" \
91 "h - history mode keys\n" \
92 "e - board edit mode keys\n" \
93 "g - global game keys"
96 const char *filebrowser_help = {
97 " UP/DOWN - previous/next menu item\n" \
98 " HOME/END - first/last menu item\n" \
99 " PGDN/PGUP - next/previous page\n" \
100 " a-zA-Z0-9 - jump to item\n" \
101 " ENTER - select item\n" \
102 " ~ - change to home directory\n" \
103 " ESCAPE - abort"
106 const char *naghelp = {
107 " UP/DOWN - previous/next menu item\n" \
108 " HOME/END - first/last menu item\n" \
109 " PGDN/PGUP - next/previous page\n" \
110 " a-zA-Z0-9 - jump to item\n" \
111 " SPACE - toggle selected item\n" \
112 " CTRL-X - quit with changes"
115 char **nags;
117 // Status window.
118 struct {
119 char *notify; // The status window notification line buffer.
120 } status;
122 int curses_initialized;
124 // When in history mode a full step is to the next move of the same playing
125 // side. Half stepping is alternating sides.
126 int movestep;
128 void update_all(GAME g);
129 void parse_engine_output(GAME *g, char *str);
130 void update_status_notify(GAME g, char *fmt, ...);
131 void edit_tags(GAME g, BOARD b, int edit);
132 void add_custom_tags(TAG ***t);
134 #ifdef DEBUG
135 void dump_board(int, BOARD);
136 void dump_flags(int);
137 char *debug_board(BOARD);
138 #endif
140 #endif