summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/gwps-common.c46
-rw-r--r--apps/gui/wps_debug.c11
-rw-r--r--apps/gui/wps_parser.c11
3 files changed, 40 insertions, 28 deletions
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]];
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 48aadc627d..bcb05e0902 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -362,17 +362,6 @@ void print_line_info(struct wps_data *data)
DEBUGF("\n");
}
- DEBUGF("subline time multipliers :\n");
- for (line = 0; line < data->num_lines; line++)
- {
- DEBUGF("%2d. ", line);
- for (subline = 0; subline < data->num_sublines[line]; subline++)
- {
- DEBUGF("%3d ", data->time_mult[line][subline]);
- }
- DEBUGF("\n");
- }
-
DEBUGF("\n");
}
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 8a226e1963..2a610bdb8c 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -490,13 +490,6 @@ static int parse_subline_timeout(const char *wps_bufptr, struct wps_data *wps_da
if (have_tenth == false)
val *= 10;
- /* We only want to allow strictly positive timeout values */
- if (val <= 0)
- val = DEFAULT_SUBLINE_TIME_MULTIPLIER;
-
- int line = wps_data->num_lines;
- int subline = wps_data->num_sublines[line];
- wps_data->time_mult[line][subline] = val;
wps_data->tokens[wps_data->num_tokens].value.i = val;
return skip;
@@ -624,8 +617,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
data->num_tokens = 0;
char *current_string = data->string_buffer;
- data->time_mult[0][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
-
while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS
&& data->num_lines < WPS_MAX_LINES)
{
@@ -644,7 +635,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR;
subline = ++(data->num_sublines[data->num_lines]);
data->format_lines[data->num_lines][subline] = data->num_tokens;
- data->time_mult[data->num_lines][subline] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
}
else
wps_bufptr += skip_end_of_line(wps_bufptr);
@@ -711,7 +701,6 @@ condlistend: /* close a conditional. sometimes we want to close them even when
if (data->num_lines < WPS_MAX_LINES)
{
data->format_lines[data->num_lines][0] = data->num_tokens;
- data->time_mult[data->num_lines][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
}
break;