summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/backdrop.c155
-rw-r--r--apps/gui/backdrop.h46
-rw-r--r--apps/gui/gwps-common.c7
-rw-r--r--apps/gui/gwps.c7
-rw-r--r--apps/gui/wps_parser.c5
5 files changed, 212 insertions, 8 deletions
diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c
new file mode 100644
index 0000000000..0d023602be
--- /dev/null
+++ b/apps/gui/backdrop.c
@@ -0,0 +1,155 @@
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#ifdef HAVE_REMOTE_LCD
24#include "lcd-remote.h"
25#endif
26#include "backdrop.h"
27
28#if LCD_DEPTH >= 8
29static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16)));
30static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16)));
31#elif LCD_DEPTH == 2
32static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
33static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
34#endif
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
41static bool main_backdrop_valid = false;
42static bool wps_backdrop_valid = false;
43
44/* load a backdrop into a buffer */
45static bool load_backdrop(char* filename, fb_data* backdrop_buffer)
46{
47 struct bitmap bm;
48 int ret;
49
50 /* load the image */
51 bm.data=(char*)backdrop_buffer;
52 ret = read_bmp_file(filename, &bm, sizeof(main_backdrop),
53 FORMAT_NATIVE | FORMAT_DITHER);
54
55 if ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT))
56 {
57 return true;
58 }
59 else
60 {
61 return false;
62 }
63}
64
65bool load_main_backdrop(char* filename)
66{
67 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]);
68 return main_backdrop_valid;
69}
70
71bool load_wps_backdrop(char* filename)
72{
73 wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]);
74 return wps_backdrop_valid;
75}
76
77void unload_main_backdrop(void)
78{
79 main_backdrop_valid = false;
80}
81
82void unload_wps_backdrop(void)
83{
84 wps_backdrop_valid = false;
85}
86
87void show_main_backdrop(void)
88{
89 lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL);
90}
91
92void show_wps_backdrop(void)
93{
94 /* if no wps backdrop, fall back to main backdrop */
95 if(wps_backdrop_valid)
96 {
97 lcd_set_backdrop(&wps_backdrop[0][0]);
98 }
99 else
100 {
101 show_main_backdrop();
102 }
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/gui/backdrop.h b/apps/gui/backdrop.h
new file mode 100644
index 0000000000..c930a87433
--- /dev/null
+++ b/apps/gui/backdrop.h
@@ -0,0 +1,46 @@
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#if LCD_DEPTH > 1
24
25#include "lcd.h"
26#include "bmp.h"
27
28bool load_main_backdrop(char* filename);
29bool load_wps_backdrop(char* filename);
30
31void unload_main_backdrop(void);
32void unload_wps_backdrop(void);
33
34void show_main_backdrop(void);
35void show_wps_backdrop(void);
36
37#endif /* LCD_DEPTH > 1 */
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
46#endif /* _BACKDROP_H */
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 7f84be613b..5043b33ec0 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -49,13 +49,14 @@
49#include "bmp.h" 49#include "bmp.h"
50#include "atoi.h" 50#include "atoi.h"
51#endif 51#endif
52#if LCD_DEPTH > 1
53#include "backdrop.h"
54#endif
55#include "dsp.h" 52#include "dsp.h"
56#include "action.h" 53#include "action.h"
57#include "cuesheet.h" 54#include "cuesheet.h"
58 55
56#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
57#include "backdrop.h"
58#endif
59
59#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ 60#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
60 /* 3% of 30min file == 54s step size */ 61 /* 3% of 30min file == 54s step size */
61#define MIN_FF_REWIND_STEP 500 62#define MIN_FF_REWIND_STEP 500
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 97f3b4dbbc..d8b2751847 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -55,12 +55,13 @@
55#include "playback.h" 55#include "playback.h"
56#include "splash.h" 56#include "splash.h"
57#include "cuesheet.h" 57#include "cuesheet.h"
58#if LCD_DEPTH > 1
59#include "backdrop.h"
60#endif
61#include "ata_idle_notify.h" 58#include "ata_idle_notify.h"
62#include "root_menu.h" 59#include "root_menu.h"
63 60
61#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
62#include "backdrop.h"
63#endif
64
64/* currently only on wps_state is needed */ 65/* currently only on wps_state is needed */
65struct wps_state wps_state; 66struct wps_state wps_state;
66struct gui_wps gui_wps[NB_SCREENS]; 67struct gui_wps gui_wps[NB_SCREENS];
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 2b5d1bb321..6d8078aab9 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -30,9 +30,10 @@
30 30
31#ifdef HAVE_LCD_BITMAP 31#ifdef HAVE_LCD_BITMAP
32#include "bmp.h" 32#include "bmp.h"
33#if LCD_DEPTH > 1
34#include "backdrop.h"
35#endif 33#endif
34
35#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
36#include "backdrop.h"
36#endif 37#endif
37 38
38#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 39#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"