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_display.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_display.c')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 8abbcddb39..66675ce95a 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -64,6 +64,7 @@ | |||
64 | 64 | ||
65 | #include "wps_internals.h" | 65 | #include "wps_internals.h" |
66 | #include "skin_engine.h" | 66 | #include "skin_engine.h" |
67 | #include "statusbar-skinned.h" | ||
67 | 68 | ||
68 | static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); | 69 | static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); |
69 | 70 | ||
@@ -83,7 +84,6 @@ bool gui_wps_display(struct gui_wps *gwps) | |||
83 | vp->bg_pattern = display->get_background(); | 84 | vp->bg_pattern = display->get_background(); |
84 | } | 85 | } |
85 | #endif | 86 | #endif |
86 | display->clear_display(); | ||
87 | display->backdrop_show(BACKDROP_SKIN_WPS); | 87 | display->backdrop_show(BACKDROP_SKIN_WPS); |
88 | return skin_redraw(gwps, WPS_REFRESH_ALL); | 88 | return skin_redraw(gwps, WPS_REFRESH_ALL); |
89 | } | 89 | } |
@@ -115,28 +115,30 @@ void skin_statusbar_changed(struct gui_wps *skin) | |||
115 | return; | 115 | return; |
116 | struct wps_data *data = skin->data; | 116 | struct wps_data *data = skin->data; |
117 | const struct screen *display = skin->display; | 117 | const struct screen *display = skin->display; |
118 | const int screen = display->screen_type; | ||
118 | 119 | ||
119 | struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, data)->vp; | 120 | struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, data)->vp; |
120 | viewport_set_fullscreen(vp, display->screen_type); | 121 | viewport_set_fullscreen(vp, screen); |
121 | 122 | ||
122 | if (data->wps_sb_tag) | 123 | if (data->wps_sb_tag) |
123 | { /* fix up the default viewport */ | 124 | { /* fix up the default viewport */ |
124 | if (data->show_sb_on_wps) | 125 | if (data->show_sb_on_wps) |
125 | { | 126 | { |
126 | bool bar_at_top = | 127 | if (statusbar_position(screen) != STATUSBAR_OFF) |
127 | statusbar_position(display->screen_type) != STATUSBAR_BOTTOM; | 128 | return; /* vp is fixed already */ |
128 | 129 | ||
129 | vp->y = bar_at_top?STATUSBAR_HEIGHT:0; | 130 | vp->y = STATUSBAR_HEIGHT; |
130 | vp->height = display->lcdheight - STATUSBAR_HEIGHT; | 131 | vp->height = display->lcdheight - STATUSBAR_HEIGHT; |
131 | } | 132 | } |
132 | else | 133 | else |
133 | { | 134 | { |
134 | vp->y = 0; | 135 | if (statusbar_position(screen) == STATUSBAR_OFF) |
136 | return; /* vp is fixed already */ | ||
137 | vp->y = vp->x = 0; | ||
135 | vp->height = display->lcdheight; | 138 | vp->height = display->lcdheight; |
139 | vp->width = display->lcdwidth; | ||
136 | } | 140 | } |
137 | } | 141 | } |
138 | |||
139 | |||
140 | } | 142 | } |
141 | 143 | ||
142 | static void draw_progressbar(struct gui_wps *gwps, | 144 | static void draw_progressbar(struct gui_wps *gwps, |
@@ -168,7 +170,7 @@ static void draw_progressbar(struct gui_wps *gwps, | |||
168 | elapsed = 0; | 170 | elapsed = 0; |
169 | length = 0; | 171 | length = 0; |
170 | } | 172 | } |
171 | 173 | ||
172 | if (pb->have_bitmap_pb) | 174 | if (pb->have_bitmap_pb) |
173 | gui_bitmap_scrollbar_draw(display, pb->bm, | 175 | gui_bitmap_scrollbar_draw(display, pb->bm, |
174 | pb->x, y, pb->width, pb->bm.height, | 176 | pb->x, y, pb->width, pb->bm.height, |
@@ -256,7 +258,7 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp) | |||
256 | } | 258 | } |
257 | #ifdef HAVE_ALBUMART | 259 | #ifdef HAVE_ALBUMART |
258 | /* now draw the AA */ | 260 | /* now draw the AA */ |
259 | if (data->albumart && data->albumart->vp == vp | 261 | if (data->albumart && data->albumart->vp == vp |
260 | && data->albumart->draw) | 262 | && data->albumart->draw) |
261 | { | 263 | { |
262 | draw_album_art(gwps, playback_current_aa_hid(data->playback_aa_slot), | 264 | draw_album_art(gwps, playback_current_aa_hid(data->playback_aa_slot), |
@@ -496,6 +498,7 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) | |||
496 | 498 | ||
497 | return true; | 499 | return true; |
498 | } | 500 | } |
501 | |||
499 | #ifdef HAVE_LCD_BITMAP | 502 | #ifdef HAVE_LCD_BITMAP |
500 | struct gui_img* find_image(char label, struct wps_data *data) | 503 | struct gui_img* find_image(char label, struct wps_data *data) |
501 | { | 504 | { |
@@ -946,15 +949,19 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
946 | if (refresh_mode == WPS_REFRESH_ALL) | 949 | if (refresh_mode == WPS_REFRESH_ALL) |
947 | { | 950 | { |
948 | struct skin_line *line; | 951 | struct skin_line *line; |
952 | struct skin_viewport *skin_viewport = find_viewport(VP_DEFAULT_LABEL, data); | ||
949 | 953 | ||
950 | display->set_viewport(&find_viewport(VP_DEFAULT_LABEL, data)->vp); | 954 | if (!(skin_viewport->hidden_flags & VP_NEVER_VISIBLE)) |
951 | display->clear_viewport(); | 955 | { |
956 | display->set_viewport(&skin_viewport->vp); | ||
957 | display->clear_viewport(); | ||
958 | } | ||
952 | 959 | ||
953 | for (viewport_list = data->viewports; | 960 | for (viewport_list = data->viewports; |
954 | viewport_list; viewport_list = viewport_list->next) | 961 | viewport_list; viewport_list = viewport_list->next) |
955 | { | 962 | { |
956 | struct skin_viewport *skin_viewport = | 963 | skin_viewport = |
957 | (struct skin_viewport *)viewport_list->token->value.data; | 964 | (struct skin_viewport *)viewport_list->token->value.data; |
958 | for(line = skin_viewport->lines; line; line = line->next) | 965 | for(line = skin_viewport->lines; line; line = line->next) |
959 | { | 966 | { |
960 | line->curr_subline = NULL; | 967 | line->curr_subline = NULL; |
@@ -977,6 +984,10 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
977 | { | 984 | { |
978 | struct skin_viewport *skin_viewport = | 985 | struct skin_viewport *skin_viewport = |
979 | (struct skin_viewport *)viewport_list->token->value.data; | 986 | (struct skin_viewport *)viewport_list->token->value.data; |
987 | if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) | ||
988 | { | ||
989 | continue; | ||
990 | } | ||
980 | if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE) | 991 | if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE) |
981 | { | 992 | { |
982 | if (skin_viewport->hidden_flags&VP_DRAW_HIDDEN) | 993 | if (skin_viewport->hidden_flags&VP_DRAW_HIDDEN) |
@@ -992,8 +1003,11 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
992 | struct skin_viewport *skin_viewport = | 1003 | struct skin_viewport *skin_viewport = |
993 | (struct skin_viewport *)viewport_list->token->value.data; | 1004 | (struct skin_viewport *)viewport_list->token->value.data; |
994 | unsigned vp_refresh_mode = refresh_mode; | 1005 | unsigned vp_refresh_mode = refresh_mode; |
1006 | |||
995 | display->set_viewport(&skin_viewport->vp); | 1007 | display->set_viewport(&skin_viewport->vp); |
996 | 1008 | ||
1009 | int hidden_vp = 0; | ||
1010 | |||
997 | #ifdef HAVE_LCD_BITMAP | 1011 | #ifdef HAVE_LCD_BITMAP |
998 | /* Set images to not to be displayed */ | 1012 | /* Set images to not to be displayed */ |
999 | struct skin_token_list *imglist = data->images; | 1013 | struct skin_token_list *imglist = data->images; |
@@ -1005,7 +1019,11 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1005 | } | 1019 | } |
1006 | #endif | 1020 | #endif |
1007 | /* dont redraw the viewport if its disabled */ | 1021 | /* dont redraw the viewport if its disabled */ |
1008 | if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN)) | 1022 | if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) |
1023 | { /* don't draw anything into this one */ | ||
1024 | vp_refresh_mode = 0; hidden_vp = true; | ||
1025 | } | ||
1026 | else if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN)) | ||
1009 | { | 1027 | { |
1010 | if (!(skin_viewport->hidden_flags&VP_DRAW_WASHIDDEN)) | 1028 | if (!(skin_viewport->hidden_flags&VP_DRAW_WASHIDDEN)) |
1011 | display->scroll_stop(&skin_viewport->vp); | 1029 | display->scroll_stop(&skin_viewport->vp); |
@@ -1019,6 +1037,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1019 | vp_refresh_mode = WPS_REFRESH_ALL; | 1037 | vp_refresh_mode = WPS_REFRESH_ALL; |
1020 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; | 1038 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; |
1021 | } | 1039 | } |
1040 | |||
1022 | if (vp_refresh_mode == WPS_REFRESH_ALL) | 1041 | if (vp_refresh_mode == WPS_REFRESH_ALL) |
1023 | { | 1042 | { |
1024 | display->clear_viewport(); | 1043 | display->clear_viewport(); |
@@ -1040,7 +1059,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1040 | flags = line->curr_subline->line_type; | 1059 | flags = line->curr_subline->line_type; |
1041 | 1060 | ||
1042 | if (vp_refresh_mode == WPS_REFRESH_ALL || (flags & vp_refresh_mode) | 1061 | if (vp_refresh_mode == WPS_REFRESH_ALL || (flags & vp_refresh_mode) |
1043 | || new_subline_refresh) | 1062 | || new_subline_refresh || hidden_vp) |
1044 | { | 1063 | { |
1045 | /* get_line tells us if we need to update the line */ | 1064 | /* get_line tells us if we need to update the line */ |
1046 | update_line = get_line(gwps, subline, | 1065 | update_line = get_line(gwps, subline, |
@@ -1086,7 +1105,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1086 | } | 1105 | } |
1087 | #endif | 1106 | #endif |
1088 | 1107 | ||
1089 | if (update_line && | 1108 | if (update_line && !hidden_vp && |
1090 | /* conditionals clear the line which means if the %Vd is put into the default | 1109 | /* conditionals clear the line which means if the %Vd is put into the default |
1091 | viewport there will be a blank line. | 1110 | viewport there will be a blank line. |
1092 | To get around this we dont allow any actual drawing to happen in the | 1111 | To get around this we dont allow any actual drawing to happen in the |
@@ -1105,7 +1124,6 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1105 | write_line(display, &align, line_count, false); | 1124 | write_line(display, &align, line_count, false); |
1106 | } | 1125 | } |
1107 | } | 1126 | } |
1108 | |||
1109 | #ifdef HAVE_LCD_BITMAP | 1127 | #ifdef HAVE_LCD_BITMAP |
1110 | /* progressbar */ | 1128 | /* progressbar */ |
1111 | if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) | 1129 | if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) |
@@ -1116,7 +1134,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1116 | } | 1134 | } |
1117 | } | 1135 | } |
1118 | /* Now display any images in this viewport */ | 1136 | /* Now display any images in this viewport */ |
1119 | wps_display_images(gwps, &skin_viewport->vp); | 1137 | if (!hidden_vp) |
1138 | wps_display_images(gwps, &skin_viewport->vp); | ||
1120 | #endif | 1139 | #endif |
1121 | } | 1140 | } |
1122 | 1141 | ||