Theme Editor: Put together a simple GUI to test going back and forth between a tree...
[kugel-rb.git] / apps / plugins / goban / display.h
blob2f64f1b6ca33894b3ada95c8e4fe914e00f2410f
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_DISPLAY_H
23 #define GOBAN_DISPLAY_H
25 #include "types.h"
26 #include "goban.h"
28 /* Call before using the display */
29 void setup_display (void);
31 /* Draw the board and the "footer" */
32 void draw_screen_display (void);
34 /* The location of the cursor */
35 extern unsigned short cursor_pos;
37 /* True if we should draw variations */
38 extern bool draw_variations;
40 /* Used to set the zoom level, loaded in from the config file */
41 unsigned int saved_circle_size;
43 /* the size of one intersection on the board, in pixels */
44 unsigned int intersection_size;
46 /* Clear the marks from the board */
47 void clear_marks_display (void);
49 /* Add a mark to the display */
50 void set_mark_display (unsigned short pos, unsigned char mark_char);
52 /* Set to indicate if we should display the 'C' in the footer or not */
53 void set_comment_display (bool new_val);
55 /* Move the display so that the position pos is in view, very useful if
56 we're zoomed in (otherwise does nothing) */
57 void move_display (unsigned short pos);
59 /* These should all be obvious. Zoom levels start at 1. set_zoom_display
60 will set the default zoom level if called with zoom_level == 0 */
61 void set_zoom_display (unsigned int zoom_level);
62 unsigned int current_zoom_display (void);
63 unsigned int min_zoom_display (void);
64 unsigned int max_zoom_display (void);
66 /* MIN and MAX intersection sizes */
67 #define MIN_DEFAULT_INT_SIZE (11)
69 /* The absolute minimum that is allowed */
70 #define MIN_INT_SIZE (3)
72 /* Don't allow one bigger than the size of the screen */
73 #define MAX_INT_SIZE (min((LCD_BOARD_WIDTH & 1) ? LCD_BOARD_WIDTH : \
74 LCD_BOARD_WIDTH - 1, \
75 (LCD_BOARD_HEIGHT & 1) ? LCD_BOARD_HEIGHT : \
76 LCD_BOARD_HEIGHT - 1))
81 /* NOTE: we do one "extra" intersection in each direction which goes off
82 the screen, because it makes drawing a little bit prettier (the board
83 doesn't end before the edge of the screen this way) */
86 /* right is a screen boundary if we're on a tall screen, bottom is a
87 screen boundary if we're on a wide screen */
88 #if defined(GBN_TALL_SCREEN)
89 #define MIN_X ((min_x_int == 0) ? 0 : min_x_int - 1)
90 #define MIN_Y (min_y_int)
91 /* always flush with top, no need for extra */
93 #define MAX_X (min(min_x_int + num_x_ints + 1, board_width))
94 #define MAX_Y (min(min_y_int + num_y_ints, board_height))
95 #else
96 #define MIN_X (min_x_int)
97 /* always flush with left, no need for extra */
99 #define MIN_Y ((min_y_int == 0) ? 0 : min_y_int - 1)
100 #define MAX_X (min(min_x_int + num_x_ints, board_width))
101 #define MAX_Y (min(min_y_int + num_y_ints + 1, board_height))
102 #endif
104 /* These are the same as above, except without the extra intersection is
105 board-boundary directions */
106 #define REAL_MIN_X (min_x_int)
107 #define REAL_MIN_Y (min_y_int)
108 #define REAL_MAX_X (min(min_x_int + num_x_ints, board_width))
109 #define REAL_MAX_Y (min(min_y_int + num_y_ints, board_height))
111 #endif