summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-02-02 20:42:56 +0000
committerDave Chapman <dave@dchapman.com>2006-02-02 20:42:56 +0000
commitd9e5b67b71cf246c11da8a9083af21752ac7bd15 (patch)
tree99ac1903b7b0a7197483fa64add73e6062d169af /apps
parent9b4b4d0bf2366ebbbb3cbb14eeb457da9f2658eb (diff)
downloadrockbox-d9e5b67b71cf246c11da8a9083af21752ac7bd15.tar.gz
rockbox-d9e5b67b71cf246c11da8a9083af21752ac7bd15.zip
Patch #1421422 - Backdrop image patch started by Linus, finished by me. Adds ability to set backdrop images for file browser and menus (store full-screen bitmaps in /.rockbox/backdrops/) and also the ability to set a full-screen background image in a WPS using the %X|filename.bmp| WPS tag. Currently only implemented for targets with colour LCDs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8536 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES3
-rw-r--r--apps/gui/gwps-common.c58
-rw-r--r--apps/gui/gwps.c44
-rw-r--r--apps/lang/english.lang24
-rw-r--r--apps/onplay.c38
-rw-r--r--apps/plugin.c10
-rw-r--r--apps/recorder/backdrop.c45
-rw-r--r--apps/recorder/backdrop.h38
-rw-r--r--apps/settings.c73
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_menu.c17
-rw-r--r--apps/tree.c13
-rw-r--r--apps/tree.h3
13 files changed, 356 insertions, 14 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index e7c9ffef3d..35f78c455e 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -56,6 +56,9 @@ recorder/icons.c
56recorder/keyboard.c 56recorder/keyboard.c
57recorder/peakmeter.c 57recorder/peakmeter.c
58recorder/widgets.c 58recorder/widgets.c
59#ifdef HAVE_LCD_COLOR
60recorder/backdrop.c
61#endif
59#endif 62#endif
60#ifdef CONFIG_TUNER 63#ifdef CONFIG_TUNER
61recorder/radio.c 64recorder/radio.c
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index ca839a9bfa..09c271b904 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -28,6 +28,7 @@
28#include "power.h" 28#include "power.h"
29#include "powermgmt.h" 29#include "powermgmt.h"
30#include "sound.h" 30#include "sound.h"
31#include "debug.h"
31#ifdef HAVE_LCD_CHARCELLS 32#ifdef HAVE_LCD_CHARCELLS
32#include "hwcompat.h" 33#include "hwcompat.h"
33#endif 34#endif
@@ -36,10 +37,11 @@
36#include "backlight.h" 37#include "backlight.h"
37#include "lang.h" 38#include "lang.h"
38#include "misc.h" 39#include "misc.h"
39 40#include "backdrop.h"
40#include "splash.h" 41#include "splash.h"
41#include "scrollbar.h" 42#include "scrollbar.h"
42#include "led.h" 43#include "led.h"
44#include "lcd.h"
43#ifdef HAVE_LCD_BITMAP 45#ifdef HAVE_LCD_BITMAP
44#include "peakmeter.h" 46#include "peakmeter.h"
45/* Image stuff */ 47/* Image stuff */
@@ -57,6 +59,10 @@ static void draw_player_fullbar(struct gui_wps *gwps,
57 /* 3% of 30min file == 54s step size */ 59 /* 3% of 30min file == 54s step size */
58#define MIN_FF_REWIND_STEP 500 60#define MIN_FF_REWIND_STEP 500
59 61
62#ifdef HAVE_LCD_COLOR
63extern bool wps_has_backdrop;
64#endif
65
60/* Skip leading UTF-8 BOM, if present. */ 66/* Skip leading UTF-8 BOM, if present. */
61static char* skip_utf8_bom(char* buf) 67static char* skip_utf8_bom(char* buf)
62{ 68{
@@ -88,6 +94,7 @@ static int get_image_id(int c)
88/* 94/*
89 * parse the given buffer for following static tags: 95 * parse the given buffer for following static tags:
90 * %x - load image for always display 96 * %x - load image for always display
97 * %X - load backdrop image
91 * %xl - preload image 98 * %xl - preload image
92 * %we - enable statusbar on wps regardless of the global setting 99 * %we - enable statusbar on wps regardless of the global setting
93 * %wd - disable statusbar on wps regardless of the global setting 100 * %wd - disable statusbar on wps regardless of the global setting
@@ -133,7 +140,54 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf,
133 return true; 140 return true;
134 } 141 }
135 break; 142 break;
136 143
144#ifdef HAVE_LCD_COLOR
145 case 'X':
146 /* Backdrop image - must be the same size as the LCD */
147 {
148 int ret = 0;
149 struct bitmap bm;
150 char *ptr = buf+2;
151 char *pos = NULL;
152 char imgname[MAX_PATH];
153
154 /* format: %X|filename.bmp| */
155 {
156 /* get filename */
157 pos = strchr(ptr, '|');
158 if ((pos - ptr) <
159 (int)sizeof(imgname)-ROCKBOX_DIR_LEN-2)
160 {
161 memcpy(imgname, bmpdir, bmpdirlen);
162 imgname[bmpdirlen] = '/';
163 memcpy(&imgname[bmpdirlen+1],
164 ptr, pos - ptr);
165 imgname[bmpdirlen+1+pos-ptr] = 0;
166 }
167 else
168 /* filename too long */
169 imgname[0] = 0;
170
171 ptr = pos+1;
172
173 /* load the image */
174 bm.data=(char*)&wps_backdrop[0][0];
175 ret = read_bmp_file(imgname, &bm,
176 sizeof(wps_backdrop), FORMAT_NATIVE);
177
178 if ((ret > 0) && (bm.width == LCD_WIDTH)
179 && (bm.height == LCD_HEIGHT)) {
180 wps_has_backdrop=true;
181 return true;
182 } else {
183 return false;
184 }
185 }
186 }
187
188 break;
189#endif
190
137 case 'x': 191 case 'x':
138 /* Preload images so the %xd# tag can display it */ 192 /* Preload images so the %xd# tag can display it */
139 { 193 {
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index d7d436c089..00d7aaa507 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -52,7 +52,7 @@
52#include "onplay.h" 52#include "onplay.h"
53#include "abrepeat.h" 53#include "abrepeat.h"
54#include "playback.h" 54#include "playback.h"
55 55#include "backdrop.h"
56#include "splash.h" 56#include "splash.h"
57 57
58#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 58#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
@@ -62,6 +62,11 @@ struct wps_state wps_state;
62struct gui_wps gui_wps[NB_SCREENS]; 62struct gui_wps gui_wps[NB_SCREENS];
63static struct wps_data wps_datas[NB_SCREENS]; 63static struct wps_data wps_datas[NB_SCREENS];
64 64
65#ifdef HAVE_LCD_COLOR
66bool wps_has_backdrop;
67fb_data* old_backdrop;
68#endif
69
65bool keys_locked = false; 70bool keys_locked = false;
66 71
67/* change the path to the current played track */ 72/* change the path to the current played track */
@@ -102,6 +107,12 @@ long gui_wps_show(void)
102 { 107 {
103 gui_wps_set_margin(&gui_wps[i]); 108 gui_wps_set_margin(&gui_wps[i]);
104 } 109 }
110#if HAVE_LCD_COLOR
111 old_backdrop = lcd_get_backdrop();
112 if (wps_has_backdrop) {
113 lcd_set_backdrop(&wps_backdrop[0][0]);
114 }
115#endif
105#endif 116#endif
106 117
107#ifdef AB_REPEAT_ENABLE 118#ifdef AB_REPEAT_ENABLE
@@ -225,7 +236,14 @@ long gui_wps_show(void)
225#ifdef WPS_RC_CONTEXT 236#ifdef WPS_RC_CONTEXT
226 case WPS_RC_CONTEXT: 237 case WPS_RC_CONTEXT:
227#endif 238#endif
239#ifdef HAVE_LCD_COLOR
240 lcd_set_backdrop(old_backdrop);
241#endif
228 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); 242 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
243#ifdef HAVE_LCD_COLOR
244 if (wps_has_backdrop)
245 lcd_set_backdrop(&wps_backdrop[0][0]);
246#endif
229#ifdef HAVE_LCD_BITMAP 247#ifdef HAVE_LCD_BITMAP
230 FOR_NB_SCREENS(i) 248 FOR_NB_SCREENS(i)
231 { 249 {
@@ -510,8 +528,15 @@ long gui_wps_show(void)
510 FOR_NB_SCREENS(i) 528 FOR_NB_SCREENS(i)
511 gui_wps[i].display->stop_scroll(); 529 gui_wps[i].display->stop_scroll();
512 530
531#ifdef HAVE_LCD_COLOR
532 lcd_set_backdrop(old_backdrop);
533#endif
513 if (main_menu()) 534 if (main_menu())
514 return true; 535 return true;
536#ifdef HAVE_LCD_COLOR
537 if (wps_has_backdrop)
538 lcd_set_backdrop(&wps_backdrop[0][0]);
539#endif
515#ifdef HAVE_LCD_BITMAP 540#ifdef HAVE_LCD_BITMAP
516 FOR_NB_SCREENS(i) 541 FOR_NB_SCREENS(i)
517 { 542 {
@@ -540,8 +565,15 @@ long gui_wps_show(void)
540#ifdef WPS_RC_QUICK 565#ifdef WPS_RC_QUICK
541 case WPS_RC_QUICK: 566 case WPS_RC_QUICK:
542#endif 567#endif
568#ifdef HAVE_LCD_COLOR
569 lcd_set_backdrop(old_backdrop);
570#endif
543 if (quick_screen_quick(button)) 571 if (quick_screen_quick(button))
544 return SYS_USB_CONNECTED; 572 return SYS_USB_CONNECTED;
573#ifdef HAVE_LCD_COLOR
574 if (wps_has_backdrop)
575 lcd_set_backdrop(&wps_backdrop[0][0]);
576#endif
545#ifdef HAVE_LCD_BITMAP 577#ifdef HAVE_LCD_BITMAP
546 FOR_NB_SCREENS(i) 578 FOR_NB_SCREENS(i)
547 { 579 {
@@ -566,8 +598,15 @@ long gui_wps_show(void)
566 || CONFIG_KEYPAD == IRIVER_H300_PAD 598 || CONFIG_KEYPAD == IRIVER_H300_PAD
567 case BUTTON_ON | BUTTON_UP: 599 case BUTTON_ON | BUTTON_UP:
568 case BUTTON_ON | BUTTON_DOWN: 600 case BUTTON_ON | BUTTON_DOWN:
601#ifdef HAVE_LCD_COLOR
602 lcd_set_backdrop(old_backdrop);
603#endif
569 if (2 == pitch_screen()) 604 if (2 == pitch_screen())
570 return SYS_USB_CONNECTED; 605 return SYS_USB_CONNECTED;
606#ifdef HAVE_LCD_COLOR
607 if (wps_has_backdrop)
608 lcd_set_backdrop(&wps_backdrop[0][0]);
609#endif
571 restore = true; 610 restore = true;
572 break; 611 break;
573#endif 612#endif
@@ -981,4 +1020,7 @@ void gui_sync_wps_init(void)
981 gui_wps_set_data(&gui_wps[i], &wps_datas[i]); 1020 gui_wps_set_data(&gui_wps[i], &wps_datas[i]);
982 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); 1021 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]);
983 } 1022 }
1023#ifdef HAVE_LCD_COLOR
1024 wps_has_backdrop = false;
1025#endif
984} 1026}
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 26f079301b..a2803ad432 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3575,3 +3575,27 @@ eng: "Queue shuffled"
3575voice: "Queue shuffled" 3575voice: "Queue shuffled"
3576new: 3576new:
3577 3577
3578id: LANG_CLEAR_BACKDROP
3579desc: text for LCD settings menu
3580eng: "Clear backdrop"
3581voice: "Clear backdrop"
3582new:
3583
3584id: LANG_SET_AS_BACKDROP
3585desc: text for onplay menu entry
3586eng: "Set as backdrop"
3587voice: "Set as backdrop"
3588new:
3589
3590id: LANG_BACKDROP_LOADED
3591desc: text for splash to indicate a new backdrop has been loaded successfully
3592eng: "Backdrop loaded"
3593voice: "Backdrop loaded"
3594new:
3595
3596id: LANG_BACKDROP_FAILED
3597desc: text for splash to indicate a failure to load a bitmap as backdrop
3598eng: "Backdrop failed"
3599voice: "Backdrop failed"
3600new:
3601
diff --git a/apps/onplay.c b/apps/onplay.c
index 6b274d74b4..c994b04695 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -49,6 +49,7 @@
49#include "action.h" 49#include "action.h"
50#include "splash.h" 50#include "splash.h"
51#include "yesno.h" 51#include "yesno.h"
52#include "backdrop.h"
52 53
53#ifdef HAVE_LCD_BITMAP 54#ifdef HAVE_LCD_BITMAP
54#include "icons.h" 55#include "icons.h"
@@ -440,6 +441,31 @@ static bool delete_dir(void)
440 return delete_handler(true); 441 return delete_handler(true);
441} 442}
442 443
444#ifdef HAVE_LCD_COLOR
445static bool set_backdrop(void)
446{
447 struct bitmap bm;
448 int ret;
449
450 /* load the image */
451 bm.data=(char*)&main_backdrop[0][0];
452 ret = read_bmp_file(selected_file, &bm,
453 sizeof(main_backdrop), FORMAT_NATIVE);
454
455 if ((ret > 0) && (bm.width == LCD_WIDTH)
456 && (bm.height == LCD_HEIGHT)) {
457 lcd_set_backdrop(&main_backdrop[0][0]);
458 gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED));
459 set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME);
460 return true;
461 } else {
462 lcd_set_backdrop(NULL);
463 gui_syncsplash(HZ, true, str(LANG_BACKDROP_FAILED));
464 return false;
465 }
466}
467#endif
468
443static bool rename_file(void) 469static bool rename_file(void)
444{ 470{
445 char newname[MAX_PATH]; 471 char newname[MAX_PATH];
@@ -512,6 +538,7 @@ int onplay(char* file, int attr, int from)
512{ 538{
513 struct menu_item items[8]; /* increase this if you add entries! */ 539 struct menu_item items[8]; /* increase this if you add entries! */
514 int m, i=0, result; 540 int m, i=0, result;
541 char *suffix;
515 542
516 onplay_result = ONPLAY_OK; 543 onplay_result = ONPLAY_OK;
517 context=from; 544 context=from;
@@ -573,6 +600,17 @@ int onplay(char* file, int attr, int from)
573 items[i].desc = ID2P(LANG_DELETE); 600 items[i].desc = ID2P(LANG_DELETE);
574 items[i].function = delete_file; 601 items[i].function = delete_file;
575 i++; 602 i++;
603
604#if HAVE_LCD_COLOR
605 suffix = strrchr(file, '.');
606 if (suffix) {
607 if (strcasecmp(suffix, ".bmp") == 0) {
608 items[i].desc = ID2P(LANG_SET_AS_BACKDROP);
609 items[i].function = set_backdrop;
610 i++;
611 }
612 }
613#endif
576 } 614 }
577 else 615 else
578 { 616 {
diff --git a/apps/plugin.c b/apps/plugin.c
index 32412bc2ee..774ae547a3 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -396,6 +396,9 @@ int plugin_load(const char* plugin, void* parameter)
396#ifdef HAVE_LCD_BITMAP 396#ifdef HAVE_LCD_BITMAP
397 int xm, ym; 397 int xm, ym;
398#endif 398#endif
399#ifdef HAVE_LCD_COLOR
400 fb_data* old_backdrop;
401#endif
399 402
400 if (pfn_tsr_exit != NULL) /* if we have a resident old plugin: */ 403 if (pfn_tsr_exit != NULL) /* if we have a resident old plugin: */
401 { 404 {
@@ -404,6 +407,10 @@ int plugin_load(const char* plugin, void* parameter)
404 plugin_loaded = false; 407 plugin_loaded = false;
405 } 408 }
406 409
410#ifdef HAVE_LCD_COLOR
411 old_backdrop = lcd_get_backdrop();
412 lcd_set_backdrop(NULL);
413#endif
407 lcd_clear_display(); 414 lcd_clear_display();
408#ifdef HAVE_LCD_BITMAP 415#ifdef HAVE_LCD_BITMAP
409 xm = lcd_getxmargin(); 416 xm = lcd_getxmargin();
@@ -481,6 +488,9 @@ int plugin_load(const char* plugin, void* parameter)
481 /* restore margins */ 488 /* restore margins */
482 lcd_setmargins(xm,ym); 489 lcd_setmargins(xm,ym);
483#endif /* HAVE_LCD_BITMAP */ 490#endif /* HAVE_LCD_BITMAP */
491#ifdef HAVE_LCD_COLOR
492 lcd_set_backdrop(old_backdrop);
493#endif
484 494
485 if (pfn_tsr_exit == NULL) 495 if (pfn_tsr_exit == NULL)
486 plugin_loaded = false; 496 plugin_loaded = false;
diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c
new file mode 100644
index 0000000000..6fc5e24118
--- /dev/null
+++ b/apps/recorder/backdrop.c
@@ -0,0 +1,45 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <stdio.h>
21#include "config.h"
22#include "lcd.h"
23#include "backdrop.h"
24
25fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
26fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
27
28bool load_main_backdrop(char* filename)
29{
30 struct bitmap bm;
31 int ret;
32
33 /* load the image */
34 bm.data=(char*)&main_backdrop[0][0];
35 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), FORMAT_NATIVE);
36
37 if ((ret > 0) && (bm.width == LCD_WIDTH)
38 && (bm.height == LCD_HEIGHT)) {
39 lcd_set_backdrop(&main_backdrop[0][0]);
40 return true;
41 } else {
42 lcd_set_backdrop(NULL);
43 return false;
44 }
45}
diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h
new file mode 100644
index 0000000000..d77985cf28
--- /dev/null
+++ b/apps/recorder/backdrop.h
@@ -0,0 +1,38 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef _BACKDROP_H
21#define _BACKDROP_H
22
23#ifdef HAVE_LCD_COLOR
24
25#include "lcd.h"
26#include "bmp.h"
27#include "backdrop.h"
28
29#ifdef HAVE_LCD_COLOR
30extern fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
31extern fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
32#endif
33
34bool load_main_backdrop(char* filename);
35
36#endif
37
38#endif
diff --git a/apps/settings.c b/apps/settings.c
index ad812076a9..ebde692896 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -72,6 +72,7 @@
72#include "statusbar.h" 72#include "statusbar.h"
73#include "splash.h" 73#include "splash.h"
74#include "list.h" 74#include "list.h"
75#include "backdrop.h"
75 76
76#if CONFIG_CODEC == MAS3507D 77#if CONFIG_CODEC == MAS3507D
77void dac_line_in(bool enable); 78void dac_line_in(bool enable);
@@ -149,7 +150,10 @@ Rest of config block, only saved to disk:
1490xB8 (char[20]) WPS file 1500xB8 (char[20]) WPS file
1500xCC (char[20]) Lang file 1510xCC (char[20]) Lang file
1510xE0 (char[20]) Font file 1520xE0 (char[20]) Font file
1520xF4-0xFF <unused> 153... (char[20]) RWPS file (on targets supporting a Remote WPS)
154... (char[20]) Main backdrop file (on color LCD targets)
155
156... to 0x200 <unused>
153 157
154*************************************/ 158*************************************/
155 159
@@ -771,6 +775,8 @@ void settings_calc_config_sector(void)
771 */ 775 */
772int settings_save( void ) 776int settings_save( void )
773{ 777{
778 int i;
779
774 { 780 {
775 int elapsed_secs; 781 int elapsed_secs;
776 782
@@ -786,15 +792,25 @@ int settings_save( void )
786 save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8); 792 save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8);
787 save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8); 793 save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8);
788 794
789 strncpy((char *)&config_block[0xb8], (char *)global_settings.wps_file, 795 i = 0xb8;
796 strncpy((char *)&config_block[i], (char *)global_settings.wps_file,
790 MAX_FILENAME); 797 MAX_FILENAME);
791 strncpy((char *)&config_block[0xcc], (char *)global_settings.lang_file, 798 i+= MAX_FILENAME;
799 strncpy((char *)&config_block[i], (char *)global_settings.lang_file,
792 MAX_FILENAME); 800 MAX_FILENAME);
793 strncpy((char *)&config_block[0xe0], (char *)global_settings.font_file, 801 i+= MAX_FILENAME;
802 strncpy((char *)&config_block[i], (char *)global_settings.font_file,
794 MAX_FILENAME); 803 MAX_FILENAME);
804 i+= MAX_FILENAME;
795#ifdef HAVE_REMOTE_LCD 805#ifdef HAVE_REMOTE_LCD
796 strncpy((char *)&config_block[0xf4], (char *)global_settings.rwps_file, 806 strncpy((char *)&config_block[i], (char *)global_settings.rwps_file,
807 MAX_FILENAME);
808 i+= MAX_FILENAME;
809#endif
810#ifdef HAVE_LCD_COLOR
811 strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file,
797 MAX_FILENAME); 812 MAX_FILENAME);
813 i+= MAX_FILENAME;
798#endif 814#endif
799 815
800 if(save_config_buffer()) 816 if(save_config_buffer())
@@ -945,6 +961,18 @@ void settings_apply(void)
945 else 961 else
946 wps_data_init(gui_wps[0].data); 962 wps_data_init(gui_wps[0].data);
947 963
964#ifdef HAVE_LCD_COLOR
965 if ( global_settings.backdrop_file[0] &&
966 global_settings.backdrop_file[0] != 0xff ) {
967 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
968 global_settings.backdrop_file);
969
970 load_main_backdrop(buf);
971 } else {
972 lcd_set_backdrop(NULL);
973 }
974#endif
975
948#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) 976#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
949 if ( global_settings.rwps_file[0] && 977 if ( global_settings.rwps_file[0] &&
950 global_settings.rwps_file[0] != 0xff ) { 978 global_settings.rwps_file[0] != 0xff ) {
@@ -1056,6 +1084,7 @@ static void load_bit_table(const struct bit_entry* p_table, int count, int bitst
1056 */ 1084 */
1057void settings_load(int which) 1085void settings_load(int which)
1058{ 1086{
1087 int i;
1059 DEBUGF( "reload_all_settings()\n" ); 1088 DEBUGF( "reload_all_settings()\n" );
1060 1089
1061 /* load the buffer from the RTC (resets it to all-unused if the block 1090 /* load the buffer from the RTC (resets it to all-unused if the block
@@ -1076,15 +1105,25 @@ void settings_load(int which)
1076 if ( global_settings.contrast < MIN_CONTRAST_SETTING ) 1105 if ( global_settings.contrast < MIN_CONTRAST_SETTING )
1077 global_settings.contrast = lcd_default_contrast(); 1106 global_settings.contrast = lcd_default_contrast();
1078 1107
1079 strncpy((char *)global_settings.wps_file, (char *)&config_block[0xb8], 1108 i = 0xb8;
1109 strncpy((char *)global_settings.wps_file, (char *)&config_block[i],
1080 MAX_FILENAME); 1110 MAX_FILENAME);
1081 strncpy((char *)global_settings.lang_file, (char *)&config_block[0xcc], 1111 i+= MAX_FILENAME;
1112 strncpy((char *)global_settings.lang_file, (char *)&config_block[i],
1082 MAX_FILENAME); 1113 MAX_FILENAME);
1083 strncpy((char *)global_settings.font_file, (char *)&config_block[0xe0], 1114 i+= MAX_FILENAME;
1115 strncpy((char *)global_settings.font_file, (char *)&config_block[i],
1084 MAX_FILENAME); 1116 MAX_FILENAME);
1117 i+= MAX_FILENAME;
1085#ifdef HAVE_REMOTE_LCD 1118#ifdef HAVE_REMOTE_LCD
1086 strncpy((char *)global_settings.rwps_file, (char *)&config_block[0xf4], 1119 strncpy((char *)global_settings.rwps_file, (char *)&config_block[i],
1120 MAX_FILENAME);
1121 i+= MAX_FILENAME;
1122#endif
1123#ifdef HAVE_LCD_COLOR
1124 strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i],
1087 MAX_FILENAME); 1125 MAX_FILENAME);
1126 i+= MAX_FILENAME;
1088#endif 1127#endif
1089 } 1128 }
1090} 1129}
@@ -1246,6 +1285,13 @@ bool settings_load_config(const char* file)
1246 set_file(value, (char *)global_settings.font_file, MAX_FILENAME); 1285 set_file(value, (char *)global_settings.font_file, MAX_FILENAME);
1247 } 1286 }
1248#endif 1287#endif
1288#ifdef HAVE_LCD_COLOR
1289 else if (!strcasecmp(name, "backdrop")) {
1290 if (load_main_backdrop(value))
1291 set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME);
1292 }
1293#endif
1294
1249 1295
1250 /* check for scalar values, using the two tables */ 1296 /* check for scalar values, using the two tables */
1251 pos = load_cfg_table(table[last_table], ta_size[last_table], 1297 pos = load_cfg_table(table[last_table], ta_size[last_table],
@@ -1388,6 +1434,12 @@ bool settings_save_config(void)
1388 global_settings.font_file); 1434 global_settings.font_file);
1389#endif 1435#endif
1390 1436
1437#ifdef HAVE_LCD_COLOR
1438 if (global_settings.backdrop_file[0] != 0)
1439 fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR,
1440 global_settings.backdrop_file);
1441#endif
1442
1391 /* here's the action: write values to file, specified via table */ 1443 /* here's the action: write values to file, specified via table */
1392 save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd); 1444 save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd);
1393 save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd); 1445 save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd);
@@ -1465,6 +1517,9 @@ void settings_reset(void) {
1465#endif 1517#endif
1466 global_settings.font_file[0] = '\0'; 1518 global_settings.font_file[0] = '\0';
1467 global_settings.lang_file[0] = '\0'; 1519 global_settings.lang_file[0] = '\0';
1520#ifdef HAVE_LCD_COLOR
1521 global_settings.backdrop_file[0] = '\0';
1522#endif
1468 1523
1469} 1524}
1470 1525
diff --git a/apps/settings.h b/apps/settings.h
index ebd3ec35b0..bb58336202 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -37,6 +37,7 @@
37#define WPS_DIR ROCKBOX_DIR "/wps" 37#define WPS_DIR ROCKBOX_DIR "/wps"
38#define THEME_DIR ROCKBOX_DIR "/themes" 38#define THEME_DIR ROCKBOX_DIR "/themes"
39#define PLUGIN_DIR ROCKBOX_DIR"/rocks" 39#define PLUGIN_DIR ROCKBOX_DIR"/rocks"
40#define BACKDROP_DIR ROCKBOX_DIR"/backdrops"
40#define REC_BASE_DIR "/recordings" 41#define REC_BASE_DIR "/recordings"
41 42
42#define MAX_FILENAME 20 43#define MAX_FILENAME 20
@@ -407,6 +408,9 @@ struct user_settings
407 int brightness; /* iriver h300: backlight PWM value: 2..15 408 int brightness; /* iriver h300: backlight PWM value: 2..15
408 (0 and 1 are black) */ 409 (0 and 1 are black) */
409#endif 410#endif
411#ifdef HAVE_LCD_COLOR
412 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
413#endif
410}; 414};
411 415
412enum optiontype { INT, BOOL }; 416enum optiontype { INT, BOOL };
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 2de6d93c5c..e70ed6767b 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -300,7 +300,19 @@ static bool invert_cursor(void)
300 STR(LANG_INVERT_CURSOR_POINTER), 300 STR(LANG_INVERT_CURSOR_POINTER),
301 NULL); 301 NULL);
302} 302}
303 303
304#ifdef HAVE_LCD_COLOR
305/**
306 * Menu to clear the backdrop image
307 */
308static bool clear_main_backdrop(void)
309{
310 global_settings.backdrop_file[0]=0;
311 lcd_set_backdrop(NULL);
312 return true;
313}
314#endif
315
304/** 316/**
305 * Menu to configure the battery display on status bar 317 * Menu to configure the battery display on status bar
306 */ 318 */
@@ -1563,6 +1575,9 @@ static bool lcd_settings_menu(void)
1563 { ID2P(LANG_FLIP_DISPLAY), flip_display }, 1575 { ID2P(LANG_FLIP_DISPLAY), flip_display },
1564 { ID2P(LANG_INVERT_CURSOR), invert_cursor }, 1576 { ID2P(LANG_INVERT_CURSOR), invert_cursor },
1565#endif 1577#endif
1578#ifdef HAVE_LCD_COLOR
1579 { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop },
1580#endif
1566 }; 1581 };
1567 1582
1568 m=menu_init( items, sizeof(items) / sizeof(*items), NULL, 1583 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
diff --git a/apps/tree.c b/apps/tree.c
index 74c1059a60..b61ed0a43d 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -102,6 +102,9 @@ const struct filetype filetypes[] = {
102#ifdef HAVE_REMOTE_LCD 102#ifdef HAVE_REMOTE_LCD
103 { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, 103 { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS },
104#endif 104#endif
105#ifdef HAVE_LCD_COLOR
106 { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS },
107#endif
105 { "lng", TREE_ATTR_LNG, Icon_Language, LANG_LANGUAGE }, 108 { "lng", TREE_ATTR_LNG, Icon_Language, LANG_LANGUAGE },
106 { "rock",TREE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK }, 109 { "rock",TREE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK },
107#ifdef HAVE_LCD_BITMAP 110#ifdef HAVE_LCD_BITMAP
@@ -861,10 +864,20 @@ static bool dirbrowse(void)
861 if (start_wps && audio_status() ) 864 if (start_wps && audio_status() )
862 { 865 {
863 int i; 866 int i;
867#if HAVE_LCD_COLOR
868 fb_data* old_backdrop;
869#endif
870
864 FOR_NB_SCREENS(i) 871 FOR_NB_SCREENS(i)
865 screens[i].stop_scroll(); 872 screens[i].stop_scroll();
873#if HAVE_LCD_COLOR
874 old_backdrop = lcd_get_backdrop();
875#endif
866 if (gui_wps_show() == SYS_USB_CONNECTED) 876 if (gui_wps_show() == SYS_USB_CONNECTED)
867 reload_dir = true; 877 reload_dir = true;
878#if HAVE_LCD_COLOR
879 lcd_set_backdrop(old_backdrop);
880#endif
868#ifdef HAVE_HOTSWAP 881#ifdef HAVE_HOTSWAP
869 else 882 else
870 if (!id3db) /* Try reload to catch 'no longer valid' case. */ 883 if (!id3db) /* Try reload to catch 'no longer valid' case. */
diff --git a/apps/tree.h b/apps/tree.h
index fa0421865d..0967fb373f 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -245,7 +245,8 @@ struct tree_context {
245#define TREE_ATTR_LNG 0x0700 /* binary lang file */ 245#define TREE_ATTR_LNG 0x0700 /* binary lang file */
246#define TREE_ATTR_ROCK 0x0800 /* binary rockbox plugin */ 246#define TREE_ATTR_ROCK 0x0800 /* binary rockbox plugin */
247#define TREE_ATTR_MOD 0x0900 /* firmware file */ 247#define TREE_ATTR_MOD 0x0900 /* firmware file */
248#define TREE_ATTR_RWPS 0x1000 /* remote-wps config file */ 248#define TREE_ATTR_RWPS 0x1000 /* remote-wps config file */
249#define TREE_ATTR_BMP 0x1100 /* backdrop bmp file */
249#define TREE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */ 250#define TREE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */
250 251
251void tree_get_filetypes(const struct filetype**, int*); 252void tree_get_filetypes(const struct filetype**, int*);