summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-01-26 20:14:42 +0000
committerThomas Martitz <kugel@rockbox.org>2010-01-26 20:14:42 +0000
commit5629d551d710bd57a1cef129ce5a69b76cbbdd12 (patch)
tree1196849b9a02ebf39fa5d6c33df1db9334aeead2
parent7a73a9cd4e882ebbc37831160ec18d0f251f14bd (diff)
downloadrockbox-5629d551d710bd57a1cef129ce5a69b76cbbdd12.zip
rockbox-5629d551d710bd57a1cef129ce5a69b76cbbdd12.tar.gz
rockbox-5629d551d710bd57a1cef129ce5a69b76cbbdd12.tar.bz2
rockbox-5629d551d710bd57a1cef129ce5a69b76cbbdd12.tar.xz
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
-rw-r--r--apps/gui/backdrop.c13
-rw-r--r--apps/gui/backdrop.h4
-rw-r--r--apps/gui/viewport.c6
-rw-r--r--apps/gui/wps.c3
-rw-r--r--apps/menu.c14
-rw-r--r--apps/menu.h2
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/pictureflow/pictureflow.c15
-rw-r--r--apps/screen_access.c2
-rw-r--r--apps/screen_access.h1
10 files changed, 45 insertions, 17 deletions
diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c
index c220d06..7e56dcb 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 b37071b..4083464 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 22eccc1..3c5249c 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 14fb848..a539498 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 88f0f3c..eb29b43 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 b386b7c..b5bab90 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 cf16eef..a7a6203 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 eab1d0a..b3f8144 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 19ab776..8267ce3 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 be62478..396a0d0 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)