1
0
Fork 0
forked from len0rd/rockbox

FS#10853 - Skin support in the radio screen! Check CustomWPS for the new tags

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25964 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-05-12 10:38:00 +00:00
parent f9736c0b63
commit 1bd072c92d
60 changed files with 736 additions and 478 deletions

View file

@ -128,6 +128,9 @@ quickscreen
#if CONFIG_TUNER != 0 #if CONFIG_TUNER != 0
radio radio
#ifdef HAVE_REMOTE_LCD
radio_remote
#endif
#endif #endif
#if (CONFIG_KEYPAD == RECORDER_PAD) #if (CONFIG_KEYPAD == RECORDER_PAD)

View file

@ -331,10 +331,16 @@ int ft_load(struct tree_context* c, const char* tempdir)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
(*c->dirfilter == SHOW_FONT && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FONT) || (*c->dirfilter == SHOW_FONT && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FONT) ||
(*c->dirfilter == SHOW_SBS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_SBS) || (*c->dirfilter == SHOW_SBS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_SBS) ||
#if CONFIG_TUNER
(*c->dirfilter == SHOW_FMS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FMS) ||
#endif
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
(*c->dirfilter == SHOW_RWPS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RWPS) || (*c->dirfilter == SHOW_RWPS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RWPS) ||
(*c->dirfilter == SHOW_RSBS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RSBS) || (*c->dirfilter == SHOW_RSBS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RSBS) ||
#if CONFIG_TUNER
(*c->dirfilter == SHOW_RFMS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RFMS) ||
#endif
#endif #endif
#if CONFIG_TUNER #if CONFIG_TUNER
(*c->dirfilter == SHOW_FMR && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FMR) || (*c->dirfilter == SHOW_FMR && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FMR) ||
@ -504,6 +510,18 @@ int ft_enter(struct tree_context* c)
} }
break; break;
case FILE_ATTR_FMS:
splash(0, ID2P(LANG_WAIT));
set_file(buf, (char *)global_settings.fms_file, MAX_FILENAME);
settings_apply_skins();
break;
#ifdef HAVE_REMOTE_LCD
case FILE_ATTR_RFMS:
splash(0, ID2P(LANG_WAIT));
set_file(buf, (char *)global_settings.rfms_file, MAX_FILENAME);
settings_apply_skins();
break;
#endif
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP

View file

