Update several codec Makefiles so that the codec libs build again on Coldfire targets...
[Rockbox.git] / apps / screen_access.c
blobb784637308609434e02976c6349a6a8bbf8218c6
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];
35 void screen_init(struct screen * screen, enum screen_type screen_type)
37 switch(screen_type)
39 #ifdef HAVE_REMOTE_LCD
40 case SCREEN_REMOTE:
41 screen->depth=LCD_REMOTE_DEPTH;
42 screen->has_disk_led=false;
44 #if 1 /* all remote LCDs are bitmapped so far */
45 screen->width=LCD_REMOTE_WIDTH;
46 screen->height=LCD_REMOTE_HEIGHT;
47 screen->setmargins=&lcd_remote_setmargins;
48 screen->getymargin=&lcd_remote_getymargin;
49 screen->getxmargin=&lcd_remote_getxmargin;
50 screen->setfont=&lcd_remote_setfont;
51 screen->setfont(FONT_UI);
52 screen->getstringsize=&lcd_remote_getstringsize;
53 screen->putsxy=&lcd_remote_putsxy;
54 screen->mono_bitmap=&lcd_remote_mono_bitmap;
55 screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part;
56 screen->set_drawmode=&lcd_remote_set_drawmode;
57 #if LCD_REMOTE_DEPTH > 1
58 #if defined(HAVE_LCD_COLOR)
59 screen->color_to_native=&lcd_remote_color_to_native;
60 #endif
61 screen->get_background=&lcd_remote_get_background;
62 screen->get_foreground=&lcd_remote_get_foreground;
63 screen->set_background=&lcd_remote_set_background;
64 screen->set_foreground=&lcd_remote_set_foreground;
65 #endif /* LCD_REMOTE_DEPTH > 1 */
66 screen->update_rect=&lcd_remote_update_rect;
67 screen->fillrect=&lcd_remote_fillrect;
68 screen->drawrect=&lcd_remote_drawrect;
69 screen->drawpixel=&lcd_remote_drawpixel;
70 screen->drawline=&lcd_remote_drawline;
71 screen->vline=&lcd_remote_vline;
72 screen->hline=&lcd_remote_hline;
73 screen->scroll_speed=&lcd_remote_scroll_speed;
74 screen->scroll_delay=&lcd_remote_scroll_delay;
75 screen->scroll_step=&lcd_remote_scroll_step;
76 screen->invertscroll=&lcd_remote_invertscroll;
77 #endif /* LCD_REMOTE_DEPTH > 1 */
78 screen->puts_offset=&lcd_remote_puts_offset;
79 screen->puts_style_offset=&lcd_remote_puts_style_offset;
80 screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
81 screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
82 screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
84 #if 0 /* no charcell remote LCDs so far */
85 screen->width=11;
86 screen->height=2;
87 screen->double_height=&lcd_remote_double_height;
88 screen->putc=&lcd_remote_putc;
89 screen->get_locked_pattern=&lcd_remote_get_locked_pattern;
90 screen->define_pattern=&lcd_remote_define_pattern;
91 #ifdef SIMULATOR
92 screen->icon=&sim_lcd_remote_icon;
93 #else
94 screen->icon=&lcd_remote_icon;
95 #endif
96 #endif /* 0 */
98 screen->init=&lcd_remote_init;
99 screen->puts_scroll=&lcd_remote_puts_scroll;
100 screen->stop_scroll=&lcd_remote_stop_scroll;
101 screen->clear_display=&lcd_remote_clear_display;
102 screen->update=&lcd_remote_update;
103 screen->puts=&lcd_remote_puts;
104 screen->backlight_on=&remote_backlight_on;
105 screen->backlight_off=&remote_backlight_off;
106 screen->is_backlight_on=&is_remote_backlight_on;
107 screen->backlight_set_timeout=&remote_backlight_set_timeout;
108 break;
109 #endif /* HAVE_REMOTE_LCD */
111 case SCREEN_MAIN:
112 default:
113 screen->depth=LCD_DEPTH;
114 #if CONFIG_LED == LED_VIRTUAL
115 screen->has_disk_led=false;
116 #elif defined(HAVE_REMOTE_LCD)
117 screen->has_disk_led=true;
118 #endif
119 #ifdef HAVE_LCD_BITMAP
120 screen->width=LCD_WIDTH;
121 screen->height=LCD_HEIGHT;
122 screen->setmargins=&lcd_setmargins;
123 screen->getymargin=&lcd_getymargin;
124 screen->getxmargin=&lcd_getxmargin;
125 screen->setfont=&lcd_setfont;
126 screen->setfont(FONT_UI);
127 screen->getstringsize=&lcd_getstringsize;
128 screen->putsxy=&lcd_putsxy;
129 screen->mono_bitmap=&lcd_mono_bitmap;
130 screen->mono_bitmap_part=&lcd_mono_bitmap_part;
131 screen->set_drawmode=&lcd_set_drawmode;
132 #if LCD_DEPTH > 1
133 screen->bitmap=&lcd_bitmap;
134 screen->bitmap_part=&lcd_bitmap_part;
135 #if LCD_DEPTH == 2
136 /* No transparency yet for grayscale lcd */
137 screen->transparent_bitmap=&lcd_bitmap;
138 screen->transparent_bitmap_part=&lcd_bitmap_part;
139 #else
140 screen->transparent_bitmap=&lcd_bitmap_transparent;
141 screen->transparent_bitmap_part=&lcd_bitmap_transparent_part;
142 #endif
143 #if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1
144 screen->color_to_native=&lcd_color_to_native;
145 #endif
146 screen->get_background=&lcd_get_background;
147 screen->get_foreground=&lcd_get_foreground;
148 screen->set_background=&lcd_set_background;
149 screen->set_foreground=&lcd_set_foreground;
150 #endif
151 screen->update_rect=&lcd_update_rect;
152 screen->fillrect=&lcd_fillrect;
153 screen->drawrect=&lcd_drawrect;
154 screen->drawpixel=&lcd_drawpixel;
155 screen->drawline=&lcd_drawline;
156 screen->vline=&lcd_vline;
157 screen->hline=&lcd_hline;
158 screen->scroll_speed=&lcd_scroll_speed;
159 screen->scroll_delay=&lcd_scroll_delay;
160 screen->scroll_step=&lcd_scroll_step;
161 screen->invertscroll=&lcd_invertscroll;
162 screen->puts_offset=&lcd_puts_offset;
163 screen->puts_style_offset=&lcd_puts_style_offset;
164 screen->puts_scroll_style=&lcd_puts_scroll_style;
165 screen->puts_scroll_offset=&lcd_puts_scroll_offset;
166 screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
167 #endif /* HAVE_LCD_BITMAP */
169 #ifdef HAVE_LCD_CHARCELLS
170 screen->width=11; /* width in characters instead of pixels */
171 screen->height=2;
172 screen->double_height=&lcd_double_height;
173 screen->putc=&lcd_putc;
174 screen->get_locked_pattern=&lcd_get_locked_pattern;
175 screen->define_pattern=&lcd_define_pattern;
176 #ifdef SIMULATOR
177 screen->icon=&sim_lcd_icon;
178 #else
179 screen->icon=&lcd_icon;
180 #endif
181 #endif /* HAVE_LCD_CHARCELLS */
183 screen->init=&lcd_init;
184 screen->puts_scroll=&lcd_puts_scroll;
185 screen->stop_scroll=&lcd_stop_scroll;
186 screen->clear_display=&lcd_clear_display;
187 #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
188 screen->update=&lcd_update;
189 #endif
190 screen->puts=&lcd_puts;
191 screen->backlight_on=&backlight_on;
192 screen->backlight_off=&backlight_off;
193 screen->is_backlight_on=&is_backlight_on;
194 screen->backlight_set_timeout=&backlight_set_timeout;
195 break;
197 screen->screen_type=screen_type;
198 #ifdef HAS_BUTTONBAR
199 screen->has_buttonbar=false;
200 #endif
201 gui_textarea_update_nblines(screen);
204 #ifdef HAVE_LCD_BITMAP
205 void screen_clear_area(struct screen * display, int xstart, int ystart,
206 int width, int height)
208 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
209 display->fillrect(xstart, ystart, width, height);
210 display->set_drawmode(DRMODE_SOLID);
212 #endif
214 void screen_access_init(void)
216 int i;
217 FOR_NB_SCREENS(i)
218 screen_init(&screens[i], i);