Accept the last patch FS#10797 with a few changes by me (fixing side effects and adding the new backdrop_hide() to the multi screen api). It changes the hide_bars parameter to mean hide_theme.

This makes plugins show the menu backdrop in their backdrop so that they don't look like crap if you have an sbs and look more integrated. I've test about all plugins and all work fine.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24335 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-01-26 20:14:42 +00:00
parent 7a73a9cd4e
commit 5629d551d7
10 changed files with 45 additions and 17 deletions

View file

@ -124,6 +124,12 @@ void backdrop_show(enum backdrop_type bdrop)
show_skin_backdrop();
}
void backdrop_hide(void)
{
lcd_set_backdrop(NULL);
}
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
@ -201,4 +207,11 @@ void remote_backdrop_unload(enum backdrop_type bdrop)
}
void remote_backdrop_hide(void)
{
lcd_remote_set_backdrop(NULL);
}
#endif

View file

@ -35,6 +35,7 @@ enum backdrop_type {
bool backdrop_load(enum backdrop_type bdrop, const char*);
void backdrop_unload(enum backdrop_type bdrop);
void backdrop_show(enum backdrop_type bdrop);
void backdrop_hide(void);
#else /* LCD_DEPTH <= 1 || __PCTOOL__ */
@ -52,6 +53,7 @@ static inline void backdrop_show(enum backdrop_type bdrop)
(void)bdrop;
}
static inline void backdrop_hide(void) {}
#endif
#if defined(HAVE_REMOTE_LCD)
@ -60,6 +62,7 @@ static inline void backdrop_show(enum backdrop_type bdrop)
bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename);
void remote_backdrop_unload(enum backdrop_type bdrop);
void remote_backdrop_show(enum backdrop_type bdrop);
void remote_backdrop_hide(void);
#else
static inline
bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename)
@ -76,6 +79,7 @@ static inline void remote_backdrop_show(enum backdrop_type bdrop)
{
(void)bdrop;
}
static inline void remote_backdrop_hide(void) {}
#endif
#endif

View file

@ -89,6 +89,8 @@ static void toggle_theme(enum screen_type screen, bool force)
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false,
do_sbs_update_callback);
screens[screen].backdrop_show(BACKDROP_MAIN);
/* remove the left overs from the previous screen.
* could cause a tiny flicker. Redo your screen code if that happens */
if (!was_enabled[screen] || force)
@ -142,7 +144,11 @@ static void toggle_theme(enum screen_type screen, bool force)
else
{
FOR_NB_SCREENS(i)
{
screens[i].backdrop_hide();
screens[i].stop_scroll();
}
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
remove_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback);
#endif

View file

@ -611,6 +611,7 @@ static void gwps_enter_wps(void)
vp->bg_pattern = display->get_background();
}
#endif
display->backdrop_show(BACKDROP_SKIN_WPS);
skin_update(gwps, WPS_REFRESH_ALL);
}
}
@ -1180,8 +1181,6 @@ long gui_wps_show(void)
/* we remove the update delay since it's not very usable in the wps,
* e.g. during volume changing or ffwd/rewind */
sb_skin_set_update_delay(0);
FOR_NB_SCREENS(i)
gui_wps[i].display->backdrop_show(BACKDROP_SKIN_WPS);
wps_sync_data.do_full_update = update = false;
gwps_enter_wps();
}

View file

