diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-08-03 22:39:27 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-08-03 22:39:27 +0000 |
commit | 218b31272e5afcb8f98a62974b46f4febbfde39c (patch) | |
tree | 3f2f6c9b3bb0bd2298d99e13f80c4125094077c4 | |
parent | 04be8dd7fe5378e39efbf5edd9ad447d17aabc06 (diff) | |
download | rockbox-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.h | 8 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_parser.c | 50 | ||||
-rw-r--r-- | apps/gui/wps.c | 58 |
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); | |||
37 | /* Do a update_type update of the skinned screen */ | 37 | /* Do a update_type update of the skinned screen */ |
38 | bool skin_update(struct gui_wps *gwps, unsigned int update_type); | 38 | bool skin_update(struct gui_wps *gwps, unsigned int update_type); |
39 | 39 | ||
40 | /* to setup up the wps-data from a format-buffer (isfile = false) | 40 | /* |
41 | from a (wps-)file (isfile = true) | 41 | * setup up the skin-data from a format-buffer (isfile = false) |
42 | if buf == NULL it will load the hardcoded default | 42 | * or from a skinfile (isfile = true) |
43 | */ | 43 | */ |
44 | void skin_data_load(struct wps_data *wps_data, | 44 | bool skin_data_load(struct wps_data *wps_data, |
45 | struct screen *display, | 45 | struct screen *display, |
46 | const char *buf, | 46 | const char *buf, |
47 | bool isfile); | 47 | 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) | |||
1666 | 1666 | ||
1667 | /* to setup up the wps-data from a format-buffer (isfile = false) | 1667 | /* to setup up the wps-data from a format-buffer (isfile = false) |
1668 | from a (wps-)file (isfile = true)*/ | 1668 | from a (wps-)file (isfile = true)*/ |
1669 | static bool _skin_data_load(struct wps_data *wps_data, | 1669 | bool skin_data_load(struct wps_data *wps_data, |
1670 | struct screen *display, | 1670 | struct screen *display, |
1671 | const char *buf, | 1671 | const char *buf, |
1672 | bool isfile) | 1672 | bool isfile) |
@@ -1815,54 +1815,6 @@ static bool _skin_data_load(struct wps_data *wps_data, | |||
1815 | } | 1815 | } |
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | void skin_data_load(struct wps_data *wps_data, | ||
1819 | struct screen *display, | ||
1820 | const char *buf, | ||
1821 | bool isfile) | ||
1822 | { | ||
1823 | bool loaded_ok = buf && _skin_data_load(wps_data, display, buf, isfile); | ||
1824 | if (!loaded_ok) /* load the hardcoded default */ | ||
1825 | { | ||
1826 | /* set the default wps for the main-screen */ | ||
1827 | if(display->screen_type == SCREEN_MAIN) | ||
1828 | { | ||
1829 | #if LCD_DEPTH > 1 | ||
1830 | unload_wps_backdrop(); | ||
1831 | #endif | ||
1832 | _skin_data_load(wps_data, | ||
1833 | display, | ||
1834 | #ifdef HAVE_LCD_BITMAP | ||
1835 | "%s%?it<%?in<%in. |>%it|%fn>\n" | ||
1836 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | ||
1837 | "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n" | ||
1838 | "\n" | ||
1839 | "%al%pc/%pt%ar[%pp:%pe]\n" | ||
1840 | "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" | ||
1841 | "%pb\n" | ||
1842 | "%pm\n", false); | ||
1843 | #else | ||
1844 | "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" | ||
1845 | "%pc%?ps<*|/>%pt\n", false); | ||
1846 | #endif | ||
1847 | } | ||
1848 | #ifdef HAVE_REMOTE_LCD | ||
1849 | /* set the default wps for the remote-screen */ | ||
1850 | else if(display->screen_type == SCREEN_REMOTE) | ||
1851 | { | ||
1852 | #if LCD_REMOTE_DEPTH > 1 | ||
1853 | unload_remote_wps_backdrop(); | ||
1854 | #endif | ||
1855 | _skin_data_load(wps_data, | ||
1856 | display, | ||
1857 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | ||
1858 | "%s%?it<%?in<%in. |>%it|%fn>\n" | ||
1859 | "%al%pc/%pt%ar[%pp:%pe]\n" | ||
1860 | "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" | ||
1861 | "%pb\n", false); | ||
1862 | } | ||
1863 | #endif | ||
1864 | } | ||
1865 | } | ||
1866 | 1818 | ||
1867 | int wps_subline_index(struct wps_data *data, int line, int subline) | 1819 | int wps_subline_index(struct wps_data *data, int line, int subline) |
1868 | { | 1820 | { |
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 @@ | |||
73 | /* in milliseconds */ | 73 | /* in milliseconds */ |
74 | #define DEFAULT_SKIP_TRESH 3000ul | 74 | #define DEFAULT_SKIP_TRESH 3000ul |
75 | 75 | ||
76 | |||
77 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | ||
78 | /* 3% of 30min file == 54s step size */ | ||
79 | #define MIN_FF_REWIND_STEP 500 | ||
80 | |||
76 | static int wpsbars; | 81 | static int wpsbars; |
77 | /* currently only one wps_state is needed */ | 82 | /* currently only one wps_state is needed */ |
78 | static struct wps_state wps_state; | 83 | static struct wps_state wps_state; |
@@ -85,14 +90,50 @@ static void track_changed_callback(void *param); | |||
85 | static void nextid3available_callback(void* param); | 90 | static void nextid3available_callback(void* param); |
86 | 91 | ||
87 | 92 | ||
88 | 93 | void wps_data_load(enum screen_type screen, const char *buf, bool isfile) | |
89 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | ||
90 | /* 3% of 30min file == 54s step size */ | ||
91 | #define MIN_FF_REWIND_STEP 500 | ||
92 | |||
93 | void wps_data_load(enum screen_type screen, const char *buf, bool is_file) | ||
94 | { | 94 | { |
95 | skin_data_load(gui_wps[screen].data, &screens[screen], buf, is_file); | 95 | bool loaded_ok = buf && skin_data_load(gui_wps[screen].data, &screens[screen], buf, isfile); |
96 | if (!loaded_ok) /* load the hardcoded default */ | ||
97 | { | ||
98 | char *skin_buf[NB_SCREENS] = { | ||
99 | #ifdef HAVE_LCD_BITMAP | ||
100 | "%s%?it<%?in<%in. |>%it|%fn>\n" | ||
101 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | ||
102 | "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n\n" | ||
103 | "%al%pc/%pt%ar[%pp:%pe]\n" | ||
104 | "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" | ||
105 | "%pb\n%pm\n", | ||
106 | #else | ||
107 | "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" | ||
108 | "%pc%?ps<*|/>%pt\n", | ||
109 | #endif | ||
110 | #ifdef HAVE_REMOTE_LCD | ||
111 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | ||
112 | "%s%?it<%?in<%in. |>%it|%fn>\n" | ||
113 | "%al%pc/%pt%ar[%pp:%pe]\n" | ||
114 | "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" | ||
115 | "%pb\n", | ||
116 | #endif | ||
117 | }; | ||
118 | skin_data_load(gui_wps[screen].data, &screens[screen], | ||
119 | skin_buf[screen], false); | ||
120 | /* set the default wps for the main-screen */ | ||
121 | if(screen == SCREEN_MAIN) | ||
122 | { | ||
123 | #if LCD_DEPTH > 1 | ||
124 | unload_wps_backdrop(); | ||
125 | #endif | ||
126 | } | ||
127 | #ifdef HAVE_REMOTE_LCD | ||
128 | /* set the default wps for the remote-screen */ | ||
129 | else if(screen == SCREEN_REMOTE) | ||
130 | { | ||
131 | #if LCD_REMOTE_DEPTH > 1 | ||
132 | unload_remote_wps_backdrop(); | ||
133 | #endif | ||
134 | } | ||
135 | #endif | ||
136 | } | ||
96 | #ifdef HAVE_REMOVE_LCD | 137 | #ifdef HAVE_REMOVE_LCD |
97 | gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); | 138 | gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); |
98 | #endif | 139 | #endif |
@@ -103,7 +144,8 @@ void wps_data_init(enum screen_type screen) | |||
103 | skin_data_init(gui_wps[screen].data); | 144 | skin_data_init(gui_wps[screen].data); |
104 | } | 145 | } |
105 | 146 | ||
106 | bool wps_fading_out = false; | 147 | |
148 | static bool wps_fading_out = false; | ||
107 | void fade(bool fade_in, bool updatewps) | 149 | void fade(bool fade_in, bool updatewps) |
108 | { | 150 | { |
109 | int fp_global_vol = global_settings.volume << 8; | 151 | int fp_global_vol = global_settings.volume << 8; |