mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
[Feature] skinengine subline timeout hide line for n seconds
builds on top of the file text patch to add hide timeouts to subline text tags this allows you to specify both a show time and hide time for these elements %t(show, hide) also removes the 327 second limit for timeouts whne this form is used Change-Id: If4598dcc24d0c7be4380e7595b7d91c7eba3a728
This commit is contained in:
parent
eb3e5eb2bf
commit
44bfffd7c5
33 changed files with 103 additions and 59 deletions
|
|
@ -927,7 +927,8 @@ static int parse_timeout_tag(struct skin_element *element,
|
|||
{
|
||||
(void)wps_data;
|
||||
int val = 0;
|
||||
if (element->params_count == 0)
|
||||
int params_count = element->params_count;
|
||||
if (params_count == 0)
|
||||
{
|
||||
switch (token->type)
|
||||
{
|
||||
|
|
@ -943,8 +944,23 @@ static int parse_timeout_tag(struct skin_element *element,
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = get_param(element, 0)->data.number;
|
||||
token->value.i = val * TIMEOUT_UNIT;
|
||||
if (token->type == SKIN_TOKEN_SUBLINE_TIMEOUT && params_count == 2)
|
||||
{
|
||||
struct wps_subline_timeout *st = skin_buffer_alloc(sizeof(*st));
|
||||
if (st)
|
||||
{
|
||||
st->show = val;
|
||||
st->hide = get_param(element, 1)->data.number;
|
||||
st->next_tick = current_tick; /* show immediately the first time */
|
||||
token->type = SKIN_TOKEN_SUBLINE_TIMEOUT_HIDE;
|
||||
token->value.data = PTRTOSKINOFFSET(skin_buffer, st);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
token->value.i = val * TIMEOUT_UNIT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1378,6 +1394,7 @@ failure:
|
|||
element->type = COMMENT;
|
||||
element->data = INVALID_OFFSET;
|
||||
token->type = SKIN_TOKEN_NO_TOKEN;
|
||||
token->value.data = INVALID_OFFSET;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -628,25 +628,39 @@ static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
|
|||
}
|
||||
while (element)
|
||||
{
|
||||
if (element->type == TAG &&
|
||||
element->tag->type == SKIN_TOKEN_SUBLINE_TIMEOUT )
|
||||
int type = element->type;
|
||||
if (type == TAG && element->tag->type == SKIN_TOKEN_SUBLINE_TIMEOUT)
|
||||
{
|
||||
token = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
if (token)
|
||||
retval = token->value.i;
|
||||
{
|
||||
if (token->type == SKIN_TOKEN_SUBLINE_TIMEOUT_HIDE)
|
||||
{
|
||||
struct wps_subline_timeout *st;
|
||||
st = SKINOFFSETTOPTR(skin_buffer, token->value.data);
|
||||
retval = st->show * TIMEOUT_UNIT;
|
||||
if (st->hide != 0)
|
||||
{
|
||||
if(TIME_BEFORE(current_tick, st->next_tick))
|
||||
retval = 0; /* don't display yet.. */
|
||||
else
|
||||
st->next_tick = current_tick + st->hide * TIMEOUT_UNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
retval = token->value.i;
|
||||
}
|
||||
}
|
||||
else if (element->type == CONDITIONAL)
|
||||
else if (type == CONDITIONAL)
|
||||
{
|
||||
struct conditional *conditional = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
int val = evaluate_conditional(gwps, 0, conditional, element->children_count);
|
||||
|
||||
int tmoval = get_subline_timeout(gwps, get_child(element->children, val));
|
||||
if (tmoval >= 0)
|
||||
{
|
||||
return MAX(retval, tmoval); /* Bugfix %t()%?CONDITIONAL tmo ignored */
|
||||
}
|
||||
}
|
||||
else if (element->type == COMMENT)
|
||||
else if (type == COMMENT)
|
||||
{
|
||||
retval = 0; /* don't display this item */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,16 +82,14 @@ struct wps_token {
|
|||
bool next;
|
||||
};
|
||||
|
||||
|
||||
struct wps_subline_timeout {
|
||||
long next_tick;
|
||||
unsigned long next_tick;
|
||||
unsigned short hide;
|
||||
unsigned short show;
|
||||
};
|
||||
|
||||
char* get_dir(char* buf, int buf_size, const char* path, int level);
|
||||
|
||||
|
||||
struct skin_token_list {
|
||||
OFFSETTYPE(struct wps_token *) token;
|
||||
OFFSETTYPE(struct skin_token_list *) next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue