2007-07-28 08:12:05 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Michael Sevakis
|
|
|
|
*
|
|
|
|
* LCD scrolling driver and scheduler
|
|
|
|
*
|
|
|
|
* Much collected and combined from the various Rockbox LCD drivers.
|
|
|
|
*
|
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.
|
2007-07-28 08:12:05 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __SCROLL_ENGINE_H__
|
|
|
|
#define __SCROLL_ENGINE_H__
|
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
#include <lcd.h>
|
2009-08-19 21:48:17 +00:00
|
|
|
#include "file.h"
|
2008-01-07 20:34:11 +00:00
|
|
|
|
2010-03-03 23:20:32 +00:00
|
|
|
void scroll_init(void) INIT_ATTR;
|
2009-09-04 16:04:02 +00:00
|
|
|
void lcd_scroll_stop(const struct viewport* vp);
|
|
|
|
void lcd_scroll_stop_line(const struct viewport* vp, int y);
|
2007-07-28 08:12:05 +00:00
|
|
|
void lcd_scroll_fn(void);
|
2008-01-07 20:34:11 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-07-28 08:12:05 +00:00
|
|
|
void lcd_remote_scroll_fn(void);
|
2009-09-04 16:04:02 +00:00
|
|
|
void lcd_remote_scroll_stop(const struct viewport* vp);
|
|
|
|
void lcd_remote_scroll_stop_line(const struct viewport* vp, int y);
|
2008-01-07 20:34:11 +00:00
|
|
|
#endif
|
2007-07-28 08:12:05 +00:00
|
|
|
|
|
|
|
/* internal usage, but in multiple drivers */
|
|
|
|
#define SCROLL_SPACING 3
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
|
|
|
|
#else
|
|
|
|
#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct scrollinfo
|
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
struct viewport* vp;
|
2007-07-28 08:12:05 +00:00
|
|
|
char line[SCROLL_LINE_SIZE];
|
2010-02-16 11:59:37 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
2007-07-28 08:12:05 +00:00
|
|
|
int len; /* length of line in chars */
|
2010-02-16 11:59:37 +00:00
|
|
|
#endif
|
2008-01-07 20:34:11 +00:00
|
|
|
int y; /* Position of the line on the screen (char co-ordinates) */
|
2007-07-28 08:12:05 +00:00
|
|
|
int offset;
|
|
|
|
int startx;
|
2010-10-06 12:46:42 +00:00
|
|
|
int y_offset; /* y offset of the line, used for pixel-accurate list scrolling */
|
2007-07-28 08:12:05 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
int width; /* length of line in pixels */
|
2007-09-30 21:12:33 +00:00
|
|
|
int style; /* line style */
|
2007-09-27 15:42:55 +00:00
|
|
|
#endif/* HAVE_LCD_BITMAP */
|
2007-07-28 08:12:05 +00:00
|
|
|
bool backward; /* scroll presently forward or backward? */
|
|
|
|
bool bidir;
|
|
|
|
long start_tick;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct scroll_screen_info
|
|
|
|
{
|
|
|
|
struct scrollinfo * const scroll;
|
|
|
|
const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
|
2008-01-07 20:34:11 +00:00
|
|
|
int lines; /* Number of currently scrolling lines */
|
2007-07-28 08:12:05 +00:00
|
|
|
long ticks; /* # of ticks between updates*/
|
|
|
|
long delay; /* ticks delay before start */
|
|
|
|
int bidir_limit; /* percent */
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
long jump_scroll_delay; /* delay between jump scroll jumps */
|
|
|
|
int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
|
|
|
|
int step; /* pixels per scroll step */
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_REMOTE_LCD)
|
|
|
|
long last_scroll;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/** main lcd **/
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
|
|
|
|
#else
|
2008-01-07 20:34:11 +00:00
|
|
|
#define LCD_SCROLLABLE_LINES LCD_HEIGHT * 2
|
2007-07-28 08:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
extern struct scroll_screen_info lcd_scroll_info;
|
|
|
|
|
|
|
|
/** remote lcd **/
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#define LCD_REMOTE_SCROLLABLE_LINES \
|
|
|
|
(((LCD_REMOTE_HEIGHT+4)/5 < 32) ? (LCD_REMOTE_HEIGHT+4)/5 : 32)
|
|
|
|
extern struct scroll_screen_info lcd_remote_scroll_info;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __SCROLL_ENGINE_H__ */
|