Index: apps/recorder/keyboard.c =================================================================== --- apps/recorder/keyboard.c (Revision 21069) +++ apps/recorder/keyboard.c (Arbeitskopie) @@ -300,6 +300,7 @@ char buf[2]; #endif int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); + viewportmanager_set_custom_vp(false); FOR_NB_SCREENS(l) { struct keyboard_parameters *pm = ¶m[l]; @@ -1244,6 +1245,7 @@ FOR_NB_SCREENS(l) screens[l].setfont(FONT_UI); viewportmanager_set_statusbar(oldbars); + viewportmanager_set_custom_vp(true); return 0; } Index: apps/settings.c =================================================================== --- apps/settings.c (Revision 21069) +++ apps/settings.c (Arbeitskopie) @@ -66,6 +66,7 @@ #include "filetypes.h" #include "option_select.h" #include "backdrop.h" +#include "viewport.h" #if CONFIG_TUNER #include "radio.h" @@ -971,7 +972,9 @@ #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC enc_global_settings_apply(); #endif - list_init_viewports(NULL); +#ifdef HAVE_LCD_BITMAP + viewport_init_custom_vp(); +#endif } @@ -1093,7 +1096,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/plugins/text_editor.c =================================================================== --- apps/plugins/text_editor.c (Revision 21069) +++ apps/plugins/text_editor.c (Arbeitskopie) @@ -35,6 +35,7 @@ static int line_count = 0; static int last_action_line = 0; static int last_char_index = 0; +static struct viewport parent[NB_SCREENS]; #define ACTION_INSERT 0 #define ACTION_GET 1 @@ -209,7 +210,7 @@ void setup_lists(struct gui_synclist *lists, int sel) { - rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL); + rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, parent); rb->gui_synclist_set_icon_callback(lists,NULL); rb->gui_synclist_set_nb_items(lists,line_count); rb->gui_synclist_limit_scroll(lists,true); @@ -327,11 +328,17 @@ #ifdef HAVE_LCD_COLOR bool edit_colors_file = false; #endif + int i; - copy_buffer[0]='\0'; prev_show_statusbar = rb->global_settings->statusbar; rb->global_settings->statusbar = false; + + rb->viewportmanager_set_custom_vp(false); + FOR_NB_SCREENS(i) + rb->viewport_set_defaults(&parent[i], i); + copy_buffer[0]='\0'; + #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif @@ -512,6 +519,7 @@ } rb->gui_synclist_set_nb_items(&lists,line_count); } + rb->viewportmanager_set_custom_vp(true); rb->global_settings->statusbar = prev_show_statusbar; return PLUGIN_OK; } Index: apps/plugins/star.c =================================================================== --- apps/plugins/star.c (Revision 21069) +++ apps/plugins/star.c (Arbeitskopie) @@ -1043,6 +1043,7 @@ "Information","Keys","Quit"); FOR_NB_SCREENS(selection) { + rb->viewportmanager_set_custom_vp(false); rb->viewport_set_defaults(&vp[selection], selection); #if LCD_DEPTH > 1 if (rb->screens[selection]->depth > 1) @@ -1152,6 +1153,8 @@ level--; star_run_game(level); } + + rb->viewportmanager_set_custom_vp(false); return PLUGIN_OK; } Index: apps/plugins/bubbles.c =================================================================== --- apps/plugins/bubbles.c (Revision 21069) +++ apps/plugins/bubbles.c (Arbeitskopie) @@ -2385,11 +2385,16 @@ * bubbles() is the main game subroutine, it returns the final game status. ******************************************************************************/ static int bubbles(struct game_context* bb) { - int buttonres; + int buttonres, i; unsigned int startlevel = 0; bool startgame = false; long timeout; + struct viewport parent[NB_SCREENS]; + rb->viewportmanager_set_custom_vp(false); + FOR_NB_SCREENS(i) + rb->viewport_set_defaults(&parent[i], i); + bubbles_setcolors(); /* don't resume by default */ @@ -2403,7 +2408,7 @@ "Level", "Display High Scores", "Playback Control", "Quit"); while(!startgame){ - switch (rb->do_menu(&menu, NULL, NULL, false)) + switch (rb->do_menu(&menu, NULL, parent, true)) { case 0: /* new game */ bb->level = startlevel; Index: apps/plugins/pictureflow/pictureflow.c =================================================================== --- apps/plugins/pictureflow/pictureflow.c (Revision 21069) +++ apps/plugins/pictureflow/pictureflow.c (Arbeitskopie) @@ -386,6 +386,7 @@ static int track_list_h; static int track_scroll_index = 0; static int track_scroll_dir = 1; +static struct viewport vp[NB_SCREENS]; /* Proposals for transitions: @@ -2022,7 +2023,7 @@ MENUITEM_STRINGLIST(album_name_menu,"Show album title",NULL, "Hide album title", "Show at the bottom", "Show at the top"); - rb->do_menu(&album_name_menu, &selection, NULL, false); + rb->do_menu(&album_name_menu, &selection, vp, false); show_album_name = selection; return GO_TO_PREVIOUS; @@ -2041,7 +2042,7 @@ "Show album title", "Resize Covers", "Rebuild cache"); do { - selection=rb->do_menu(&settings_menu,&selection, NULL, false); + selection=rb->do_menu(&settings_menu,&selection, vp, false); switch(selection) { case 0: rb->set_bool("Show FPS", &show_fps); @@ -2118,7 +2119,7 @@ MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, "Settings", "Return", "Quit"); while (1) { - switch (rb->do_menu(&main_menu,&selection, NULL, false)) { + switch (rb->do_menu(&main_menu,&selection, vp, false)) { case 0: result = settings_menu(); if ( result != 0 ) return result; @@ -2622,6 +2623,10 @@ #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif + rb->viewportmanager_set_custom_vp(false); + int i; + FOR_NB_SCREENS(i) + rb->viewport_set_defaults(&vp[i], i); /* Turn off backlight timeout */ backlight_force_on(); /* backlight control in lib/helper.c */ #ifdef HAVE_ADJUSTABLE_CPU_FREQ Index: apps/plugins/test_fps.c =================================================================== --- apps/plugins/test_fps.c (Revision 21069) +++ apps/plugins/test_fps.c (Arbeitskopie) @@ -75,6 +75,7 @@ static void log_text(char *text) { +#if 0 rb->lcd_puts(0, line, text); if (++line >= max_line) line = 0; @@ -85,8 +86,12 @@ remote_line = 0; rb->lcd_remote_update(); #endif +#else + rb->simplelist_addline(SIMPLELIST_ADD_LINE, text); +#endif } + static int calc_tenth_fps(int framecount, long ticks) { return (10*HZ) * framecount / ticks; @@ -340,40 +345,56 @@ char str[32]; int cpu_freq; #endif + int page = 0; + char title[] = "LCD framerate test"; + struct simplelist_info info; + rb->simplelist_info_init(&info, title, 32, &page); + info.timeout = HZ/100; + info.get_name = NULL; + info.action_callback= NULL; /* standard stuff */ PLUGIN_IRAM_INIT(rb) (void)parameter; log_init(); + backlight_force_on(); /* backlight control in lib/helper.c */ + + int i; + for (i = 0; i < 2; i++) + { + if (i) + rb->cpu_boost(true); #ifndef SIMULATOR - cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ + cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ #endif - backlight_force_on(); /* backlight control in lib/helper.c */ - - log_text("Main LCD Update"); - time_main_update(); + + log_text("Main LCD Update"); + time_main_update(); #ifdef HAVE_LCD_COLOR - log_text("Main LCD YUV"); - time_main_yuv(); + log_text("Main LCD YUV"); + time_main_yuv(); #endif #if LCD_DEPTH < 4 - log_text("Greyscale library"); - time_greyscale(); + log_text("Greyscale library"); + time_greyscale(); #endif #ifdef HAVE_REMOTE_LCD - log_text("Remote LCD Update"); - time_remote_update(); + log_text("Remote LCD Update"); + time_remote_update(); #endif - #ifndef SIMULATOR - if (*rb->cpu_frequency != cpu_freq) - rb->snprintf(str, sizeof(str), "CPU clock changed!"); - else - rb->snprintf(str, sizeof(str), "CPU: %d MHz", - (cpu_freq + 500000) / 1000000); - log_text(str); + if (*rb->cpu_frequency != cpu_freq) + rb->snprintf(str, sizeof(str), "CPU clock changed!"); + else + rb->snprintf(str, sizeof(str), "CPU: %d MHz", + (cpu_freq + 500000) / 1000000); + log_text(str); #endif + if (i) + rb->cpu_boost(false); + } + backlight_use_settings(); /* backlight control in lib/helper.c */ /* wait until user closes plugin */ Index: apps/gui/splash.c =================================================================== --- apps/gui/splash.c (Revision 21069) +++ apps/gui/splash.c (Arbeitskopie) @@ -29,6 +29,7 @@ #include "talk.h" #include "splash.h" #include "viewport.h" +#include "appevents.h" #ifdef HAVE_LCD_BITMAP @@ -44,8 +45,16 @@ #define RECT_SPACING 2 -static void splash_internal(struct screen * screen, const char *fmt, va_list ap) +static void splash_cleanup(void* param) { + (void)param; + int i; + FOR_NB_SCREENS(i) + screens[i].update(); +} + +static void splash_internal(int ticks, struct screen * screen, const char *fmt, va_list ap) +{ char splash_buf[MAXBUFFER]; short widths[MAXLINES]; char *lines[MAXLINES]; @@ -201,6 +210,14 @@ #undef W } screen->update_viewport(); + screen->clear_viewport(); + if (ticks) + { + sleep(ticks); + screen->update_viewport(); + } + else + add_event(GUI_EVENT_SPLASH_CLEANUP, true, splash_cleanup); end: screen->set_viewport(NULL); } @@ -216,11 +233,9 @@ FOR_NB_SCREENS(i) { va_start(ap, fmt); - splash_internal(&(screens[i]), fmt, ap); + splash_internal(ticks, &(screens[i]), fmt, ap); va_end(ap); } - if (ticks) - sleep(ticks); } void splash(int ticks, const char *str) Index: apps/gui/splash.h =================================================================== --- apps/gui/splash.h (Revision 21069) +++ apps/gui/splash.h (Arbeitskopie) @@ -38,4 +38,5 @@ * it will be voiced */ extern void splash(int ticks, const char *str); + #endif /* _GUI_ICON_H_ */ Index: apps/gui/statusbar.c =================================================================== --- apps/gui/statusbar.c (Revision 21069) +++ 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; vp.y = STATUSBAR_Y_POS; Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (Revision 21069) +++ apps/gui/list.c (Arbeitskopie) @@ -28,6 +28,7 @@ #include "settings.h" #include "kernel.h" #include "system.h" +#include "debug.h" #include "action.h" #include "screen_access.h" @@ -55,29 +56,36 @@ /* 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; + struct viewport* vp; + bool parent_used[NB_SCREENS]; FOR_NB_SCREENS(i) { - vp = &parent[i]; - if (!list || list->parent[i] == vp) - viewport_set_defaults(vp, i); + parent_used[i] = (list->parent[i]); } + vp = viewport_get_current_vp(); + FOR_NB_SCREENS(i) + { + if (!parent_used[i]) + { + printf("NULL parent\n"); + viewportmanager_set_custom_vp(true); + list->parent[i] = &vp[i]; + } + } + viewport_set_current_vp(*list->parent); #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 +98,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 +146,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 +166,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 +221,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 +439,6 @@ } else { gui_list->title_width = 0; } - force_list_reinit = true; } Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (Revision 21069) +++ 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; +} custom_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 @@ -57,10 +71,21 @@ return true; #endif return false; -} +} void viewport_set_defaults(struct viewport *vp, enum screen_type screen) { +#ifdef HAVE_LCD_BITMAP + if (custom_vp_info.enabled) + *vp = custom_vp[screen]; + else +#endif + viewport_set_fullscreen(vp, screen); +} + + +void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen) +{ vp->x = 0; vp->width = screens[screen].lcdwidth; @@ -97,6 +122,16 @@ #endif } +void viewportmanager_init(void) +{ + viewportmanager_set_statusbar(VP_SB_ALLSCREENS); + custom_vp_info.enabled = viewport_init_custom_vp(); + add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, + viewportmanager_statusbar_changed); + add_event(GUI_EVENT_THEME_CHANGED, false, + viewportmanager_ui_vp_changed); + custom_vp_info.vp = custom_vp; +} int viewportmanager_set_statusbar(int enabled) { @@ -110,16 +145,16 @@ 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) { (void)data; int i; @@ -131,8 +166,176 @@ } } -void viewportmanager_statusbar_changed(void* data) +static void viewportmanager_statusbar_changed(void* data) { (void)data; viewportmanager_set_statusbar(statusbar_enabled); } + +#ifdef HAVE_LCD_BITMAP +void viewportmanager_set_custom_vp(const bool enable) +{ + if (enable && !custom_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 */ + int i; + FOR_NB_SCREENS(i) + { + viewportmanager_ui_vp_changed(NULL); + } + } + custom_vp_info.enabled = enable; +} + +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 got 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) + custom_vp_info.vp = vp; + else + custom_vp_info.vp = custom_vp; +} + +struct viewport* viewport_get_current_vp(void) +{ + return custom_vp_info.vp; +} + +/* 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 */ +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; +} + +/* returns 0 if defaults are used, due to viewport_parse_viewport failure */ +int viewport_init_custom_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_list_vp_config, ',', screen))) + { + viewport_set_fullscreen(&custom_vp[screen], screen); + ret--; + } + } + else +#endif + { + if (!(viewport_parse_viewport(&custom_vp[screen], + global_settings.list_vp_config, ',', screen))) + { + viewport_set_fullscreen(&custom_vp[screen], screen); + ret--; + } + } + } + return ret; +} + +#endif /* HAVE_LCD_BITMAP */ Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (Revision 21069) +++ apps/gui/gwps.c (Arbeitskopie) @@ -287,6 +287,7 @@ /* Play safe and unregister the hook */ lcd_activation_set_hook(NULL); #endif + viewportmanager_set_custom_vp(true); } void gwps_draw_statusbars(void) @@ -820,6 +821,7 @@ restore = false; restoretimer = RESTORE_WPS_INSTANTLY; gwps_fix_statusbars(); + viewportmanager_set_custom_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 21069) +++ 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 21069) +++ apps/gui/viewport.h (Arbeitskopie) @@ -61,8 +61,19 @@ #define VP_SB_ONSCREEN(screen) (1u<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/settings.h =================================================================== --- apps/settings.h (Revision 21069) +++ apps/settings.h (Arbeitskopie) @@ -734,6 +734,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 list_vp_config[50]; /* viewport string for the lists */ +#endif +#ifdef HAVE_REMOTE_LCD + unsigned char remote_list_vp_config[50]; /* viewport file for the remote lists */ +#endif }; /** global variables **/ Index: apps/appevents.h =================================================================== --- apps/appevents.h (Revision 21069) +++ apps/appevents.h (Arbeitskopie) @@ -49,8 +49,10 @@ /** Generic GUI class events **/ enum { GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1), + GUI_EVENT_VIEWPORT_CHANGED, GUI_EVENT_STATUSBAR_TOGGLE, GUI_EVENT_ACTIONUPDATE, + GUI_EVENT_SPLASH_CLEANUP, }; #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 21069) +++ apps/settings_list.c (Arbeitskopie) @@ -177,6 +177,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"; @@ -1468,6 +1472,14 @@ ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)), #endif OFFON_SETTING(0, prevent_skip, LANG_PREVENT_SKIPPING, false, "prevent track skip", NULL), + + /* Customizable list */ +#ifdef HAVE_LCD_BITMAP + VIEWPORT_SETTING(list_vp_config, "list viewport", ""), +#endif +#ifdef HAVE_REMOTE_LCD + VIEWPORT_SETTING(remote_list_vp_config, "remote list viewport", ""), +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings); Index: apps/filetree.c =================================================================== --- apps/filetree.c (Revision 21069) +++ apps/filetree.c (Arbeitskopie) @@ -377,6 +377,12 @@ return 0; } +/* callback for refreshing after theme change */ +void filetree_theme_changed_cb(void) +{ + gui_synclist_draw(&tree_lists); +} + int ft_enter(struct tree_context* c) { int rc = 0; @@ -507,6 +513,7 @@ splash(0, ID2P(LANG_WAIT)); if (!settings_load_config(buf,true)) break; + send_event(GUI_EVENT_THEME_CHANGED, filetree_theme_changed_cb); splash(HZ, ID2P(LANG_SETTINGS_LOADED)); break; @@ -590,6 +597,8 @@ } } + send_event(GUI_EVENT_SPLASH_CLEANUP, 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 21069) +++ apps/plugin.c (Arbeitskopie) @@ -648,12 +648,14 @@ #ifdef HAVE_TOUCHSCREEN action_get_touchscreen_press, #endif +#ifdef HAVE_LCD_BITMAP + viewportmanager_set_custom_vp, +#endif }; int plugin_load(const char* plugin, const void* parameter) { int rc; - int oldbars; struct plugin_header *hdr; #ifdef SIMULATOR void *pd; @@ -760,7 +762,6 @@ #endif cpucache_invalidate(); - oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); #ifdef HAVE_TOUCHSCREEN enum touchscreen_mode old_mode = touchscreen_get_mode(); @@ -773,9 +774,6 @@ #ifdef HAVE_TOUCHSCREEN touchscreen_set_mode(old_mode); #endif - - viewportmanager_set_statusbar(oldbars); - button_clear_queue(); #ifdef HAVE_LCD_BITMAP @@ -810,7 +808,9 @@ #endif - viewportmanager_set_statusbar(oldbars); + viewportmanager_set_statusbar(global_settings.statusbar + ? VP_SB_ALLSCREENS : VP_SB_HIDE_ALL); + viewportmanager_set_custom_vp(true); if (pfn_tsr_exit == NULL) plugin_loaded = false; Index: apps/plugin.h =================================================================== --- apps/plugin.h (Revision 21069) +++ apps/plugin.h (Arbeitskopie) @@ -810,6 +810,9 @@ #ifdef HAVE_TOUCHSCREEN int (*action_get_touchscreen_press)(short *x, short *y); #endif +#ifdef HAVE_LCD_BITMAP + void (*viewportmanager_set_custom_vp)(const bool enable); +#endif }; /* plugin header */ Index: apps/root_menu.c =================================================================== --- apps/root_menu.c (Revision 21069) +++ apps/root_menu.c (Arbeitskopie) @@ -193,6 +193,7 @@ } } } + send_event(GUI_EVENT_SPLASH_CLEANUP, NULL); if (!tagcache_is_usable()) return GO_TO_PREVIOUS; filter = SHOW_ID3DB; Index: apps/main.c =================================================================== --- apps/main.c (Revision 21069) +++ 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" @@ -135,10 +136,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 21069) +++ wps/WPSLIST (Arbeitskopie) @@ -69,6 +69,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -81,6 +83,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -93,6 +97,8 @@ viewers iconset: selector type: bar (inverse) Statusbar: on +list viewport: - +remote list viewport: - @@ -105,6 +111,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -152,6 +160,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -159,6 +169,8 @@ Author: Mike Sobel Font: 13-Nimbus.fnt Statusbar: on +list viewport: - +remote list viewport: - @@ -173,6 +185,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -206,6 +220,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -228,6 +244,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -261,6 +279,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: - +remote list viewport: - @@ -352,6 +372,10 @@ # Whether the WPS is designed to have the statusbar on or off Statusbar: on + +# list & remote list viewports +list viewport: - +remote list viewport: - Index: wps/wpsbuild.pl =================================================================== --- wps/wpsbuild.pl (Revision 21069) +++ 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); @@ -290,6 +292,12 @@ if($rwps && $has_remote ) { push @out, "rwps: /$rbdir/wps/$rwps\n"; } + if(defined($listviewport)) { + push @out, "list viewport: $listviewport\n"; + } + if(defined($remotelistviewport) && $has_remote) { + push @out, "remote list viewport: $listviewport\n"; + } if(-f "$rbdir/wps/$cfg") { print STDERR "wpsbuild warning: wps/$cfg already exists!\n"; } @@ -344,6 +352,8 @@ undef $viewericon; undef $lineselecttextcolor; undef $filetylecolor; + undef $listviewport; + undef $remotelistviewport; next; } @@ -510,6 +520,12 @@ elsif($l =~ /^filetype colours: *(.*)/i) { $filetylecolor = $1; } + elsif($l =~ /^list viewport: *(.*)/i) { + $listviewport = $1; + } + elsif($l =~ /^remote list viewport: *(.*)/i) { + $remotelistviewport = $1; + } else{ #print "Unknown line: $l!\n"; }