1
0
Fork 0
forked from len0rd/rockbox

Add %cs tag.

It can be used conditionally and indicates the current screen (wps, rec, radio screens or lists).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23207 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-10-16 19:14:33 +00:00
parent 71411ee83a
commit 9072a4558c
5 changed files with 58 additions and 1 deletions

View file

@ -354,6 +354,7 @@ static const struct wps_tag all_tags[] = {
parse_setting_and_lang },
{ WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
{ WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_NO_TOKEN, "T", 0, parse_touchregion },
{ WPS_TOKEN_UNKNOWN, "", 0, NULL }

View file

@ -56,6 +56,10 @@
#include "wps_internals.h"
#include "wps.h"
#include "root_menu.h"
#ifdef HAVE_RECORDING
#include "recording.h"
#endif
static char* get_codectype(const struct mp3entry* id3)
{
@ -482,16 +486,20 @@ const char *get_token_value(struct gui_wps *gwps,
if (status_get_ffmode() == STATUS_FASTBACKWARD)
mode = 5;
}
#ifdef HAVE_RECORDING
/* recording */
if (status == STATUS_RECORD)
mode = 6;
else if (status == STATUS_RECORD_PAUSE)
mode = 7;
#endif
#if CONFIG_TUNER
/* radio */
if (status == STATUS_RADIO)
mode = 8;
else if (status == STATUS_RADIO_PAUSE)
mode = 9;
#endif
if (intval) {
*intval = mode;
@ -823,6 +831,44 @@ const char *get_token_value(struct gui_wps *gwps,
cfg_to_string(token->value.i,buf,buf_size);
return buf;
}
case WPS_TOKEN_CURRENT_SCREEN:
{
int curr_screen = current_screen();
#ifdef HAVE_RECORDING
/* override current_screen() for recording screen since it may
* be entered from the radio screen */
if (in_recording_screen())
curr_screen = GO_TO_RECSCREEN;
#endif
switch (curr_screen)
{
case GO_TO_WPS:
curr_screen = 2;
break;
#ifdef HAVE_RECORDING
case GO_TO_RECSCREEN:
curr_screen = 3;
break;
#endif
#if CONFIG_TUNER
case GO_TO_FM:
curr_screen = 4;
break;
#endif
default: /* lists */
curr_screen = 1;
break;
}
if (intval)
{
*intval = curr_screen;
}
snprintf(buf, buf_size, "%d", curr_screen);
return buf;
}
default:
return NULL;

View file

@ -192,6 +192,7 @@ enum wps_token_type {
/* Setting option */
WPS_TOKEN_SETTING,
WPS_TOKEN_CURRENT_SCREEN,
};
struct wps_token {

View file

@ -73,6 +73,9 @@ struct root_items {
static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume
or goto current track based on previous
screen */
int next_screen = GO_TO_ROOT;
static char current_track_path[MAX_PATH];
static void rootmenu_track_changed_callback(void* param)
{
@ -504,10 +507,14 @@ void previous_music_is_wps(void)
previous_music = GO_TO_WPS;
}
int current_screen(void)
{
return next_screen;
}
void root_menu(void)
{
int previous_browser = GO_TO_FILEBROWSER;
int next_screen = GO_TO_ROOT;
int selected = 0;
if (global_settings.start_in_screen == 0)

View file

@ -58,4 +58,6 @@ extern const struct menu_item_ex root_menu_;
extern void previous_music_is_wps(void);
extern int current_screen(void);
#endif /* __ROOT_MENU_H__ */