From ec7a0c5676ac34c7cdc41282bb1b151fd010818e Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 14 Apr 2009 22:13:29 +0000 Subject: Fix caption backlight. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20708 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 34 ---------------------------------- apps/gui/gwps.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 34 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 189fc6fa31..5ab0097b2c 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -40,7 +40,6 @@ #endif #include "abrepeat.h" #include "mp3_playback.h" -#include "backlight.h" #include "lang.h" #include "misc.h" #include "splash.h" @@ -2058,38 +2057,5 @@ bool gui_wps_redraw(struct gui_wps *gwps, display->update(); -#ifdef HAVE_BACKLIGHT - if (global_settings.caption_backlight) - { - /* turn on backlight n seconds before track ends, and turn it off n - seconds into the new track. n == backlight_timeout, or 5s */ - int n = global_settings.backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((id3->elapsed < 1000) || - ((id3->length - id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - backlight_on(); - } -#endif -#ifdef HAVE_REMOTE_LCD - if (global_settings.remote_caption_backlight) - { - /* turn on remote backlight n seconds before track ends, and turn it - off n seconds into the new track. n == remote_backlight_timeout, - or 5s */ - int n = global_settings.remote_backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((id3->elapsed < 1000) || - ((id3->length - id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - remote_backlight_on(); - } -#endif return true; } diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 6285f7793f..0c8a3aa2b1 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -81,6 +81,50 @@ static void wps_state_init(void); static void track_changed_callback(void *param); static void nextid3available_callback(void* param); + +#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) +static void gwps_caption_backlight(struct wps_state *state) +{ + if (state && state->id3) + { +#ifdef HAVE_BACKLIGHT + if (global_settings.caption_backlight) + { + /* turn on backlight n seconds before track ends, and turn it off n + seconds into the new track. n == backlight_timeout, or 5s */ + int n = global_settings.backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + backlight_on(); + } +#endif +#ifdef HAVE_REMOTE_LCD + if (global_settings.remote_caption_backlight) + { + /* turn on remote backlight n seconds before track ends, and turn it + off n seconds into the new track. n == remote_backlight_timeout, + or 5s */ + int n = global_settings.remote_backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + remote_backlight_on(); + } +#endif + } +} +#endif + + static void change_dir(int direction) { if (global_settings.prevent_skip) @@ -680,6 +724,9 @@ long gui_wps_show(void) if (wps_state.do_full_update || update) { +#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) + gwps_caption_backlight(&wps_state); +#endif FOR_NB_SCREENS(i) { #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) -- cgit v1.2.3