Hopefully fix the red builds.
[kugel-rb.git] / apps / plugins / goban / goban.h
blobc15eead13baccee1e13dbf9d41bd11f0047244fd
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef GOBAN_MAIN_H
23 #define GOBAN_MAIN_H
25 /* Enable this to run test mode. (see the end of util.c) */
26 #if 0
27 #define GBN_TEST
28 #endif
30 #include "types.h"
31 #include "util.h"
34 /* Colors of various things. The colors on mono bitmap targets is fixed
35 based on the background/foreground color. */
36 #ifdef HAVE_LCD_COLOR
37 #define BOARD_COLOR LCD_RGBPACK(184,136,72)
38 #define WHITE_COLOR LCD_RGBPACK(255,255,255)
39 #define BLACK_COLOR LCD_RGBPACK(0,0,0)
40 #define LINE_COLOR LCD_RGBPACK(0,0,0)
41 #define BACKGROUND_COLOR LCD_RGBPACK(41,104,74)
42 #define CURSOR_COLOR LCD_RGBPACK(222,0,0)
43 #define MARK_COLOR LCD_RGBPACK(0,0,255)
44 #elif LCD_DEPTH > 1 /* grayscale */
45 #define BOARD_COLOR LCD_LIGHTGRAY
46 #define WHITE_COLOR LCD_WHITE
47 #define BLACK_COLOR LCD_BLACK
48 #define LINE_COLOR LCD_BLACK
49 #define BACKGROUND_COLOR LCD_DARKGRAY
50 #define CURSOR_COLOR LCD_DARKGRAY
51 #define MARK_COLOR LCD_DARKGRAY
52 #endif
54 /* Key setups */
55 #ifdef HAVE_TOUCHSCREEN
56 #define GBN_BUTTON_UP BUTTON_TOPMIDDLE
57 #define GBN_BUTTON_DOWN BUTTON_BOTTOMMIDDLE
58 #define GBN_BUTTON_LEFT BUTTON_MIDLEFT
59 #define GBN_BUTTON_RIGHT BUTTON_MIDRIGHT
60 #define GBN_BUTTON_RETREAT BUTTON_BOTTOMLEFT
61 #define GBN_BUTTON_ADVANCE BUTTON_BOTTOMRIGHT
62 #define GBN_BUTTON_MENU BUTTON_TOPLEFT
63 #define GBN_BUTTON_PLAY BUTTON_CENTER | BUTTON_REL
64 #define GBN_BUTTON_CONTEXT BUTTON_CENTER | BUTTON_REPEAT
65 #define GBN_BUTTON_NEXT_VAR BUTTON_TOPRIGHT
67 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
68 || (CONFIG_KEYPAD == IPOD_3G_PAD) \
69 || (CONFIG_KEYPAD == IPOD_4G_PAD)
70 #define GBN_BUTTON_UP BUTTON_MENU
71 #define GBN_BUTTON_DOWN BUTTON_PLAY
72 #define GBN_BUTTON_LEFT BUTTON_LEFT
73 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
74 #define GBN_BUTTON_RETREAT BUTTON_SCROLL_BACK
75 #define GBN_BUTTON_ADVANCE BUTTON_SCROLL_FWD
76 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
77 #define GBN_BUTTON_MENU BUTTON_SELECT | BUTTON_REPEAT
78 /* no context */
79 /* no next var */
81 #elif (CONFIG_KEYPAD == SANSA_E200_PAD)
82 #define GBN_BUTTON_UP BUTTON_UP
83 #define GBN_BUTTON_DOWN BUTTON_DOWN
84 #define GBN_BUTTON_LEFT BUTTON_LEFT
85 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
86 #define GBN_BUTTON_RETREAT BUTTON_SCROLL_BACK
87 #define GBN_BUTTON_ADVANCE BUTTON_SCROLL_FWD
88 #define GBN_BUTTON_MENU BUTTON_POWER
89 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
90 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
91 #define GBN_BUTTON_NEXT_VAR BUTTON_REC
93 #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
94 #define GBN_BUTTON_UP BUTTON_UP
95 #define GBN_BUTTON_DOWN BUTTON_DOWN
96 #define GBN_BUTTON_LEFT BUTTON_LEFT
97 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
98 #define GBN_BUTTON_RETREAT BUTTON_SCROLL_BACK
99 #define GBN_BUTTON_ADVANCE BUTTON_SCROLL_FWD
100 #define GBN_BUTTON_MENU BUTTON_POWER
101 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
102 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
103 /* no next var */
105 #elif (CONFIG_KEYPAD == SANSA_C200_PAD)
106 #define GBN_BUTTON_UP BUTTON_UP
107 #define GBN_BUTTON_DOWN BUTTON_DOWN
108 #define GBN_BUTTON_LEFT BUTTON_LEFT
109 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
110 #define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN
111 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
112 #define GBN_BUTTON_MENU BUTTON_POWER
113 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
114 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
115 #define GBN_BUTTON_NEXT_VAR BUTTON_REC
117 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
118 #define GBN_BUTTON_UP BUTTON_UP
119 #define GBN_BUTTON_DOWN BUTTON_DOWN
120 #define GBN_BUTTON_LEFT BUTTON_LEFT
121 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
122 #define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN
123 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
124 #define GBN_BUTTON_MENU BUTTON_MENU
125 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
126 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
127 #define GBN_BUTTON_NEXT_VAR BUTTON_A
129 #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
130 #define GBN_BUTTON_UP BUTTON_UP
131 #define GBN_BUTTON_DOWN BUTTON_DOWN
132 #define GBN_BUTTON_LEFT BUTTON_LEFT
133 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
134 #define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN
135 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
136 #define GBN_BUTTON_MENU BUTTON_MENU
137 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
138 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
139 #define GBN_BUTTON_NEXT_VAR BUTTON_PLAY
141 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
142 #define GBN_BUTTON_UP BUTTON_SCROLL_UP
143 #define GBN_BUTTON_DOWN BUTTON_SCROLL_DOWN
144 #define GBN_BUTTON_LEFT BUTTON_LEFT
145 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
146 #define GBN_BUTTON_RETREAT BUTTON_FF
147 #define GBN_BUTTON_ADVANCE BUTTON_REW
148 #define GBN_BUTTON_MENU BUTTON_POWER
149 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
150 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
151 /* No next var */
153 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
154 (CONFIG_KEYPAD == IRIVER_H300_PAD)
155 #define GBN_BUTTON_UP BUTTON_UP
156 #define GBN_BUTTON_DOWN BUTTON_DOWN
157 #define GBN_BUTTON_LEFT BUTTON_LEFT
158 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
159 #define GBN_BUTTON_RETREAT BUTTON_OFF
160 #define GBN_BUTTON_ADVANCE BUTTON_ON
161 #define GBN_BUTTON_MENU BUTTON_MODE
162 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
163 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
164 #define GBN_BUTTON_NEXT_VAR BUTTON_REC
166 #elif (CONFIG_KEYPAD == MROBE100_PAD)
167 #define GBN_BUTTON_UP BUTTON_UP
168 #define GBN_BUTTON_DOWN BUTTON_DOWN
169 #define GBN_BUTTON_LEFT BUTTON_LEFT
170 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
171 #define GBN_BUTTON_RETREAT BUTTON_MENU
172 #define GBN_BUTTON_ADVANCE BUTTON_PLAY
173 #define GBN_BUTTON_MENU BUTTON_DISPLAY
174 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
175 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
176 #define GBN_BUTTON_NEXT_VAR BUTTON_POWER
178 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
179 #define GBN_BUTTON_UP BUTTON_UP
180 #define GBN_BUTTON_DOWN BUTTON_DOWN
181 #define GBN_BUTTON_LEFT BUTTON_LEFT
182 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
183 #define GBN_BUTTON_RETREAT BUTTON_PLAY
184 #define GBN_BUTTON_ADVANCE BUTTON_REC
185 #define GBN_BUTTON_MENU BUTTON_POWER
186 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
187 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
188 /* no next var */
190 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
191 /* TODO: these are basically complete guesses, I have no manual to go by */
192 #define GBN_BUTTON_UP BUTTON_RC_VOL_UP
193 #define GBN_BUTTON_DOWN BUTTON_RC_VOL_DOWN
194 #define GBN_BUTTON_LEFT BUTTON_RC_REW
195 #define GBN_BUTTON_RIGHT BUTTON_RC_FF
196 #define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN
197 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
198 #define GBN_BUTTON_MENU BUTTON_MODE
199 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
200 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
201 /* no next var */
203 #elif (CONFIG_KEYPAD == RECORDER_PAD)
204 #define GBN_BUTTON_UP BUTTON_UP
205 #define GBN_BUTTON_DOWN BUTTON_DOWN
206 #define GBN_BUTTON_LEFT BUTTON_LEFT
207 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
208 #define GBN_BUTTON_RETREAT BUTTON_F1
209 #define GBN_BUTTON_ADVANCE BUTTON_F3
210 #define GBN_BUTTON_MENU BUTTON_F2
211 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
212 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
213 #define GBN_BUTTON_NEXT_VAR BUTTON_ON
215 #elif (CONFIG_KEYPAD == ONDIO_PAD)
216 #define GBN_BUTTON_UP BUTTON_UP
217 #define GBN_BUTTON_DOWN BUTTON_DOWN
218 #define GBN_BUTTON_LEFT BUTTON_LEFT
219 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
220 #define GBN_BUTTON_MENU BUTTON_MENU | BUTTON_REPEAT
221 #define GBN_BUTTON_PLAY BUTTON_MENU | BUTTON_REL
222 #define GBN_BUTTON_NAV_MODE BUTTON_OFF
223 /* No context */
224 /* No advance/retreat */
225 /* no next var */
227 #else
228 #error Unsupported keypad
229 #endif
232 /* The smallest dimension of the LCD */
233 #define LCD_MIN_DIMENSION (LCD_HEIGHT > LCD_WIDTH ? LCD_WIDTH : LCD_HEIGHT)
236 /* Determine if we have a wide screen or a tall screen. This is used to
237 place the board and footer in acceptable locations also, set the
238 LCD_BOARD_SIZE, making sure that we have at least 16 pixels for the
239 "footer" on either the bottom or the right. */
241 #define FOOTER_RESERVE (16)
243 #if (LCD_WIDTH > LCD_HEIGHT)
245 #define GBN_WIDE_SCREEN
247 #define LCD_BOARD_WIDTH (LCD_WIDTH - FOOTER_RESERVE)
248 #define LCD_BOARD_HEIGHT LCD_HEIGHT
250 #else
252 #define GBN_TALL_SCREEN
254 #define LCD_BOARD_WIDTH LCD_WIDTH
255 #define LCD_BOARD_HEIGHT (LCD_HEIGHT - FOOTER_RESERVE)
257 #endif // LCD_WIDTH > LCD_HEIGHT
260 /* The directory we default to for saving crap */
261 #define DEFAULT_SAVE_DIR "/sgf"
263 /* The default file we save to */
264 #define DEFAULT_SAVE (DEFAULT_SAVE_DIR "/gbn_def.sgf")
266 /* The size of the buffer we store filenames in (1 reserved for '\0') */
267 #define SAVE_FILE_LENGTH 256
269 /* The maximum setting for idle autosave time, in minutes */
270 #define MAX_AUTOSAVE (30)
272 /* On mono targets, draw while stones with a black outline so they are
273 actually visibile instead of being white on white */
274 #if (LCD_DEPTH == 1)
275 #define OUTLINE_STONES
276 #endif
278 /* The current play mode */
279 extern enum play_mode_t play_mode;
281 /* Show comments when redoing onto a move? */
282 extern bool auto_show_comments;
284 /* A stack used for parsing/outputting as well as some board functions
285 such as counting liberties and filling in/ removing stones */
286 extern struct stack_t parse_stack;
288 #endif