summaryrefslogtreecommitdiff
path: root/apps/gui/gwps.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-03-20 16:12:09 +0000
committerThomas Martitz <kugel@rockbox.org>2009-03-20 16:12:09 +0000
commitad59f6ed22b90a07cdd6bbb8a69591d0281033a4 (patch)
tree6c23c4538737c777804a5954206abd3cdb2834e1 /apps/gui/gwps.c
parentce6b116bc1c09b665e4a79272bc409b5e27f773e (diff)
downloadrockbox-ad59f6ed22b90a07cdd6bbb8a69591d0281033a4.tar.gz
rockbox-ad59f6ed22b90a07cdd6bbb8a69591d0281033a4.zip
Fix up statusbar drawing in the wps a bit, fixing most, if not all, (re-)draw issues.
a) remove the temporary work around in gui_wps_display b) let the wps-statusbars redraw if it's masked (i.e. WPS_REFRESH_ALL or WPS_REFRESH_STATUSBAR) c) fix a bug of mine, I attached re-fixing the bars to the wrong event d) unify the decision whether to draw bars at all e) some other style/code minor cleanups git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20400 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r--apps/gui/gwps.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 89b8bf1960..cbce0f5973 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -151,7 +151,7 @@ static void play_hop(int direction)
151#endif 151#endif
152} 152}
153 153
154void gwps_fix_statusbars(void) 154static void gwps_fix_statusbars(void)
155{ 155{
156#ifdef HAVE_LCD_BITMAP 156#ifdef HAVE_LCD_BITMAP
157 int i; 157 int i;
@@ -161,9 +161,11 @@ void gwps_fix_statusbars(void)
161 bool draw = false; 161 bool draw = false;
162 if (gui_wps[i].data->wps_sb_tag) 162 if (gui_wps[i].data->wps_sb_tag)
163 draw = gui_wps[i].data->show_sb_on_wps; 163 draw = gui_wps[i].data->show_sb_on_wps;
164 else if (global_settings.statusbar)
165 wpsbars |= VP_SB_ONSCREEN(i);
164 if (draw) 166 if (draw)
165 wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i)); 167 wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
166 } 168 }
167#else 169#else
168 wpsbars = VP_SB_ALLSCREENS; 170 wpsbars = VP_SB_ALLSCREENS;
169#endif 171#endif
@@ -188,6 +190,11 @@ static void gwps_leave_wps(void)
188 viewportmanager_set_statusbar(oldbars); 190 viewportmanager_set_statusbar(oldbars);
189} 191}
190 192
193void gwps_draw_statusbars(void)
194{
195 viewportmanager_set_statusbar(wpsbars);
196}
197
191/* The WPS can be left in two ways: 198/* The WPS can be left in two ways:
192 * a) call a function, which draws over the wps. In this case, the wps 199 * a) call a function, which draws over the wps. In this case, the wps
193 * will be still active (i.e. the below function didn't return) 200 * will be still active (i.e. the below function didn't return)
@@ -207,7 +214,6 @@ long gui_wps_show(void)
207 bool update_track = false; 214 bool update_track = false;
208 int i; 215 int i;
209 long last_left = 0, last_right = 0; 216 long last_left = 0, last_right = 0;
210
211 wps_state_init(); 217 wps_state_init();
212 218
213#ifdef HAVE_LCD_CHARCELLS 219#ifdef HAVE_LCD_CHARCELLS
@@ -685,7 +691,7 @@ long gui_wps_show(void)
685 691
686 if (restore && 692 if (restore &&
687 ((restoretimer == RESTORE_WPS_INSTANTLY) || 693 ((restoretimer == RESTORE_WPS_INSTANTLY) ||
688 TIME_AFTER(restore, current_tick))) 694 TIME_AFTER(current_tick, restoretimer)))
689 { 695 {
690 /* restore wps backrops and statusbars */ 696 /* restore wps backrops and statusbars */
691#if LCD_DEPTH > 1 697#if LCD_DEPTH > 1
@@ -694,7 +700,6 @@ long gui_wps_show(void)
694#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 700#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
695 show_remote_wps_backdrop(); 701 show_remote_wps_backdrop();
696#endif 702#endif
697 viewportmanager_set_statusbar(wpsbars);
698 restore = false; 703 restore = false;
699 restoretimer = RESTORE_WPS_INSTANTLY; 704 restoretimer = RESTORE_WPS_INSTANTLY;
700 if (gui_wps_display()) { 705 if (gui_wps_display()) {
@@ -751,22 +756,21 @@ static void statusbar_toggle_handler(void *data)
751{ 756{
752 (void)data; 757 (void)data;
753 int i; 758 int i;
754 bool draw = global_settings.statusbar; 759 gwps_fix_statusbars();
755 760
756 FOR_NB_SCREENS(i) 761 FOR_NB_SCREENS(i)
757 { 762 {
758 struct wps_viewport *vp = &gui_wps[i].data->viewports[0]; 763 struct viewport *vp = &gui_wps[i].data->viewports[0].vp;
759 if (gui_wps[i].data->wps_sb_tag) 764 bool draw = wpsbars & (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
760 draw = gui_wps[i].data->show_sb_on_wps;
761 if (!draw) 765 if (!draw)
762 { 766 {
763 vp->vp.y = 0; 767 vp->y = 0;
764 vp->vp.height = screens[i].lcdheight; 768 vp->height = screens[i].lcdheight;
765 } 769 }
766 else 770 else
767 { 771 {
768 vp->vp.y = STATUSBAR_HEIGHT; 772 vp->y = STATUSBAR_HEIGHT;
769 vp->vp.height = screens[i].lcdheight - STATUSBAR_HEIGHT; 773 vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
770 } 774 }
771 } 775 }
772} 776}