Index: apps/recorder/keyboard.c =================================================================== --- apps/recorder/keyboard.c (Revision 21826) +++ apps/recorder/keyboard.c (Arbeitskopie) @@ -304,6 +304,7 @@ char buf[2]; #endif int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); + viewportmanager_set_ui_vp(false); FOR_NB_SCREENS(l) { struct keyboard_parameters *pm = ¶m[l]; @@ -1248,6 +1249,7 @@ FOR_NB_SCREENS(l) screens[l].setfont(FONT_UI); viewportmanager_set_statusbar(oldbars); + viewportmanager_set_ui_vp(true); return 0; } Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (Revision 21826) +++ apps/recorder/recording.c (Arbeitskopie) @@ -76,6 +76,8 @@ #include "viewport.h" #include "list.h" #include "general.h" +#include "events.h" +#include "appevents.h" #ifdef HAVE_RECORDING /* This array holds the record timer interval lengths, in seconds */ @@ -1924,9 +1926,11 @@ rec_status &= ~RCSTAT_IN_RECSCREEN; sound_settings_apply(); - viewportmanager_set_statusbar(oldbars); FOR_NB_SCREENS(i) screens[i].setfont(FONT_UI); + + viewportmanager_set_statusbar(oldbars); + send_event(GUI_EVENT_REFRESH, NULL); /* if the directory was created or recording happened, make sure the browser is updated */ Index: apps/settings.c =================================================================== --- apps/settings.c (Revision 21826) +++ apps/settings.c (Arbeitskopie) @@ -66,6 +66,7 @@ #include "filetypes.h" #include "option_select.h" #include "backdrop.h" +#include "viewport.h" #include "appevents.h" #if CONFIG_TUNER #include "radio.h" @@ -731,6 +732,7 @@ void settings_apply(bool read_disk) { + char buf[64]; #if CONFIG_CODEC == SWCODEC int i; @@ -982,7 +984,9 @@ enc_global_settings_apply(); #endif send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); - list_init_viewports(NULL); +#ifdef HAVE_LCD_BITMAP + viewport_init_ui_vp(); +#endif send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); } @@ -1105,7 +1109,8 @@ item.lang_id = -1; item.cfg_vals = (char*)string; item.setting = (void *)variable; - return option_screen(&item, NULL, false, NULL); + return option_screen(&item, + viewport_get_current_vp(), false, NULL); } Index: apps/gui/statusbar.c =================================================================== --- apps/gui/statusbar.c (Revision 21826) +++ apps/gui/statusbar.c (Arbeitskopie) @@ -263,7 +263,7 @@ memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) { struct viewport vp; - viewport_set_defaults(&vp, display->screen_type); + viewport_set_fullscreen(&vp, display->screen_type); vp.height = STATUSBAR_HEIGHT; vp.x = STATUSBAR_X_POS; if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM) Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (Revision 21826) +++ apps/gui/list.c (Arbeitskopie) @@ -55,29 +55,28 @@ /* should lines scroll out of the screen */ static bool offset_out_of_view = false; #endif -static int force_list_reinit = false; static void gui_list_select_at_offset(struct gui_synclist * gui_list, int offset); void list_draw(struct screen *display, struct gui_synclist *list); #ifdef HAVE_LCD_BITMAP -static struct viewport parent[NB_SCREENS]; -void list_init_viewports(struct gui_synclist *list) +static void list_init_viewports(struct gui_synclist *list) { - int i; - struct viewport *vp; - FOR_NB_SCREENS(i) + struct viewport* vp; + bool parent_used = (*list->parent != NULL); + if (!parent_used) { - vp = &parent[i]; - if (!list || list->parent[i] == vp) - viewport_set_defaults(vp, i); + viewportmanager_set_ui_vp(true); + vp = viewport_get_current_vp(); + printf("vp: %p\n", vp); + printf("vp.height: %p\n", vp[0].height); + *list->parent = vp; } #ifdef HAVE_BUTTONBAR - if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar) + if (list && !parent_used[SCREEN_MAIN] && global_settings.buttonbar) list->parent[0]->height -= BUTTONBAR_HEIGHT; #endif - force_list_reinit = false; } #else static struct viewport parent[NB_SCREENS] = @@ -90,11 +89,7 @@ .height = LCD_HEIGHT }, }; -void list_init_viewports(struct gui_synclist *list) -{ - (void)list; - force_list_reinit = false; -} +#define list_init_viewports(a) #endif #ifdef HAVE_LCD_BITMAP @@ -142,7 +137,7 @@ gui_list->parent[i] = &list_parent[i]; else { - gui_list->parent[i] = &parent[i]; + gui_list->parent[i] = NULL; } } list_init_viewports(gui_list); @@ -162,7 +157,6 @@ gui_list->title_color = -1; gui_list->callback_get_item_color = NULL; #endif - force_list_reinit = true; } /* this toggles the selection bar or cursor */ @@ -218,7 +212,7 @@ #ifdef HAVE_BUTTONBAR static bool last_buttonbar = false; #endif - if (force_list_reinit || + if ( #ifdef HAVE_BUTTONBAR last_buttonbar != screens[SCREEN_MAIN].has_buttonbar || #endif @@ -436,7 +430,6 @@ } else { gui_list->title_width = 0; } - force_list_reinit = true; } Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (Revision 21826) +++ apps/gui/viewport.c (Arbeitskopie) @@ -37,6 +37,20 @@ static int statusbar_enabled = 0; +#ifdef HAVE_LCD_BITMAP +static struct { + struct viewport* vp; + int enabled; +} ui_vp_info; + +static struct viewport custom_vp[NB_SCREENS]; + +/* callbacks for GUI_EVENT_* events */ +static void viewportmanager_ui_vp_changed(void (*param)(void)); +#endif +static void viewportmanager_redraw(void* data); +static void viewportmanager_statusbar_changed(void* data); + int viewport_get_nb_lines(struct viewport *vp) { #ifdef HAVE_LCD_BITMAP @@ -59,9 +73,9 @@ #endif } return false; -} +} -void viewport_set_defaults(struct viewport *vp, enum screen_type screen) +void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) { vp->x = 0; vp->width = screens[screen].lcdwidth; @@ -106,7 +120,31 @@ #endif } +void viewport_set_defaults(struct viewport *vp, enum screen_type screen) +{ +#ifdef HAVE_LCD_BITMAP + if (ui_vp_info.enabled) + *vp = custom_vp[screen]; + else +#endif + viewport_set_fullscreen(vp, screen); +} +void viewportmanager_init(void) +{ + viewportmanager_set_statusbar(VP_SB_ALLSCREENS); + ui_vp_info.enabled = viewport_init_ui_vp(); + add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, + viewportmanager_statusbar_changed); + ui_vp_info.vp = custom_vp; + printf("ui_vp_info.vp: %p\n", ui_vp_info.vp); +} + +int viewportmanager_get_statusbar(void) +{ + return statusbar_enabled; +} + int viewportmanager_set_statusbar(int enabled) { int old = statusbar_enabled; @@ -119,27 +157,27 @@ if (showing_bars(i)) gui_statusbar_draw(&statusbars.statusbars[i], true); } - add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars); + add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw); } else { - remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_draw_statusbars); + remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw); } return old; } -void viewportmanager_draw_statusbars(void* data) +static void viewportmanager_redraw(void* data) { int i; FOR_NB_SCREENS(i) { if (showing_bars(i)) - gui_statusbar_draw(&statusbars.statusbars[i], (bool)data); + gui_statusbar_draw(&statusbars.statusbars[i], NULL != data); } } -void viewportmanager_statusbar_changed(void* data) +static void viewportmanager_statusbar_changed(void* data) { (void)data; statusbar_enabled = 0; @@ -151,3 +189,170 @@ #endif viewportmanager_set_statusbar(statusbar_enabled); } + +#ifdef HAVE_LCD_BITMAP +void viewportmanager_set_ui_vp(const bool enable) +{ + if (enable && !ui_vp_info.enabled) + { /* maybe we changed from "full screen" to a smaller custom vp, + * so we need to remove dead parts of the screen by refreshing the whole + * screen */ + viewportmanager_ui_vp_changed(NULL); + } + if ((ui_vp_info.enabled = enable)) + 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)(void)) +{ + /* if the user changed the theme, we need to initiate a full redraw */ + int i; + /* start with clearing the screen */ + FOR_NB_SCREENS(i) + screens[i].clear_display(); + /* redraw the statusbar if it was enabled */ + viewportmanager_set_statusbar(statusbar_enabled); + /* call the passed function which will redraw the content of + * the current screen */ + if (param != NULL) + param(); + FOR_NB_SCREENS(i) + screens[i].update(); +} + +void viewport_set_current_vp(struct viewport* vp) +{ + if (vp != NULL) + ui_vp_info.vp = vp; + else + ui_vp_info.vp = custom_vp; + printf("ui_vp_info.vp: %p\n", ui_vp_info.vp); +} + +struct viewport* viewport_get_current_vp(void) +{ + return ui_vp_info.vp; +} + +const char* viewport_parse_viewport(struct viewport *vp, + const char *bufptr, const char seperator, enum screen_type screen) +{ + /* parse the list to the viewport struct */ + const char *ptr = bufptr; + int depth; + uint32_t set = 0; + + enum { + PL_X = 0, + PL_Y, + PL_WIDTH, + PL_HEIGHT, + PL_FONT, + PL_FG, + PL_BG, + }; + + /* Work out the depth of this display */ + depth = screens[screen].depth; +#ifdef HAVE_LCD_COLOR + if (depth == 16) + { + if (!(ptr = parse_list("dddddcc", &set, seperator, ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) + return VP_ERROR; + } + else +#endif +#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) + if (depth == 2) { + if (!(ptr = parse_list("dddddgg", &set, seperator, ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern))) + return VP_ERROR; + } + else +#endif +#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) + if (depth == 1) + { + if (!(ptr = parse_list("ddddd", &set, seperator, ptr, &vp->x, &vp->y, &vp->width, + &vp->height, &vp->font))) + return VP_ERROR; + } + else +#endif + {} + + if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) + return VP_ERROR; + + /* fix defaults */ + if (!LIST_VALUE_PARSED(set, PL_WIDTH)) + vp->width = screens[screen].lcdwidth - vp->x; + if (!LIST_VALUE_PARSED(set, PL_HEIGHT)) + vp->height = screens[screen].lcdheight - vp->y; + +#if (LCD_DEPTH > 1) + if (!LIST_VALUE_PARSED(set, PL_FG)) + vp->fg_pattern = global_settings.fg_color; + if (!LIST_VALUE_PARSED(set, PL_BG)) + vp->bg_pattern = global_settings.bg_color; +#endif +#ifdef HAVE_LCD_COLOR + vp->lss_pattern = global_settings.lss_color; + vp->lse_pattern = global_settings.lse_color; + vp->lst_pattern = global_settings.lst_color; +#endif + /* Validate the viewport dimensions - we know that the numbers are + non-negative integers */ + if ((vp->x >= screens[screen].lcdwidth) || + ((vp->x + vp->width) > screens[screen].lcdwidth) || + (vp->y >= screens[screen].lcdheight) || + ((vp->y + vp->height) > screens[screen].lcdheight)) + { + return VP_ERROR; + } + + /* Default to using the user font if the font was an invalid number */ + if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) + vp->font = FONT_UI; + + vp->drawmode = DRMODE_SOLID; + + return ptr; +} + +int viewport_init_ui_vp(void) +{ + int screen, ret = NB_SCREENS; + FOR_NB_SCREENS(screen) + { +#ifdef HAVE_REMOTE_LCD + if ((screen == SCREEN_REMOTE)) + { + if(!(viewport_parse_viewport(&custom_vp[screen], + global_settings.remote_ui_vp_config, ',', screen))) + { + viewport_set_fullscreen(&custom_vp[screen], screen); + ret--; + } + } + else +#endif + { + if (!(viewport_parse_viewport(&custom_vp[screen], + global_settings.ui_vp_config, ',', screen))) + { + viewport_set_fullscreen(&custom_vp[screen], screen); + ret--; + } + } + } + if (ret) + add_event(GUI_EVENT_THEME_CHANGED, true, + viewportmanager_ui_vp_changed); + return ret; +} + +#endif /* HAVE_LCD_BITMAP */ Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (Revision 21826) +++ apps/gui/gwps.c (Arbeitskopie) @@ -289,6 +289,7 @@ /* Play safe and unregister the hook */ lcd_activation_set_hook(NULL); #endif + viewportmanager_set_ui_vp(true); } void gwps_draw_statusbars(void) @@ -825,6 +826,7 @@ restore = false; restoretimer = RESTORE_WPS_INSTANTLY; gwps_fix_statusbars(); + viewportmanager_set_ui_vp(false); #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) lcd_activation_set_hook(wps_lcd_activation_hook); #endif Index: apps/gui/list.h =================================================================== --- apps/gui/list.h (Revision 21826) +++ apps/gui/list.h (Arbeitskopie) @@ -139,8 +139,6 @@ extern void gui_list_screen_scroll_out_of_view(bool enable); #endif /* HAVE_LCD_BITMAP */ -void list_init_viewports(struct gui_synclist * lists); - extern void gui_synclist_init( struct gui_synclist * lists, list_get_name callback_get_item_name, Index: apps/gui/viewport.h =================================================================== --- apps/gui/viewport.h (Revision 21826) +++ apps/gui/viewport.h (Arbeitskopie) @@ -62,8 +62,60 @@ #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)) + +int viewportmanager_get_statusbar(void); int viewportmanager_set_statusbar(int enabled); -/* callbacks for GUI_EVENT_* events */ -void viewportmanager_draw_statusbars(void*data); -void viewportmanager_statusbar_changed(void* data); +/* + * Initializes the given viewport with maximum dimensions minus status- and + * buttonbar + */ +void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen); + +#ifdef HAVE_LCD_BITMAP + +/* + * Generic viewport parsing function to parse viewports structures like + * the %V tag; basically just a wrapper for parse_list, so improvements + * should aim parse_list + * + * Returns the pointer after the viewport string + */ +const char* viewport_parse_viewport(struct viewport *vp, + const char *bufptr, const char seperator, enum screen_type screen); + +/* + * enable or disable the usage of the UI vp + * Does not automatically make the UI vp disappear, use viewport_set_defaults() + * after to get a fullscreen viewport + */ +void viewportmanager_set_ui_vp(const bool enable); + +/* + * (re)parse the UI vp from the settings + * - Returns + * 0 if no UI vp is used + * >0 if it's used at least partly (on multiscreen targets) + * NB_SCREENS if all screens have a UI vp + */ +int viewport_init_ui_vp(void); + +/* + * Returns a pointer to the current viewport + * - That could be the UI vp, or a viewport passed to do_menu() or the like + */ +struct viewport* viewport_get_current_vp(void); + +/* + * Set the UI vp pointer to a different one - NULL to reset to the UI vp + */ +void viewport_set_current_vp(struct viewport* vp); + +/* + * Initialize the viewportmanager, which in turns initializes the UI vp and + * statusbar stuff + */ +void viewportmanager_init(void); +#else +#define viewportmanager_set_ui_vp(a) +#endif Index: apps/gui/wps_parser.c =================================================================== --- apps/gui/wps_parser.c (Revision 21826) +++ apps/gui/wps_parser.c (Arbeitskopie) @@ -25,6 +25,7 @@ #include "file.h" #include "misc.h" #include "plugin.h" +#include "viewport.h" #ifdef __PCTOOL__ #ifdef WPSEDITOR @@ -586,26 +587,12 @@ { (void)token; /* Kill warnings */ const char *ptr = wps_bufptr; - struct viewport* vp; - int depth; - uint32_t set = 0; - enum { - PL_X = 0, - PL_Y, - PL_WIDTH, - PL_HEIGHT, - PL_FONT, - PL_FG, - PL_BG, - }; - int lcd_width = LCD_WIDTH, lcd_height = LCD_HEIGHT; + + const int screen = #ifdef HAVE_REMOTE_LCD - if (wps_data->remote_wps) - { - lcd_width = LCD_REMOTE_WIDTH; - lcd_height = LCD_REMOTE_HEIGHT; - } + wps_data->remote_wps ? SCREEN_REMOTE : #endif + SCREEN_MAIN; if (wps_data->num_viewports >= WPS_MAX_VIEWPORTS) return WPS_ERROR_INVALID_PARAM; @@ -634,88 +621,20 @@ return WPS_ERROR_INVALID_PARAM; ptr++; - vp = &wps_data->viewports[wps_data->num_viewports].vp; + struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp; /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ /* Set the defaults for fields not user-specified */ vp->drawmode = DRMODE_SOLID; - /* Work out the depth of this display */ -#ifdef HAVE_REMOTE_LCD - depth = (wps_data->remote_wps ? LCD_REMOTE_DEPTH : LCD_DEPTH); -#else - depth = LCD_DEPTH; -#endif + if (!(ptr = viewport_parse_viewport(vp, ptr, '|', screen))) + return WPS_ERROR_INVALID_PARAM; -#ifdef HAVE_LCD_COLOR - if (depth == 16) - { - if (!(ptr = parse_list("dddddcc", &set, '|', ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) - return WPS_ERROR_INVALID_PARAM; - } - else -#endif -#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) - if (depth == 2) { - /* Default to black on white */ - vp->fg_pattern = 0; - vp->bg_pattern = 3; - if (!(ptr = parse_list("dddddgg", &set, '|', ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern))) - return WPS_ERROR_INVALID_PARAM; - } - else -#endif -#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) - if (depth == 1) - { - if (!(ptr = parse_list("ddddd", &set, '|', ptr, &vp->x, &vp->y, - &vp->width, &vp->height, &vp->font))) - return WPS_ERROR_INVALID_PARAM; - } - else -#endif - {} - /* Check for trailing | */ if (*ptr != '|') return WPS_ERROR_INVALID_PARAM; - if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) - return WPS_ERROR_INVALID_PARAM; - - /* fix defaults */ - if (!LIST_VALUE_PARSED(set, PL_WIDTH)) - vp->width = lcd_width - vp->x; - if (!LIST_VALUE_PARSED(set, PL_HEIGHT)) - vp->height = lcd_height - vp->y; - - /* Default to using the user font if the font was an invalid number */ - if (!LIST_VALUE_PARSED(set, PL_FONT) || - ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI))) - vp->font = FONT_UI; - /* Validate the viewport dimensions - we know that the numbers are - non-negative integers */ - if ((vp->x >= lcd_width) || - ((vp->x + vp->width) > lcd_width) || - (vp->y >= lcd_height) || - ((vp->y + vp->height) > lcd_height)) - { - return WPS_ERROR_INVALID_PARAM; - } - -#ifdef HAVE_LCD_COLOR - if (depth == 16) - { - if (!LIST_VALUE_PARSED(set, PL_FG)) - vp->fg_pattern = global_settings.fg_color; - if (!LIST_VALUE_PARSED(set, PL_BG)) - vp->bg_pattern = global_settings.bg_color; - } -#endif - wps_data->viewports[wps_data->num_viewports-1].last_line = wps_data->num_lines - 1; wps_data->viewports[wps_data->num_viewports].first_line = wps_data->num_lines; Index: apps/menu.c =================================================================== --- apps/menu.c (Revision 21826) +++ apps/menu.c (Arbeitskopie) @@ -344,8 +344,8 @@ const struct menu_item_ex *temp, *menu; int ret = 0, i; bool redraw_lists; - int oldbars = viewportmanager_set_statusbar( - hide_bars ? VP_SB_HIDE_ALL : VP_SB_ALLSCREENS); + int oldbars = viewportmanager_get_statusbar(); + viewportmanager_set_statusbar(hide_bars ? VP_SB_HIDE_ALL : oldbars); const struct menu_item_ex *menu_stack[MAX_MENUS]; int menu_stack_selected_item[MAX_MENUS]; Index: apps/settings.h =================================================================== --- apps/settings.h (Revision 21826) +++ apps/settings.h (Arbeitskopie) @@ -749,6 +749,13 @@ /* If values are just added to the end, no need to bump plugin API version. */ /* new stuff to be added at the end */ + +#ifdef HAVE_LCD_BITMAP + unsigned char ui_vp_config[50]; /* viewport string for the lists */ +#ifdef HAVE_REMOTE_LCD + unsigned char remote_ui_vp_config[50]; /* viewport file for the remote lists */ +#endif +#endif }; /** global variables **/ Index: apps/menus/theme_menu.c =================================================================== --- apps/menus/theme_menu.c (Revision 21826) +++ apps/menus/theme_menu.c (Arbeitskopie) @@ -38,6 +38,7 @@ #include "lcd-remote.h" #include "backdrop.h" #include "exported_menus.h" +#include "appevents.h" #if LCD_DEPTH > 1 /** @@ -48,6 +49,7 @@ global_settings.backdrop_file[0]=0; unload_main_backdrop(); show_main_backdrop(); + send_event(GUI_EVENT_REFRESH, NULL); settings_save(); return 0; } Index: apps/appevents.h =================================================================== --- apps/appevents.h (Revision 21826) +++ apps/appevents.h (Arbeitskopie) @@ -51,6 +51,7 @@ GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1), GUI_EVENT_STATUSBAR_TOGGLE, GUI_EVENT_ACTIONUPDATE, + GUI_EVENT_REFRESH, }; #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 21826) +++ apps/settings_list.c (Arbeitskopie) @@ -180,6 +180,10 @@ {.custom = (void*)default}, name, NULL, \ {.custom_setting = (struct custom_setting[]){ \ {load_from_cfg, write_to_cfg, is_change, set_default}}}} + +#define VIEWPORT_SETTING(var,name,default) \ + TEXT_SETTING(0,var,name,default, NULL, NULL) + /* some sets of values which are used more than once, to save memory */ static const char off_on[] = "off,on"; static const char off_on_ask[] = "off,on,ask"; @@ -1537,6 +1541,13 @@ #endif #endif + /* Customizable list */ +#ifdef HAVE_LCD_BITMAP + VIEWPORT_SETTING(ui_vp_config, "ui viewport", ""), +#ifdef HAVE_REMOTE_LCD + VIEWPORT_SETTING(remote_ui_vp_config, "remote ui viewport", ""), +#endif +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings); Index: apps/filetree.c =================================================================== --- apps/filetree.c (Revision 21826) +++ apps/filetree.c (Arbeitskopie) @@ -507,7 +507,6 @@ splash(0, ID2P(LANG_WAIT)); if (!settings_load_config(buf,true)) break; - gui_synclist_draw(&tree_lists); splash(HZ, ID2P(LANG_SETTINGS_LOADED)); break; @@ -617,6 +616,8 @@ } } + send_event(GUI_EVENT_REFRESH, NULL); + if ( play ) { /* the resume_index must always be the index in the shuffled list in case shuffle is enabled */ Index: apps/plugin.c =================================================================== --- apps/plugin.c (Revision 21826) +++ apps/plugin.c (Arbeitskopie) @@ -663,10 +663,10 @@ int plugin_load(const char* plugin, const void* parameter) { - int rc; - int i; + int rc, i; int oldbars; struct plugin_header *hdr; + struct viewport plugin_vp[NB_SCREENS]; #ifdef SIMULATOR void *pd; #else /* !SIMULATOR */ @@ -771,8 +771,15 @@ lcd_remote_update(); #endif + oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); + viewportmanager_set_ui_vp(false); + + FOR_NB_SCREENS(i) + viewport_set_defaults(&plugin_vp[i], i); + + viewport_set_current_vp(plugin_vp); + cpucache_invalidate(); - oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); #ifdef HAVE_TOUCHSCREEN enum touchscreen_mode old_mode = touchscreen_get_mode(); @@ -825,6 +832,8 @@ } viewportmanager_set_statusbar(oldbars); + viewportmanager_set_ui_vp(true); + viewport_set_current_vp(NULL); if (pfn_tsr_exit == NULL) plugin_loaded = false; Index: apps/root_menu.c =================================================================== --- apps/root_menu.c (Revision 21826) +++ apps/root_menu.c (Arbeitskopie) @@ -193,6 +193,7 @@ } } } + send_event(GUI_EVENT_REFRESH, NULL); if (!tagcache_is_usable()) return GO_TO_PREVIOUS; filter = SHOW_ID3DB; Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (Revision 21826) +++ apps/debug_menu.c (Arbeitskopie) @@ -398,7 +398,6 @@ lcd_update(); } - tick_remove_task(dbg_audio_task); lcd_setfont(FONT_UI); @@ -2841,9 +2840,11 @@ if (btn == ACTION_STD_OK) { int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); + viewportmanager_set_ui_vp(false); menuitems[gui_synclist_get_sel_pos(lists)].function(); btn = ACTION_REDRAW; viewportmanager_set_statusbar(oldbars); + viewportmanager_set_ui_vp(true); } return btn; } Index: apps/main.c =================================================================== --- apps/main.c (Revision 21826) +++ apps/main.c (Arbeitskopie) @@ -72,6 +72,7 @@ #include "eeprom_settings.h" #include "scrobbler.h" #include "icon.h" +#include "viewport.h" #ifdef IPOD_ACCESSORY_PROTOCOL #include "iap.h" @@ -136,10 +137,8 @@ screens[i].clear_display(); screens[i].update(); } + viewportmanager_init(); tree_gui_init(); - viewportmanager_set_statusbar(VP_SB_ALLSCREENS); - add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, - viewportmanager_statusbar_changed); #ifdef HAVE_USBSTACK /* All threads should be created and public queues registered by now */ usb_start_monitoring(); Index: wps/WPSLIST =================================================================== --- wps/WPSLIST (Revision 21826) +++ wps/WPSLIST (Arbeitskopie) @@ -69,6 +69,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -81,6 +83,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -93,6 +97,8 @@ viewers iconset: selector type: bar (inverse) Statusbar: top +ui viewport: - +remote ui viewport: - @@ -105,6 +111,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: +remote ui viewport: @@ -152,6 +160,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -159,6 +169,8 @@ Author: Mike Sobel Font: 13-Nimbus.fnt Statusbar: top +ui viewport: - +remote ui viewport: - @@ -173,6 +185,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -206,6 +220,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -228,6 +244,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -261,6 +279,8 @@ iconset: viewers iconset: selector type: bar (inverse) +ui viewport: - +remote ui viewport: - @@ -352,6 +372,10 @@ # Whether the WPS is designed to have the statusbar on or off Statusbar: top + +# list & remote ui viewports +ui viewport: - +remote ui viewport: - Index: wps/wpsbuild.pl =================================================================== --- wps/wpsbuild.pl (Revision 21826) +++ wps/wpsbuild.pl (Arbeitskopie) @@ -53,6 +53,8 @@ my $viewericon; my $lineselecttextcolor; my $filetylecolor; +my $listviewport; +my $remotelistviewport; # LCD sizes my ($main_height, $main_width, $main_depth); @@ -293,6 +295,12 @@ if($rwps && $has_remote ) { push @out, "rwps: /$rbdir/wps/$rwps\n"; } + if(defined($listviewport)) { + push @out, "ui viewport: $listviewport\n"; + } + if(defined($remotelistviewport) && $has_remote) { + push @out, "remote ui viewport: $listviewport\n"; + } if(-f "$rbdir/wps/$cfg") { print STDERR "wpsbuild warning: wps/$cfg already exists!\n"; } @@ -347,6 +355,8 @@ undef $viewericon; undef $lineselecttextcolor; undef $filetylecolor; + undef $listviewport; + undef $remotelistviewport; next; } @@ -513,6 +523,12 @@ elsif($l =~ /^filetype colours: *(.*)/i) { $filetylecolor = $1; } + elsif($l =~ /^ui viewport: *(.*)/i) { + $listviewport = $1; + } + elsif($l =~ /^remote ui viewport: *(.*)/i) { + $remotelistviewport = $1; + } else{ #print "Unknown line: $l!\n"; }