@ -335,7 +335,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp,
/* display a menu */
int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars)
struct viewport parent[NB_SCREENS], bool hide_theme)
{
int selected = start_selected? *start_selected : 0;
int action;
@ -344,7 +344,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
int ret = 0, i;
bool redraw_lists;
FOR_NB_SCREENS(i)
viewportmanager_theme_enable(i, !hide_bars, NULL);
viewportmanager_theme_enable(i, !hide_theme, NULL);
const struct menu_item_ex *menu_stack[MAX_MENUS];
int menu_stack_selected_item[MAX_MENUS];
@ -363,7 +363,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
menu = &main_menu_;
else menu = start_menu;
/* if hide_bars is true, assume parent has been fixed before passed into
/* if hide_theme is true, assume parent has been fixed before passed into
* this function, e.g. with viewport_set_defaults(parent, screen) */
init_menu_lists(menu, &lists, selected, true, parent);
vps = *(lists.parent);
@ -373,7 +373,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
#ifdef HAVE_BUTTONBAR
if (!hide_bars)
if (!hide_theme)
{
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);
@ -382,7 +382,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
while (!done)
{
redraw_lists = false;
if (!hide_bars)
if (!hide_theme)
{
#ifdef HAVE_BUTTONBAR
gui_buttonbar_draw(&buttonbar);
@ -551,7 +551,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
screens[i].scroll_stop(&vps[i]);
}
#ifdef HAVE_BUTTONBAR
if (!hide_bars)
if (!hide_theme)
{
gui_buttonbar_unset(&buttonbar);
gui_buttonbar_draw(&buttonbar);
@ -653,7 +653,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
break;
}
#ifdef HAVE_BUTTONBAR
if (!hide_bars)
if (!hide_theme)
{
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);

View file

@ -121,7 +121,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp,
If NULL it is ignored and the firs item starts selected
*/
int do_menu(const struct menu_item_ex *menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars);
struct viewport parent[NB_SCREENS], bool hide_theme);
/* In all the following macros the argument names are as follows:
- name: The name for the variable (so it can be used in a MAKE_MENU()

View file

@ -659,7 +659,7 @@ struct plugin_api {
/* menu */
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars);
struct viewport parent[NB_SCREENS], bool hide_theme);
/* scroll bar */
struct gui_syncstatusbar *statusbars;

View file

@ -2019,6 +2019,7 @@ void update_scroll_animation(void)
void cleanup(void *parameter)
{
(void) parameter;
int i;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif
@ -2029,6 +2030,8 @@ void cleanup(void *parameter)
#ifdef USEGSLIB
grey_release();
#endif
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_undo(i, false);
}
/**
@ -2076,7 +2079,7 @@ int settings_menu(void)
};
do {
selection=rb->do_menu(&settings_menu,&selection, NULL, false);
selection=rb->do_menu(&settings_menu,&selection, NULL, true);
switch(selection) {
case 0:
rb->set_bool("Show FPS", &show_fps);
@ -2168,7 +2171,7 @@ int main_menu(void)
#endif
"Settings", "Return", "Quit");
while (1) {
switch (rb->do_menu(&main_menu,&selection, NULL, false)) {
switch (rb->do_menu(&main_menu,&selection, NULL, true)) {
case PF_GOTO_WPS: /* WPS */
return -2;
#if PF_PLAYBACK_CAPABLE
@ -2732,11 +2735,11 @@ int main(void)
enum plugin_status plugin_start(const void *parameter)
{
int ret;
int ret, i;
(void) parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_enable(i, false, NULL);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ

View file

@ -202,6 +202,7 @@ struct screen screens[NB_SCREENS] =
.backdrop_load=&backdrop_load,
.backdrop_unload=&backdrop_unload,
.backdrop_show=&backdrop_show,
.backdrop_hide=&backdrop_hide,
#ifdef HAVE_BUTTONBAR
.has_buttonbar=false,
#endif
@ -288,6 +289,7 @@ struct screen screens[NB_SCREENS] =
.backdrop_load=&remote_backdrop_load,
.backdrop_unload=&remote_backdrop_unload,
.backdrop_show=&remote_backdrop_show,
.backdrop_hide=&remote_backdrop_hide,
#ifdef HAVE_BUTTONBAR
.has_buttonbar=false,
#endif

View file

@ -150,6 +150,7 @@ struct screen
bool (*backdrop_load)(enum backdrop_type bdrop, const char* filename);
void (*backdrop_unload)(enum backdrop_type bdrop);
void (*backdrop_show)(enum backdrop_type bdrop);
void (*backdrop_hide)(void);
};
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)