From 1cf2ec38b1d3fbbe62fab1daf39f617bb64516a9 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Wed, 25 Apr 2007 22:08:00 +0000 Subject: Change some ifdefs for the recent backdrop changes (fixes the yellow builds) and move the backdrop files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13265 a1c6a512-1295-4272-9138-f99709370657 --- apps/SOURCES | 7 ++- apps/bookmark.c | 2 +- apps/filetree.c | 2 +- apps/gui/backdrop.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++ apps/gui/backdrop.h | 46 ++++++++++++++ apps/gui/gwps-common.c | 7 ++- apps/gui/gwps.c | 7 ++- apps/gui/wps_parser.c | 5 +- apps/menus/display_menu.c | 5 +- apps/onplay.c | 7 ++- apps/recorder/backdrop.c | 155 ---------------------------------------------- apps/recorder/backdrop.h | 46 -------------- apps/root_menu.c | 7 ++- apps/screens.c | 2 +- apps/settings.c | 3 +- apps/tree.c | 2 +- 16 files changed, 234 insertions(+), 224 deletions(-) create mode 100644 apps/gui/backdrop.c create mode 100644 apps/gui/backdrop.h delete mode 100644 apps/recorder/backdrop.c delete mode 100644 apps/recorder/backdrop.h (limited to 'apps') diff --git a/apps/SOURCES b/apps/SOURCES index 1dabb12d2b..9467914bca 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -62,6 +62,10 @@ gui/yesno.c gui/wps_debug.c gui/wps_parser.c +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +gui/backdrop.c +#endif + #ifdef HAVE_LCD_CHARCELLS player/icons.c player/keyboard.c @@ -71,9 +75,6 @@ recorder/bmp.c recorder/icons.c recorder/keyboard.c recorder/peakmeter.c -#if LCD_DEPTH > 1 -recorder/backdrop.c -#endif #ifdef HAVE_LCD_COLOR gui/color_picker.c #endif diff --git a/apps/bookmark.c b/apps/bookmark.c index cb0dbe718a..a878dedb13 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -51,7 +51,7 @@ #include "splash.h" #include "yesno.h" -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif diff --git a/apps/filetree.c b/apps/filetree.c index 4a8e9c1868..7073e59f1b 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -50,7 +50,7 @@ #include "radio.h" #endif -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 Dave Chapman + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include "config.h" +#include "lcd.h" +#ifdef HAVE_REMOTE_LCD +#include "lcd-remote.h" +#endif +#include "backdrop.h" + +#if LCD_DEPTH >= 8 +static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); +static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); +#elif LCD_DEPTH == 2 +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; + +/* load a backdrop into a buffer */ +static bool load_backdrop(char* filename, fb_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); + + if ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT)) + { + return true; + } + else + { + return false; + } +} + +bool load_main_backdrop(char* filename) +{ + main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); + return main_backdrop_valid; +} + +bool load_wps_backdrop(char* filename) +{ + wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); + return wps_backdrop_valid; +} + +void unload_main_backdrop(void) +{ + main_backdrop_valid = false; +} + +void unload_wps_backdrop(void) +{ + wps_backdrop_valid = false; +} + +void show_main_backdrop(void) +{ + lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL); +} + +void show_wps_backdrop(void) +{ + /* if no wps backdrop, fall back to main backdrop */ + if(wps_backdrop_valid) + { + lcd_set_backdrop(&wps_backdrop[0][0]); + } + else + { + 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 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 Dave Chapman + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _BACKDROP_H +#define _BACKDROP_H + +#if LCD_DEPTH > 1 + +#include "lcd.h" +#include "bmp.h" + +bool load_main_backdrop(char* filename); +bool load_wps_backdrop(char* filename); + +void unload_main_backdrop(void); +void unload_wps_backdrop(void); + +void show_main_backdrop(void); +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 */ 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 @@ #include "bmp.h" #include "atoi.h" #endif -#if LCD_DEPTH > 1 -#include "backdrop.h" -#endif #include "dsp.h" #include "action.h" #include "cuesheet.h" +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" +#endif + #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ #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 @@ #include "playback.h" #include "splash.h" #include "cuesheet.h" -#if LCD_DEPTH > 1 -#include "backdrop.h" -#endif #include "ata_idle_notify.h" #include "root_menu.h" +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" +#endif + /* currently only on wps_state is needed */ struct wps_state wps_state; struct 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 @@ #ifdef HAVE_LCD_BITMAP #include "bmp.h" -#if LCD_DEPTH > 1 -#include "backdrop.h" #endif + +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" #endif #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 9f6b2be624..18506e7304 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -29,7 +29,6 @@ #include "tree.h" #include "list.h" #ifdef HAVE_LCD_BITMAP -#include "backdrop.h" #include "peakmeter.h" #endif #include "talk.h" @@ -37,6 +36,10 @@ #include "lcd.h" #include "lcd-remote.h" +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" +#endif + #ifdef HAVE_BACKLIGHT int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) diff --git a/apps/onplay.c b/apps/onplay.c index 6314bd932c..0bd2b01c1c 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -50,9 +50,6 @@ #include "action.h" #include "splash.h" #include "yesno.h" -#if LCD_DEPTH > 1 -#include "backdrop.h" -#endif #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif @@ -67,6 +64,10 @@ #include "tagtree.h" #endif +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" +#endif + static int context; static char* selected_file = NULL; static int selected_file_attr = 0; diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c deleted file mode 100644 index 0d023602be..0000000000 --- a/apps/recorder/backdrop.c +++ /dev/null @@ -1,155 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2006 Dave Chapman - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include -#include "config.h" -#include "lcd.h" -#ifdef HAVE_REMOTE_LCD -#include "lcd-remote.h" -#endif -#include "backdrop.h" - -#if LCD_DEPTH >= 8 -static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); -static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); -#elif LCD_DEPTH == 2 -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; - -/* load a backdrop into a buffer */ -static bool load_backdrop(char* filename, fb_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); - - if ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT)) - { - return true; - } - else - { - return false; - } -} - -bool load_main_backdrop(char* filename) -{ - main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); - return main_backdrop_valid; -} - -bool load_wps_backdrop(char* filename) -{ - wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); - return wps_backdrop_valid; -} - -void unload_main_backdrop(void) -{ - main_backdrop_valid = false; -} - -void unload_wps_backdrop(void) -{ - wps_backdrop_valid = false; -} - -void show_main_backdrop(void) -{ - lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL); -} - -void show_wps_backdrop(void) -{ - /* if no wps backdrop, fall back to main backdrop */ - if(wps_backdrop_valid) - { - lcd_set_backdrop(&wps_backdrop[0][0]); - } - else - { - 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 diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h deleted file mode 100644 index c930a87433..0000000000 --- a/apps/recorder/backdrop.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2006 Dave Chapman - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef _BACKDROP_H -#define _BACKDROP_H - -#if LCD_DEPTH > 1 - -#include "lcd.h" -#include "bmp.h" - -bool load_main_backdrop(char* filename); -bool load_wps_backdrop(char* filename); - -void unload_main_backdrop(void); -void unload_wps_backdrop(void); - -void show_main_backdrop(void); -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 */ diff --git a/apps/root_menu.c b/apps/root_menu.c index ebb13ecb92..5f16a0ecb8 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -32,12 +32,13 @@ #include "rolo.h" #include "powermgmt.h" #include "power.h" +#include "talk.h" +#include "audio.h" -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif -#include "talk.h" -#include "audio.h" + /* gui api */ #include "list.h" diff --git a/apps/screens.c b/apps/screens.c index 82ae490d75..a9f84be686 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -72,7 +72,7 @@ #include "dsp.h" #endif -#ifdef HAVE_LCD_COLOR +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif diff --git a/apps/settings.c b/apps/settings.c index ba4a98c4e2..35a063bf96 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -61,7 +61,8 @@ #include "splash.h" #include "list.h" #include "settings_list.h" -#if LCD_DEPTH > 1 + +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif diff --git a/apps/tree.c b/apps/tree.c index b847a7f112..03683dbce7 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -81,7 +81,7 @@ #include "root_menu.h" -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" #endif -- cgit v1.2.3