diff --git a/apps/SOURCES b/apps/SOURCES index 143d9d5..e6eecf7 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -78,6 +78,7 @@ gui/quickscreen.c #endif gui/wps.c +gui/statusbar-skinned.c gui/scrollbar.c gui/splash.c gui/statusbar.c diff --git a/apps/filetree.c b/apps/filetree.c index ec79324..56c3568 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -482,7 +482,26 @@ int ft_enter(struct tree_context* c) break; #endif - +#ifdef HAVE_LCD_BITMAP + case FILE_ATTR_SB: + splash(0, ID2P(LANG_WAIT)); + set_file(buf, (char *)global_settings.sb_file, + MAX_FILENAME); + global_settings.statusbar = STATUSBAR_CUSTOM; + settings_apply_skins(); + viewportmanager_theme_changed(THEME_STATUSBAR); + break; +#endif +#ifdef HAVE_REMOTE_LCD + case FILE_ATTR_RSB: + splash(0, ID2P(LANG_WAIT)); + set_file(buf, (char *)global_settings.rsb_file, + MAX_FILENAME); + global_settings.remote_statusbar = STATUSBAR_CUSTOM; + settings_apply_skins(); + viewportmanager_theme_changed(THEME_STATUSBAR); + break; +#endif /* wps config file */ case FILE_ATTR_WPS: splash(0, ID2P(LANG_WAIT)); diff --git a/apps/filetypes.c b/apps/filetypes.c index ffa7161..aff153d 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -108,6 +108,12 @@ static const struct filetype inbuilt_filetypes[] = { #endif { "bmark",FILE_ATTR_BMARK, Icon_Bookmark, VOICE_EXT_BMARK }, { "cue", FILE_ATTR_CUE, Icon_Bookmark, VOICE_EXT_CUESHEET }, +#ifdef HAVE_LCD_BITMAP + { "sb", FILE_ATTR_SB, Icon_Wps, VOICE_EXT_WPS }, +#endif +#ifdef HAVE_REMOTE_LCD + { "rsb", FILE_ATTR_RSB, Icon_Wps, VOICE_EXT_WPS }, +#endif #ifdef BOOTFILE_EXT { BOOTFILE_EXT, FILE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ }, #endif diff --git a/apps/filetypes.h b/apps/filetypes.h index f872cf8..66c7ae2 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -41,6 +41,8 @@ #define FILE_ATTR_KBD 0x0C00 /* keyboard file */ #define FILE_ATTR_FMR 0x0D00 /* preset file */ #define FILE_ATTR_CUE 0x0E00 /* cuesheet file */ +#define FILE_ATTR_SB 0x0F00 /* statusbar file */ +#define FILE_ATTR_RSB 0x1000 /* remote statusbar file */ #define FILE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */ struct filetype { diff --git a/apps/gui/list.c b/apps/gui/list.c index 9b139dd..85b220d 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -29,6 +29,7 @@ #include "kernel.h" #include "system.h" +#include "appevents.h" #include "action.h" #include "screen_access.h" #include "list.h" diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index b64de43..e03d2e8 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -64,6 +64,7 @@ #include "wps_internals.h" #include "skin_engine.h" +#include "statusbar-skinned.h" static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); @@ -105,7 +106,6 @@ bool gui_wps_display(struct gui_wps *gwps) vp->bg_pattern = display->get_background(); } #endif - display->clear_display(); display->backdrop_show(BACKDROP_SKIN_WPS); return skin_redraw(gwps, WPS_REFRESH_ALL); } @@ -137,28 +137,30 @@ void skin_statusbar_changed(struct gui_wps *skin) return; struct wps_data *data = skin->data; const struct screen *display = skin->display; + const int screen = display->screen_type; struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, data)->vp; - viewport_set_fullscreen(vp, display->screen_type); + viewport_set_fullscreen(vp, screen); if (data->wps_sb_tag) { /* fix up the default viewport */ if (data->show_sb_on_wps) { - bool bar_at_top = - statusbar_position(display->screen_type) != STATUSBAR_BOTTOM; + if (statusbar_position(screen) != STATUSBAR_OFF) + return; /* vp is fixed already */ - vp->y = bar_at_top?STATUSBAR_HEIGHT:0; + vp->y = STATUSBAR_HEIGHT; vp->height = display->lcdheight - STATUSBAR_HEIGHT; } else { - vp->y = 0; + if (statusbar_position(screen) == STATUSBAR_OFF) + return; /* vp is fixed already */ + vp->y = vp->x = 0; vp->height = display->lcdheight; + vp->width = display->lcdwidth; } } - - } static void draw_progressbar(struct gui_wps *gwps, @@ -190,7 +192,7 @@ static void draw_progressbar(struct gui_wps *gwps, elapsed = 0; length = 0; } - + if (pb->have_bitmap_pb) gui_bitmap_scrollbar_draw(display, pb->bm, pb->x, y, pb->width, pb->bm.height, @@ -527,7 +529,12 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) #ifdef HAVE_LCD_BITMAP /* clear all pictures in the conditional and nested ones */ if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY) - clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data)); + { + struct gui_img *tmp = find_image(data->tokens[i].value.i&0xFF, + data); + if (tmp) + clear_image_pos(gwps, tmp); + } #endif #ifdef HAVE_ALBUMART if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) @@ -537,18 +544,35 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) return true; } + #ifdef HAVE_LCD_BITMAP struct gui_img* find_image(char label, struct wps_data *data) { + static int i = 0; + struct gui_img *ret = NULL; struct skin_token_list *list = data->images; + if (data->debug) + { + SDEBUGF("%s >> requesting image (label: %c)\n", __func__, label); + SDEBUGF("%s >> first list data (p: %p\n", __func__, data->images); + } while (list) { struct gui_img *img = (struct gui_img *)list->token->value.data; if (img->label == label) - return img; + { + i = 0; + ret = img; goto end; + } list = list->next; } - return NULL; + i = 0; +end: + if (data->debug) + { + SDEBUGF("%s >> returning %p\n", __func__, ret); + } + return ret; } #endif @@ -563,9 +587,8 @@ struct skin_viewport* find_viewport(char label, struct wps_data *data) list = list->next; } return NULL; -} - - +} + /* Read a (sub)line to the given alignment format buffer. linebuf is the buffer where the data is actually stored. align is the alignment format that'll be used to display the text. @@ -1024,8 +1047,13 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) /* reset to first subline if refresh all flag is set */ if (refresh_mode == WPS_REFRESH_ALL) { - display->set_viewport(&find_viewport(VP_DEFAULT_LABEL, data)->vp); - display->clear_viewport(); + struct skin_viewport *skin_viewport = find_viewport(VP_DEFAULT_LABEL, data); + + if (!(skin_viewport->hidden_flags & VP_NEVER_VISIBLE)) + { + display->set_viewport(&skin_viewport->vp); + display->clear_viewport(); + } for (i = 0; i <= data->num_lines; i++) { @@ -1048,6 +1076,10 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) { struct skin_viewport *skin_viewport = (struct skin_viewport *)viewport_list->token->value.data; + if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) + { + continue; + } if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE) { if (skin_viewport->hidden_flags&VP_DRAW_HIDDEN) @@ -1063,8 +1095,11 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) struct skin_viewport *skin_viewport = (struct skin_viewport *)viewport_list->token->value.data; unsigned vp_refresh_mode = refresh_mode; + display->set_viewport(&skin_viewport->vp); + int hidden_vp = 0; + #ifdef HAVE_LCD_BITMAP /* Set images to not to be displayed */ struct skin_token_list *imglist = data->images; @@ -1076,7 +1111,11 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) } #endif /* dont redraw the viewport if its disabled */ - if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN)) + if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) + { /* don't draw anything into this one */ + vp_refresh_mode = 0; hidden_vp = true; + } + else if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN)) { if (!(skin_viewport->hidden_flags&VP_DRAW_WASHIDDEN)) display->scroll_stop(&skin_viewport->vp); @@ -1090,11 +1129,12 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) vp_refresh_mode = WPS_REFRESH_ALL; skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; } + if (vp_refresh_mode == WPS_REFRESH_ALL) { display->clear_viewport(); } - + for (line = skin_viewport->first_line; line <= skin_viewport->last_line; line++) { @@ -1109,7 +1149,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) flags = data->sublines[subline_idx].line_type; if (vp_refresh_mode == WPS_REFRESH_ALL || (flags & vp_refresh_mode) - || new_subline_refresh) + || new_subline_refresh || hidden_vp) { /* get_line tells us if we need to update the line */ update_line = get_line(gwps, line, data->lines[line].curr_subline, @@ -1155,7 +1195,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) } #endif - if (update_line && + if (update_line && !hidden_vp && /* conditionals clear the line which means if the %Vd is put into the default viewport there will be a blank line. To get around this we dont allow any actual drawing to happen in the @@ -1174,7 +1214,6 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) write_line(display, &align, line - skin_viewport->first_line, false); } } - #ifdef HAVE_LCD_BITMAP /* progressbar */ if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) @@ -1185,7 +1224,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) } } /* Now display any images in this viewport */ - wps_display_images(gwps, &skin_viewport->vp); + if (!hidden_vp) + wps_display_images(gwps, &skin_viewport->vp); #endif } diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h index c52f720..62afbd9 100644 --- a/apps/gui/skin_engine/skin_engine.h +++ b/apps/gui/skin_engine/skin_engine.h @@ -27,6 +27,7 @@ #include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */ +#define SDEBUGF(varargs...) //DEBUGF(varargs) #ifdef HAVE_TOUCHSCREEN int wps_get_touchaction(struct wps_data *data); @@ -44,7 +45,6 @@ bool skin_update(struct gui_wps *gwps, unsigned int update_type); * or from a skinfile (isfile = true) */ bool skin_data_load(struct wps_data *wps_data, - struct screen *display, const char *buf, bool isfile); diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 68bddf6..11610ed 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -547,6 +547,10 @@ static int parse_image_load(const char *wps_bufptr, return WPS_ERROR_INVALID_PARAM; /* save a pointer to the filename */ img->bm.data = (char*)filename; + if (wps_data->debug) + { + SDEBUGF("%s >> image parsed (label: %c)\n", __func__, *id); + } img->label = *id; img->x = x; img->y = y; @@ -617,8 +621,14 @@ static int parse_viewport(const char *wps_bufptr, skin_vp->hidden_flags = 0; skin_vp->label = VP_NO_LABEL; skin_vp->pb = NULL; - - if (*ptr == 'l') + + if (*ptr == 'i') + { + skin_vp->label = VP_INFO_LABEL; + skin_vp->hidden_flags = VP_NEVER_VISIBLE; + ++ptr; + } + else if (*ptr == 'l') { if (*(ptr+1) == '|') { @@ -1528,7 +1538,14 @@ static void wps_reset(struct wps_data *data) #ifdef HAVE_REMOTE_LCD bool rwps = data->remote_wps; /* remember whether the data is for a RWPS */ #endif + + bool old_debug = data->debug; + if (old_debug) + { + SDEBUGF("%s >> wps_data trashed (%p)\n", __func__, data); + } memset(data, 0, sizeof(*data)); + data->debug = old_debug; skin_data_init(data); #ifdef HAVE_REMOTE_LCD data->remote_wps = rwps; @@ -1566,7 +1583,7 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char else { /* Abort if we can't load an image */ - DEBUGF("ERR: Failed to load image - %s\n",img_path); + SDEBUGF("ERR: %s >> Failed to load image - %s\n",__func__, img_path); loaded = false; } return loaded; @@ -1625,7 +1642,6 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) /* to setup up the wps-data from a format-buffer (isfile = false) from a (wps-)file (isfile = true)*/ bool skin_data_load(struct wps_data *wps_data, - struct screen *display, const char *buf, bool isfile) { @@ -1637,11 +1653,13 @@ bool skin_data_load(struct wps_data *wps_data, int albumart_max_height = wps_data->albumart_max_height; int albumart_max_width = wps_data->albumart_max_width; #endif + if (!wps_data || !buf) return false; wps_reset(wps_data); - + + /* alloc default viewport, will be fixed up later */ curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); if (!curr_vp) return false; @@ -1653,36 +1671,9 @@ bool skin_data_load(struct wps_data *wps_data, /* Initialise the first (default) viewport */ curr_vp->label = VP_DEFAULT_LABEL; - curr_vp->vp.x = 0; - curr_vp->vp.width = display->getwidth(); - curr_vp->vp.height = display->getheight(); curr_vp->pb = NULL; curr_vp->hidden_flags = 0; - switch (statusbar_position(display->screen_type)) - { - case STATUSBAR_OFF: - curr_vp->vp.y = 0; - break; - case STATUSBAR_TOP: - curr_vp->vp.y = STATUSBAR_HEIGHT; - curr_vp->vp.height -= STATUSBAR_HEIGHT; - break; - case STATUSBAR_BOTTOM: - curr_vp->vp.y = 0; - curr_vp->vp.height -= STATUSBAR_HEIGHT; - break; - } -#ifdef HAVE_LCD_BITMAP - curr_vp->vp.font = FONT_UI; - curr_vp->vp.drawmode = DRMODE_SOLID; -#endif -#if LCD_DEPTH > 1 - if (display->depth > 1) - { - curr_vp->vp.fg_pattern = display->get_foreground(); - curr_vp->vp.bg_pattern = display->get_background(); - } -#endif + if (!isfile) { return wps_parse(wps_data, buf, false); diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index fbd18b9..8a20e1f 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -188,11 +188,14 @@ struct wps_line { long subline_expire_time; }; -#define VP_DRAW_HIDEABLE 0x1 -#define VP_DRAW_HIDDEN 0x2 -#define VP_DRAW_WASHIDDEN 0x4 -#define VP_DEFAULT_LABEL '|' -#define VP_NO_LABEL '-' +#define VP_DRAW_HIDEABLE 0x1 +#define VP_DRAW_HIDDEN 0x2 +#define VP_DRAW_WASHIDDEN 0x4 +/* these are never drawn, nor cleared, i.e. just ignored */ +#define VP_NEVER_VISIBLE 0x8 +#define VP_DEFAULT_LABEL '|' +#define VP_NO_LABEL '-' +#define VP_INFO_LABEL '_' struct skin_viewport { struct viewport vp; /* The LCD viewport struct */ struct progressbar *pb; @@ -284,6 +287,7 @@ struct wps_data /* tick the volume button was last pressed */ unsigned int button_time_volume; + bool debug; }; /* Returns the index of the last subline's token in the token array. diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c new file mode 100644 index 0000000..a8fc3e4 --- /dev/null +++ b/apps/gui/statusbar-skinned.c @@ -0,0 +1,149 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" + +#include "system.h" +#include "settings.h" +#include "appevents.h" +#include "screens.h" +#include "screen_access.h" +#include "skin_engine/skin_engine.h" +#include "skin_engine/wps_internals.h" +#include "viewport.h" +#include "statusbar.h" +#include "debug.h" + + +/* currently only one wps_state is needed */ +extern struct wps_state wps_state; +static struct gui_wps sb_skin[NB_SCREENS]; +static struct wps_data sb_skin_data[NB_SCREENS]; + +/* initial setup of wps_data */ +static void sb_skin_update(void*); +static bool loaded_ok[NB_SCREENS] = { false }; +static int skinbars = 0; + +void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile) +{ + struct wps_data *data = sb_skin[screen].data; + + int success; + success = buf && skin_data_load(data, buf, isfile); + + if (success) + { /*hide the sb's default viewport because it has nasty effect with stuff + *not part of the sb, hence .sb's without any other vps are unsupported*/ + struct skin_viewport *vp = find_viewport(VP_DEFAULT_LABEL, data); + struct skin_token_list *next_vp = data->viewports->next; + + if (!next_vp) + { /* no second viewport, let parsing fail */ + success = false; + } + /* hide this viewport, forever */ + vp->hidden_flags = VP_NEVER_VISIBLE; + } + + if (!success) + remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update); + +#ifdef HAVE_REMOVE_LCD + data->remote_wps = !(screen == SCREEN_MAIN); +#endif + loaded_ok[screen] = success; +} + +void sb_skin_data_init(enum screen_type screen) +{ + skin_data_init(sb_skin[screen].data); +} + +struct viewport *sb_skin_get_info_vp(enum screen_type screen) +{ + return &find_viewport(VP_INFO_LABEL, sb_skin[screen].data)->vp; +} + +inline bool sb_skin_get_state(enum screen_type screen) +{ + return loaded_ok[screen] && (statusbar_position(screen) + == STATUSBAR_CUSTOM); +} + +void sb_skin_set_state(int state, enum screen_type screen) +{ + wps_state.do_full_update = true; + if (state) + { + skinbars |= VP_SB_ONSCREEN(screen); + } + else + { + skinbars &= ~VP_SB_ONSCREEN(screen); + } + + if (skinbars) + add_event(GUI_EVENT_ACTIONUPDATE, false, sb_skin_update); + else + remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update); +} + +static void sb_skin_update(void* param) +{ + static long next_update = 0; + int i; + int forced_draw = param || wps_state.do_full_update; + if (TIME_AFTER(current_tick, next_update) || forced_draw) + { + FOR_NB_SCREENS(i) + { + if (sb_skin_get_state(i)) + { + skin_update(&sb_skin[i], WPS_REFRESH_NON_STATIC); + } + } + next_update = current_tick + HZ/2; + wps_state.do_full_update = false; + } +} + +void sb_skin_init(void) +{ + int i; + FOR_NB_SCREENS(i) + { + skin_data_init(&sb_skin_data[i]); +#ifdef HAVE_ALBUMART + sb_skin_data[i].wps_uses_albumart = 0; +#endif +#ifdef HAVE_REMOTE_LCD + sb_skin_data[i].remote_wps = (i == SCREEN_REMOTE); +#endif + sb_skin[i].data = &sb_skin_data[i]; + sb_skin[i].display = &screens[i]; + sb_skin[i].data->debug = true; + /* Currently no seperate wps_state needed/possible + so use the only available ( "global" ) one */ + sb_skin[i].state = &wps_state; + sb_skin[i].statusbars = &skinbars; + } +} diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h new file mode 100644 index 0000000..ca27211 --- /dev/null +++ b/apps/gui/statusbar-skinned.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include "config.h" + +#ifndef __STATUSBAR_SKINNED_H__ +#define __STATUSBAR_SKINNED_H__ + + +void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile); +void sb_skin_data_init(enum screen_type screen); + +/* probably temporary, to shut the classic statusbar up */ +bool sb_skin_get_state(enum screen_type screen); +void sb_skin_set_state(int state, enum screen_type screen); +void sb_skin_init(void); +struct viewport *sb_skin_get_info_vp(enum screen_type screen); + +#ifdef HAVE_ALBUMART +bool sb_skin_uses_statusbar(int *width, int *height); +#endif + +#endif /* __STATUSBAR_SKINNED_H__ */ diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 7a361e5..436ca68 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -187,6 +187,9 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) { struct screen * display = bar->display; + if (!display) + return; + #ifdef HAVE_LCD_CHARCELLS int val; (void)force_redraw; /* The Player always has "redraw" */ diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 84d3785..b25edbf 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h @@ -55,7 +55,8 @@ struct status_info { }; /* statusbar visibility/position, used for settings also */ -enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM }; +enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM, + STATUSBAR_CUSTOM }; struct gui_statusbar { diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index bb4c291..9c9b4fd 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -33,7 +33,9 @@ #include "viewport.h" #include "statusbar.h" #include "screen_access.h" +#include "statusbar-skinned.h" #include "appevents.h" +#include "debug.h" @@ -87,8 +89,9 @@ static bool showing_bars(enum screen_type screen) if (statusbar_enabled & VP_SB_ONSCREEN(screen)) { #ifdef HAVE_LCD_BITMAP - bool ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen); - return ignore || (statusbar_position(screen)); + int ignore; + ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen); + return ignore || (statusbar_position(screen) != STATUSBAR_OFF); #else return true; #endif @@ -102,19 +105,29 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) vp->width = screens[screen].lcdwidth; #ifdef HAVE_LCD_BITMAP - vp->drawmode = DRMODE_SOLID; - vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ - - vp->height = screens[screen].lcdheight; - if (statusbar_position(screen) != STATUSBAR_BOTTOM && showing_bars(screen)) - vp->y = STATUSBAR_HEIGHT; - else - vp->y = 0; + struct viewport *sb_skin_vp = sb_skin_get_info_vp(screen); + if (sb_skin_vp && sb_skin_get_state(screen) + && statusbar_enabled & VP_SB_ONSCREEN(screen)) + { + *vp = *sb_skin_vp; + } + else + { + if (statusbar_position(screen) != STATUSBAR_BOTTOM && showing_bars(screen)) + vp->y = STATUSBAR_HEIGHT; + else + vp->y = 0; #else - vp->y = 0; + { + vp->y = 0; #endif - vp->height = screens[screen].lcdheight - (showing_bars(screen)?STATUSBAR_HEIGHT:0); + vp->height = screens[screen].lcdheight + - (showing_bars(screen)?STATUSBAR_HEIGHT:0); + } +#ifdef HAVE_LCD_BITMAP + vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ + vp->drawmode = DRMODE_SOLID; #if LCD_DEPTH > 1 #ifdef HAVE_REMOTE_LCD /* We only need this test if there is a remote LCD */ @@ -134,6 +147,7 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) vp->bg_pattern = LCD_REMOTE_DEFAULT_BG; } #endif +#endif } void viewport_set_defaults(struct viewport *vp, enum screen_type screen) @@ -164,20 +178,26 @@ int viewportmanager_get_statusbar(void) int viewportmanager_set_statusbar(int enabled) { int old = statusbar_enabled; + int i; + statusbar_enabled = enabled; - if (enabled) + + FOR_NB_SCREENS(i) { - int i; - FOR_NB_SCREENS(i) + if (showing_bars(i) + && statusbar_position(i) != STATUSBAR_CUSTOM) { - if (showing_bars(i)) - gui_statusbar_draw(&statusbars.statusbars[i], true); + add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); + gui_statusbar_draw(&statusbars.statusbars[i], true); } - add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); + else + remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw); } - else + + FOR_NB_SCREENS(i) { - remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw); + sb_skin_set_state(showing_bars(i) + && statusbar_position(i) == STATUSBAR_CUSTOM, i); } return old; } @@ -188,7 +208,8 @@ static void viewportmanager_redraw(void* data) FOR_NB_SCREENS(i) { - if (showing_bars(i)) + if (showing_bars(i) + && statusbar_position(i) != STATUSBAR_CUSTOM) gui_statusbar_draw(&statusbars.statusbars[i], NULL != data); } } @@ -204,38 +225,40 @@ static void statusbar_toggled(void* param) void viewportmanager_theme_changed(int which) { + int i; if (which & THEME_UI_VIEWPORT) { /* reset the ui viewport */ - if ((ui_vp_info.active = viewport_init_ui_vp())) - add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed); - else - remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed); + ui_vp_info.active = viewport_init_ui_vp(); /* and point to it */ ui_vp_info.vp = custom_vp; } - if (which & THEME_STATUSBAR) + if (which & (THEME_STATUSBAR)) { statusbar_enabled = 0; - if (global_settings.statusbar != STATUSBAR_OFF) - statusbar_enabled = VP_SB_ONSCREEN(SCREEN_MAIN); -#ifdef HAVE_REMOTE_LCD - if (global_settings.remote_statusbar != STATUSBAR_OFF) - statusbar_enabled |= VP_SB_ONSCREEN(SCREEN_REMOTE); -#endif - if (statusbar_enabled) - add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); - else - remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw); + FOR_NB_SCREENS(i) + { + if (statusbar_position(i) != STATUSBAR_OFF) + statusbar_enabled |= VP_SB_ONSCREEN(i); + } + + viewportmanager_set_statusbar(statusbar_enabled); - /* reposition viewport to fit statusbar, only if not using the ui vp */ if (!ui_vp_info.active) - { - int i; + {/* reposition viewport to fit statusbar,only if not using the ui vp */ FOR_NB_SCREENS(i) viewport_set_fullscreen(&custom_vp[i], i); } } + + int event_add = ui_vp_info.active; + FOR_NB_SCREENS(i) + event_add |= (statusbar_position(i) == STATUSBAR_CUSTOM); + + if (event_add) + add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed); + else + remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed); } static void viewportmanager_ui_vp_changed(void *param) @@ -248,10 +271,10 @@ static void viewportmanager_ui_vp_changed(void *param) FOR_NB_SCREENS(i) screens[i].clear_display(); /* redraw the statusbar if it was enabled */ - viewportmanager_set_statusbar(statusbar_enabled); + send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); /* call the passed function which will redraw the content of * the current screen */ - if (param != NULL) + if (draw_func != NULL) draw_func(); FOR_NB_SCREENS(i) screens[i].update(); diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index 2ed138b..768df83 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h @@ -56,14 +56,14 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen); */ -#define THEME_STATUSBAR (BIT_N(0)) -#define THEME_UI_VIEWPORT (BIT_N(1)) -#define THEME_ALL (~(0u)) - -#define VP_SB_HIDE_ALL 0 -#define VP_SB_ONSCREEN(screen) BIT_N(screen) -#define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen) -#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) +#define THEME_STATUSBAR (BIT_N(0)) +#define THEME_UI_VIEWPORT (BIT_N(1)) +#define THEME_ALL (~(0u)) + +#define VP_SB_HIDE_ALL 0 +#define VP_SB_ONSCREEN(screen) BIT_N(screen) +#define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen) +#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) /* * Initialize the viewportmanager, which in turns initializes the UI vp and diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 1d97501..2f2d994 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -81,7 +81,7 @@ /* this is for the viewportmanager */ static int wpsbars; /* currently only one wps_state is needed */ -static struct wps_state wps_state; +struct wps_state wps_state; static struct gui_wps gui_wps[NB_SCREENS]; static struct wps_data wps_datas[NB_SCREENS]; @@ -128,8 +128,9 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile) #endif /* __PCTOOL__ */ - loaded_ok = buf && skin_data_load(gui_wps[screen].data, - &screens[screen], buf, isfile); + loaded_ok = buf && skin_data_load(gui_wps[screen].data, buf, isfile); + + DEBUGF("%s >> wps loading\n", __func__); if (!loaded_ok) /* load the hardcoded default */ { char *skin_buf[NB_SCREENS] = { @@ -152,11 +153,11 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile) "%pb\n", #endif }; - skin_data_load(gui_wps[screen].data, &screens[screen], - skin_buf[screen], false); + skin_data_load(gui_wps[screen].data, skin_buf[screen], false); } #ifdef HAVE_REMOVE_LCD gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); + #endif } @@ -721,7 +722,6 @@ long gui_wps_show(void) #endif } } - #ifdef HAVE_LCD_BITMAP /* when the peak meter is enabled we want to have a few extra updates to make it look smooth. On the @@ -1282,6 +1282,7 @@ void gui_sync_wps_init(void) #ifdef HAVE_REMOTE_LCD wps_datas[i].remote_wps = (i == SCREEN_REMOTE); #endif + wps_datas[i].debug = false; gui_wps[i].data = &wps_datas[i]; gui_wps[i].display = &screens[i]; /* Currently no seperate wps_state needed/possible diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 73a3fe9..850240a 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -12718,3 +12718,17 @@ swcodec: "Limiter Preamp" + + id: LANG_STATUSBAR_CUSTOM + desc: in Settings -> General -> Display -> statusbar + user: core + + *: "Custom" + + + *: "Custom" + + + *: "Custom" + + diff --git a/apps/main.c b/apps/main.c index 6aa16e5..ff775c2 100644 --- a/apps/main.c +++ b/apps/main.c @@ -73,6 +73,7 @@ #include "scrobbler.h" #include "icon.h" #include "viewport.h" +#include "statusbar-skinned.h" #ifdef IPOD_ACCESSORY_PROTOCOL #include "iap.h" @@ -311,6 +312,7 @@ static void init(void) settings_reset(); settings_load(SETTINGS_ALL); gui_sync_wps_init(); + sb_skin_init(); settings_apply(true); init_dircache(true); init_dircache(false); @@ -536,6 +538,7 @@ static void init(void) } gui_sync_wps_init(); + sb_skin_init(); settings_apply(true); init_dircache(false); #ifdef HAVE_TAGCACHE diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index f2e4579..8c8276a 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -157,13 +157,18 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item { case ACTION_ENTER_MENUITEM: old_bar[screen] = statusbar_position(screen); + break; case ACTION_EXIT_MENUITEM: - gui_statusbar_changed(screen, old_bar[screen]); send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); + if ((old_bar[screen] == STATUSBAR_CUSTOM) + || (statusbar_position(screen) == STATUSBAR_CUSTOM)) + send_event(GUI_EVENT_REFRESH, NULL); + else + gui_statusbar_changed(screen, old_bar[screen]); break; } - return action; + return ACTION_REDRAW; } #ifdef HAVE_REMOTE_LCD diff --git a/apps/plugin.c b/apps/plugin.c index a497ad0..1a70113 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -800,8 +800,6 @@ int plugin_load(const char* plugin, const void* parameter) #ifdef HAVE_TOUCHSCREEN touchscreen_set_mode(global_settings.touch_mode); #endif - - viewportmanager_set_statusbar(oldbars); button_clear_queue(); @@ -830,13 +828,14 @@ int plugin_load(const char* plugin, const void* parameter) #endif #endif + viewportmanager_set_statusbar(oldbars); + viewport_set_current_vp(NULL); + if (rc != PLUGIN_GOTO_WPS) { send_event(GUI_EVENT_REFRESH, NULL); } - viewportmanager_set_statusbar(oldbars); - viewport_set_current_vp(NULL); if (pfn_tsr_exit == NULL) plugin_loaded = false; diff --git a/apps/settings.c b/apps/settings.c index 4c16c6a..4f2f596 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -71,6 +71,7 @@ #include "wps.h" #include "skin_engine/skin_engine.h" #include "viewport.h" +#include "statusbar-skinned.h" #if CONFIG_CODEC == MAS3507D void dac_line_in(bool enable); @@ -740,6 +741,17 @@ void settings_apply_skins(void) char buf[MAX_PATH]; /* re-initialize the skin buffer before we start reloading skins */ skin_buffer_init(); + if ( global_settings.sb_file[0] && + global_settings.sb_file[0] != 0xff ) { + snprintf(buf, sizeof buf, WPS_DIR "/%s.sb", + global_settings.sb_file); + sb_skin_data_load(SCREEN_MAIN, buf, true); + } + else + { + sb_skin_data_init(SCREEN_MAIN); + sb_skin_data_load(SCREEN_MAIN, NULL, true); + } if ( global_settings.wps_file[0] && global_settings.wps_file[0] != 0xff ) { snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", @@ -752,6 +764,17 @@ void settings_apply_skins(void) wps_data_load(SCREEN_MAIN, NULL, true); } #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) + if ( global_settings.rsb_file[0] && + global_settings.rsb_file[0] != 0xff ) { + snprintf(buf, sizeof buf, WPS_DIR "/%s.rsb", + global_settings.rsb_file); + sb_skin_data_load(SCREEN_REMOTE, buf, true); + } + else + { + sb_skin_data_init(SCREEN_REMOTE); + sb_skin_data_load(SCREEN_REMOTE, NULL, true); + } if ( global_settings.rwps_file[0]) { snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", global_settings.rwps_file); @@ -763,6 +786,7 @@ void settings_apply_skins(void) wps_data_load(SCREEN_REMOTE, NULL, true); } #endif + viewportmanager_theme_changed(THEME_STATUSBAR); } void settings_apply(bool read_disk) @@ -994,7 +1018,8 @@ void settings_apply(bool read_disk) enc_global_settings_apply(); #endif #ifdef HAVE_LCD_BITMAP - viewportmanager_theme_changed(THEME_ALL); + /* already called with THEME_STATUSBAR in settings_apply_skins() */ + viewportmanager_theme_changed(THEME_UI_VIEWPORT); #endif } diff --git a/apps/settings.h b/apps/settings.h index bd28b99..b176086 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -60,6 +60,7 @@ struct opt_items { #define FONT_DIR ROCKBOX_DIR "/fonts" #define LANG_DIR ROCKBOX_DIR "/langs" #define WPS_DIR ROCKBOX_DIR "/wps" +#define SB_DIR ROCKBOX_DIR "/statusbar" #define THEME_DIR ROCKBOX_DIR "/themes" #define ICON_DIR ROCKBOX_DIR "/icons" @@ -544,6 +545,7 @@ struct user_settings int peak_meter_max; /* range maximum */ unsigned char wps_file[MAX_FILENAME+1]; /* last wps */ + unsigned char sb_file[MAX_FILENAME+1]; /* last wps */ unsigned char lang_file[MAX_FILENAME+1]; /* last language */ unsigned char playlist_catalog_dir[MAX_FILENAME+1]; int skip_length; /* skip length */ @@ -719,6 +721,7 @@ struct user_settings unsigned char remote_icon_file[MAX_FILENAME+1]; unsigned char remote_viewers_icon_file[MAX_FILENAME+1]; unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */ + unsigned char rsb_file[MAX_FILENAME+1]; /* last remote-wps */ #ifdef HAS_REMOTE_BUTTON_HOLD int remote_backlight_on_button_hold; /* what to do with remote backlight when hold switch is on */ diff --git a/apps/settings_list.c b/apps/settings_list.c index 23f07cb..32b140c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -603,14 +603,14 @@ const struct settings_list settings[] = { ID2P(LANG_INVERT_CURSOR_BAR)), #endif CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, - LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom", - NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), - ID2P(LANG_STATUSBAR_BOTTOM)), + LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom,custom", + NULL, 4, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), + ID2P(LANG_STATUSBAR_BOTTOM), ID2P(LANG_STATUSBAR_CUSTOM)), #ifdef HAVE_REMOTE_LCD CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar, - LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom", - NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), - ID2P(LANG_STATUSBAR_BOTTOM)), + LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom,custom", + NULL, 4, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), + ID2P(LANG_STATUSBAR_BOTTOM), ID2P(LANG_STATUSBAR_CUSTOM)), #endif CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, scrollbar, LANG_SCROLL_BAR, SCROLLBAR_LEFT, "scrollbar","off,left,right", @@ -1393,8 +1393,12 @@ const struct settings_list settings[] = { #endif TEXT_SETTING(F_THEMESETTING,wps_file, "wps", DEFAULT_WPSNAME, WPS_DIR "/", ".wps"), + TEXT_SETTING(F_THEMESETTING,sb_file, "sb", + DEFAULT_WPSNAME, WPS_DIR "/", ".sb"), TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"), #ifdef HAVE_REMOTE_LCD + TEXT_SETTING(F_THEMESETTING,rsb_file, "rsb", + DEFAULT_WPSNAME, WPS_DIR "/", ".rsb"), TEXT_SETTING(F_THEMESETTING,rwps_file,"rwps", DEFAULT_WPSNAME, WPS_DIR "/", ".rwps"), #endif diff --git a/wps/WPSLIST b/wps/WPSLIST index 58fa5f1..cb50bab 100644 --- a/wps/WPSLIST +++ b/wps/WPSLIST @@ -44,6 +44,8 @@ selector type: bar (inverse) Name: rockbox_default.wps RWPS: rockbox_default.rwps +SB: +RSB: Author: Rockbox team Font: 08-Schumacher-Clean.fnt Font.11x2x1: @@ -59,6 +61,8 @@ selector type: bar (inverse) Name: boxes.wps rwps: boxes.rwps +SB: +RSB: Author: Christi Scarborough (after Magnus Westerlund) Font: 08-Schumacher-Clean.fnt Statusbar: top @@ -76,6 +80,8 @@ remote ui viewport: - Name: engineeer2.wps RWPS: engineeer2.rwps +SB: +RSB: Author: Magnus Westerlund Font: 08-Nedore.fnt Statusbar: top @@ -90,6 +96,8 @@ remote ui viewport: - Name: iAmp.wps RWPS: iAmp.rwps +SB: +RSB: Author: Raymond Hoh Font: 12-Nimbus.fnt backdrop: @@ -104,6 +112,8 @@ remote ui viewport: - Name: zezayer.wps RWPS: zezayer.rwps +SB: +RSB: Author: Jake Owen Font: 08-Nedore.fnt Statusbar: top @@ -153,6 +163,8 @@ Statusbar: top Name: marquee.wps RWPS: marquee.rwps +SB: +RSB: Author: Mike Sobel Font: 13-Nimbus.fnt Statusbar: top @@ -176,6 +188,8 @@ remote ui viewport: - Name: DancePuffDuo.wps RWPS: DancePuffDuo.rwps +SB: +RSB: Author: Chris Oxtoby Font: 13-Nimbus.fnt Statusbar: top @@ -199,6 +213,8 @@ Statusbar: top Name: iCatcher.wps RWPS: iCatcher.rwps +SB: +RSB: Author: Ioannis Koutoulakis Font.112x64x1: 08-Rockfont.fnt Font.128x64x1: 08-Rockfont.fnt @@ -235,6 +251,8 @@ Statusbar: top Name: UniCatcher.wps RWPS: UniCatcher.rwps +SB: +RSB: Author: Ioannis Koutoulakis Font: 16-GNU-Unifont.fnt Foreground Color: 000000 @@ -258,6 +276,8 @@ Statusbar: top Name: Rockboxed.wps RWPS: rockbox_default.rwps +SB: +RSB: Author: Roan Horning Font.112x64x1: 08-Schumacher-Clean.fnt Font.128x64x1: 08-Schumacher-Clean.fnt @@ -291,6 +311,9 @@ Author: Jens Arnold Name: cabbiev2.wps RWPS: cabbiev2.rwps +SB: +SB.176x220x16: cabbiev2.sb +RSB: # Real name of the creator of the WPS Author: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta. @@ -372,9 +395,12 @@ viewers iconset.240x400x16: /.rockbox/icons/tango_small_viewers.bmp # Whether the WPS is designed to have the statusbar on or off Statusbar: top +statusbar.176x220x16: custom +remote statusbar: top # list & remote ui viewports ui viewport: - +ui viewport.176x220x16: 0,0,-,180,-,-,- remote ui viewport: - diff --git a/wps/cabbiev2.176x220x16.sb b/wps/cabbiev2.176x220x16.sb new file mode 100644 index 0000000..505b57f --- /dev/null +++ b/wps/cabbiev2.176x220x16.sb @@ -0,0 +1,20 @@ +# cabbie 2.0 default for the Sansa e200 Series by Marc Guay +# derived from cabbie 2.0 default (C) 2007, Johannes Voggenthaler (Zinc Alloy) +%wd +%xl|A|lock-176x220x16.bmp|51|24|2| +%xl|B|battery-176x220x16.bmp|73|26|10| +%xl|C|volume-176x220x16.bmp|97|26|10| +%xl|D|shuffle-176x220x16.bmp|119|27| +%xl|E|repeat-176x220x16.bmp|144|24|4| +%xl|F|playmode-176x220x16.bmp|159|24|5| +#NowPlaying +%V|0|180|-|-|-|-|-| +%pb|pb-176x220x16.bmp|5|2|166|8| +%al %pc%ac%pp of %pe%ar%pr +%?mh<%xdAa|%xdAb> +%?bp<%?bc<%xdBa|%xdBb>|%?bl<|%xdBc|%xdBd|%xdBe|%xdBf|%xdBg|%xdBh|%xdBi|%xdBj>> +%?pv<%xdCa|%xdCb|%xdCc|%xdCd|%xdCe|%xdCf|%xdCg|%xdCh|%xdCi|%xdCj> +%?ps<%xdD> +%?mm<|%xdEa|%xdEb|%xdEc|%xdEd> +%?mp<%xdFa|%xdFb|%xdFc|%xdFd|%xdFe> +#%?C<%C> diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl index e9e5c29..f6bc1a6 100755 --- a/wps/wpsbuild.pl +++ b/wps/wpsbuild.pl @@ -32,9 +32,18 @@ my $cppdef = $target; my @depthlist = ( 16, 8, 4, 2, 1 ); # These parameters are filled in as we parse wpslist +my $req_size; +my $req_g_wps; +my $req_t; +my $req_t_wps; my $wps; my $wps_prefix; +my $sb_prefix; my $rwps; +my $sb; +my $sb_w_size; +my $rsb; +my $rsb_w_size; my $width; my $height; my $font; @@ -42,9 +51,6 @@ my $fgcolor; my $bgcolor; my $statusbar; my $author; -my $req_g; -my $req_g_wps; -my $req_t_wps; my $backdrop; my $lineselectstart; my $lineselectend; @@ -191,12 +197,26 @@ sub copywps my $dir; my @filelist; my $file; + my $__sb; if($wpslist =~ /(.*)WPSLIST/) { $dir = $1; -# system("cp $dir/$wps .rockbox/wps/"); - #print "$req_t_wps $req_g_wps\n"; + $__sb = $sb_prefix . "." . $req_size . ".sb"; + #print "$req_t_wps $req_g_wps $sb_prefix\n"; + #print "$dir/$__sb\n"; +# system("cp $dir/$wps .rockbox/wps/"); + # check for .WIDTHxHEIGHTxDEPTH.sb + if (-e "$dir/$__sb") { + system("cp $dir/$__sb $rbdir/wps/$sb"); + } + # check for .WIDTHxHEIGHTxDEPTH..sb and overwrite the + # previous sb if needed + $__sb = $sb_prefix . "." . $req_size . "." . $modelname . ".sb"; + if (-e "$dir/$__sb") { + system("cp $dir/$__sb $rbdir/wps/$sb"); + } + if (-e "$dir/$req_t_wps" ) { system("cp $dir/$req_t_wps $rbdir/wps/$wps"); @@ -210,9 +230,9 @@ sub copywps close(WPSFILE); if ($#filelist >= 0) { - if (-e "$dir/$wps_prefix/$req_g") { + if (-e "$dir/$wps_prefix/$req_size") { foreach $file (@filelist) { - system("cp $dir/$wps_prefix/$req_g/$file $rbdir/wps/$wps_prefix/"); + system("cp $dir/$wps_prefix/$req_size/$file $rbdir/wps/$wps_prefix/"); } } elsif (-e "$dir/$wps_prefix") { @@ -235,7 +255,7 @@ sub copywps sub buildcfg { my $cfg = $wps; - my @out; + my @out; $cfg =~ s/\.(r|)wps/.cfg/; @@ -247,6 +267,20 @@ sub buildcfg { wps: /$rbdir/wps/$wps MOO ; + if(defined($sb)) { + if ($sb eq '') { + push @out, "sb: -\n"; + } else { + push @out, "sb: /$rbdir/wps/$sb\n"; + } + } + if(defined($sb) && $has_remote) { + if ($rsb eq '') { + push @out, "rsb: -\n"; + } else { + push @out, "rsb: /$rbdir/wps/$rsb\n"; + } + } if($font) { push @out, "font: /$rbdir/fonts/$font\n"; } @@ -264,7 +298,7 @@ MOO } if(defined($backdrop)) { if ($backdrop eq '') { - push @out, "backdrop:\n"; + push @out, "backdrop: -\n"; } else { # clip resolution from filename $backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; @@ -338,6 +372,8 @@ while() { undef $wps; undef $wps_prefix; undef $rwps; + undef $sb; + undef $rsb; undef $width; undef $height; undef $font; @@ -386,23 +422,24 @@ while() { foreach my $d (@depthlist) { next if ($d > $rdepth); - $req_g = $rwidth . "x" . $rheight . "x" . $d; + $req_size = $rwidth . "x" . $rheight . "x" . $d; # check for model specific wps - $req_g_wps = $wps_prefix . "." . $req_g . "." . $modelname . ".wps"; + $req_g_wps = $wps_prefix . "." . $req_size . "." . $modelname . ".wps"; last if (-e "$wpsdir/$req_g_wps"); - $req_g_wps = $wps_prefix . "." . $req_g . ".wps"; + # check for normal wps (with WIDTHxHEIGHTxDEPTH) + $req_g_wps = $wps_prefix . "." . $req_size . ".wps"; last if (-e "$wpsdir/$req_g_wps"); if ($isrwps) { - $req_g = $req_g . "." . $main_width . "x" . $main_height . "x" . "$main_depth"; + $req_size = $req_size . "." . $main_width . "x" . $main_height . "x" . "$main_depth"; - $req_g_wps = $wps_prefix . "." . $req_g . ".wps"; + $req_g_wps = $wps_prefix . "." . $req_size . ".wps"; last if (-e "$wpsdir/$req_g_wps"); } } - $req_t_wps = $wps_prefix . ".txt" . ".wps"; + $req_t_wps = $wps_prefix . $req_t . ".wps"; #print "LCD: $wps wants $width x $height\n"; #print "LCD: is $rwidth x $rheight\n"; @@ -454,6 +491,19 @@ while() { elsif($l =~ /^RWPS\.${main_width}x${main_height}x$main_depth: *(.*)/i) { $rwps = $1; } + elsif($l =~ /^SB: *(.*)/i) { + $sb = $sb_prefix = $1; + $sb_prefix =~ s/\.(r|)sb//; + } + elsif($l =~ /^SB\.${main_width}x${main_height}x$main_depth: *(.*)/i) { + $sb = $1; + } + elsif($l =~ /^RSB: *(.*)/i) { + $rsb = $1; + } + elsif($l =~ /^RSB\.${main_width}x${main_height}x$main_depth: *(.*)/i) { + $rsb = $1; + } elsif($l =~ /^Author: *(.*)/i) { $author = $1; } @@ -526,9 +576,15 @@ while() { elsif($l =~ /^ui viewport: *(.*)/i) { $listviewport = $1; } + elsif($l =~ /^ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) { + $listviewport = $1; + } elsif($l =~ /^remote ui viewport: *(.*)/i) { $remotelistviewport = $1; } + elsif($l =~ /^remote ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) { + $remotelistviewport = $1; + } else{ #print "Unknown line: $l!\n"; }