Try to fit as many tags as possible in the tag window.
[cboard.git] / src / cboard.h
blobcc7d0cf6ea3706e1fcb01fb55603014da3e1acd5
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2002-2007 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-2007 " 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 14
29 #define STATUS_WIDTH (COLS - BOARD_WIDTH)
30 #define TAG_HEIGHT LINES - STATUS_HEIGHT
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 const char *history_menu_help_str = {
71 " UP/DOWN - previous/next menu item\n" \
72 " HOME/END - first/last menu item\n" \
73 " PGDN/PGUP - next/previous page\n" \
74 " a-zA-Z0-9 - jump to item\n" \
75 " CTRL-a - annotate the selected move\n" \
76 " ENTER - view annotation\n" \
77 " CTRL-d - toggle board details\n" \
78 " ESCAPE - quit"
81 const char *mainhelp = {
82 "p - play mode keys\n" \
83 "h - history mode keys\n" \
84 "e - board edit mode keys\n" \
85 "g - global game keys"
88 const char *naghelp = {
89 " UP/DOWN - previous/next menu item\n" \
90 " HOME/END - first/last menu item\n" \
91 " PGDN/PGUP - next/previous page\n" \
92 " a-zA-Z0-9 - jump to item\n" \
93 " SPACE - toggle selected item\n" \
94 " CTRL-X - quit with changes"
97 char **nags;
98 int nag_total;
100 // Status window.
101 struct {
102 char *notify; // The status window notification line buffer.
103 } status;
105 int curses_initialized;
107 // When in history mode a full step is to the next move of the same playing
108 // side. Half stepping is alternating sides.
109 int movestep;
111 void update_all(GAME g);
112 void update_status_notify(GAME g, char *fmt, ...);
113 void edit_tags(GAME g, BOARD b, int edit);
114 void add_custom_tags(TAG ***t);
115 static void free_userdata_once(GAME g);
117 #ifndef HAVE_PROGNAME
118 char *__progname;
119 #endif
121 #endif