diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-02-01 11:34:16 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-02-01 11:34:16 +0000 |
commit | 80cb3551eb61cdf240cf24ad0c44016475bf2e61 (patch) | |
tree | e9c72c90954b73807d64df59fefcdf0b1c1fc615 /apps/gui/viewport.c | |
parent | e55f2329c059434452c62af48903b4607e500e4e (diff) |
Statusbar handling fixes.
Fixes FS#9845 - %we/%wd wasnt working
WPS no longer resets the viewportmanger more than needed (was doing it twice/draw before)
screens can now enable/disable the statusbar easily ignoring the setting instead of needing special handling (fix for the radio screen coming soon)
minor glitch introduced in this commit... the statusbar in the WPS might disappear for a fraction of a second when it is entered, I need to track this down...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19894 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r-- | apps/gui/viewport.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 24ba652498..3854430521 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -35,7 +35,7 @@ #include "screen_access.h" #include "appevents.h" -static bool statusbar_enabled = true; +static char statusbar_enabled = VP_ALLSCREENS; int viewport_get_nb_lines(struct viewport *vp) { @@ -47,13 +47,19 @@ int viewport_get_nb_lines(struct viewport *vp) #endif } +static bool showing_bars(enum screen_type screen) +{ + if (statusbar_enabled&(1<<screen)) + return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4))); + return false; +} void viewport_set_defaults(struct viewport *vp, enum screen_type screen) { vp->x = 0; vp->width = screens[screen].lcdwidth; - vp->y = statusbar_enabled?gui_statusbar_height():0; + vp->y = showing_bars(screen)?gui_statusbar_height():0; vp->height = screens[screen].lcdheight - vp->y; #ifdef HAVE_LCD_BITMAP vp->drawmode = DRMODE_SOLID; @@ -87,17 +93,18 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen) } /* returns true if it was enabled BEFORE this call */ -bool viewportmanager_set_statusbar(bool enabled) +char viewportmanager_set_statusbar(char enabled) { - bool old = statusbar_enabled; - if (enabled -#ifdef HAVE_LCD_BITMAP - && global_settings.statusbar -#endif - ) + char old = statusbar_enabled; + if (enabled) { + int i; + FOR_NB_SCREENS(i) + { + if (showing_bars(i)) + gui_statusbar_draw(&statusbars.statusbars[i], true); + } add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars); - gui_syncstatusbar_draw(&statusbars, true); } else { @@ -110,8 +117,12 @@ bool viewportmanager_set_statusbar(bool enabled) void viewportmanager_draw_statusbars(void* data) { (void)data; - if (statusbar_enabled) - gui_syncstatusbar_draw(&statusbars, false); + int i; + FOR_NB_SCREENS(i) + { + if (showing_bars(i)) + gui_statusbar_draw(&statusbars.statusbars[i], false); + } } void viewportmanager_statusbar_changed(void* data) |