From 87e77ba466bbeecbbb7b6479318c0c69a9394c8d Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Fri, 6 Apr 2007 16:43:07 +0000 Subject: This time I hope I got it right! Basically, remove what the previous commit about subline timeouts added and make the values be computed by a special function at display time. This should bring complete compatibility with the previous code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13047 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'apps/gui/gwps-common.c') diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 86003fa9ef..cb2329c65d 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1396,10 +1396,6 @@ static bool get_line(struct gui_wps *gwps, i = find_conditional_end(data, i); break; - case WPS_TOKEN_SUBLINE_TIMEOUT: - data->time_mult[line][subline] = data->tokens[i].value.i; - break; - #ifdef HAVE_LCD_BITMAP case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: { @@ -1484,9 +1480,44 @@ static bool get_line(struct gui_wps *gwps, return update; } +static void get_subline_timeout(struct gui_wps *gwps, int line, int subline) +{ + struct wps_data *data = gwps->data; + int i = data->format_lines[line][subline]; + + while (data->tokens[i].type != WPS_TOKEN_EOL + && data->tokens[i].type != WPS_TOKEN_SUBLINE_SEPARATOR + && i < data->num_tokens) + { + switch(data->tokens[i].type) + { + case WPS_TOKEN_CONDITIONAL: + /* place ourselves in the right conditional case */ + i = evaluate_conditional(gwps, i); + break; + + case WPS_TOKEN_CONDITIONAL_OPTION: + /* we've finished in the curent conditional case, + skip to the end of the conditional structure */ + i = find_conditional_end(data, i); + break; + + case WPS_TOKEN_SUBLINE_TIMEOUT: + data->time_mult[line][subline] = data->tokens[i].value.i; + break; + + default: + break; + } + i++; + } +} + /* Calculate which subline should be displayed for each line */ -static bool get_curr_subline(struct wps_data *data, int line) +static bool get_curr_subline(struct gui_wps *gwps, int line) { + struct wps_data *data = gwps->data; + int search, search_start; bool reset_subline; bool new_subline_refresh; @@ -1532,6 +1563,9 @@ static bool get_curr_subline(struct wps_data *data, int line) } else { + /* get initial time multiplier for this subline */ + get_subline_timeout(gwps, line, data->curr_subline[line]); + /* only use this subline if subline time > 0 */ if (data->time_mult[line][data->curr_subline[line]] > 0) { @@ -1791,7 +1825,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, update_line = false; /* get current subline for the line */ - new_subline_refresh = get_curr_subline(data, line); + new_subline_refresh = get_curr_subline(gwps, line); flags = data->line_type[line][data->curr_subline[line]]; -- cgit v1.2.3