diff options
author | Dave Chapman <dave@dchapman.com> | 2008-01-08 01:22:14 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-01-08 01:22:14 +0000 |
commit | 3646c313679c4bd16c9eec98c2e35c7a7bf5c961 (patch) | |
tree | b6508cc00ae60c70c9499090fb87d97f3370c131 | |
parent | 08e6c6bc2a90e953372e503367c406c469994da2 (diff) | |
download | rockbox-3646c313679c4bd16c9eec98c2e35c7a7bf5c961.tar.gz rockbox-3646c313679c4bd16c9eec98c2e35c7a7bf5c961.zip |
Add the viewport functions to the screens API, including a new getfont() function to return the font used by the current viewport. A change to the screens API makes the plugin API incompatible, so we bump version and sort. Also commit the test_viewports plugin (not built by default). This is some more of FS#8385.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16022 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugin.c | 7 | ||||
-rw-r--r-- | apps/plugin.h | 13 | ||||
-rw-r--r-- | apps/plugins/CATEGORIES | 1 | ||||
-rw-r--r-- | apps/plugins/test_viewports.c | 309 | ||||
-rw-r--r-- | apps/screen_access.c | 20 | ||||
-rw-r--r-- | apps/screen_access.h | 9 | ||||
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 5 | ||||
-rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 5 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 5 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 5 | ||||
-rw-r--r-- | firmware/drivers/lcd-remote-1bit-v.c | 5 | ||||
-rw-r--r-- | firmware/drivers/lcd-remote-2bit-vi.c | 5 | ||||
-rw-r--r-- | firmware/export/lcd-remote.h | 1 | ||||
-rw-r--r-- | firmware/export/lcd.h | 1 |
14 files changed, 379 insertions, 12 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 6d48329111..2149fdaee8 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -181,6 +181,9 @@ static const struct plugin_api rockbox_api = { | |||
181 | lcd_remote_bitmap, | 181 | lcd_remote_bitmap, |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) | ||
185 | lcd_grey_phase_blit, | ||
186 | #endif | ||
184 | #if defined(HAVE_LCD_COLOR) | 187 | #if defined(HAVE_LCD_COLOR) |
185 | lcd_yuv_blit, | 188 | lcd_yuv_blit, |
186 | #endif | 189 | #endif |
@@ -583,10 +586,6 @@ static const struct plugin_api rockbox_api = { | |||
583 | sound_unit, | 586 | sound_unit, |
584 | sound_val2phys, | 587 | sound_val2phys, |
585 | #endif /* CONFIG_CODEC == SWCODEC */ | 588 | #endif /* CONFIG_CODEC == SWCODEC */ |
586 | |||
587 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) | ||
588 | lcd_grey_phase_blit, | ||
589 | #endif | ||
590 | }; | 589 | }; |
591 | 590 | ||
592 | int plugin_load(const char* plugin, void* parameter) | 591 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index f782b7a20c..849c10bb89 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -119,12 +119,12 @@ | |||
119 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 119 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
120 | 120 | ||
121 | /* increase this every time the api struct changes */ | 121 | /* increase this every time the api struct changes */ |
122 | #define PLUGIN_API_VERSION 94 | 122 | #define PLUGIN_API_VERSION 95 |
123 | 123 | ||
124 | /* update this to latest version if a change to the api struct breaks | 124 | /* update this to latest version if a change to the api struct breaks |
125 | backwards compatibility (and please take the opportunity to sort in any | 125 | backwards compatibility (and please take the opportunity to sort in any |
126 | new function which are "waiting" at the end of the function table) */ | 126 | new function which are "waiting" at the end of the function table) */ |
127 | #define PLUGIN_MIN_API_VERSION 88 | 127 | #define PLUGIN_MIN_API_VERSION 95 |
128 | 128 | ||
129 | /* plugin return codes */ | 129 | /* plugin return codes */ |
130 | enum plugin_status { | 130 | enum plugin_status { |
@@ -267,6 +267,10 @@ struct plugin_api { | |||
267 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width, | 267 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width, |
268 | int height); | 268 | int height); |
269 | #endif | 269 | #endif |
270 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) | ||
271 | void (*lcd_grey_phase_blit)(const struct grey_data *data, int bx, int by, | ||
272 | int bwidth, int bheight, int stride); | ||
273 | #endif | ||
270 | #if defined(HAVE_LCD_COLOR) | 274 | #if defined(HAVE_LCD_COLOR) |
271 | void (*lcd_yuv_blit)(unsigned char * const src[3], | 275 | void (*lcd_yuv_blit)(unsigned char * const src[3], |
272 | int src_x, int src_y, int stride, | 276 | int src_x, int src_y, int stride, |
@@ -718,11 +722,6 @@ struct plugin_api { | |||
718 | const char * (*sound_unit)(int setting); | 722 | const char * (*sound_unit)(int setting); |
719 | int (*sound_val2phys)(int setting, int value); | 723 | int (*sound_val2phys)(int setting, int value); |
720 | #endif /* CONFIG_CODEC == SWCODEC */ | 724 | #endif /* CONFIG_CODEC == SWCODEC */ |
721 | |||
722 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) | ||
723 | void (*lcd_grey_phase_blit)(const struct grey_data *data, int bx, int by, | ||
724 | int bwidth, int bheight, int stride); | ||
725 | #endif | ||
726 | }; | 725 | }; |
727 | 726 | ||
728 | /* plugin header */ | 727 | /* plugin header */ |
diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES index 9a6cc93faa..ee28614da0 100644 --- a/apps/plugins/CATEGORIES +++ b/apps/plugins/CATEGORIES | |||
@@ -81,6 +81,7 @@ test_disk,apps | |||
81 | test_fps,apps | 81 | test_fps,apps |
82 | test_sampr,apps | 82 | test_sampr,apps |
83 | test_scanrate,apps | 83 | test_scanrate,apps |
84 | test_viewports,apps | ||
84 | text_editor,apps | 85 | text_editor,apps |
85 | vbrfix,viewers | 86 | vbrfix,viewers |
86 | video,viewers | 87 | video,viewers |
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c new file mode 100644 index 0000000000..3cb8afb519 --- /dev/null +++ b/apps/plugins/test_viewports.c | |||
@@ -0,0 +1,309 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: helloworld.c 12807 2007-03-16 21:56:08Z amiconn $ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "plugin.h" | ||
21 | |||
22 | PLUGIN_HEADER | ||
23 | |||
24 | static struct plugin_api* rb; | ||
25 | |||
26 | #ifdef HAVE_LCD_BITMAP | ||
27 | |||
28 | #ifdef HAVE_LCD_COLOR | ||
29 | #define BGCOLOR_1 LCD_RGBPACK(255,255,0) | ||
30 | #define BGCOLOR_2 LCD_RGBPACK(0,255,0) | ||
31 | #define FGCOLOR_1 LCD_RGBPACK(0,0,255) | ||
32 | #else if LCD_DEPTH > 1 | ||
33 | #define BGCOLOR_1 LCD_DARKGRAY | ||
34 | #define BGCOLOR_2 LCD_LIGHTGRAY | ||
35 | #define FGCOLOR_1 LCD_WHITE | ||
36 | #endif | ||
37 | |||
38 | static struct viewport vp0 = | ||
39 | { | ||
40 | .x = 0, | ||
41 | .y = 0, | ||
42 | .width = LCD_WIDTH, | ||
43 | .height = 20, | ||
44 | .font = FONT_UI, | ||
45 | .drawmode = DRMODE_SOLID, | ||
46 | .xmargin = 0, | ||
47 | .ymargin = 0, | ||
48 | #if LCD_DEPTH > 1 | ||
49 | .fg_pattern = LCD_DEFAULT_FG, | ||
50 | .bg_pattern = BGCOLOR_1, | ||
51 | #endif | ||
52 | #ifdef HAVE_LCD_COLOR | ||
53 | .lss_pattern = LCD_DEFAULT_BG, | ||
54 | .lse_pattern = LCD_DEFAULT_BG, | ||
55 | .lst_pattern = LCD_DEFAULT_BG, | ||
56 | #endif | ||
57 | }; | ||
58 | |||
59 | static struct viewport vp1 = | ||
60 | { | ||
61 | .x = LCD_WIDTH / 10, | ||
62 | .y = 20, | ||
63 | .width = LCD_WIDTH / 3, | ||
64 | .height = LCD_HEIGHT / 2, | ||
65 | .font = FONT_SYSFIXED, | ||
66 | .drawmode = DRMODE_SOLID, | ||
67 | .xmargin = 0, | ||
68 | .ymargin = 0, | ||
69 | #if LCD_DEPTH > 1 | ||
70 | .fg_pattern = LCD_DEFAULT_FG, | ||
71 | .bg_pattern = LCD_DEFAULT_BG, | ||
72 | #ifdef HAVE_LCD_COLOR | ||
73 | .lss_pattern = LCD_DEFAULT_BG, | ||
74 | .lse_pattern = LCD_DEFAULT_BG, | ||
75 | .lst_pattern = LCD_DEFAULT_BG, | ||
76 | #endif | ||
77 | #endif | ||
78 | }; | ||
79 | |||
80 | static struct viewport vp2 = | ||
81 | { | ||
82 | .x = LCD_WIDTH / 2, | ||
83 | .y = 40, | ||
84 | .width = LCD_WIDTH / 3, | ||
85 | .height = (LCD_HEIGHT / 2), | ||
86 | .font = FONT_UI, | ||
87 | .drawmode = DRMODE_SOLID, | ||
88 | .xmargin = 0, | ||
89 | .ymargin = 0, | ||
90 | #if LCD_DEPTH > 1 | ||
91 | .fg_pattern = FGCOLOR_1, | ||
92 | .bg_pattern = BGCOLOR_2, | ||
93 | #ifdef HAVE_LCD_COLOR | ||
94 | .lss_pattern = LCD_DEFAULT_BG, | ||
95 | .lse_pattern = LCD_DEFAULT_BG, | ||
96 | .lst_pattern = LCD_DEFAULT_BG, | ||
97 | #endif | ||
98 | #endif | ||
99 | }; | ||
100 | |||
101 | |||
102 | static struct viewport vp3 = | ||
103 | { | ||
104 | .x = LCD_WIDTH / 4, | ||
105 | .y = (5 * LCD_HEIGHT) / 8, | ||
106 | .width = LCD_WIDTH / 2, | ||
107 | .height = (LCD_HEIGHT / 4), | ||
108 | .font = FONT_SYSFIXED, | ||
109 | .drawmode = DRMODE_SOLID, | ||
110 | .xmargin = 0, | ||
111 | .ymargin = 0, | ||
112 | #if LCD_DEPTH > 1 | ||
113 | .fg_pattern = LCD_BLACK, | ||
114 | .bg_pattern = LCD_WHITE, | ||
115 | #ifdef HAVE_LCD_COLOR | ||
116 | .lss_pattern = LCD_DEFAULT_BG, | ||
117 | .lse_pattern = LCD_DEFAULT_BG, | ||
118 | .lst_pattern = LCD_DEFAULT_BG, | ||
119 | #endif | ||
120 | #endif | ||
121 | }; | ||
122 | |||
123 | |||
124 | #ifdef HAVE_REMOTE_LCD | ||
125 | static struct viewport rvp0 = | ||
126 | { | ||
127 | .x = 0, | ||
128 | .y = 10, | ||
129 | .width = LCD_REMOTE_WIDTH / 3, | ||
130 | .height = LCD_REMOTE_HEIGHT - 10, | ||
131 | .font = FONT_SYSFIXED, | ||
132 | .drawmode = DRMODE_SOLID, | ||
133 | .xmargin = 0, | ||
134 | .ymargin = 0, | ||
135 | #if LCD_REMOTE_DEPTH > 1 | ||
136 | .fg_pattern = LCD_REMOTE_BLACK, | ||
137 | .bg_pattern = LCD_REMOTE_LIGHTGRAY, | ||
138 | #endif | ||
139 | }; | ||
140 | |||
141 | static struct viewport rvp1 = | ||
142 | { | ||
143 | .x = LCD_REMOTE_WIDTH / 2, | ||
144 | .y = 0, | ||
145 | .width = LCD_REMOTE_WIDTH / 3, | ||
146 | .height = LCD_REMOTE_HEIGHT - 10, | ||
147 | .font = FONT_SYSFIXED, | ||
148 | .drawmode = DRMODE_SOLID, | ||
149 | .xmargin = 0, | ||
150 | .ymargin = 0, | ||
151 | #if LCD_REMOTE_DEPTH > 1 | ||
152 | .fg_pattern = LCD_REMOTE_DEFAULT_FG, | ||
153 | .bg_pattern = LCD_REMOTE_DEFAULT_BG | ||
154 | #endif | ||
155 | }; | ||
156 | |||
157 | #endif | ||
158 | |||
159 | |||
160 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
161 | { | ||
162 | (void)parameter; | ||
163 | char buf[80]; | ||
164 | int i,y; | ||
165 | |||
166 | rb = api; | ||
167 | |||
168 | rb->screens[SCREEN_MAIN]->set_viewport(&vp0); | ||
169 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
170 | rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Viewport testing plugin - this is a scrolling title"); | ||
171 | |||
172 | rb->screens[SCREEN_MAIN]->set_viewport(&vp1); | ||
173 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
174 | |||
175 | for (i = 0 ; i < 3; i++) | ||
176 | { | ||
177 | rb->snprintf(buf,sizeof(buf),"Left text, scrolling_line %d",i); | ||
178 | rb->screens[SCREEN_MAIN]->puts_scroll(0,i,buf); | ||
179 | } | ||
180 | |||
181 | rb->screens[SCREEN_MAIN]->set_viewport(&vp2); | ||
182 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
183 | for (i = 1 ; i < 3; i++) | ||
184 | { | ||
185 | rb->snprintf(buf,sizeof(buf),"Right text, scrolling line %d",i); | ||
186 | rb->screens[SCREEN_MAIN]->puts_scroll(1,i,buf); | ||
187 | } | ||
188 | |||
189 | y = -10; | ||
190 | for (i = -10; i < vp2.width + 10; i += 5) | ||
191 | { | ||
192 | rb->screens[SCREEN_MAIN]->drawline(i, y, i, vp2.height - y); | ||
193 | } | ||
194 | |||
195 | rb->screens[SCREEN_MAIN]->set_viewport(&vp3); | ||
196 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
197 | for (i = 1 ; i < 2; i++) | ||
198 | { | ||
199 | rb->snprintf(buf,sizeof(buf),"Bottom text, a scrolling line %d",i); | ||
200 | rb->screens[SCREEN_MAIN]->puts_scroll(2,i,buf); | ||
201 | } | ||
202 | rb->screens[SCREEN_MAIN]->puts_scroll(4,i,"Short line"); | ||
203 | rb->screens[SCREEN_MAIN]->update(); | ||
204 | |||
205 | |||
206 | #ifdef HAVE_REMOTE_LCD | ||
207 | rb->screens[SCREEN_REMOTE]->set_viewport(&rvp0); | ||
208 | rb->screens[SCREEN_REMOTE]->clear_viewport(); | ||
209 | |||
210 | for (i = 0 ; i < 5; i++) | ||
211 | { | ||
212 | rb->snprintf(buf,sizeof(buf),"Left text, scrolling_line %d",i); | ||
213 | rb->screens[SCREEN_REMOTE]->puts_scroll(0,i,buf); | ||
214 | } | ||
215 | rb->screens[SCREEN_REMOTE]->puts(1,i,"Static"); | ||
216 | |||
217 | rb->screens[SCREEN_REMOTE]->set_viewport(&rvp1); | ||
218 | rb->screens[SCREEN_REMOTE]->clear_viewport(); | ||
219 | for (i = 1 ; i < 3; i++) | ||
220 | { | ||
221 | rb->snprintf(buf,sizeof(buf),"Right text, scrolling line %d",i); | ||
222 | rb->screens[SCREEN_REMOTE]->puts_scroll(1,i,buf); | ||
223 | } | ||
224 | |||
225 | y = -10; | ||
226 | for (i = -10; i < rvp1.width + 10; i += 5) | ||
227 | { | ||
228 | rb->screens[SCREEN_REMOTE]->drawline(i, y, i, rvp1.height - y); | ||
229 | } | ||
230 | |||
231 | rb->screens[SCREEN_REMOTE]->update(); | ||
232 | #endif | ||
233 | |||
234 | rb->button_get(true); | ||
235 | |||
236 | /* Restore the default viewport */ | ||
237 | rb->screens[SCREEN_MAIN]->set_viewport(NULL); | ||
238 | #ifdef HAVE_REMOTE_LCD | ||
239 | rb->screens[SCREEN_REMOTE]->set_viewport(NULL); | ||
240 | #endif | ||
241 | |||
242 | return PLUGIN_OK; | ||
243 | } | ||
244 | |||
245 | |||
246 | #else | ||
247 | |||
248 | /* Charcell version of plugin */ | ||
249 | |||
250 | static struct viewport vp0 = | ||
251 | { | ||
252 | .x = 0, | ||
253 | .y = 0, | ||
254 | .width = 5, | ||
255 | .height = 1, | ||
256 | .xmargin = 0, | ||
257 | .ymargin = 0, | ||
258 | }; | ||
259 | |||
260 | static struct viewport vp1 = | ||
261 | { | ||
262 | .x = 6, | ||
263 | .y = 0, | ||
264 | .width = 5, | ||
265 | .height = 1, | ||
266 | .xmargin = 0, | ||
267 | .ymargin = 0, | ||
268 | }; | ||
269 | |||
270 | static struct viewport vp2 = | ||
271 | { | ||
272 | .x = 0, | ||
273 | .y = 1, | ||
274 | .width = LCD_WIDTH, | ||
275 | .height = 1, | ||
276 | .xmargin = 0, | ||
277 | .ymargin = 0, | ||
278 | }; | ||
279 | |||
280 | |||
281 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
282 | { | ||
283 | (void)parameter; | ||
284 | |||
285 | rb = api; | ||
286 | |||
287 | rb->screens[SCREEN_MAIN]->set_viewport(&vp0); | ||
288 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
289 | rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Rockbox"); | ||
290 | |||
291 | rb->screens[SCREEN_MAIN]->set_viewport(&vp1); | ||
292 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
293 | rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Viewports"); | ||
294 | |||
295 | rb->screens[SCREEN_MAIN]->set_viewport(&vp2); | ||
296 | rb->screens[SCREEN_MAIN]->clear_viewport(); | ||
297 | rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Demonstration"); | ||
298 | |||
299 | rb->screens[SCREEN_MAIN]->update(); | ||
300 | |||
301 | rb->button_get(true); | ||
302 | |||
303 | /* Restore the default viewport */ | ||
304 | rb->screens[SCREEN_MAIN]->set_viewport(NULL); | ||
305 | |||
306 | return PLUGIN_OK; | ||
307 | } | ||
308 | |||
309 | #endif /* !HAVE_LCD_BITMAP */ | ||
diff --git a/apps/screen_access.c b/apps/screen_access.c index 0d7017984e..5e9ab03d06 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <lcd.h> | 20 | #include <lcd.h> |
21 | #include <lcd-remote.h> | 21 | #include <lcd-remote.h> |
22 | #include <scroll_engine.h> | ||
22 | #include "backlight.h" | 23 | #include "backlight.h" |
23 | #include <font.h> | 24 | #include <font.h> |
24 | #include <button.h> | 25 | #include <button.h> |
@@ -50,12 +51,16 @@ struct screen screens[NB_SCREENS] = | |||
50 | #elif defined(HAVE_REMOTE_LCD) | 51 | #elif defined(HAVE_REMOTE_LCD) |
51 | .has_disk_led=true, | 52 | .has_disk_led=true, |
52 | #endif | 53 | #endif |
54 | .set_viewport=&lcd_set_viewport, | ||
53 | .setmargins=&lcd_setmargins, | 55 | .setmargins=&lcd_setmargins, |
56 | .getwidth=&lcd_getwidth, | ||
57 | .getheight=&lcd_getheight, | ||
54 | .getymargin=&lcd_getymargin, | 58 | .getymargin=&lcd_getymargin, |
55 | .getxmargin=&lcd_getxmargin, | 59 | .getxmargin=&lcd_getxmargin, |
56 | .getstringsize=&lcd_getstringsize, | 60 | .getstringsize=&lcd_getstringsize, |
57 | #ifdef HAVE_LCD_BITMAP | 61 | #ifdef HAVE_LCD_BITMAP |
58 | .setfont=&lcd_setfont, | 62 | .setfont=&lcd_setfont, |
63 | .getfont=&lcd_getfont, | ||
59 | .mono_bitmap=&lcd_mono_bitmap, | 64 | .mono_bitmap=&lcd_mono_bitmap, |
60 | .mono_bitmap_part=&lcd_mono_bitmap_part, | 65 | .mono_bitmap_part=&lcd_mono_bitmap_part, |
61 | .set_drawmode=&lcd_set_drawmode, | 66 | .set_drawmode=&lcd_set_drawmode, |
@@ -84,6 +89,7 @@ struct screen screens[NB_SCREENS] = | |||
84 | #endif | 89 | #endif |
85 | #endif /* LCD_DEPTH > 1 */ | 90 | #endif /* LCD_DEPTH > 1 */ |
86 | .update_rect=&lcd_update_rect, | 91 | .update_rect=&lcd_update_rect, |
92 | .update_viewport_rect=&lcd_update_viewport_rect, | ||
87 | .fillrect=&lcd_fillrect, | 93 | .fillrect=&lcd_fillrect, |
88 | .drawrect=&lcd_drawrect, | 94 | .drawrect=&lcd_drawrect, |
89 | .drawpixel=&lcd_drawpixel, | 95 | .drawpixel=&lcd_drawpixel, |
@@ -114,7 +120,11 @@ struct screen screens[NB_SCREENS] = | |||
114 | .scroll_delay=&lcd_scroll_delay, | 120 | .scroll_delay=&lcd_scroll_delay, |
115 | .stop_scroll=&lcd_stop_scroll, | 121 | .stop_scroll=&lcd_stop_scroll, |
116 | .clear_display=&lcd_clear_display, | 122 | .clear_display=&lcd_clear_display, |
123 | .clear_viewport=&lcd_clear_viewport, | ||
124 | .scroll_stop=&lcd_scroll_stop, | ||
125 | .scroll_stop_line=&lcd_scroll_stop_line, | ||
117 | .update=&lcd_update, | 126 | .update=&lcd_update, |
127 | .update_viewport=&lcd_update_viewport, | ||
118 | .backlight_on=&backlight_on, | 128 | .backlight_on=&backlight_on, |
119 | .backlight_off=&backlight_off, | 129 | .backlight_off=&backlight_off, |
120 | .is_backlight_on=&is_backlight_on, | 130 | .is_backlight_on=&is_backlight_on, |
@@ -132,12 +142,15 @@ struct screen screens[NB_SCREENS] = | |||
132 | .is_color=false,/* No color remotes yet */ | 142 | .is_color=false,/* No color remotes yet */ |
133 | .pixel_format=LCD_REMOTE_PIXELFORMAT, | 143 | .pixel_format=LCD_REMOTE_PIXELFORMAT, |
134 | .has_disk_led=false, | 144 | .has_disk_led=false, |
145 | .set_viewport=&lcd_remote_set_viewport, | ||
135 | .setmargins=&lcd_remote_setmargins, | 146 | .setmargins=&lcd_remote_setmargins, |
147 | .getwidth=&lcd_remote_getwidth, | ||
148 | .getheight=&lcd_remote_getheight, | ||
136 | .getymargin=&lcd_remote_getymargin, | 149 | .getymargin=&lcd_remote_getymargin, |
137 | .getxmargin=&lcd_remote_getxmargin, | 150 | .getxmargin=&lcd_remote_getxmargin, |
138 | .getstringsize=&lcd_remote_getstringsize, | 151 | .getstringsize=&lcd_remote_getstringsize, |
139 | #if 1 /* all remote LCDs are bitmapped so far */ | 152 | #if 1 /* all remote LCDs are bitmapped so far */ |
140 | .setfont=&lcd_remote_setfont, | 153 | .getfont=&lcd_remote_getfont, |
141 | .mono_bitmap=&lcd_remote_mono_bitmap, | 154 | .mono_bitmap=&lcd_remote_mono_bitmap, |
142 | .mono_bitmap_part=&lcd_remote_mono_bitmap_part, | 155 | .mono_bitmap_part=&lcd_remote_mono_bitmap_part, |
143 | .bitmap=(screen_bitmap_func*)&lcd_remote_bitmap, | 156 | .bitmap=(screen_bitmap_func*)&lcd_remote_bitmap, |
@@ -159,6 +172,7 @@ struct screen screens[NB_SCREENS] = | |||
159 | .set_foreground=&lcd_remote_set_foreground, | 172 | .set_foreground=&lcd_remote_set_foreground, |
160 | #endif /* LCD_REMOTE_DEPTH > 1 */ | 173 | #endif /* LCD_REMOTE_DEPTH > 1 */ |
161 | .update_rect=&lcd_remote_update_rect, | 174 | .update_rect=&lcd_remote_update_rect, |
175 | .update_viewport_rect=&lcd_remote_update_viewport_rect, | ||
162 | .fillrect=&lcd_remote_fillrect, | 176 | .fillrect=&lcd_remote_fillrect, |
163 | .drawrect=&lcd_remote_drawrect, | 177 | .drawrect=&lcd_remote_drawrect, |
164 | .drawpixel=&lcd_remote_drawpixel, | 178 | .drawpixel=&lcd_remote_drawpixel, |
@@ -187,7 +201,11 @@ struct screen screens[NB_SCREENS] = | |||
187 | .scroll_delay=&lcd_remote_scroll_delay, | 201 | .scroll_delay=&lcd_remote_scroll_delay, |
188 | .stop_scroll=&lcd_remote_stop_scroll, | 202 | .stop_scroll=&lcd_remote_stop_scroll, |
189 | .clear_display=&lcd_remote_clear_display, | 203 | .clear_display=&lcd_remote_clear_display, |
204 | .clear_viewport=&lcd_remote_clear_viewport, | ||
205 | .scroll_stop=&lcd_remote_scroll_stop, | ||
206 | .scroll_stop_line=&lcd_remote_scroll_stop_line, | ||
190 | .update=&lcd_remote_update, | 207 | .update=&lcd_remote_update, |
208 | .update_viewport=&lcd_remote_update_viewport, | ||
191 | .backlight_on=&remote_backlight_on, | 209 | .backlight_on=&remote_backlight_on, |
192 | .backlight_off=&remote_backlight_off, | 210 | .backlight_off=&remote_backlight_off, |
193 | .is_backlight_on=&is_remote_backlight_on, | 211 | .is_backlight_on=&is_remote_backlight_on, |
diff --git a/apps/screen_access.h b/apps/screen_access.h index 35bcdef0a2..7efa48c423 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -71,12 +71,16 @@ struct screen | |||
71 | #ifdef HAS_BUTTONBAR | 71 | #ifdef HAS_BUTTONBAR |
72 | bool has_buttonbar; | 72 | bool has_buttonbar; |
73 | #endif | 73 | #endif |
74 | void (*set_viewport)(struct viewport* vp); | ||
74 | void (*setmargins)(int x, int y); | 75 | void (*setmargins)(int x, int y); |
76 | int (*getwidth)(void); | ||
77 | int (*getheight)(void); | ||
75 | int (*getxmargin)(void); | 78 | int (*getxmargin)(void); |
76 | int (*getymargin)(void); | 79 | int (*getymargin)(void); |
77 | int (*getstringsize)(const unsigned char *str, int *w, int *h); | 80 | int (*getstringsize)(const unsigned char *str, int *w, int *h); |
78 | #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ | 81 | #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ |
79 | void (*setfont)(int newfont); | 82 | void (*setfont)(int newfont); |
83 | int (*getfont)(void); | ||
80 | 84 | ||
81 | void (*scroll_step)(int pixels); | 85 | void (*scroll_step)(int pixels); |
82 | void (*puts_style_offset)(int x, int y, const unsigned char *str, | 86 | void (*puts_style_offset)(int x, int y, const unsigned char *str, |
@@ -113,6 +117,7 @@ struct screen | |||
113 | void (*set_selector_text)(unsigned selector_text); | 117 | void (*set_selector_text)(unsigned selector_text); |
114 | #endif | 118 | #endif |
115 | void (*update_rect)(int x, int y, int width, int height); | 119 | void (*update_rect)(int x, int y, int width, int height); |
120 | void (*update_viewport_rect)(int x, int y, int width, int height); | ||
116 | void (*fillrect)(int x, int y, int width, int height); | 121 | void (*fillrect)(int x, int y, int width, int height); |
117 | void (*drawrect)(int x, int y, int width, int height); | 122 | void (*drawrect)(int x, int y, int width, int height); |
118 | void (*drawpixel)(int x, int y); | 123 | void (*drawpixel)(int x, int y); |
@@ -139,7 +144,11 @@ struct screen | |||
139 | void (*scroll_delay)(int ms); | 144 | void (*scroll_delay)(int ms); |
140 | void (*stop_scroll)(void); | 145 | void (*stop_scroll)(void); |
141 | void (*clear_display)(void); | 146 | void (*clear_display)(void); |
147 | void (*clear_viewport)(void); | ||
148 | void (*scroll_stop)(struct viewport* vp); | ||
149 | void (*scroll_stop_line)(struct viewport* vp, int y); | ||
142 | void (*update)(void); | 150 | void (*update)(void); |
151 | void (*update_viewport)(void); | ||
143 | void (*backlight_on)(void); | 152 | void (*backlight_on)(void); |
144 | void (*backlight_off)(void); | 153 | void (*backlight_off)(void); |
145 | bool (*is_backlight_on)(void); | 154 | bool (*is_backlight_on)(void); |
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index cc5a6c5ab7..2a766d4006 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -190,6 +190,11 @@ void lcd_setfont(int newfont) | |||
190 | current_vp->font = newfont; | 190 | current_vp->font = newfont; |
191 | } | 191 | } |
192 | 192 | ||
193 | int lcd_getfont(void) | ||
194 | { | ||
195 | return current_vp->font; | ||
196 | } | ||
197 | |||
193 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) | 198 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) |
194 | { | 199 | { |
195 | return font_getstringsize(str, w, h, current_vp->font); | 200 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 5c651a9613..7c9cd26e2a 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -122,6 +122,11 @@ void lcd_setfont(int newfont) | |||
122 | current_vp->font = newfont; | 122 | current_vp->font = newfont; |
123 | } | 123 | } |
124 | 124 | ||
125 | int lcd_getfont(void) | ||
126 | { | ||
127 | return current_vp->font; | ||
128 | } | ||
129 | |||
125 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) | 130 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) |
126 | { | 131 | { |
127 | return font_getstringsize(str, w, h, current_vp->font); | 132 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 1ee0addba4..195885c072 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -172,6 +172,11 @@ void lcd_setfont(int newfont) | |||
172 | current_vp->font = newfont; | 172 | current_vp->font = newfont; |
173 | } | 173 | } |
174 | 174 | ||
175 | int lcd_getfont(void) | ||
176 | { | ||
177 | return current_vp->font; | ||
178 | } | ||
179 | |||
175 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) | 180 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) |
176 | { | 181 | { |
177 | return font_getstringsize(str, w, h, current_vp->font); | 182 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 2341ddb3df..cb532b7aaf 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -175,6 +175,11 @@ void lcd_setfont(int newfont) | |||
175 | current_vp->font = newfont; | 175 | current_vp->font = newfont; |
176 | } | 176 | } |
177 | 177 | ||
178 | int lcd_getfont(void) | ||
179 | { | ||
180 | return current_vp->font; | ||
181 | } | ||
182 | |||
178 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) | 183 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) |
179 | { | 184 | { |
180 | return font_getstringsize(str, w, h, current_vp->font); | 185 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/drivers/lcd-remote-1bit-v.c b/firmware/drivers/lcd-remote-1bit-v.c index a33648b76a..20c6f6655c 100644 --- a/firmware/drivers/lcd-remote-1bit-v.c +++ b/firmware/drivers/lcd-remote-1bit-v.c | |||
@@ -117,6 +117,11 @@ void lcd_remote_setfont(int newfont) | |||
117 | current_vp->font = newfont; | 117 | current_vp->font = newfont; |
118 | } | 118 | } |
119 | 119 | ||
120 | int lcd_remote_getfont(void) | ||
121 | { | ||
122 | return current_vp->font; | ||
123 | } | ||
124 | |||
120 | int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) | 125 | int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) |
121 | { | 126 | { |
122 | return font_getstringsize(str, w, h, current_vp->font); | 127 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c index 9ab98c69aa..9f70e95195 100644 --- a/firmware/drivers/lcd-remote-2bit-vi.c +++ b/firmware/drivers/lcd-remote-2bit-vi.c | |||
@@ -174,6 +174,11 @@ void lcd_remote_setfont(int newfont) | |||
174 | current_vp->font = newfont; | 174 | current_vp->font = newfont; |
175 | } | 175 | } |
176 | 176 | ||
177 | int lcd_remote_getfont(void) | ||
178 | { | ||
179 | return current_vp->font; | ||
180 | } | ||
181 | |||
177 | int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) | 182 | int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h) |
178 | { | 183 | { |
179 | return font_getstringsize(str, w, h, current_vp->font); | 184 | return font_getstringsize(str, w, h, current_vp->font); |
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 34c40e52c1..cdd48e5fa3 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h | |||
@@ -149,6 +149,7 @@ extern int lcd_remote_getymargin(void); | |||
149 | extern int lcd_remote_getwidth(void); | 149 | extern int lcd_remote_getwidth(void); |
150 | extern int lcd_remote_getheight(void); | 150 | extern int lcd_remote_getheight(void); |
151 | extern void lcd_remote_setfont(int font); | 151 | extern void lcd_remote_setfont(int font); |
152 | extern int lcd_remote_getfont(void); | ||
152 | extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); | 153 | extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); |
153 | 154 | ||
154 | /* low level drawing function pointer arrays */ | 155 | /* low level drawing function pointer arrays */ |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 276dcdfedc..57c9b1d3b8 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -372,6 +372,7 @@ extern void lcd_set_flip(bool yesno); | |||
372 | extern void lcd_set_drawmode(int mode); | 372 | extern void lcd_set_drawmode(int mode); |
373 | extern int lcd_get_drawmode(void); | 373 | extern int lcd_get_drawmode(void); |
374 | extern void lcd_setfont(int font); | 374 | extern void lcd_setfont(int font); |
375 | extern int lcd_getfont(void); | ||
375 | 376 | ||
376 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, | 377 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, |
377 | int style, int offset); | 378 | int style, int offset); |