Introduce Rockbox Utility to the manual as automated installation option. Only rather...
[Rockbox.git] / apps / screen_access.c
blob251bd7e848bc8fa4f541b0cb94170a0078592f9d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <lcd.h>
21 #include <lcd-remote.h>
22 #include "backlight.h"
23 #include <font.h>
24 #include <button.h>
25 #include <sprintf.h>
26 #include <settings.h>
27 #include <kernel.h>
28 #include <icons.h>
30 #include "screen_access.h"
31 #include "textarea.h"
33 struct screen screens[NB_SCREENS] =
36 .screen_type=SCREEN_MAIN,
37 .width=LCD_WIDTH,
38 .height=LCD_HEIGHT,
39 .depth=LCD_DEPTH,
40 #if defined(HAVE_LCD_COLOR)
41 .is_color=true,
42 #else
43 .is_color=false,
44 #endif
45 #ifdef HAVE_LCD_BITMAP
46 .pixel_format=LCD_PIXELFORMAT,
47 #endif
48 #if (CONFIG_LED == LED_VIRTUAL)
49 .has_disk_led=false,
50 #elif defined(HAVE_REMOTE_LCD)
51 .has_disk_led=true,
52 #endif
53 .setmargins=&lcd_setmargins,
54 .getymargin=&lcd_getymargin,
55 .getxmargin=&lcd_getxmargin,
56 .getstringsize=&lcd_getstringsize,
57 #ifdef HAVE_LCD_BITMAP
58 .setfont=&lcd_setfont,
59 .mono_bitmap=&lcd_mono_bitmap,
60 .mono_bitmap_part=&lcd_mono_bitmap_part,
61 .set_drawmode=&lcd_set_drawmode,
62 .bitmap=(screen_bitmap_func*)&lcd_bitmap,
63 .bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part,
64 #if LCD_DEPTH <= 2
65 /* No transparency yet for grayscale and mono lcd */
66 .transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap,
67 .transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part,
68 #else
69 .transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap_transparent,
70 .transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_transparent_part,
71 #endif
72 #if LCD_DEPTH > 1
73 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
74 .color_to_native=&lcd_color_to_native,
75 #endif
76 .get_background=&lcd_get_background,
77 .get_foreground=&lcd_get_foreground,
78 .set_background=&lcd_set_background,
79 .set_foreground=&lcd_set_foreground,
80 #endif /* LCD_DEPTH > 1 */
81 .update_rect=&lcd_update_rect,
82 .fillrect=&lcd_fillrect,
83 .drawrect=&lcd_drawrect,
84 .drawpixel=&lcd_drawpixel,
85 .drawline=&lcd_drawline,
86 .vline=&lcd_vline,
87 .hline=&lcd_hline,
88 .scroll_step=&lcd_scroll_step,
89 .invertscroll=&lcd_invertscroll,
90 .puts_style_offset=&lcd_puts_style_offset,
91 .puts_scroll_style=&lcd_puts_scroll_style,
92 .puts_scroll_style_offset=&lcd_puts_scroll_style_offset,
93 #endif /* HAVE_LCD_BITMAP */
95 #ifdef HAVE_LCD_CHARCELLS
96 .double_height=&lcd_double_height,
97 .putc=&lcd_putc,
98 .get_locked_pattern=&lcd_get_locked_pattern,
99 .define_pattern=&lcd_define_pattern,
100 .unlock_pattern=&lcd_unlock_pattern,
101 .icon=&lcd_icon,
102 #endif /* HAVE_LCD_CHARCELLS */
104 .putsxy=&lcd_putsxy,
105 .puts=&lcd_puts,
106 .puts_offset=&lcd_puts_offset,
107 .puts_scroll=&lcd_puts_scroll,
108 .puts_scroll_offset=&lcd_puts_scroll_offset,
109 .scroll_speed=&lcd_scroll_speed,
110 .scroll_delay=&lcd_scroll_delay,
111 .stop_scroll=&lcd_stop_scroll,
112 .clear_display=&lcd_clear_display,
113 .update=&lcd_update,
114 .backlight_on=&backlight_on,
115 .backlight_off=&backlight_off,
116 .is_backlight_on=&is_backlight_on,
117 .backlight_set_timeout=&backlight_set_timeout
118 #ifdef HAS_BUTTONBAR
119 ,.has_buttonbar=false
120 #endif
122 #ifdef HAVE_REMOTE_LCD
124 .screen_type=SCREEN_REMOTE,
125 .width=LCD_REMOTE_WIDTH,
126 .height=LCD_REMOTE_HEIGHT,
127 .depth=LCD_REMOTE_DEPTH,
128 .is_color=false,/* No color remotes yet */
129 .pixel_format=LCD_REMOTE_PIXELFORMAT,
130 .has_disk_led=false,
131 .setmargins=&lcd_remote_setmargins,
132 .getymargin=&lcd_remote_getymargin,
133 .getxmargin=&lcd_remote_getxmargin,
134 .getstringsize=&lcd_remote_getstringsize,
135 #if 1 /* all remote LCDs are bitmapped so far */
136 .setfont=&lcd_remote_setfont,
137 .mono_bitmap=&lcd_remote_mono_bitmap,
138 .mono_bitmap_part=&lcd_remote_mono_bitmap_part,
139 .bitmap=(screen_bitmap_func*)&lcd_remote_bitmap,
140 .bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part,
141 .set_drawmode=&lcd_remote_set_drawmode,
142 #if LCD_REMOTE_DEPTH <= 2
143 /* No transparency yet for grayscale and mono lcd */
144 .transparent_bitmap=(screen_bitmap_func*)&lcd_remote_bitmap,
145 .transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part,
146 /* No colour remotes yet */
147 #endif
148 #if LCD_REMOTE_DEPTH > 1
149 #if defined(HAVE_LCD_COLOR)
150 .color_to_native=&lcd_remote_color_to_native,
151 #endif
152 .get_background=&lcd_remote_get_background,
153 .get_foreground=&lcd_remote_get_foreground,
154 .set_background=&lcd_remote_set_background,
155 .set_foreground=&lcd_remote_set_foreground,
156 #endif /* LCD_REMOTE_DEPTH > 1 */
157 .update_rect=&lcd_remote_update_rect,
158 .fillrect=&lcd_remote_fillrect,
159 .drawrect=&lcd_remote_drawrect,
160 .drawpixel=&lcd_remote_drawpixel,
161 .drawline=&lcd_remote_drawline,
162 .vline=&lcd_remote_vline,
163 .hline=&lcd_remote_hline,
164 .scroll_step=&lcd_remote_scroll_step,
165 .invertscroll=&lcd_remote_invertscroll,
166 .puts_style_offset=&lcd_remote_puts_style_offset,
167 .puts_scroll_style=&lcd_remote_puts_scroll_style,
168 .puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset,
169 #endif /* 1 */
171 #if 0 /* no charcell remote LCDs so far */
172 .double_height=&lcd_remote_double_height,
173 .putc=&lcd_remote_putc,
174 .get_locked_pattern=&lcd_remote_get_locked_pattern,
175 .define_pattern=&lcd_remote_define_pattern,
176 .icon=&lcd_remote_icon,
177 #endif /* 0 */
178 .putsxy=&lcd_remote_putsxy,
179 .puts=&lcd_remote_puts,
180 .puts_offset=&lcd_remote_puts_offset,
181 .puts_scroll=&lcd_remote_puts_scroll,
182 .puts_scroll_offset=&lcd_remote_puts_scroll_offset,
183 .scroll_speed=&lcd_remote_scroll_speed,
184 .scroll_delay=&lcd_remote_scroll_delay,
185 .stop_scroll=&lcd_remote_stop_scroll,
186 .clear_display=&lcd_remote_clear_display,
187 .update=&lcd_remote_update,
188 .backlight_on=&remote_backlight_on,
189 .backlight_off=&remote_backlight_off,
190 .is_backlight_on=&is_remote_backlight_on,
191 .backlight_set_timeout=&remote_backlight_set_timeout
193 #endif /* HAVE_REMOTE_LCD */
196 #ifdef HAVE_LCD_BITMAP
197 void screen_clear_area(struct screen * display, int xstart, int ystart,
198 int width, int height)
200 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
201 display->fillrect(xstart, ystart, width, height);
202 display->set_drawmode(DRMODE_SOLID);
204 #endif
206 void screen_access_init(void)
208 int i;
209 FOR_NB_SCREENS(i)
211 #ifdef HAVE_LCD_BITMAP
212 ((struct screen*)&screens[i])->setfont(FONT_UI);
213 #endif
214 gui_textarea_update_nblines(&screens[i]);