summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2006-05-21 11:00:02 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2006-05-21 11:00:02 +0000
commit93b899d0fe3426ed50de06d20cdefb6d288e5ec2 (patch)
tree0dd0af26a5797a02f9a1f0139fde9fb60e1844bb
parent6ddb5f24294d68749e53c10a99ca09aca9f9f7eb (diff)
downloadrockbox-93b899d0fe3426ed50de06d20cdefb6d288e5ec2.tar.gz
rockbox-93b899d0fe3426ed50de06d20cdefb6d288e5ec2.zip
Reworked backdrop handling. Fixes a bug that wasn't in the tracker yet ;)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9970 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/filetree.c8
-rw-r--r--apps/gui/gwps-common.c52
-rw-r--r--apps/gui/gwps.c55
-rw-r--r--apps/gui/gwps.h4
-rw-r--r--apps/onplay.c13
-rw-r--r--apps/recorder/backdrop.c63
-rw-r--r--apps/recorder/backdrop.h16
-rw-r--r--apps/screens.c7
-rw-r--r--apps/settings.c17
-rw-r--r--apps/settings_menu.c7
-rw-r--r--apps/tree.c17
11 files changed, 147 insertions, 112 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 72a58c7fe1..acceb0b93b 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -53,6 +53,11 @@
53static int boot_size = 0; 53static int boot_size = 0;
54static int boot_cluster; 54static int boot_cluster;
55#endif 55#endif
56
57#ifdef HAVE_LCD_COLOR
58#include "backdrop.h"
59#endif
60
56extern bool boot_changed; 61extern bool boot_changed;
57 62
58int ft_build_playlist(struct tree_context* c, int start_index) 63int ft_build_playlist(struct tree_context* c, int start_index)
@@ -461,6 +466,9 @@ int ft_enter(struct tree_context* c)
461 /* wps config file */ 466 /* wps config file */
462 case TREE_ATTR_WPS: 467 case TREE_ATTR_WPS:
463 gui_syncsplash(0, true, str(LANG_WAIT)); 468 gui_syncsplash(0, true, str(LANG_WAIT));
469#ifdef HAVE_LCD_COLOR
470 unload_wps_backdrop();
471#endif
464 wps_data_load(gui_wps[0].data, buf, true); 472 wps_data_load(gui_wps[0].data, buf, true);
465 set_file(buf, (char *)global_settings.wps_file, 473 set_file(buf, (char *)global_settings.wps_file,
466 MAX_FILENAME); 474 MAX_FILENAME);
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 349c92b9a0..5ab6ce8c82 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -146,44 +146,31 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf,
146 case 'X': 146 case 'X':
147 /* Backdrop image - must be the same size as the LCD */ 147 /* Backdrop image - must be the same size as the LCD */
148 { 148 {
149 int ret = 0;
150 struct bitmap bm;
151 char *ptr = buf+2; 149 char *ptr = buf+2;
152 char *pos = NULL; 150 char *pos = NULL;
153 char imgname[MAX_PATH]; 151 char imgname[MAX_PATH];
154 152
155 /* format: %X|filename.bmp| */ 153 /* format: %X|filename.bmp| */
156 {
157 /* get filename */
158 pos = strchr(ptr, '|');
159 if ((pos - ptr) <
160 (int)sizeof(imgname)-ROCKBOX_DIR_LEN-2)
161 {
162 memcpy(imgname, bmpdir, bmpdirlen);
163 imgname[bmpdirlen] = '/';
164 memcpy(&imgname[bmpdirlen+1],
165 ptr, pos - ptr);
166 imgname[bmpdirlen+1+pos-ptr] = 0;
167 }
168 else
169 /* filename too long */
170 imgname[0] = 0;
171
172 ptr = pos+1;
173 154
174 /* load the image */ 155 /* get filename */
175 bm.data=(char*)&wps_backdrop[0][0]; 156 pos = strchr(ptr, '|');
176 ret = read_bmp_file(imgname, &bm, 157 if ((pos - ptr) <
177 sizeof(wps_backdrop), FORMAT_NATIVE); 158 (int)sizeof(imgname)-ROCKBOX_DIR_LEN-2)
178 159 {
179 if ((ret > 0) && (bm.width == LCD_WIDTH) 160 memcpy(imgname, bmpdir, bmpdirlen);
180 && (bm.height == LCD_HEIGHT)) { 161 imgname[bmpdirlen] = '/';
181 data->has_backdrop=true; 162 memcpy(&imgname[bmpdirlen+1],
182 return true; 163 ptr, pos - ptr);
183 } else { 164 imgname[bmpdirlen+1+pos-ptr] = 0;
184 return false;
185 }
186 } 165 }
166 else
167 {
168 /* filename too long */
169 imgname[0] = 0;
170 }
171
172 /* load the image */
173 return load_wps_backdrop(imgname);
187 } 174 }
188 175
189 break; 176 break;
@@ -2460,6 +2447,9 @@ bool gui_wps_display(void)
2460 if(i == 0) 2447 if(i == 0)
2461 { 2448 {
2462#ifdef HAVE_LCD_BITMAP 2449#ifdef HAVE_LCD_BITMAP
2450#ifdef HAVE_LCD_COLOR
2451 unload_wps_backdrop();
2452#endif
2463 wps_data_load(gui_wps[i].data, 2453 wps_data_load(gui_wps[i].data,
2464 "%s%?it<%?in<%in. |>%it|%fn>\n" 2454 "%s%?it<%?in<%in. |>%it|%fn>\n"
2465 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 2455 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index b84027c61c..d7a27e8eb9 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -105,18 +105,8 @@ long gui_wps_show(void)
105 gui_wps_set_margin(&gui_wps[i]); 105 gui_wps_set_margin(&gui_wps[i]);
106 } 106 }
107#ifdef HAVE_LCD_COLOR 107#ifdef HAVE_LCD_COLOR
108 gui_wps[SCREEN_MAIN].data->old_backdrop = lcd_get_backdrop(); 108 show_wps_backdrop();
109 if (gui_wps[SCREEN_MAIN].data->has_backdrop) 109#endif /* HAVE_LCD_COLOR */
110 {
111 lcd_set_backdrop(&wps_backdrop[0][0]);
112 }
113 else
114 {
115 /* wps has no backdrop, so clear it in case we're switching wps */
116 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop);
117 }
118
119#endif
120#endif 110#endif
121 111
122#ifdef AB_REPEAT_ENABLE 112#ifdef AB_REPEAT_ENABLE
@@ -241,12 +231,11 @@ long gui_wps_show(void)
241 case WPS_RC_CONTEXT: 231 case WPS_RC_CONTEXT:
242#endif 232#endif
243#ifdef HAVE_LCD_COLOR 233#ifdef HAVE_LCD_COLOR
244 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 234 show_main_backdrop();
245#endif 235#endif
246 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); 236 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
247#ifdef HAVE_LCD_COLOR 237#ifdef HAVE_LCD_COLOR
248 if (gui_wps[SCREEN_MAIN].data->has_backdrop) 238 show_wps_backdrop();
249 lcd_set_backdrop(&wps_backdrop[0][0]);
250#endif 239#endif
251#ifdef HAVE_LCD_BITMAP 240#ifdef HAVE_LCD_BITMAP
252 FOR_NB_SCREENS(i) 241 FOR_NB_SCREENS(i)
@@ -557,16 +546,12 @@ long gui_wps_show(void)
557 gui_wps[i].display->stop_scroll(); 546 gui_wps[i].display->stop_scroll();
558 547
559#ifdef HAVE_LCD_COLOR 548#ifdef HAVE_LCD_COLOR
560 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 549 show_main_backdrop();
561#endif 550#endif
562 if (main_menu()) 551 if (main_menu())
563 return true; 552 return true;
564#ifdef HAVE_LCD_COLOR 553#ifdef HAVE_LCD_COLOR
565 if(global_settings.backdrop_file[0] == 0) 554 show_wps_backdrop();
566 gui_wps[SCREEN_MAIN].data->old_backdrop = NULL;
567
568 if (gui_wps[SCREEN_MAIN].data->has_backdrop)
569 lcd_set_backdrop(&wps_backdrop[0][0]);
570#endif 555#endif
571#ifdef HAVE_LCD_BITMAP 556#ifdef HAVE_LCD_BITMAP
572 FOR_NB_SCREENS(i) 557 FOR_NB_SCREENS(i)
@@ -596,13 +581,12 @@ long gui_wps_show(void)
596 case WPS_RC_QUICK: 581 case WPS_RC_QUICK:
597#endif 582#endif
598#ifdef HAVE_LCD_COLOR 583#ifdef HAVE_LCD_COLOR
599 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 584 show_main_backdrop();
600#endif 585#endif
601 if (quick_screen_quick(button)) 586 if (quick_screen_quick(button))
602 return SYS_USB_CONNECTED; 587 return SYS_USB_CONNECTED;
603#ifdef HAVE_LCD_COLOR 588#ifdef HAVE_LCD_COLOR
604 if (gui_wps[SCREEN_MAIN].data->has_backdrop) 589 show_wps_backdrop();
605 lcd_set_backdrop(&wps_backdrop[0][0]);
606#endif 590#endif
607#ifdef HAVE_LCD_BITMAP 591#ifdef HAVE_LCD_BITMAP
608 FOR_NB_SCREENS(i) 592 FOR_NB_SCREENS(i)
@@ -629,13 +613,12 @@ long gui_wps_show(void)
629 case BUTTON_ON | BUTTON_UP: 613 case BUTTON_ON | BUTTON_UP:
630 case BUTTON_ON | BUTTON_DOWN: 614 case BUTTON_ON | BUTTON_DOWN:
631#ifdef HAVE_LCD_COLOR 615#ifdef HAVE_LCD_COLOR
632 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 616 show_main_backdrop();
633#endif 617#endif
634 if (1 == pitch_screen()) 618 if (1 == pitch_screen())
635 return SYS_USB_CONNECTED; 619 return SYS_USB_CONNECTED;
636#ifdef HAVE_LCD_COLOR 620#ifdef HAVE_LCD_COLOR
637 if (gui_wps[SCREEN_MAIN].data->has_backdrop) 621 show_wps_backdrop();
638 lcd_set_backdrop(&wps_backdrop[0][0]);
639#endif 622#endif
640 restore = true; 623 restore = true;
641 break; 624 break;
@@ -730,12 +713,11 @@ long gui_wps_show(void)
730#ifdef WPS_ID3 713#ifdef WPS_ID3
731 case WPS_ID3: 714 case WPS_ID3:
732#ifdef HAVE_LCD_COLOR 715#ifdef HAVE_LCD_COLOR
733 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 716 show_main_backdrop();
734#endif 717#endif
735 browse_id3(); 718 browse_id3();
736#ifdef HAVE_LCD_COLOR 719#ifdef HAVE_LCD_COLOR
737 if (gui_wps[SCREEN_MAIN].data->has_backdrop) 720 show_wps_backdrop();
738 lcd_set_backdrop(&wps_backdrop[0][0]);
739#endif 721#endif
740#ifdef HAVE_LCD_BITMAP 722#ifdef HAVE_LCD_BITMAP
741 FOR_NB_SCREENS(i) 723 FOR_NB_SCREENS(i)
@@ -754,19 +736,14 @@ long gui_wps_show(void)
754 case SYS_POWEROFF: 736 case SYS_POWEROFF:
755 bookmark_autobookmark(); 737 bookmark_autobookmark();
756#ifdef HAVE_LCD_COLOR 738#ifdef HAVE_LCD_COLOR
757 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop); 739 show_main_backdrop();
758#endif 740#endif
759 default_event_handler(SYS_POWEROFF); 741 default_event_handler(SYS_POWEROFF);
760 break; 742 break;
761 743
762 default: 744 default:
763 if(default_event_handler(button) == SYS_USB_CONNECTED) 745 if(default_event_handler(button) == SYS_USB_CONNECTED)
764 {
765#ifdef HAVE_LCD_COLOR
766 lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop);
767#endif
768 return SYS_USB_CONNECTED; 746 return SYS_USB_CONNECTED;
769 }
770 update_track = true; 747 update_track = true;
771 break; 748 break;
772 } 749 }
@@ -887,9 +864,6 @@ void wps_data_init(struct wps_data *wps_data)
887 wps_data->format_buffer[0] = '\0'; 864 wps_data->format_buffer[0] = '\0';
888 wps_data->wps_loaded = false; 865 wps_data->wps_loaded = false;
889 wps_data->peak_meter_enabled = false; 866 wps_data->peak_meter_enabled = false;
890#ifdef HAVE_LCD_COLOR
891 wps_data->has_backdrop = false;
892#endif
893} 867}
894 868
895static void wps_reset(struct wps_data *data) 869static void wps_reset(struct wps_data *data)
@@ -1075,4 +1049,7 @@ void gui_sync_wps_init(void)
1075 gui_wps_set_data(&gui_wps[i], &wps_datas[i]); 1049 gui_wps_set_data(&gui_wps[i], &wps_datas[i]);
1076 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); 1050 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]);
1077 } 1051 }
1052#ifdef HAVE_LCD_COLOR
1053 unload_wps_backdrop();
1054#endif
1078} 1055}
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 08299acbfc..3911ad1825 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -367,10 +367,6 @@ struct wps_data
367 int progress_end; 367 int progress_end;
368 bool wps_loaded; 368 bool wps_loaded;
369 bool peak_meter_enabled; 369 bool peak_meter_enabled;
370#ifdef HAVE_LCD_COLOR
371 bool has_backdrop;
372 fb_data* old_backdrop;
373#endif
374}; 370};
375 371
376/* initial setup of wps_data */ 372/* initial setup of wps_data */
diff --git a/apps/onplay.c b/apps/onplay.c
index 6ff99d7dd1..bc486d1a38 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -433,22 +433,13 @@ static bool delete_dir(void)
433#ifdef HAVE_LCD_COLOR 433#ifdef HAVE_LCD_COLOR
434static bool set_backdrop(void) 434static bool set_backdrop(void)
435{ 435{
436 struct bitmap bm;
437 int ret;
438
439 /* load the image */ 436 /* load the image */
440 bm.data=(char*)&main_backdrop[0][0]; 437 if(load_main_backdrop(selected_file)) {
441 ret = read_bmp_file(selected_file, &bm,
442 sizeof(main_backdrop), FORMAT_NATIVE);
443
444 if ((ret > 0) && (bm.width == LCD_WIDTH)
445 && (bm.height == LCD_HEIGHT)) {
446 lcd_set_backdrop(&main_backdrop[0][0]);
447 gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED)); 438 gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED));
448 set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME); 439 set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME);
440 show_main_backdrop();
449 return true; 441 return true;
450 } else { 442 } else {
451 lcd_set_backdrop(NULL);
452 gui_syncsplash(HZ, true, str(LANG_BACKDROP_FAILED)); 443 gui_syncsplash(HZ, true, str(LANG_BACKDROP_FAILED));
453 return false; 444 return false;
454 } 445 }
diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c
index 6fc5e24118..d230a6ec5a 100644
--- a/apps/recorder/backdrop.c
+++ b/apps/recorder/backdrop.c
@@ -21,25 +21,74 @@
21#include "config.h" 21#include "config.h"
22#include "lcd.h" 22#include "lcd.h"
23#include "backdrop.h" 23#include "backdrop.h"
24#include "splash.h" /* debugging */
24 25
25fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; 26fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
26fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; 27fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
28bool main_backdrop_valid = false;
29bool wps_backdrop_valid = false;
27 30
28bool load_main_backdrop(char* filename) 31/* load a backdrop into a buffer */
32bool load_backdrop(char* filename, fb_data* backdrop_buffer)
29{ 33{
30 struct bitmap bm; 34 struct bitmap bm;
31 int ret; 35 int ret;
32 36
33 /* load the image */ 37 /* load the image */
34 bm.data=(char*)&main_backdrop[0][0]; 38 bm.data=(char*)backdrop_buffer;
35 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), FORMAT_NATIVE); 39 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), FORMAT_NATIVE);
36 40
37 if ((ret > 0) && (bm.width == LCD_WIDTH) 41 if ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT))
38 && (bm.height == LCD_HEIGHT)) { 42 {
39 lcd_set_backdrop(&main_backdrop[0][0]);
40 return true; 43 return true;
41 } else { 44 }
42 lcd_set_backdrop(NULL); 45 else
46 {
43 return false; 47 return false;
44 } 48 }
45} 49}
50
51bool load_main_backdrop(char* filename)
52{
53 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]);
54/* gui_syncsplash(100, true, "MAIN backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/
55 return main_backdrop_valid;
56}
57
58bool load_wps_backdrop(char* filename)
59{
60 wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]);
61/* gui_syncsplash(100, true, "WPS backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/
62 return wps_backdrop_valid;
63}
64
65void unload_main_backdrop(void)
66{
67 main_backdrop_valid = false;
68/* gui_syncsplash(100, true, "MAIN backdrop unload");*/
69}
70
71void unload_wps_backdrop(void)
72{
73 wps_backdrop_valid = false;
74/* gui_syncsplash(100, true, "WPS backdrop unload");*/
75}
76
77void show_main_backdrop(void)
78{
79 lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL);
80}
81
82void show_wps_backdrop(void)
83{
84 /* if no wps backdrop, fall back to main backdrop */
85 if(wps_backdrop_valid)
86 {
87 lcd_set_backdrop(&wps_backdrop[0][0]);
88 }
89 else
90 {
91/* gui_syncsplash(100, true, "WPS backdrop show: fallback to MAIN");*/
92 show_main_backdrop();
93 }
94}
diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h
index d77985cf28..da515af261 100644
--- a/apps/recorder/backdrop.h
+++ b/apps/recorder/backdrop.h
@@ -25,14 +25,20 @@
25#include "lcd.h" 25#include "lcd.h"
26#include "bmp.h" 26#include "bmp.h"
27#include "backdrop.h" 27#include "backdrop.h"
28 28/*
29#ifdef HAVE_LCD_COLOR
30extern fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; 29extern fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
31extern fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; 30extern fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
32#endif 31*/
33 32
34bool load_main_backdrop(char* filename); 33bool load_main_backdrop(char* filename);
34bool load_wps_backdrop(char* filename);
35
36void unload_main_backdrop(void);
37void unload_wps_backdrop(void);
38
39void show_main_backdrop(void);
40void show_wps_backdrop(void);
35 41
36#endif 42#endif /* HAVE_LCD_COLOR */
37 43
38#endif 44#endif /* _BACKDROP_H */
diff --git a/apps/screens.c b/apps/screens.c
index 1507b6dd74..b7e4575534 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -64,6 +64,10 @@
64#include "dsp.h" 64#include "dsp.h"
65#endif 65#endif
66 66
67#ifdef HAVE_LCD_COLOR
68#include "backdrop.h"
69#endif
70
67#ifdef HAVE_LCD_BITMAP 71#ifdef HAVE_LCD_BITMAP
68#define SCROLLBAR_WIDTH 6 72#define SCROLLBAR_WIDTH 6
69#endif 73#endif
@@ -74,6 +78,9 @@ void usb_screen(void)
74 /* nothing here! */ 78 /* nothing here! */
75#else 79#else
76 int i; 80 int i;
81#ifdef HAVE_LCD_COLOR
82 show_main_backdrop();
83#endif
77 FOR_NB_SCREENS(i) { 84 FOR_NB_SCREENS(i) {
78 screens[i].backlight_on(); 85 screens[i].backlight_on();
79 gui_logo_draw(&usb_logos[i], &screens[i]); 86 gui_logo_draw(&usb_logos[i], &screens[i]);
diff --git a/apps/settings.c b/apps/settings.c
index f1b6f29957..1a6b4c3199 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1055,6 +1055,9 @@ void settings_apply(void)
1055 global_settings.peak_meter_clip_hold); 1055 global_settings.peak_meter_clip_hold);
1056#endif 1056#endif
1057 1057
1058#ifdef HAVE_LCD_COLOR
1059 unload_wps_backdrop();
1060#endif
1058 if ( global_settings.wps_file[0] && 1061 if ( global_settings.wps_file[0] &&
1059 global_settings.wps_file[0] != 0xff ) { 1062 global_settings.wps_file[0] != 0xff ) {
1060 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", 1063 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
@@ -1062,18 +1065,21 @@ void settings_apply(void)
1062 wps_data_load(gui_wps[0].data, buf, true); 1065 wps_data_load(gui_wps[0].data, buf, true);
1063 } 1066 }
1064 else 1067 else
1068 {
1065 wps_data_init(gui_wps[0].data); 1069 wps_data_init(gui_wps[0].data);
1070 }
1066 1071
1067#ifdef HAVE_LCD_COLOR 1072#ifdef HAVE_LCD_COLOR
1068 if ( global_settings.backdrop_file[0] && 1073 if ( global_settings.backdrop_file[0] &&
1069 global_settings.backdrop_file[0] != 0xff ) { 1074 global_settings.backdrop_file[0] != 0xff ) {
1070 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", 1075 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
1071 global_settings.backdrop_file); 1076 global_settings.backdrop_file);
1072
1073 load_main_backdrop(buf); 1077 load_main_backdrop(buf);
1074 } else { 1078 } else {
1075 lcd_set_backdrop(NULL); 1079 unload_main_backdrop();
1076 } 1080 }
1081 show_main_backdrop();
1082
1077 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); 1083 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
1078 screens[SCREEN_MAIN].set_background(global_settings.bg_color); 1084 screens[SCREEN_MAIN].set_background(global_settings.bg_color);
1079#endif 1085#endif
@@ -1415,6 +1421,9 @@ bool settings_load_config(const char* file)
1415 1421
1416 /* check for the string values */ 1422 /* check for the string values */
1417 if (!strcasecmp(name, "wps")) { 1423 if (!strcasecmp(name, "wps")) {
1424#ifdef HAVE_LCD_COLOR
1425 unload_wps_backdrop();
1426#endif
1418 if (wps_data_load(gui_wps[0].data, value, true)) 1427 if (wps_data_load(gui_wps[0].data, value, true))
1419 set_file(value, (char *)global_settings.wps_file, MAX_FILENAME); 1428 set_file(value, (char *)global_settings.wps_file, MAX_FILENAME);
1420 } 1429 }
@@ -1444,8 +1453,10 @@ bool settings_load_config(const char* file)
1444#endif 1453#endif
1445#ifdef HAVE_LCD_COLOR 1454#ifdef HAVE_LCD_COLOR
1446 else if (!strcasecmp(name, "backdrop")) { 1455 else if (!strcasecmp(name, "backdrop")) {
1447 if (load_main_backdrop(value)) 1456 if (load_main_backdrop(value)) {
1448 set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME); 1457 set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME);
1458 show_main_backdrop();
1459 }
1449 } 1460 }
1450#endif 1461#endif
1451#ifdef HAVE_LCD_BITMAP 1462#ifdef HAVE_LCD_BITMAP
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 4d80ed8c73..c15eb6cf91 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -78,6 +78,10 @@ void dac_line_in(bool enable);
78#include "dsp.h" 78#include "dsp.h"
79#endif 79#endif
80 80
81#ifdef HAVE_LCD_COLOR
82#include "backdrop.h"
83#endif
84
81#ifdef HAVE_CHARGING 85#ifdef HAVE_CHARGING
82static bool car_adapter_mode(void) 86static bool car_adapter_mode(void)
83{ 87{
@@ -323,7 +327,8 @@ static bool invert_cursor(void)
323static bool clear_main_backdrop(void) 327static bool clear_main_backdrop(void)
324{ 328{
325 global_settings.backdrop_file[0]=0; 329 global_settings.backdrop_file[0]=0;
326 lcd_set_backdrop(NULL); 330 unload_main_backdrop();
331 show_main_backdrop();
327 return false; 332 return false;
328} 333}
329 334
diff --git a/apps/tree.c b/apps/tree.c
index 6141a000bd..8eaff87fd8 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -75,6 +75,10 @@
75#include "widgets.h" 75#include "widgets.h"
76#endif 76#endif
77 77
78#ifdef HAVE_LCD_COLOR
79#include "backdrop.h"
80#endif
81
78/* a table for the know file types */ 82/* a table for the know file types */
79const struct filetype filetypes[] = { 83const struct filetype filetypes[] = {
80 { "mp3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, 84 { "mp3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
@@ -877,23 +881,14 @@ static bool dirbrowse(void)
877 if (start_wps && audio_status() ) 881 if (start_wps && audio_status() )
878 { 882 {
879 int i; 883 int i;
880#ifdef HAVE_LCD_COLOR
881 fb_data* old_backdrop;
882#endif
883 884
884 FOR_NB_SCREENS(i) 885 FOR_NB_SCREENS(i)
885 screens[i].stop_scroll(); 886 screens[i].stop_scroll();
886#ifdef HAVE_LCD_COLOR 887
887 old_backdrop = lcd_get_backdrop();
888#endif
889 if (gui_wps_show() == SYS_USB_CONNECTED) 888 if (gui_wps_show() == SYS_USB_CONNECTED)
890 reload_dir = true; 889 reload_dir = true;
891#ifdef HAVE_LCD_COLOR 890#ifdef HAVE_LCD_COLOR
892 /* check if the backdrop hasn't been cleared */ 891 show_main_backdrop();
893 if(global_settings.backdrop_file[0])
894 lcd_set_backdrop(old_backdrop);
895 else
896 lcd_set_backdrop(NULL);
897#endif 892#endif
898#ifdef HAVE_HOTSWAP 893#ifdef HAVE_HOTSWAP
899 else 894 else