forked from len0rd/rockbox
fix the buttonbar in the browser and menus.
fix a problem where the menus wouldnt redraw when they should have when settings change git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16816 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
03b7532711
commit
be185a1eaf
4 changed files with 49 additions and 18 deletions
|
|
@ -63,15 +63,26 @@ void list_draw(struct screen *display, struct viewport *parent, struct gui_syncl
|
|||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
static struct viewport parent[NB_SCREENS];
|
||||
void list_init_viewports(void)
|
||||
void list_init_viewports(struct gui_synclist *list)
|
||||
{
|
||||
int i;
|
||||
struct viewport *vp;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
vp = &parent[i];
|
||||
viewport_set_defaults(vp, i);
|
||||
if (!list)
|
||||
viewport_set_defaults(vp, i);
|
||||
else if (list->parent[i] == vp)
|
||||
{
|
||||
viewport_set_defaults(vp, i);
|
||||
list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
|
||||
list->parent[i]->height = screens[i].height - list->parent[i]->y;
|
||||
}
|
||||
}
|
||||
#ifdef HAS_BUTTONBAR
|
||||
if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar)
|
||||
list->parent[0]->height -= BUTTONBAR_HEIGHT;
|
||||
#endif
|
||||
force_list_reinit = false;
|
||||
}
|
||||
#else
|
||||
|
|
@ -85,8 +96,9 @@ static struct viewport parent[NB_SCREENS] =
|
|||
.height = LCD_HEIGHT
|
||||
},
|
||||
};
|
||||
void list_init_viewports(void)
|
||||
void list_init_viewports(struct gui_synclist *list)
|
||||
{
|
||||
(void)list;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -135,14 +147,9 @@ void gui_synclist_init(struct gui_synclist * gui_list,
|
|||
else
|
||||
{
|
||||
gui_list->parent[i] = &parent[i];
|
||||
gui_list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
|
||||
gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y;
|
||||
#ifdef HAS_BUTTONBAR
|
||||
if (screens[i].has_buttonbar)
|
||||
gui_list->parent[i]->height -= BUTTONBAR_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
list_init_viewports(gui_list);
|
||||
gui_list->limit_scroll = false;
|
||||
gui_list->data=data;
|
||||
gui_list->scroll_all=scroll_all;
|
||||
|
|
@ -214,7 +221,6 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
|
|||
#ifdef HAS_BUTTONBAR
|
||||
static bool last_buttonbar = false;
|
||||
#endif
|
||||
|
||||
if (force_list_reinit ||
|
||||
#ifdef HAS_BUTTONBAR
|
||||
last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
|
||||
|
|
@ -222,7 +228,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
|
|||
last_list != gui_list ||
|
||||
gui_list->nb_items != last_count)
|
||||
{
|
||||
list_init_viewports();
|
||||
list_init_viewports(gui_list);
|
||||
force_list_reinit = false;
|
||||
}
|
||||
#ifdef HAS_BUTTONBAR
|
||||
|
|
@ -817,14 +823,20 @@ static char* simplelist_static_getname(int item, void * data, char *buffer)
|
|||
bool simplelist_show_list(struct simplelist_info *info)
|
||||
{
|
||||
struct gui_synclist lists;
|
||||
int action, old_line_count = simplelist_line_count;
|
||||
struct viewport vp[NB_SCREENS];
|
||||
int action, old_line_count = simplelist_line_count,i;
|
||||
char* (*getname)(int item, void * data, char *buffer);
|
||||
if (info->get_name)
|
||||
getname = info->get_name;
|
||||
else
|
||||
getname = simplelist_static_getname;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
viewport_set_defaults(&vp[i], i);
|
||||
}
|
||||
gui_synclist_init(&lists, getname, info->callback_data,
|
||||
info->scroll_all, info->selection_size, NULL);
|
||||
info->scroll_all, info->selection_size, vp);
|
||||
|
||||
if (info->title)
|
||||
gui_synclist_set_title(&lists, info->title, NOICON);
|
||||
if (info->get_icon)
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ extern void gui_list_screen_scroll_step(int ofs);
|
|||
extern void gui_list_screen_scroll_out_of_view(bool enable);
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
void list_init_viewports(void);
|
||||
void list_init_viewports(struct gui_synclist * lists);
|
||||
|
||||
extern void gui_synclist_init(
|
||||
struct gui_synclist * lists,
|
||||
|
|
|
|||
25
apps/menu.c
25
apps/menu.c
|
|
@ -296,19 +296,30 @@ void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_b
|
|||
}
|
||||
}
|
||||
#ifdef HAS_BUTTONBAR
|
||||
if (!hide_bars)
|
||||
if (!hide_bars && global_settings.buttonbar)
|
||||
parent[0].height -= BUTTONBAR_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool do_setting_from_menu(const struct menu_item_ex *temp)
|
||||
{
|
||||
int setting_id;
|
||||
int setting_id, oldval;
|
||||
const struct settings_list *setting = find_setting(
|
||||
temp->variable,
|
||||
&setting_id);
|
||||
char *title;
|
||||
char padded_title[MAX_PATH];
|
||||
int var_type = setting->flags&F_T_MASK;
|
||||
if (var_type == F_T_INT || var_type == F_T_UINT)
|
||||
{
|
||||
oldval = *(int*)setting->setting;
|
||||
}
|
||||
else if (var_type == F_T_BOOL)
|
||||
{
|
||||
oldval = *(bool*)setting->setting;
|
||||
}
|
||||
else
|
||||
oldval = 0;
|
||||
if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)
|
||||
title = temp->callback_and_desc->desc;
|
||||
else
|
||||
|
|
@ -339,6 +350,14 @@ bool do_setting_from_menu(const struct menu_item_ex *temp)
|
|||
|
||||
option_screen((struct settings_list *)setting,
|
||||
setting->flags&F_TEMPVAR, title);
|
||||
if (var_type == F_T_INT || var_type == F_T_UINT)
|
||||
{
|
||||
return oldval != *(int*)setting->setting;
|
||||
}
|
||||
else if (var_type == F_T_BOOL)
|
||||
{
|
||||
return oldval != *(bool*)setting->setting;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -548,9 +567,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (temp->flags&MENU_HAS_DESC &&
|
||||
temp->callback_and_desc->desc == ID2P(LANG_LANGUAGE))
|
||||
{
|
||||
init_default_menu_viewports(menu_vp, hide_bars);
|
||||
init_menu_lists(menu, &lists, selected, true, vps);
|
||||
}
|
||||
init_default_menu_viewports(menu_vp, hide_bars);
|
||||
|
||||
if (temp->flags&MENU_FUNC_CHECK_RETVAL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ void settings_apply(const bool read_disk)
|
|||
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
||||
enc_global_settings_apply();
|
||||
#endif
|
||||
list_init_viewports();
|
||||
list_init_viewports(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue