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