@ -115,6 +115,7 @@ static const struct filetype inbuilt_filetypes[] = {
#endif #endif
#if CONFIG_TUNER #if CONFIG_TUNER
{ "fmr", FILE_ATTR_FMR, Icon_Preset, LANG_FMR }, { "fmr", FILE_ATTR_FMR, Icon_Preset, LANG_FMR },
{ "fms", FILE_ATTR_FMS, Icon_Wps, VOICE_EXT_FMS },
#endif #endif
{ "lng", FILE_ATTR_LNG, Icon_Language, LANG_LANGUAGE }, { "lng", FILE_ATTR_LNG, Icon_Language, LANG_LANGUAGE },
{ "rock",FILE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK }, { "rock",FILE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK },
@ -130,6 +131,9 @@ static const struct filetype inbuilt_filetypes[] = {
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
{ "rsbs", FILE_ATTR_RSBS, Icon_Wps, VOICE_EXT_RSBS }, { "rsbs", FILE_ATTR_RSBS, Icon_Wps, VOICE_EXT_RSBS },
#if CONFIG_TUNER
{ "rfms", FILE_ATTR_RFMS, Icon_Wps, VOICE_EXT_RFMS },
#endif
#endif #endif
#ifdef BOOTFILE_EXT #ifdef BOOTFILE_EXT
{ BOOTFILE_EXT, FILE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ }, { BOOTFILE_EXT, FILE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ },

View file

@ -44,6 +44,8 @@
#define FILE_ATTR_SBS 0x0F00 /* statusbar file */ #define FILE_ATTR_SBS 0x0F00 /* statusbar file */
#define FILE_ATTR_RSBS 0x1000 /* remote statusbar file */ #define FILE_ATTR_RSBS 0x1000 /* remote statusbar file */
#define FILE_ATTR_LUA 0x1100 /* Lua rockbox plugin */ #define FILE_ATTR_LUA 0x1100 /* Lua rockbox plugin */
#define FILE_ATTR_FMS 0x1200 /* FM screen skin file */
#define FILE_ATTR_RFMS 0x1300 /* FM screen skin file */
#define FILE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */ #define FILE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */
struct filetype { struct filetype {

View file

@ -31,6 +31,7 @@
#ifdef DEBUG #ifdef DEBUG
#include "debug.h" #include "debug.h"
#endif #endif
#include "action.h"
#include "abrepeat.h" #include "abrepeat.h"
#include "lang.h" #include "lang.h"
#include "language.h" #include "language.h"
@ -57,6 +58,9 @@
#endif #endif
#include "backdrop.h" #include "backdrop.h"
#include "viewport.h" #include "viewport.h"
#include "radio.h"
#include "tuner.h"
#include "root_menu.h"
#include "wps_internals.h" #include "wps_internals.h"
@ -157,6 +161,14 @@ static void draw_progressbar(struct gui_wps *gwps,
length = id3->length; length = id3->length;
elapsed = id3->elapsed + state->ff_rewind_count; elapsed = id3->elapsed + state->ff_rewind_count;
} }
#if CONFIG_TUNER
else if (in_radio_screen())
{
int min = fm_region_data[global_settings.fm_region].freq_min;
elapsed = radio_current_frequency() - min;
length = fm_region_data[global_settings.fm_region].freq_max - min;
}
#endif
else else
{ {
length = 1; length = 1;
@ -191,8 +203,8 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
struct wps_state *state = gwps->state; struct wps_state *state = gwps->state;
int lines = viewport_get_nb_lines(viewer->vp); int lines = viewport_get_nb_lines(viewer->vp);
int line_height = font_get(viewer->vp->font)->height; int line_height = font_get(viewer->vp->font)->height;
int cur_playlist_pos = playlist_get_display_index(); int cur_pos, count;
int start_item = MAX(0, cur_playlist_pos + viewer->start_offset); int start_item;
int i; int i;
struct wps_token token; struct wps_token token;
int x, length, alignment = WPS_TOKEN_ALIGN_LEFT; int x, length, alignment = WPS_TOKEN_ALIGN_LEFT;
@ -200,39 +212,65 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
struct mp3entry *pid3; struct mp3entry *pid3;
char buf[MAX_PATH*2], tempbuf[MAX_PATH]; char buf[MAX_PATH*2], tempbuf[MAX_PATH];
const char *filename; const char *filename;
bool ismusic = true;
#if CONFIG_TUNER
if (current_screen() == GO_TO_FM)
{
cur_pos = radio_current_preset();
count = radio_preset_count();
ismusic = false;
}
else
#endif
{
cur_pos = playlist_get_display_index();
count = playlist_amount()+1;
}
start_item = MAX(0, cur_pos + viewer->start_offset);
gwps->display->set_viewport(viewer->vp); gwps->display->set_viewport(viewer->vp);
for(i=start_item; (i-start_item)<lines && i<=playlist_amount(); i++) for(i=start_item; (i-start_item)<lines && i<count; i++)
{ {
filename = playlist_peek(i-cur_playlist_pos); int line;
if (i == cur_playlist_pos) #if CONFIG_TUNER
{ if (current_screen() == GO_TO_FM)
pid3 = state->id3;
}
else if (i == cur_playlist_pos+1)
{
pid3 = state->nid3;
}
#if CONFIG_CODEC == SWCODEC
else if (i>cur_playlist_pos)
{
#ifdef HAVE_TC_RAMCACHE
if (tagcache_fill_tags(&viewer->tempid3, filename))
{
pid3 = &viewer->tempid3;
}
else
#endif
if (!audio_peek_track(&pid3, i-cur_playlist_pos))
pid3 = NULL;
}
#endif
else
{ {
pid3 = NULL; pid3 = NULL;
line = TRACK_HAS_INFO;
filename = "";
}
else
#endif
{
filename = playlist_peek(i-cur_pos);
if (i == cur_pos)
{
pid3 = state->id3;
}
else if (i == cur_pos+1)
{
pid3 = state->nid3;
}
#if CONFIG_CODEC == SWCODEC
else if (i>cur_pos)
{
#ifdef HAVE_TC_RAMCACHE
if (tagcache_fill_tags(&viewer->tempid3, filename))
{
pid3 = &viewer->tempid3;
}
else
#endif
if (!audio_peek_track(&pid3, i-cur_pos))
pid3 = NULL;
}
#endif
else
{
pid3 = NULL;
}
line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO;
} }
int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO;
int j = 0, cur_string = 0; int j = 0, cur_string = 0;
unsigned int line_len = 0; unsigned int line_len = 0;
buf[0] = '\0'; buf[0] = '\0';
@ -243,12 +281,18 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
token.value.i = 0; token.value.i = 0;
token.next = false; token.next = false;
out = get_id3_token(&token, pid3, tempbuf, sizeof(tempbuf), -1, NULL); out = get_id3_token(&token, pid3, tempbuf, sizeof(tempbuf), -1, NULL);
#if CONFIG_TUNER
if (!out)
out = get_radio_token(&token, i-cur_pos,
tempbuf, sizeof(tempbuf), -1, NULL);
#endif
if (out) if (out)
{ {
line_len = strlcat(buf, out, sizeof(buf)); line_len = strlcat(buf, out, sizeof(buf));
j++; j++;
continue; continue;
} }
switch (viewer->lines[line].tokens[j]) switch (viewer->lines[line].tokens[j])
{ {
case WPS_TOKEN_ALIGN_CENTER: case WPS_TOKEN_ALIGN_CENTER:
@ -1303,3 +1347,70 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
return true; return true;
} }
bool skin_has_sbs(enum screen_type screen, struct wps_data *data)
{
(void)screen;
bool draw = false;
#ifdef HAVE_LCD_BITMAP
if (data->wps_sb_tag)
draw = data->show_sb_on_wps;
else if (statusbar_position(screen) != STATUSBAR_OFF)
draw = true;
#endif
return draw;
}
/* do the button loop as often as required for the peak meters to update
* with a good refresh rate.
* gwps is really gwps[NB_SCREENS]! don't wrap this if FOR_NB_SCREENS()
*/
int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout)
{
#ifdef HAVE_LCD_BITMAP
int i;
int button = ACTION_NONE;
/* when the peak meter is enabled we want to have a
few extra updates to make it look smooth. On the
other hand we don't want to waste energy if it
isn't displayed */
bool pm=false;
FOR_NB_SCREENS(i)
{
if(gwps[i].data->peak_meter_enabled)
pm = true;
}
if (pm) {
long next_refresh = current_tick;
long next_big_refresh = current_tick + timeout;
button = BUTTON_NONE;
while (TIME_BEFORE(current_tick, next_big_refresh)) {
button = get_action(context,TIMEOUT_NOBLOCK);
if (button != ACTION_NONE) {
break;
}
peak_meter_peek();
sleep(0); /* Sleep until end of current tick. */
if (TIME_AFTER(current_tick, next_refresh)) {
FOR_NB_SCREENS(i)
{
if(gwps[i].data->peak_meter_enabled)
skin_update(&gwps[i], WPS_REFRESH_PEAK_METER);
next_refresh += HZ / PEAK_METER_FPS;
}
}
}
}
/* The peak meter is disabled
-> no additional screen updates needed */
else
#endif
{
button = get_action(context, timeout);
}
return button;
}

View file

@ -30,6 +30,9 @@
enum skinnable_screens { enum skinnable_screens {
CUSTOM_STATUSBAR, CUSTOM_STATUSBAR,
WPS, WPS,
#if CONFIG_TUNER
FM_SCREEN,
#endif
SKINNABLE_SCREENS_COUNT SKINNABLE_SCREENS_COUNT
@ -53,9 +56,18 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
/* call this in statusbar toggle handlers if needed */ /* call this in statusbar toggle handlers if needed */
void skin_statusbar_changed(struct gui_wps*); void skin_statusbar_changed(struct gui_wps*);
bool skin_has_sbs(enum screen_type screen, struct wps_data *data);
/* load a backdrop into the skin buffer. /* load a backdrop into the skin buffer.
* reuse buffers if the file is already loaded */ * reuse buffers if the file is already loaded */
char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen); char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen);
void skin_backdrop_init(void); void skin_backdrop_init(void);
/* do the button loop as often as required for the peak meters to update
* with a good refresh rate.
* gwps is really gwps[NB_SCREENS]! don't wrap this in FOR_NB_SCREENS()
*/
int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout);
#endif #endif

View file

@ -52,6 +52,7 @@
#include "skin_engine.h" #include "skin_engine.h"
#include "settings.h" #include "settings.h"
#include "settings_list.h" #include "settings_list.h"
#include "radio.h"
#include "skin_fonts.h" #include "skin_fonts.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -348,6 +349,25 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL },
#endif #endif
{ WPS_TOKEN_HAVE_TUNER, "tp", WPS_REFRESH_STATIC, NULL },
#if CONFIG_TUNER /* Re-uses the 't' and 'T' prefixes, be careful about doubleups */
{ WPS_TOKEN_TUNER_TUNED, "tt", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_TUNER_SCANMODE, "tm", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_TUNER_STEREO, "ts", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_TUNER_MINFREQ, "ta", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_TUNER_MAXFREQ, "tb", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_TUNER_CURFREQ, "tf", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_PRESET_ID, "Ti", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_PRESET_NAME, "Tn", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_PRESET_FREQ, "Tf", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_PRESET_COUNT, "Tc", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_HAVE_RDS, "tx", WPS_REFRESH_STATIC, NULL },
#ifdef HAVE_RDS_CAPS
{ WPS_TOKEN_RDS_NAME, "ty", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_RDS_TEXT, "tz", WPS_REFRESH_DYNAMIC, NULL },
#endif
#endif /* CONFIG_TUNER */
{ WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL },
{ WPS_TOKEN_SUBLINE_TIMEOUT, "t", 0, parse_timeout }, { WPS_TOKEN_SUBLINE_TIMEOUT, "t", 0, parse_timeout },
@ -398,10 +418,14 @@ static const struct wps_tag all_tags[] = {
/* Recording Tokens */ /* Recording Tokens */
{ WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL }, { WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL },
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
{ WPS_TOKEN_IS_RECORDING, "Rr", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_FREQ, "Rf", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_REC_FREQ, "Rf", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_ENCODER, "Re", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_REC_ENCODER, "Re", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_BITRATE, "Rb", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_REC_BITRATE, "Rb", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_MONO, "Rm", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_REC_MONO, "Rm", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_SECONDS, "Rs", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_MINUTES, "Rn", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_REC_HOURS, "Rh", WPS_REFRESH_DYNAMIC, NULL },
#endif #endif
{ WPS_TOKEN_UNKNOWN, "", 0, NULL } { WPS_TOKEN_UNKNOWN, "", 0, NULL }
/* the array MUST end with an empty string (first char is \0) */ /* the array MUST end with an empty string (first char is \0) */
@ -1723,6 +1747,13 @@ static int check_feature_tag(const char *wps_bufptr, const int type)
#else #else
return find_false_branch(wps_bufptr); return find_false_branch(wps_bufptr);
#endif #endif
case WPS_TOKEN_HAVE_TUNER:
#if CONFIG_TUNER
if (radio_hardware_present())
return 0;
#endif
return find_false_branch(wps_bufptr);
default: /* not a tag we care about, just don't skip */ default: /* not a tag we care about, just don't skip */
return 0; return 0;
} }

View file

@ -61,6 +61,8 @@
#endif #endif
#include "language.h" #include "language.h"
#include "usb.h" #include "usb.h"
#include "radio.h"
#include "tuner.h"
extern struct wps_state wps_state; extern struct wps_state wps_state;
@ -339,6 +341,89 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
return buf; return buf;
} }
#if CONFIG_TUNER
/* Tokens which are really only used by the radio screen go in here */
const char *get_radio_token(struct wps_token *token, int preset_offset,
char *buf, int buf_size, int limit, int *intval)
{
(void)limit;
switch (token->type)
{
/* Radio/tuner tokens */
case WPS_TOKEN_TUNER_TUNED:
if (tuner_get(RADIO_TUNED))
return "t";
return NULL;
case WPS_TOKEN_TUNER_SCANMODE:
if (radio_scan_mode())
return "s";
return NULL;
case WPS_TOKEN_TUNER_STEREO:
if (radio_is_stereo())
return "s";
return NULL;
case WPS_TOKEN_TUNER_MINFREQ: /* changes based on "region" */
{
int freq = fm_region_data[global_settings.fm_region].freq_min / 10000;
snprintf(buf, buf_size, "%d.%02d", freq/100, freq%100);
return buf;
}
case WPS_TOKEN_TUNER_MAXFREQ: /* changes based on "region" */
{
int freq = fm_region_data[global_settings.fm_region].freq_max / 10000;
snprintf(buf, buf_size, "%d.%02d", freq/100, freq%100);
return buf;
}
case WPS_TOKEN_TUNER_CURFREQ:
{
int freq = radio_current_frequency() / 10000;
snprintf(buf, buf_size, "%d.%02d", freq/100, freq%100);
return buf;
}
case WPS_TOKEN_PRESET_ID:
snprintf(buf, buf_size, "%d", radio_current_preset() + 1 + preset_offset);
return buf;
case WPS_TOKEN_PRESET_NAME:
case WPS_TOKEN_PRESET_FREQ:
{
int preset = radio_current_preset() + preset_offset;
if (radio_preset_count() == 0 || preset == -1)
return NULL;
/* make sure its in the valid range */
while (preset < 0)
preset += radio_preset_count();
preset %= radio_preset_count();
if (token->type == WPS_TOKEN_PRESET_NAME)
{
snprintf(buf, buf_size, "%s", radio_get_preset(preset)->name);
}
else
{
int freq = radio_get_preset(preset)->frequency / 10000;
snprintf(buf, buf_size, "%d.%02d", freq/100, freq%100);
}
return buf;
}
case WPS_TOKEN_PRESET_COUNT:
snprintf(buf, buf_size, "%d", radio_preset_count());
if (intval)
*intval = radio_preset_count();
return buf;
case WPS_TOKEN_HAVE_RDS:
#ifdef HAVE_RDS_CAP
return "rds";
case WPS_TOKEN_RDS_NAME:
return tuner_get_rds_info(RADIO_RDS_NAME);
case WPS_TOKEN_RDS_TEXT:
return tuner_get_rds_info(RADIO_RDS_TEXT);
#else
return NULL; /* end of the WPS_TOKEN_HAVE_RDS case */
#endif /* HAVE_RDS_CAP */
}
return NULL;
}
#endif
/* Return the tags value as text. buf should be used as temp storage if needed. /* Return the tags value as text. buf should be used as temp storage if needed.
intval is used with conditionals/enums: when this function is called, intval is used with conditionals/enums: when this function is called,
@ -396,6 +481,11 @@ const char *get_token_value(struct gui_wps *gwps,
out_text = get_id3_token(token, id3, buf, buf_size, limit, intval); out_text = get_id3_token(token, id3, buf, buf_size, limit, intval);
if (out_text) if (out_text)
return out_text; return out_text;
#if CONFIG_TUNER
out_text = get_radio_token(token, 0, buf, buf_size, limit, intval);
if (out_text)
return out_text;
#endif
switch (token->type) switch (token->type)
{ {
@ -971,6 +1061,9 @@ const char *get_token_value(struct gui_wps *gwps,
* The string's emptyness discards the setting's * The string's emptyness discards the setting's
* prefix and suffix */ * prefix and suffix */
*intval = ((char*)s->setting)[0]?1:2; *intval = ((char*)s->setting)[0]?1:2;
/* if there is a prefix we should ignore it here */
if (s->filename_setting->prefix)
return (char*)s->setting;
break; break;
default: default:
/* This shouldn't happen ... but you never know */ /* This shouldn't happen ... but you never know */
@ -988,6 +1081,12 @@ const char *get_token_value(struct gui_wps *gwps,
cfg_to_string(token->value.i,buf,buf_size); cfg_to_string(token->value.i,buf,buf_size);
return buf; return buf;
} }
case WPS_TOKEN_HAVE_TUNER:
#if CONFIG_TUNER
if (radio_hardware_present())
return "r";
#endif
return NULL;
/* Recording tokens */ /* Recording tokens */
case WPS_TOKEN_HAVE_RECORDING: case WPS_TOKEN_HAVE_RECORDING:
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
@ -997,6 +1096,10 @@ const char *get_token_value(struct gui_wps *gwps,
#endif #endif
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
case WPS_TOKEN_IS_RECORDING:
if (audio_status() == AUDIO_STATUS_RECORD)
return "r";
return NULL;
case WPS_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */ case WPS_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */
{ {
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
@ -1180,7 +1283,33 @@ const char *get_token_value(struct gui_wps *gwps,
return "m"; return "m";
return NULL; return NULL;
case WPS_TOKEN_REC_SECONDS:
{
int time = (audio_recorded_time() / HZ) % 60;
if (intval)
*intval = time;
snprintf(buf, buf_size, "%02d", time);
return buf;
}
case WPS_TOKEN_REC_MINUTES:
{
int time = (audio_recorded_time() / HZ) / 60;
if (intval)
*intval = time;
snprintf(buf, buf_size, "%02d", time);
return buf;
}
case WPS_TOKEN_REC_HOURS:
{
int time = (audio_recorded_time() / HZ) / 3600;
if (intval)
*intval = time;
snprintf(buf, buf_size, "%02d", time);
return buf;
}
#endif /* HAVE_RECORDING */ #endif /* HAVE_RECORDING */
case WPS_TOKEN_CURRENT_SCREEN: case WPS_TOKEN_CURRENT_SCREEN:
{ {
int curr_screen = current_screen(); int curr_screen = current_screen();

View file

@ -219,10 +219,38 @@ enum wps_token_type {
/* Recording Tokens */ /* Recording Tokens */
TOKEN_MARKER_RECORDING, TOKEN_MARKER_RECORDING,
WPS_TOKEN_HAVE_RECORDING, WPS_TOKEN_HAVE_RECORDING,
WPS_TOKEN_IS_RECORDING,
WPS_TOKEN_REC_FREQ, WPS_TOKEN_REC_FREQ,
WPS_TOKEN_REC_ENCODER, WPS_TOKEN_REC_ENCODER,
WPS_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */ WPS_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
WPS_TOKEN_REC_MONO, WPS_TOKEN_REC_MONO,
WPS_TOKEN_REC_SECONDS,
WPS_TOKEN_REC_MINUTES,
WPS_TOKEN_REC_HOURS,
/* Radio Tokens */
TOKEN_MARKER_TUNER,
WPS_TOKEN_HAVE_TUNER,
#if CONFIG_TUNER
WPS_TOKEN_TUNER_TUNED,
WPS_TOKEN_TUNER_SCANMODE,
WPS_TOKEN_TUNER_STEREO,
WPS_TOKEN_TUNER_MINFREQ, /* changes based on "region" */
WPS_TOKEN_TUNER_MAXFREQ, /* changes based on "region" */
WPS_TOKEN_TUNER_CURFREQ,
WPS_TOKEN_PRESET_ID, /* "id" of this preset.. really the array element number */
WPS_TOKEN_PRESET_NAME,
WPS_TOKEN_PRESET_FREQ,
WPS_TOKEN_PRESET_COUNT,
/* RDS tokens */
WPS_TOKEN_HAVE_RDS,
#ifdef HAVE_RDS_CAP
WPS_TOKEN_RDS_NAME,
WPS_TOKEN_RDS_TEXT,
#endif
#endif /* CONFIG_TUNER */
TOKEN_MARKER_END, /* this needs to be the last value in this enum */ TOKEN_MARKER_END, /* this needs to be the last value in this enum */
}; };

View file

@ -60,6 +60,7 @@ struct debug_token_table tokens[] = {
{ X(TOKEN_MARKER_PLAYLIST) }, { X(TOKEN_MARKER_PLAYLIST) },
{ X(TOKEN_MARKER_MISC) }, { X(TOKEN_MARKER_MISC) },
{ X(TOKEN_MARKER_RECORDING) }, { X(TOKEN_MARKER_RECORDING) },
{ X(TOKEN_MARKER_TUNER) },
{ X(TOKEN_MARKER_END) }, { X(TOKEN_MARKER_END) },
}; };
#undef X #undef X

View file

@ -371,7 +371,10 @@ const char *get_token_value(struct gui_wps *gwps,
const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
char *buf, int buf_size, int limit, int *intval); char *buf, int buf_size, int limit, int *intval);
#if CONFIG_TUNER
const char *get_radio_token(struct wps_token *token, int preset_offset,
char *buf, int buf_size, int limit, int *intval);
#endif
struct gui_img* find_image(char label, struct wps_data *data); struct gui_img* find_image(char label, struct wps_data *data);
struct skin_viewport* find_viewport(char label, struct wps_data *data); struct skin_viewport* find_viewport(char label, struct wps_data *data);

View file

@ -30,6 +30,7 @@
#include "settings.h" #include "settings.h"
#include "wps.h" #include "wps.h"
#include "file.h" #include "file.h"
#include "radio.h"
#include "skin_engine/skin_engine.h" #include "skin_engine/skin_engine.h"
#include "skin_engine/skin_fonts.h" #include "skin_engine/skin_fonts.h"
#include "statusbar-skinned.h" #include "statusbar-skinned.h"
@ -52,9 +53,15 @@ static const struct skin_load_setting skins[] = {
{ global_settings.sbs_file, "sbs", sb_skin_data_load}, { global_settings.sbs_file, "sbs", sb_skin_data_load},
#endif #endif
{ global_settings.wps_file, "wps", wps_data_load}, { global_settings.wps_file, "wps", wps_data_load},
#if CONFIG_TUNER
{ global_settings.fms_file, "fms", fms_data_load},
#endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
{ global_settings.rsbs_file, "rsbs", sb_skin_data_load}, { global_settings.rsbs_file, "rsbs", sb_skin_data_load},
{ global_settings.rwps_file, "rwps", wps_data_load}, { global_settings.rwps_file, "rwps", wps_data_load},
#if CONFIG_TUNER
{ global_settings.rfms_file, "rfms", fms_data_load},
#endif
#endif #endif
}; };
@ -68,6 +75,9 @@ void settings_apply_skins(void)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
skin_backdrop_init(); skin_backdrop_init();
skin_font_init(); skin_font_init();
#endif
#if CONFIG_TUNER
fms_skin_init();
#endif #endif
for (i=0; i<ARRAYLEN(skins); i++) for (i=0; i<ARRAYLEN(skins); i++)
{ {

View file

@ -571,15 +571,7 @@ static void gwps_leave_wps(void)
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
gui_wps[i].display->backdrop_show(sb_get_backdrop(i)); gui_wps[i].display->backdrop_show(sb_get_backdrop(i));
#endif #endif
viewportmanager_theme_undo(i, skin_has_sbs(i, gui_wps[i].data));
#ifdef HAVE_LCD_BITMAP
bool draw = false;
if (gui_wps[i].data->wps_sb_tag)
draw = gui_wps[i].data->show_sb_on_wps;
else if (statusbar_position(i) != STATUSBAR_OFF)
draw = true;
#endif
viewportmanager_theme_undo(i, draw);
} }
@ -600,15 +592,8 @@ static void gwps_enter_wps(void)
{ {
struct gui_wps *gwps = &gui_wps[i]; struct gui_wps *gwps = &gui_wps[i];
struct screen *display = gwps->display; struct screen *display = gwps->display;
#ifdef HAVE_LCD_BITMAP
bool draw = false;
if (gui_wps[i].data->wps_sb_tag)
draw = gui_wps[i].data->show_sb_on_wps;
else if (statusbar_position(i) != STATUSBAR_OFF)
draw = true;
#endif
display->stop_scroll(); display->stop_scroll();
viewportmanager_theme_enable(i, draw, NULL); viewportmanager_theme_enable(i, skin_has_sbs(i, gui_wps[i].data), NULL);
/* Update the values in the first (default) viewport - in case the user /* Update the values in the first (default) viewport - in case the user
has modified the statusbar or colour settings */ has modified the statusbar or colour settings */
@ -801,56 +786,8 @@ long gui_wps_show(void)
#endif #endif
} }
} }
#ifdef HAVE_LCD_BITMAP button = skin_wait_for_action(gui_wps, CONTEXT_WPS|ALLOW_SOFTLOCK,
/* when the peak meter is enabled we want to have a restore ? 1 : HZ/5);
few extra updates to make it look smooth. On the
other hand we don't want to waste energy if it
isn't displayed */
bool pm=false;
FOR_NB_SCREENS(i)
{
if(gui_wps[i].data->peak_meter_enabled)
pm = true;
}
if (pm) {
long next_refresh = current_tick;
long next_big_refresh = current_tick + HZ / 5;
button = BUTTON_NONE;
while (TIME_BEFORE(current_tick, next_big_refresh)) {
button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_NOBLOCK);
/* check for restore to not let the peakmeter delay the
* initial draw of the wps, don't delay handling of button
* presses either */
if (button != ACTION_NONE || restore) {
break;
}
peak_meter_peek();
sleep(0); /* Sleep until end of current tick. */
if (TIME_AFTER(current_tick, next_refresh)) {
FOR_NB_SCREENS(i)
{
if(gui_wps[i].data->peak_meter_enabled)
skin_update(&gui_wps[i], WPS_REFRESH_PEAK_METER);
next_refresh += HZ / PEAK_METER_FPS;
}
}
}
}
/* The peak meter is disabled
-> no additional screen updates needed */
else
#endif
{ /* 1 is the minimum timeout which lets other threads run.
* audio thread (apprently) needs to run before displaying the wps
* or bad things happen with regards to cuesheet
* (probably a race condition, on sh at least) */
button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,
restore ? 1 : HZ/5);
}
/* Exit if audio has stopped playing. This happens e.g. at end of /* Exit if audio has stopped playing. This happens e.g. at end of
playlist or if using the sleep timer. */ playlist or if using the sleep timer. */

