Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (Revision 18290) +++ apps/recorder/recording.c (Arbeitskopie) @@ -1051,26 +1051,24 @@ struct viewport *v; /* top vp, 4 lines, force sys font if total screen < 6 lines NOTE: one could limit the list to 1 line and get away with 5 lines */ + vp_top[i] = list_info[i]; v = &vp_top[i]; - viewport_set_defaults(v, i); /*already takes care of statusbar*/ if (viewport_get_nb_lines(v) < 4) { /* compact needs 4 lines total */ v->font = FONT_SYSFIXED; compact_view[i] = false; } + /* check again with FONT_SYSFIXED, compact view if still too less space */ + if (viewport_get_nb_lines(v) < (4+2)) /*top=4,list=2*/ + compact_view[i] = true; else - { - if (viewport_get_nb_lines(v) < (4+2)) /*top=4,list=2*/ - compact_view[i] = true; - else - compact_view[i] = false; - } + compact_view[i] = false; v->height = (font_get(v->font)->height)*(compact_view[i] ? 3 : 4); /* list section, rest of the screen */ + vp_list[i] = list_info[i]; v = &vp_list[i]; - viewport_set_defaults(v, i); v->font = vp_top[i].font; v->y = vp_top[i].y + vp_top[i].height; v->height = screens[i].lcdheight - v->y; /* the rest */ @@ -1083,16 +1081,17 @@ trig_ypos[i] -= (font_get(vp_top[i].font)->height)/2; } - /* init the bottom list */ - gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list); - gui_synclist_set_title(&lists, NULL, Icon_NOICON); - /* start of the loop: we stay in this loop until user quits recscreen */ while(done <= 0) { if(done < 0) { /* request to re-init stuff, done after settings screen */ + + /* init the bottom list */ + gui_synclist_init(&lists, reclist_get_name, NULL, + false, 1, vp_list); + gui_synclist_set_title(&lists, NULL, Icon_NOICON); done = 0; #ifdef HAVE_FMRADIO_REC /* If input changes away from FM Radio, Index: apps/plugins/pictureflow.c =================================================================== --- apps/plugins/pictureflow.c (Revision 18290) +++ apps/plugins/pictureflow.c (Arbeitskopie) @@ -128,6 +128,7 @@ #define ERROR_NO_ALBUMS -1 #define ERROR_BUFFER_FULL -2 +static struct viewport vp[NB_SCREENS]; /** structs we use */ @@ -1529,6 +1530,9 @@ if ( empty_slide_hid != - 1) rb->bufclose(empty_slide_hid); rb->lcd_set_drawmode(old_drawmode); + i = 0; + FOR_NB_SCREENS(i); + rb->init_list_info(i); } /** @@ -1564,7 +1568,7 @@ "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); @@ -1627,7 +1631,7 @@ "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; @@ -2120,6 +2124,9 @@ rb = api; /* copy to global api pointer */ (void) parameter; + int i; + FOR_NB_SCREENS(i) + rb->viewport_set_defaults(&vp[i], i); #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif Index: apps/plugins/star.c =================================================================== --- apps/plugins/star.c (Revision 18290) +++ apps/plugins/star.c (Arbeitskopie) @@ -19,6 +19,7 @@ * ****************************************************************************/ #include "plugin.h" + #ifdef HAVE_LCD_BITMAP PLUGIN_HEADER @@ -982,7 +983,7 @@ */ static int star_menu(void) { - int selection, level=1; + int selection, i, level=1; bool menu_quit = false; struct viewport vp[NB_SCREENS]; /* get the size of char */ @@ -1097,7 +1098,10 @@ level--; star_run_game(level); } - + FOR_NB_SCREENS(i) + { + rb->init_list_info(i); + } return PLUGIN_OK; } Index: apps/plugins/disktidy.c =================================================================== --- apps/plugins/disktidy.c (Revision 18290) +++ apps/plugins/disktidy.c (Arbeitskopie) @@ -460,7 +460,7 @@ bool show_icons = rb->global_settings->show_icons; struct simplelist_info list; rb->global_settings->show_icons = true; /* force the icons so its readable */ - rb->simplelist_info_init(&list, "Files to Clean", tidy_type_count, NULL); + rb->simplelist_info_init(&list, "Files to Clean", tidy_type_count, NULL, NULL); list.get_icon = get_icon; list.get_name = get_name; list.action_callback = list_action_callback; Index: apps/plugins/text_editor.c =================================================================== --- apps/plugins/text_editor.c (Revision 18290) +++ apps/plugins/text_editor.c (Arbeitskopie) @@ -36,13 +36,13 @@ static int line_count = 0; static int last_action_line = 0; static int last_char_index = 0; +static struct viewport vp[NB_SCREENS]; #define ACTION_INSERT 0 #define ACTION_GET 1 #define ACTION_REMOVE 2 #define ACTION_UPDATE 3 #define ACTION_CONCAT 4 - int _do_action(int action, char* str, int line); #ifndef HAVE_ADJUSTABLE_CPU_FREQ #define do_action _do_action @@ -205,7 +205,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, vp); rb->gui_synclist_set_icon_callback(lists,NULL); rb->gui_synclist_set_nb_items(lists,line_count); rb->gui_synclist_limit_scroll(lists,true); @@ -226,7 +226,7 @@ "Concat To Above", "Save", "Show Playback Menu",); - switch (rb->do_menu(&menu, NULL, NULL, false)) + switch (rb->do_menu(&menu, NULL, vp, false)) { case 0: /* cut */ rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]); @@ -312,7 +312,6 @@ { int fd; static char temp_line[MAX_LINE_LEN]; - struct gui_synclist lists; bool exit = false; int button; @@ -326,6 +325,9 @@ rb = api; + short scrn; + FOR_NB_SCREENS(scrn) + rb->viewport_set_defaults(&vp[scrn], scrn); copy_buffer[0]='\0'; prev_show_statusbar = rb->global_settings->statusbar; rb->global_settings->statusbar = false; @@ -408,7 +410,7 @@ { MENUITEM_STRINGLIST(menu, "Edit What?", NULL, "Extension", "Color",); - switch (rb->do_menu(&menu, NULL, NULL, false)) + switch (rb->do_menu(&menu, NULL, vp, false)) { case 0: edit_text = true; @@ -476,7 +478,7 @@ "Show Playback Menu", "Save Changes", "Save As...", "Save and Exit", "Ignore Changes and Exit"); - switch (rb->do_menu(&menu, NULL, NULL, false)) + switch (rb->do_menu(&menu, NULL, vp, false)) { case 0: break; @@ -506,6 +508,10 @@ } rb->gui_synclist_set_nb_items(&lists,line_count); } + /* re-initliaze the (custom) list viewport */ + scrn = 0; + FOR_NB_SCREENS(scrn) + rb->init_list_info(scrn); rb->global_settings->statusbar = prev_show_statusbar; return PLUGIN_OK; } Index: apps/gui/bitmap/list.c =================================================================== --- apps/gui/bitmap/list.c (Revision 18290) +++ apps/gui/bitmap/list.c (Arbeitskopie) @@ -86,9 +86,9 @@ + ICON_PADDING*2; vp_icons->x += ICON_PADDING; - vp_text->width -= vp_icons->width + vp_icons->x; - vp_text->x += vp_icons->width + vp_icons->x; - + vp_text->x = vp_icons->width + vp_icons->x; + vp_text->width -= vp_text->x; + display->set_viewport(vp_icons); screen_put_icon(display, 0, 0, list->title_icon); } @@ -107,7 +107,12 @@ void list_draw(struct screen *display, struct viewport *parent, struct gui_synclist *list) { + static struct viewport fullscreen; int start, end, line_height, i; + /* fullscreen vp needed, so that the screen update removes dead parts of + * previous screens */ + FOR_NB_SCREENS(i) + viewport_set_defaults(&fullscreen, display->screen_type); int icon_width = get_icon_width(display->screen_type) + ICON_PADDING; bool show_cursor = !global_settings.cursor_style && list->show_selection_marker; @@ -117,9 +122,11 @@ int item_offset; bool show_title; line_height = font_get(parent->font)->height; - display->set_viewport(parent); + /* using NULL results in statusbar flickering */ + display->set_viewport(&fullscreen); display->clear_viewport(); display->stop_scroll(); + display->set_viewport(parent); list_text[display->screen_type] = *parent; if ((show_title = draw_title(display, parent, list))) { @@ -278,10 +285,8 @@ screen_put_icon(display, 0, (i-start), Icon_Cursor); } } - - display->set_viewport(parent); + display->set_viewport(NULL); display->update_viewport(); - display->set_viewport(NULL); } Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (Revision 18290) +++ apps/gui/list.c (Arbeitskopie) @@ -58,12 +58,37 @@ 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 viewport *parent, struct gui_synclist *list); #ifdef HAVE_LCD_BITMAP +/* initialize the custom list vp once, call this fuction whenever the list_info + * viewport should be parsed again (e.g. when a setting changes) + */ + +void init_list_info(enum screen_type screen) +{ +#ifdef HAVE_REMOTE_LCD + if (screen == SCREEN_REMOTE) + { + if(!(viewport_parse_viewport(&(list_info[screen]), + global_settings.remote_list_vp_config, ',', screen))) + { + viewport_set_defaults(&(list_info[screen]),screen); + } + } + else +#endif + { + if (!(viewport_parse_viewport(&(list_info[screen]), + global_settings.list_vp_config, ',', screen))) + { + viewport_set_defaults(&(list_info[screen]),screen); + } + } +} + static struct viewport parent[NB_SCREENS]; void list_init_viewports(struct gui_synclist *list) { @@ -139,17 +164,15 @@ gui_list->selected_item = 0; FOR_NB_SCREENS(i) { + init_list_info(i); gui_list->start_item[i] = 0; gui_list->last_displayed_start_item[i] = -1 ; #ifdef HAVE_LCD_BITMAP gui_list->offset_position[i] = 0; #endif if (list_parent) - gui_list->parent[i] = &list_parent[i]; - else - { - gui_list->parent[i] = &parent[i]; - } + list_info[i] = list_parent[i]; + gui_list->parent[i] = &list_info[i]; } list_init_viewports(gui_list); gui_list->limit_scroll = false; @@ -256,7 +279,6 @@ vp.height -= list_title_height(gui_list,gui_list->parent[screen]); #endif nb_lines = viewport_get_nb_lines(&vp); - /* edge case,, selected last item */ if (gui_list->selected_item == gui_list->nb_items -1) { @@ -845,19 +867,14 @@ bool simplelist_show_list(struct simplelist_info *info) { struct gui_synclist lists; - struct viewport vp[NB_SCREENS]; - int action, old_line_count = simplelist_line_count,i; + int action, old_line_count = simplelist_line_count; char* (*getname)(int item, void * data, char *buffer, size_t buffer_len); if (info->get_name) getname = info->get_name; else getname = simplelist_static_getname; - FOR_NB_SCREENS(i) - { - viewport_set_defaults(&vp[i], i); - } gui_synclist_init(&lists, getname, info->callback_data, - info->scroll_all, info->selection_size, vp); + info->scroll_all, info->selection_size, info->parent); if (info->title) gui_synclist_set_title(&lists, info->title, NOICON); @@ -917,7 +934,7 @@ } void simplelist_info_init(struct simplelist_info *info, char* title, - int count, void* data) + int count, void* data, struct viewport parent[NB_SCREENS]) { info->title = title; info->count = count; @@ -931,6 +948,7 @@ info->get_name = NULL; info->get_talk = NULL; info->callback_data = data; + info->parent = parent; } Index: apps/gui/quickscreen.c =================================================================== --- apps/gui/quickscreen.c (Revision 18290) +++ apps/gui/quickscreen.c (Arbeitskopie) @@ -37,6 +37,7 @@ #include "audio.h" #include "quickscreen.h" #include "talk.h" +#include "list.h" static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; static struct viewport vp_icons[NB_SCREENS]; @@ -293,7 +294,8 @@ screens[i].set_viewport(NULL); screens[i].stop_scroll(); viewport_set_defaults(&vp[i], i); - quickscreen_fix_viewports(qs, &screens[i], &vp[i]); + + quickscreen_fix_viewports(qs, &screens[i], &list_info[i]); gui_quickscreen_draw(qs, &screens[i], &vp[i]); } /* Announce current selection on entering this screen. This is all Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (Revision 18290) +++ apps/gui/viewport.c (Arbeitskopie) @@ -33,6 +33,8 @@ #include "viewport.h" #include "statusbar.h" #include "screen_access.h" +#include "debug.h" +#define VP_STRUCTURE_PARAM_ERROR 0 int viewport_get_nb_lines(struct viewport *vp) { @@ -44,7 +46,6 @@ #endif } - void viewport_set_defaults(struct viewport *vp, enum screen_type screen) { vp->x = 0; @@ -82,3 +83,94 @@ } #endif } + +#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 */ +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, + }; + + /* set the defaults, the string is maybe complete */ + viewport_set_defaults(vp, screen); + + /* 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_STRUCTURE_PARAM_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_STRUCTURE_PARAM_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_STRUCTURE_PARAM_ERROR; + } + else +#endif + {} + + if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) + return VP_STRUCTURE_PARAM_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 == 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 + /* 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_STRUCTURE_PARAM_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; + + return ptr; +} + +#endif Index: apps/gui/list.h =================================================================== --- apps/gui/list.h (Revision 18290) +++ apps/gui/list.h (Arbeitskopie) @@ -35,6 +35,15 @@ }; /* + * this is used for the customizable list dimensions + */ + +#ifdef HAVE_LCD_BITMAP +struct viewport list_info[NB_SCREENS]; + +void init_list_info(enum screen_type screen); +#endif +/* * The gui_list is based on callback functions, if you want the list * to display something you have to provide it a function that * tells it what to display. @@ -216,6 +225,7 @@ list_get_name *get_name; /* NULL if you're using simplelist_addline() */ list_speak_item *get_talk; /* can be NULL to not speak */ void *callback_data; /* data for callbacks */ + struct viewport *parent; }; #define SIMPLELIST_MAX_LINES 32 @@ -246,8 +256,9 @@ info.timeout = HZ/10; info.start_selection = 0; */ +/* passing NULL as parent results in using the list_info viewport */ void simplelist_info_init(struct simplelist_info *info, char* title, - int count, void* data); + int count, void* data, struct viewport parent[NB_SCREENS]); /* show a list. if list->action_callback != NULL it is called with the action ACTION_REDRAW Index: apps/gui/viewport.h =================================================================== --- apps/gui/viewport.h (Revision 18290) +++ apps/gui/viewport.h (Arbeitskopie) @@ -35,8 +35,18 @@ #define VP_DIMENSIONS 0x1 #define VP_COLORS 0x2 #define VP_SELECTIONCOLORS 0x4 + +#define DEBUG_VP(vp, string) DEBUGF("%s debug:\n.x: %d\t.y: %d\n \ + \r.width: %d\t.height: %d\n\n"\ + ,string, vp.x,vp.y,vp.width,vp.height) +#define DEBUG_VP_PTR(vp, string) DEBUGF("%s debug:\n->x: %d\t\t->y: %d\n \ + \r->width: %d\t->height: %d\n\n", \ + string, vp->x,vp->y,vp->width,vp->height) /* load a viewport struct from a config string. returns a combination of the above to say which were loaded ok from the string */ int viewport_load_config(const char *config, struct viewport *vp); void viewport_set_defaults(struct viewport *vp, enum screen_type screen); + +const char* viewport_parse_viewport(struct viewport *vp, + const char *ptr, char seperator, enum screen_type screen); Index: apps/gui/wps_parser.c =================================================================== --- apps/gui/wps_parser.c (Revision 18290) +++ apps/gui/wps_parser.c (Arbeitskopie) @@ -26,6 +26,7 @@ #include "file.h" #include "misc.h" #include "plugin.h" +#include "viewport.h" #ifdef __PCTOOL__ #define DEBUGF printf @@ -566,26 +567,6 @@ { (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; -#ifdef HAVE_REMOTE_LCD - if (wps_data->remote_wps) - { - lcd_width = LCD_REMOTE_WIDTH; - lcd_height = LCD_REMOTE_HEIGHT; - } -#endif if (wps_data->num_viewports >= WPS_MAX_VIEWPORTS) return WPS_ERROR_INVALID_PARAM; @@ -614,7 +595,7 @@ 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 */ @@ -622,80 +603,27 @@ /* 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 - -#ifdef HAVE_LCD_COLOR - if (depth == 16) + if (!(wps_data->remote_wps)) { - 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))) + if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_MAIN))) return WPS_ERROR_INVALID_PARAM; +#ifdef HAVE_REMOTE_LCD } - else -#endif -#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) - if (depth == 1) + else { - if (!(ptr = parse_list("ddddd", &set, '|', ptr, &vp->x, &vp->y, - &vp->width, &vp->height, &vp->font))) + if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_REMOTE))) 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 18290) +++ apps/menu.c (Arbeitskopie) @@ -204,7 +204,6 @@ } } current_submenus_menu = (struct menu_item_ex *)menu; - gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1, parent); #ifdef HAVE_LCD_BITMAP if (menu->callback_and_desc->icon_id == Icon_NOICON) @@ -384,7 +383,7 @@ int stack_top = 0; bool in_stringlist, done = false; - struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */ + struct viewport *vps; #ifdef HAVE_BUTTONBAR struct gui_buttonbar buttonbar; gui_buttonbar_init(&buttonbar); @@ -404,7 +403,7 @@ } else { - vps = menu_vp; + vps = list_info; init_default_menu_viewports(vps, hide_bars); } FOR_NB_SCREENS(i) @@ -574,7 +573,7 @@ return_value = temp->function->function(); if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU)) { - init_default_menu_viewports(menu_vp, hide_bars); + init_default_menu_viewports(vps, hide_bars); init_menu_lists(menu, &lists, selected, true, vps); } if (temp->flags&MENU_FUNC_CHECK_RETVAL) @@ -590,9 +589,9 @@ case MT_SETTING: case MT_SETTING_W_TEXT: { - if (do_setting_from_menu(temp, menu_vp)) + if (do_setting_from_menu(temp, vps)) { - init_default_menu_viewports(menu_vp, hide_bars); + init_default_menu_viewports(vps, hide_bars); init_menu_lists(menu, &lists, selected, true,vps); redraw_lists = false; /* above does the redraw */ } Index: apps/settings.h =================================================================== --- apps/settings.h (Revision 18290) +++ apps/settings.h (Arbeitskopie) @@ -432,7 +432,12 @@ #endif unsigned char wps_file[MAX_FILENAME+1]; /* last wps */ unsigned char lang_file[MAX_FILENAME+1]; /* last language */ - +#ifdef HAVE_LCD_BITMAP + unsigned char list_vp_config[34]; /* viewport file for the lists */ +#endif +#ifdef HAVE_REMOTE_LCD + unsigned char remote_list_vp_config[34]; /* viewport file for the lists */ +#endif /* misc options */ int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */ Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (Revision 18290) +++ apps/menus/main_menu.c (Arbeitskopie) @@ -441,7 +441,8 @@ { struct info_data data = {.new_data = true }; struct simplelist_info info; - simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), INFO_COUNT, (void*)&data); + simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), INFO_COUNT, (void*)&data, + NULL); info.hide_selection = !global_settings.talk_menu; if (info.hide_selection) info.scroll_all = true; Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 18290) +++ apps/settings_list.c (Arbeitskopie) @@ -108,7 +108,6 @@ CHARPTR(default),name,NULL, \ {.filename_setting= \ (struct filename_setting[]){{prefix,suffix,len}}} } - /* Used for settings which use the set_option() setting screen. The ... arg is a list of pointers to strings to display in the setting screen. These can either be literal strings, or ID2P(LANG_*) */ @@ -160,6 +159,9 @@ {cb, formatter, get_talk_id, unit, count, \ (const int[]){__VA_ARGS__}}}}} +#define VIEWPORT_SETTING(var,name,default) \ + FILENAME_SETTING(0,var,name,default, NULL, NULL, 32) + /* 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"; @@ -1349,6 +1351,13 @@ "touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2, ID2P(LANG_NORMAL), ID2P(LANG_HIGH)), #endif + /* 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/plugin.c =================================================================== --- apps/plugin.c (Revision 18290) +++ apps/plugin.c (Arbeitskopie) @@ -609,6 +609,12 @@ /* new stuff at the end, sort into place next time the API gets incompatible */ + init_list_info, +#ifdef HAVE_REMOTE_LCD + {&list_info[SCREEN_MAIN], &list_info[SCREEN_REMOTE]}, +#else + {&list_info[SCREEN_MAIN]}, +#endif }; int plugin_load(const char* plugin, const void* parameter) Index: apps/plugin.h =================================================================== --- apps/plugin.h (Revision 18290) +++ apps/plugin.h (Arbeitskopie) @@ -330,7 +330,7 @@ const struct text_message * yes_message, const struct text_message * no_message); void (*simplelist_info_init)(struct simplelist_info *info, char* title, - int count, void* data); + int count, void* data, struct viewport *parent); bool (*simplelist_show_list)(struct simplelist_info *info); /* button */ @@ -765,7 +765,8 @@ /* new stuff at the end, sort into place next time the API gets incompatible */ - + void (*init_list_info)(enum screen_type screen); + struct viewport* list_info[NB_SCREENS]; }; /* plugin header */ Index: apps/filetypes.c =================================================================== --- apps/filetypes.c (Revision 18290) +++ apps/filetypes.c (Arbeitskopie) @@ -489,7 +489,7 @@ return PLUGIN_OK; } #endif - simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), count, &data); + simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), count, &data, NULL); info.action_callback = openwith_action_callback; info.get_name = openwith_get_name; info.get_icon = openwith_get_icon; Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (Revision 18290) +++ apps/debug_menu.c (Arbeitskopie) @@ -210,7 +210,7 @@ #else MAXTHREADS+NUM_CORES, #endif - NULL); + NULL, NULL); #ifndef ROCKBOX_HAS_LOGF info.hide_selection = true; info.scroll_all = true; @@ -793,7 +793,7 @@ bool dbg_partitions(void) { struct simplelist_info info; - simplelist_info_init(&info, "Partition Info", 4, NULL); + simplelist_info_init(&info, "Partition Info", 4, NULL, NULL); info.selection_size = 2; info.hide_selection = true; info.scroll_all = true; @@ -1524,7 +1524,7 @@ int page = 0; char title[32] = "tsc2100 registers - Page 0"; struct simplelist_info info; - simplelist_info_init(&info, title, 32, &page); + simplelist_info_init(&info, title, 32, &page, NULL); info.timeout = HZ/100; info.get_name = tsc2100_debug_getname; info.action_callback= tsc2100debug_action_callback; @@ -1967,7 +1967,7 @@ static bool dbg_disk_info(void) { struct simplelist_info info; - simplelist_info_init(&info, "Disk Info", 1, NULL); + simplelist_info_init(&info, "Disk Info", 1, NULL, NULL); #if defined(HAVE_MMC) || defined(HAVE_ATA_SD) char title[16]; int card = 0; @@ -2006,7 +2006,7 @@ static bool dbg_dircache_info(void) { struct simplelist_info info; - simplelist_info_init(&info, "Dircache Info", 7, NULL); + simplelist_info_init(&info, "Dircache Info", 7, NULL, NULL); info.action_callback = dircache_callback; info.hide_selection = true; info.scroll_all = true; @@ -2064,7 +2064,7 @@ static bool dbg_tagcache_info(void) { struct simplelist_info info; - simplelist_info_init(&info, "Database Info", 8, NULL); + simplelist_info_init(&info, "Database Info", 8, NULL, NULL); info.action_callback = database_callback; info.hide_selection = true; info.scroll_all = true; @@ -2215,7 +2215,7 @@ { struct simplelist_info info; info.scroll_all = true; - simplelist_info_init(&info, "FM Radio", 1, NULL); + simplelist_info_init(&info, "FM Radio", 1, NULL, NULL); simplelist_set_line_count(0); simplelist_addline(SIMPLELIST_ADD_LINE, "HW detected: %s", radio_hardware_present() ? "yes" : "no"); @@ -2427,7 +2427,7 @@ { struct simplelist_info isp1583; isp1583.scroll_all = true; - simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL); + simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL, NULL); isp1583.timeout = HZ/100; isp1583.hide_selection = true; isp1583.get_name = dbg_usb_item; @@ -2452,7 +2452,7 @@ { struct simplelist_info pic; pic.scroll_all = true; - simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL); + simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL, NULL); pic.timeout = HZ/100; pic.hide_selection = true; pic.get_name = pic_dbg_item; @@ -2576,7 +2576,7 @@ { struct simplelist_info info; - simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL); + simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL, NULL); info.action_callback = menu_action_callback; info.get_name = dbg_menu_getname; Index: wps/WPSLIST =================================================================== --- wps/WPSLIST (Revision 18290) +++ wps/WPSLIST (Arbeitskopie) @@ -68,6 +68,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -80,6 +82,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -92,6 +96,8 @@ viewers iconset: selector type: bar (inverse) Statusbar: on +list viewport: +remote list viewport: @@ -104,6 +110,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -151,6 +159,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -158,6 +168,8 @@ Author: Mike Sobel Font: nimbus-13.fnt Statusbar: on +list viewport: +remote list viewport: @@ -172,6 +184,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -203,6 +217,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -225,6 +241,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -256,6 +274,8 @@ iconset: viewers iconset: selector type: bar (inverse) +list viewport: +remote list viewport: @@ -341,6 +361,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 18290) +++ wps/wpsbuild.pl (Arbeitskopie) @@ -258,6 +258,16 @@ if($rwps && $has_remote ) { push @out, "rwps: /.rockbox/wps/$rwps\n"; } + if(defined($listviewport)) { + if($listviewport eq '') { + push @out, "list viewport:\n"; + } + } + if((defined($remotelistviewport)) && $has_remote) { + if($remotelistviewport eq '') { + push @out, "remote list viewport:\n"; + } + } if(-f ".rockbox/wps/$cfg") { print STDERR "wpsbuild warning: wps/$cfg already exists!\n"; } @@ -308,6 +318,8 @@ undef $viewericon; undef $lineselecttextcolor; undef $filetylecolor; + undef $listviewport; + undef $remotelistviewport; next; } @@ -463,6 +475,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"; }