diff options
Diffstat (limited to 'apps/gui/skin_engine/wps_parser.c')
-rw-r--r-- | apps/gui/skin_engine/wps_parser.c | 73 |
1 files changed, 3 insertions, 70 deletions
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c index c37cd786ec..440133327a 100644 --- a/apps/gui/skin_engine/wps_parser.c +++ b/apps/gui/skin_engine/wps_parser.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "font.h" | 44 | #include "font.h" |
45 | 45 | ||
46 | #include "wps_internals.h" | 46 | #include "wps_internals.h" |
47 | #include "skin_engine.h" | ||
47 | #include "settings.h" | 48 | #include "settings.h" |
48 | #include "settings_list.h" | 49 | #include "settings_list.h" |
49 | 50 | ||
@@ -1535,46 +1536,6 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr) | |||
1535 | return (fail == 0); | 1536 | return (fail == 0); |
1536 | } | 1537 | } |
1537 | 1538 | ||
1538 | #ifdef HAVE_LCD_BITMAP | ||
1539 | /* Clear the WPS image cache */ | ||
1540 | static void wps_images_clear(struct wps_data *data) | ||
1541 | { | ||
1542 | int i; | ||
1543 | /* set images to unloaded and not displayed */ | ||
1544 | for (i = 0; i < MAX_IMAGES; i++) | ||
1545 | { | ||
1546 | data->img[i].loaded = false; | ||
1547 | data->img[i].display = -1; | ||
1548 | data->img[i].always_display = false; | ||
1549 | data->img[i].num_subimages = 1; | ||
1550 | } | ||
1551 | } | ||
1552 | #endif | ||
1553 | |||
1554 | /* initial setup of wps_data */ | ||
1555 | void skin_data_init(struct wps_data *wps_data) | ||
1556 | { | ||
1557 | #ifdef HAVE_LCD_BITMAP | ||
1558 | wps_images_clear(wps_data); | ||
1559 | wps_data->wps_sb_tag = false; | ||
1560 | wps_data->show_sb_on_wps = false; | ||
1561 | wps_data->img_buf_ptr = wps_data->img_buf; /* where in image buffer */ | ||
1562 | wps_data->img_buf_free = IMG_BUFSIZE; /* free space in image buffer */ | ||
1563 | wps_data->peak_meter_enabled = false; | ||
1564 | /* progress bars */ | ||
1565 | wps_data->progressbar_count = 0; | ||
1566 | #else /* HAVE_LCD_CHARCELLS */ | ||
1567 | int i; | ||
1568 | for (i = 0; i < 8; i++) | ||
1569 | { | ||
1570 | wps_data->wps_progress_pat[i] = 0; | ||
1571 | } | ||
1572 | wps_data->full_line_progressbar = false; | ||
1573 | #endif | ||
1574 | wps_data->button_time_volume = 0; | ||
1575 | wps_data->wps_loaded = false; | ||
1576 | } | ||
1577 | |||
1578 | static void wps_reset(struct wps_data *data) | 1539 | static void wps_reset(struct wps_data *data) |
1579 | { | 1540 | { |
1580 | #ifdef HAVE_REMOTE_LCD | 1541 | #ifdef HAVE_REMOTE_LCD |
@@ -1589,7 +1550,7 @@ static void wps_reset(struct wps_data *data) | |||
1589 | 1550 | ||
1590 | #ifdef HAVE_LCD_BITMAP | 1551 | #ifdef HAVE_LCD_BITMAP |
1591 | 1552 | ||
1592 | static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) | 1553 | static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) |
1593 | { | 1554 | { |
1594 | char img_path[MAX_PATH]; | 1555 | char img_path[MAX_PATH]; |
1595 | struct bitmap *bitmap; | 1556 | struct bitmap *bitmap; |
@@ -1780,7 +1741,7 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1780 | strlcpy(bmpdir, buf, dot - buf + 1); | 1741 | strlcpy(bmpdir, buf, dot - buf + 1); |
1781 | 1742 | ||
1782 | /* load the bitmaps that were found by the parsing */ | 1743 | /* load the bitmaps that were found by the parsing */ |
1783 | if (!load_wps_bitmaps(wps_data, bmpdir)) { | 1744 | if (!load_skin_bitmaps(wps_data, bmpdir)) { |
1784 | wps_reset(wps_data); | 1745 | wps_reset(wps_data); |
1785 | return false; | 1746 | return false; |
1786 | } | 1747 | } |
@@ -1803,31 +1764,3 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1803 | return true; | 1764 | return true; |
1804 | } | 1765 | } |
1805 | } | 1766 | } |
1806 | |||
1807 | |||
1808 | int wps_subline_index(struct wps_data *data, int line, int subline) | ||
1809 | { | ||
1810 | return data->lines[line].first_subline_idx + subline; | ||
1811 | } | ||
1812 | |||
1813 | int wps_first_token_index(struct wps_data *data, int line, int subline) | ||
1814 | { | ||
1815 | int first_subline_idx = data->lines[line].first_subline_idx; | ||
1816 | return data->sublines[first_subline_idx + subline].first_token_idx; | ||
1817 | } | ||
1818 | |||
1819 | int wps_last_token_index(struct wps_data *data, int line, int subline) | ||
1820 | { | ||
1821 | int first_subline_idx = data->lines[line].first_subline_idx; | ||
1822 | int idx = first_subline_idx + subline; | ||
1823 | if (idx < data->num_sublines - 1) | ||
1824 | { | ||
1825 | /* This subline ends where the next begins */ | ||
1826 | return data->sublines[idx+1].first_token_idx - 1; | ||
1827 | } | ||
1828 | else | ||
1829 | { | ||
1830 | /* The last subline goes to the end */ | ||
1831 | return data->num_tokens - 1; | ||
1832 | } | ||
1833 | } | ||