summaryrefslogtreecommitdiff
path: root/apps/gui/viewport.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r--apps/gui/viewport.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
new file mode 100644
index 0000000000..c59a1d9ca2
--- /dev/null
+++ b/apps/gui/viewport.c
@@ -0,0 +1,73 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Jonathan Gordon
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "lcd.h"
22#include "font.h"
23#include "sprintf.h"
24#include "string.h"
25#include "settings.h"
26#include "kernel.h"
27#include "system.h"
28#include "misc.h"
29#include "atoi.h"
30#include "viewport.h"
31#include "statusbar.h"
32#include "screen_access.h"
33
34int viewport_get_nb_lines(struct viewport *vp)
35{
36#ifdef HAVE_LCD_BITMAP
37 return vp->height/font_get(vp->font)->height;
38#else
39 (void)vp;
40 return 2;
41#endif
42}
43
44
45void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
46{
47 vp->x = 0;
48 vp->width = screens[screen].width;
49
50 vp->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
51 vp->height = screens[screen].height - vp->y
52#ifdef HAS_BUTTONBAR
53 - screens[screen].has_buttonbar?BUTTONBAR_HEIGHT:0
54#endif
55 ;
56#ifdef HAVE_LCD_BITMAP
57 vp->drawmode = DRMODE_SOLID;
58 vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
59#endif
60 if (screens[screen].depth > 1)
61 {
62#ifdef HAVE_LCD_COLOR
63 vp->fg_pattern = global_settings.fg_color;
64 vp->bg_pattern = global_settings.bg_color;
65 vp->lss_pattern = global_settings.lss_color;
66 vp->lse_pattern = global_settings.lse_color;
67 vp->lst_pattern = global_settings.lst_color;
68#elif LCD_DEPTH > 1
69 vp->fg_pattern = LCD_DEFAULT_FG;
70 vp->bg_pattern = LCD_DEFAULT_BG;
71#endif
72 }
73}