Index: apps/gui/bitmap/list.c =================================================================== --- apps/gui/bitmap/list.c (Revision 16800) +++ apps/gui/bitmap/list.c (Arbeitskopie) @@ -40,6 +40,9 @@ #include "misc.h" #include "talk.h" #include "viewport.h" +/* +#include "debug.h" +*/ #define SCROLLBAR_WIDTH 6 #define ICON_PADDING 1 @@ -78,7 +81,12 @@ if (!list_display_title(list, parent)) return false; *vp_text = *parent; + vp_text->x = global_settings.listxpos; + vp_text->y = global_settings.listypos; + if (global_settings.statusbar && (vp_text->y < STATUSBAR_HEIGHT)) + vp_text->y = STATUSBAR_HEIGHT; vp_text->height = list_title_height(list, parent); + vp_text->width = global_settings.listwidth; if (list->title_icon != Icon_NOICON && global_settings.show_icons) { *vp_icons = *vp_text; @@ -86,12 +94,17 @@ + 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->width -= vp_icons->width; + vp_text->x += vp_icons->width; display->set_viewport(vp_icons); screen_put_icon(display, 0, 0, list->title_icon); } +/* + DEBUGF("Global settings:\nx\t%d\ny\t%d\nwidth\t%d\nheight\t%d\n\n",global_settings.listxpos, + global_settings.listypos,global_settings.listwidth,global_settings.listheight); + DEBUGF("Titel viewport:\nx\t%d\ny\t%d\nwidth\t%d\nheight\t%d\n\n",vp_text->x,vp_text->y,vp_text->width,vp_text->height); +*/ display->set_viewport(vp_text); vp_text->drawmode = STYLE_DEFAULT; #ifdef HAVE_LCD_COLOR @@ -114,35 +127,59 @@ #ifdef HAVE_LCD_COLOR unsigned char cur_line = 0; #endif - int item_offset; + int item_offset, statusbar; bool show_title; + statusbar = global_settings.statusbar?STATUSBAR_HEIGHT+1:0; line_height = font_get(parent->font)->height; display->set_viewport(parent); display->clear_viewport(); display->stop_scroll(); list_text[display->screen_type] = *parent; + + list_text[display->screen_type].width = global_settings.listwidth; + list_text[display->screen_type].x = global_settings.listxpos; + list_text[display->screen_type].height = global_settings.listheight - statusbar; + list_text[display->screen_type].y = global_settings.listypos + + ((global_settings.listypos < statusbar)?statusbar:0); if ((show_title = draw_title(display, parent, list))) { - list_text[display->screen_type].y += list_title_height(list, parent); - list_text[display->screen_type].height -= list_title_height(list, parent); + list_text[display->screen_type].y += title_text->height; + list_text[display->screen_type].height -= title_text->height; } - +/* + DEBUGF("List Text:\nx\t%d\ny\t%d\nwidth\t%d\nheight\t%d\n\n",list_text[display->screen_type].x,list_text[display->screen_type].y,list_text[display->screen_type].width,list_text[display->screen_type].height); +*/ + start = list->start_item[display->screen_type]; end = start + viewport_get_nb_lines(&list_text[display->screen_type]); - + /* draw the scrollbar if its needed */ - if (global_settings.scrollbar && - viewport_get_nb_lines(&list_text[display->screen_type]) < list->nb_items) + bool draw_scrollbar = (global_settings.scrollbar && + viewport_get_nb_lines(&list_text[display->screen_type]) + < list->nb_items); +/* + DEBUGF("nb_items:\t%d\n",list->nb_items); +*/ + if (draw_scrollbar) { struct viewport vp; vp = list_text[display->screen_type]; + /* looks nicer with 1pix indent if listxpos == 0 */ + vp.x = (global_settings.listxpos) + (global_settings.listxpos?0:1); vp.width = SCROLLBAR_WIDTH; - list_text[display->screen_type].width -= SCROLLBAR_WIDTH; - list_text[display->screen_type].x += SCROLLBAR_WIDTH; - vp.height = line_height * - viewport_get_nb_lines(&list_text[display->screen_type]); - vp.x = parent->x; + list_text[display->screen_type].width -= vp.width; + list_text[display->screen_type].x += vp.width; + + /* shorten scrollbar to fit the lines */ + vp.height = line_height * + viewport_get_nb_lines(&list_text[display->screen_type]); +/* + DEBUGF("vp_get_nb_lines:\t%d\n",viewport_get_nb_lines(&list_text[display->screen_type])); +*/ display->set_viewport(&vp); +/* + DEBUGF("Scrollbar:\nx\t%d\ny\t%d\nwidth\t%d\nheight\t%d\n\n",vp.x,vp.y,vp.width,vp.height); +*/ gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, vp.height, list->nb_items, list->start_item[display->screen_type], Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (Revision 16800) +++ apps/gui/list.c (Arbeitskopie) @@ -38,6 +38,7 @@ #include "misc.h" #include "talk.h" #include "viewport.h" +//#include "debug.h" #ifdef HAVE_LCD_CHARCELLS #define SCROLL_LIMIT 1 @@ -232,7 +233,11 @@ struct viewport vp = *gui_list->parent[screen]; #ifdef HAVE_LCD_BITMAP if (list_display_title(gui_list, gui_list->parent[screen])) + { + vp.height = global_settings.listheight; vp.height -= list_title_height(gui_list,gui_list->parent[screen]); + } + vp.height -= (global_settings.statusbar?STATUSBAR_HEIGHT:0); #endif nb_lines = viewport_get_nb_lines(&vp); Index: apps/settings.h =================================================================== --- apps/settings.h (Revision 16800) +++ apps/settings.h (Arbeitskopie) @@ -724,6 +724,14 @@ int keyclick_repeats; /* keyclick on repeats */ #endif unsigned char playlist_catalog_dir[MAX_FILENAME+1]; +#ifdef HAVE_LCD_BITMAP + /* custom coordinates/settings for the lists (Menus/File list) */ + int listxpos; + int listypos; + int listheight; + int listwidth; +#endif + }; /** global variables **/ Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 16800) +++ apps/settings_list.c (Arbeitskopie) @@ -1197,6 +1197,15 @@ "remote viewers iconset", "", ICON_DIR "/", ".bmp", MAX_FILENAME+1), #endif /* HAVE_REMOTE_LCD */ + + /* Customizable list */ +#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.listheight,-1,INT(LCD_HEIGHT),"listheight",NULL,UNUSED}, + {F_T_INT,&global_settings.listwidth,-1,INT(LCD_WIDTH),"listwidth",NULL,UNUSED}, +#endif + #ifdef HAVE_LCD_COLOR FILENAME_SETTING(F_THEMESETTING, colors_file, "filetype colours", "-", THEME_DIR "/", ".colours", MAX_FILENAME+1),