diff options
-rw-r--r-- | apps/gui/charcell/list.c | 8 | ||||
-rw-r--r-- | apps/gui/color_picker.c | 52 | ||||
-rw-r--r-- | apps/gui/pitchscreen.c | 14 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 2 | ||||
-rw-r--r-- | apps/main.c | 10 | ||||
-rw-r--r-- | apps/onplay.c | 5 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 6 | ||||
-rw-r--r-- | apps/screen_access.c | 102 | ||||
-rw-r--r-- | apps/screen_access.h | 11 |
9 files changed, 124 insertions, 86 deletions
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index 2df030f8b6..b1d0adcdd6 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c | |||
@@ -51,13 +51,13 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
51 | int i; | 51 | int i; |
52 | int lines; | 52 | int lines; |
53 | int start, end; | 53 | int start, end; |
54 | 54 | ||
55 | display->set_viewport(NULL); | 55 | display->set_viewport(NULL); |
56 | lines = display->nb_lines; | 56 | lines = display->getnblines(); |
57 | 57 | ||
58 | display->clear_display(); | 58 | display->clear_display(); |
59 | start = 0; | 59 | start = 0; |
60 | end = display->nb_lines; | 60 | end = display->getnblines(); |
61 | gui_list->last_displayed_start_item[display->screen_type] = | 61 | gui_list->last_displayed_start_item[display->screen_type] = |
62 | gui_list->start_item[display->screen_type]; | 62 | gui_list->start_item[display->screen_type]; |
63 | 63 | ||
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index d1ac2a9103..eb4490035d 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c | |||
@@ -158,11 +158,12 @@ static void draw_screen(struct screen *display, char *title, | |||
158 | enough to display the selected slider - calculate total height | 158 | enough to display the selected slider - calculate total height |
159 | of display with three sliders present */ | 159 | of display with three sliders present */ |
160 | display_three_rows = | 160 | display_three_rows = |
161 | display->getheight() >= MARGIN_TOP + | 161 | display->getheight() >= |
162 | display->char_height*4 + /* Title + 3 sliders */ | 162 | MARGIN_TOP + |
163 | TITLE_MARGIN_BOTTOM + | 163 | display->getcharheight()*4 + /* Title + 3 sliders */ |
164 | SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ | 164 | TITLE_MARGIN_BOTTOM + |
165 | MARGIN_BOTTOM; | 165 | SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ |
166 | MARGIN_BOTTOM; | ||
166 | 167 | ||
167 | /* Figure out widest label character in case they vary - | 168 | /* Figure out widest label character in case they vary - |
168 | this function assumes labels are one character */ | 169 | this function assumes labels are one character */ |
@@ -185,8 +186,8 @@ static void draw_screen(struct screen *display, char *title, | |||
185 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + | 186 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + |
186 | max_label_width + SLIDER_MARGIN_LEFT; | 187 | max_label_width + SLIDER_MARGIN_LEFT; |
187 | slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - | 188 | slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - |
188 | display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH - | 189 | display->getcharwidth()*2 - SELECTOR_LR_MARGIN - |
189 | MARGIN_RIGHT; | 190 | SELECTOR_WIDTH - MARGIN_RIGHT; |
190 | 191 | ||
191 | for (i = 0; i < 3; i++) | 192 | for (i = 0; i < 3; i++) |
192 | { | 193 | { |
@@ -209,7 +210,7 @@ static void draw_screen(struct screen *display, char *title, | |||
209 | display->fillrect(0, | 210 | display->fillrect(0, |
210 | text_top - SELECTOR_TB_MARGIN, | 211 | text_top - SELECTOR_TB_MARGIN, |
211 | display->getwidth(), | 212 | display->getwidth(), |
212 | display->char_height + | 213 | display->getcharheight() + |
213 | SELECTOR_TB_MARGIN*2); | 214 | SELECTOR_TB_MARGIN*2); |
214 | 215 | ||
215 | if (display->depth < 16) | 216 | if (display->depth < 16) |
@@ -221,7 +222,7 @@ static void draw_screen(struct screen *display, char *title, | |||
221 | else if (display_three_rows) | 222 | else if (display_three_rows) |
222 | { | 223 | { |
223 | /* Draw "> <" around sliders */ | 224 | /* Draw "> <" around sliders */ |
224 | int top = text_top + (display->char_height - | 225 | int top = text_top + (display->getcharheight() - |
225 | SELECTOR_HEIGHT) / 2; | 226 | SELECTOR_HEIGHT) / 2; |
226 | screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); | 227 | screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); |
227 | screen_put_iconxy(display, | 228 | screen_put_iconxy(display, |
@@ -244,7 +245,7 @@ static void draw_screen(struct screen *display, char *title, | |||
244 | /* Draw label */ | 245 | /* Draw label */ |
245 | buf[0] = str(LANG_COLOR_RGB_LABELS)[i]; | 246 | buf[0] = str(LANG_COLOR_RGB_LABELS)[i]; |
246 | buf[1] = '\0'; | 247 | buf[1] = '\0'; |
247 | display->putsxy(slider_left - display->char_width - | 248 | display->putsxy(slider_left - display->getcharwidth() - |
248 | SLIDER_MARGIN_LEFT, text_top, buf); | 249 | SLIDER_MARGIN_LEFT, text_top, buf); |
249 | 250 | ||
250 | /* Draw color value */ | 251 | /* Draw color value */ |
@@ -255,24 +256,21 @@ static void draw_screen(struct screen *display, char *title, | |||
255 | /* Draw scrollbar */ | 256 | /* Draw scrollbar */ |
256 | gui_scrollbar_draw(display, | 257 | gui_scrollbar_draw(display, |
257 | slider_left, | 258 | slider_left, |
258 | text_top + display->char_height / 4, | 259 | text_top + display->getcharheight() / 4, |
259 | slider_width, | 260 | slider_width, |
260 | display->char_height / 2, | 261 | display->getcharheight() / 2, |
261 | rgb_max[i], | 262 | rgb_max[i], |
262 | 0, | 263 | 0, |
263 | rgb->rgb_val[i], | 264 | rgb->rgb_val[i], |
264 | sb_flags); | 265 | sb_flags); |
265 | 266 | ||
266 | /* Advance to next line */ | 267 | /* Advance to next line */ |
267 | text_top += display->char_height + 2*SELECTOR_TB_MARGIN; | 268 | text_top += display->getcharheight() + 2*SELECTOR_TB_MARGIN; |
268 | 269 | ||
269 | if (!display_three_rows) | 270 | if (!display_three_rows) |
270 | break; | 271 | break; |
271 | } /* end for */ | 272 | } /* end for */ |
272 | 273 | ||
273 | /* Draw color value in system font */ | ||
274 | display->setfont(FONT_SYSFIXED); | ||
275 | |||
276 | /* Format RGB: #rrggbb */ | 274 | /* Format RGB: #rrggbb */ |
277 | snprintf(buf, sizeof(buf), str(LANG_COLOR_RGB_VALUE), | 275 | snprintf(buf, sizeof(buf), str(LANG_COLOR_RGB_VALUE), |
278 | rgb->red, rgb->green, rgb->blue); | 276 | rgb->red, rgb->green, rgb->blue); |
@@ -287,7 +285,7 @@ static void draw_screen(struct screen *display, char *title, | |||
287 | int height = display->getheight() - top - MARGIN_BOTTOM; | 285 | int height = display->getheight() - top - MARGIN_BOTTOM; |
288 | 286 | ||
289 | /* Only draw if room */ | 287 | /* Only draw if room */ |
290 | if (height >= display->char_height + 2) | 288 | if (height >= display->getcharheight() + 2) |
291 | { | 289 | { |
292 | display->set_foreground(rgb->color); | 290 | display->set_foreground(rgb->color); |
293 | display->fillrect(left, top, width, height); | 291 | display->fillrect(left, top, width, height); |
@@ -357,19 +355,21 @@ static int touchscreen_slider(struct rgb_pick *rgb, int *selected_slider) | |||
357 | max_label_width = x1; | 355 | max_label_width = x1; |
358 | } | 356 | } |
359 | /* Get slider positions and top starting position */ | 357 | /* Get slider positions and top starting position */ |
360 | text_top = MARGIN_TOP + display->char_height + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; | 358 | text_top = MARGIN_TOP + display->getcharheight() + TITLE_MARGIN_BOTTOM + |
359 | SELECTOR_TB_MARGIN; | ||
361 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + | 360 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + |
362 | max_label_width + SLIDER_MARGIN_LEFT; | 361 | max_label_width + SLIDER_MARGIN_LEFT; |
363 | slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - | 362 | slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - |
364 | display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH - | 363 | display->getcharwidth()*2 - SELECTOR_LR_MARGIN - |
365 | MARGIN_RIGHT; | 364 | SELECTOR_WIDTH - MARGIN_RIGHT; |
366 | display_three_rows = | 365 | display_three_rows = |
367 | display->getheight() >= MARGIN_TOP + | 366 | display->getheight() >= |
368 | display->char_height*4 + /* Title + 3 sliders */ | 367 | MARGIN_TOP + |
369 | TITLE_MARGIN_BOTTOM + | 368 | display->getcharheight()*4 + /* Title + 3 sliders */ |
370 | SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ | 369 | TITLE_MARGIN_BOTTOM + |
371 | MARGIN_BOTTOM; | 370 | SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ |
372 | if (y < MARGIN_TOP+display->char_height) | 371 | MARGIN_BOTTOM; |
372 | if (y < MARGIN_TOP+display->getcharheight()) | ||
373 | { | 373 | { |
374 | if (button == BUTTON_REL) | 374 | if (button == BUTTON_REL) |
375 | return ACTION_STD_CANCEL; | 375 | return ACTION_STD_CANCEL; |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 2a568afc0a..c4f78f4baa 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -60,12 +60,12 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode) | |||
60 | 60 | ||
61 | display->clear_display(); | 61 | display->clear_display(); |
62 | 62 | ||
63 | if (display->nb_lines < 4) /* very small screen, just show the pitch value */ | 63 | if (display->getnblines() < 4) /* very small screen, just show pitch value*/ |
64 | { | 64 | { |
65 | w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), | 65 | w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), |
66 | pitch / 10, pitch % 10 ); | 66 | pitch / 10, pitch % 10 ); |
67 | display->putsxy((display->lcdwidth-(w*display->char_width))/2, | 67 | display->putsxy((display->lcdwidth-(w*display->getcharwidth()))/2, |
68 | display->nb_lines/2,buf); | 68 | display->getnblines()/2,buf); |
69 | } | 69 | } |
70 | else /* bigger screen, show everything... */ | 70 | else /* bigger screen, show everything... */ |
71 | { | 71 | { |
@@ -242,7 +242,7 @@ bool pitch_screen(void) | |||
242 | nudged = (new_pitch != pitch); | 242 | nudged = (new_pitch != pitch); |
243 | pitch = new_pitch; | 243 | pitch = new_pitch; |
244 | break; | 244 | break; |
245 | 245 | ||
246 | case ACTION_PS_NUDGE_LEFTOFF: | 246 | case ACTION_PS_NUDGE_LEFTOFF: |
247 | if (nudged) { | 247 | if (nudged) { |
248 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); | 248 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); |
@@ -268,7 +268,7 @@ bool pitch_screen(void) | |||
268 | return 1; | 268 | return 1; |
269 | break; | 269 | break; |
270 | } | 270 | } |
271 | 271 | ||
272 | if(delta) | 272 | if(delta) |
273 | { | 273 | { |
274 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | 274 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { |
@@ -276,10 +276,10 @@ bool pitch_screen(void) | |||
276 | } else { | 276 | } else { |
277 | pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false); | 277 | pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false); |
278 | } | 278 | } |
279 | 279 | ||
280 | delta = 0; | 280 | delta = 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | } | 283 | } |
284 | #if CONFIG_CODEC == SWCODEC | 284 | #if CONFIG_CODEC == SWCODEC |
285 | pcmbuf_set_low_latency(false); | 285 | pcmbuf_set_low_latency(false); |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 4e55dfed7d..9c850b74ca 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -207,7 +207,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs, | |||
207 | value = option_get_valuestring((struct settings_list*)qs->items[i], | 207 | value = option_get_valuestring((struct settings_list*)qs->items[i], |
208 | buf, MAX_PATH, temp); | 208 | buf, MAX_PATH, temp); |
209 | 209 | ||
210 | if (vps[screen][i].height < display->char_height*2) | 210 | if (vps[screen][i].height < display->getcharheight()*2) |
211 | { | 211 | { |
212 | char text[MAX_PATH]; | 212 | char text[MAX_PATH]; |
213 | snprintf(text, MAX_PATH, "%s: %s", title, value); | 213 | snprintf(text, MAX_PATH, "%s: %s", title, value); |
diff --git a/apps/main.c b/apps/main.c index d59d17a5f1..bacaa51e01 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -288,7 +288,6 @@ static void init(void) | |||
288 | debug_init(); | 288 | debug_init(); |
289 | #endif | 289 | #endif |
290 | /* Must be done before any code uses the multi-screen APi */ | 290 | /* Must be done before any code uses the multi-screen APi */ |
291 | screen_access_init(); | ||
292 | gui_syncstatusbar_init(&statusbars); | 291 | gui_syncstatusbar_init(&statusbars); |
293 | ata_init(); | 292 | ata_init(); |
294 | settings_reset(); | 293 | settings_reset(); |
@@ -404,13 +403,12 @@ static void init(void) | |||
404 | button_init(); | 403 | button_init(); |
405 | 404 | ||
406 | powermgmt_init(); | 405 | powermgmt_init(); |
407 | 406 | ||
408 | #if CONFIG_TUNER | 407 | #if CONFIG_TUNER |
409 | radio_init(); | 408 | radio_init(); |
410 | #endif | 409 | #endif |
411 | 410 | ||
412 | /* Must be done before any code uses the multi-screen APi */ | 411 | /* Must be done before any code uses the multi-screen APi */ |
413 | screen_access_init(); | ||
414 | gui_syncstatusbar_init(&statusbars); | 412 | gui_syncstatusbar_init(&statusbars); |
415 | 413 | ||
416 | #if CONFIG_CHARGING && (CONFIG_CPU == SH7034) | 414 | #if CONFIG_CHARGING && (CONFIG_CPU == SH7034) |
@@ -448,11 +446,11 @@ static void init(void) | |||
448 | #ifdef HAVE_EEPROM_SETTINGS | 446 | #ifdef HAVE_EEPROM_SETTINGS |
449 | eeprom_settings_init(); | 447 | eeprom_settings_init(); |
450 | #endif | 448 | #endif |
451 | 449 | ||
452 | usb_start_monitoring(); | 450 | usb_start_monitoring(); |
453 | #ifndef HAVE_USBSTACK | 451 | #ifndef HAVE_USBSTACK |
454 | while (usb_detect() == USB_INSERTED) | 452 | while (usb_detect() == USB_INSERTED) |
455 | { | 453 | { |
456 | #ifdef HAVE_EEPROM_SETTINGS | 454 | #ifdef HAVE_EEPROM_SETTINGS |
457 | firmware_settings.disk_clean = false; | 455 | firmware_settings.disk_clean = false; |
458 | #endif | 456 | #endif |
@@ -517,7 +515,7 @@ static void init(void) | |||
517 | remove(TAGCACHE_STATEFILE); | 515 | remove(TAGCACHE_STATEFILE); |
518 | #endif | 516 | #endif |
519 | } | 517 | } |
520 | 518 | ||
521 | gui_sync_wps_init(); | 519 | gui_sync_wps_init(); |
522 | settings_apply(true); | 520 | settings_apply(true); |
523 | init_dircache(false); | 521 | init_dircache(false); |
diff --git a/apps/onplay.c b/apps/onplay.c index 9ca0c6743e..cfe1985eb9 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -674,8 +674,9 @@ static void draw_slider(void) | |||
674 | int i; | 674 | int i; |
675 | FOR_NB_SCREENS(i) | 675 | FOR_NB_SCREENS(i) |
676 | { | 676 | { |
677 | show_busy_slider(&screens[i], 1, LCD_HEIGHT-2*screens[i].char_height, | 677 | show_busy_slider(&screens[i], 1, |
678 | LCD_WIDTH-2, 2*screens[i].char_height-1); | 678 | LCD_HEIGHT-2*screens[i].getcharheight(), |
679 | LCD_WIDTH-2, 2*screens[i].getcharheight()-1); | ||
679 | screens[i].update(); | 680 | screens[i].update(); |
680 | } | 681 | } |
681 | } | 682 | } |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 62e755a53a..3b74406d37 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | /* The number of items between the selected one and the end/start of | 59 | /* The number of items between the selected one and the end/start of |
60 | * the buffer under which the buffer must reload */ | 60 | * the buffer under which the buffer must reload */ |
61 | #define MIN_BUFFER_MARGIN (screens[0].nb_lines+1) | 61 | #define MIN_BUFFER_MARGIN (screens[0].getnblines()+1) |
62 | 62 | ||
63 | /* Information about a specific track */ | 63 | /* Information about a specific track */ |
64 | struct playlist_entry { | 64 | struct playlist_entry { |
@@ -182,7 +182,7 @@ static void playlist_buffer_load_entries_screen(struct playlist_buffer * pb, | |||
182 | { | 182 | { |
183 | if(direction==FORWARD) | 183 | if(direction==FORWARD) |
184 | { | 184 | { |
185 | int min_start=viewer.selected_track-2*screens[0].nb_lines; | 185 | int min_start=viewer.selected_track-2*screens[0].getnblines(); |
186 | while(min_start<0) | 186 | while(min_start<0) |
187 | min_start+=viewer.num_tracks; | 187 | min_start+=viewer.num_tracks; |
188 | min_start %= viewer.num_tracks; | 188 | min_start %= viewer.num_tracks; |
@@ -190,7 +190,7 @@ static void playlist_buffer_load_entries_screen(struct playlist_buffer * pb, | |||
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | int max_start=viewer.selected_track+2*screens[0].nb_lines; | 193 | int max_start=viewer.selected_track+2*screens[0].getnblines(); |
194 | max_start%=viewer.num_tracks; | 194 | max_start%=viewer.num_tracks; |
195 | playlist_buffer_load_entries(pb, max_start, BACKWARD); | 195 | playlist_buffer_load_entries(pb, max_start, BACKWARD); |
196 | } | 196 | } |
diff --git a/apps/screen_access.c b/apps/screen_access.c index de59537770..2f928b7360 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -32,6 +32,73 @@ | |||
32 | 32 | ||
33 | #include "screen_access.h" | 33 | #include "screen_access.h" |
34 | 34 | ||
35 | /* some helper functions to calculate metrics on the fly */ | ||
36 | static int screen_helper_getcharwidth(void) | ||
37 | { | ||
38 | #ifdef HAVE_LCD_BITMAP | ||
39 | return font_get(lcd_getfont())->maxwidth; | ||
40 | #else | ||
41 | return 1; | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | static int screen_helper_getcharheight(void) | ||
46 | { | ||
47 | #ifdef HAVE_LCD_BITMAP | ||
48 | return font_get(lcd_getfont())->height; | ||
49 | #else | ||
50 | return 1; | ||
51 | #endif | ||
52 | } | ||
53 | |||
54 | static int screen_helper_getnblines(void) | ||
55 | { | ||
56 | int height=screens[0].lcdheight; | ||
57 | #ifdef HAVE_LCD_BITMAP | ||
58 | if(global_settings.statusbar) | ||
59 | height -= STATUSBAR_HEIGHT; | ||
60 | #ifdef HAVE_BUTTONBAR | ||
61 | if(global_settings.buttonbar && screens[0].has_buttonbar) | ||
62 | height -= BUTTONBAR_HEIGHT; | ||
63 | #endif | ||
64 | #endif | ||
65 | return height / screens[0].getcharheight(); | ||
66 | } | ||
67 | |||
68 | #if NB_SCREENS == 2 | ||
69 | static int screen_helper_remote_getcharwidth(void) | ||
70 | { | ||
71 | #ifdef HAVE_LCD_BITMAP | ||
72 | return font_get(lcd_remote_getfont())->maxwidth; | ||
73 | #else | ||
74 | return 1; | ||
75 | #endif | ||
76 | } | ||
77 | |||
78 | static int screen_helper_remote_getcharheight(void) | ||
79 | { | ||
80 | #ifdef HAVE_LCD_BITMAP | ||
81 | return font_get(lcd_remote_getfont())->height; | ||
82 | #else | ||
83 | return 1; | ||
84 | #endif | ||
85 | } | ||
86 | |||
87 | static int screen_helper_remote_getnblines(void) | ||
88 | { | ||
89 | int height=screens[1].lcdheight; | ||
90 | #ifdef HAVE_LCD_BITMAP | ||
91 | if(global_settings.statusbar) | ||
92 | height -= STATUSBAR_HEIGHT; | ||
93 | #ifdef HAVE_BUTTONBAR | ||
94 | if(global_settings.buttonbar && screens[0].has_buttonbar) | ||
95 | height -= BUTTONBAR_HEIGHT; | ||
96 | #endif | ||
97 | #endif | ||
98 | return height / screens[1].getcharheight(); | ||
99 | } | ||
100 | #endif | ||
101 | |||
35 | struct screen screens[NB_SCREENS] = | 102 | struct screen screens[NB_SCREENS] = |
36 | { | 103 | { |
37 | { | 104 | { |
@@ -39,6 +106,7 @@ struct screen screens[NB_SCREENS] = | |||
39 | .lcdwidth=LCD_WIDTH, | 106 | .lcdwidth=LCD_WIDTH, |
40 | .lcdheight=LCD_HEIGHT, | 107 | .lcdheight=LCD_HEIGHT, |
41 | .depth=LCD_DEPTH, | 108 | .depth=LCD_DEPTH, |
109 | .getnblines=&screen_helper_getnblines, | ||
42 | #if defined(HAVE_LCD_COLOR) | 110 | #if defined(HAVE_LCD_COLOR) |
43 | .is_color=true, | 111 | .is_color=true, |
44 | #else | 112 | #else |
@@ -47,6 +115,8 @@ struct screen screens[NB_SCREENS] = | |||
47 | #ifdef HAVE_LCD_BITMAP | 115 | #ifdef HAVE_LCD_BITMAP |
48 | .pixel_format=LCD_PIXELFORMAT, | 116 | .pixel_format=LCD_PIXELFORMAT, |
49 | #endif | 117 | #endif |
118 | .getcharwidth=screen_helper_getcharwidth, | ||
119 | .getcharheight=screen_helper_getcharheight, | ||
50 | #if (CONFIG_LED == LED_VIRTUAL) | 120 | #if (CONFIG_LED == LED_VIRTUAL) |
51 | .has_disk_led=false, | 121 | .has_disk_led=false, |
52 | #elif defined(HAVE_REMOTE_LCD) | 122 | #elif defined(HAVE_REMOTE_LCD) |
@@ -137,8 +207,11 @@ struct screen screens[NB_SCREENS] = | |||
137 | .lcdwidth=LCD_REMOTE_WIDTH, | 207 | .lcdwidth=LCD_REMOTE_WIDTH, |
138 | .lcdheight=LCD_REMOTE_HEIGHT, | 208 | .lcdheight=LCD_REMOTE_HEIGHT, |
139 | .depth=LCD_REMOTE_DEPTH, | 209 | .depth=LCD_REMOTE_DEPTH, |
210 | .getnblines=&screen_helper_remote_getnblines, | ||
140 | .is_color=false,/* No color remotes yet */ | 211 | .is_color=false,/* No color remotes yet */ |
141 | .pixel_format=LCD_REMOTE_PIXELFORMAT, | 212 | .pixel_format=LCD_REMOTE_PIXELFORMAT, |
213 | .getcharwidth=screen_helper_remote_getcharwidth, | ||
214 | .getcharheight=screen_helper_remote_getcharheight, | ||
142 | .has_disk_led=false, | 215 | .has_disk_led=false, |
143 | .set_viewport=&lcd_remote_set_viewport, | 216 | .set_viewport=&lcd_remote_set_viewport, |
144 | .getwidth=&lcd_remote_getwidth, | 217 | .getwidth=&lcd_remote_getwidth, |
@@ -219,32 +292,3 @@ void screen_clear_area(struct screen * display, int xstart, int ystart, | |||
219 | display->set_drawmode(DRMODE_SOLID); | 292 | display->set_drawmode(DRMODE_SOLID); |
220 | } | 293 | } |
221 | #endif | 294 | #endif |
222 | |||
223 | void screen_access_init(void) | ||
224 | { | ||
225 | int i; | ||
226 | struct screen *display; | ||
227 | FOR_NB_SCREENS(i) | ||
228 | { | ||
229 | display = &screens[i]; | ||
230 | #ifdef HAVE_LCD_BITMAP | ||
231 | ((struct screen*)&screens[i])->setfont(FONT_UI); | ||
232 | #endif | ||
233 | |||
234 | int height=display->lcdheight; | ||
235 | #ifdef HAVE_LCD_BITMAP | ||
236 | if(global_settings.statusbar) | ||
237 | height -= STATUSBAR_HEIGHT; | ||
238 | #ifdef HAVE_BUTTONBAR | ||
239 | if(global_settings.buttonbar && display->has_buttonbar) | ||
240 | height -= BUTTONBAR_HEIGHT; | ||
241 | #endif | ||
242 | display->getstringsize((unsigned char *)"A", &display->char_width, | ||
243 | &display->char_height); | ||
244 | #else | ||
245 | display->char_width = 1; | ||
246 | display->char_height = 1; | ||
247 | #endif | ||
248 | display->nb_lines = height / display->char_height; | ||
249 | } | ||
250 | } | ||
diff --git a/apps/screen_access.h b/apps/screen_access.h index d800c31489..c76d2b1c86 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -60,12 +60,12 @@ struct screen | |||
60 | enum screen_type screen_type; | 60 | enum screen_type screen_type; |
61 | int lcdwidth, lcdheight; | 61 | int lcdwidth, lcdheight; |
62 | int depth; | 62 | int depth; |
63 | int nb_lines; | 63 | int (*getnblines)(void); |
64 | #ifdef HAVE_LCD_BITMAP | 64 | #ifdef HAVE_LCD_BITMAP |
65 | int pixel_format; | 65 | int pixel_format; |
66 | #endif | 66 | #endif |
67 | int char_width; | 67 | int (*getcharwidth)(void); |
68 | int char_height; | 68 | int (*getcharheight)(void); |
69 | bool is_color; | 69 | bool is_color; |
70 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | 70 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
71 | bool has_disk_led; | 71 | bool has_disk_led; |
@@ -166,11 +166,6 @@ void screen_clear_area(struct screen * display, int xstart, int ystart, | |||
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * Initializes the whole screen_access api | ||
170 | */ | ||
171 | extern void screen_access_init(void); | ||
172 | |||
173 | /* | ||
174 | * exported screens array that should be used | 169 | * exported screens array that should be used |
175 | * by each app that wants to write to access display | 170 | * by each app that wants to write to access display |
176 | */ | 171 | */ |