summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-03 22:39:27 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-03 22:39:27 +0000
commit218b31272e5afcb8f98a62974b46f4febbfde39c (patch)
tree3f2f6c9b3bb0bd2298d99e13f80c4125094077c4
parent04be8dd7fe5378e39efbf5edd9ad447d17aabc06 (diff)
downloadrockbox-218b31272e5afcb8f98a62974b46f4febbfde39c.tar.gz
rockbox-218b31272e5afcb8f98a62974b46f4febbfde39c.zip
Remove the wrapper around the wrapper (wps_data_load) and handle loading hardcoded wps in case of a broken file directly in wps.c.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22146 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/skin_engine.h8
-rw-r--r--apps/gui/skin_engine/wps_parser.c50
-rw-r--r--apps/gui/wps.c58
3 files changed, 55 insertions, 61 deletions
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 498444e8ea..1f5236fc15 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -37,11 +37,11 @@ bool gui_wps_display(struct gui_wps *gwps);
/* Do a update_type update of the skinned screen */
bool skin_update(struct gui_wps *gwps, unsigned int update_type);
-/* to setup up the wps-data from a format-buffer (isfile = false)
- from a (wps-)file (isfile = true)
- if buf == NULL it will load the hardcoded default
+/*
+ * setup up the skin-data from a format-buffer (isfile = false)
+ * or from a skinfile (isfile = true)
*/
-void skin_data_load(struct wps_data *wps_data,
+bool skin_data_load(struct wps_data *wps_data,
struct screen *display,
const char *buf,
bool isfile);
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 2c6d5ded95..1a903c98ec 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -1666,7 +1666,7 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
/* to setup up the wps-data from a format-buffer (isfile = false)
from a (wps-)file (isfile = true)*/
-static bool _skin_data_load(struct wps_data *wps_data,
+bool skin_data_load(struct wps_data *wps_data,
struct screen *display,
const char *buf,
bool isfile)
@@ -1815,54 +1815,6 @@ static bool _skin_data_load(struct wps_data *wps_data,
}
}
-void skin_data_load(struct wps_data *wps_data,
- struct screen *display,
- const char *buf,
- bool isfile)
-{
- bool loaded_ok = buf && _skin_data_load(wps_data, display, buf, isfile);
- if (!loaded_ok) /* load the hardcoded default */
- {
- /* set the default wps for the main-screen */
- if(display->screen_type == SCREEN_MAIN)
- {
-#if LCD_DEPTH > 1
- unload_wps_backdrop();
-#endif
- _skin_data_load(wps_data,
- display,
-#ifdef HAVE_LCD_BITMAP
- "%s%?it<%?in<%in. |>%it|%fn>\n"
- "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
- "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
- "\n"
- "%al%pc/%pt%ar[%pp:%pe]\n"
- "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
- "%pb\n"
- "%pm\n", false);
-#else
- "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
- "%pc%?ps<*|/>%pt\n", false);
-#endif
- }
-#ifdef HAVE_REMOTE_LCD
- /* set the default wps for the remote-screen */
- else if(display->screen_type == SCREEN_REMOTE)
- {
-#if LCD_REMOTE_DEPTH > 1
- unload_remote_wps_backdrop();
-#endif
- _skin_data_load(wps_data,
- display,
- "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
- "%s%?it<%?in<%in. |>%it|%fn>\n"
- "%al%pc/%pt%ar[%pp:%pe]\n"
- "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
- "%pb\n", false);
- }
-#endif
- }
-}
int wps_subline_index(struct wps_data *data, int line, int subline)
{
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index d62507e0b0..bce4db2b8a 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -73,6 +73,11 @@
/* in milliseconds */
#define DEFAULT_SKIP_TRESH 3000ul
+
+#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
+ /* 3% of 30min file == 54s step size */
+#define MIN_FF_REWIND_STEP 500
+
static int wpsbars;
/* currently only one wps_state is needed */
static struct wps_state wps_state;
@@ -85,14 +90,50 @@ static void track_changed_callback(void *param);
static void nextid3available_callback(void* param);
-
-#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
- /* 3% of 30min file == 54s step size */
-#define MIN_FF_REWIND_STEP 500
-
-void wps_data_load(enum screen_type screen, const char *buf, bool is_file)
+void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
{
- skin_data_load(gui_wps[screen].data, &screens[screen], buf, is_file);
+ bool loaded_ok = buf && skin_data_load(gui_wps[screen].data, &screens[screen], buf, isfile);
+ if (!loaded_ok) /* load the hardcoded default */
+ {
+ char *skin_buf[NB_SCREENS] = {
+#ifdef HAVE_LCD_BITMAP
+ "%s%?it<%?in<%in. |>%it|%fn>\n"
+ "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
+ "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n\n"
+ "%al%pc/%pt%ar[%pp:%pe]\n"
+ "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
+ "%pb\n%pm\n",
+#else
+ "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
+ "%pc%?ps<*|/>%pt\n",
+#endif
+#ifdef HAVE_REMOTE_LCD
+ "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
+ "%s%?it<%?in<%in. |>%it|%fn>\n"
+ "%al%pc/%pt%ar[%pp:%pe]\n"
+ "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
+ "%pb\n",
+#endif
+ };
+ skin_data_load(gui_wps[screen].data, &screens[screen],
+ skin_buf[screen], false);
+ /* set the default wps for the main-screen */
+ if(screen == SCREEN_MAIN)
+ {
+#if LCD_DEPTH > 1
+ unload_wps_backdrop();
+#endif
+ }
+#ifdef HAVE_REMOTE_LCD
+ /* set the default wps for the remote-screen */
+ else if(screen == SCREEN_REMOTE)
+ {
+#if LCD_REMOTE_DEPTH > 1
+ unload_remote_wps_backdrop();
+#endif
+ }
+#endif
+ }
#ifdef HAVE_REMOVE_LCD
gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN);
#endif
@@ -103,7 +144,8 @@ void wps_data_init(enum screen_type screen)
skin_data_init(gui_wps[screen].data);
}
-bool wps_fading_out = false;
+
+static bool wps_fading_out = false;
void fade(bool fade_in, bool updatewps)
{
int fp_global_vol = global_settings.volume << 8;