View file

@ -4189,19 +4189,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "المحطة: %d.%02d ميجاهرتز"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -2774,19 +2774,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Станция: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5139,15 +5139,13 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Emisora: %d.%dMHz"
</dest> </dest>
<voice> <voice>
*: none *: none

View file

@ -6991,19 +6991,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "频道:%d.%02dMHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -7001,19 +7001,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "電台: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5179,19 +5179,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stanice: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6203,19 +6203,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Station: %d,%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5179,19 +5179,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Sender: %d,%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -7446,16 +7446,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: "Station: %d.%dMHz" *: none
</source> </source>
<dest> <dest>
*: "Station: %d.%dMHz" *: none
</dest> </dest>
<voice> <voice>
*: "" *: none
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5251,19 +5251,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Station: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -13530,3 +13527,71 @@
swcodec: "Rewind before resume" swcodec: "Rewind before resume"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_REMOTE_FMRADIO
desc: in the main menu
user: core
<source>
*:none
radio_remote: "Remote FM Radio"
</source>
<dest>
*:none
radio_remote: "Remote FM Radio"
</dest>
<voice>
*:none
radio_remote: "Remote FM Radio"
</voice>
</phrase>
<phrase>
id: VOICE_EXT_FMS
desc: spoken only, for file extension
user: core
<source>
*: none
radio: ""
</source>
<dest>
*: none
radio: ""
</dest>
<voice>
*: none
radio: "radio screen skin"
</voice>
</phrase>
<phrase>
id: VOICE_EXT_RFMS
desc: spoken only, for file extension
user: core
<source>
*: none
radio_remote: ""
</source>
<dest>
*: none
radio_remote: ""
</dest>
<voice>
*: none
radio_remote: "remote radio screen skin"
</voice>
</phrase>
<phrase>
id: LANG_FM_STATION_HEADER
desc: in radio screen
user: core
<source>
*: none
radio: "Station:"
</source>
<dest>
*: none
radio: "Station:"
</dest>
<voice>
*: none
radio: ""
</voice>
</phrase>

