summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 16:43:07 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-06 16:43:07 +0000
commit87e77ba466bbeecbbb7b6479318c0c69a9394c8d (patch)
tree4cf68904946b7711a526c935aeabd659f51b6717
parentbcec79c3c137afd5d4cbced64167acc99db9608e (diff)
downloadrockbox-87e77ba466bbeecbbb7b6479318c0c69a9394c8d.tar.gz
rockbox-87e77ba466bbeecbbb7b6479318c0c69a9394c8d.zip
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
-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,
1396 i = find_conditional_end(data, i); 1396 i = find_conditional_end(data, i);
1397 break; 1397 break;
1398 1398
1399 case WPS_TOKEN_SUBLINE_TIMEOUT:
1400 data->time_mult[line][subline] = data->tokens[i].value.i;
1401 break;
1402
1403#ifdef HAVE_LCD_BITMAP 1399#ifdef HAVE_LCD_BITMAP
1404 case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: 1400 case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
1405 { 1401 {
@@ -1484,9 +1480,44 @@ static bool get_line(struct gui_wps *gwps,
1484 return update; 1480 return update;
1485} 1481}
1486 1482
1483static void get_subline_timeout(struct gui_wps *gwps, int line, int subline)
1484{
1485 struct wps_data *data = gwps->data;
1486 int i = data->format_lines[line][subline];
1487
1488 while (data->tokens[i].type != WPS_TOKEN_EOL
1489 && data->tokens[i].type != WPS_TOKEN_SUBLINE_SEPARATOR
1490 && i < data->num_tokens)
1491 {
1492 switch(data->tokens[i].type)
1493 {
1494 case WPS_TOKEN_CONDITIONAL:
1495 /* place ourselves in the right conditional case */
1496 i = evaluate_conditional(gwps, i);
1497 break;
1498
1499 case WPS_TOKEN_CONDITIONAL_OPTION:
1500 /* we've finished in the curent conditional case,
1501 skip to the end of the conditional structure */
1502 i = find_conditional_end(data, i);
1503 break;
1504
1505 case WPS_TOKEN_SUBLINE_TIMEOUT:
1506 data->time_mult[line][subline] = data->tokens[i].value.i;
1507 break;
1508
1509 default:
1510 break;
1511 }
1512 i++;
1513 }
1514}
1515
1487/* Calculate which subline should be displayed for each line */ 1516/* Calculate which subline should be displayed for each line */
1488static bool get_curr_subline(struct wps_data *data, int line) 1517static bool get_curr_subline(struct gui_wps *gwps, int line)
1489{ 1518{
1519 struct wps_data *data = gwps->data;
1520
1490 int search, search_start; 1521 int search, search_start;
1491 bool reset_subline; 1522 bool reset_subline;
1492 bool new_subline_refresh; 1523 bool new_subline_refresh;
@@ -1532,6 +1563,9 @@ static bool get_curr_subline(struct wps_data *data, int line)
1532 } 1563 }
1533 else 1564 else
1534 { 1565 {
1566 /* get initial time multiplier for this subline */
1567 get_subline_timeout(gwps, line, data->curr_subline[line]);
1568
1535 /* only use this subline if subline time > 0 */ 1569 /* only use this subline if subline time > 0 */
1536 if (data->time_mult[line][data->curr_subline[line]] > 0) 1570 if (data->time_mult[line][data->curr_subline[line]] > 0)
1537 { 1571 {
@@ -1791,7 +1825,7 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1791 update_line = false; 1825 update_line = false;
1792 1826
1793 /* get current subline for the line */ 1827 /* get current subline for the line */
1794 new_subline_refresh = get_curr_subline(data, line); 1828 new_subline_refresh = get_curr_subline(gwps, line);
1795 1829
1796 flags = data->line_type[line][data->curr_subline[line]]; 1830 flags = data->line_type[line][data->curr_subline[line]];
1797 1831
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)
362 DEBUGF("\n"); 362 DEBUGF("\n");
363 } 363 }
364 364
365 DEBUGF("subline time multipliers :\n");
366 for (line = 0; line < data->num_lines; line++)
367 {
368 DEBUGF("%2d. ", line);
369 for (subline = 0; subline < data->num_sublines[line]; subline++)
370 {
371 DEBUGF("%3d ", data->time_mult[line][subline]);
372 }
373 DEBUGF("\n");
374 }
375
376 DEBUGF("\n"); 365 DEBUGF("\n");
377} 366}
378 367
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
490 if (have_tenth == false) 490 if (have_tenth == false)
491 val *= 10; 491 val *= 10;
492 492
493 /* We only want to allow strictly positive timeout values */
494 if (val <= 0)
495 val = DEFAULT_SUBLINE_TIME_MULTIPLIER;
496
497 int line = wps_data->num_lines;
498 int subline = wps_data->num_sublines[line];
499 wps_data->time_mult[line][subline] = val;
500 wps_data->tokens[wps_data->num_tokens].value.i = val; 493 wps_data->tokens[wps_data->num_tokens].value.i = val;
501 494
502 return skip; 495 return skip;
@@ -624,8 +617,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
624 data->num_tokens = 0; 617 data->num_tokens = 0;
625 char *current_string = data->string_buffer; 618 char *current_string = data->string_buffer;
626 619
627 data->time_mult[0][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
628
629 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS 620 while(wps_bufptr && *wps_bufptr && data->num_tokens < WPS_MAX_TOKENS
630 && data->num_lines < WPS_MAX_LINES) 621 && data->num_lines < WPS_MAX_LINES)
631 { 622 {
@@ -644,7 +635,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
644 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR; 635 data->tokens[data->num_tokens++].type = WPS_TOKEN_SUBLINE_SEPARATOR;
645 subline = ++(data->num_sublines[data->num_lines]); 636 subline = ++(data->num_sublines[data->num_lines]);
646 data->format_lines[data->num_lines][subline] = data->num_tokens; 637 data->format_lines[data->num_lines][subline] = data->num_tokens;
647 data->time_mult[data->num_lines][subline] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
648 } 638 }
649 else 639 else
650 wps_bufptr += skip_end_of_line(wps_bufptr); 640 wps_bufptr += skip_end_of_line(wps_bufptr);
@@ -711,7 +701,6 @@ condlistend: /* close a conditional. sometimes we want to close them even when
711 if (data->num_lines < WPS_MAX_LINES) 701 if (data->num_lines < WPS_MAX_LINES)
712 { 702 {
713 data->format_lines[data->num_lines][0] = data->num_tokens; 703 data->format_lines[data->num_lines][0] = data->num_tokens;
714 data->time_mult[data->num_lines][0] = DEFAULT_SUBLINE_TIME_MULTIPLIER;
715 } 704 }
716 705
717 break; 706 break;