summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-25 21:44:56 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-25 21:44:56 +0000
commit7fdfa56454c0fab8cbdfcf50d852dc6fa90d4435 (patch)
treee59f8442d401de4c58750c793276ac8a65de67ae /apps
parent205ec3279d32a152f6046ecc6ad66c39f097fa4d (diff)
downloadrockbox-7fdfa56454c0fab8cbdfcf50d852dc6fa90d4435.tar.gz
rockbox-7fdfa56454c0fab8cbdfcf50d852dc6fa90d4435.zip
Add backdrop support for LCD remotes with depth > 1-bit. Only WPS backdrops, but the groundwork is laid for main backdrops too (all that's really needed are menus to set/clear them).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13263 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/bookmark.c3
-rw-r--r--apps/filetree.c3
-rw-r--r--apps/gui/gwps-common.c3
-rw-r--r--apps/gui/gwps.c37
-rw-r--r--apps/gui/wps_parser.c23
-rw-r--r--apps/recorder/backdrop.c60
-rw-r--r--apps/recorder/backdrop.h7
-rw-r--r--apps/root_menu.c3
-rw-r--r--apps/screens.c3
-rw-r--r--apps/settings.c6
10 files changed, 139 insertions, 9 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 8ff9040c2d..cb0dbe718a 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -181,6 +181,9 @@ bool bookmark_autobookmark(void)
181#if LCD_DEPTH > 1 181#if LCD_DEPTH > 1
182 show_main_backdrop(); /* switch to main backdrop as we may come from wps */ 182 show_main_backdrop(); /* switch to main backdrop as we may come from wps */
183#endif 183#endif
184#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
185 show_remote_main_backdrop();
186#endif
184 gui_syncstatusbar_draw(&statusbars, false); 187 gui_syncstatusbar_draw(&statusbars, false);
185 if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) 188 if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
186 { 189 {
diff --git a/apps/filetree.c b/apps/filetree.c
index 088d68ac1e..4a8e9c1868 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -453,6 +453,9 @@ int ft_enter(struct tree_context* c)
453#if LCD_DEPTH > 1 453#if LCD_DEPTH > 1
454 unload_wps_backdrop(); 454 unload_wps_backdrop();
455#endif 455#endif
456#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
457 unload_remote_wps_backdrop();
458#endif
456 wps_data_load(gui_wps[0].data, buf, true); 459 wps_data_load(gui_wps[0].data, buf, true);
457 set_file(buf, (char *)global_settings.wps_file, 460 set_file(buf, (char *)global_settings.wps_file,
458 MAX_FILENAME); 461 MAX_FILENAME);
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 8022209189..7f84be613b 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -337,6 +337,9 @@ bool gui_wps_display(void)
337 /* set the default wps for the remote-screen */ 337 /* set the default wps for the remote-screen */
338 else if(i == 1) 338 else if(i == 1)
339 { 339 {
340#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
341 unload_remote_wps_backdrop();
342#endif
340 wps_data_load(gui_wps[i].data, 343 wps_data_load(gui_wps[i].data,
341 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 344 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
342 "%s%?it<%?in<%in. |>%it|%fn>\n" 345 "%s%?it<%?in<%in. |>%it|%fn>\n"
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index e46f804af8..97f3b4dbbc 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -119,6 +119,10 @@ long gui_wps_show(void)
119#endif /* LCD_DEPTH > 1 */ 119#endif /* LCD_DEPTH > 1 */
120#endif 120#endif
121 121
122#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
123 show_remote_wps_backdrop();
124#endif
125
122#ifdef AB_REPEAT_ENABLE 126#ifdef AB_REPEAT_ENABLE
123 ab_repeat_init(); 127 ab_repeat_init();
124 ab_reset_markers(); 128 ab_reset_markers();
@@ -235,6 +239,9 @@ long gui_wps_show(void)
235#if LCD_DEPTH > 1 239#if LCD_DEPTH > 1
236 show_main_backdrop(); 240 show_main_backdrop();
237#endif 241#endif
242#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
243 show_remote_main_backdrop();
244#endif
238 action_signalscreenchange(); 245 action_signalscreenchange();
239 if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS) 246 if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS)
240 == ONPLAY_MAINMENU) 247 == ONPLAY_MAINMENU)
@@ -242,6 +249,9 @@ long gui_wps_show(void)
242#if LCD_DEPTH > 1 249#if LCD_DEPTH > 1
243 show_wps_backdrop(); 250 show_wps_backdrop();
244#endif 251#endif
252#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
253 show_remote_wps_backdrop();
254#endif
245#ifdef HAVE_LCD_BITMAP 255#ifdef HAVE_LCD_BITMAP
246 FOR_NB_SCREENS(i) 256 FOR_NB_SCREENS(i)
247 { 257 {
@@ -501,11 +511,17 @@ long gui_wps_show(void)
501#if LCD_DEPTH > 1 511#if LCD_DEPTH > 1
502 show_main_backdrop(); 512 show_main_backdrop();
503#endif 513#endif
514#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
515 show_remote_main_backdrop();
516#endif
504 if (quick_screen_quick(button)) 517 if (quick_screen_quick(button))
505 return SYS_USB_CONNECTED; 518 return SYS_USB_CONNECTED;
506#if LCD_DEPTH > 1 519#if LCD_DEPTH > 1
507 show_wps_backdrop(); 520 show_wps_backdrop();
508#endif 521#endif
522#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
523 show_remote_wps_backdrop();
524#endif
509#ifdef HAVE_LCD_BITMAP 525#ifdef HAVE_LCD_BITMAP
510 FOR_NB_SCREENS(i) 526 FOR_NB_SCREENS(i)
511 { 527 {
@@ -522,6 +538,9 @@ long gui_wps_show(void)
522#if LCD_DEPTH > 1 538#if LCD_DEPTH > 1
523 show_main_backdrop(); 539 show_main_backdrop();
524#endif 540#endif
541#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
542 show_remote_main_backdrop();
543#endif
525 if (quick_screen_f3(BUTTON_F3)) 544 if (quick_screen_f3(BUTTON_F3))
526 return SYS_USB_CONNECTED; 545 return SYS_USB_CONNECTED;
527#ifdef HAVE_LCD_BITMAP 546#ifdef HAVE_LCD_BITMAP
@@ -540,12 +559,18 @@ long gui_wps_show(void)
540#if LCD_DEPTH > 1 559#if LCD_DEPTH > 1
541 show_main_backdrop(); 560 show_main_backdrop();
542#endif 561#endif
562#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
563 show_remote_main_backdrop();
564#endif
543 action_signalscreenchange(); 565 action_signalscreenchange();
544 if (1 == pitch_screen()) 566 if (1 == pitch_screen())
545 return SYS_USB_CONNECTED; 567 return SYS_USB_CONNECTED;
546#if LCD_DEPTH > 1 568#if LCD_DEPTH > 1
547 show_wps_backdrop(); 569 show_wps_backdrop();
548#endif 570#endif
571#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
572 show_remote_wps_backdrop();
573#endif
549 restore = true; 574 restore = true;
550 break; 575 break;
551#endif /* HAVE_PITCHSCREEN */ 576#endif /* HAVE_PITCHSCREEN */
@@ -572,10 +597,16 @@ long gui_wps_show(void)
572#if LCD_DEPTH > 1 597#if LCD_DEPTH > 1
573 show_main_backdrop(); 598 show_main_backdrop();
574#endif 599#endif
600#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
601 show_remote_main_backdrop();
602#endif
575 browse_id3(); 603 browse_id3();
576#if LCD_DEPTH > 1 604#if LCD_DEPTH > 1
577 show_wps_backdrop(); 605 show_wps_backdrop();
578#endif 606#endif
607#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
608 show_remote_wps_backdrop();
609#endif
579#ifdef HAVE_LCD_BITMAP 610#ifdef HAVE_LCD_BITMAP
580 FOR_NB_SCREENS(i) 611 FOR_NB_SCREENS(i)
581 { 612 {
@@ -598,6 +629,9 @@ long gui_wps_show(void)
598#if LCD_DEPTH > 1 629#if LCD_DEPTH > 1
599 show_main_backdrop(); 630 show_main_backdrop();
600#endif 631#endif
632#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
633 show_remote_main_backdrop();
634#endif
601 default_event_handler(SYS_POWEROFF); 635 default_event_handler(SYS_POWEROFF);
602 break; 636 break;
603 637
@@ -751,4 +785,7 @@ void gui_sync_wps_init(void)
751#if LCD_DEPTH > 1 785#if LCD_DEPTH > 1
752 unload_wps_backdrop(); 786 unload_wps_backdrop();
753#endif 787#endif
788#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
789 unload_remote_wps_backdrop();
790#endif
754} 791}
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index b6cda91e74..2b5d1bb321 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -257,7 +257,7 @@ static const struct wps_tag all_tags[] = {
257 257
258 { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load }, 258 { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load },
259 { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special }, 259 { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special },
260#if LCD_DEPTH > 1 260#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
261 { WPS_TOKEN_IMAGE_BACKDROP, "X", 0, parse_image_special }, 261 { WPS_TOKEN_IMAGE_BACKDROP, "X", 0, parse_image_special },
262#endif 262#endif
263#endif 263#endif
@@ -908,17 +908,22 @@ static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
908 } 908 }
909 } 909 }
910 910
911#if LCD_DEPTH > 1 911#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
912 if (backdrop_bmp_name)
913 {
914 get_image_filename(backdrop_bmp_name, bmpdir,
915 img_path, sizeof(img_path));
912#ifdef HAVE_REMOTE_LCD 916#ifdef HAVE_REMOTE_LCD
913 if (!wps_data->remote_wps) 917 if (wps_data->remote_wps)
918#if LCD_REMOTE_DEPTH > 1
919 load_remote_wps_backdrop(img_path)
914#endif 920#endif
915 if (backdrop_bmp_name) 921 ;
916 { 922 else
917 get_image_filename(backdrop_bmp_name, bmpdir, 923#endif /* HAVE_REMOTE_LCD */
918 img_path, sizeof(img_path));
919 load_wps_backdrop(img_path); 924 load_wps_backdrop(img_path);
920 } 925 }
921#endif 926#endif /* has backdrop support */
922} 927}
923 928
924#endif /* HAVE_LCD_BITMAP */ 929#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c
index e31543549d..0d023602be 100644
--- a/apps/recorder/backdrop.c
+++ b/apps/recorder/backdrop.c
@@ -20,6 +20,9 @@
20#include <stdio.h> 20#include <stdio.h>
21#include "config.h" 21#include "config.h"
22#include "lcd.h" 22#include "lcd.h"
23#ifdef HAVE_REMOTE_LCD
24#include "lcd-remote.h"
25#endif
23#include "backdrop.h" 26#include "backdrop.h"
24 27
25#if LCD_DEPTH >= 8 28#if LCD_DEPTH >= 8
@@ -30,6 +33,11 @@ static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
30static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH]; 33static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
31#endif 34#endif
32 35
36#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
37static fb_remote_data remote_wps_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
38static bool remote_wps_backdrop_valid = false;
39#endif
40
33static bool main_backdrop_valid = false; 41static bool main_backdrop_valid = false;
34static bool wps_backdrop_valid = false; 42static bool wps_backdrop_valid = false;
35 43
@@ -93,3 +101,55 @@ void show_wps_backdrop(void)
93 show_main_backdrop(); 101 show_main_backdrop();
94 } 102 }
95} 103}
104
105#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
106
107static bool load_remote_backdrop(char* filename, fb_remote_data* backdrop_buffer)
108{
109 struct bitmap bm;
110 int ret;
111
112 /* load the image */
113 bm.data=(char*)backdrop_buffer;
114 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop),
115 FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE);
116
117 if ((ret > 0) && (bm.width == LCD_REMOTE_WIDTH) && (bm.height == LCD_REMOTE_HEIGHT))
118 {
119 return true;
120 }
121 else
122 {
123 return false;
124 }
125}
126
127bool load_remote_wps_backdrop(char* filename)
128{
129 remote_wps_backdrop_valid = load_remote_backdrop(filename, &remote_wps_backdrop[0][0]);
130 return remote_wps_backdrop_valid;
131}
132
133void unload_remote_wps_backdrop(void)
134{
135 remote_wps_backdrop_valid = false;
136}
137
138void show_remote_wps_backdrop(void)
139{
140 /* if no wps backdrop, fall back to main backdrop */
141 if(remote_wps_backdrop_valid)
142 {
143 lcd_remote_set_backdrop(&remote_wps_backdrop[0][0]);
144 }
145 else
146 {
147 show_remote_main_backdrop();
148 }
149}
150
151void show_remote_main_backdrop(void)
152{
153 lcd_remote_set_backdrop(NULL);
154}
155#endif
diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h
index 93373f1321..c930a87433 100644
--- a/apps/recorder/backdrop.h
+++ b/apps/recorder/backdrop.h
@@ -36,4 +36,11 @@ void show_wps_backdrop(void);
36 36
37#endif /* LCD_DEPTH > 1 */ 37#endif /* LCD_DEPTH > 1 */
38 38
39#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
40bool load_remote_wps_backdrop(char* filename);
41void unload_remote_wps_backdrop(void);
42void show_remote_wps_backdrop(void);
43void show_remote_main_backdrop(void); /* only clears the wps backdrop */
44#endif
45
39#endif /* _BACKDROP_H */ 46#endif /* _BACKDROP_H */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 9f1491df8e..ebb13ecb92 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -234,6 +234,9 @@ static int wpsscrn(void* param)
234#if LCD_DEPTH > 1 234#if LCD_DEPTH > 1
235 show_main_backdrop(); 235 show_main_backdrop();
236#endif 236#endif
237#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
238 show_remote_main_backdrop();
239#endif
237 return ret_val; 240 return ret_val;
238} 241}
239#if CONFIG_TUNER 242#if CONFIG_TUNER
diff --git a/apps/screens.c b/apps/screens.c
index 0c65ca425c..82ae490d75 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -89,6 +89,9 @@ void usb_screen(void)
89#ifdef HAVE_LCD_COLOR 89#ifdef HAVE_LCD_COLOR
90 show_main_backdrop(); 90 show_main_backdrop();
91#endif 91#endif
92#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
93 show_remote_main_backdrop();
94#endif
92 95
93 FOR_NB_SCREENS(i) 96 FOR_NB_SCREENS(i)
94 screens[i].backlight_on(); 97 screens[i].backlight_on();
diff --git a/apps/settings.c b/apps/settings.c
index 52af7cb481..ba4a98c4e2 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -742,6 +742,9 @@ void settings_apply(void)
742#if LCD_DEPTH > 1 742#if LCD_DEPTH > 1
743 unload_wps_backdrop(); 743 unload_wps_backdrop();
744#endif 744#endif
745#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
746 unload_remote_wps_backdrop();
747#endif
745 if ( global_settings.wps_file[0] && 748 if ( global_settings.wps_file[0] &&
746 global_settings.wps_file[0] != 0xff ) { 749 global_settings.wps_file[0] != 0xff ) {
747 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", 750 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
@@ -767,6 +770,9 @@ void settings_apply(void)
767 } 770 }
768 show_main_backdrop(); 771 show_main_backdrop();
769#endif 772#endif
773#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
774 show_remote_main_backdrop();
775#endif
770 776
771#ifdef HAVE_LCD_COLOR 777#ifdef HAVE_LCD_COLOR
772 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); 778 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);