View file

@ -5117,19 +5117,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Emisora: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6990,16 +6990,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: "Station: %d.%02d MHz" *: none
</source> </source>
<dest> <dest>
*: "Stacio: %d.%02d MHz" *: none
</dest> </dest>
<voice> <voice>
*: "" *: none
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6992,19 +6992,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Asema: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5205,19 +5205,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Station : %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5950,16 +5950,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: "Station: %d.%02d MHz" *: none
</source> </source>
<dest> <dest>
*: "Estación: %d.%02d MHz" *: none
</dest> </dest>
<voice> <voice>
*: "" *: none
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5145,19 +5145,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Σταθμός: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5183,19 +5183,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "%d.%02d MHZ :תחנה"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6203,16 +6203,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: "Station: %d.%02d MHz" *: none
</source> </source>
<dest> <dest>
*: "Stöð: %d.%02d MHz" *: none
</dest> </dest>
<voice> <voice>
*: "" *: none
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5176,19 +5176,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stazione: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5181,19 +5181,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "局: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6997,19 +6997,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "방송국: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5233,19 +5233,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stotis: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5151,19 +5151,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Adó: %d,%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6992,19 +6992,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Zender: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: "Zender: %d.%02d MHz"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6898,15 +6898,13 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stasjon: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none

View file

