mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-23 12:02:39 -05:00
[Feature] Skin engine Themes grab text from a file %ft(file, line) WIP
allow the skin engine to read text files and return a particular line you then can use ss on that string to allow display of strings from the file (Playername comes to mind) able to be used as conditional %?ft(filename)<Found|Not Found> if (selected) line of file is empty the tag is treated as #COMMENT scroll timeouts now persist thru trackchange bugfix: %t(n)%?x<text|text> would ignore the specified timeout defaulting to 2 seconds playername.txt generated at boot if it doesn't exist contents: 'RockBox!' Change-Id: I961910e01be052ef902f77e6d92fc3e367ffe9d0
This commit is contained in:
parent
c754bc5870
commit
62b5dfd81d
32 changed files with 144 additions and 50 deletions
|
|
@ -633,20 +633,23 @@ static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
|
|||
{
|
||||
token = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
if (token)
|
||||
return token->value.i;
|
||||
retval = token->value.i;
|
||||
}
|
||||
else if (element->type == CONDITIONAL)
|
||||
{
|
||||
struct conditional *conditional = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
int val = evaluate_conditional(gwps, 0, conditional,
|
||||
element->children_count);
|
||||
if (val >= 0)
|
||||
int val = evaluate_conditional(gwps, 0, conditional, element->children_count);
|
||||
|
||||
int tmoval = get_subline_timeout(gwps, get_child(element->children, val));
|
||||
if (tmoval >= 0)
|
||||
{
|
||||
retval = get_subline_timeout(gwps, get_child(element->children, val));
|
||||
if (retval >= 0)
|
||||
return retval;
|
||||
return MAX(retval, tmoval); /* Bugfix %t()%?CONDITIONAL tmo ignored */
|
||||
}
|
||||
}
|
||||
else if (element->type == COMMENT)
|
||||
{
|
||||
retval = 0; /* don't display this item */
|
||||
}
|
||||
element = SKINOFFSETTOPTR(skin_buffer, element->next);
|
||||
}
|
||||
return retval;
|
||||
|
|
@ -657,6 +660,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
|
|||
bool changed_lines = false;
|
||||
struct line_alternator *alternator = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
unsigned old_refresh = info->refresh_type;
|
||||
|
||||
if (info->refresh_type == SKIN_REFRESH_ALL)
|
||||
{
|
||||
alternator->current_line = element->children_count-1;
|
||||
|
|
@ -697,7 +701,10 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
|
|||
if (suitable)
|
||||
{
|
||||
alternator->current_line = try_line;
|
||||
alternator->next_change_tick = current_tick + rettimeout;
|
||||
if (TIME_AFTER(current_tick, alternator->next_change_tick))
|
||||
{
|
||||
alternator->next_change_tick = current_tick + rettimeout;
|
||||
}
|
||||
}
|
||||
|
||||
info->refresh_type = SKIN_REFRESH_ALL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue