summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-07-08 00:51:03 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-07-08 00:51:03 +0000
commita06f6eedae542afc48cf0aa5e30b4647e18547a2 (patch)
tree1b14ae67f85e37e9ed4186094c2cf5de8c8b453b
parent008f611bca3173e21027a568540281c0d7d03ef2 (diff)
cleanup the remote+main statusbar handling a bit, and fix the bug where the remote wps might reserve the space for the statusbar even if its disabled
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21709 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps.c12
-rw-r--r--apps/gui/statusbar.c17
-rw-r--r--apps/gui/statusbar.h5
-rw-r--r--apps/gui/viewport.c17
-rw-r--r--apps/gui/wps_parser.c22
5 files changed, 32 insertions, 41 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 64b8939ee9..95cca5c117 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -245,8 +245,8 @@ static void gwps_fix_statusbars(void)
bool draw = false;
if (gui_wps[i].data->wps_sb_tag)
draw = gui_wps[i].data->show_sb_on_wps;
- else if (global_settings.statusbar)
- wpsbars |= VP_SB_ONSCREEN(i);
+ else if (statusbar_position(i) != STATUSBAR_OFF)
+ draw = true;
if (draw)
wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
}
@@ -937,13 +937,7 @@ static void statusbar_toggle_handler(void *data)
}
else
{
- bool bar_at_top = true;
-#ifdef HAVE_REMOTE_LCD
- if (i == SCREEN_REMOTE)
- bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
- else
-#endif
- bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
+ bool bar_at_top = statusbar_position(i) != STATUSBAR_BOTTOM;
vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
}
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index dca4169603..47dcb4ead1 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -263,17 +263,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
{
struct viewport vp;
- bool bar_at_top = true;
viewport_set_defaults(&vp, display->screen_type);
vp.height = STATUSBAR_HEIGHT;
vp.x = STATUSBAR_X_POS;
-#ifdef HAVE_REMOTE_LCD
- if (display->screen_type == SCREEN_REMOTE)
- bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
- else
-#endif
- bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
- if (bar_at_top)
+ if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM)
vp.y = 0;
else
vp.y = display->lcdheight - STATUSBAR_HEIGHT;
@@ -829,3 +822,11 @@ void gui_statusbar_changed(int enabled)
(void)enabled;
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
}
+#ifdef HAVE_REMOTE_LCD
+int statusbar_position(int screen)
+{
+ if (screen == SCREEN_REMOTE)
+ return global_settings.remote_statusbar;
+ return global_settings.statusbar;
+}
+#endif
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index db0ff9d780..f346c92f5a 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -99,5 +99,10 @@ struct gui_syncstatusbar
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
void gui_statusbar_changed(int enabled);
+#ifndef HAVE_REMOTE_LCD
+#define statusbar_position(a) (global_settings.statusbar)
+#else
+int statusbar_position(int screen);
+#endif
#endif /*_GUI_STATUSBAR_H_*/
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 81baf1eab6..d635c10481 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -53,11 +53,7 @@ static bool showing_bars(enum screen_type screen)
{
#ifdef HAVE_LCD_BITMAP
bool ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen);
-#ifdef HAVE_REMOTE_LCD
- if (screen == SCREEN_REMOTE)
- return global_settings.remote_statusbar || ignore;
-#endif
- return global_settings.statusbar || ignore;
+ return ignore || (statusbar_position(screen));
#else
return true;
#endif
@@ -67,24 +63,15 @@ static bool showing_bars(enum screen_type screen)
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{
-#ifdef HAVE_LCD_BITMAP
- bool bar_at_top = true;
-#endif
vp->x = 0;
vp->width = screens[screen].lcdwidth;
#ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID;
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
-#ifdef HAVE_REMOTE_LCD
- if (screen == SCREEN_REMOTE)
- bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
- else
-#endif
- bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
vp->height = screens[screen].lcdheight;
- if (bar_at_top && showing_bars(screen))
+ if (statusbar_position(screen) != STATUSBAR_BOTTOM && showing_bars(screen))
vp->y = STATUSBAR_HEIGHT;
else
vp->y = 0;
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 14c8d30c6a..09bcab8443 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -1682,16 +1682,20 @@ bool wps_data_load(struct wps_data *wps_data,
/* Initialise the first (default) viewport */
wps_data->viewports[0].vp.x = 0;
wps_data->viewports[0].vp.width = display->getwidth();
- if (!global_settings.statusbar)
+ wps_data->viewports[0].vp.height = display->getheight();
+ switch (statusbar_position(display->screen_type))
{
- wps_data->viewports[0].vp.y = 0;
- wps_data->viewports[0].vp.height = display->getheight();
- }
- else
- {
- wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
- wps_data->viewports[0].vp.height = display->getheight() -
- STATUSBAR_HEIGHT;
+ case STATUSBAR_OFF:
+ wps_data->viewports[0].vp.y = 0;
+ break;
+ case STATUSBAR_TOP:
+ wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
+ wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
+ break;
+ case STATUSBAR_BOTTOM:
+ wps_data->viewports[0].vp.y = 0;
+ wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
+ break;
}
#ifdef HAVE_LCD_BITMAP
wps_data->viewports[0].vp.font = FONT_UI;