@ -6205,19 +6205,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stasjon: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5185,19 +5185,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stacja: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5171,19 +5171,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Emissora: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6619,19 +6619,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Estação: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -3088,19 +3088,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Statie: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -6461,19 +6461,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Станция: %d.%02d МГц"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5175,19 +5175,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Stanica: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5158,19 +5158,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Станица: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5181,19 +5181,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Kanal: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5157,19 +5157,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Station: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5139,19 +5139,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "สถานี: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -4977,19 +4977,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Station: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5168,19 +5168,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Станцiя: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5363,16 +5363,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: "Station: %d.%02d MHz" *: none
</source> </source>
<dest> <dest>
*: "Sender: %d.%02d MHz" *: none
</dest> </dest>
<voice> <voice>
*: "" *: none
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -5179,19 +5179,16 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_FM_STATION id: LANG_FM_STATION
desc: in radio screen desc: deprecated
user: core user:
<source> <source>
*: none *: none
radio: "Station: %d.%02d MHz"
</source> </source>
<dest> <dest>
*: none *: none
radio: "Posse: %d.%02d MHz"
</dest> </dest>
<voice> <voice>
*: none *: none
radio: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -224,11 +224,17 @@ MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON,
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static struct browse_folder_info fonts = {FONT_DIR, SHOW_FONT}; static struct browse_folder_info fonts = {FONT_DIR, SHOW_FONT};
static struct browse_folder_info sbs = {SBS_DIR, SHOW_SBS}; static struct browse_folder_info sbs = {SBS_DIR, SHOW_SBS};
#if CONFIG_TUNER
static struct browse_folder_info fms = {WPS_DIR, SHOW_FMS};
#endif
#endif #endif
static struct browse_folder_info wps = {WPS_DIR, SHOW_WPS}; static struct browse_folder_info wps = {WPS_DIR, SHOW_WPS};
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
static struct browse_folder_info rwps = {WPS_DIR, SHOW_RWPS}; static struct browse_folder_info rwps = {WPS_DIR, SHOW_RWPS};
static struct browse_folder_info rsbs = {SBS_DIR, SHOW_RSBS}; static struct browse_folder_info rsbs = {SBS_DIR, SHOW_RSBS};
#if CONFIG_TUNER
static struct browse_folder_info rfms = {WPS_DIR, SHOW_RFMS};
#endif
#endif #endif
static struct browse_folder_info themes = {THEME_DIR, SHOW_CFG}; static struct browse_folder_info themes = {THEME_DIR, SHOW_CFG};
@ -247,6 +253,11 @@ MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM,
MENUITEM_FUNCTION(browse_sbs, MENU_FUNC_USEPARAM, MENUITEM_FUNCTION(browse_sbs, MENU_FUNC_USEPARAM,
ID2P(LANG_BASE_SKIN), ID2P(LANG_BASE_SKIN),
browse_folder, (void*)&sbs, NULL, Icon_Wps); browse_folder, (void*)&sbs, NULL, Icon_Wps);
#if CONFIG_TUNER
MENUITEM_FUNCTION(browse_fms, MENU_FUNC_USEPARAM,
ID2P(LANG_FM_RADIO),
browse_folder, (void*)&fms, NULL, Icon_Wps);
#endif
#endif #endif
MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM, MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM,
ID2P(LANG_WHILE_PLAYING), ID2P(LANG_WHILE_PLAYING),
@ -258,6 +269,11 @@ MENUITEM_FUNCTION(browse_rwps, MENU_FUNC_USEPARAM,
MENUITEM_FUNCTION(browse_rsbs, MENU_FUNC_USEPARAM, MENUITEM_FUNCTION(browse_rsbs, MENU_FUNC_USEPARAM,
ID2P(LANG_REMOTE_BASE_SKIN), ID2P(LANG_REMOTE_BASE_SKIN),
browse_folder, (void*)&rsbs, NULL, Icon_Wps); browse_folder, (void*)&rsbs, NULL, Icon_Wps);
#if CONFIG_TUNER
MENUITEM_FUNCTION(browse_rfms, MENU_FUNC_USEPARAM,
ID2P(LANG_REMOTE_FMRADIO),
browse_folder, (void*)&rfms, NULL, Icon_Wps);
#endif
#endif #endif
MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL); MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL);
@ -278,6 +294,12 @@ MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU),
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
&browse_rwps, &browse_rwps,
#endif #endif
#if CONFIG_TUNER
&browse_fms,
#ifdef HAVE_REMOTE_LCD
&browse_rfms,
#endif
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
&browse_sbs, &browse_sbs,
#endif #endif

