forked from len0rd/rockbox
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
This commit is contained in:
parent
ca755f767c
commit
466e5d9aa4
9 changed files with 48 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue