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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <lcd.h>
|
|
|
|
#include <lcd-remote.h>
|
2005-11-22 03:38:07 +00:00
|
|
|
#include "backlight.h"
|
2005-10-28 00:17:15 +00:00
|
|
|
#include <font.h>
|
|
|
|
#include <button.h>
|
|
|
|
#include <sprintf.h>
|
|
|
|
#include <settings.h>
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <icons.h>
|
|
|
|
|
|
|
|
#include "screen_access.h"
|
2005-11-02 01:06:51 +00:00
|
|
|
#include "textarea.h"
|
2005-10-28 00:17:15 +00:00
|
|
|
|
|
|
|
struct screen screens[NB_SCREENS];
|
|
|
|
|
|
|
|
void screen_init(struct screen * screen, enum screen_type screen_type)
|
|
|
|
{
|
|
|
|
switch(screen_type)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
case SCREEN_REMOTE:
|
2007-07-18 11:18:52 +00:00
|
|
|
screen->is_color=false;/* No color remotes yet */
|
2007-08-04 03:01:46 +00:00
|
|
|
screen->pixel_format=LCD_REMOTE_PIXELFORMAT;
|
2005-11-19 11:45:08 +00:00
|
|
|
screen->depth=LCD_REMOTE_DEPTH;
|
2005-11-20 01:02:14 +00:00
|
|
|
screen->has_disk_led=false;
|
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->width=LCD_REMOTE_WIDTH;
|
|
|
|
screen->height=LCD_REMOTE_HEIGHT;
|
|
|
|
screen->setmargins=&lcd_remote_setmargins;
|
|
|
|
screen->getymargin=&lcd_remote_getymargin;
|
|
|
|
screen->getxmargin=&lcd_remote_getxmargin;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->getstringsize=&lcd_remote_getstringsize;
|
|
|
|
#if 1 /* all remote LCDs are bitmapped so far */
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->setfont=&lcd_remote_setfont;
|
2005-11-19 11:45:08 +00:00
|
|
|
screen->setfont(FONT_UI);
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->mono_bitmap=&lcd_remote_mono_bitmap;
|
2006-10-14 01:32:58 +00:00
|
|
|
screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part;
|
2007-04-16 23:55:19 +00:00
|
|
|
screen->bitmap=(screen_bitmap_func*)&lcd_remote_bitmap;
|
|
|
|
screen->bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->set_drawmode=&lcd_remote_set_drawmode;
|
2007-04-24 21:00:45 +00:00
|
|
|
#if LCD_REMOTE_DEPTH <= 2
|
2007-04-16 23:55:19 +00:00
|
|
|
/* No transparency yet for grayscale and mono lcd */
|
|
|
|
screen->transparent_bitmap=(screen_bitmap_func*)&lcd_remote_bitmap;
|
|
|
|
screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part;
|
|
|
|
/* No colour remotes yet */
|
|
|
|
#endif
|
2006-10-12 20:45:31 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
2006-10-14 01:32:58 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
screen->color_to_native=&lcd_remote_color_to_native;
|
|
|
|
#endif
|
2006-02-02 22:00:56 +00:00
|
|
|
screen->get_background=&lcd_remote_get_background;
|
|
|
|
screen->get_foreground=&lcd_remote_get_foreground;
|
2005-11-19 11:45:08 +00:00
|
|
|
screen->set_background=&lcd_remote_set_background;
|
2006-02-02 22:00:56 +00:00
|
|
|
screen->set_foreground=&lcd_remote_set_foreground;
|
2005-11-19 11:45:08 +00:00
|
|
|
#endif /* LCD_REMOTE_DEPTH > 1 */
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->update_rect=&lcd_remote_update_rect;
|
|
|
|
screen->fillrect=&lcd_remote_fillrect;
|
|
|
|
screen->drawrect=&lcd_remote_drawrect;
|
|
|
|
screen->drawpixel=&lcd_remote_drawpixel;
|
|
|
|
screen->drawline=&lcd_remote_drawline;
|
|
|
|
screen->vline=&lcd_remote_vline;
|
|
|
|
screen->hline=&lcd_remote_hline;
|
|
|
|
screen->scroll_step=&lcd_remote_scroll_step;
|
2005-11-09 01:17:57 +00:00
|
|
|
screen->invertscroll=&lcd_remote_invertscroll;
|
2006-01-22 01:42:05 +00:00
|
|
|
screen->puts_style_offset=&lcd_remote_puts_style_offset;
|
2006-01-22 04:24:26 +00:00
|
|
|
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
|
|
|
|
screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
|
2007-03-26 07:52:13 +00:00
|
|
|
#endif /* 1 */
|
2006-01-22 04:24:26 +00:00
|
|
|
|
2005-11-19 11:45:08 +00:00
|
|
|
#if 0 /* no charcell remote LCDs so far */
|
|
|
|
screen->double_height=&lcd_remote_double_height;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->putc=&lcd_remote_putc;
|
2005-11-19 11:45:08 +00:00
|
|
|
screen->get_locked_pattern=&lcd_remote_get_locked_pattern;
|
|
|
|
screen->define_pattern=&lcd_remote_define_pattern;
|
|
|
|
screen->icon=&lcd_remote_icon;
|
|
|
|
#endif /* 0 */
|
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->init=&lcd_remote_init;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->putsxy=&lcd_remote_putsxy;
|
|
|
|
screen->puts=&lcd_remote_puts;
|
|
|
|
screen->puts_offset=&lcd_remote_puts_offset;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->puts_scroll=&lcd_remote_puts_scroll;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
|
|
|
|
screen->scroll_speed=&lcd_remote_scroll_speed;
|
|
|
|
screen->scroll_delay=&lcd_remote_scroll_delay;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->stop_scroll=&lcd_remote_stop_scroll;
|
|
|
|
screen->clear_display=&lcd_remote_clear_display;
|
|
|
|
screen->update=&lcd_remote_update;
|
2005-11-22 03:38:07 +00:00
|
|
|
screen->backlight_on=&remote_backlight_on;
|
|
|
|
screen->backlight_off=&remote_backlight_off;
|
2006-07-01 10:14:27 +00:00
|
|
|
screen->is_backlight_on=&is_remote_backlight_on;
|
|
|
|
screen->backlight_set_timeout=&remote_backlight_set_timeout;
|
2005-10-28 00:17:15 +00:00
|
|
|
break;
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
|
|
|
|
case SCREEN_MAIN:
|
|
|
|
default:
|
2007-07-18 11:18:52 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
screen->is_color=true;
|
|
|
|
#else
|
|
|
|
screen->is_color=false;
|
2007-08-04 03:01:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
screen->pixel_format=LCD_PIXELFORMAT;
|
2007-07-18 11:18:52 +00:00
|
|
|
#endif
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->depth=LCD_DEPTH;
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL)
|
2005-11-20 01:02:14 +00:00
|
|
|
screen->has_disk_led=false;
|
2005-11-24 00:10:14 +00:00
|
|
|
#elif defined(HAVE_REMOTE_LCD)
|
2005-11-20 01:02:14 +00:00
|
|
|
screen->has_disk_led=true;
|
|
|
|
#endif
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->width=LCD_WIDTH;
|
|
|
|
screen->height=LCD_HEIGHT;
|
|
|
|
screen->setmargins=&lcd_setmargins;
|
|
|
|
screen->getymargin=&lcd_getymargin;
|
|
|
|
screen->getxmargin=&lcd_getxmargin;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->getstringsize=&lcd_getstringsize;
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->setfont=&lcd_setfont;
|
2005-11-19 11:45:08 +00:00
|
|
|
screen->setfont(FONT_UI);
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->mono_bitmap=&lcd_mono_bitmap;
|
2006-02-10 13:57:11 +00:00
|
|
|
screen->mono_bitmap_part=&lcd_mono_bitmap_part;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->set_drawmode=&lcd_set_drawmode;
|
2007-04-16 23:55:19 +00:00
|
|
|
screen->bitmap=(screen_bitmap_func*)&lcd_bitmap;
|
|
|
|
screen->bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part;
|
|
|
|
#if LCD_DEPTH <= 2
|
|
|
|
/* No transparency yet for grayscale and mono lcd */
|
|
|
|
screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap;
|
|
|
|
screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part;
|
2006-01-28 23:12:20 +00:00
|
|
|
#else
|
2007-04-16 23:55:19 +00:00
|
|
|
screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap_transparent;
|
|
|
|
screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_transparent_part;
|
2006-10-14 01:32:58 +00:00
|
|
|
#endif
|
2007-04-16 23:55:19 +00:00
|
|
|
#if LCD_DEPTH > 1
|
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
|
|
|
screen->color_to_native=&lcd_color_to_native;
|
2006-01-28 23:12:20 +00:00
|
|
|
#endif
|
2006-02-02 22:00:56 +00:00
|
|
|
screen->get_background=&lcd_get_background;
|
|
|
|
screen->get_foreground=&lcd_get_foreground;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->set_background=&lcd_set_background;
|
2006-02-02 22:00:56 +00:00
|
|
|
screen->set_foreground=&lcd_set_foreground;
|
2007-03-26 07:52:13 +00:00
|
|
|
#endif /* LCD_DEPTH > 1 */
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->update_rect=&lcd_update_rect;
|
|
|
|
screen->fillrect=&lcd_fillrect;
|
|
|
|
screen->drawrect=&lcd_drawrect;
|
|
|
|
screen->drawpixel=&lcd_drawpixel;
|
|
|
|
screen->drawline=&lcd_drawline;
|
|
|
|
screen->vline=&lcd_vline;
|
|
|
|
screen->hline=&lcd_hline;
|
|
|
|
screen->scroll_step=&lcd_scroll_step;
|
2005-11-09 01:17:57 +00:00
|
|
|
screen->invertscroll=&lcd_invertscroll;
|
2006-01-22 01:42:05 +00:00
|
|
|
screen->puts_style_offset=&lcd_puts_style_offset;
|
2006-04-04 18:28:34 +00:00
|
|
|
screen->puts_scroll_style=&lcd_puts_scroll_style;
|
2006-01-22 04:24:26 +00:00
|
|
|
screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
|
2005-10-28 00:17:15 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
screen->double_height=&lcd_double_height;
|
|
|
|
screen->putc=&lcd_putc;
|
2005-11-17 20:14:59 +00:00
|
|
|
screen->get_locked_pattern=&lcd_get_locked_pattern;
|
|
|
|
screen->define_pattern=&lcd_define_pattern;
|
2007-07-25 09:38:55 +00:00
|
|
|
screen->unlock_pattern=&lcd_unlock_pattern;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->icon=&lcd_icon;
|
|
|
|
#endif /* HAVE_LCD_CHARCELLS */
|
2005-11-19 11:45:08 +00:00
|
|
|
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->init=&lcd_init;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->putsxy=&lcd_putsxy;
|
|
|
|
screen->puts=&lcd_puts;
|
|
|
|
screen->puts_offset=&lcd_puts_offset;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->puts_scroll=&lcd_puts_scroll;
|
2007-03-26 07:52:13 +00:00
|
|
|
screen->puts_scroll_offset=&lcd_puts_scroll_offset;
|
|
|
|
screen->scroll_speed=&lcd_scroll_speed;
|
|
|
|
screen->scroll_delay=&lcd_scroll_delay;
|
2005-10-28 00:17:15 +00:00
|
|
|
screen->stop_scroll=&lcd_stop_scroll;
|
|
|
|
screen->clear_display=&lcd_clear_display;
|
|
|
|
screen->update=&lcd_update;
|
2005-11-22 03:38:07 +00:00
|
|
|
screen->backlight_on=&backlight_on;
|
|
|
|
screen->backlight_off=&backlight_off;
|
2006-07-01 10:14:27 +00:00
|
|
|
screen->is_backlight_on=&is_backlight_on;
|
|
|
|
screen->backlight_set_timeout=&backlight_set_timeout;
|
2005-10-28 00:17:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
screen->screen_type=screen_type;
|
2005-10-30 22:34:51 +00:00
|
|
|
#ifdef HAS_BUTTONBAR
|
|
|
|
screen->has_buttonbar=false;
|
|
|
|
#endif
|
2005-11-01 23:56:03 +00:00
|
|
|
gui_textarea_update_nblines(screen);
|
2005-10-28 00:17:15 +00:00
|
|
|
}
|
|
|
|
|
2005-11-09 01:17:57 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
void screen_clear_area(struct screen * display, int xstart, int ystart,
|
|
|
|
int width, int height)
|
|
|
|
{
|
|
|
|
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
display->fillrect(xstart, ystart, width, height);
|
|
|
|
display->set_drawmode(DRMODE_SOLID);
|
2005-10-28 00:17:15 +00:00
|
|
|
}
|
2005-11-09 01:17:57 +00:00
|
|
|
#endif
|
2005-11-16 02:12:25 +00:00
|
|
|
|
|
|
|
void screen_access_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
screen_init(&screens[i], i);
|
|
|
|
}
|