View file

@ -138,7 +138,7 @@ static struct mp3entry unbuffered_id3; /* the id3 for the first unbuffered track
static struct cuesheet *curr_cue = NULL; static struct cuesheet *curr_cue = NULL;
#define MAX_MULTIPLE_AA 2 #define MAX_MULTIPLE_AA SKINNABLE_SCREENS_COUNT
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
static struct albumart_slot { static struct albumart_slot {

View file

@ -51,6 +51,7 @@
#ifdef IPOD_ACCESSORY_PROTOCOL #ifdef IPOD_ACCESSORY_PROTOCOL
#include "iap.h" #include "iap.h"
#endif #endif
#include "appevents.h"
#include "talk.h" #include "talk.h"
#include "tuner.h" #include "tuner.h"
#include "power.h" #include "power.h"
@ -66,9 +67,8 @@
#include "menus/exported_menus.h" #include "menus/exported_menus.h"
#include "root_menu.h" #include "root_menu.h"
#include "viewport.h" #include "viewport.h"
#ifdef HAVE_QUICKSCREEN #include "skin_engine/skin_engine.h"
#include "quickscreen.h" #include "statusbar-skinned.h"
#endif
#if CONFIG_TUNER #if CONFIG_TUNER
@ -100,20 +100,32 @@
#elif CONFIG_KEYPAD == ONDIO_PAD #elif CONFIG_KEYPAD == ONDIO_PAD
#define FM_RECORD_DBLPRE #define FM_RECORD_DBLPRE
#define FM_RECORD #define FM_RECORD
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) \ #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD)
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD) #define FM_MENU
#define FM_PRESET #define FM_PRESET
#define FM_STOP
#define FM_MODE #define FM_MODE
#define FM_EXIT
#define FM_PLAY
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
#define FM_PRESET #define FM_PRESET
#define FM_MODE #define FM_MODE
#elif (CONFIG_KEYPAD == COWON_D2_PAD) #elif (CONFIG_KEYPAD == COWON_D2_PAD)
#define FM_MENU
#define FM_PRESET #define FM_PRESET
#define FM_STOP
#define FM_MODE
#define FM_EXIT
#define FM_PLAY
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD) (CONFIG_KEYPAD == IPOD_1G2G_PAD)
#define FM_MENU
#define FM_STOP
#define FM_EXIT
#define FM_PLAY
#define FM_MODE #define FM_MODE
#endif #endif
@ -148,6 +160,32 @@ static int clear_preset_list(void);
static int scan_presets(void *viewports); static int scan_presets(void *viewports);
static void radio_off(void); static void radio_off(void);
bool radio_scan_mode(void)
{
return radio_mode == RADIO_SCAN_MODE;
}
bool radio_is_stereo(void)
{
return tuner_get(RADIO_STEREO) && !global_settings.fm_force_mono;
}
int radio_current_frequency(void)
{
return curr_freq;
}
int radio_current_preset(void)
{
return curr_preset;
}
int radio_preset_count(void)
{
return num_presets;
}
const struct fmstation *radio_get_preset(int preset)
{
return &presets[preset];
}
/* Function to manipulate all yesno dialogues. /* Function to manipulate all yesno dialogues.
This function needs the output text as an argument. */ This function needs the output text as an argument. */
static bool yesno_pop(const char* text) static bool yesno_pop(const char* text)
@ -460,30 +498,90 @@ static void talk_preset(int preset, bool fallback, bool enqueue)
} }
} }
static void fms_restore(struct viewport vp[NB_SCREENS]) /* Skin stuff */
extern struct wps_state wps_state; /* from wps.c */
static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }};
static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }};
static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false };
void fms_data_load(enum screen_type screen, const char *buf, bool isfile)
{
struct wps_data *data = fms_skin[screen].data;
int success;
success = buf && skin_data_load(screen, data, buf, isfile);
if (!success ) /* load the default */
{
const char default_fms[] = "%Sx|Station:| %tf\n"
"%?ts<%Sx|Stereo||%Sx|Mono|>\n"
"%?tm<%Sx|Mode:| %Sx|Scan||%Sx|Preset|: %Ti. %?Tn<%Tn|%Tf>>\n"
"%pb\n"
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
"%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|"
"%?St|prerecording time|<%Sx|Prerecord Time| %Rs|%pm>>\n"
#endif
;
skin_data_load(screen, data, default_fms, false);
}
}
enum fms_exiting {
FMS_EXIT,
FMS_ENTER
};
void fms_fix_displays(enum fms_exiting toggle_state)
{ {
struct screen *display;
int i; int i;
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
{ {
display = &screens[i]; if (toggle_state == FMS_ENTER)
display->set_viewport(&vp[i]); {
display->clear_viewport(); viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL);
display->update_viewport(); #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
screens[i].backdrop_show(fms_skin[i].data->backdrop);
#endif
screens[i].clear_display();
/* force statusbar/skin update since we just cleared the whole screen */
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
}
else
{
screens[i].stop_scroll();
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
screens[i].backdrop_show(sb_get_backdrop(i));
#endif
viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data));
}
}
}
void fms_skin_init(void)
{
int i;
FOR_NB_SCREENS(i)
{
#ifdef HAVE_ALBUMART
fms_skin_data[i].albumart = NULL;
fms_skin_data[i].playback_aa_slot = -1;
#endif
fms_skin[i].data = &fms_skin_data[i];
fms_skin[i].display = &screens[i];
/* Currently no seperate wps_state needed/possible
so use the only available ( "global" ) one */
fms_skin[i].state = &wps_state;
fms_skin[i].sync_data = &fms_skin_sync_data;
} }
} }
int radio_screen(void) int radio_screen(void)
{ {
char buf[MAX_PATH];
bool done = false; bool done = false;
int ret_val = GO_TO_ROOT; int ret_val = GO_TO_ROOT;
int button; int button;
int i; int i;
bool stereo = false, last_stereo = false; bool stereo = false, last_stereo = false;
int fh; bool update_screen = true, restore = true;
int top_of_screen = 0;
bool update_screen = true;
bool screen_freeze = false; bool screen_freeze = false;
bool keep_playing = false; bool keep_playing = false;
bool talk = false; bool talk = false;
@ -502,33 +600,10 @@ int radio_screen(void)
#ifndef HAVE_NOISY_IDLE_MODE #ifndef HAVE_NOISY_IDLE_MODE
int button_timeout = current_tick + (2*HZ); int button_timeout = current_tick + (2*HZ);
#endif #endif
struct viewport vp[NB_SCREENS];
#ifdef HAVE_BUTTONBAR
struct gui_buttonbar buttonbar;
gui_buttonbar_init(&buttonbar);
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
#endif
/* change status to "in screen" */ /* change status to "in screen" */
in_screen = true; in_screen = true;
/* always display status bar in radio screen for now */
FOR_NB_SCREENS(i)
{
viewport_set_defaults(&vp[i], i);
#ifdef HAVE_BUTTONBAR
if (global_settings.buttonbar)
vp[i].height -= BUTTONBAR_HEIGHT;
#endif
}
fms_restore(vp);
fh = font_get(FONT_UI)->height;
/* Adjust for font size, trying to center the information vertically */
if(fh < 10)
top_of_screen = 1;
if(num_presets <= 0) if(num_presets <= 0)
{ {
radio_load_presets(global_settings.fmr_file); radio_load_presets(global_settings.fmr_file);
@ -571,17 +646,12 @@ int radio_screen(void)
#endif #endif
if(num_presets < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN))) if(num_presets < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN)))
scan_presets(vp); scan_presets(NULL);
curr_preset = find_preset(curr_freq); curr_preset = find_preset(curr_freq);
if(curr_preset != -1) if(curr_preset != -1)
radio_mode = RADIO_PRESET_MODE; radio_mode = RADIO_PRESET_MODE;
#ifdef HAVE_BUTTONBAR
gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU),
str(LANG_PRESET), str(LANG_FM_BUTTONBAR_RECORD));
#endif
#ifndef HAVE_NOISY_IDLE_MODE #ifndef HAVE_NOISY_IDLE_MODE
cpu_idle_mode(true); cpu_idle_mode(true);
#endif #endif
@ -608,15 +678,8 @@ int radio_screen(void)
cancel_cpu_boost(); cancel_cpu_boost();
} }
#if CONFIG_CODEC != SWCODEC button = skin_wait_for_action(fms_skin, CONTEXT_FM,
/* TODO: Can we timeout at HZ when recording since peaks aren't update_screen ? TIMEOUT_NOBLOCK : HZ);
displayed? This should quiet recordings too. */
button = get_action(CONTEXT_FM,
update_screen ? TIMEOUT_NOBLOCK : HZ / PEAK_METER_FPS);
#else
button = get_action(CONTEXT_FM,
update_screen ? TIMEOUT_NOBLOCK : HZ);
#endif
#ifndef HAVE_NOISY_IDLE_MODE #ifndef HAVE_NOISY_IDLE_MODE
if (button != ACTION_NONE) if (button != ACTION_NONE)
@ -763,19 +826,11 @@ int radio_screen(void)
break; break;
case ACTION_FM_MENU: case ACTION_FM_MENU:
FOR_NB_SCREENS(i) fms_fix_displays(FMS_EXIT);
{
screens[i].scroll_stop(&vp[i]);
}
radio_menu(); radio_menu();
curr_preset = find_preset(curr_freq); curr_preset = find_preset(curr_freq);
fms_restore(vp);
#ifdef HAVE_BUTTONBAR
gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU),
str(LANG_PRESET),
str(LANG_FM_BUTTONBAR_RECORD));
#endif
update_screen = true; update_screen = true;
restore = true;
break; break;
#ifdef FM_PRESET #ifdef FM_PRESET
@ -784,37 +839,15 @@ int radio_screen(void)
{ {
splash(HZ, ID2P(LANG_FM_NO_PRESETS)); splash(HZ, ID2P(LANG_FM_NO_PRESETS));
update_screen = true; update_screen = true;
fms_restore(vp);
break; break;
} }
FOR_NB_SCREENS(i) fms_fix_displays(FMS_EXIT);
screens[i].scroll_stop(&vp[i]);
handle_radio_presets(); handle_radio_presets();
fms_restore(vp);
#ifdef HAVE_BUTTONBAR
gui_buttonbar_set(&buttonbar,
str(LANG_BUTTONBAR_MENU),
str(LANG_PRESET),
str(LANG_FM_BUTTONBAR_RECORD));
#endif
update_screen = true; update_screen = true;
restore = true;
break; break;
#endif /* FM_PRESET */ #endif /* FM_PRESET */
#ifdef HAVE_QUICKSCREEN
case ACTION_FM_QUICKSCREEN:
{
if (quick_screen_quick(button))
{
done = true;
break;
}
fms_restore(vp);
update_screen = true;
}
break;
#endif
#ifdef FM_FREEZE #ifdef FM_FREEZE
case ACTION_FM_FREEZE: case ACTION_FM_FREEZE:
if(!screen_freeze) if(!screen_freeze)
@ -923,17 +956,6 @@ int radio_screen(void)
{ {
/* Only display the peak meter when not recording */ /* Only display the peak meter when not recording */
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
if(!audio_status())
{
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(&vp[i]);
peak_meter_screen(&screens[i],0, fh*(top_of_screen + 4),fh);
screens[i].update_rect(0, fh*(top_of_screen + 4),
screens[i].getwidth(), fh);
}
}
if(TIME_AFTER(current_tick, timeout)) if(TIME_AFTER(current_tick, timeout))
{ {
timeout = current_tick + HZ; timeout = current_tick + HZ;
@ -957,85 +979,20 @@ int radio_screen(void)
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) #if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
seconds = audio_recorded_time() / HZ; seconds = audio_recorded_time() / HZ;
if (update_screen || seconds > last_seconds) if (update_screen || seconds > last_seconds || restore)
{ {
last_seconds = seconds; last_seconds = seconds;
#else #else
if (update_screen) if (update_screen || restore)
{ {
#endif #endif
int freq; if (restore)
fms_fix_displays(FMS_ENTER);
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
{ skin_update(&fms_skin[i], WPS_REFRESH_ALL);
screens[i].set_viewport(&vp[i]); restore = false;
}
snprintf(buf, 128, curr_preset >= 0 ? "%d. %s" : " ",
curr_preset + 1, presets[curr_preset].name);
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen, buf);
freq = curr_freq / 10000;
snprintf(buf, 128, str(LANG_FM_STATION),
freq / 100, freq % 100);
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 1, buf);
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 2,
stereo ? str(LANG_CHANNEL_STEREO) :
str(LANG_CHANNEL_MONO));
snprintf(buf, 128, "%s %s", str(LANG_MODE),
radio_mode ? str(LANG_PRESET) :
str(LANG_RADIO_SCAN_MODE));
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 3, buf);
#ifndef SIMULATOR
#ifdef HAVE_RDS_CAP
snprintf(buf, 128, "%s",tuner_get_rds_info(RADIO_RDS_NAME));
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 4, buf);
snprintf(buf, 128, "%s",tuner_get_rds_info(RADIO_RDS_TEXT));
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 5, buf);
#endif
#endif /* SIMULATOR */
#if CONFIG_CODEC != SWCODEC
if(audio_status() == AUDIO_STATUS_RECORD)
{
hours = seconds / 3600;
minutes = (seconds - (hours * 3600)) / 60;
snprintf(buf, 32, "%s %02d:%02d:%02d",
str(LANG_RECORDING_TIME),
hours, minutes, seconds%60);
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 4, buf);
}
else
{
if(rec_options.rec_prerecord_time)
{
snprintf(buf, 32, "%s %02d",
str(LANG_RECORD_PRERECORD), seconds%60);
FOR_NB_SCREENS(i)
screens[i].puts_scroll(0, top_of_screen + 4, buf);
}
}
#endif /* CONFIG_CODEC != SWCODEC */
FOR_NB_SCREENS(i)
screens[i].update_viewport();
#ifdef HAVE_BUTTONBAR
gui_buttonbar_draw(&buttonbar);
#endif
} }
} }
update_screen = false; update_screen = false;
if (global_settings.talk_file && talk if (global_settings.talk_file && talk
@ -1073,7 +1030,6 @@ int radio_screen(void)
if(audio_status() & AUDIO_STATUS_ERROR) if(audio_status() & AUDIO_STATUS_ERROR)
{ {
splash(0, str(LANG_DISK_FULL)); splash(0, str(LANG_DISK_FULL));
fms_restore(vp);
audio_error_clear(); audio_error_clear();
while(1) while(1)
@ -1116,11 +1072,7 @@ int radio_screen(void)
#ifndef HAVE_NOISY_IDLE_MODE #ifndef HAVE_NOISY_IDLE_MODE
cpu_idle_mode(false); cpu_idle_mode(false);
#endif #endif
FOR_NB_SCREENS(i) fms_fix_displays(FMS_EXIT);
{
screens[i].scroll_stop(&vp[i]);
screens[i].set_viewport(NULL);
}
in_screen = false; in_screen = false;
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
return have_recorded; return have_recorded;
@ -1471,7 +1423,6 @@ static int handle_radio_presets(void)
result = 2; result = 2;
} }
} }
gui_synclist_scroll_stop(&lists);
return result - 1; return result - 1;
} }

