summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-03-06 00:29:46 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-03-06 00:29:46 +0000
commita9b5f4d810903996d868b0fcdcf9859cf3f47d7d (patch)
tree4acbdcace28f00451d5b5c9687cc53c6f997886c /apps
parent43ed678b4645a48cf2072ab72c93e730f4d329ff (diff)
downloadrockbox-a9b5f4d810903996d868b0fcdcf9859cf3f47d7d.tar.gz
rockbox-a9b5f4d810903996d868b0fcdcf9859cf3f47d7d.zip
cleanup statusbar+base skin relationship...
* remove the "custom" option from the statusbar setting. if a sbs file is set then statusbar setting is ignored, no other user visible change there. * new tag, %wi - use to draw the inbuilt statusbar in the current viewport git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25038 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c8
-rw-r--r--apps/gui/skin_engine/skin_display.c13
-rw-r--r--apps/gui/skin_engine/skin_parser.c11
-rw-r--r--apps/gui/skin_engine/skin_tokens.h1
-rw-r--r--apps/gui/statusbar-skinned.c17
-rw-r--r--apps/gui/statusbar.c39
-rw-r--r--apps/gui/statusbar.h8
-rw-r--r--apps/gui/viewport.c7
-rw-r--r--apps/menus/theme_menu.c3
-rw-r--r--apps/settings_list.c12
10 files changed, 65 insertions, 54 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index c9c8b3810a..e3977e5a44 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -510,18 +510,14 @@ int ft_enter(struct tree_context* c)
510#ifdef HAVE_LCD_BITMAP 510#ifdef HAVE_LCD_BITMAP
511 case FILE_ATTR_SBS: 511 case FILE_ATTR_SBS:
512 splash(0, ID2P(LANG_WAIT)); 512 splash(0, ID2P(LANG_WAIT));
513 set_file(buf, (char *)global_settings.sbs_file, 513 set_file(buf, (char *)global_settings.sbs_file, MAX_FILENAME);
514 MAX_FILENAME);
515 global_settings.statusbar = STATUSBAR_CUSTOM;
516 settings_apply_skins(); 514 settings_apply_skins();
517 break; 515 break;
518#endif 516#endif
519#ifdef HAVE_REMOTE_LCD 517#ifdef HAVE_REMOTE_LCD
520 case FILE_ATTR_RSBS: 518 case FILE_ATTR_RSBS:
521 splash(0, ID2P(LANG_WAIT)); 519 splash(0, ID2P(LANG_WAIT));
522 set_file(buf, (char *)global_settings.rsbs_file, 520 set_file(buf, (char *)global_settings.rsbs_file, MAX_FILENAME);
523 MAX_FILENAME);
524 global_settings.remote_statusbar = STATUSBAR_CUSTOM;
525 settings_apply_skins(); 521 settings_apply_skins();
526 break; 522 break;
527#endif 523#endif
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);
155static int parse_statusbar_disable(const char *wps_bufptr, 155static 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);
157static int parse_statusbar_inbuilt(const char *wps_bufptr,
158 struct wps_token *token, struct wps_data *wps_data);
157static int parse_image_display(const char *wps_bufptr, 159static 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);
159static int parse_image_load(const char *wps_bufptr, 161static 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
568static 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
565static int get_image_id(int c) 576static 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
187void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) 187void 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
831void 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
852enum statusbar_values statusbar_position(int screen) 839enum 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 */
58enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM, 58enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM };
59 STATUSBAR_CUSTOM };
60 59
61struct gui_statusbar 60struct 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 */
95extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw); 94extern void gui_statusbar_draw(struct gui_statusbar * bar,
95 bool force_redraw, struct viewport *vp);
96 96
97 97
98struct gui_syncstatusbar 98struct gui_syncstatusbar
@@ -103,8 +103,6 @@ struct gui_syncstatusbar
103extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR; 103extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR;
104extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, 104extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
105 bool force_redraw); 105 bool force_redraw);
106void 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
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index ee1970ee44..7d2a05c67f 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -162,8 +162,7 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item
162 old_bar[screen] = statusbar_position(screen); 162 old_bar[screen] = statusbar_position(screen);
163 break; 163 break;
164 case ACTION_EXIT_MENUITEM: 164 case ACTION_EXIT_MENUITEM:
165 if (statusbar_position(screen) == STATUSBAR_CUSTOM 165 if (old_bar[screen] != statusbar_position(screen))
166 && old_bar[screen] != statusbar_position(screen))
167 settings_apply_skins(); 166 settings_apply_skins();
168 break; 167 break;
169 } 168 }
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 0a7c3c5b99..5759e24286 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -624,14 +624,14 @@ const struct settings_list settings[] = {
624 ID2P(LANG_INVERT_CURSOR_BAR)), 624 ID2P(LANG_INVERT_CURSOR_BAR)),
625 #endif 625 #endif
626 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, 626 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
627 LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom,custom", 627 LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom",
628 NULL, 4, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), 628 NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP),
629 ID2P(LANG_STATUSBAR_BOTTOM), ID2P(LANG_STATUSBAR_CUSTOM)), 629 ID2P(LANG_STATUSBAR_BOTTOM)),
630#ifdef HAVE_REMOTE_LCD 630#ifdef HAVE_REMOTE_LCD
631 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar, 631 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar,
632 LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom,custom", 632 LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom",
633 NULL, 4, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), 633 NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP),
634 ID2P(LANG_STATUSBAR_BOTTOM), ID2P(LANG_STATUSBAR_CUSTOM)), 634 ID2P(LANG_STATUSBAR_BOTTOM)),
635#endif 635#endif
636 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, scrollbar, 636 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, scrollbar,
637 LANG_SCROLL_BAR, SCROLLBAR_LEFT, "scrollbar","off,left,right", 637 LANG_SCROLL_BAR, SCROLLBAR_LEFT, "scrollbar","off,left,right",