diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-08-06 00:14:40 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-08-06 00:14:40 +0000 |
commit | 4764ee04c9c6432ad3cada25a8e87be056815815 (patch) | |
tree | 490154e71180349bb1991bd04445ddc0287a5db3 | |
parent | 4632fc0682cfc3e2490435d616c7fa0b48088125 (diff) | |
download | rockbox-4764ee04c9c6432ad3cada25a8e87be056815815.tar.gz rockbox-4764ee04c9c6432ad3cada25a8e87be056815815.zip |
Add backdrop functions to the multiscreen api and add a enum backdrop_type parameter for different backdrops (main, wps), symplifying calls and removing dozens of #ifdefs (stubs added for non-backdrop displays that can't do backdrops).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22176 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/bookmark.c | 10 | ||||
-rw-r--r-- | apps/filetree.c | 4 | ||||
-rw-r--r-- | apps/gui/backdrop.c | 141 | ||||
-rw-r--r-- | apps/gui/backdrop.h | 59 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_display.c | 9 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_parser.c | 19 | ||||
-rw-r--r-- | apps/gui/wps.c | 38 | ||||
-rw-r--r-- | apps/menus/theme_menu.c | 4 | ||||
-rw-r--r-- | apps/onplay.c | 4 | ||||
-rw-r--r-- | apps/screen_access.c | 11 | ||||
-rw-r--r-- | apps/screen_access.h | 4 | ||||
-rw-r--r-- | apps/screens.c | 7 | ||||
-rw-r--r-- | apps/settings.c | 19 |
13 files changed, 185 insertions, 144 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index 892a3d35b2..5b92767796 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -164,6 +164,7 @@ bool bookmark_autobookmark(void) | |||
164 | char* bookmark; | 164 | char* bookmark; |
165 | if (!system_check()) | 165 | if (!system_check()) |
166 | return false; | 166 | return false; |
167 | int i; | ||
167 | 168 | ||
168 | audio_pause(); /* first pause playback */ | 169 | audio_pause(); /* first pause playback */ |
169 | bookmark = create_bookmark(); | 170 | bookmark = create_bookmark(); |
@@ -191,12 +192,9 @@ bool bookmark_autobookmark(void) | |||
191 | str(LANG_CONFIRM_WITH_BUTTON)}; | 192 | str(LANG_CONFIRM_WITH_BUTTON)}; |
192 | const struct text_message message={lines, 2}; | 193 | const struct text_message message={lines, 2}; |
193 | #endif | 194 | #endif |
194 | #if LCD_DEPTH > 1 | 195 | FOR_NB_SCREENS(i) |
195 | show_main_backdrop(); /* switch to main backdrop as we may come from wps */ | 196 | screens[i].backdrop_show(BACKDROP_MAIN); |
196 | #endif | 197 | |
197 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
198 | show_remote_main_backdrop(); | ||
199 | #endif | ||
200 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) | 198 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) |
201 | { | 199 | { |
202 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) | 200 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) |
diff --git a/apps/filetree.c b/apps/filetree.c index e6be09ad6c..6a7da4067e 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -482,7 +482,7 @@ int ft_enter(struct tree_context* c) | |||
482 | case FILE_ATTR_WPS: | 482 | case FILE_ATTR_WPS: |
483 | splash(0, ID2P(LANG_WAIT)); | 483 | splash(0, ID2P(LANG_WAIT)); |
484 | #if LCD_DEPTH > 1 | 484 | #if LCD_DEPTH > 1 |
485 | unload_wps_backdrop(); | 485 | backdrop_unload(BACKDROP_SKIN_WPS); |
486 | #endif | 486 | #endif |
487 | wps_data_load(SCREEN_MAIN, buf, true); | 487 | wps_data_load(SCREEN_MAIN, buf, true); |
488 | set_file(buf, (char *)global_settings.wps_file, | 488 | set_file(buf, (char *)global_settings.wps_file, |
@@ -494,7 +494,7 @@ int ft_enter(struct tree_context* c) | |||
494 | case FILE_ATTR_RWPS: | 494 | case FILE_ATTR_RWPS: |
495 | splash(0, ID2P(LANG_WAIT)); | 495 | splash(0, ID2P(LANG_WAIT)); |
496 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | 496 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 |
497 | unload_remote_wps_backdrop(); | 497 | remote_backdrop_unload(BACKDROP_SKIN_WPS); |
498 | #endif | 498 | #endif |
499 | wps_data_load(SCREEN_REMOTE, buf, true); | 499 | wps_data_load(SCREEN_REMOTE, buf, true); |
500 | set_file(buf, (char *)global_settings.rwps_file, | 500 | set_file(buf, (char *)global_settings.rwps_file, |
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 | 30 | static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBHEIGHT] |
31 | static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); | 31 | __attribute__ ((aligned (16))); |
32 | static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); | 32 | static fb_data skin_backdrop[LCD_FBHEIGHT][LCD_FBHEIGHT] |
33 | #elif LCD_DEPTH == 2 | 33 | __attribute__ ((aligned (16))); |
34 | static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH]; | ||
35 | static 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 |
39 | static fb_remote_data remote_wps_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; | 36 | static fb_remote_data |
40 | static bool remote_wps_backdrop_valid = false; | 37 | remote_skin_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; |
38 | static bool remote_skin_backdrop_valid = false; | ||
41 | #endif | 39 | #endif |
42 | 40 | ||
43 | static bool main_backdrop_valid = false; | 41 | static bool main_backdrop_valid = false; |
44 | static bool wps_backdrop_valid = false; | 42 | static bool skin_backdrop_valid = false; |
45 | 43 | ||
46 | /* load a backdrop into a buffer */ | 44 | /* load a backdrop into a buffer */ |
47 | static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) | 45 | static 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 | ||
67 | bool load_main_backdrop(const char* filename) | 59 | static 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 | ||
73 | bool load_wps_backdrop(const char* filename) | 65 | static 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 | ||
79 | void unload_main_backdrop(void) | 71 | static inline void unload_main_backdrop(void) |
80 | { | 72 | { |
81 | main_backdrop_valid = false; | 73 | main_backdrop_valid = false; |
82 | } | 74 | } |
83 | 75 | ||
84 | void unload_wps_backdrop(void) | 76 | static inline void unload_skin_backdrop(void) |
85 | { | 77 | { |
86 | wps_backdrop_valid = false; | 78 | skin_backdrop_valid = false; |
87 | } | 79 | } |
88 | 80 | ||
89 | void show_main_backdrop(void) | 81 | static 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 | ||
94 | void show_wps_backdrop(void) | 86 | static 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 | |||
101 | bool 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 | |||
111 | void 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 | |||
119 | void 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 | ||
109 | static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_buffer) | 130 | static 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 | ||
129 | bool load_remote_wps_backdrop(const char* filename) | 146 | static 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 | ||
135 | void unload_remote_wps_backdrop(void) | 153 | static 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 | ||
140 | void show_remote_wps_backdrop(void) | 158 | static 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 | ||
153 | void show_remote_main_backdrop(void) | 171 | static 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 */ | ||
178 | bool 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 | |||
189 | void 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 | |||
197 | void 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 | ||
25 | enum 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 | ||
30 | bool load_main_backdrop(const char* filename); | 35 | bool backdrop_load(enum backdrop_type bdrop, const char*); |
31 | bool load_wps_backdrop(const char* filename); | 36 | void backdrop_unload(enum backdrop_type bdrop); |
37 | void backdrop_show(enum backdrop_type bdrop); | ||
38 | |||
39 | #else /* LCD_DEPTH > 1 */ | ||
40 | |||
41 | static inline | ||
42 | bool backdrop_load(enum backdrop_type bdrop, const char* filename) | ||
43 | { | ||
44 | (void)filename; (void)bdrop; return true; | ||
45 | } | ||
32 | 46 | ||
33 | void unload_main_backdrop(void); | 47 | static inline void backdrop_unload(enum backdrop_type bdrop) |
34 | void unload_wps_backdrop(void); | 48 | { |
49 | (void)bdrop; | ||
50 | } | ||
51 | static inline void backdrop_show(enum backdrop_type bdrop) | ||
52 | { | ||
53 | (void)bdrop; | ||
54 | } | ||
35 | 55 | ||
36 | void show_main_backdrop(void); | 56 | #endif |
37 | void show_wps_backdrop(void); | 57 | |
58 | #if defined(HAVE_REMOTE_LCD) | ||
59 | /* no main backdrop, stubs! */ | ||
60 | #if LCD_REMOTE_DEPTH > 1 | ||
61 | bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename); | ||
62 | void remote_backdropunload(enum backdrop_type bdrop); | ||
63 | void remote_backdrop_show(enum backdrop_type bdrop); | ||
64 | #else | ||
65 | static inline | ||
66 | bool 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 */ | 71 | static 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 | 76 | static inline void remote_backdrop_show(enum backdrop_type bdrop) |
42 | bool load_remote_wps_backdrop(const char* filename); | 77 | { |
43 | void unload_remote_wps_backdrop(void); | 78 | (void)bdrop; |
44 | void show_remote_wps_backdrop(void); | 79 | } |
45 | void 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 | ||
93 | void wps_data_load(enum screen_type screen, const char *buf, bool isfile) | 93 | void 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 |
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 25b18244a6..f96a6ced4b 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c | |||
@@ -46,8 +46,8 @@ | |||
46 | static int clear_main_backdrop(void) | 46 | static int clear_main_backdrop(void) |
47 | { | 47 | { |
48 | global_settings.backdrop_file[0]=0; | 48 | global_settings.backdrop_file[0]=0; |
49 | unload_main_backdrop(); | 49 | backdrop_unload(BACKDROP_MAIN); |
50 | show_main_backdrop(); | 50 | backdrop_show(BACKDROP_MAIN); |
51 | settings_save(); | 51 | settings_save(); |
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
diff --git a/apps/onplay.c b/apps/onplay.c index ad71f7302e..3052f8dfdb 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -560,11 +560,11 @@ static bool delete_dir(void) | |||
560 | static bool set_backdrop(void) | 560 | static bool set_backdrop(void) |
561 | { | 561 | { |
562 | /* load the image */ | 562 | /* load the image */ |
563 | if(load_main_backdrop(selected_file)) { | 563 | if(backdrop_load(BACKDROP_MAIN, selected_file)) { |
564 | splash(HZ, str(LANG_BACKDROP_LOADED)); | 564 | splash(HZ, str(LANG_BACKDROP_LOADED)); |
565 | set_file(selected_file, (char *)global_settings.backdrop_file, | 565 | set_file(selected_file, (char *)global_settings.backdrop_file, |
566 | MAX_FILENAME); | 566 | MAX_FILENAME); |
567 | show_main_backdrop(); | 567 | backdrop_show(BACKDROP_MAIN); |
568 | return true; | 568 | return true; |
569 | } else { | 569 | } else { |
570 | splash(HZ, str(LANG_BACKDROP_FAILED)); | 570 | splash(HZ, str(LANG_BACKDROP_FAILED)); |
diff --git a/apps/screen_access.c b/apps/screen_access.c index 2f928b7360..d0b483f3f4 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <icons.h> | 31 | #include <icons.h> |
32 | 32 | ||
33 | #include "screen_access.h" | 33 | #include "screen_access.h" |
34 | #include "backdrop.h" | ||
34 | 35 | ||
35 | /* some helper functions to calculate metrics on the fly */ | 36 | /* some helper functions to calculate metrics on the fly */ |
36 | static int screen_helper_getcharwidth(void) | 37 | static int screen_helper_getcharwidth(void) |
@@ -197,8 +198,11 @@ struct screen screens[NB_SCREENS] = | |||
197 | .backlight_off=&backlight_off, | 198 | .backlight_off=&backlight_off, |
198 | .is_backlight_on=&is_backlight_on, | 199 | .is_backlight_on=&is_backlight_on, |
199 | .backlight_set_timeout=&backlight_set_timeout, | 200 | .backlight_set_timeout=&backlight_set_timeout, |
201 | .backdrop_load=&backdrop_load, | ||
202 | .backdrop_unload=&backdrop_unload, | ||
203 | .backdrop_show=&backdrop_show, | ||
200 | #ifdef HAVE_BUTTONBAR | 204 | #ifdef HAVE_BUTTONBAR |
201 | .has_buttonbar=false | 205 | .has_buttonbar=false, |
202 | #endif | 206 | #endif |
203 | }, | 207 | }, |
204 | #if NB_SCREENS == 2 | 208 | #if NB_SCREENS == 2 |
@@ -278,7 +282,10 @@ struct screen screens[NB_SCREENS] = | |||
278 | .backlight_on=&remote_backlight_on, | 282 | .backlight_on=&remote_backlight_on, |
279 | .backlight_off=&remote_backlight_off, | 283 | .backlight_off=&remote_backlight_off, |
280 | .is_backlight_on=&is_remote_backlight_on, | 284 | .is_backlight_on=&is_remote_backlight_on, |
281 | .backlight_set_timeout=&remote_backlight_set_timeout | 285 | .backlight_set_timeout=&remote_backlight_set_timeout, |
286 | .backdrop_load=&remote_backdrop_load, | ||
287 | .backdrop_unload=&remote_backdrop_unload, | ||
288 | .backdrop_show=&remote_backdrop_show, | ||
282 | } | 289 | } |
283 | #endif /* HAVE_REMOTE_LCD */ | 290 | #endif /* HAVE_REMOTE_LCD */ |
284 | }; | 291 | }; |
diff --git a/apps/screen_access.h b/apps/screen_access.h index c76d2b1c86..f0fed01722 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "buttonbar.h" | 26 | #include "buttonbar.h" |
27 | #include "backdrop.h" | ||
27 | 28 | ||
28 | enum screen_type { | 29 | enum screen_type { |
29 | SCREEN_MAIN | 30 | SCREEN_MAIN |
@@ -152,6 +153,9 @@ struct screen | |||
152 | void (*backlight_off)(void); | 153 | void (*backlight_off)(void); |
153 | bool (*is_backlight_on)(bool ignore_always_off); | 154 | bool (*is_backlight_on)(bool ignore_always_off); |
154 | void (*backlight_set_timeout)(int index); | 155 | void (*backlight_set_timeout)(int index); |
156 | bool (*backdrop_load)(enum backdrop_type bdrop, const char* filename); | ||
157 | void (*backdrop_unload)(enum backdrop_type bdrop); | ||
158 | void (*backdrop_show)(enum backdrop_type bdrop); | ||
155 | }; | 159 | }; |
156 | 160 | ||
157 | #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) | 161 | #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) |
diff --git a/apps/screens.c b/apps/screens.c index 9a986716f3..9f1596cb7a 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -183,14 +183,9 @@ void usb_screen(void) | |||
183 | int i; | 183 | int i; |
184 | bool statusbar = global_settings.statusbar; /* force the statusbar */ | 184 | bool statusbar = global_settings.statusbar; /* force the statusbar */ |
185 | global_settings.statusbar = true; | 185 | global_settings.statusbar = true; |
186 | #if LCD_DEPTH > 1 | ||
187 | show_main_backdrop(); | ||
188 | #endif | ||
189 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
190 | show_remote_main_backdrop(); | ||
191 | #endif | ||
192 | FOR_NB_SCREENS(i) | 186 | FOR_NB_SCREENS(i) |
193 | { | 187 | { |
188 | screens[i].backdrop_show(BACKDROP_MAIN); | ||
194 | screens[i].backlight_on(); | 189 | screens[i].backlight_on(); |
195 | screens[i].clear_display(); | 190 | screens[i].clear_display(); |
196 | #if NB_SCREENS > 1 | 191 | #if NB_SCREENS > 1 |
diff --git a/apps/settings.c b/apps/settings.c index 423e6ed173..6a761ecdd9 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -730,6 +730,7 @@ void settings_apply(bool read_disk) | |||
730 | #if CONFIG_CODEC == SWCODEC | 730 | #if CONFIG_CODEC == SWCODEC |
731 | int i; | 731 | int i; |
732 | #endif | 732 | #endif |
733 | int screen; | ||
733 | 734 | ||
734 | sound_settings_apply(); | 735 | sound_settings_apply(); |
735 | 736 | ||
@@ -838,12 +839,7 @@ void settings_apply(bool read_disk) | |||
838 | else | 839 | else |
839 | load_kbd(NULL); | 840 | load_kbd(NULL); |
840 | #endif | 841 | #endif |
841 | #if LCD_DEPTH > 1 | 842 | |
842 | unload_wps_backdrop(); | ||
843 | #endif | ||
844 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
845 | unload_remote_wps_backdrop(); | ||
846 | #endif | ||
847 | if ( global_settings.wps_file[0] && | 843 | if ( global_settings.wps_file[0] && |
848 | global_settings.wps_file[0] != 0xff ) { | 844 | global_settings.wps_file[0] != 0xff ) { |
849 | snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", | 845 | snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", |
@@ -861,16 +857,15 @@ void settings_apply(bool read_disk) | |||
861 | global_settings.backdrop_file[0] != 0xff ) { | 857 | global_settings.backdrop_file[0] != 0xff ) { |
862 | snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", | 858 | snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", |
863 | global_settings.backdrop_file); | 859 | global_settings.backdrop_file); |
864 | load_main_backdrop(buf); | 860 | backdrop_load(BACKDROP_MAIN, buf); |
865 | } else { | 861 | } else { |
866 | unload_main_backdrop(); | 862 | backdrop_unload(BACKDROP_MAIN); |
867 | } | 863 | } |
868 | show_main_backdrop(); | ||
869 | #endif | ||
870 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
871 | show_remote_main_backdrop(); | ||
872 | #endif | 864 | #endif |
873 | 865 | ||
866 | FOR_NB_SCREENS(screen) | ||
867 | screens[screen].backdrop_show(BACKDROP_MAIN); | ||
868 | |||
874 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) | 869 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) |
875 | if ( global_settings.rwps_file[0]) { | 870 | if ( global_settings.rwps_file[0]) { |
876 | snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", | 871 | snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", |