View file

@ -24,6 +24,7 @@
#ifndef FMRADIO_H #ifndef FMRADIO_H
#include "fmradio.h" #include "fmradio.h"
#endif #endif
#include "screen_access.h"
#if CONFIG_TUNER #if CONFIG_TUNER
void radio_load_presets(char *filename); void radio_load_presets(char *filename);
@ -34,6 +35,18 @@ void radio_pause(void);
void radio_stop(void); void radio_stop(void);
bool radio_hardware_present(void); bool radio_hardware_present(void);
bool in_radio_screen(void); bool in_radio_screen(void);
bool radio_scan_mode(void); /* true for scan mode, false for preset mode */
bool radio_is_stereo(void);
int radio_current_frequency(void);
int radio_current_preset(void);
int radio_preset_count(void);
const struct fmstation *radio_get_preset(int preset);
/* skin functions */
void fms_data_load(enum screen_type screen, const char *buf, bool isfile);
void fms_skin_init(void);
/* callbacks for the radio settings */ /* callbacks for the radio settings */
void set_radio_region(int region); void set_radio_region(int region);
void toggle_mono_mode(bool mono); void toggle_mono_mode(bool mono);

View file

@ -146,7 +146,7 @@ enum
* must be added after NUM_FILTER_MODES. */ * must be added after NUM_FILTER_MODES. */
enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB, enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
NUM_FILTER_MODES, NUM_FILTER_MODES,
SHOW_WPS, SHOW_RWPS, SHOW_SBS, SHOW_RSBS, SHOW_FMR, SHOW_CFG, SHOW_WPS, SHOW_RWPS, SHOW_FMS, SHOW_RFMS, SHOW_SBS, SHOW_RSBS, SHOW_FMR, SHOW_CFG,
SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS}; SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
/* file and dir sort options */ /* file and dir sort options */
@ -498,7 +498,11 @@ struct user_settings
int fm_region; int fm_region;
bool fm_force_mono; /* Forces Mono mode if true */ bool fm_force_mono; /* Forces Mono mode if true */
unsigned char fmr_file[MAX_FILENAME+1]; /* last fmr preset */ unsigned char fmr_file[MAX_FILENAME+1]; /* last fmr preset */
unsigned char fms_file[MAX_FILENAME+1]; /* last fms */
#ifdef HAVE_REMOTE_LCD
unsigned char rfms_file[MAX_FILENAME+1]; /* last remote-fms */
#endif #endif
#endif /* CONFIG_TUNER */
/* misc options */ /* misc options */
#ifndef HAVE_WHEEL_ACCELERATION #ifndef HAVE_WHEEL_ACCELERATION

