diff options
| author | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-09-07 20:09:11 +0000 |
|---|---|---|
| committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-09-07 20:09:11 +0000 |
| commit | 3c1e9ca55892ae342c9efb396cd9f49f3d403a5a (patch) | |
| tree | 92b4bfa29308aae41843c47350b27385fae35b11 /apps/gui | |
| parent | e682143af578d9643f45712f0dcbcc13e94597d4 (diff) | |
| download | rockbox-3c1e9ca55892ae342c9efb396cd9f49f3d403a5a.zip rockbox-3c1e9ca55892ae342c9efb396cd9f49f3d403a5a.tar.gz rockbox-3c1e9ca55892ae342c9efb396cd9f49f3d403a5a.tar.bz2 rockbox-3c1e9ca55892ae342c9efb396cd9f49f3d403a5a.tar.xz | |
Change screens memebers char_width, char_height and nb_lines to functions returning a calculated value. Fixes FS #9361 because the values were calculated based on sysfont, not the user selected font.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18441 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
| -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 |
4 files changed, 38 insertions, 38 deletions
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index 2df030f..b1d0adc 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, int i; int lines; int start, end; - + display->set_viewport(NULL); - lines = display->nb_lines; - + lines = display->getnblines(); + display->clear_display(); start = 0; - end = display->nb_lines; + end = display->getnblines(); gui_list->last_displayed_start_item[display->screen_type] = gui_list->start_item[display->screen_type]; diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index d1ac2a9..eb44900 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, enough to display the selected slider - calculate total height of display with three sliders present */ display_three_rows = - display->getheight() >= MARGIN_TOP + - display->char_height*4 + /* Title + 3 sliders */ - TITLE_MARGIN_BOTTOM + - SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ - MARGIN_BOTTOM; + display->getheight() >= + MARGIN_TOP + + display->getcharheight()*4 + /* Title + 3 sliders */ + TITLE_MARGIN_BOTTOM + + SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ + MARGIN_BOTTOM; /* Figure out widest label character in case they vary - this function assumes labels are one character */ @@ -185,8 +186,8 @@ static void draw_screen(struct screen *display, char *title, slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + max_label_width + SLIDER_MARGIN_LEFT; slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - - display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH - - MARGIN_RIGHT; + display->getcharwidth()*2 - SELECTOR_LR_MARGIN - + SELECTOR_WIDTH - MARGIN_RIGHT; for (i = 0; i < 3; i++) { @@ -209,7 +210,7 @@ static void draw_screen(struct screen *display, char *title, display->fillrect(0, text_top - SELECTOR_TB_MARGIN, display->getwidth(), - display->char_height + + display->getcharheight() + SELECTOR_TB_MARGIN*2); if (display->depth < 16) @@ -221,7 +222,7 @@ static void draw_screen(struct screen *display, char *title, else if (display_three_rows) { /* Draw "> <" around sliders */ - int top = text_top + (display->char_height - + int top = text_top + (display->getcharheight() - SELECTOR_HEIGHT) / 2; screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); screen_put_iconxy(display, @@ -244,7 +245,7 @@ static void draw_screen(struct screen *display, char *title, /* Draw label */ buf[0] = str(LANG_COLOR_RGB_LABELS)[i]; buf[1] = '\0'; - display->putsxy(slider_left - display->char_width - + display->putsxy(slider_left - display->getcharwidth() - SLIDER_MARGIN_LEFT, text_top, buf); /* Draw color value */ @@ -255,24 +256,21 @@ static void draw_screen(struct screen *display, char *title, /* Draw scrollbar */ gui_scrollbar_draw(display, slider_left, - text_top + display->char_height / 4, + text_top + display->getcharheight() / 4, slider_width, - display->char_height / 2, + display->getcharheight() / 2, rgb_max[i], 0, rgb->rgb_val[i], sb_flags); /* Advance to next line */ - text_top += display->char_height + 2*SELECTOR_TB_MARGIN; + text_top += display->getcharheight() + 2*SELECTOR_TB_MARGIN; if (!display_three_rows) break; } /* end for */ - /* Draw color value in system font */ - display->setfont(FONT_SYSFIXED); - /* Format RGB: #rrggbb */ snprintf(buf, sizeof(buf), str(LANG_COLOR_RGB_VALUE), rgb->red, rgb->green, rgb->blue); @@ -287,7 +285,7 @@ static void draw_screen(struct screen *display, char *title, int height = display->getheight() - top - MARGIN_BOTTOM; /* Only draw if room */ - if (height >= display->char_height + 2) + if (height >= display->getcharheight() + 2) { display->set_foreground(rgb->color); display->fillrect(left, top, width, height); @@ -357,19 +355,21 @@ static int touchscreen_slider(struct rgb_pick *rgb, int *selected_slider) max_label_width = x1; } /* Get slider positions and top starting position */ - text_top = MARGIN_TOP + display->char_height + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; + text_top = MARGIN_TOP + display->getcharheight() + TITLE_MARGIN_BOTTOM + + SELECTOR_TB_MARGIN; slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + max_label_width + SLIDER_MARGIN_LEFT; slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - - display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH - - MARGIN_RIGHT; + display->getcharwidth()*2 - SELECTOR_LR_MARGIN - + SELECTOR_WIDTH - MARGIN_RIGHT; display_three_rows = - display->getheight() >= MARGIN_TOP + - display->char_height*4 + /* Title + 3 sliders */ - TITLE_MARGIN_BOTTOM + - SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ - MARGIN_BOTTOM; - if (y < MARGIN_TOP+display->char_height) + display->getheight() >= + MARGIN_TOP + + display->getcharheight()*4 + /* Title + 3 sliders */ + TITLE_MARGIN_BOTTOM + + SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ + MARGIN_BOTTOM; + if (y < MARGIN_TOP+display->getcharheight()) { if (button == BUTTON_REL) return ACTION_STD_CANCEL; diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 2a568af..c4f78f4 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) display->clear_display(); - if (display->nb_lines < 4) /* very small screen, just show the pitch value */ + if (display->getnblines() < 4) /* very small screen, just show pitch value*/ { w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), pitch / 10, pitch % 10 ); - display->putsxy((display->lcdwidth-(w*display->char_width))/2, - display->nb_lines/2,buf); + display->putsxy((display->lcdwidth-(w*display->getcharwidth()))/2, + display->getnblines()/2,buf); } else /* bigger screen, show everything... */ { @@ -242,7 +242,7 @@ bool pitch_screen(void) nudged = (new_pitch != pitch); pitch = new_pitch; break; - + case ACTION_PS_NUDGE_LEFTOFF: if (nudged) { pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); @@ -268,7 +268,7 @@ bool pitch_screen(void) return 1; break; } - + if(delta) { if (pitch_mode == PITCH_MODE_ABSOLUTE) { @@ -276,10 +276,10 @@ bool pitch_screen(void) } else { pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false); } - + delta = 0; } - + } #if CONFIG_CODEC == SWCODEC pcmbuf_set_low_latency(false); diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 4e55dfe..9c850b7 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -207,7 +207,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs, value = option_get_valuestring((struct settings_list*)qs->items[i], buf, MAX_PATH, temp); - if (vps[screen][i].height < display->char_height*2) + if (vps[screen][i].height < display->getcharheight()*2) { char text[MAX_PATH]; snprintf(text, MAX_PATH, "%s: %s", title, value); |