diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-19 15:28:15 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-19 15:28:15 +0000 |
commit | 1016ee4e809776619fa9e4e773ceb1523bd7bc66 (patch) | |
tree | 585cd873c118bee7c2459205e6eb54ff3e76a21b /apps/gui/skin_engine/skin_parser.c | |
parent | 00695baac0b797cbe46e7bc2999a83f73b36aae8 (diff) | |
download | rockbox-1016ee4e809776619fa9e4e773ceb1523bd7bc66.tar.gz rockbox-1016ee4e809776619fa9e4e773ceb1523bd7bc66.zip |
Initial custom statusbar commit.
The custom statusbar can be used as a WPS for the main UI, using .(r)sbs files. It's using the skin engine and knows all tags the WPS also knows.
The default folder for .sbs is the wps folder to reuse images used in the WPS.
As it can be shown in the WPS also, it's useful to move shared parts to the custom statusbar in order to save skin buffer space.
There are a few restrictions/TODOs:
*) Peak meter doesn't redraw nicely(not frequent enough), as very frequent updates would slow the UI down as hell (some targets fight with it in the WPS already: FS#10686)
*) No touchregion support as the statusbar doesn't have any action handling (it won't fail to parse though).
*) Drawing stuff into the default VP is forbidden (loading images in it is not). You *need* to use viewports for the displaying stuff (parsing fails if no viewport is used).
*) Themes that don't use a custom ui viewport can be fixed up using the new %Vi tag to avoid nasty redraw effectts (you must not draw into it as well, it's used to fix up the ui viewport). %Vi describes the viewport that the lists can use without getting in the way of the statusbar.
Otherwise, it behaves like the classic statusbar, it can be configured in the theme settings, and can be turned off in the wps using %wd.
Note to translaters: When translating LANG_STATUSBAR_CUSTOM, please consider using the same translation as for LANG_CHANNEL_CUSTOM if it's compatible. They could be combined later then.
Flyspray: FS#10566
Author: myself
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23258 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index fa35ed994f..434e7c9fa5 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -683,8 +683,15 @@ static int parse_viewport(const char *wps_bufptr, | |||
683 | curr_line = NULL; | 683 | curr_line = NULL; |
684 | if (!skin_start_new_line(skin_vp, wps_data->num_tokens)) | 684 | if (!skin_start_new_line(skin_vp, wps_data->num_tokens)) |
685 | return WPS_ERROR_INVALID_PARAM; | 685 | return WPS_ERROR_INVALID_PARAM; |
686 | 686 | ||
687 | if (*ptr == 'l') | 687 | |
688 | if (*ptr == 'i') | ||
689 | { | ||
690 | skin_vp->label = VP_INFO_LABEL; | ||
691 | skin_vp->hidden_flags = VP_NEVER_VISIBLE; | ||
692 | ++ptr; | ||
693 | } | ||
694 | else if (*ptr == 'l') | ||
688 | { | 695 | { |
689 | if (*(ptr+1) == '|') | 696 | if (*(ptr+1) == '|') |
690 | { | 697 | { |
@@ -1674,7 +1681,6 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char | |||
1674 | else | 1681 | else |
1675 | { | 1682 | { |
1676 | /* Abort if we can't load an image */ | 1683 | /* Abort if we can't load an image */ |
1677 | DEBUGF("ERR: Failed to load image - %s\n",img_path); | ||
1678 | loaded = false; | 1684 | loaded = false; |
1679 | } | 1685 | } |
1680 | return loaded; | 1686 | return loaded; |
@@ -1733,7 +1739,6 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
1733 | /* to setup up the wps-data from a format-buffer (isfile = false) | 1739 | /* to setup up the wps-data from a format-buffer (isfile = false) |
1734 | from a (wps-)file (isfile = true)*/ | 1740 | from a (wps-)file (isfile = true)*/ |
1735 | bool skin_data_load(struct wps_data *wps_data, | 1741 | bool skin_data_load(struct wps_data *wps_data, |
1736 | struct screen *display, | ||
1737 | const char *buf, | 1742 | const char *buf, |
1738 | bool isfile) | 1743 | bool isfile) |
1739 | { | 1744 | { |
@@ -1755,6 +1760,7 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1755 | 1760 | ||
1756 | skin_data_reset(wps_data); | 1761 | skin_data_reset(wps_data); |
1757 | 1762 | ||
1763 | /* alloc default viewport, will be fixed up later */ | ||
1758 | curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); | 1764 | curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); |
1759 | if (!curr_vp) | 1765 | if (!curr_vp) |
1760 | return false; | 1766 | return false; |
@@ -1766,9 +1772,6 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1766 | 1772 | ||
1767 | /* Initialise the first (default) viewport */ | 1773 | /* Initialise the first (default) viewport */ |
1768 | curr_vp->label = VP_DEFAULT_LABEL; | 1774 | curr_vp->label = VP_DEFAULT_LABEL; |
1769 | curr_vp->vp.x = 0; | ||
1770 | curr_vp->vp.width = display->getwidth(); | ||
1771 | curr_vp->vp.height = display->getheight(); | ||
1772 | curr_vp->pb = NULL; | 1775 | curr_vp->pb = NULL; |
1773 | curr_vp->hidden_flags = 0; | 1776 | curr_vp->hidden_flags = 0; |
1774 | curr_vp->lines = NULL; | 1777 | curr_vp->lines = NULL; |
@@ -1777,31 +1780,6 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1777 | if (!skin_start_new_line(curr_vp, 0)) | 1780 | if (!skin_start_new_line(curr_vp, 0)) |
1778 | return false; | 1781 | return false; |
1779 | 1782 | ||
1780 | switch (statusbar_position(display->screen_type)) | ||
1781 | { | ||
1782 | case STATUSBAR_OFF: | ||
1783 | curr_vp->vp.y = 0; | ||
1784 | break; | ||
1785 | case STATUSBAR_TOP: | ||
1786 | curr_vp->vp.y = STATUSBAR_HEIGHT; | ||
1787 | curr_vp->vp.height -= STATUSBAR_HEIGHT; | ||
1788 | break; | ||
1789 | case STATUSBAR_BOTTOM: | ||
1790 | curr_vp->vp.y = 0; | ||
1791 | curr_vp->vp.height -= STATUSBAR_HEIGHT; | ||
1792 | break; | ||
1793 | } | ||
1794 | #ifdef HAVE_LCD_BITMAP | ||
1795 | curr_vp->vp.font = FONT_UI; | ||
1796 | curr_vp->vp.drawmode = DRMODE_SOLID; | ||
1797 | #endif | ||
1798 | #if LCD_DEPTH > 1 | ||
1799 | if (display->depth > 1) | ||
1800 | { | ||
1801 | curr_vp->vp.fg_pattern = display->get_foreground(); | ||
1802 | curr_vp->vp.bg_pattern = display->get_background(); | ||
1803 | } | ||
1804 | #endif | ||
1805 | if (!isfile) | 1783 | if (!isfile) |
1806 | { | 1784 | { |
1807 | return wps_parse(wps_data, buf, false); | 1785 | return wps_parse(wps_data, buf, false); |