View file

@ -203,6 +203,7 @@ static const char graphic_numeric[] = "graphic,numeric";
/* Default theme settings */ /* Default theme settings */
#define DEFAULT_WPSNAME "cabbiev2" #define DEFAULT_WPSNAME "cabbiev2"
#define DEFAULT_SBSNAME "-" #define DEFAULT_SBSNAME "-"
#define DEFAULT_FMS_NAME DEFAULT_WPSNAME
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -1456,7 +1457,13 @@ const struct settings_list settings[] = {
#if CONFIG_TUNER #if CONFIG_TUNER
TEXT_SETTING(0, fmr_file, "fmr", "-", TEXT_SETTING(0, fmr_file, "fmr", "-",
FMPRESET_PATH "/", ".fmr"), FMPRESET_PATH "/", ".fmr"),
TEXT_SETTING(F_THEMESETTING,fms_file, "fms",
DEFAULT_FMS_NAME, SBS_DIR "/", ".fms"),
#ifdef HAVE_REMOTE_LCD
TEXT_SETTING(F_THEMESETTING,rfms_file, "rfms",
DEFAULT_FMS_NAME, SBS_DIR "/", ".rfms"),
#endif #endif
#endif /* CONFIG_TUNER */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
TEXT_SETTING(F_THEMESETTING, font_file, "font", TEXT_SETTING(F_THEMESETTING, font_file, "font",
DEFAULT_FONTNAME, FONT_DIR "/", ".fnt"), DEFAULT_FONTNAME, FONT_DIR "/", ".fnt"),

View file

@ -207,6 +207,13 @@ void screen_clear_area(struct screen * display, int xstart, int ystart,
} }
#endif #endif
#if CONFIG_TUNER
bool radio_hardware_present(void)
{
return true;
}
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static int loaded_fonts = 0; static int loaded_fonts = 0;
int font_load(struct font* pf, const char *path) int font_load(struct font* pf, const char *path)