Add the viewport functions to the screens API, including a new getfont() function...
[Rockbox.git] / firmware / export / scroll_engine.h
blob48d5c5cb8cc975fc7e40bf0fd59b35ae9a1c95a3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Michael Sevakis
12 * LCD scrolling driver and scheduler
14 * Much collected and combined from the various Rockbox LCD drivers.
16 * All files in this archive are subject to the GNU General Public License.
17 * See the file COPYING in the source tree root for full license agreement.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
23 #ifndef __SCROLL_ENGINE_H__
24 #define __SCROLL_ENGINE_H__
26 #include <lcd.h>
28 void scroll_init(void);
29 void lcd_scroll_stop(struct viewport* vp);
30 void lcd_scroll_stop_line(struct viewport* vp, int y);
31 void lcd_scroll_fn(void);
32 #ifdef HAVE_REMOTE_LCD
33 void lcd_remote_scroll_fn(void);
34 void lcd_remote_scroll_stop(struct viewport* vp);
35 void lcd_remote_scroll_stop_line(struct viewport* vp, int y);
36 #endif
38 /* internal usage, but in multiple drivers */
39 #define SCROLL_SPACING 3
40 #ifdef HAVE_LCD_BITMAP
41 #define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
42 #else
43 #define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
44 #endif
46 struct scrollinfo
48 struct viewport* vp;
49 char line[SCROLL_LINE_SIZE];
50 int len; /* length of line in chars */
51 int y; /* Position of the line on the screen (char co-ordinates) */
52 int offset;
53 int startx;
54 #ifdef HAVE_LCD_BITMAP
55 int width; /* length of line in pixels */
56 int style; /* line style */
57 #endif/* HAVE_LCD_BITMAP */
58 bool backward; /* scroll presently forward or backward? */
59 bool bidir;
60 long start_tick;
63 struct scroll_screen_info
65 struct scrollinfo * const scroll;
66 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
67 int lines; /* Number of currently scrolling lines */
68 long ticks; /* # of ticks between updates*/
69 long delay; /* ticks delay before start */
70 int bidir_limit; /* percent */
71 #ifdef HAVE_LCD_CHARCELLS
72 long jump_scroll_delay; /* delay between jump scroll jumps */
73 int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
74 #endif
75 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
76 int step; /* pixels per scroll step */
77 #endif
78 #if defined(HAVE_REMOTE_LCD)
79 long last_scroll;
80 #endif
83 /** main lcd **/
84 #ifdef HAVE_LCD_BITMAP
85 #define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
86 #else
87 #define LCD_SCROLLABLE_LINES LCD_HEIGHT * 2
88 #endif
90 extern struct scroll_screen_info lcd_scroll_info;
92 /** remote lcd **/
93 #ifdef HAVE_REMOTE_LCD
94 #define LCD_REMOTE_SCROLLABLE_LINES \
95 (((LCD_REMOTE_HEIGHT+4)/5 < 32) ? (LCD_REMOTE_HEIGHT+4)/5 : 32)
96 extern struct scroll_screen_info lcd_remote_scroll_info;
97 #endif
99 #endif /* __SCROLL_ENGINE_H__ */