summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-03 15:06:30 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-03 15:06:30 +0000
commit3b75c86d74937a6bffcb371bb08bdfb182db9d2b (patch)
tree3be12a89b7a5377a31a46b48e672e08af36ac949 /apps/gui
parent0dc5cc8002e3d30fc7ae7ddf7f33a56c8b136e7e (diff)
downloadrockbox-3b75c86d74937a6bffcb371bb08bdfb182db9d2b.tar.gz
rockbox-3b75c86d74937a6bffcb371bb08bdfb182db9d2b.zip
A bit mroe wps/skin engine cleanup so that the structs the wps uses can be static:
-add wrappers wps_data_load() and wps_data_init() so that other code doesn't need the structs for that -change (and rename) gui_sync_wps_uses_albumart() to take points to be filled as parameter to get the AA size of a wps git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22139 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/skin_engine/skin_engine.h11
-rw-r--r--apps/gui/skin_engine/wps_internals.h7
-rw-r--r--apps/gui/skin_engine/wps_parser.c12
-rw-r--r--apps/gui/wps.c30
-rw-r--r--apps/gui/wps.h13
5 files changed, 45 insertions, 28 deletions
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 00232a327a..498444e8ea 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -30,11 +30,6 @@
30int wps_get_touchaction(struct wps_data *data); 30int wps_get_touchaction(struct wps_data *data);
31#endif 31#endif
32 32
33#ifdef HAVE_ALBUMART
34/* gives back if WPS contains an albumart tag */
35bool gui_sync_wps_uses_albumart(void);
36#endif
37
38/* setup and display a WPS for the first time */ 33/* setup and display a WPS for the first time */
39bool gui_wps_display(struct gui_wps *gwps); 34bool gui_wps_display(struct gui_wps *gwps);
40 35
@@ -52,8 +47,6 @@ void skin_data_load(struct wps_data *wps_data,
52 bool isfile); 47 bool isfile);
53 48
54 49
55 50/* initial setup of wps_data */
56 51void skin_data_init(struct wps_data *wps_data);
57
58
59#endif 52#endif
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 2dcaa504bb..c00a4f1945 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -470,9 +470,6 @@ struct wps_data
470 unsigned int button_time_volume; 470 unsigned int button_time_volume;
471}; 471};
472 472
473/* initial setup of wps_data */
474void wps_data_init(struct wps_data *wps_data);
475
476 473
477/* Redraw statusbars if necessary */ 474/* Redraw statusbars if necessary */
478void gwps_draw_statusbars(void); 475void gwps_draw_statusbars(void);
@@ -536,10 +533,6 @@ struct gui_wps
536/* gui_wps end */ 533/* gui_wps end */
537 534
538 535
539/* currently only on wps_state is needed */
540extern struct wps_state wps_state;
541extern struct gui_wps gui_wps[NB_SCREENS];
542
543/***** wps_tokens.c ******/ 536/***** wps_tokens.c ******/
544 537
545const char *get_token_value(struct gui_wps *gwps, 538const char *get_token_value(struct gui_wps *gwps,
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index a3e5f6861d..2c6d5ded95 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -1552,7 +1552,7 @@ static void wps_images_clear(struct wps_data *data)
1552#endif 1552#endif
1553 1553
1554/* initial setup of wps_data */ 1554/* initial setup of wps_data */
1555void wps_data_init(struct wps_data *wps_data) 1555void skin_data_init(struct wps_data *wps_data)
1556{ 1556{
1557#ifdef HAVE_LCD_BITMAP 1557#ifdef HAVE_LCD_BITMAP
1558 wps_images_clear(wps_data); 1558 wps_images_clear(wps_data);
@@ -1581,7 +1581,7 @@ static void wps_reset(struct wps_data *data)
1581 bool rwps = data->remote_wps; /* remember whether the data is for a RWPS */ 1581 bool rwps = data->remote_wps; /* remember whether the data is for a RWPS */
1582#endif 1582#endif
1583 memset(data, 0, sizeof(*data)); 1583 memset(data, 0, sizeof(*data));
1584 wps_data_init(data); 1584 skin_data_init(data);
1585#ifdef HAVE_REMOTE_LCD 1585#ifdef HAVE_REMOTE_LCD
1586 data->remote_wps = rwps; 1586 data->remote_wps = rwps;
1587#endif 1587#endif
@@ -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)*/
1669static bool wps_data_load(struct wps_data *wps_data, 1669static 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)
@@ -1820,7 +1820,7 @@ void skin_data_load(struct wps_data *wps_data,
1820 const char *buf, 1820 const char *buf,
1821 bool isfile) 1821 bool isfile)
1822{ 1822{
1823 bool loaded_ok = buf && wps_data_load(wps_data, display, buf, isfile); 1823 bool loaded_ok = buf && _skin_data_load(wps_data, display, buf, isfile);
1824 if (!loaded_ok) /* load the hardcoded default */ 1824 if (!loaded_ok) /* load the hardcoded default */
1825 { 1825 {
1826 /* set the default wps for the main-screen */ 1826 /* set the default wps for the main-screen */
@@ -1829,7 +1829,7 @@ void skin_data_load(struct wps_data *wps_data,
1829#if LCD_DEPTH > 1 1829#if LCD_DEPTH > 1
1830 unload_wps_backdrop(); 1830 unload_wps_backdrop();
1831#endif 1831#endif
1832 wps_data_load(wps_data, 1832 _skin_data_load(wps_data,
1833 display, 1833 display,
1834#ifdef HAVE_LCD_BITMAP 1834#ifdef HAVE_LCD_BITMAP
1835 "%s%?it<%?in<%in. |>%it|%fn>\n" 1835 "%s%?it<%?in<%in. |>%it|%fn>\n"
@@ -1852,7 +1852,7 @@ void skin_data_load(struct wps_data *wps_data,
1852#if LCD_REMOTE_DEPTH > 1 1852#if LCD_REMOTE_DEPTH > 1
1853 unload_remote_wps_backdrop(); 1853 unload_remote_wps_backdrop();
1854#endif 1854#endif
1855 wps_data_load(wps_data, 1855 _skin_data_load(wps_data,
1856 display, 1856 display,
1857 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 1857 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
1858 "%s%?it<%?in<%in. |>%it|%fn>\n" 1858 "%s%?it<%?in<%in. |>%it|%fn>\n"
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 4a7de875d2..447c1d6b00 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -75,8 +75,8 @@
75 75
76static int wpsbars; 76static int wpsbars;
77/* currently only one wps_state is needed */ 77/* currently only one wps_state is needed */
78struct wps_state wps_state; 78static struct wps_state wps_state;
79struct gui_wps gui_wps[NB_SCREENS]; 79static struct gui_wps gui_wps[NB_SCREENS];
80static struct wps_data wps_datas[NB_SCREENS]; 80static struct wps_data wps_datas[NB_SCREENS];
81 81
82/* initial setup of wps_data */ 82/* initial setup of wps_data */
@@ -90,6 +90,19 @@ static void nextid3available_callback(void* param);
90 /* 3% of 30min file == 54s step size */ 90 /* 3% of 30min file == 54s step size */
91#define MIN_FF_REWIND_STEP 500 91#define MIN_FF_REWIND_STEP 500
92 92
93void wps_data_load(enum screen_type screen, const char *buf, bool is_file)
94{
95 skin_data_load(gui_wps[screen].data, &screens[screen], buf, is_file);
96#ifdef HAVE_REMOVE_LCD
97 gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN);
98#endif
99}
100
101void wps_data_init(enum screen_type screen)
102{
103 skin_data_init(gui_wps[screen].data);
104}
105
93bool wps_fading_out = false; 106bool wps_fading_out = false;
94void fade(bool fade_in, bool updatewps) 107void fade(bool fade_in, bool updatewps)
95{ 108{
@@ -165,6 +178,7 @@ bool update_onvol_change(struct gui_wps * gwps)
165 return false; 178 return false;
166} 179}
167 180
181
168bool ffwd_rew(int button) 182bool ffwd_rew(int button)
169{ 183{
170 unsigned int step = 0; /* current ff/rewind step */ 184 unsigned int step = 0; /* current ff/rewind step */
@@ -1176,7 +1190,7 @@ void gui_sync_wps_init(void)
1176 int i; 1190 int i;
1177 FOR_NB_SCREENS(i) 1191 FOR_NB_SCREENS(i)
1178 { 1192 {
1179 wps_data_init(&wps_datas[i]); 1193 skin_data_init(&wps_datas[i]);
1180#ifdef HAVE_ALBUMART 1194#ifdef HAVE_ALBUMART
1181 wps_datas[i].wps_uses_albumart = 0; 1195 wps_datas[i].wps_uses_albumart = 0;
1182#endif 1196#endif
@@ -1201,15 +1215,19 @@ void gui_sync_wps_init(void)
1201} 1215}
1202 1216
1203#ifdef HAVE_ALBUMART 1217#ifdef HAVE_ALBUMART
1204/* Returns true if at least one of the gui_wps screens has an album art 1218bool wps_uses_albumart(int *width, int *height)
1205 tag in its wps structure */
1206bool gui_sync_wps_uses_albumart(void)
1207{ 1219{
1208 int i; 1220 int i;
1209 FOR_NB_SCREENS(i) { 1221 FOR_NB_SCREENS(i) {
1210 struct gui_wps *gwps = &gui_wps[i]; 1222 struct gui_wps *gwps = &gui_wps[i];
1211 if (gwps->data && (gwps->data->wps_uses_albumart != WPS_ALBUMART_NONE)) 1223 if (gwps->data && (gwps->data->wps_uses_albumart != WPS_ALBUMART_NONE))
1224 {
1225 if (width)
1226 *width = gui_wps[0].data->albumart_max_width;
1227 if (height)
1228 *height = gui_wps[0].data->albumart_max_height;
1212 return true; 1229 return true;
1230 }
1213 } 1231 }
1214 return false; 1232 return false;
1215} 1233}
diff --git a/apps/gui/wps.h b/apps/gui/wps.h
index 90614cb65b..b8cb7d2ffa 100644
--- a/apps/gui/wps.h
+++ b/apps/gui/wps.h
@@ -34,4 +34,17 @@ bool ffwd_rew(int button);
34void display_keylock_text(bool locked); 34void display_keylock_text(bool locked);
35 35
36bool is_wps_fading(void); 36bool is_wps_fading(void);
37
38/* wrapper for the wps to load the skin (.wps/.rwps) files */
39void wps_data_load(enum screen_type, const char *, bool);
40void wps_data_init(enum screen_type);
41
42#ifdef HAVE_ALBUMART
43/*
44 * Returns true if at least one of the gui_wps screens has an album art
45 * tag in its wps structure and writes the width and height into the passed
46 * pointers
47 */
48bool wps_uses_albumart(int*, int*);
49#endif
37#endif 50#endif