diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-19 15:28:15 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-19 15:28:15 +0000 |
commit | 1016ee4e809776619fa9e4e773ceb1523bd7bc66 (patch) | |
tree | 585cd873c118bee7c2459205e6eb54ff3e76a21b /apps/gui/wps.c | |
parent | 00695baac0b797cbe46e7bc2999a83f73b36aae8 (diff) | |
download | rockbox-1016ee4e809776619fa9e4e773ceb1523bd7bc66.tar.gz rockbox-1016ee4e809776619fa9e4e773ceb1523bd7bc66.zip |
Initial custom statusbar commit.
The custom statusbar can be used as a WPS for the main UI, using .(r)sbs files. It's using the skin engine and knows all tags the WPS also knows.
The default folder for .sbs is the wps folder to reuse images used in the WPS.
As it can be shown in the WPS also, it's useful to move shared parts to the custom statusbar in order to save skin buffer space.
There are a few restrictions/TODOs:
*) Peak meter doesn't redraw nicely(not frequent enough), as very frequent updates would slow the UI down as hell (some targets fight with it in the WPS already: FS#10686)
*) No touchregion support as the statusbar doesn't have any action handling (it won't fail to parse though).
*) Drawing stuff into the default VP is forbidden (loading images in it is not). You *need* to use viewports for the displaying stuff (parsing fails if no viewport is used).
*) Themes that don't use a custom ui viewport can be fixed up using the new %Vi tag to avoid nasty redraw effectts (you must not draw into it as well, it's used to fix up the ui viewport). %Vi describes the viewport that the lists can use without getting in the way of the statusbar.
Otherwise, it behaves like the classic statusbar, it can be configured in the theme settings, and can be turned off in the wps using %wd.
Note to translaters: When translating LANG_STATUSBAR_CUSTOM, please consider using the same translation as for LANG_CHANNEL_CUSTOM if it's compatible. They could be combined later then.
Flyspray: FS#10566
Author: myself
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23258 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r-- | apps/gui/wps.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index a74e3d449d..11ce946e98 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "action.h" | 31 | #include "action.h" |
32 | #include "kernel.h" | 32 | #include "kernel.h" |
33 | #include "filetypes.h" | 33 | #include "filetypes.h" |
34 | #include "debug.h" | ||
35 | #include "sprintf.h" | 34 | #include "sprintf.h" |
36 | #include "settings.h" | 35 | #include "settings.h" |
37 | #include "skin_engine/skin_engine.h" | 36 | #include "skin_engine/skin_engine.h" |
@@ -67,6 +66,7 @@ | |||
67 | #include "dsp.h" | 66 | #include "dsp.h" |
68 | #include "playlist_viewer.h" | 67 | #include "playlist_viewer.h" |
69 | #include "wps.h" | 68 | #include "wps.h" |
69 | #include "statusbar-skinned.h" | ||
70 | 70 | ||
71 | #define RESTORE_WPS_INSTANTLY 0l | 71 | #define RESTORE_WPS_INSTANTLY 0l |
72 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) | 72 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) |
@@ -82,7 +82,7 @@ | |||
82 | static int wpsbars = 0; | 82 | static int wpsbars = 0; |
83 | 83 | ||
84 | /* currently only one wps_state is needed, initialize to 0 */ | 84 | /* currently only one wps_state is needed, initialize to 0 */ |
85 | static struct wps_state wps_state = { .id3 = NULL }; | 85 | struct wps_state wps_state = { .id3 = NULL }; |
86 | static struct gui_wps gui_wps[NB_SCREENS] = {{ .data = NULL }}; | 86 | static struct gui_wps gui_wps[NB_SCREENS] = {{ .data = NULL }}; |
87 | static struct wps_data wps_datas[NB_SCREENS] = {{ .wps_loaded = 0 }}; | 87 | static struct wps_data wps_datas[NB_SCREENS] = {{ .wps_loaded = 0 }}; |
88 | 88 | ||
@@ -129,8 +129,8 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile) | |||
129 | 129 | ||
130 | #endif /* __PCTOOL__ */ | 130 | #endif /* __PCTOOL__ */ |
131 | 131 | ||
132 | loaded_ok = buf && skin_data_load(gui_wps[screen].data, | 132 | loaded_ok = buf && skin_data_load(gui_wps[screen].data, buf, isfile); |
133 | &screens[screen], buf, isfile); | 133 | |
134 | if (!loaded_ok) /* load the hardcoded default */ | 134 | if (!loaded_ok) /* load the hardcoded default */ |
135 | { | 135 | { |
136 | char *skin_buf[NB_SCREENS] = { | 136 | char *skin_buf[NB_SCREENS] = { |
@@ -153,11 +153,11 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile) | |||
153 | "%pb\n", | 153 | "%pb\n", |
154 | #endif | 154 | #endif |
155 | }; | 155 | }; |
156 | skin_data_load(gui_wps[screen].data, &screens[screen], | 156 | skin_data_load(gui_wps[screen].data, skin_buf[screen], false); |
157 | skin_buf[screen], false); | ||
158 | } | 157 | } |
159 | #ifdef HAVE_REMOVE_LCD | 158 | #ifdef HAVE_REMOVE_LCD |
160 | gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); | 159 | gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); |
160 | |||
161 | #endif | 161 | #endif |
162 | } | 162 | } |
163 | 163 | ||
@@ -587,6 +587,8 @@ static void gwps_leave_wps(void) | |||
587 | /* Play safe and unregister the hook */ | 587 | /* Play safe and unregister the hook */ |
588 | lcd_activation_set_hook(NULL); | 588 | lcd_activation_set_hook(NULL); |
589 | #endif | 589 | #endif |
590 | /* unhandle statusbar update delay */ | ||
591 | sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY); | ||
590 | send_event(GUI_EVENT_REFRESH, NULL); | 592 | send_event(GUI_EVENT_REFRESH, NULL); |
591 | } | 593 | } |
592 | 594 | ||
@@ -739,7 +741,6 @@ long gui_wps_show(void) | |||
739 | #endif | 741 | #endif |
740 | } | 742 | } |
741 | } | 743 | } |
742 | |||
743 | #ifdef HAVE_LCD_BITMAP | 744 | #ifdef HAVE_LCD_BITMAP |
744 | /* when the peak meter is enabled we want to have a | 745 | /* when the peak meter is enabled we want to have a |
745 | few extra updates to make it look smooth. On the | 746 | few extra updates to make it look smooth. On the |
@@ -1175,7 +1176,13 @@ long gui_wps_show(void) | |||
1175 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); | 1176 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); |
1176 | } | 1177 | } |
1177 | } | 1178 | } |
1178 | wps_state.do_full_update = false; | 1179 | /* currently skinned statusbar and wps share the same wps_state, |
1180 | * don't steal do_full_update away */ | ||
1181 | if (wps_state.do_full_update) | ||
1182 | { | ||
1183 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); | ||
1184 | wps_state.do_full_update = false; | ||
1185 | } | ||
1179 | update = false; | 1186 | update = false; |
1180 | } | 1187 | } |
1181 | 1188 | ||
@@ -1188,6 +1195,9 @@ long gui_wps_show(void) | |||
1188 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1195 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1189 | lcd_activation_set_hook(wps_lcd_activation_hook); | 1196 | lcd_activation_set_hook(wps_lcd_activation_hook); |
1190 | #endif | 1197 | #endif |
1198 | /* we remove the update delay since it's not very usable in the wps, | ||
1199 | * e.g. during volume changing or ffwd/rewind */ | ||
1200 | sb_skin_set_update_delay(0); | ||
1191 | FOR_NB_SCREENS(i) | 1201 | FOR_NB_SCREENS(i) |
1192 | { | 1202 | { |
1193 | screens[i].stop_scroll(); | 1203 | screens[i].stop_scroll(); |