diff -ru rockbox6/apps/gui/icon.c rockbox/apps/gui/icon.c --- rockbox6/apps/gui/icon.c 2008-01-09 17:23:56.000000000 +0100 +++ rockbox/apps/gui/icon.c 2008-01-09 17:29:10.000000000 +0100 @@ -265,3 +265,8 @@ { return ICON_WIDTH(screen_type); } + +int get_icon_height(enum screen_type screen_type) +{ + return ICON_HEIGHT(screen_type); +} diff -ru rockbox6/apps/gui/icon.h rockbox/apps/gui/icon.h --- rockbox6/apps/gui/icon.h 2008-01-09 17:23:56.000000000 +0100 +++ rockbox/apps/gui/icon.h 2008-01-09 17:29:10.000000000 +0100 @@ -110,6 +110,7 @@ # define get_icon_width(a) 6 #else int get_icon_width(enum screen_type screen_type); +int get_icon_height(enum screen_type screen_type); #endif #endif /*_GUI_ICON_H_*/ diff -ru rockbox6/apps/gui/list.c rockbox/apps/gui/list.c --- rockbox6/apps/gui/list.c 2008-01-09 18:32:11.000000000 +0100 +++ rockbox/apps/gui/list.c 2008-01-10 00:30:28.000000000 +0100 @@ -68,6 +68,7 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, int offset); + /* * Initializes a scrolling list * - gui_list : the list structure to initialize @@ -155,12 +156,32 @@ } #endif + + +void gui_synclist_draw(struct gui_synclist *gui_list); /* * Draws the list on the attached screen * - gui_list : the list structure */ static void gui_list_draw_smart(struct gui_synclist *gui_list, struct screen * display) { + struct viewport vp = + { + .x = 0, + .y = 0, + .width = LCD_WIDTH, + .height = LCD_HEIGHT, + .font = FONT_SYSFIXED, + .drawmode = DRMODE_SOLID, + .xmargin = 0, + .ymargin = 0, + .fg_pattern = LCD_DEFAULT_FG, + .bg_pattern = LCD_DEFAULT_BG, + .lss_pattern = LCD_DEFAULT_BG, + .lse_pattern = LCD_DEFAULT_BG, + .lst_pattern = LCD_DEFAULT_BG, + }; + display->set_viewport(&vp); int text_pos; bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons); bool draw_cursor; @@ -173,6 +194,9 @@ #endif int start, end; bool partial_draw = false; + int icon_width=get_icon_width(display->screen_type); + int icon_height=get_icon_height(display->screen_type); + #ifdef HAVE_LCD_BITMAP switch (gui_list_context) /* Set appropriate font */ @@ -192,8 +216,18 @@ default: debugf("gui_list_put_selection_in_screen(): unknown font context: %i\n", gui_list_context); } + int width, height; + display->getstringsize((unsigned char *)"M", &width, &height); #endif gui_textarea_update_nblines(display); + int nb_lines; + bool use_custom_list = display->screen_type == SCREEN_MAIN && global_settings.listlines; + + if (use_custom_list) { + nb_lines = global_settings.listlines; + } else { + nb_lines = display->nb_lines; + } /* Speed up UI by drawing the changed contents only. */ if (gui_list == last_list_displayed @@ -203,7 +237,7 @@ partial_draw = true; } - lines = display->nb_lines - SHOW_LIST_TITLE; + lines = nb_lines - SHOW_LIST_TITLE; if (last_lines[display->screen_type] != lines) { gui_list_select_at_offset(gui_list, 0); @@ -229,7 +263,7 @@ { gui_textarea_clear(display); start = 0; - end = display->nb_lines; + end=nb_lines; gui_list->last_displayed_start_item[display->screen_type] = gui_list->start_item[display->screen_type]; last_list_displayed = gui_list; } @@ -241,9 +275,21 @@ { if (gui_list->title_icon != NOICON && draw_icons) { - screen_put_icon(display, 0, 0, gui_list->title_icon); + if (use_custom_list) { #ifdef HAVE_LCD_BITMAP - text_pos = get_icon_width(display->screen_type)+2; /* pixels */ + int icon_pos_x=global_settings.listxpos; + int icon_pos_y=global_settings.listypos; + + if ( height > icon_height )/* center the cursor */ + icon_pos_y += (height - icon_height) / 2; + + screen_put_iconxy(display, icon_pos_x, icon_pos_y, gui_list->title_icon); +#endif + } else { + screen_put_icon(display, 0, 0, gui_list->title_icon); + } +#ifdef HAVE_LCD_BITMAP + text_pos = icon_width+2; /* pixels */ #else text_pos = 1; /* chars */ #endif @@ -262,10 +308,19 @@ title_style |= gui_list->title_color; } #endif - screen_set_xmargin(display, text_pos); /* margin for title */ + if (use_custom_list) { + display->setmargins(global_settings.listxpos+text_pos, + global_settings.listypos); + vp.width = global_settings.listxpos+global_settings.listwidth; + } else { + display->setmargins(text_pos, + (global_settings.statusbar?STATUSBAR_HEIGHT:0)); + vp.width = LCD_WIDTH; + } + item_offset = gui_list_get_item_offset(gui_list, gui_list->title_width, text_pos, display); - if (item_offset > gui_list->title_width - (display->width - text_pos)) + if (item_offset > display->getwidth()) display->puts_style_offset(0, 0, gui_list->title, title_style, item_offset); else @@ -286,16 +341,21 @@ draw_cursor = !global_settings.cursor_style && gui_list->show_selection_marker; text_pos = 0; /* here it's in pixels */ + if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's a title */ { text_pos += SCROLLBAR_WIDTH; } - if(draw_cursor) - text_pos += get_icon_width(display->screen_type) + 2; if(draw_icons) - text_pos += get_icon_width(display->screen_type) + 2; + if (!use_custom_list && draw_cursor) /* against a glitch when not using custom list, + cursor line selector */ + text_pos += icon_width+icon_width+2; + else + text_pos += icon_width + 2; + else + text_pos += 2; #else draw_cursor = true; if(draw_icons) @@ -305,13 +365,21 @@ #endif #ifdef HAVE_LCD_BITMAP - screen_set_xmargin(display, text_pos); /* margin for list */ + if (use_custom_list) { + display->setmargins(global_settings.listxpos+text_pos+(!draw_scrollbar && !SHOW_LIST_TITLE?SCROLLBAR_WIDTH:0), + global_settings.listypos); + vp.width = global_settings.listxpos+global_settings.listwidth; + } else { + display->setmargins(text_pos, + (global_settings.statusbar?STATUSBAR_HEIGHT:0)); + vp.width = LCD_WIDTH; + } #endif if (SHOW_LIST_TITLE) { start++; - if (end < display->nb_lines) + if (end < nb_lines) end++; } @@ -385,7 +453,7 @@ style = STYLE_GRADIENT; /* Make the lcd driver know how many lines the gradient should - cover and current line number */ + cover and current line number */ /* number of selected lines */ style |= NUMLN_PACK(gui_list->selected_size); /* current line number, zero based */ @@ -399,7 +467,7 @@ draw_cursor = false; } /* if the text is smaller than the viewport size */ - if (item_offset > item_width - (display->width - text_pos)) + if (item_offset > display->getwidth()) { /* don't scroll */ display->puts_style_offset(0, i, entry_name, @@ -453,8 +521,22 @@ #ifdef HAVE_LCD_BITMAP int x = draw_cursor?1:0; int x_off = (draw_scrollbar || SHOW_LIST_TITLE) ? SCROLLBAR_WIDTH: 0; - screen_put_icon_with_offset(display, x, i, + + if (use_custom_list) { + int icon_pos_x=global_settings.listxpos+x_off; + int icon_pos_y=global_settings.listypos+i*height; + + if ( !draw_scrollbar && !SHOW_LIST_TITLE) + icon_pos_x += SCROLLBAR_WIDTH; + + if ( height > icon_height)/* center the cursor */ + icon_pos_y += (height - icon_height) / 2; + + screen_put_iconxy(display, icon_pos_x, icon_pos_y, icon); + } else { + screen_put_icon_with_offset(display, x, i, x_off, 0, icon); + } #else screen_put_icon(display, 1, i, icon); #endif @@ -467,20 +549,29 @@ if(draw_scrollbar) { int y_start = gui_textarea_get_ystart(display); + int x_start =0; + + if (use_custom_list) + { + y_start=global_settings.listypos; + x_start=global_settings.listxpos; + } if (SHOW_LIST_TITLE) y_start += display->char_height; int scrollbar_y_end = display->char_height * lines + y_start; - gui_scrollbar_draw(display, 0, y_start, SCROLLBAR_WIDTH-1, - scrollbar_y_end - y_start, gui_list->nb_items, - gui_list->start_item[display->screen_type], - gui_list->start_item[display->screen_type] + lines, VERTICAL); - } + gui_scrollbar_draw(display, x_start, y_start, SCROLLBAR_WIDTH-1, + scrollbar_y_end - y_start, gui_list->nb_items, + gui_list->start_item[display->screen_type], + gui_list->start_item[display->screen_type] + lines, VERTICAL); + } screen_set_xmargin(display, old_margin); #endif gui_textarea_update(display); + /* reseting viewport */ + display->set_viewport(NULL); } /* @@ -496,14 +587,21 @@ } } - - /* sets up the list so the selection is shown correctly on the screen */ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, enum screen_type screen) { struct screen *display = &screens[screen]; - int nb_lines = display->nb_lines - SHOW_LIST_TITLE; + screens[screen].update_viewport(); + screens[screen].update(); + int nb_lines; + bool use_custom_list=display->screen_type== SCREEN_MAIN && + global_settings.listlines; + if (use_custom_list) { + nb_lines = global_settings.listlines - SHOW_LIST_TITLE; + } else { + nb_lines = display->nb_lines - SHOW_LIST_TITLE; + } int difference = gui_list->selected_item - gui_list->start_item[screen]; /* edge case,, selected last item */ @@ -650,7 +748,15 @@ FOR_NB_SCREENS(i) { gui_textarea_update_nblines(&screens[i]); - int nb_lines = screens[i].nb_lines; + struct screen * display = &screens[i]; + int nb_lines; + bool use_custom_list=display->screen_type==SCREEN_MAIN && + global_settings.listlines; + if (use_custom_list) { + nb_lines = global_settings.listlines; + } else { + nb_lines = display->nb_lines; + } int dist_start_from_end = gui_list->nb_items - gui_list->start_item[i] - 1; @@ -736,13 +842,31 @@ static void gui_synclist_select_next_page(struct gui_synclist * lists, enum screen_type screen) { - gui_list_select_at_offset(lists, screens[screen].nb_lines); + bool use_custom_list=screen==SCREEN_MAIN && global_settings.listlines; + int nb_lines; + + if (use_custom_list) { + nb_lines = global_settings.listlines; + } else { + nb_lines = screens[screen].nb_lines; + } + + gui_list_select_at_offset(lists, nb_lines); } static void gui_synclist_select_previous_page(struct gui_synclist * lists, enum screen_type screen) { - gui_list_select_at_offset(lists, -screens[screen].nb_lines); + bool use_custom_list=screen==SCREEN_MAIN && global_settings.listlines; + int nb_lines; + + if (use_custom_list) { + nb_lines = global_settings.listlines; + } else { + nb_lines = screens[screen].nb_lines; + } + + gui_list_select_at_offset(lists, -nb_lines); } void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll) diff -ru rockbox6/apps/gui/quickscreen.c rockbox/apps/gui/quickscreen.c --- rockbox6/apps/gui/quickscreen.c 2008-01-09 17:23:56.000000000 +0100 +++ rockbox/apps/gui/quickscreen.c 2008-01-09 17:29:10.000000000 +0100 @@ -50,6 +50,18 @@ */ static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) { + int mfont_h; + display->setfont(FONT_MENU); + display->getstringsize("A", NULL, &mfont_h); + + int gsx = global_settings.listxpos; + int gsw = global_settings.listwidth; + int gsh = global_settings.listypos+global_settings.listlines*mfont_h; + int bgsx = (gsx?gsx-2:0); + + if (!gsh) gsh = display->height; + if (!gsw) gsw = display->width; + const unsigned char *option; const unsigned char *title; int w, font_h; @@ -62,8 +74,6 @@ { display->setfont(FONT_SYSFIXED); } - else - display->setfont(FONT_MENU); if(display->depth > 2) display->set_foreground(global_settings.fg_color); display->getstringsize("A", NULL, &font_h); @@ -72,15 +82,19 @@ const unsigned int puts_center = display->height/2/font_h; const unsigned int puts_bottom = display->height/font_h; const unsigned int putsxy_center = display->height/2; - const unsigned int putsxy_bottom = display->height; + const unsigned int putsxy_bottom = gsh; /* Displays the first line of text */ option=(unsigned char *)option_select_get_text(qs->left_option); title=(unsigned char *)qs->left_option->title; - display->puts_scroll(2, puts_center-4+!statusbar, title); - display->puts_scroll(2, puts_center-3+!statusbar, option); - display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1, - putsxy_center-(font_h*3), 7, 8); + int ypos=puts_center-4; + if(ypos<0){ + ypos=0; + } + display->puts_scroll(gsx/6+2, ypos, title); + ypos++; + display->puts_scroll(gsx/6+2, ypos, option); + display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], bgsx+1, ypos*font_h, 7, 8); /* Displays the second line of text */ option=(unsigned char *)option_select_get_text(qs->right_option); @@ -88,21 +102,21 @@ display->getstringsize(title, &w, NULL); if(w > display->width - 8) { - display->puts_scroll(2, puts_center-2+!statusbar, title); + display->puts_scroll(2, puts_center-2, title); display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1, putsxy_center-font_h, 7, 8); } else { - display->putsxy(display->width - w - 12, putsxy_center-font_h, title); + display->putsxy(gsx+gsw - w - 12, putsxy_center-2*font_h, title); display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], - display->width - 8, putsxy_center-font_h, 7, 8); + gsx+gsw - 8, putsxy_center-font_h, 7, 8); } display->getstringsize(option, &w, NULL); if(w > display->width) - display->puts_scroll(0, puts_center-1+!statusbar, option); + display->puts_scroll(0, puts_center-1, option); else - display->putsxy(display->width -w-12, putsxy_center, option); + display->putsxy(gsx+gsw -w-12, putsxy_center-font_h, option); /* Displays the third line of text */ option=(unsigned char *)option_select_get_text(qs->bottom_option); @@ -110,15 +124,15 @@ display->getstringsize(title, &w, NULL); if(w > display->width) - display->puts_scroll(0, puts_bottom-4+!statusbar, title); + display->puts_scroll(0, puts_bottom-4, title); else - display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*3), title); + display->putsxy(gsx+gsw/2-w/2, putsxy_bottom-(font_h*3), title); display->getstringsize(option, &w, NULL); if(w > display->width) - display->puts_scroll(0, puts_bottom-3+!statusbar, option); + display->puts_scroll(0, puts_bottom-3, option); else - display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*2), option); + display->putsxy(gsx+gsw/2-w/2, putsxy_bottom-(font_h*2), option); display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->width/2-4, putsxy_bottom-font_h, 7, 8); diff -ru rockbox6/apps/settings.c rockbox/apps/settings.c --- rockbox6/apps/settings.c 2008-01-09 17:23:56.000000000 +0100 +++ rockbox/apps/settings.c 2008-01-09 17:29:10.000000000 +0100 @@ -287,6 +287,12 @@ global_settings.fg_color=LCD_DEFAULT_FG; global_settings.bg_color=LCD_DEFAULT_BG; #endif +#ifdef HAVE_LCD_BITMAP + global_settings.listxpos=0; + global_settings.listypos=0; + global_settings.listlines=0; + global_settings.listwidth=0; +#endif } bool settings_load_config(const char* file, bool apply) diff -ru rockbox6/apps/settings.h rockbox/apps/settings.h --- rockbox6/apps/settings.h 2008-01-09 17:23:56.000000000 +0100 +++ rockbox/apps/settings.h 2008-01-09 17:29:10.000000000 +0100 @@ -684,6 +684,14 @@ #endif bool audioscrobbler; /* Audioscrobbler logging */ +#ifdef HAVE_LCD_BITMAP + /* custom coordinates/settings for the lists (Menus/File list) */ + int listxpos; + int listypos; + int listlines; + int listwidth; +#endif + /* If values are just added to the end, no need to bump plugin API version. */ /* new stuff to be added at the end */ diff -ru rockbox6/apps/settings_list.c rockbox/apps/settings_list.c --- rockbox6/apps/settings_list.c 2008-01-09 17:23:55.000000000 +0100 +++ rockbox/apps/settings_list.c 2008-01-09 17:29:10.000000000 +0100 @@ -1122,6 +1122,14 @@ #endif #endif OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", NULL), + +#ifdef HAVE_LCD_BITMAP + {F_T_INT,&global_settings.listxpos,-1,INT(0),"listxpos",NULL,UNUSED}, + {F_T_INT,&global_settings.listypos,-1,INT(0),"listypos",NULL,UNUSED}, + {F_T_INT,&global_settings.listlines,-1,INT(0),"listlines",NULL,UNUSED}, + {F_T_INT,&global_settings.listwidth,-1,INT(0),"listwidth",NULL,UNUSED}, +#endif + CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files,db,wps,menu," #ifdef HAVE_RECORDING