copy the classic_statusbar and rockbox_none .sbs's to .rsbs's also so remote displays...
[kugel-rb.git] / apps / plugins / goban / goban.h
blob229c9aed59e2c4bc80317c6746a1981fa605b2fc
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_HOME|BUTTON_REPEAT)
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 == SANSA_CLIP_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_POWER
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_HOME
129 #elif (CONFIG_KEYPAD == SANSA_M200_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_POWER
137 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
138 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
139 /* No next var */
141 #elif (CONFIG_KEYPAD == CREATIVEZVM_PAD) \
142 || (CONFIG_KEYPAD == CREATIVEZV_PAD)
143 #define GBN_BUTTON_UP BUTTON_UP
144 #define GBN_BUTTON_DOWN BUTTON_DOWN
145 #define GBN_BUTTON_LEFT BUTTON_LEFT
146 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
147 #define GBN_BUTTON_RETREAT BUTTON_BACK
148 #define GBN_BUTTON_ADVANCE BUTTON_CUSTOM
149 #define GBN_BUTTON_MENU BUTTON_MENU
150 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
151 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
152 #define GBN_BUTTON_NEXT_VAR BUTTON_PLAY
154 #elif (CONFIG_KEYPAD == PHILIPS_HDD1630_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_VOL_DOWN
160 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
161 #define GBN_BUTTON_MENU BUTTON_MENU
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_VIEW
166 #elif (CONFIG_KEYPAD == GIGABEAT_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_VOL_DOWN
172 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
173 #define GBN_BUTTON_MENU BUTTON_MENU
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_A
178 #elif (CONFIG_KEYPAD == GIGABEAT_S_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_VOL_DOWN
184 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
185 #define GBN_BUTTON_MENU BUTTON_MENU
186 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
187 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
188 #define GBN_BUTTON_NEXT_VAR BUTTON_PLAY
190 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
191 #define GBN_BUTTON_UP BUTTON_SCROLL_UP
192 #define GBN_BUTTON_DOWN BUTTON_SCROLL_DOWN
193 #define GBN_BUTTON_LEFT BUTTON_LEFT
194 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
195 #define GBN_BUTTON_RETREAT BUTTON_FF
196 #define GBN_BUTTON_ADVANCE BUTTON_REW
197 #define GBN_BUTTON_MENU BUTTON_POWER
198 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
199 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
200 /* No next var */
202 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
203 (CONFIG_KEYPAD == IRIVER_H300_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_OFF
209 #define GBN_BUTTON_ADVANCE BUTTON_ON
210 #define GBN_BUTTON_MENU BUTTON_MODE
211 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
212 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
213 #define GBN_BUTTON_NEXT_VAR BUTTON_REC
215 #elif (CONFIG_KEYPAD == MROBE100_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_RETREAT BUTTON_MENU
221 #define GBN_BUTTON_ADVANCE BUTTON_PLAY
222 #define GBN_BUTTON_MENU BUTTON_DISPLAY
223 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
224 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
225 #define GBN_BUTTON_NEXT_VAR BUTTON_POWER
227 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
228 #define GBN_BUTTON_UP BUTTON_UP
229 #define GBN_BUTTON_DOWN BUTTON_DOWN
230 #define GBN_BUTTON_LEFT BUTTON_LEFT
231 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
232 #define GBN_BUTTON_RETREAT BUTTON_PLAY
233 #define GBN_BUTTON_ADVANCE BUTTON_REC
234 #define GBN_BUTTON_MENU BUTTON_POWER
235 #define GBN_BUTTON_PLAY BUTTON_SELECT | BUTTON_REL
236 #define GBN_BUTTON_CONTEXT BUTTON_SELECT | BUTTON_REPEAT
237 /* no next var */
239 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
240 /* TODO: these are basically complete guesses, I have no manual to go by */
241 #define GBN_BUTTON_UP BUTTON_RC_VOL_UP
242 #define GBN_BUTTON_DOWN BUTTON_RC_VOL_DOWN
243 #define GBN_BUTTON_LEFT BUTTON_RC_REW
244 #define GBN_BUTTON_RIGHT BUTTON_RC_FF
245 #define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN
246 #define GBN_BUTTON_ADVANCE BUTTON_VOL_UP
247 #define GBN_BUTTON_MENU BUTTON_MODE
248 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
249 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
250 /* no next var */
252 #elif (CONFIG_KEYPAD == RECORDER_PAD)
253 #define GBN_BUTTON_UP BUTTON_UP
254 #define GBN_BUTTON_DOWN BUTTON_DOWN
255 #define GBN_BUTTON_LEFT BUTTON_LEFT
256 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
257 #define GBN_BUTTON_RETREAT BUTTON_F1
258 #define GBN_BUTTON_ADVANCE BUTTON_F3
259 #define GBN_BUTTON_MENU BUTTON_F2
260 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL
261 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT
262 #define GBN_BUTTON_NEXT_VAR BUTTON_ON
264 #elif (CONFIG_KEYPAD == ONDIO_PAD)
265 #define GBN_BUTTON_UP BUTTON_UP
266 #define GBN_BUTTON_DOWN BUTTON_DOWN
267 #define GBN_BUTTON_LEFT BUTTON_LEFT
268 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
269 #define GBN_BUTTON_MENU BUTTON_MENU | BUTTON_REPEAT
270 #define GBN_BUTTON_PLAY BUTTON_MENU | BUTTON_REL
271 #define GBN_BUTTON_NAV_MODE BUTTON_OFF
273 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
274 #define GBN_BUTTON_UP BUTTON_UP
275 #define GBN_BUTTON_DOWN BUTTON_DOWN
276 #define GBN_BUTTON_LEFT BUTTON_LEFT
277 #define GBN_BUTTON_RIGHT BUTTON_RIGHT
278 #define GBN_BUTTON_RETREAT BUTTON_REW
279 #define GBN_BUTTON_ADVANCE BUTTON_FFWD
280 #define GBN_BUTTON_MENU BUTTON_PLAY | BUTTON_LEFT
281 #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_RIGHT
282 #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_DOWN
283 #define GBN_BUTTON_NEXT_VAR BUTTON_PLAY | BUTTON_UP
284 /* No context */
285 /* No advance/retreat */
286 /* no next var */
288 #else
289 #error Unsupported keypad
290 #endif
293 /* The smallest dimension of the LCD */
294 #define LCD_MIN_DIMENSION (LCD_HEIGHT > LCD_WIDTH ? LCD_WIDTH : LCD_HEIGHT)
297 /* Determine if we have a wide screen or a tall screen. This is used to
298 place the board and footer in acceptable locations also, set the
299 LCD_BOARD_SIZE, making sure that we have at least 16 pixels for the
300 "footer" on either the bottom or the right. */
302 #define FOOTER_RESERVE (16)
304 #if (LCD_WIDTH > LCD_HEIGHT)
306 #define GBN_WIDE_SCREEN
308 #define LCD_BOARD_WIDTH (LCD_WIDTH - FOOTER_RESERVE)
309 #define LCD_BOARD_HEIGHT LCD_HEIGHT
311 #else
313 #define GBN_TALL_SCREEN
315 #define LCD_BOARD_WIDTH LCD_WIDTH
316 #define LCD_BOARD_HEIGHT (LCD_HEIGHT - FOOTER_RESERVE)
318 #endif /* LCD_WIDTH > LCD_HEIGHT */
321 /* The directory we default to for saving crap */
322 #define DEFAULT_SAVE_DIR PLUGIN_GAMES_DIR "/goban"
324 /* The default file we save to */
325 #define DEFAULT_SAVE (DEFAULT_SAVE_DIR "/goban_d.sgf")
327 /* The size of the buffer we store filenames in (1 reserved for '\0') */
328 #define SAVE_FILE_LENGTH 256
330 /* The maximum setting for idle autosave time, in minutes */
331 #define MAX_AUTOSAVE (30)
333 /* On mono targets, draw while stones with a black outline so they are
334 actually visibile instead of being white on white */
335 #if (LCD_DEPTH == 1)
336 #define OUTLINE_STONES
337 #endif
339 /* The current play mode */
340 extern enum play_mode_t play_mode;
342 /* Show comments when redoing onto a move? */
343 extern bool auto_show_comments;
345 /* A stack used for parsing/outputting as well as some board functions
346 such as counting liberties and filling in/ removing stones */
347 extern struct stack_t parse_stack;
349 #endif