diff options
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r-- | apps/gui/gwps-common.c | 237 |
1 files changed, 140 insertions, 97 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index cfaabafe90..ae5492a66c 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -295,6 +295,19 @@ bool gui_wps_display(void) | |||
295 | { | 295 | { |
296 | FOR_NB_SCREENS(i) | 296 | FOR_NB_SCREENS(i) |
297 | { | 297 | { |
298 | /* Update the values in the first (default) viewport - in case the user | ||
299 | has modified the statusbar or colour settings */ | ||
300 | #ifdef HAVE_LCD_BITMAP | ||
301 | gui_wps[i].data->viewports[0].vp.ymargin = gui_wps[i].display->getymargin(); | ||
302 | #if LCD_DEPTH > 1 | ||
303 | if (gui_wps[i].display->depth > 1) | ||
304 | { | ||
305 | gui_wps[i].data->viewports[0].vp.fg_pattern = gui_wps[i].display->get_foreground(); | ||
306 | gui_wps[i].data->viewports[0].vp.bg_pattern = gui_wps[i].display->get_background(); | ||
307 | } | ||
308 | #endif | ||
309 | #endif | ||
310 | |||
298 | gui_wps[i].display->clear_display(); | 311 | gui_wps[i].display->clear_display(); |
299 | if (!gui_wps[i].data->wps_loaded) { | 312 | if (!gui_wps[i].data->wps_loaded) { |
300 | if ( !gui_wps[i].data->num_tokens ) { | 313 | if ( !gui_wps[i].data->num_tokens ) { |
@@ -306,6 +319,7 @@ bool gui_wps_display(void) | |||
306 | unload_wps_backdrop(); | 319 | unload_wps_backdrop(); |
307 | #endif | 320 | #endif |
308 | wps_data_load(gui_wps[i].data, | 321 | wps_data_load(gui_wps[i].data, |
322 | gui_wps[i].display, | ||
309 | "%s%?it<%?in<%in. |>%it|%fn>\n" | 323 | "%s%?it<%?in<%in. |>%it|%fn>\n" |
310 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | 324 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" |
311 | "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n" | 325 | "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n" |
@@ -316,6 +330,7 @@ bool gui_wps_display(void) | |||
316 | "%pm\n", false); | 330 | "%pm\n", false); |
317 | #else | 331 | #else |
318 | wps_data_load(gui_wps[i].data, | 332 | wps_data_load(gui_wps[i].data, |
333 | gui_wps[i].display, | ||
319 | "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" | 334 | "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" |
320 | "%pc%?ps<*|/>%pt\n", false); | 335 | "%pc%?ps<*|/>%pt\n", false); |
321 | #endif | 336 | #endif |
@@ -328,6 +343,7 @@ bool gui_wps_display(void) | |||
328 | unload_remote_wps_backdrop(); | 343 | unload_remote_wps_backdrop(); |
329 | #endif | 344 | #endif |
330 | wps_data_load(gui_wps[i].data, | 345 | wps_data_load(gui_wps[i].data, |
346 | gui_wps[i].display, | ||
331 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" | 347 | "%s%?ia<%ia|%?d2<%d2|(root)>>\n" |
332 | "%s%?it<%?in<%in. |>%it|%fn>\n" | 348 | "%s%?it<%?in<%in. |>%it|%fn>\n" |
333 | "%al%pc/%pt%ar[%pp:%pe]\n" | 349 | "%al%pc/%pt%ar[%pp:%pe]\n" |
@@ -448,7 +464,7 @@ static void draw_progressbar(struct gui_wps *gwps, int line) | |||
448 | struct wps_data *data = gwps->data; | 464 | struct wps_data *data = gwps->data; |
449 | struct screen *display = gwps->display; | 465 | struct screen *display = gwps->display; |
450 | struct wps_state *state = gwps->state; | 466 | struct wps_state *state = gwps->state; |
451 | int h = font_get(FONT_UI)->height; | 467 | int h = font_get(display->getfont())->height; |
452 | 468 | ||
453 | int sb_y; | 469 | int sb_y; |
454 | if (data->progress_top < 0) | 470 | if (data->progress_top < 0) |
@@ -459,7 +475,7 @@ static void draw_progressbar(struct gui_wps *gwps, int line) | |||
459 | sb_y = data->progress_top; | 475 | sb_y = data->progress_top; |
460 | 476 | ||
461 | if (!data->progress_end) | 477 | if (!data->progress_end) |
462 | data->progress_end=display->width; | 478 | data->progress_end=display->getwidth(); |
463 | 479 | ||
464 | if (gwps->data->progressbar.have_bitmap_pb) | 480 | if (gwps->data->progressbar.have_bitmap_pb) |
465 | gui_bitmap_scrollbar_draw(display, data->progressbar.bm, | 481 | gui_bitmap_scrollbar_draw(display, data->progressbar.bm, |
@@ -529,7 +545,7 @@ static void wps_draw_image(struct gui_wps *gwps, int n) | |||
529 | #endif | 545 | #endif |
530 | } | 546 | } |
531 | 547 | ||
532 | static void wps_display_images(struct gui_wps *gwps) | 548 | static void wps_display_images(struct gui_wps *gwps, struct viewport* vp) |
533 | { | 549 | { |
534 | if(!gwps || !gwps->data || !gwps->display) | 550 | if(!gwps || !gwps->data || !gwps->display) |
535 | return; | 551 | return; |
@@ -541,7 +557,8 @@ static void wps_display_images(struct gui_wps *gwps) | |||
541 | for (n = 0; n < MAX_IMAGES; n++) | 557 | for (n = 0; n < MAX_IMAGES; n++) |
542 | { | 558 | { |
543 | if (data->img[n].loaded && | 559 | if (data->img[n].loaded && |
544 | (data->img[n].display || data->img[n].always_display)) | 560 | (data->img[n].display || |
561 | (data->img[n].always_display && data->img[n].vp == vp))) | ||
545 | { | 562 | { |
546 | wps_draw_image(gwps, n); | 563 | wps_draw_image(gwps, n); |
547 | } | 564 | } |
@@ -1449,7 +1466,7 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) | |||
1449 | The return value indicates whether the line needs to be updated. | 1466 | The return value indicates whether the line needs to be updated. |
1450 | */ | 1467 | */ |
1451 | static bool get_line(struct gui_wps *gwps, | 1468 | static bool get_line(struct gui_wps *gwps, |
1452 | int line, int subline, | 1469 | int v, int line, int subline, |
1453 | struct align_pos *align, | 1470 | struct align_pos *align, |
1454 | char *linebuf, | 1471 | char *linebuf, |
1455 | int linebuf_size) | 1472 | int linebuf_size) |
@@ -1477,8 +1494,8 @@ static bool get_line(struct gui_wps *gwps, | |||
1477 | #endif | 1494 | #endif |
1478 | 1495 | ||
1479 | /* Process all tokens of the desired subline */ | 1496 | /* Process all tokens of the desired subline */ |
1480 | last_token_idx = wps_last_token_index(data, line, subline); | 1497 | last_token_idx = wps_last_token_index(data, v, line, subline); |
1481 | for (i = wps_first_token_index(data, line, subline); | 1498 | for (i = wps_first_token_index(data, v, line, subline); |
1482 | i <= last_token_idx; i++) | 1499 | i <= last_token_idx; i++) |
1483 | { | 1500 | { |
1484 | switch(data->tokens[i].type) | 1501 | switch(data->tokens[i].type) |
@@ -1577,16 +1594,16 @@ static bool get_line(struct gui_wps *gwps, | |||
1577 | return update; | 1594 | return update; |
1578 | } | 1595 | } |
1579 | 1596 | ||
1580 | static void get_subline_timeout(struct gui_wps *gwps, int line, int subline) | 1597 | static void get_subline_timeout(struct gui_wps *gwps, int v, int line, int subline) |
1581 | { | 1598 | { |
1582 | struct wps_data *data = gwps->data; | 1599 | struct wps_data *data = gwps->data; |
1583 | int i; | 1600 | int i; |
1584 | int subline_idx = wps_subline_index(data, line, subline); | 1601 | int subline_idx = wps_subline_index(data, v, line, subline); |
1585 | int last_token_idx = wps_last_token_index(data, line, subline); | 1602 | int last_token_idx = wps_last_token_index(data, v, line, subline); |
1586 | 1603 | ||
1587 | data->sublines[subline_idx].time_mult = DEFAULT_SUBLINE_TIME_MULTIPLIER; | 1604 | data->sublines[subline_idx].time_mult = DEFAULT_SUBLINE_TIME_MULTIPLIER; |
1588 | 1605 | ||
1589 | for (i = wps_first_token_index(data, line, subline); | 1606 | for (i = wps_first_token_index(data, v, line, subline); |
1590 | i <= last_token_idx; i++) | 1607 | i <= last_token_idx; i++) |
1591 | { | 1608 | { |
1592 | switch(data->tokens[i].type) | 1609 | switch(data->tokens[i].type) |
@@ -1614,7 +1631,7 @@ static void get_subline_timeout(struct gui_wps *gwps, int line, int subline) | |||
1614 | 1631 | ||
1615 | /* Calculates which subline should be displayed for the specified line | 1632 | /* Calculates which subline should be displayed for the specified line |
1616 | Returns true iff the subline must be refreshed */ | 1633 | Returns true iff the subline must be refreshed */ |
1617 | static bool update_curr_subline(struct gui_wps *gwps, int line) | 1634 | static bool update_curr_subline(struct gui_wps *gwps, int v, int line) |
1618 | { | 1635 | { |
1619 | struct wps_data *data = gwps->data; | 1636 | struct wps_data *data = gwps->data; |
1620 | 1637 | ||
@@ -1623,13 +1640,13 @@ static bool update_curr_subline(struct gui_wps *gwps, int line) | |||
1623 | bool new_subline_refresh; | 1640 | bool new_subline_refresh; |
1624 | bool only_one_subline; | 1641 | bool only_one_subline; |
1625 | 1642 | ||
1626 | num_sublines = data->lines[line].num_sublines; | 1643 | num_sublines = data->viewports[v].lines[line].num_sublines; |
1627 | reset_subline = (data->lines[line].curr_subline == SUBLINE_RESET); | 1644 | reset_subline = (data->viewports[v].lines[line].curr_subline == SUBLINE_RESET); |
1628 | new_subline_refresh = false; | 1645 | new_subline_refresh = false; |
1629 | only_one_subline = false; | 1646 | only_one_subline = false; |
1630 | 1647 | ||
1631 | /* if time to advance to next sub-line */ | 1648 | /* if time to advance to next sub-line */ |
1632 | if (TIME_AFTER(current_tick, data->lines[line].subline_expire_time - 1) || | 1649 | if (TIME_AFTER(current_tick, data->viewports[v].lines[line].subline_expire_time - 1) || |
1633 | reset_subline) | 1650 | reset_subline) |
1634 | { | 1651 | { |
1635 | /* search all sublines until the next subline with time > 0 | 1652 | /* search all sublines until the next subline with time > 0 |
@@ -1637,46 +1654,46 @@ static bool update_curr_subline(struct gui_wps *gwps, int line) | |||
1637 | if (reset_subline) | 1654 | if (reset_subline) |
1638 | search_start = 0; | 1655 | search_start = 0; |
1639 | else | 1656 | else |
1640 | search_start = data->lines[line].curr_subline; | 1657 | search_start = data->viewports[v].lines[line].curr_subline; |
1641 | 1658 | ||
1642 | for (search = 0; search < num_sublines; search++) | 1659 | for (search = 0; search < num_sublines; search++) |
1643 | { | 1660 | { |
1644 | data->lines[line].curr_subline++; | 1661 | data->viewports[v].lines[line].curr_subline++; |
1645 | 1662 | ||
1646 | /* wrap around if beyond last defined subline or WPS_MAX_SUBLINES */ | 1663 | /* wrap around if beyond last defined subline or WPS_MAX_SUBLINES */ |
1647 | if (data->lines[line].curr_subline == num_sublines) | 1664 | if (data->viewports[v].lines[line].curr_subline == num_sublines) |
1648 | { | 1665 | { |
1649 | if (data->lines[line].curr_subline == 1) | 1666 | if (data->viewports[v].lines[line].curr_subline == 1) |
1650 | only_one_subline = true; | 1667 | only_one_subline = true; |
1651 | data->lines[line].curr_subline = 0; | 1668 | data->viewports[v].lines[line].curr_subline = 0; |
1652 | } | 1669 | } |
1653 | 1670 | ||
1654 | /* if back where we started after search or | 1671 | /* if back where we started after search or |
1655 | only one subline is defined on the line */ | 1672 | only one subline is defined on the line */ |
1656 | if (((search > 0) && | 1673 | if (((search > 0) && |
1657 | (data->lines[line].curr_subline == search_start)) || | 1674 | (data->viewports[v].lines[line].curr_subline == search_start)) || |
1658 | only_one_subline) | 1675 | only_one_subline) |
1659 | { | 1676 | { |
1660 | /* no other subline with a time > 0 exists */ | 1677 | /* no other subline with a time > 0 exists */ |
1661 | data->lines[line].subline_expire_time = (reset_subline ? | 1678 | data->viewports[v].lines[line].subline_expire_time = (reset_subline ? |
1662 | current_tick : | 1679 | current_tick : |
1663 | data->lines[line].subline_expire_time) + 100 * HZ; | 1680 | data->viewports[v].lines[line].subline_expire_time) + 100 * HZ; |
1664 | break; | 1681 | break; |
1665 | } | 1682 | } |
1666 | else | 1683 | else |
1667 | { | 1684 | { |
1668 | /* get initial time multiplier for this subline */ | 1685 | /* get initial time multiplier for this subline */ |
1669 | get_subline_timeout(gwps, line, data->lines[line].curr_subline); | 1686 | get_subline_timeout(gwps, v, line, data->viewports[v].lines[line].curr_subline); |
1670 | 1687 | ||
1671 | int subline_idx = wps_subline_index(data, line, | 1688 | int subline_idx = wps_subline_index(data, v, line, |
1672 | data->lines[line].curr_subline); | 1689 | data->viewports[v].lines[line].curr_subline); |
1673 | 1690 | ||
1674 | /* only use this subline if subline time > 0 */ | 1691 | /* only use this subline if subline time > 0 */ |
1675 | if (data->sublines[subline_idx].time_mult > 0) | 1692 | if (data->sublines[subline_idx].time_mult > 0) |
1676 | { | 1693 | { |
1677 | new_subline_refresh = true; | 1694 | new_subline_refresh = true; |
1678 | data->lines[line].subline_expire_time = (reset_subline ? | 1695 | data->viewports[v].lines[line].subline_expire_time = (reset_subline ? |
1679 | current_tick : data->lines[line].subline_expire_time) + | 1696 | current_tick : data->viewports[v].lines[line].subline_expire_time) + |
1680 | BASE_SUBLINE_TIME*data->sublines[subline_idx].time_mult; | 1697 | BASE_SUBLINE_TIME*data->sublines[subline_idx].time_mult; |
1681 | break; | 1698 | break; |
1682 | } | 1699 | } |
@@ -1724,10 +1741,10 @@ static void write_line(struct screen *display, | |||
1724 | } | 1741 | } |
1725 | 1742 | ||
1726 | left_xpos = display->getxmargin(); | 1743 | left_xpos = display->getxmargin(); |
1727 | right_xpos = (display->width - right_width); | 1744 | right_xpos = (display->getwidth() - right_width); |
1728 | center_xpos = (display->width + left_xpos - center_width) / 2; | 1745 | center_xpos = (display->getwidth() + left_xpos - center_width) / 2; |
1729 | 1746 | ||
1730 | scroll_width = display->width - left_xpos; | 1747 | scroll_width = display->getwidth() - left_xpos; |
1731 | 1748 | ||
1732 | /* Checks for overlapping strings. | 1749 | /* Checks for overlapping strings. |
1733 | If needed the overlapping strings will be merged, separated by a | 1750 | If needed the overlapping strings will be merged, separated by a |
@@ -1767,7 +1784,7 @@ static void write_line(struct screen *display, | |||
1767 | format_align->right = format_align->center; | 1784 | format_align->right = format_align->center; |
1768 | /* calculate the new width and position of the merged string */ | 1785 | /* calculate the new width and position of the merged string */ |
1769 | right_width = center_width + space_width + right_width; | 1786 | right_width = center_width + space_width + right_width; |
1770 | right_xpos = (display->width - right_width); | 1787 | right_xpos = (display->getwidth() - right_width); |
1771 | /* there is no centered string anymore */ | 1788 | /* there is no centered string anymore */ |
1772 | center_width = 0; | 1789 | center_width = 0; |
1773 | } | 1790 | } |
@@ -1778,7 +1795,7 @@ static void write_line(struct screen *display, | |||
1778 | format_align->right = format_align->center; | 1795 | format_align->right = format_align->center; |
1779 | /* calculate the new width and position of the string */ | 1796 | /* calculate the new width and position of the string */ |
1780 | right_width = center_width; | 1797 | right_width = center_width; |
1781 | right_xpos = (display->width - right_width); | 1798 | right_xpos = (display->getwidth() - right_width); |
1782 | /* there is no centered string anymore */ | 1799 | /* there is no centered string anymore */ |
1783 | center_width = 0; | 1800 | center_width = 0; |
1784 | } | 1801 | } |
@@ -1823,7 +1840,7 @@ static void write_line(struct screen *display, | |||
1823 | #ifdef HAVE_LCD_BITMAP | 1840 | #ifdef HAVE_LCD_BITMAP |
1824 | /* clear the line first */ | 1841 | /* clear the line first */ |
1825 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1842 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
1826 | display->fillrect(left_xpos, ypos, display->width, string_height); | 1843 | display->fillrect(left_xpos, ypos, display->getwidth(), string_height); |
1827 | display->set_drawmode(DRMODE_SOLID); | 1844 | display->set_drawmode(DRMODE_SOLID); |
1828 | #endif | 1845 | #endif |
1829 | 1846 | ||
@@ -1862,7 +1879,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, | |||
1862 | if(!gwps || !data || !state || !display) | 1879 | if(!gwps || !data || !state || !display) |
1863 | return false; | 1880 | return false; |
1864 | 1881 | ||
1865 | int line, i, subline_idx; | 1882 | int v, line, i, subline_idx; |
1866 | unsigned char flags; | 1883 | unsigned char flags; |
1867 | char linebuf[MAX_PATH]; | 1884 | char linebuf[MAX_PATH]; |
1868 | 1885 | ||
@@ -1885,19 +1902,19 @@ bool gui_wps_refresh(struct gui_wps *gwps, | |||
1885 | */ | 1902 | */ |
1886 | bool enable_pm = false; | 1903 | bool enable_pm = false; |
1887 | 1904 | ||
1888 | /* Set images to not to be displayed */ | ||
1889 | for (i = 0; i < MAX_IMAGES; i++) | ||
1890 | { | ||
1891 | data->img[i].display = false; | ||
1892 | } | ||
1893 | #endif | 1905 | #endif |
1894 | 1906 | ||
1895 | /* reset to first subline if refresh all flag is set */ | 1907 | /* reset to first subline if refresh all flag is set */ |
1896 | if (refresh_mode == WPS_REFRESH_ALL) | 1908 | if (refresh_mode == WPS_REFRESH_ALL) |
1897 | { | 1909 | { |
1898 | for (i = 0; i < data->num_lines; i++) | 1910 | display->clear_display(); |
1911 | |||
1912 | for (v = 0; v < data->num_viewports; v++) | ||
1899 | { | 1913 | { |
1900 | data->lines[i].curr_subline = SUBLINE_RESET; | 1914 | for (i = 0; i < data->viewports[v].num_lines; i++) |
1915 | { | ||
1916 | data->viewports[v].lines[i].curr_subline = SUBLINE_RESET; | ||
1917 | } | ||
1901 | } | 1918 | } |
1902 | } | 1919 | } |
1903 | 1920 | ||
@@ -1917,88 +1934,114 @@ bool gui_wps_refresh(struct gui_wps *gwps, | |||
1917 | 1934 | ||
1918 | state->ff_rewind_count = ffwd_offset; | 1935 | state->ff_rewind_count = ffwd_offset; |
1919 | 1936 | ||
1920 | for (line = 0; line < data->num_lines; line++) | 1937 | for (v = 0; v < data->num_viewports; v++) |
1921 | { | 1938 | { |
1922 | memset(linebuf, 0, sizeof(linebuf)); | 1939 | display->set_viewport(&data->viewports[v].vp); |
1923 | update_line = false; | ||
1924 | |||
1925 | /* get current subline for the line */ | ||
1926 | new_subline_refresh = update_curr_subline(gwps, line); | ||
1927 | |||
1928 | subline_idx = wps_subline_index(data, line, | ||
1929 | data->lines[line].curr_subline); | ||
1930 | flags = data->sublines[subline_idx].line_type; | ||
1931 | 1940 | ||
1932 | if (refresh_mode == WPS_REFRESH_ALL || (flags & refresh_mode) | 1941 | if (refresh_mode == WPS_REFRESH_ALL) |
1933 | || new_subline_refresh) | ||
1934 | { | 1942 | { |
1935 | /* get_line tells us if we need to update the line */ | 1943 | display->clear_viewport(); |
1936 | update_line = get_line(gwps, line, data->lines[line].curr_subline, | ||
1937 | &align, linebuf, sizeof(linebuf)); | ||
1938 | } | 1944 | } |
1939 | 1945 | ||
1940 | #ifdef HAVE_LCD_BITMAP | 1946 | #ifdef HAVE_LCD_BITMAP |
1941 | /* progressbar */ | 1947 | /* Set images to not to be displayed */ |
1942 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) | 1948 | for (i = 0; i < MAX_IMAGES; i++) |
1943 | { | 1949 | { |
1944 | /* the progressbar should be alone on its line */ | 1950 | data->img[i].display = false; |
1945 | update_line = false; | ||
1946 | draw_progressbar(gwps, line); | ||
1947 | } | 1951 | } |
1952 | #endif | ||
1948 | 1953 | ||
1949 | /* peakmeter */ | 1954 | for (line = 0; line < data->viewports[v].num_lines; line++) |
1950 | if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) | ||
1951 | { | 1955 | { |
1952 | /* the peakmeter should be alone on its line */ | 1956 | memset(linebuf, 0, sizeof(linebuf)); |
1953 | update_line = false; | 1957 | update_line = false; |
1954 | 1958 | ||
1955 | int h = font_get(FONT_UI)->height; | 1959 | /* get current subline for the line */ |
1956 | int peak_meter_y = display->getymargin() + line * h; | 1960 | new_subline_refresh = update_curr_subline(gwps, v, line); |
1957 | 1961 | ||
1958 | /* The user might decide to have the peak meter in the last | 1962 | subline_idx = wps_subline_index(data, v, line, |
1959 | line so that it is only displayed if no status bar is | 1963 | data->viewports[v].lines[line].curr_subline); |
1960 | visible. If so we neither want do draw nor enable the | 1964 | flags = data->sublines[subline_idx].line_type; |
1961 | peak meter. */ | 1965 | |
1962 | if (peak_meter_y + h <= display->height) { | 1966 | if (refresh_mode == WPS_REFRESH_ALL || (flags & refresh_mode) |
1963 | /* found a line with a peak meter -> remember that we must | 1967 | || new_subline_refresh) |
1964 | enable it later */ | 1968 | { |
1965 | enable_pm = true; | 1969 | /* get_line tells us if we need to update the line */ |
1966 | peak_meter_screen(gwps->display, 0, peak_meter_y, | 1970 | update_line = get_line(gwps, v, line, data->viewports[v].lines[line].curr_subline, |
1967 | MIN(h, display->height - peak_meter_y)); | 1971 | &align, linebuf, sizeof(linebuf)); |
1972 | } | ||
1973 | |||
1974 | #ifdef HAVE_LCD_BITMAP | ||
1975 | /* progressbar */ | ||
1976 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) | ||
1977 | { | ||
1978 | /* the progressbar should be alone on its line */ | ||
1979 | update_line = false; | ||
1980 | draw_progressbar(gwps, line); | ||
1981 | } | ||
1982 | |||
1983 | /* peakmeter */ | ||
1984 | if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) | ||
1985 | { | ||
1986 | /* the peakmeter should be alone on its line */ | ||
1987 | update_line = false; | ||
1988 | |||
1989 | int h = font_get(display->getfont())->height; | ||
1990 | int peak_meter_y = display->getymargin() + line * h; | ||
1991 | |||
1992 | /* The user might decide to have the peak meter in the last | ||
1993 | line so that it is only displayed if no status bar is | ||
1994 | visible. If so we neither want do draw nor enable the | ||
1995 | peak meter. */ | ||
1996 | if (peak_meter_y + h <= display->getheight()) { | ||
1997 | /* found a line with a peak meter -> remember that we must | ||
1998 | enable it later */ | ||
1999 | enable_pm = true; | ||
2000 | peak_meter_screen(gwps->display, 0, peak_meter_y, | ||
2001 | MIN(h, display->getheight() - peak_meter_y)); | ||
2002 | } | ||
1968 | } | 2003 | } |
1969 | } | ||
1970 | 2004 | ||
1971 | #else /* HAVE_LCD_CHARCELL */ | 2005 | #else /* HAVE_LCD_CHARCELL */ |
1972 | 2006 | ||
1973 | /* progressbar */ | 2007 | /* progressbar */ |
1974 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) | 2008 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) |
1975 | { | 2009 | { |
1976 | if (data->full_line_progressbar) | 2010 | if (data->full_line_progressbar) |
1977 | draw_player_fullbar(gwps, linebuf, sizeof(linebuf)); | 2011 | draw_player_fullbar(gwps, linebuf, sizeof(linebuf)); |
1978 | else | 2012 | else |
1979 | draw_player_progress(gwps); | 2013 | draw_player_progress(gwps); |
1980 | } | 2014 | } |
1981 | #endif | 2015 | #endif |
1982 | 2016 | ||
1983 | if (update_line) | 2017 | if (update_line) |
1984 | { | ||
1985 | if (flags & WPS_REFRESH_SCROLL) | ||
1986 | { | 2018 | { |
1987 | /* if the line is a scrolling one we don't want to update | 2019 | if (flags & WPS_REFRESH_SCROLL) |
1988 | too often, so that it has the time to scroll */ | 2020 | { |
1989 | if ((refresh_mode & WPS_REFRESH_SCROLL) || new_subline_refresh) | 2021 | /* if the line is a scrolling one we don't want to update |
1990 | write_line(display, &align, line, true); | 2022 | too often, so that it has the time to scroll */ |
2023 | if ((refresh_mode & WPS_REFRESH_SCROLL) || new_subline_refresh) | ||
2024 | write_line(display, &align, line, true); | ||
2025 | } | ||
2026 | else | ||
2027 | write_line(display, &align, line, false); | ||
1991 | } | 2028 | } |
1992 | else | 2029 | |
1993 | write_line(display, &align, line, false); | ||
1994 | } | 2030 | } |
2031 | |||
2032 | #ifdef HAVE_LCD_BITMAP | ||
2033 | /* Now display any images in this viewport */ | ||
2034 | wps_display_images(gwps, &data->viewports[v].vp); | ||
2035 | #endif | ||
1995 | } | 2036 | } |
1996 | 2037 | ||
1997 | #ifdef HAVE_LCD_BITMAP | 2038 | #ifdef HAVE_LCD_BITMAP |
1998 | data->peak_meter_enabled = enable_pm; | 2039 | data->peak_meter_enabled = enable_pm; |
1999 | wps_display_images(gwps); | ||
2000 | #endif | 2040 | #endif |
2001 | 2041 | ||
2042 | /* Restore the default viewport */ | ||
2043 | display->set_viewport(NULL); | ||
2044 | |||
2002 | display->update(); | 2045 | display->update(); |
2003 | 2046 | ||
2004 | #ifdef HAVE_BACKLIGHT | 2047 | #ifdef HAVE_BACKLIGHT |