summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-02-26 03:45:41 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-02-26 03:45:41 +0000
commit466e5d9aa4fcdc3da6172eb9ae125fd4157be0b9 (patch)
tree660ff0f1991703cd87e77bab3cccca190d0f5e28
parentca755f767c2d67fb2b52c292402b3b3d3be28244 (diff)
downloadrockbox-466e5d9aa4fcdc3da6172eb9ae125fd4157be0b9.tar.gz
rockbox-466e5d9aa4fcdc3da6172eb9ae125fd4157be0b9.tar.bz2
rockbox-466e5d9aa4fcdc3da6172eb9ae125fd4157be0b9.zip
2 new tags for the base skin.
%Lt - the title text for the current list %Li - the icon number. Same order as the CustomIcons list, except the first icon is the "no icon" icon. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24917 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/bitmap/list.c3
-rw-r--r--apps/gui/list.c8
-rw-r--r--apps/gui/skin_engine/skin_parser.c2
-rw-r--r--apps/gui/skin_engine/skin_tokens.c8
-rw-r--r--apps/gui/skin_engine/skin_tokens.h2
-rw-r--r--apps/gui/statusbar-skinned.c20
-rw-r--r--apps/gui/statusbar-skinned.h2
-rw-r--r--apps/gui/viewport.c1
-rw-r--r--apps/menu.c4
9 files changed, 48 insertions, 2 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index e209003372..10616c9df4 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -40,6 +40,7 @@
#include "sound.h"
#include "misc.h"
#include "viewport.h"
+#include "statusbar-skinned.h"
#define ICON_PADDING 1
@@ -82,6 +83,8 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
int style = STYLE_DEFAULT;
struct viewport *title_text_vp = &title_text[screen];
+ if (sb_set_title_text(list->title, list->title_icon, screen))
+ return false; /* the sbs is handling the title */
display->scroll_stop(title_text_vp);
if (!list_display_title(list, screen))
return false;
diff --git a/apps/gui/list.c b/apps/gui/list.c
index a3b822503b..ccb51959ff 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -39,6 +39,7 @@
#include "talk.h"
#include "viewport.h"
#include "appevents.h"
+#include "statusbar-skinned.h"
/* The minimum number of pending button events in queue before starting
* to limit list drawing interval.
@@ -399,6 +400,12 @@ void gui_synclist_set_title(struct gui_synclist * gui_list,
{
gui_list->title = title;
gui_list->title_icon = icon;
+#ifdef HAVE_LCD_BITMAP
+ int i;
+ FOR_NB_SCREENS(i)
+ sb_set_title_text(title, icon, i);
+#endif
+ send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
}
void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)
@@ -550,7 +557,6 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
#else
static int next_item_modifier = 1;
static int last_accel_tick = 0;
-
if (global_settings.list_accel_start_delay)
{
int start_delay = global_settings.list_accel_start_delay * (HZ/2);
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 844fe5f120..7fbf63bfeb 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -366,6 +366,8 @@ static const struct wps_tag all_tags[] = {
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 },
+ { WPS_TOKEN_LIST_TITLE_ICON, "Li", WPS_REFRESH_DYNAMIC, NULL },
#endif
{ WPS_NO_TOKEN, "V", 0, parse_viewport },
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 1189925ea0..a682bdf87a 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -416,6 +416,14 @@ const char *get_token_value(struct gui_wps *gwps,
case WPS_TOKEN_PLAYLIST_ENTRIES:
snprintf(buf, buf_size, "%d", playlist_amount());
return buf;
+
+ case WPS_TOKEN_LIST_TITLE_TEXT:
+ return (char*)token->value.data;
+ case WPS_TOKEN_LIST_TITLE_ICON:
+ if (intval)
+ *intval = token->value.i;
+ snprintf(buf, buf_size, "%d", token->value.i);
+ return buf;
case WPS_TOKEN_PLAYLIST_NAME:
return playlist_name(NULL, buf, buf_size);
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index 5778f95808..d0df058cf0 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -189,6 +189,8 @@ enum wps_token_type {
/* buttons */
TOKEN_MARKER_MISC,
+ WPS_TOKEN_LIST_TITLE_TEXT,
+ WPS_TOKEN_LIST_TITLE_ICON,
WPS_TOKEN_BUTTON_VOLUME,
WPS_TOKEN_LASTTOUCH,
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index f5458fb252..2ebdcca048 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -33,6 +33,7 @@
#include "statusbar-skinned.h"
#include "debug.h"
#include "font.h"
+#include "icon.h"
/* currently only one wps_state is needed */
@@ -44,6 +45,25 @@ static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false
/* initial setup of wps_data */
static int update_delay = DEFAULT_UPDATE_DELAY;
+bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen)
+{
+ int i;
+ bool retval = false;
+ for(i=0; i<sb_skin_data[screen].num_tokens; i++)
+ {
+ if (sb_skin_data[screen].tokens[i].type == WPS_TOKEN_LIST_TITLE_TEXT)
+ {
+ sb_skin_data[screen].tokens[i].value.data = title;
+ retval = true;
+ }
+ else if (sb_skin_data[screen].tokens[i].type == WPS_TOKEN_LIST_TITLE_ICON)
+ {
+ sb_skin_data[screen].tokens[i].value.i = icon+1;
+ }
+ }
+ return retval;
+}
+
void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
{
diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h
index bbd4a65018..35bde0bcc1 100644
--- a/apps/gui/statusbar-skinned.h
+++ b/apps/gui/statusbar-skinned.h
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include "config.h"
+#include "icon.h"
void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile);
@@ -39,6 +40,7 @@ struct viewport *sb_skin_get_info_vp(enum screen_type screen);
void sb_skin_update(enum screen_type screen, bool force);
void sb_skin_set_update_delay(int delay);
+bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type screen);
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
char* sb_get_backdrop(enum screen_type screen);
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 142be1c8ac..6e4d9913c4 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -104,6 +104,7 @@ static void toggle_theme(enum screen_type screen, bool force)
FOR_NB_SCREENS(i)
{
enable_event = enable_event || is_theme_enabled(i);
+ sb_set_title_text(NULL, Icon_NOICON, i);
}
toggle_events(enable_event);
diff --git a/apps/menu.c b/apps/menu.c
index eb4bf0e1c9..670a235202 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -28,6 +28,7 @@
#include "config.h"
#include "system.h"
+#include "appevents.h"
#include "lcd.h"
#include "font.h"
#include "file.h"
@@ -364,7 +365,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
/* if hide_theme is true, assume parent has been fixed before passed into
* this function, e.g. with viewport_set_defaults(parent, screen) */
- init_menu_lists(menu, &lists, selected, true, parent);
+ init_menu_lists(menu, &lists, selected, true, parent);
vps = *(lists.parent);
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
/* load the callback, and only reload it if menu changes */
@@ -604,6 +605,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
case MT_SETTING_W_TEXT:
{
do_setting_from_menu(temp, vps);
+ send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
break;
}
case MT_RETURN_ID: