Make it possible to move the UI viewport using conditional viewports.
%Vi|<label>|<Usual %Vi params>| <- specify the possible viewports to use %VI<label> <- make the UI viewport use the %Vi definition with the <label> label. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25826 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
268f7c42f0
commit
efd1f4e49f
7 changed files with 47 additions and 7 deletions
|
@ -775,6 +775,10 @@ static bool get_line(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WPS_TOKEN_UIVIEWPORT_ENABLE:
|
||||||
|
sb_set_info_vp(gwps->display->screen_type,
|
||||||
|
data->tokens[i].value.i|VP_INFO_LABEL);
|
||||||
|
break;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
case WPS_VIEWPORT_CUSTOMLIST:
|
case WPS_VIEWPORT_CUSTOMLIST:
|
||||||
draw_playlist_viewer_list(gwps, data->tokens[i].value.data);
|
draw_playlist_viewer_list(gwps, data->tokens[i].value.data);
|
||||||
|
|
|
@ -370,6 +370,8 @@ static const struct wps_tag all_tags[] = {
|
||||||
|
|
||||||
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
|
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
|
||||||
parse_viewport_display },
|
parse_viewport_display },
|
||||||
|
{ WPS_TOKEN_UIVIEWPORT_ENABLE, "VI", WPS_REFRESH_STATIC,
|
||||||
|
parse_viewport_display },
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ WPS_VIEWPORT_CUSTOMLIST, "Vp", WPS_REFRESH_STATIC, parse_playlistview },
|
{ WPS_VIEWPORT_CUSTOMLIST, "Vp", WPS_REFRESH_STATIC, parse_playlistview },
|
||||||
{ WPS_TOKEN_LIST_TITLE_TEXT, "Lt", WPS_REFRESH_DYNAMIC, NULL },
|
{ WPS_TOKEN_LIST_TITLE_TEXT, "Lt", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
|
@ -915,9 +917,25 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
|
|
||||||
if (*ptr == 'i')
|
if (*ptr == 'i')
|
||||||
{
|
{
|
||||||
skin_vp->label = VP_INFO_LABEL;
|
if (*(ptr+1) == '|')
|
||||||
skin_vp->hidden_flags = VP_NEVER_VISIBLE;
|
{
|
||||||
++ptr;
|
char label = *(ptr+2);
|
||||||
|
if (label >= 'a' && label <= 'z')
|
||||||
|
{
|
||||||
|
skin_vp->hidden_flags = VP_NEVER_VISIBLE;
|
||||||
|
skin_vp->label = VP_INFO_LABEL|label;
|
||||||
|
ptr += 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skin_vp->label = VP_INFO_LABEL|VP_DEFAULT_LABEL;
|
||||||
|
skin_vp->hidden_flags = VP_NEVER_VISIBLE;
|
||||||
|
++ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (*ptr == 'l')
|
else if (*ptr == 'l')
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ enum wps_token_type {
|
||||||
/* Viewport display */
|
/* Viewport display */
|
||||||
WPS_VIEWPORT_ENABLE,
|
WPS_VIEWPORT_ENABLE,
|
||||||
WPS_VIEWPORT_CUSTOMLIST,
|
WPS_VIEWPORT_CUSTOMLIST,
|
||||||
|
WPS_TOKEN_UIVIEWPORT_ENABLE,
|
||||||
|
|
||||||
/* Battery */
|
/* Battery */
|
||||||
TOKEN_MARKER_BATTERY,
|
TOKEN_MARKER_BATTERY,
|
||||||
|
|
|
@ -490,7 +490,9 @@ static char *get_token_desc(struct wps_token *token, char *buf,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case WPS_VIEWPORT_ENABLE:
|
case WPS_VIEWPORT_ENABLE:
|
||||||
snprintf(buf, bufsize, "enable VP: %c",
|
case WPS_TOKEN_UIVIEWPORT_ENABLE:
|
||||||
|
snprintf(buf, bufsize, "enable %sVP: %c",
|
||||||
|
token->type == WPS_TOKEN_UIVIEWPORT_ENABLE ? "UI " : "",
|
||||||
(char)token->value.i);
|
(char)token->value.i);
|
||||||
break;
|
break;
|
||||||
case WPS_TOKEN_BUTTON_VOLUME:
|
case WPS_TOKEN_BUTTON_VOLUME:
|
||||||
|
|
|
@ -203,7 +203,7 @@ struct skin_line {
|
||||||
#define VP_NEVER_VISIBLE 0x8
|
#define VP_NEVER_VISIBLE 0x8
|
||||||
#define VP_DEFAULT_LABEL '|'
|
#define VP_DEFAULT_LABEL '|'
|
||||||
#define VP_NO_LABEL '-'
|
#define VP_NO_LABEL '-'
|
||||||
#define VP_INFO_LABEL '_'
|
#define VP_INFO_LABEL 0x80
|
||||||
struct skin_viewport {
|
struct skin_viewport {
|
||||||
struct viewport vp; /* The LCD viewport struct */
|
struct viewport vp; /* The LCD viewport struct */
|
||||||
struct skin_line *lines;
|
struct skin_line *lines;
|
||||||
|
|
|
@ -86,15 +86,29 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
|
||||||
}
|
}
|
||||||
/* hide this viewport, forever */
|
/* hide this viewport, forever */
|
||||||
vp->hidden_flags = VP_NEVER_VISIBLE;
|
vp->hidden_flags = VP_NEVER_VISIBLE;
|
||||||
|
sb_set_info_vp(screen, VP_INFO_LABEL|VP_DEFAULT_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success && isfile)
|
if (!success && isfile)
|
||||||
sb_create_from_settings(screen);
|
sb_create_from_settings(screen);
|
||||||
}
|
}
|
||||||
|
static char infovp_label[NB_SCREENS];
|
||||||
|
static char oldinfovp_label[NB_SCREENS];
|
||||||
|
void sb_set_info_vp(enum screen_type screen, char label)
|
||||||
|
{
|
||||||
|
infovp_label[screen] = label;
|
||||||
|
}
|
||||||
|
|
||||||
struct viewport *sb_skin_get_info_vp(enum screen_type screen)
|
struct viewport *sb_skin_get_info_vp(enum screen_type screen)
|
||||||
{
|
{
|
||||||
return &find_viewport(VP_INFO_LABEL, sb_skin[screen].data)->vp;
|
if (oldinfovp_label[screen] != infovp_label[screen])
|
||||||
|
{
|
||||||
|
/* UI viewport changed, so force a redraw */
|
||||||
|
oldinfovp_label[screen] = infovp_label[screen];
|
||||||
|
viewportmanager_theme_enable(screen, false, NULL);
|
||||||
|
viewportmanager_theme_undo(screen, true);
|
||||||
|
}
|
||||||
|
return &find_viewport(infovp_label[screen], sb_skin[screen].data)->vp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
|
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
|
||||||
|
|
|
@ -36,6 +36,7 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile);
|
||||||
|
|
||||||
void sb_create_from_settings(enum screen_type screen);
|
void sb_create_from_settings(enum screen_type screen);
|
||||||
void sb_skin_init(void) INIT_ATTR;
|
void sb_skin_init(void) INIT_ATTR;
|
||||||
|
void sb_set_info_vp(enum screen_type screen, char label);
|
||||||
struct viewport *sb_skin_get_info_vp(enum screen_type screen);
|
struct viewport *sb_skin_get_info_vp(enum screen_type screen);
|
||||||
void sb_skin_update(enum screen_type screen, bool force);
|
void sb_skin_update(enum screen_type screen, bool force);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue