Fix a typo.
[maemo-rb.git] / firmware / export / scroll_engine.h
blob55f41208934d52f82db1cd85245bf8bb88af14c0
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 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
24 ****************************************************************************/
25 #ifndef __SCROLL_ENGINE_H__
26 #define __SCROLL_ENGINE_H__
28 #include "config.h"
29 #include <lcd.h>
30 #include "file.h"
32 void scroll_init(void) INIT_ATTR;
33 void lcd_scroll_stop(const struct viewport* vp);
34 void lcd_scroll_stop_line(const struct viewport* vp, int y);
35 void lcd_scroll_fn(void);
36 #ifdef HAVE_REMOTE_LCD
37 void lcd_remote_scroll_fn(void);
38 void lcd_remote_scroll_stop(const struct viewport* vp);
39 void lcd_remote_scroll_stop_line(const struct viewport* vp, int y);
40 #endif
42 /* internal usage, but in multiple drivers */
43 #define SCROLL_SPACING 3
44 #ifdef HAVE_LCD_BITMAP
45 #define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
46 #else
47 #define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
48 #endif
50 struct scrollinfo
52 struct viewport* vp;
53 char line[SCROLL_LINE_SIZE];
54 #ifdef HAVE_LCD_CHARCELLS
55 int len; /* length of line in chars */
56 #endif
57 int y; /* Position of the line on the screen (char co-ordinates) */
58 int offset;
59 int startx;
60 int y_offset; /* y offset of the line, used for pixel-accurate list scrolling */
61 #ifdef HAVE_LCD_BITMAP
62 int width; /* length of line in pixels */
63 int style; /* line style */
64 #endif/* HAVE_LCD_BITMAP */
65 bool backward; /* scroll presently forward or backward? */
66 bool bidir;
67 long start_tick;
70 struct scroll_screen_info
72 struct scrollinfo * const scroll;
73 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
74 int lines; /* Number of currently scrolling lines */
75 long ticks; /* # of ticks between updates*/
76 long delay; /* ticks delay before start */
77 int bidir_limit; /* percent */
78 #ifdef HAVE_LCD_CHARCELLS
79 long jump_scroll_delay; /* delay between jump scroll jumps */
80 int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
81 #endif
82 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
83 int step; /* pixels per scroll step */
84 #endif
85 #if defined(HAVE_REMOTE_LCD)
86 long last_scroll;
87 #endif
90 /** main lcd **/
91 #ifdef HAVE_LCD_BITMAP
92 #define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
93 #else
94 #define LCD_SCROLLABLE_LINES LCD_HEIGHT * 2
95 #endif
97 extern struct scroll_screen_info lcd_scroll_info;
99 /** remote lcd **/
100 #ifdef HAVE_REMOTE_LCD
101 #define LCD_REMOTE_SCROLLABLE_LINES \
102 (((LCD_REMOTE_HEIGHT+4)/5 < 32) ? (LCD_REMOTE_HEIGHT+4)/5 : 32)
103 extern struct scroll_screen_info lcd_remote_scroll_info;
104 #endif
106 #endif /* __SCROLL_ENGINE_H__ */