1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
21 #include <lcd-remote.h>
22 #include "backlight.h"
30 #include "screen_access.h"
33 struct screen screens
[NB_SCREENS
];
35 void screen_init(struct screen
* screen
, enum screen_type screen_type
)
39 #ifdef HAVE_REMOTE_LCD
41 screen
->is_color
=false;/* No color remotes yet */
42 screen
->pixel_format
=LCD_REMOTE_PIXELFORMAT
;
43 screen
->depth
=LCD_REMOTE_DEPTH
;
44 screen
->has_disk_led
=false;
46 screen
->width
=LCD_REMOTE_WIDTH
;
47 screen
->height
=LCD_REMOTE_HEIGHT
;
48 screen
->setmargins
=&lcd_remote_setmargins
;
49 screen
->getymargin
=&lcd_remote_getymargin
;
50 screen
->getxmargin
=&lcd_remote_getxmargin
;
51 screen
->getstringsize
=&lcd_remote_getstringsize
;
52 #if 1 /* all remote LCDs are bitmapped so far */
53 screen
->setfont
=&lcd_remote_setfont
;
54 screen
->setfont(FONT_UI
);
55 screen
->mono_bitmap
=&lcd_remote_mono_bitmap
;
56 screen
->mono_bitmap_part
=&lcd_remote_mono_bitmap_part
;
57 screen
->bitmap
=(screen_bitmap_func
*)&lcd_remote_bitmap
;
58 screen
->bitmap_part
=(screen_bitmap_part_func
*)&lcd_remote_bitmap_part
;
59 screen
->set_drawmode
=&lcd_remote_set_drawmode
;
60 #if LCD_REMOTE_DEPTH <= 2
61 /* No transparency yet for grayscale and mono lcd */
62 screen
->transparent_bitmap
=(screen_bitmap_func
*)&lcd_remote_bitmap
;
63 screen
->transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_remote_bitmap_part
;
64 /* No colour remotes yet */
66 #if LCD_REMOTE_DEPTH > 1
67 #if defined(HAVE_LCD_COLOR)
68 screen
->color_to_native
=&lcd_remote_color_to_native
;
70 screen
->get_background
=&lcd_remote_get_background
;
71 screen
->get_foreground
=&lcd_remote_get_foreground
;
72 screen
->set_background
=&lcd_remote_set_background
;
73 screen
->set_foreground
=&lcd_remote_set_foreground
;
74 #endif /* LCD_REMOTE_DEPTH > 1 */
75 screen
->update_rect
=&lcd_remote_update_rect
;
76 screen
->fillrect
=&lcd_remote_fillrect
;
77 screen
->drawrect
=&lcd_remote_drawrect
;
78 screen
->drawpixel
=&lcd_remote_drawpixel
;
79 screen
->drawline
=&lcd_remote_drawline
;
80 screen
->vline
=&lcd_remote_vline
;
81 screen
->hline
=&lcd_remote_hline
;
82 screen
->scroll_step
=&lcd_remote_scroll_step
;
83 screen
->invertscroll
=&lcd_remote_invertscroll
;
84 screen
->puts_style_offset
=&lcd_remote_puts_style_offset
;
85 screen
->puts_scroll_style
=&lcd_remote_puts_scroll_style
;
86 screen
->puts_scroll_style_offset
=&lcd_remote_puts_scroll_style_offset
;
89 #if 0 /* no charcell remote LCDs so far */
90 screen
->double_height
=&lcd_remote_double_height
;
91 screen
->putc
=&lcd_remote_putc
;
92 screen
->get_locked_pattern
=&lcd_remote_get_locked_pattern
;
93 screen
->define_pattern
=&lcd_remote_define_pattern
;
94 screen
->icon
=&lcd_remote_icon
;
97 screen
->init
=&lcd_remote_init
;
98 screen
->putsxy
=&lcd_remote_putsxy
;
99 screen
->puts
=&lcd_remote_puts
;
100 screen
->puts_offset
=&lcd_remote_puts_offset
;
101 screen
->puts_scroll
=&lcd_remote_puts_scroll
;
102 screen
->puts_scroll_offset
=&lcd_remote_puts_scroll_offset
;
103 screen
->scroll_speed
=&lcd_remote_scroll_speed
;
104 screen
->scroll_delay
=&lcd_remote_scroll_delay
;
105 screen
->stop_scroll
=&lcd_remote_stop_scroll
;
106 screen
->clear_display
=&lcd_remote_clear_display
;
107 screen
->update
=&lcd_remote_update
;
108 screen
->backlight_on
=&remote_backlight_on
;
109 screen
->backlight_off
=&remote_backlight_off
;
110 screen
->is_backlight_on
=&is_remote_backlight_on
;
111 screen
->backlight_set_timeout
=&remote_backlight_set_timeout
;
113 #endif /* HAVE_REMOTE_LCD */
117 #if defined(HAVE_LCD_COLOR)
118 screen
->is_color
=true;
120 screen
->is_color
=false;
122 #ifdef HAVE_LCD_BITMAP
123 screen
->pixel_format
=LCD_PIXELFORMAT
;
125 screen
->depth
=LCD_DEPTH
;
126 #if (CONFIG_LED == LED_VIRTUAL)
127 screen
->has_disk_led
=false;
128 #elif defined(HAVE_REMOTE_LCD)
129 screen
->has_disk_led
=true;
131 screen
->width
=LCD_WIDTH
;
132 screen
->height
=LCD_HEIGHT
;
133 screen
->setmargins
=&lcd_setmargins
;
134 screen
->getymargin
=&lcd_getymargin
;
135 screen
->getxmargin
=&lcd_getxmargin
;
136 screen
->getstringsize
=&lcd_getstringsize
;
137 #ifdef HAVE_LCD_BITMAP
138 screen
->setfont
=&lcd_setfont
;
139 screen
->setfont(FONT_UI
);
140 screen
->mono_bitmap
=&lcd_mono_bitmap
;
141 screen
->mono_bitmap_part
=&lcd_mono_bitmap_part
;
142 screen
->set_drawmode
=&lcd_set_drawmode
;
143 screen
->bitmap
=(screen_bitmap_func
*)&lcd_bitmap
;
144 screen
->bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_part
;
146 /* No transparency yet for grayscale and mono lcd */
147 screen
->transparent_bitmap
=(screen_bitmap_func
*)&lcd_bitmap
;
148 screen
->transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_part
;
150 screen
->transparent_bitmap
=(screen_bitmap_func
*)&lcd_bitmap_transparent
;
151 screen
->transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_transparent_part
;
154 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
155 screen
->color_to_native
=&lcd_color_to_native
;
157 screen
->get_background
=&lcd_get_background
;
158 screen
->get_foreground
=&lcd_get_foreground
;
159 screen
->set_background
=&lcd_set_background
;
160 screen
->set_foreground
=&lcd_set_foreground
;
161 #endif /* LCD_DEPTH > 1 */
162 screen
->update_rect
=&lcd_update_rect
;
163 screen
->fillrect
=&lcd_fillrect
;
164 screen
->drawrect
=&lcd_drawrect
;
165 screen
->drawpixel
=&lcd_drawpixel
;
166 screen
->drawline
=&lcd_drawline
;
167 screen
->vline
=&lcd_vline
;
168 screen
->hline
=&lcd_hline
;
169 screen
->scroll_step
=&lcd_scroll_step
;
170 screen
->invertscroll
=&lcd_invertscroll
;
171 screen
->puts_style_offset
=&lcd_puts_style_offset
;
172 screen
->puts_scroll_style
=&lcd_puts_scroll_style
;
173 screen
->puts_scroll_style_offset
=&lcd_puts_scroll_style_offset
;
174 #endif /* HAVE_LCD_BITMAP */
176 #ifdef HAVE_LCD_CHARCELLS
177 screen
->double_height
=&lcd_double_height
;
178 screen
->putc
=&lcd_putc
;
179 screen
->get_locked_pattern
=&lcd_get_locked_pattern
;
180 screen
->define_pattern
=&lcd_define_pattern
;
181 screen
->unlock_pattern
=&lcd_unlock_pattern
;
182 screen
->icon
=&lcd_icon
;
183 #endif /* HAVE_LCD_CHARCELLS */
185 screen
->init
=&lcd_init
;
186 screen
->putsxy
=&lcd_putsxy
;
187 screen
->puts
=&lcd_puts
;
188 screen
->puts_offset
=&lcd_puts_offset
;
189 screen
->puts_scroll
=&lcd_puts_scroll
;
190 screen
->puts_scroll_offset
=&lcd_puts_scroll_offset
;
191 screen
->scroll_speed
=&lcd_scroll_speed
;
192 screen
->scroll_delay
=&lcd_scroll_delay
;
193 screen
->stop_scroll
=&lcd_stop_scroll
;
194 screen
->clear_display
=&lcd_clear_display
;
195 screen
->update
=&lcd_update
;
196 screen
->backlight_on
=&backlight_on
;
197 screen
->backlight_off
=&backlight_off
;
198 screen
->is_backlight_on
=&is_backlight_on
;
199 screen
->backlight_set_timeout
=&backlight_set_timeout
;
202 screen
->screen_type
=screen_type
;
204 screen
->has_buttonbar
=false;
206 gui_textarea_update_nblines(screen
);
209 #ifdef HAVE_LCD_BITMAP
210 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
211 int width
, int height
)
213 display
->set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
214 display
->fillrect(xstart
, ystart
, width
, height
);
215 display
->set_drawmode(DRMODE_SOLID
);
219 void screen_access_init(void)
223 screen_init(&screens
[i
], i
);