summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-05-05 13:48:50 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-05-05 13:48:50 +0000
commitefd1f4e49facbcdcbb11dbf6a8ead3843df586d3 (patch)
tree1247db65aa3b5eb15814b01d3becd8dbe98d2eb0 /apps
parent268f7c42f0d7128a4c88cb1c9b64b663dd266bf6 (diff)
downloadrockbox-efd1f4e49facbcdcbb11dbf6a8ead3843df586d3.tar.gz
rockbox-efd1f4e49facbcdcbb11dbf6a8ead3843df586d3.tar.bz2
rockbox-efd1f4e49facbcdcbb11dbf6a8ead3843df586d3.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_display.c4
-rw-r--r--apps/gui/skin_engine/skin_parser.c24
-rw-r--r--apps/gui/skin_engine/skin_tokens.h1
-rw-r--r--apps/gui/skin_engine/wps_debug.c4
-rw-r--r--apps/gui/skin_engine/wps_internals.h2
-rw-r--r--apps/gui/statusbar-skinned.c18
-rw-r--r--apps/gui/statusbar-skinned.h1
7 files changed, 47 insertions, 7 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index a0b3497683..475f3a102c 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -775,6 +775,10 @@ static bool get_line(struct gui_wps *gwps,
}
}
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
case WPS_VIEWPORT_CUSTOMLIST:
draw_playlist_viewer_list(gwps, data->tokens[i].value.data);
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 6ea0180534..78ec26eaf9 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -370,6 +370,8 @@ static const struct wps_tag all_tags[] = {
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
parse_viewport_display },
+ { WPS_TOKEN_UIVIEWPORT_ENABLE, "VI", WPS_REFRESH_STATIC,
+ parse_viewport_display },
#ifdef HAVE_LCD_BITMAP
{ WPS_VIEWPORT_CUSTOMLIST, "Vp", WPS_REFRESH_STATIC, parse_playlistview },
{ 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')
{
- skin_vp->label = VP_INFO_LABEL;
- skin_vp->hidden_flags = VP_NEVER_VISIBLE;
- ++ptr;
+ if (*(ptr+1) == '|')
+ {
+ 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')
{
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index 3b155509f9..aefae40af9 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -55,6 +55,7 @@ enum wps_token_type {
/* Viewport display */
WPS_VIEWPORT_ENABLE,
WPS_VIEWPORT_CUSTOMLIST,
+ WPS_TOKEN_UIVIEWPORT_ENABLE,
/* Battery */
TOKEN_MARKER_BATTERY,
diff --git a/apps/gui/skin_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index 26554b1db6..4186e306e3 100644
--- a/apps/gui/skin_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
@@ -490,7 +490,9 @@ static char *get_token_desc(struct wps_token *token, char *buf,
break;
#endif
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);
break;
case WPS_TOKEN_BUTTON_VOLUME:
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index a014770017..edfae68e84 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -203,7 +203,7 @@ struct skin_line {
#define VP_NEVER_VISIBLE 0x8
#define VP_DEFAULT_LABEL '|'
#define VP_NO_LABEL '-'
-#define VP_INFO_LABEL '_'
+#define VP_INFO_LABEL 0x80
struct skin_viewport {
struct viewport vp; /* The LCD viewport struct */
struct skin_line *lines;
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index 0902950599..af02b9b54d 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -86,15 +86,29 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
}
/* hide this viewport, forever */
vp->hidden_flags = VP_NEVER_VISIBLE;
+ sb_set_info_vp(screen, VP_INFO_LABEL|VP_DEFAULT_LABEL);
}
if (!success && isfile)
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)
{
- 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)
diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h
index 7558d5a6f8..eb27b06196 100644
--- a/apps/gui/statusbar-skinned.h
+++ b/apps/gui/statusbar-skinned.h
@@ -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_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);
void sb_skin_update(enum screen_type screen, bool force);