2005-10-28 00:17:15 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2005-10-30 01:24:35 +00:00
|
|
|
* Copyright (C) 2005 by Kevin Ferrare
|
2005-10-28 00:17:15 +00:00
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SCREEN_ACCESS_H_
|
|
|
|
#define _SCREEN_ACCESS_H_
|
|
|
|
|
|
|
|
#include "lcd.h"
|
2005-10-30 01:24:35 +00:00
|
|
|
#include "buttonbar.h"
|
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
enum screen_type {
|
|
|
|
SCREEN_MAIN
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
,SCREEN_REMOTE
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2005-11-02 02:28:12 +00:00
|
|
|
#if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
|
2005-10-28 00:17:15 +00:00
|
|
|
#define NB_SCREENS 2
|
|
|
|
#else
|
|
|
|
#define NB_SCREENS 1
|
|
|
|
#endif
|
|
|
|
|
2005-11-09 22:47:15 +00:00
|
|
|
#if NB_SCREENS == 1
|
|
|
|
#define FOR_NB_SCREENS(i) i = 0;
|
|
|
|
#else
|
|
|
|
#define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
|
|
|
|
#endif
|
|
|
|
|
2005-10-29 02:33:19 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
2005-10-28 00:17:15 +00:00
|
|
|
#define MAX_LINES_ON_SCREEN 2
|
|
|
|
#endif
|
|
|
|
|
2007-04-16 23:55:19 +00:00
|
|
|
typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
|
|
|
|
int stride, int x, int y, int width, int height);
|
|
|
|
typedef void screen_bitmap_func(const void *src, int x, int y, int width,
|
|
|
|
int height);
|
|
|
|
|
2007-09-18 19:05:35 +00:00
|
|
|
/* if this struct is changed the plugin api may break so bump the api
|
|
|
|
versions in plugin.h */
|
2005-10-28 00:17:15 +00:00
|
|
|
struct screen
|
|
|
|
{
|
|
|
|
enum screen_type screen_type;
|
2007-09-18 19:05:35 +00:00
|
|
|
int width, height;
|
2005-10-28 00:17:15 +00:00
|
|
|
int depth;
|
2007-09-18 19:05:35 +00:00
|
|
|
int nb_lines;
|
2007-08-04 03:01:46 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
int pixel_format;
|
|
|
|
#endif
|
2005-10-28 00:17:15 +00:00
|
|
|
int char_width;
|
|
|
|
int char_height;
|
2007-09-18 19:05:35 +00:00
|
|
|
bool is_color;
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
2005-11-20 01:02:14 +00:00
|
|
|
bool has_disk_led;
|
2005-11-24 00:10:14 +00:00
|
|
|
#endif
|
2005-10-30 22:34:51 +00:00
|
|
|
#ifdef HAS_BUTTONBAR
|
|
|
|
bool has_buttonbar;
|
|
|
|
#endif
|
2008-01-08 01:22:14 +00:00
|
|
|
void (*set_viewport)(struct viewport* vp);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*setmargins)(int x, int y);
|
2008-01-08 01:22:14 +00:00
|
|
|
int (*getwidth)(void);
|
|
|
|
int (*getheight)(void);
|
2005-10-28 00:17:15 +00:00
|
|
|
int (*getxmargin)(void);
|
|
|
|
int (*getymargin)(void);
|
|
|
|
int (*getstringsize)(const unsigned char *str, int *w, int *h);
|
2007-03-26 07:52:13 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
|
|
|
|
void (*setfont)(int newfont);
|
2008-01-08 01:22:14 +00:00
|
|
|
int (*getfont)(void);
|
2006-01-22 01:42:05 +00:00
|
|
|
|
2006-01-22 04:24:26 +00:00
|
|
|
void (*scroll_step)(int pixels);
|
2006-10-14 01:32:58 +00:00
|
|
|
void (*puts_style_offset)(int x, int y, const unsigned char *str,
|
2006-01-22 04:24:26 +00:00
|
|
|
int style, int offset);
|
2006-01-22 01:42:05 +00:00
|
|
|
void (*puts_scroll_style)(int x, int y, const unsigned char *string,
|
|
|
|
int style);
|
|
|
|
void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
|
2006-01-22 04:24:26 +00:00
|
|
|
int style, int offset);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*mono_bitmap)(const unsigned char *src,
|
|
|
|
int x, int y, int width, int height);
|
2006-02-10 13:57:11 +00:00
|
|
|
void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
|
|
|
|
int stride, int x, int y, int width, int height);
|
2007-04-16 23:55:19 +00:00
|
|
|
void (*bitmap)(const void *src,
|
2006-01-28 12:12:42 +00:00
|
|
|
int x, int y, int width, int height);
|
2007-04-16 23:55:19 +00:00
|
|
|
void (*bitmap_part)(const void *src, int src_x, int src_y,
|
2006-10-14 01:32:58 +00:00
|
|
|
int stride, int x, int y, int width, int height);
|
2007-04-16 23:55:19 +00:00
|
|
|
void (*transparent_bitmap)(const void *src,
|
2006-01-28 23:12:20 +00:00
|
|
|
int x, int y, int width, int height);
|
2007-04-16 23:55:19 +00:00
|
|
|
void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
|
2006-02-10 13:57:11 +00:00
|
|
|
int stride, int x, int y, int width, int height);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*set_drawmode)(int mode);
|
2007-02-17 21:54:17 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
|
2006-10-14 01:32:58 +00:00
|
|
|
unsigned (*color_to_native)(unsigned color);
|
|
|
|
#endif
|
2007-02-17 23:07:39 +00:00
|
|
|
#if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
|
2006-02-02 22:00:56 +00:00
|
|
|
unsigned (*get_background)(void);
|
|
|
|
unsigned (*get_foreground)(void);
|
2005-11-16 21:09:23 +00:00
|
|
|
void (*set_background)(unsigned background);
|
2006-02-02 22:00:56 +00:00
|
|
|
void (*set_foreground)(unsigned foreground);
|
2005-11-19 11:45:08 +00:00
|
|
|
#endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
|
2007-09-27 15:42:55 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
void (*set_selector_start)(unsigned selector);
|
|
|
|
void (*set_selector_end)(unsigned selector);
|
|
|
|
void (*set_selector_text)(unsigned selector_text);
|
|
|
|
#endif
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*update_rect)(int x, int y, int width, int height);
|
2008-01-08 01:22:14 +00:00
|
|
|
void (*update_viewport_rect)(int x, int y, int width, int height);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*fillrect)(int x, int y, int width, int height);
|
|
|
|
void (*drawrect)(int x, int y, int width, int height);
|
|
|
|
void (*drawpixel)(int x, int y);
|
|
|
|
void (*drawline)(int x1, int y1, int x2, int y2);
|
|
|
|
void (*vline)(int x, int y1, int y2);
|
|
|
|
void (*hline)(int x1, int x2, int y);
|
2005-11-19 11:45:08 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
|
2005-10-28 00:17:15 +00:00
|
|
|
|
2005-11-19 11:45:08 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*double_height)(bool on);
|
2007-03-26 07:52:13 +00:00
|
|
|
void (*putc)(int x, int y, unsigned long ucs);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*icon)(int icon, bool enable);
|
2007-03-26 07:52:13 +00:00
|
|
|
unsigned long (*get_locked_pattern)(void);
|
|
|
|
void (*define_pattern)(unsigned long ucs, const char *pattern);
|
2007-07-25 09:38:55 +00:00
|
|
|
void (*unlock_pattern)(unsigned long ucs);
|
2005-10-28 00:17:15 +00:00
|
|
|
#endif
|
2007-03-26 07:52:13 +00:00
|
|
|
void (*putsxy)(int x, int y, const unsigned char *str);
|
|
|
|
void (*puts)(int x, int y, const unsigned char *str);
|
|
|
|
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*puts_scroll)(int x, int y, const unsigned char *string);
|
2007-03-26 07:52:13 +00:00
|
|
|
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
|
|
|
|
int offset);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*scroll_speed)(int speed);
|
|
|
|
void (*scroll_delay)(int ms);
|
|
|
|
void (*stop_scroll)(void);
|
|
|
|
void (*clear_display)(void);
|
2008-01-08 01:22:14 +00:00
|
|
|
void (*clear_viewport)(void);
|
|
|
|
void (*scroll_stop)(struct viewport* vp);
|
|
|
|
void (*scroll_stop_line)(struct viewport* vp, int y);
|
2005-10-28 00:17:15 +00:00
|
|
|
void (*update)(void);
|
2008-01-08 01:22:14 +00:00
|
|
|
void (*update_viewport)(void);
|
2005-11-22 03:38:07 +00:00
|
|
|
void (*backlight_on)(void);
|
|
|
|
void (*backlight_off)(void);
|
2008-04-02 22:16:14 +00:00
|
|
|
bool (*is_backlight_on)(bool ignore_always_off);
|
2006-07-01 10:14:27 +00:00
|
|
|
void (*backlight_set_timeout)(int index);
|
2005-10-28 00:17:15 +00:00
|
|
|
};
|
|
|
|
|
2005-10-30 22:34:51 +00:00
|
|
|
#ifdef HAS_BUTTONBAR
|
|
|
|
/*
|
|
|
|
* Sets if the given screen has a buttonbar or not
|
|
|
|
* - screen : the screen structure
|
|
|
|
* - has : a boolean telling wether the current screen will have a buttonbar or not
|
|
|
|
*/
|
|
|
|
#define screen_has_buttonbar(screen, has_btnb) \
|
|
|
|
(screen)->has_buttonbar=has_btnb;
|
|
|
|
#endif
|
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
/*
|
2005-11-01 23:56:03 +00:00
|
|
|
* Sets the x margin in pixels for the given screen
|
2005-10-28 00:17:15 +00:00
|
|
|
* - screen : the screen structure
|
2005-11-01 23:56:03 +00:00
|
|
|
* - xmargin : the number of pixels to the left of the screen
|
2005-10-28 00:17:15 +00:00
|
|
|
*/
|
2005-11-01 23:56:03 +00:00
|
|
|
#define screen_set_xmargin(screen, xmargin) \
|
|
|
|
(screen)->setmargins(xmargin, (screen)->getymargin());
|
2005-10-28 00:17:15 +00:00
|
|
|
|
|
|
|
/*
|
2005-11-01 23:56:03 +00:00
|
|
|
* Sets the y margin in pixels for the given screen
|
2005-10-28 00:17:15 +00:00
|
|
|
* - screen : the screen structure
|
2005-11-01 23:56:03 +00:00
|
|
|
* - xmargin : the number of pixels to the top of the screen
|
2005-10-28 00:17:15 +00:00
|
|
|
*/
|
2005-11-01 23:56:03 +00:00
|
|
|
#define screen_set_ymargin(screen, ymargin) \
|
|
|
|
(screen)->setmargins((screen)->getxmargin(), ymargin);
|
2005-10-28 00:17:15 +00:00
|
|
|
|
2005-11-19 11:45:08 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
|
2005-11-09 01:17:57 +00:00
|
|
|
/*
|
|
|
|
* Clear only a given area of the screen
|
|
|
|
* - screen : the screen structure
|
|
|
|
* - xstart, ystart : where the area starts
|
|
|
|
* - width, height : size of the area
|
|
|
|
*/
|
|
|
|
void screen_clear_area(struct screen * display, int xstart, int ystart,
|
|
|
|
int width, int height);
|
|
|
|
#endif
|
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
/*
|
|
|
|
* Initializes the whole screen_access api
|
|
|
|
*/
|
|
|
|
extern void screen_access_init(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* exported screens array that should be used
|
|
|
|
* by each app that wants to write to access display
|
|
|
|
*/
|
|
|
|
extern struct screen screens[NB_SCREENS];
|
|
|
|
|
|
|
|
#endif /*_SCREEN_ACCESS_H_*/
|