Readjusted quickscreen code so that it now actually scales to larger LCDs. Get rid of 'left_right_text' argument - this also means that 'scroll bar' and 'status bar' look better in some languages.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9602 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
62ccbbb418
commit
a0a01b38e2
3 changed files with 34 additions and 34 deletions
|
@ -34,64 +34,64 @@ void gui_quickscreen_init(struct gui_quickscreen * qs,
|
|||
struct option_select *left_option,
|
||||
struct option_select *bottom_option,
|
||||
struct option_select *right_option,
|
||||
char * left_right_title,
|
||||
quickscreen_callback callback)
|
||||
{
|
||||
qs->left_option=left_option;
|
||||
qs->bottom_option=bottom_option;
|
||||
qs->right_option=right_option;
|
||||
qs->left_right_title=left_right_title;
|
||||
qs->callback=callback;
|
||||
}
|
||||
|
||||
void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
|
||||
{
|
||||
char buffer[30], line_text[40];
|
||||
#define PUTS_CENTER (display->height/2/font_h)
|
||||
#define PUTS_BOTTOM (display->height/font_h)
|
||||
#define PUTSXY_CENTER (display->height/2)
|
||||
#define PUTSXY_BOTTOM (display->height)
|
||||
|
||||
char buffer[30];
|
||||
const unsigned char *option;
|
||||
const unsigned char *title;
|
||||
const unsigned char *left_right_title;
|
||||
int w;
|
||||
int w, font_h;
|
||||
bool statusbar = global_settings.statusbar;
|
||||
#ifdef HAS_BUTTONBAR
|
||||
display->has_buttonbar=false;
|
||||
#endif
|
||||
gui_textarea_clear(display);
|
||||
display->setfont(FONT_SYSFIXED);
|
||||
left_right_title=(unsigned char *)qs->left_right_title;
|
||||
|
||||
/* Displays the icons */
|
||||
display->getstringsize("A", NULL, &font_h);
|
||||
|
||||
/* Displays the first line of text */
|
||||
option=(unsigned char *)option_select_get_text(qs->left_option, buffer,
|
||||
sizeof buffer);
|
||||
title=(unsigned char *)qs->left_option->title;
|
||||
snprintf(line_text, sizeof(line_text), "%s %s", title, left_right_title);
|
||||
display->puts_scroll(2, !statusbar, line_text);
|
||||
display->puts_scroll(2, 1+!statusbar, option);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1, 8, 7, 8);
|
||||
display->puts_scroll(2, PUTS_CENTER-4+!statusbar, title);
|
||||
display->puts_scroll(2, PUTS_CENTER-3+!statusbar, option);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1,
|
||||
PUTSXY_CENTER-(font_h*3), 7, 8);
|
||||
|
||||
/* Displays the second line of text */
|
||||
option=(unsigned char *)option_select_get_text(qs->right_option, buffer,
|
||||
sizeof buffer);
|
||||
title=(unsigned char *)qs->right_option->title;
|
||||
snprintf(line_text, sizeof(line_text), "%s %s", title, left_right_title);
|
||||
display->getstringsize(line_text, &w, NULL);
|
||||
display->getstringsize(title, &w, NULL);
|
||||
if(w > display->width - 8)
|
||||
{
|
||||
display->puts_scroll(2, 2+!statusbar, line_text);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1, 24, 7, 8);
|
||||
display->puts_scroll(2, PUTS_CENTER-2+!statusbar, title);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1,
|
||||
PUTSXY_CENTER-font_h, 7, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
display->putsxy(display->width - w - 12, 24, line_text);
|
||||
display->putsxy(display->width - w - 12, PUTSXY_CENTER-font_h, title);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
|
||||
display->width - 8, 24, 7, 8);
|
||||
display->width - 8, PUTSXY_CENTER-font_h, 7, 8);
|
||||
}
|
||||
display->getstringsize(option, &w, NULL);
|
||||
if(w > display->width)
|
||||
display->puts_scroll(0, 3+!statusbar, option);
|
||||
display->puts_scroll(0, PUTS_CENTER-1+!statusbar, option);
|
||||
else
|
||||
display->putsxy(display->width -w-12, 32, option);
|
||||
display->putsxy(display->width -w-12, PUTSXY_CENTER, option);
|
||||
|
||||
/* Displays the third line of text */
|
||||
option=(unsigned char *)option_select_get_text(qs->bottom_option, buffer,
|
||||
|
@ -100,16 +100,17 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
|
|||
|
||||
display->getstringsize(title, &w, NULL);
|
||||
if(w > display->width)
|
||||
display->puts_scroll(0, 4+!statusbar, line_text);
|
||||
display->puts_scroll(0, PUTS_BOTTOM-4+!statusbar, title);
|
||||
else
|
||||
display->putsxy(display->width/2-w/2, 40, title);
|
||||
display->putsxy(display->width/2-w/2, PUTSXY_BOTTOM-(font_h*3), title);
|
||||
|
||||
display->getstringsize(option, &w, NULL);
|
||||
if(w > display->width)
|
||||
display->puts_scroll(0, 5+!statusbar, option);
|
||||
display->puts_scroll(0, PUTS_BOTTOM-3+!statusbar, option);
|
||||
else
|
||||
display->putsxy(display->width/2-w/2, 48, option);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->width/2-4, 56, 7, 8);
|
||||
display->putsxy(display->width/2-w/2, PUTSXY_BOTTOM-(font_h*2), option);
|
||||
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->width/2-4,
|
||||
PUTSXY_BOTTOM-font_h, 7, 8);
|
||||
|
||||
gui_textarea_update(display);
|
||||
display->setfont(FONT_UI);
|
||||
|
|
|
@ -52,9 +52,10 @@
|
|||
#define QUICKSCREEN_QUIT BUTTON_MENU
|
||||
#define QUICKSCREEN_QUIT2 BUTTON_SELECT
|
||||
#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
|
||||
#define QUICKSCREEN_BOTTOM BUTTON_DOWN
|
||||
#define QUICKSCREEN_QUIT BUTTON_REC
|
||||
#define QUICKSCREEN_QUIT2 BUTTON_POWER
|
||||
#define QUICKSCREEN_BOTTOM BUTTON_DOWN
|
||||
#define QUICKSCREEN_BOTTOM_INV BUTTON_UP
|
||||
#define QUICKSCREEN_QUIT BUTTON_REC
|
||||
#define QUICKSCREEN_QUIT2 BUTTON_POWER
|
||||
#endif
|
||||
|
||||
struct gui_quickscreen;
|
||||
|
@ -69,7 +70,6 @@ struct gui_quickscreen
|
|||
struct option_select *left_option;
|
||||
struct option_select *bottom_option;
|
||||
struct option_select *right_option;
|
||||
char * left_right_title;
|
||||
quickscreen_callback *callback;
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,6 @@ void gui_quickscreen_init(struct gui_quickscreen * qs,
|
|||
struct option_select *left_option,
|
||||
struct option_select *bottom_option,
|
||||
struct option_select *right_option,
|
||||
char * left_right_title,
|
||||
quickscreen_callback *callback);
|
||||
/*
|
||||
* Draws the quickscreen on a given screen
|
||||
|
|
|
@ -525,7 +525,7 @@ bool quick_screen_quick(int button_enter)
|
|||
sizeof(right_items)/sizeof(struct opt_items));
|
||||
|
||||
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
|
||||
(char *)str(LANG_F2_MODE), &quick_screen_quick_apply);
|
||||
&quick_screen_quick_apply);
|
||||
oldrepeat=global_settings.repeat_mode;
|
||||
oldshuffle=global_settings.playlist_shuffle;
|
||||
res=gui_syncquickscreen_run(&qs, button_enter);
|
||||
|
@ -588,7 +588,7 @@ bool quick_screen_f3(int button_enter)
|
|||
struct gui_quickscreen qs;
|
||||
|
||||
option_select_init_items(&left_option,
|
||||
str(LANG_F3_SCROLL),
|
||||
str(LANG_SCROLL_BAR),
|
||||
bool_to_int(global_settings.scrollbar),
|
||||
onoff_items,
|
||||
2);
|
||||
|
@ -598,12 +598,12 @@ bool quick_screen_f3(int button_enter)
|
|||
yesno_items,
|
||||
2);
|
||||
option_select_init_items(&right_option,
|
||||
str(LANG_F3_STATUS),
|
||||
str(LANG_STATUS_BAR),
|
||||
bool_to_int(global_settings.statusbar),
|
||||
onoff_items,
|
||||
2);
|
||||
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
|
||||
str(LANG_F3_BAR), &quick_screen_f3_apply);
|
||||
&quick_screen_f3_apply);
|
||||
res=gui_syncquickscreen_run(&qs, button_enter);
|
||||
if(!res)
|
||||
settings_save();
|
||||
|
|
Loading…
Reference in a new issue