forked from len0rd/rockbox
Fixed truncated option strings for numeric settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8043 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
be15957c24
commit
fd02642ee0
4 changed files with 12 additions and 8 deletions
|
@ -90,13 +90,14 @@ void option_select_prev(struct option_select * opt)
|
|||
opt->option-=opt->step;
|
||||
}
|
||||
|
||||
const char * option_select_get_text(struct option_select * opt, char * buffer)
|
||||
const char * option_select_get_text(struct option_select * opt, char * buffer,
|
||||
int buffersize)
|
||||
{
|
||||
if(opt->items)
|
||||
return(P2STR(opt->items[opt->option].string));
|
||||
if(!opt->formatter)
|
||||
snprintf(buffer, sizeof buffer,"%d %s", opt->option, opt->extra_string);
|
||||
snprintf(buffer, buffersize,"%d %s", opt->option, opt->extra_string);
|
||||
else
|
||||
opt->formatter(buffer, sizeof buffer, opt->option, opt->extra_string);
|
||||
opt->formatter(buffer, buffersize, opt->option, opt->extra_string);
|
||||
return(buffer);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,9 @@ extern void option_select_init_items(struct option_select * opt,
|
|||
* - buffer : a buffer to eventually format the option
|
||||
* Returns the selected option
|
||||
*/
|
||||
extern const char * option_select_get_text(struct option_select * opt, char * buffer);
|
||||
extern const char * option_select_get_text(struct option_select * opt,
|
||||
char * buffer,
|
||||
int buffersize);
|
||||
|
||||
/*
|
||||
* Selects the next value
|
||||
|
|
|
@ -66,14 +66,14 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
|
|||
|
||||
/* Displays the left's text */
|
||||
title=option_select_get_title(qs->left_option);
|
||||
option=option_select_get_text(qs->left_option, buffer);
|
||||
option=option_select_get_text(qs->left_option, buffer, sizeof buffer);
|
||||
display->putsxy(0, display->height/2 - h*2, title);
|
||||
display->putsxy(0, display->height/2 - h, qs->left_right_title);
|
||||
display->putsxy(0, display->height/2, option);
|
||||
|
||||
/* Displays the bottom's text */
|
||||
title=option_select_get_title(qs->bottom_option);
|
||||
option=option_select_get_text(qs->bottom_option, buffer);
|
||||
option=option_select_get_text(qs->bottom_option, buffer, sizeof buffer);
|
||||
display->getstringsize(title, &w, &h);
|
||||
display->putsxy((display->width-w)/2, display->height - h*2, title);
|
||||
display->getstringsize(option, &w, &h);
|
||||
|
@ -81,7 +81,7 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
|
|||
|
||||
/* Displays the right's text */
|
||||
title=option_select_get_title(qs->right_option);
|
||||
option=option_select_get_text(qs->right_option, buffer);
|
||||
option=option_select_get_text(qs->right_option, buffer, sizeof buffer);
|
||||
display->getstringsize(title,&w,&h);
|
||||
display->putsxy(display->width - w, display->height/2 - h*2, title);
|
||||
display->getstringsize(qs->left_right_title,&w,&h);
|
||||
|
|
|
@ -54,7 +54,8 @@ void gui_select_init_items(struct gui_select * select,
|
|||
void gui_select_draw(struct gui_select * select, struct screen * display)
|
||||
{
|
||||
char buffer[30];
|
||||
const char * selected=option_select_get_text(&(select->options), buffer);
|
||||
const char * selected=option_select_get_text(&(select->options), buffer,
|
||||
sizeof buffer);
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
screen_set_xmargin(display, 0);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue