diff options
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 13 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 11 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.h | 1 | ||||
-rw-r--r-- | apps/gui/statusbar-skinned.c | 17 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 39 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 8 | ||||
-rw-r--r-- | apps/gui/viewport.c | 7 |
7 files changed, 56 insertions, 40 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index d610fe4a4d..316b97523c 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -630,7 +630,8 @@ static bool get_line(struct gui_wps *gwps, | |||
630 | struct skin_subline *subline, | 630 | struct skin_subline *subline, |
631 | struct align_pos *align, | 631 | struct align_pos *align, |
632 | char *linebuf, | 632 | char *linebuf, |
633 | int linebuf_size) | 633 | int linebuf_size, |
634 | unsigned refresh_mode) | ||
634 | { | 635 | { |
635 | struct wps_data *data = gwps->data; | 636 | struct wps_data *data = gwps->data; |
636 | 637 | ||
@@ -639,6 +640,7 @@ static bool get_line(struct gui_wps *gwps, | |||
639 | char *linebuf_end = linebuf + linebuf_size - 1; | 640 | char *linebuf_end = linebuf + linebuf_size - 1; |
640 | bool update = false; | 641 | bool update = false; |
641 | int i; | 642 | int i; |
643 | (void)refresh_mode; /* silence warning on charcell */ | ||
642 | 644 | ||
643 | /* alignment-related variables */ | 645 | /* alignment-related variables */ |
644 | int cur_align; | 646 | int cur_align; |
@@ -676,6 +678,11 @@ static bool get_line(struct gui_wps *gwps, | |||
676 | img->display = subimage; | 678 | img->display = subimage; |
677 | break; | 679 | break; |
678 | } | 680 | } |
681 | case WPS_TOKEN_DRAW_INBUILTBAR: | ||
682 | gui_statusbar_draw(&(statusbars.statusbars[gwps->display->screen_type]), | ||
683 | refresh_mode == WPS_REFRESH_ALL, | ||
684 | data->tokens[i].value.data); | ||
685 | break; | ||
679 | #endif | 686 | #endif |
680 | 687 | ||
681 | case WPS_TOKEN_ALIGN_LEFT: | 688 | case WPS_TOKEN_ALIGN_LEFT: |
@@ -1176,8 +1183,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1176 | || new_subline_refresh || hidden_vp) | 1183 | || new_subline_refresh || hidden_vp) |
1177 | { | 1184 | { |
1178 | /* get_line tells us if we need to update the line */ | 1185 | /* get_line tells us if we need to update the line */ |
1179 | update_line = get_line(gwps, subline, | 1186 | update_line = get_line(gwps, subline, &align, |
1180 | &align, linebuf, sizeof(linebuf)); | 1187 | linebuf, sizeof(linebuf), vp_refresh_mode); |
1181 | } | 1188 | } |
1182 | #ifdef HAVE_LCD_BITMAP | 1189 | #ifdef HAVE_LCD_BITMAP |
1183 | /* peakmeter */ | 1190 | /* peakmeter */ |
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index ecfdfaa9e5..b66af75cb5 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -154,6 +154,8 @@ static int parse_statusbar_enable(const char *wps_bufptr, | |||
154 | struct wps_token *token, struct wps_data *wps_data); | 154 | struct wps_token *token, struct wps_data *wps_data); |
155 | static int parse_statusbar_disable(const char *wps_bufptr, | 155 | static int parse_statusbar_disable(const char *wps_bufptr, |
156 | struct wps_token *token, struct wps_data *wps_data); | 156 | struct wps_token *token, struct wps_data *wps_data); |
157 | static int parse_statusbar_inbuilt(const char *wps_bufptr, | ||
158 | struct wps_token *token, struct wps_data *wps_data); | ||
157 | static int parse_image_display(const char *wps_bufptr, | 159 | static int parse_image_display(const char *wps_bufptr, |
158 | struct wps_token *token, struct wps_data *wps_data); | 160 | struct wps_token *token, struct wps_data *wps_data); |
159 | static int parse_image_load(const char *wps_bufptr, | 161 | static int parse_image_load(const char *wps_bufptr, |
@@ -349,6 +351,7 @@ static const struct wps_tag all_tags[] = { | |||
349 | #ifdef HAVE_LCD_BITMAP | 351 | #ifdef HAVE_LCD_BITMAP |
350 | { WPS_NO_TOKEN, "we", 0, parse_statusbar_enable }, | 352 | { WPS_NO_TOKEN, "we", 0, parse_statusbar_enable }, |
351 | { WPS_NO_TOKEN, "wd", 0, parse_statusbar_disable }, | 353 | { WPS_NO_TOKEN, "wd", 0, parse_statusbar_disable }, |
354 | { WPS_TOKEN_DRAW_INBUILTBAR, "wi", WPS_REFRESH_DYNAMIC, parse_statusbar_inbuilt }, | ||
352 | 355 | ||
353 | { WPS_NO_TOKEN, "xl", 0, parse_image_load }, | 356 | { WPS_NO_TOKEN, "xl", 0, parse_image_load }, |
354 | 357 | ||
@@ -562,6 +565,14 @@ static int parse_statusbar_disable(const char *wps_bufptr, | |||
562 | return skip_end_of_line(wps_bufptr); | 565 | return skip_end_of_line(wps_bufptr); |
563 | } | 566 | } |
564 | 567 | ||
568 | static int parse_statusbar_inbuilt(const char *wps_bufptr, | ||
569 | struct wps_token *token, struct wps_data *wps_data) | ||
570 | { | ||
571 | (void)wps_data; | ||
572 | token->value.data = (void*)&curr_vp->vp; | ||
573 | return skip_end_of_line(wps_bufptr); | ||
574 | } | ||
575 | |||
565 | static int get_image_id(int c) | 576 | static int get_image_id(int c) |
566 | { | 577 | { |
567 | if(c >= 'a' && c <= 'z') | 578 | if(c >= 'a' && c <= 'z') |
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h index d0df058cf0..2c6dd6b72a 100644 --- a/apps/gui/skin_engine/skin_tokens.h +++ b/apps/gui/skin_engine/skin_tokens.h | |||
@@ -189,6 +189,7 @@ enum wps_token_type { | |||
189 | 189 | ||
190 | /* buttons */ | 190 | /* buttons */ |
191 | TOKEN_MARKER_MISC, | 191 | TOKEN_MARKER_MISC, |
192 | WPS_TOKEN_DRAW_INBUILTBAR, | ||
192 | WPS_TOKEN_LIST_TITLE_TEXT, | 193 | WPS_TOKEN_LIST_TITLE_TEXT, |
193 | WPS_TOKEN_LIST_TITLE_ICON, | 194 | WPS_TOKEN_LIST_TITLE_ICON, |
194 | WPS_TOKEN_BUTTON_VOLUME, | 195 | WPS_TOKEN_BUTTON_VOLUME, |
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c index 2ebdcca048..840ad63c40 100644 --- a/apps/gui/statusbar-skinned.c +++ b/apps/gui/statusbar-skinned.c | |||
@@ -173,10 +173,23 @@ void sb_create_from_settings(enum screen_type screen) | |||
173 | { | 173 | { |
174 | char buf[128], *ptr, *ptr2; | 174 | char buf[128], *ptr, *ptr2; |
175 | int len, remaining = sizeof(buf); | 175 | int len, remaining = sizeof(buf); |
176 | 176 | int bar_position = statusbar_position(screen); | |
177 | ptr = buf; | 177 | ptr = buf; |
178 | ptr[0] = '\0'; | 178 | ptr[0] = '\0'; |
179 | 179 | ||
180 | /* setup the inbuilt statusbar */ | ||
181 | if (bar_position != STATUSBAR_OFF) | ||
182 | { | ||
183 | int y = 0, height = STATUSBAR_HEIGHT; | ||
184 | if (bar_position == STATUSBAR_BOTTOM) | ||
185 | { | ||
186 | y = screens[screen].lcdheight - STATUSBAR_HEIGHT; | ||
187 | } | ||
188 | len = snprintf(ptr, remaining, "%%V|0|%d|-|%d|0|-|-|\n%%wi\n", | ||
189 | y, height); | ||
190 | remaining -= len; | ||
191 | ptr += len; | ||
192 | } | ||
180 | /* %Vi viewport, colours handled by the parser */ | 193 | /* %Vi viewport, colours handled by the parser */ |
181 | #if NB_SCREENS > 1 | 194 | #if NB_SCREENS > 1 |
182 | if (screen == SCREEN_REMOTE) | 195 | if (screen == SCREEN_REMOTE) |
@@ -194,7 +207,7 @@ void sb_create_from_settings(enum screen_type screen) | |||
194 | else | 207 | else |
195 | { | 208 | { |
196 | int y = 0, height; | 209 | int y = 0, height; |
197 | switch (statusbar_position(screen)) | 210 | switch (bar_position) |
198 | { | 211 | { |
199 | case STATUSBAR_TOP: | 212 | case STATUSBAR_TOP: |
200 | y = STATUSBAR_HEIGHT; | 213 | y = STATUSBAR_HEIGHT; |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 4710ebac42..bc5570ee4e 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -184,7 +184,7 @@ static void gui_statusbar_init(struct gui_statusbar * bar) | |||
184 | (vp).y = (display)->lcdheight - STATUSBAR_HEIGHT; \ | 184 | (vp).y = (display)->lcdheight - STATUSBAR_HEIGHT; \ |
185 | } while(0) | 185 | } while(0) |
186 | 186 | ||
187 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | 187 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw, struct viewport *vp) |
188 | { | 188 | { |
189 | struct screen * display = bar->display; | 189 | struct screen * display = bar->display; |
190 | 190 | ||
@@ -194,6 +194,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
194 | #ifdef HAVE_LCD_CHARCELLS | 194 | #ifdef HAVE_LCD_CHARCELLS |
195 | int val; | 195 | int val; |
196 | (void)force_redraw; /* The Player always has "redraw" */ | 196 | (void)force_redraw; /* The Player always has "redraw" */ |
197 | (void)vp; | ||
197 | #endif /* HAVE_LCD_CHARCELLS */ | 198 | #endif /* HAVE_LCD_CHARCELLS */ |
198 | 199 | ||
199 | bar->info.battlevel = battery_level(); | 200 | bar->info.battlevel = battery_level(); |
@@ -277,10 +278,16 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
277 | #endif | 278 | #endif |
278 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) | 279 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) |
279 | { | 280 | { |
280 | struct viewport vp; | 281 | if (vp == NULL) |
281 | 282 | { | |
282 | GET_RECT(vp,statusbar_position(display->screen_type),display); | 283 | struct viewport viewport; |
283 | display->set_viewport(&vp); | 284 | GET_RECT(viewport,statusbar_position(display->screen_type),display); |
285 | display->set_viewport(&viewport); | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | display->set_viewport(vp); | ||
290 | } | ||
284 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 291 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
285 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); | 292 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); |
286 | display->set_drawmode(DRMODE_SOLID); | 293 | display->set_drawmode(DRMODE_SOLID); |
@@ -823,30 +830,10 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, | |||
823 | #endif /* HAVE_LCD_BITMAP */ | 830 | #endif /* HAVE_LCD_BITMAP */ |
824 | int i; | 831 | int i; |
825 | FOR_NB_SCREENS(i) { | 832 | FOR_NB_SCREENS(i) { |
826 | gui_statusbar_draw( &(bars->statusbars[i]), force_redraw ); | 833 | gui_statusbar_draw( &(bars->statusbars[i]), force_redraw, NULL ); |
827 | } | 834 | } |
828 | } | 835 | } |
829 | 836 | ||
830 | #ifdef HAVE_LCD_BITMAP | ||
831 | void gui_statusbar_changed( enum screen_type screen, | ||
832 | enum statusbar_values old) | ||
833 | { | ||
834 | /* clear and update the statusbar area to remove old parts */ | ||
835 | enum statusbar_values bar = statusbar_position(screen); | ||
836 | |||
837 | struct screen *display = &screens[screen]; | ||
838 | struct viewport vp; | ||
839 | |||
840 | if (old != STATUSBAR_OFF && old != bar) | ||
841 | { | ||
842 | GET_RECT(vp, old, display); | ||
843 | display->set_viewport(&vp); | ||
844 | display->clear_viewport(); | ||
845 | display->update_viewport(); | ||
846 | display->set_viewport(NULL); | ||
847 | } | ||
848 | } | ||
849 | #endif | ||
850 | 837 | ||
851 | #ifdef HAVE_REMOTE_LCD | 838 | #ifdef HAVE_REMOTE_LCD |
852 | enum statusbar_values statusbar_position(int screen) | 839 | enum statusbar_values statusbar_position(int screen) |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 0233b56baf..281cf3f5b9 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -55,8 +55,7 @@ struct status_info { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | /* statusbar visibility/position, used for settings also */ | 57 | /* statusbar visibility/position, used for settings also */ |
58 | enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM, | 58 | enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM }; |
59 | STATUSBAR_CUSTOM }; | ||
60 | 59 | ||
61 | struct gui_statusbar | 60 | struct gui_statusbar |
62 | { | 61 | { |
@@ -92,7 +91,8 @@ extern struct gui_syncstatusbar statusbars; | |||
92 | * Draws the status bar on the attached screen | 91 | * Draws the status bar on the attached screen |
93 | * - bar : the statusbar structure | 92 | * - bar : the statusbar structure |
94 | */ | 93 | */ |
95 | extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw); | 94 | extern void gui_statusbar_draw(struct gui_statusbar * bar, |
95 | bool force_redraw, struct viewport *vp); | ||
96 | 96 | ||
97 | 97 | ||
98 | struct gui_syncstatusbar | 98 | struct gui_syncstatusbar |
@@ -103,8 +103,6 @@ struct gui_syncstatusbar | |||
103 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR; | 103 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR; |
104 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, | 104 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, |
105 | bool force_redraw); | 105 | bool force_redraw); |
106 | void gui_statusbar_changed(enum screen_type screen, | ||
107 | enum statusbar_values old); | ||
108 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) | 106 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) |
109 | #include "settings.h" | 107 | #include "settings.h" |
110 | #define statusbar_position(a) ((enum statusbar_values)global_settings.statusbar) | 108 | #define statusbar_position(a) ((enum statusbar_values)global_settings.statusbar) |
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index c51f2f5b48..0d3f57447c 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -229,11 +229,10 @@ static void viewportmanager_redraw(void* data) | |||
229 | FOR_NB_SCREENS(i) | 229 | FOR_NB_SCREENS(i) |
230 | { | 230 | { |
231 | #ifdef HAVE_LCD_BITMAP | 231 | #ifdef HAVE_LCD_BITMAP |
232 | if (statusbar_position(i) == STATUSBAR_CUSTOM) | 232 | sb_skin_update(i, NULL != data); |
233 | sb_skin_update(i, NULL != data); | 233 | #else |
234 | else if (statusbar_position(i) != STATUSBAR_OFF) | 234 | gui_statusbar_draw(&statusbars.statusbars[i], NULL, NULL); |
235 | #endif | 235 | #endif |
236 | gui_statusbar_draw(&statusbars.statusbars[i], NULL != data); | ||
237 | } | 236 | } |
238 | } | 237 | } |
239 | 238 | ||