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>
|
2008-01-08 01:22:14 +00:00
|
|
|
#include <scroll_engine.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"
|
|
|
|
|
2007-09-18 19:05:35 +00:00
|
|
|
struct screen screens[NB_SCREENS] =
|
2005-10-28 00:17:15 +00:00
|
|
|
{
|
|
|
|
{
|
2007-09-18 19:05:35 +00:00
|
|
|
.screen_type=SCREEN_MAIN,
|
|
|
|
.width=LCD_WIDTH,
|
|
|
|
.height=LCD_HEIGHT,
|
|
|
|
.depth=LCD_DEPTH,
|
2006-10-14 01:32:58 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
2007-09-18 19:05:35 +00:00
|
|
|
.is_color=true,
|
2007-07-18 11:18:52 +00:00
|
|
|
#else
|
2007-09-18 19:05:35 +00:00
|
|
|
.is_color=false,
|
2007-08-04 03:01:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-09-18 19:05:35 +00:00
|
|
|
.pixel_format=LCD_PIXELFORMAT,
|
2007-07-18 11:18:52 +00:00
|
|
|
#endif
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL)
|
2007-09-18 19:05:35 +00:00
|
|
|
.has_disk_led=false,
|
2005-11-24 00:10:14 +00:00
|
|
|
#elif defined(HAVE_REMOTE_LCD)
|
2007-09-18 19:05:35 +00:00
|
|
|
.has_disk_led=true,
|
2005-11-20 01:02:14 +00:00
|
|
|
#endif
|
2008-01-08 01:22:14 +00:00
|
|
|
.set_viewport=&lcd_set_viewport,
|
2007-09-18 19:05:35 +00:00
|
|
|
.setmargins=&lcd_setmargins,
|
2008-01-08 01:22:14 +00:00
|
|
|
.getwidth=&lcd_getwidth,
|
|
|
|
.getheight=&lcd_getheight,
|
2007-09-18 19:05:35 +00:00
|
|
|
.getymargin=&lcd_getymargin,
|
|
|
|
.getxmargin=&lcd_getxmargin,
|
|
|
|
.getstringsize=&lcd_getstringsize,
|
2007-03-26 07:52:13 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-09-18 19:05:35 +00:00
|
|
|
.setfont=&lcd_setfont,
|
2008-01-08 01:22:14 +00:00
|
|
|
.getfont=&lcd_getfont,
|
2007-09-18 19:05:35 +00:00
|
|
|
.mono_bitmap=&lcd_mono_bitmap,
|
|
|
|
.mono_bitmap_part=&lcd_mono_bitmap_part,
|
|
|
|
.set_drawmode=&lcd_set_drawmode,
|
|
|
|
.bitmap=(screen_bitmap_func*)&lcd_bitmap,
|
|
|
|
.bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part,
|
2007-04-16 23:55:19 +00:00
|
|
|
#if LCD_DEPTH <= 2
|
2007-09-18 19:05:35 +00:00
|
|
|
/* No transparency yet for grayscale and mono lcd */
|
|
|
|
.transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap,
|
|
|
|
.transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part,
|
2006-01-28 23:12:20 +00:00
|
|
|
#else
|
2007-09-18 19:05:35 +00:00
|
|
|
.transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap_transparent,
|
|
|
|
.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
|
2007-09-18 19:05:35 +00:00
|
|
|
.color_to_native=&lcd_color_to_native,
|
2006-01-28 23:12:20 +00:00
|
|
|
#endif
|
2007-09-18 19:05:35 +00:00
|
|
|
.get_background=&lcd_get_background,
|
|
|
|
.get_foreground=&lcd_get_foreground,
|
|
|
|
.set_background=&lcd_set_background,
|
|
|
|
.set_foreground=&lcd_set_foreground,
|
2007-09-27 15:42:55 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
.set_selector_start=&lcd_set_selector_start,
|
|
|
|
.set_selector_end=&lcd_set_selector_end,
|
|
|
|
.set_selector_text=&lcd_set_selector_text,
|
|
|
|
#endif
|
2007-03-26 07:52:13 +00:00
|
|
|
#endif /* LCD_DEPTH > 1 */
|
2007-09-18 19:05:35 +00:00
|
|
|
.update_rect=&lcd_update_rect,
|
2008-01-08 01:22:14 +00:00
|
|
|
.update_viewport_rect=&lcd_update_viewport_rect,
|
2007-09-18 19:05:35 +00:00
|
|
|
.fillrect=&lcd_fillrect,
|
|
|
|
.drawrect=&lcd_drawrect,
|
|
|
|
.drawpixel=&lcd_drawpixel,
|
|
|
|
.drawline=&lcd_drawline,
|
|
|
|
.vline=&lcd_vline,
|
|
|
|
.hline=&lcd_hline,
|
|
|
|
.scroll_step=&lcd_scroll_step,
|
|
|
|
.puts_style_offset=&lcd_puts_style_offset,
|
|
|
|
.puts_scroll_style=&lcd_puts_scroll_style,
|
|
|
|
.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
|
2007-09-18 19:05:35 +00:00
|
|
|
.double_height=&lcd_double_height,
|
|
|
|
.putc=&lcd_putc,
|
|
|
|
.get_locked_pattern=&lcd_get_locked_pattern,
|
|
|
|
.define_pattern=&lcd_define_pattern,
|
|
|
|
.unlock_pattern=&lcd_unlock_pattern,
|
|
|
|
.icon=&lcd_icon,
|
2005-10-28 00:17:15 +00:00
|
|
|
#endif /* HAVE_LCD_CHARCELLS */
|
2005-11-19 11:45:08 +00:00
|
|
|
|
2007-09-18 19:05:35 +00:00
|
|
|
.putsxy=&lcd_putsxy,
|
|
|
|
.puts=&lcd_puts,
|
|
|
|
.puts_offset=&lcd_puts_offset,
|
|
|
|
.puts_scroll=&lcd_puts_scroll,
|
|
|
|
.puts_scroll_offset=&lcd_puts_scroll_offset,
|
|
|
|
.scroll_speed=&lcd_scroll_speed,
|
|
|
|
.scroll_delay=&lcd_scroll_delay,
|
|
|
|
.stop_scroll=&lcd_stop_scroll,
|
|
|
|
.clear_display=&lcd_clear_display,
|
2008-01-08 01:22:14 +00:00
|
|
|
.clear_viewport=&lcd_clear_viewport,
|
|
|
|
.scroll_stop=&lcd_scroll_stop,
|
|
|
|
.scroll_stop_line=&lcd_scroll_stop_line,
|
2007-09-18 19:05:35 +00:00
|
|
|
.update=&lcd_update,
|
2008-01-08 01:22:14 +00:00
|
|
|
.update_viewport=&lcd_update_viewport,
|
2007-09-18 19:05:35 +00:00
|
|
|
.backlight_on=&backlight_on,
|
|
|
|
.backlight_off=&backlight_off,
|
|
|
|
.is_backlight_on=&is_backlight_on,
|
2007-10-21 11:02:51 +00:00
|
|
|
.backlight_set_timeout=&backlight_set_timeout,
|
2005-10-30 22:34:51 +00:00
|
|
|
#ifdef HAS_BUTTONBAR
|
2007-10-21 11:02:51 +00:00
|
|
|
.has_buttonbar=false
|
2005-10-30 22:34:51 +00:00
|
|
|
#endif
|
2007-10-21 11:02:51 +00:00
|
|
|
},
|
|
|
|
#if NB_SCREENS == 2
|
|
|
|
{
|
2007-09-18 19:05:35 +00:00
|
|
|
.screen_type=SCREEN_REMOTE,
|
|
|
|
.width=LCD_REMOTE_WIDTH,
|
|
|
|
.height=LCD_REMOTE_HEIGHT,
|
|
|
|
.depth=LCD_REMOTE_DEPTH,
|
|
|
|
.is_color=false,/* No color remotes yet */
|
|
|
|
.pixel_format=LCD_REMOTE_PIXELFORMAT,
|
|
|
|
.has_disk_led=false,
|
2008-01-08 01:22:14 +00:00
|
|
|
.set_viewport=&lcd_remote_set_viewport,
|
2007-09-18 19:05:35 +00:00
|
|
|
.setmargins=&lcd_remote_setmargins,
|
2008-01-08 01:22:14 +00:00
|
|
|
.getwidth=&lcd_remote_getwidth,
|
|
|
|
.getheight=&lcd_remote_getheight,
|
2007-09-18 19:05:35 +00:00
|
|
|
.getymargin=&lcd_remote_getymargin,
|
|
|
|
.getxmargin=&lcd_remote_getxmargin,
|
|
|
|
.getstringsize=&lcd_remote_getstringsize,
|
|
|
|
#if 1 /* all remote LCDs are bitmapped so far */
|
2008-01-08 11:41:05 +00:00
|
|
|
.setfont=&lcd_remote_setfont,
|
2008-01-08 01:22:14 +00:00
|
|
|
.getfont=&lcd_remote_getfont,
|
2007-09-18 19:05:35 +00:00
|
|
|
.mono_bitmap=&lcd_remote_mono_bitmap,
|
|
|
|
.mono_bitmap_part=&lcd_remote_mono_bitmap_part,
|
|
|
|
.bitmap=(screen_bitmap_func*)&lcd_remote_bitmap,
|
|
|
|
.bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part,
|
|
|
|
.set_drawmode=&lcd_remote_set_drawmode,
|
|
|
|
#if LCD_REMOTE_DEPTH <= 2
|
|
|
|
/* No transparency yet for grayscale and mono lcd */
|
|
|
|
.transparent_bitmap=(screen_bitmap_func*)&lcd_remote_bitmap,
|
|
|
|
.transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part,
|
|
|
|
/* No colour remotes yet */
|
|
|
|
#endif
|
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
.color_to_native=&lcd_remote_color_to_native,
|
|
|
|
#endif
|
|
|
|
.get_background=&lcd_remote_get_background,
|
|
|
|
.get_foreground=&lcd_remote_get_foreground,
|
|
|
|
.set_background=&lcd_remote_set_background,
|
|
|
|
.set_foreground=&lcd_remote_set_foreground,
|
|
|
|
#endif /* LCD_REMOTE_DEPTH > 1 */
|
|
|
|
.update_rect=&lcd_remote_update_rect,
|
2008-01-08 01:22:14 +00:00
|
|
|
.update_viewport_rect=&lcd_remote_update_viewport_rect,
|
2007-09-18 19:05:35 +00:00
|
|
|
.fillrect=&lcd_remote_fillrect,
|
|
|
|
.drawrect=&lcd_remote_drawrect,
|
|
|
|
.drawpixel=&lcd_remote_drawpixel,
|
|
|
|
.drawline=&lcd_remote_drawline,
|
|
|
|
.vline=&lcd_remote_vline,
|
|
|
|
.hline=&lcd_remote_hline,
|
|
|
|
.scroll_step=&lcd_remote_scroll_step,
|
|
|
|
.puts_style_offset=&lcd_remote_puts_style_offset,
|
|
|
|
.puts_scroll_style=&lcd_remote_puts_scroll_style,
|
|
|
|
.puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset,
|
|
|
|
#endif /* 1 */
|
|
|
|
|
|
|
|
#if 0 /* no charcell remote LCDs so far */
|
|
|
|
.double_height=&lcd_remote_double_height,
|
|
|
|
.putc=&lcd_remote_putc,
|
|
|
|
.get_locked_pattern=&lcd_remote_get_locked_pattern,
|
|
|
|
.define_pattern=&lcd_remote_define_pattern,
|
|
|
|
.icon=&lcd_remote_icon,
|
|
|
|
#endif /* 0 */
|
|
|
|
.putsxy=&lcd_remote_putsxy,
|
|
|
|
.puts=&lcd_remote_puts,
|
|
|
|
.puts_offset=&lcd_remote_puts_offset,
|
|
|
|
.puts_scroll=&lcd_remote_puts_scroll,
|
|
|
|
.puts_scroll_offset=&lcd_remote_puts_scroll_offset,
|
|
|
|
.scroll_speed=&lcd_remote_scroll_speed,
|
|
|
|
.scroll_delay=&lcd_remote_scroll_delay,
|
|
|
|
.stop_scroll=&lcd_remote_stop_scroll,
|
|
|
|
.clear_display=&lcd_remote_clear_display,
|
2008-01-08 01:22:14 +00:00
|
|
|
.clear_viewport=&lcd_remote_clear_viewport,
|
|
|
|
.scroll_stop=&lcd_remote_scroll_stop,
|
|
|
|
.scroll_stop_line=&lcd_remote_scroll_stop_line,
|
2007-09-18 19:05:35 +00:00
|
|
|
.update=&lcd_remote_update,
|
2008-01-08 01:22:14 +00:00
|
|
|
.update_viewport=&lcd_remote_update_viewport,
|
2007-09-18 19:05:35 +00:00
|
|
|
.backlight_on=&remote_backlight_on,
|
|
|
|
.backlight_off=&remote_backlight_off,
|
|
|
|
.is_backlight_on=&is_remote_backlight_on,
|
|
|
|
.backlight_set_timeout=&remote_backlight_set_timeout
|
|
|
|
}
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
};
|
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;
|
2008-05-29 11:13:46 +00:00
|
|
|
struct screen *display;
|
2005-11-16 02:12:25 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2007-09-18 19:05:35 +00:00
|
|
|
{
|
2008-05-29 11:13:46 +00:00
|
|
|
display = &screens[i];
|
2007-09-18 19:05:35 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
((struct screen*)&screens[i])->setfont(FONT_UI);
|
|
|
|
#endif
|
2008-05-29 11:13:46 +00:00
|
|
|
|
|
|
|
int height=display->height;
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
if(global_settings.statusbar)
|
|
|
|
height -= STATUSBAR_HEIGHT;
|
|
|
|
#ifdef HAS_BUTTONBAR
|
|
|
|
if(global_settings.buttonbar && display->has_buttonbar)
|
|
|
|
height -= BUTTONBAR_HEIGHT;
|
|
|
|
#endif
|
|
|
|
display->getstringsize((unsigned char *)"A", &display->char_width,
|
|
|
|
&display->char_height);
|
|
|
|
#else
|
|
|
|
display->char_width = 1;
|
|
|
|
display->char_height = 1;
|
|
|
|
#endif
|
|
|
|
display->nb_lines = height / display->char_height;
|
2007-09-18 19:05:35 +00:00
|
|
|
}
|
2005-11-16 02:12:25 +00:00
|
|
|
}
|