forked from len0rd/rockbox
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
This commit is contained in:
parent
205ec3279d
commit
7fdfa56454
11 changed files with 141 additions and 9 deletions
|
@ -180,6 +180,9 @@ bool bookmark_autobookmark(void)
|
|||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop(); /* switch to main backdrop as we may come from wps */
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
gui_syncstatusbar_draw(&statusbars, false);
|
||||
if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
|
||||
|
|
|
@ -452,6 +452,9 @@ int ft_enter(struct tree_context* c)
|
|||
gui_syncsplash(0, str(LANG_WAIT));
|
||||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(gui_wps[0].data, buf, true);
|
||||
set_file(buf, (char *)global_settings.wps_file,
|
||||
|
|
|
@ -337,6 +337,9 @@ bool gui_wps_display(void)
|
|||
/* set the default wps for the remote-screen */
|
||||
else if(i == 1)
|
||||
{
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(gui_wps[i].data,
|
||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||
|
|
|
@ -119,6 +119,10 @@ long gui_wps_show(void)
|
|||
#endif /* LCD_DEPTH > 1 */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_wps_backdrop();
|
||||
#endif
|
||||
|
||||
#ifdef AB_REPEAT_ENABLE
|
||||
ab_repeat_init();
|
||||
ab_reset_markers();
|
||||
|
@ -234,6 +238,9 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_CONTEXT:
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
action_signalscreenchange();
|
||||
if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS)
|
||||
|
@ -242,6 +249,9 @@ long gui_wps_show(void)
|
|||
#if LCD_DEPTH > 1
|
||||
show_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_wps_backdrop();
|
||||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
|
@ -500,12 +510,18 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_QUICKSCREEN:
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
if (quick_screen_quick(button))
|
||||
return SYS_USB_CONNECTED;
|
||||
#if LCD_DEPTH > 1
|
||||
show_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_wps_backdrop();
|
||||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
|
@ -521,6 +537,9 @@ long gui_wps_show(void)
|
|||
case ACTION_F3:
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
if (quick_screen_f3(BUTTON_F3))
|
||||
return SYS_USB_CONNECTED;
|
||||
|
@ -539,12 +558,18 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_PITCHSCREEN:
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
action_signalscreenchange();
|
||||
if (1 == pitch_screen())
|
||||
return SYS_USB_CONNECTED;
|
||||
#if LCD_DEPTH > 1
|
||||
show_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_wps_backdrop();
|
||||
#endif
|
||||
restore = true;
|
||||
break;
|
||||
|
@ -571,11 +596,17 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_ID3SCREEN:
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
browse_id3();
|
||||
#if LCD_DEPTH > 1
|
||||
show_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_wps_backdrop();
|
||||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
|
@ -597,6 +628,9 @@ long gui_wps_show(void)
|
|||
bookmark_autobookmark();
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
default_event_handler(SYS_POWEROFF);
|
||||
break;
|
||||
|
@ -751,4 +785,7 @@ void gui_sync_wps_init(void)
|
|||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ static const struct wps_tag all_tags[] = {
|
|||
|
||||
{ WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load },
|
||||
{ WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special },
|
||||
#if LCD_DEPTH > 1
|
||||
#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
|
||||
{ WPS_TOKEN_IMAGE_BACKDROP, "X", 0, parse_image_special },
|
||||
#endif
|
||||
#endif
|
||||
|
@ -908,17 +908,22 @@ static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
|
|||
}
|
||||
}
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
if (!wps_data->remote_wps)
|
||||
#endif
|
||||
#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
|
||||
if (backdrop_bmp_name)
|
||||
{
|
||||
get_image_filename(backdrop_bmp_name, bmpdir,
|
||||
img_path, sizeof(img_path));
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
if (wps_data->remote_wps)
|
||||
#if LCD_REMOTE_DEPTH > 1
|
||||
load_remote_wps_backdrop(img_path)
|
||||
#endif
|
||||
;
|
||||
else
|
||||
#endif /* HAVE_REMOTE_LCD */
|
||||
load_wps_backdrop(img_path);
|
||||
}
|
||||
#endif
|
||||
#endif /* has backdrop support */
|
||||
}
|
||||
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "lcd.h"
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
#include "lcd-remote.h"
|
||||
#endif
|
||||
#include "backdrop.h"
|
||||
|
||||
#if LCD_DEPTH >= 8
|
||||
|
@ -30,6 +33,11 @@ static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
|
|||
static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH];
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
static fb_remote_data remote_wps_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
|
||||
static bool remote_wps_backdrop_valid = false;
|
||||
#endif
|
||||
|
||||
static bool main_backdrop_valid = false;
|
||||
static bool wps_backdrop_valid = false;
|
||||
|
||||
|
@ -93,3 +101,55 @@ void show_wps_backdrop(void)
|
|||
show_main_backdrop();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
|
||||
static bool load_remote_backdrop(char* filename, fb_remote_data* backdrop_buffer)
|
||||
{
|
||||
struct bitmap bm;
|
||||
int ret;
|
||||
|
||||
/* load the image */
|
||||
bm.data=(char*)backdrop_buffer;
|
||||
ret = read_bmp_file(filename, &bm, sizeof(main_backdrop),
|
||||
FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE);
|
||||
|
||||
if ((ret > 0) && (bm.width == LCD_REMOTE_WIDTH) && (bm.height == LCD_REMOTE_HEIGHT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool load_remote_wps_backdrop(char* filename)
|
||||
{
|
||||
remote_wps_backdrop_valid = load_remote_backdrop(filename, &remote_wps_backdrop[0][0]);
|
||||
return remote_wps_backdrop_valid;
|
||||
}
|
||||
|
||||
void unload_remote_wps_backdrop(void)
|
||||
{
|
||||
remote_wps_backdrop_valid = false;
|
||||
}
|
||||
|
||||
void show_remote_wps_backdrop(void)
|
||||
{
|
||||
/* if no wps backdrop, fall back to main backdrop */
|
||||
if(remote_wps_backdrop_valid)
|
||||
{
|
||||
lcd_remote_set_backdrop(&remote_wps_backdrop[0][0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_remote_main_backdrop();
|
||||
}
|
||||
}
|
||||
|
||||
void show_remote_main_backdrop(void)
|
||||
{
|
||||
lcd_remote_set_backdrop(NULL);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -36,4 +36,11 @@ void show_wps_backdrop(void);
|
|||
|
||||
#endif /* LCD_DEPTH > 1 */
|
||||
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
bool load_remote_wps_backdrop(char* filename);
|
||||
void unload_remote_wps_backdrop(void);
|
||||
void show_remote_wps_backdrop(void);
|
||||
void show_remote_main_backdrop(void); /* only clears the wps backdrop */
|
||||
#endif
|
||||
|
||||
#endif /* _BACKDROP_H */
|
||||
|
|
|
@ -233,6 +233,9 @@ static int wpsscrn(void* param)
|
|||
}
|
||||
#if LCD_DEPTH > 1
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
return ret_val;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,9 @@ void usb_screen(void)
|
|||
#ifdef HAVE_LCD_COLOR
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
screens[i].backlight_on();
|
||||
|
|
|
@ -741,6 +741,9 @@ void settings_apply(void)
|
|||
|
||||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
if ( global_settings.wps_file[0] &&
|
||||
global_settings.wps_file[0] != 0xff ) {
|
||||
|
@ -767,6 +770,9 @@ void settings_apply(void)
|
|||
}
|
||||
show_main_backdrop();
|
||||
#endif
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
show_remote_main_backdrop();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
|
||||
|
|
|
@ -181,6 +181,8 @@ extern void lcd_remote_set_background(unsigned background);
|
|||
extern unsigned lcd_remote_get_background(void);
|
||||
extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
|
||||
unsigned background);
|
||||
void lcd_remote_set_backdrop(fb_remote_data* backdrop);
|
||||
fb_remote_data* lcd_remote_get_backdrop(void);
|
||||
|
||||
extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||
int src_y, int stride, int x, int y,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue