From 5629d551d710bd57a1cef129ce5a69b76cbbdd12 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 26 Jan 2010 20:14:42 +0000 Subject: 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 --- apps/gui/backdrop.c | 13 +++++++++++++ apps/gui/backdrop.h | 4 ++++ apps/gui/viewport.c | 6 ++++++ apps/gui/wps.c | 3 +-- apps/menu.c | 14 +++++++------- apps/menu.h | 2 +- apps/plugin.h | 2 +- apps/plugins/pictureflow/pictureflow.c | 15 +++++++++------ apps/screen_access.c | 2 ++ apps/screen_access.h | 1 + 10 files changed, 45 insertions(+), 17 deletions(-) diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c index c220d06493..7e56dcb7db 100644 --- a/apps/gui/backdrop.c +++ b/apps/gui/backdrop.c @@ -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 + + diff --git a/apps/gui/backdrop.h b/apps/gui/backdrop.h index b37071b5d4..4083464cee 100644 --- a/apps/gui/backdrop.h +++ b/apps/gui/backdrop.h @@ -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 diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 22eccc161f..3c5249cff9 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -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 diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 14fb848ebe..a5394981ae 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -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(); } diff --git a/apps/menu.c b/apps/menu.c index 88f0f3c529..eb29b43f3b 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -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); diff --git a/apps/menu.h b/apps/menu.h index b386b7ce4b..b5bab90981 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -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() diff --git a/apps/plugin.h b/apps/plugin.h index cf16eef94f..a7a6203e53 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -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; diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index eab1d0a00a..b3f81444bb 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -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 diff --git a/apps/screen_access.c b/apps/screen_access.c index 19ab77654e..8267ce3ecd 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -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 diff --git a/apps/screen_access.h b/apps/screen_access.h index be6247886e..396a0d0e88 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -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) -- cgit v1.2.3