2008-03-05 09:58:30 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 by Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-03-05 09:58:30 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2009-08-12 15:34:41 +00:00
|
|
|
#ifndef __VIEWPORT_H__
|
|
|
|
#define __VIEWPORT_H__
|
|
|
|
|
|
|
|
|
2008-03-05 09:58:30 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "lcd.h"
|
2009-06-07 21:27:05 +00:00
|
|
|
#include "system.h"
|
2008-03-05 09:58:30 +00:00
|
|
|
#include "screen_access.h"
|
|
|
|
|
|
|
|
/* return the number of text lines in the vp viewport */
|
2009-10-10 08:29:13 +00:00
|
|
|
int viewport_get_nb_lines(const struct viewport *vp);
|
2008-03-05 09:58:30 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
#define THEME_STATUSBAR (BIT_N(0))
|
|
|
|
#define THEME_UI_VIEWPORT (BIT_N(1))
|
|
|
|
#define THEME_BUTTONBAR (BIT_N(2))
|
|
|
|
#define THEME_LANGUAGE (BIT_N(3))
|
|
|
|
#define THEME_ALL (~(0u))
|
2009-08-16 22:20:11 +00:00
|
|
|
|
2009-09-13 13:40:58 +00:00
|
|
|
#ifndef __PCTOOL__
|
2009-08-16 22:20:11 +00:00
|
|
|
/*
|
|
|
|
* Initialize the viewportmanager, which in turns initializes the UI vp and
|
|
|
|
* statusbar stuff
|
|
|
|
*/
|
2010-03-03 23:20:32 +00:00
|
|
|
void viewportmanager_init(void) INIT_ATTR;
|
2009-08-16 22:20:11 +00:00
|
|
|
|
2009-12-09 07:25:46 +00:00
|
|
|
void viewport_set_defaults(struct viewport *vp,
|
|
|
|
const enum screen_type screen);
|
2009-10-11 00:05:12 +00:00
|
|
|
void viewport_set_fullscreen(struct viewport *vp,
|
2009-12-09 07:25:46 +00:00
|
|
|
const enum screen_type screen);
|
2010-06-07 03:44:11 +00:00
|
|
|
int get_viewport_default_colour(enum screen_type screen, bool fgcolour);
|
2009-08-12 15:34:41 +00:00
|
|
|
|
2009-08-16 22:20:11 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-12-09 07:25:46 +00:00
|
|
|
void viewportmanager_theme_enable(enum screen_type screen, bool enable,
|
|
|
|
struct viewport *viewport);
|
2009-12-21 05:19:12 +00:00
|
|
|
/* Force will cause a redraw even if the theme was previously and
|
|
|
|
* currently enabled (i,e the undo doing nothing).
|
|
|
|
* Should almost always be set to false except coming out of fully skinned screens */
|
|
|
|
void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw);
|
2009-08-16 22:20:11 +00:00
|
|
|
|
2009-10-09 19:17:22 +00:00
|
|
|
/* call this when a theme changed */
|
2009-10-11 00:05:12 +00:00
|
|
|
void viewportmanager_theme_changed(const int);
|
2009-10-09 19:17:22 +00:00
|
|
|
|
2009-09-05 23:57:09 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2009-10-11 00:05:12 +00:00
|
|
|
bool viewport_point_within_vp(const struct viewport *vp,
|
|
|
|
const int x, const int y);
|
2009-09-05 23:57:09 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-16 22:20:11 +00:00
|
|
|
#else /* HAVE_LCD_CHARCELL */
|
2009-10-09 19:17:22 +00:00
|
|
|
#define viewportmanager_theme_changed(a)
|
2009-12-09 07:25:46 +00:00
|
|
|
#define viewportmanager_theme_enable(...)
|
|
|
|
#define viewportmanager_theme_undo(...)
|
2009-08-16 22:20:11 +00:00
|
|
|
#endif
|
2009-09-13 13:40:58 +00:00
|
|
|
|
|
|
|
#endif /* __PCTOOL__ */
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse a viewport definition (vp_def), which looks like:
|
|
|
|
*
|
|
|
|
* Screens with depth > 1:
|
|
|
|
* X|Y|width|height|font|foregorund color|background color
|
|
|
|
* Screens with depth = 1:
|
|
|
|
* X|Y|width|height|font
|
|
|
|
*
|
|
|
|
* | is a separator and can be specified via the parameter
|
|
|
|
*
|
|
|
|
* Returns the pointer to the char after the last character parsed
|
|
|
|
* if everything went OK or NULL if an error happened (some values
|
|
|
|
* not specified in the definition)
|
|
|
|
*/
|
|
|
|
const char* viewport_parse_viewport(struct viewport *vp,
|
|
|
|
enum screen_type screen,
|
|
|
|
const char *vp_def,
|
|
|
|
const char separator);
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2009-08-12 15:34:41 +00:00
|
|
|
#endif /* __VIEWPORT_H__ */
|