updated the quickscreen's:

- use viewports
- dont change to system font, fiddle with item positions to make them fit small screens
- user customizable options (use the .cfg settings "quickscreen_left, quickscreen_right, quickscreen_top, quickscreen_bottom" for the name and the .cfg name for the setting you want to use. it can be any except the string settings... (e.g. quickscreen_left:talk menu)
- a top item! if there is none set the up button will exit the screen



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16220 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-02-05 05:50:20 +00:00
parent 47412cbc35
commit 2c82494e66
12 changed files with 371 additions and 400 deletions

View file

@ -636,158 +636,6 @@ bool pitch_screen(void)
}
#endif /* HAVE_PITCHSCREEN */
#ifdef HAVE_QUICKSCREEN
#define bool_to_int(b)\
b?1:0
#define int_to_bool(i)\
i==0?false:true
static void quick_screen_quick_apply(struct gui_quickscreen *qs)
{
global_settings.playlist_shuffle=int_to_bool(qs->left_option->option);
global_settings.dirfilter=qs->bottom_option->option;
global_settings.repeat_mode=qs->right_option->option;
}
bool quick_screen_quick(int button_enter)
{
bool res, oldshuffle;
struct option_select left_option;
struct option_select bottom_option;
struct option_select right_option;
int oldrepeat, old_x_margin, old_y_margin;
static const struct opt_items left_items[] = {
[0]={ STR(LANG_SYSFONT_OFF) },
[1]={ STR(LANG_SYSFONT_ON) }
};
static const struct opt_items bottom_items[] = {
[SHOW_ALL]={ STR(LANG_SYSFONT_ALL) },
[SHOW_SUPPORTED]={ STR(LANG_SYSFONT_FILTER_SUPPORTED) },
[SHOW_MUSIC]={ STR(LANG_SYSFONT_FILTER_MUSIC) },
[SHOW_PLAYLIST]={ STR(LANG_SYSFONT_FILTER_PLAYLIST) },
};
static const struct opt_items right_items[] = {
[REPEAT_OFF]={ STR(LANG_SYSFONT_OFF) },
[REPEAT_ALL]={ STR(LANG_SYSFONT_ALL) },
[REPEAT_ONE]={ STR(LANG_SYSFONT_REPEAT_ONE) },
[REPEAT_SHUFFLE]={ STR(LANG_SYSFONT_SHUFFLE) },
#ifdef AB_REPEAT_ENABLE
[REPEAT_AB]={ STR(LANG_SYSFONT_REPEAT_AB) }
#endif
};
struct gui_quickscreen qs;
old_x_margin = lcd_getxmargin();
old_y_margin = lcd_getymargin();
lcd_setmargins(0, 0);
option_select_init_items(&left_option,
(char *)str(LANG_SYSFONT_SHUFFLE),
bool_to_int(global_settings.playlist_shuffle),
left_items,
2);
option_select_init_items(&bottom_option,
(char *)str(LANG_SYSFONT_FILTER),
global_settings.dirfilter,
bottom_items,
sizeof(bottom_items)/sizeof(struct opt_items));
option_select_init_items(&right_option,
(char *)str(LANG_SYSFONT_REPEAT),
global_settings.repeat_mode,
right_items,
sizeof(right_items)/sizeof(struct opt_items));
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
&quick_screen_quick_apply);
oldrepeat=global_settings.repeat_mode;
oldshuffle=global_settings.playlist_shuffle;
res=gui_syncquickscreen_run(&qs, button_enter);
if(!res)
{
if ( oldrepeat != global_settings.repeat_mode &&
(audio_status() & AUDIO_STATUS_PLAY) )
audio_flush_and_reload_tracks();
if(oldshuffle != global_settings.playlist_shuffle
&& audio_status() & AUDIO_STATUS_PLAY)
{
#if CONFIG_CODEC == SWCODEC
dsp_set_replaygain();
#endif
if (global_settings.playlist_shuffle)
playlist_randomise(NULL, current_tick, true);
else
playlist_sort(NULL, true);
}
settings_save();
}
lcd_setmargins(old_x_margin, old_y_margin);
return(res);
}
#ifdef BUTTON_F3
static void quick_screen_f3_apply(struct gui_quickscreen *qs)
{
global_settings.scrollbar=int_to_bool(qs->left_option->option);
global_settings.flip_display=int_to_bool(qs->bottom_option->option);
button_set_flip(global_settings.flip_display);
lcd_set_flip(global_settings.flip_display);
global_settings.statusbar=int_to_bool(qs->right_option->option);
gui_syncstatusbar_draw(&statusbars, true);
}
bool quick_screen_f3(int button_enter)
{
bool res;
struct option_select left_option;
struct option_select bottom_option;
struct option_select right_option;
int old_x_margin, old_y_margin;
static const struct opt_items onoff_items[] = {
[0]={ STR(LANG_SYSFONT_OFF) },
[1]={ STR(LANG_SYSFONT_ON) }
};
static const struct opt_items yesno_items[] = {
[0]={ STR(LANG_SYSFONT_SET_BOOL_NO) },
[1]={ STR(LANG_SYSFONT_SET_BOOL_YES) }
};
struct gui_quickscreen qs;
old_x_margin = lcd_getxmargin();
old_y_margin = lcd_getymargin();
lcd_setmargins(0, 0);
option_select_init_items(&left_option,
str(LANG_SYSFONT_SCROLL_BAR),
bool_to_int(global_settings.scrollbar),
onoff_items,
2);
option_select_init_items(&bottom_option,
str(LANG_SYSFONT_FLIP_DISPLAY),
bool_to_int(global_settings.flip_display),
yesno_items,
2);
option_select_init_items(&right_option,
str(LANG_SYSFONT_STATUS_BAR),
bool_to_int(global_settings.statusbar),
onoff_items,
2);
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
&quick_screen_f3_apply);
res=gui_syncquickscreen_run(&qs, button_enter);
if(!res)
settings_save();
lcd_setmargins(old_x_margin, old_y_margin);
return(res);
}
#endif /* BUTTON_F3 */
#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */
#if CONFIG_CHARGING
void charging_splash(void)
{