summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/backdrop.c141
-rw-r--r--apps/gui/backdrop.h59
-rw-r--r--apps/gui/skin_engine/wps_display.c9
-rw-r--r--apps/gui/skin_engine/wps_parser.c19
-rw-r--r--apps/gui/wps.c38
5 files changed, 154 insertions, 112 deletions
diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c
index c95fda9022..28216da4e0 100644
--- a/apps/gui/backdrop.c
+++ b/apps/gui/backdrop.c
@@ -27,21 +27,19 @@
27#endif 27#endif
28#include "backdrop.h" 28#include "backdrop.h"
29 29
30#if LCD_DEPTH >= 8 30static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBHEIGHT]
31static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); 31 __attribute__ ((aligned (16)));
32static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); 32static fb_data skin_backdrop[LCD_FBHEIGHT][LCD_FBHEIGHT]
33#elif LCD_DEPTH == 2 33 __attribute__ ((aligned (16)));
34static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
35static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
36#endif
37 34
38#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 35#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
39static fb_remote_data remote_wps_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; 36static fb_remote_data
40static bool remote_wps_backdrop_valid = false; 37remote_skin_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
38static bool remote_skin_backdrop_valid = false;
41#endif 39#endif
42 40
43static bool main_backdrop_valid = false; 41static bool main_backdrop_valid = false;
44static bool wps_backdrop_valid = false; 42static bool skin_backdrop_valid = false;
45 43
46/* load a backdrop into a buffer */ 44/* load a backdrop into a buffer */
47static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) 45static bool load_backdrop(const char* filename, fb_data* backdrop_buffer)
@@ -54,49 +52,43 @@ static bool load_backdrop(const char* filename, fb_data* backdrop_buffer)
54 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), 52 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop),
55 FORMAT_NATIVE | FORMAT_DITHER, NULL); 53 FORMAT_NATIVE | FORMAT_DITHER, NULL);
56 54
57 if ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT)) 55 return ((ret > 0)
58 { 56 && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT));
59 return true;
60 }
61 else
62 {
63 return false;
64 }
65} 57}
66 58
67bool load_main_backdrop(const char* filename) 59static bool load_main_backdrop(const char* filename)
68{ 60{
69 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); 61 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]);
70 return main_backdrop_valid; 62 return main_backdrop_valid;
71} 63}
72 64
73bool load_wps_backdrop(const char* filename) 65static inline bool load_skin_backdrop(const char* filename)
74{ 66{
75 wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); 67 skin_backdrop_valid = load_backdrop(filename, &skin_backdrop[0][0]);
76 return wps_backdrop_valid; 68 return skin_backdrop_valid;
77} 69}
78 70
79void unload_main_backdrop(void) 71static inline void unload_main_backdrop(void)
80{ 72{
81 main_backdrop_valid = false; 73 main_backdrop_valid = false;
82} 74}
83 75
84void unload_wps_backdrop(void) 76static inline void unload_skin_backdrop(void)
85{ 77{
86 wps_backdrop_valid = false; 78 skin_backdrop_valid = false;
87} 79}
88 80
89void show_main_backdrop(void) 81static inline void show_main_backdrop(void)
90{ 82{
91 lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL); 83 lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL);
92} 84}
93 85
94void show_wps_backdrop(void) 86static void show_skin_backdrop(void)
95{ 87{
96 /* if no wps backdrop, fall back to main backdrop */ 88 /* if no wps backdrop, fall back to main backdrop */
97 if(wps_backdrop_valid) 89 if(skin_backdrop_valid)
98 { 90 {
99 lcd_set_backdrop(&wps_backdrop[0][0]); 91 lcd_set_backdrop(&skin_backdrop[0][0]);
100 } 92 }
101 else 93 else
102 { 94 {
@@ -104,9 +96,39 @@ void show_wps_backdrop(void)
104 } 96 }
105} 97}
106 98
99/* api functions */
100
101bool backdrop_load(enum backdrop_type bdrop, const char* filename)
102{
103 if (bdrop == BACKDROP_MAIN)
104 return load_main_backdrop(filename);
105 else if (bdrop == BACKDROP_SKIN_WPS)
106 return load_skin_backdrop(filename);
107 else
108 return false;
109}
110
111void backdrop_unload(enum backdrop_type bdrop)
112{
113 if (bdrop == BACKDROP_MAIN)
114 unload_main_backdrop();
115 else if (bdrop == BACKDROP_SKIN_WPS)
116 unload_skin_backdrop();
117}
118
119void backdrop_show(enum backdrop_type bdrop)
120{
121 if (bdrop == BACKDROP_MAIN)
122 show_main_backdrop();
123 else if (bdrop == BACKDROP_SKIN_WPS)
124 show_skin_backdrop();
125}
126
127
107#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 128#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
108 129
109static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_buffer) 130static bool load_remote_backdrop(const char* filename,
131 fb_remote_data* backdrop_buffer)
110{ 132{
111 struct bitmap bm; 133 struct bitmap bm;
112 int ret; 134 int ret;
@@ -116,33 +138,29 @@ static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_
116 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), 138 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop),
117 FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE, NULL); 139 FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE, NULL);
118 140
119 if ((ret > 0) && (bm.width == LCD_REMOTE_WIDTH) && (bm.height == LCD_REMOTE_HEIGHT)) 141 return ((ret > 0)
120 { 142 && (bm.width == LCD_REMOTE_WIDTH)
121 return true; 143 && (bm.height == LCD_REMOTE_HEIGHT));
122 }
123 else
124 {
125 return false;
126 }
127} 144}
128 145
129bool load_remote_wps_backdrop(const char* filename) 146static inline bool load_remote_skin_backdrop(const char* filename)
130{ 147{
131 remote_wps_backdrop_valid = load_remote_backdrop(filename, &remote_wps_backdrop[0][0]); 148 remote_skin_backdrop_valid =
132 return remote_wps_backdrop_valid; 149 load_remote_backdrop(filename, &remote_skin_backdrop[0][0]);
150 return remote_skin_backdrop_valid;
133} 151}
134 152
135void unload_remote_wps_backdrop(void) 153static inline void unload_remote_skin_backdrop(void)
136{ 154{
137 remote_wps_backdrop_valid = false; 155 remote_skin_backdrop_valid = false;
138} 156}
139 157
140void show_remote_wps_backdrop(void) 158static inline void show_remote_skin_backdrop(void)
141{ 159{
142 /* if no wps backdrop, fall back to main backdrop */ 160 /* if no wps backdrop, fall back to main backdrop */
143 if(remote_wps_backdrop_valid) 161 if(remote_skin_backdrop_valid)
144 { 162 {
145 lcd_remote_set_backdrop(&remote_wps_backdrop[0][0]); 163 lcd_remote_set_backdrop(&remote_skin_backdrop[0][0]);
146 } 164 }
147 else 165 else
148 { 166 {
@@ -150,8 +168,37 @@ void show_remote_wps_backdrop(void)
150 } 168 }
151} 169}
152 170
153void show_remote_main_backdrop(void) 171static line void show_remote_main_backdrop(void)
154{ 172{
155 lcd_remote_set_backdrop(NULL); 173 lcd_remote_set_backdrop(NULL);
156} 174}
175
176
177/* api functions */
178bool remote_backdrop_load(enum backdrop_type bdrop,
179 const char *filename)
180{
181 if (bdrop == BACKDROP_SKIN_WPS)
182 return load_remote_skin_backdrop(filename);
183 else if (bdrop == BACKDROP_MAIN)
184 return true;
185 else
186 return false;
187}
188
189void remote_backrop_show(enum backdrop_type bdrop)
190{
191 if (bdrop == BACKDROP_MAIN)
192 show_remote_main_backdrop();
193 else if (bdrop == BACKDROP_SKIN_WPS)
194 show_remote_skin_backdrop();
195}
196
197void remote_backdrop_unload(enum backdrop_type bdrop)
198{
199 if (bdrop != BACKDROP_MAIN)
200 unload_remote_skin_backdrop();
201}
202
203
157#endif 204#endif
diff --git a/apps/gui/backdrop.h b/apps/gui/backdrop.h
index dc9805f07b..f3ef1d7686 100644
--- a/apps/gui/backdrop.h
+++ b/apps/gui/backdrop.h
@@ -22,27 +22,62 @@
22#ifndef _BACKDROP_H 22#ifndef _BACKDROP_H
23#define _BACKDROP_H 23#define _BACKDROP_H
24 24
25enum backdrop_type {
26 BACKDROP_MAIN,
27 BACKDROP_SKIN_WPS,
28};
29
25#if LCD_DEPTH > 1 30#if LCD_DEPTH > 1
26 31
27#include "lcd.h" 32#include "lcd.h"
28#include "bmp.h" 33#include "bmp.h"
29 34
30bool load_main_backdrop(const char* filename); 35bool backdrop_load(enum backdrop_type bdrop, const char*);
31bool load_wps_backdrop(const char* filename); 36void backdrop_unload(enum backdrop_type bdrop);
37void backdrop_show(enum backdrop_type bdrop);
38
39#else /* LCD_DEPTH > 1 */
40
41static inline
42bool backdrop_load(enum backdrop_type bdrop, const char* filename)
43{
44 (void)filename; (void)bdrop; return true;
45}
32 46
33void unload_main_backdrop(void); 47static inline void backdrop_unload(enum backdrop_type bdrop)
34void unload_wps_backdrop(void); 48{
49 (void)bdrop;
50}
51static inline void backdrop_show(enum backdrop_type bdrop)
52{
53 (void)bdrop;
54}
35 55
36void show_main_backdrop(void); 56#endif
37void show_wps_backdrop(void); 57
58#if defined(HAVE_REMOTE_LCD)
59/* no main backdrop, stubs! */
60#if LCD_REMOTE_DEPTH > 1
61bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename);
62void remote_backdropunload(enum backdrop_type bdrop);
63void remote_backdrop_show(enum backdrop_type bdrop);
64#else
65static inline
66bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename)
67{
68 (void)filename; (void)bdrop; return true;
69}
38 70
39#endif /* LCD_DEPTH > 1 */ 71static inline void remote_backdrop_unload(enum backdrop_type bdrop)
72{
73 (void)bdrop;
74}
40 75
41#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 76static inline void remote_backdrop_show(enum backdrop_type bdrop)
42bool load_remote_wps_backdrop(const char* filename); 77{
43void unload_remote_wps_backdrop(void); 78 (void)bdrop;
44void show_remote_wps_backdrop(void); 79}
45void show_remote_main_backdrop(void); /* only clears the wps backdrop */ 80#endif
46#endif 81#endif
47 82
48#endif /* _BACKDROP_H */ 83#endif /* _BACKDROP_H */
diff --git a/apps/gui/skin_engine/wps_display.c b/apps/gui/skin_engine/wps_display.c
index 98050093c4..6a94c6a946 100644
--- a/apps/gui/skin_engine/wps_display.c
+++ b/apps/gui/skin_engine/wps_display.c
@@ -82,14 +82,7 @@ bool gui_wps_display(struct gui_wps *gwps)
82 } 82 }
83#endif 83#endif
84 display->clear_display(); 84 display->clear_display();
85#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 85 display->backdrop_show(BACKDROP_SKIN_WPS);
86 if (display->screen_type == SCREEN_REMOTE)
87 show_remote_wps_backdrop();
88 else if (display->screen_type == SCREEN_MAIN)
89#endif
90#if LCD_DEPTH > 1
91 show_wps_backdrop();
92#endif
93 return gui_wps_redraw(gwps, WPS_REFRESH_ALL); 86 return gui_wps_redraw(gwps, WPS_REFRESH_ALL);
94} 87}
95 88
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 1a903c98ec..c37cd786ec 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -1635,26 +1635,15 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
1635#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 1635#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
1636 if (bmp_names[BACKDROP_BMP]) 1636 if (bmp_names[BACKDROP_BMP])
1637 { 1637 {
1638 int screen = SCREEN_MAIN;
1638 get_image_filename(bmp_names[BACKDROP_BMP], bmpdir, 1639 get_image_filename(bmp_names[BACKDROP_BMP], bmpdir,
1639 img_path, sizeof(img_path)); 1640 img_path, sizeof(img_path));
1640
1641#if defined(HAVE_REMOTE_LCD) 1641#if defined(HAVE_REMOTE_LCD)
1642 /* We only need to check LCD type if there is a remote LCD */ 1642 /* We only need to check LCD type if there is a remote LCD */
1643 if (!wps_data->remote_wps) 1643 if (wps_data->remote_wps)
1644#endif 1644 screen = SCREEN_REMOTE;
1645 {
1646 /* Load backdrop for the main LCD */
1647 if (!load_wps_backdrop(img_path))
1648 return false;
1649 }
1650#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
1651 else
1652 {
1653 /* Load backdrop for the remote LCD */
1654 if (!load_remote_wps_backdrop(img_path))
1655 return false;
1656 }
1657#endif 1645#endif
1646 screens[screen].backdrop_load(BACKDROP_SKIN_WPS, img_path);
1658 } 1647 }
1659#endif /* has backdrop support */ 1648#endif /* has backdrop support */
1660 1649
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index bce4db2b8a..bbf169ff96 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -92,7 +92,8 @@ static void nextid3available_callback(void* param);
92 92
93void wps_data_load(enum screen_type screen, const char *buf, bool isfile) 93void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
94{ 94{
95 bool loaded_ok = buf && skin_data_load(gui_wps[screen].data, &screens[screen], buf, isfile); 95 bool loaded_ok = buf && skin_data_load(gui_wps[screen].data,
96 &screens[screen], buf, isfile);
96 if (!loaded_ok) /* load the hardcoded default */ 97 if (!loaded_ok) /* load the hardcoded default */
97 { 98 {
98 char *skin_buf[NB_SCREENS] = { 99 char *skin_buf[NB_SCREENS] = {
@@ -115,24 +116,9 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
115 "%pb\n", 116 "%pb\n",
116#endif 117#endif
117 }; 118 };
119 screens[screen].backdrop_unload(BACKDROP_SKIN_WPS);
118 skin_data_load(gui_wps[screen].data, &screens[screen], 120 skin_data_load(gui_wps[screen].data, &screens[screen],
119 skin_buf[screen], false); 121 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 } 122 }
137#ifdef HAVE_REMOVE_LCD 123#ifdef HAVE_REMOVE_LCD
138 gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); 124 gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN);
@@ -564,16 +550,13 @@ static void gwps_leave_wps(void)
564 int i, oldbars = VP_SB_HIDE_ALL; 550 int i, oldbars = VP_SB_HIDE_ALL;
565 551
566 FOR_NB_SCREENS(i) 552 FOR_NB_SCREENS(i)
553 {
567 gui_wps[i].display->stop_scroll(); 554 gui_wps[i].display->stop_scroll();
555 gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
556 }
568 if (global_settings.statusbar) 557 if (global_settings.statusbar)
569 oldbars = VP_SB_ALLSCREENS; 558 oldbars = VP_SB_ALLSCREENS;
570 559
571#if LCD_DEPTH > 1
572 show_main_backdrop();
573#endif
574#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
575 show_remote_main_backdrop();
576#endif
577 viewportmanager_set_statusbar(oldbars); 560 viewportmanager_set_statusbar(oldbars);
578#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 561#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
579 /* Play safe and unregister the hook */ 562 /* Play safe and unregister the hook */
@@ -1237,23 +1220,18 @@ void gui_sync_wps_init(void)
1237 wps_datas[i].wps_uses_albumart = 0; 1220 wps_datas[i].wps_uses_albumart = 0;
1238#endif 1221#endif
1239#ifdef HAVE_REMOTE_LCD 1222#ifdef HAVE_REMOTE_LCD
1240 wps_datas[i].remote_wps = (i != 0); 1223 wps_datas[i].remote_wps = (i == SCREEN_REMOTE);
1241#endif 1224#endif
1242 gui_wps[i].data = &wps_datas[i]; 1225 gui_wps[i].data = &wps_datas[i];
1243 gui_wps[i].display = &screens[i]; 1226 gui_wps[i].display = &screens[i];
1244 /* Currently no seperate wps_state needed/possible 1227 /* Currently no seperate wps_state needed/possible
1245 so use the only available ( "global" ) one */ 1228 so use the only available ( "global" ) one */
1246 gui_wps[i].state = &wps_state; 1229 gui_wps[i].state = &wps_state;
1230 gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS);
1247 } 1231 }
1248#ifdef HAVE_LCD_BITMAP 1232#ifdef HAVE_LCD_BITMAP
1249 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler); 1233 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
1250#endif 1234#endif
1251#if LCD_DEPTH > 1
1252 unload_wps_backdrop();
1253#endif
1254#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
1255 unload_remote_wps_backdrop();
1256#endif
1257} 1235}
1258 1236
1259#ifdef HAVE_ALBUMART 1237#ifdef HAVE_ALBUMART