Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (Revision 16821) +++ apps/lang/english.lang (Arbeitskopie) @@ -11576,3 +11576,105 @@ swcodec: "Keyclick Repeats" + + id: LANG_LIST_DIMENSION_SETTINGS + desc: list dimensions settings + user: + + *: none + lcd_bitmap: "List Dimensions" + + + *: none + lcd_bitmap: "List Dimensions" + + + *: none + lcd_bitmap: "List Dimensions" + + + + id: LANG_LIST_XPOS_SETTING + desc: list dimensions xpos settings + user: + + *: none + lcd_bitmap: "Set Horizontal Start Position" + + + *: none + lcd_bitmap: "Set Horizontal Start Position" + + + *: none + lcd_bitmap: "Set Horizontal Start Position" + + + + id: LANG_LIST_YPOS_SETTING + desc: list dimensions ypos settings + user: + + *: none + lcd_bitmap: "Set Vertical Start Position" + + + *: none + lcd_bitmap: "Set Vertical Start Position" + + + *: none + lcd_bitmap: "Set Vertical Start Position" + + + + id: LANG_LIST_WIDTH_SETTING + desc: list dimensions width settings + user: + + *: none + lcd_bitmap: "Set width" + + + *: none + lcd_bitmap: "Set width" + + + *: none + lcd_bitmap: "Set width" + + + + id: LANG_LIST_HEIGHT_SETTING + desc: list dimensions height settings + user: + + *: none + lcd_bitmap: "Set height" + + + *: none + lcd_bitmap: "Set height" + + + *: none + lcd_bitmap: "Set height" + + + + id: LANG_LIST_RESET_LIST + desc: list reset dimensions + user: + + *: none + lcd_bitmap: "Reset List Dimensions" + + + *: none + lcd_bitmap: "Reset List Dimensions" + + + *: none + lcd_bitmap: "Reset List Dimensions" + + Index: apps/gui/bitmap/list.c =================================================================== --- apps/gui/bitmap/list.c (Revision 16821) +++ apps/gui/bitmap/list.c (Arbeitskopie) @@ -40,10 +40,19 @@ #include "misc.h" #include "talk.h" #include "viewport.h" +/* +#include "debug.h" +*/ #define SCROLLBAR_WIDTH 6 #define ICON_PADDING 1 +/* TODO: fix an issue with the configuration of the customlist. With small x + * values the "live" positioning is a bit messed up, since shows the selection + * of the previous selection +*/ + + /* globals */ struct viewport title_text[NB_SCREENS], title_icons[NB_SCREENS], list_text[NB_SCREENS], list_icons[NB_SCREENS]; @@ -78,7 +87,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 +100,18 @@ + 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 @@ -116,33 +136,57 @@ #endif int item_offset; bool show_title; + int 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], @@ -155,7 +199,7 @@ list_text[display->screen_type].width -= SCROLLBAR_WIDTH; list_text[display->screen_type].x += SCROLLBAR_WIDTH; } - + /* setup icon placement */ list_icons[display->screen_type] = list_text[display->screen_type]; int icon_count = global_settings.show_icons && Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (Revision 16821) +++ apps/gui/list.c (Arbeitskopie) @@ -38,6 +38,9 @@ #include "misc.h" #include "talk.h" #include "viewport.h" +/* +#include "debug.h" +*/ #ifdef HAVE_LCD_CHARCELLS #define SCROLL_LIMIT 1 @@ -250,8 +253,16 @@ int difference = gui_list->selected_item - gui_list->start_item[screen]; struct viewport vp = *gui_list->parent[screen]; #ifdef HAVE_LCD_BITMAP + vp.height = global_settings.listheight; + if (list_display_title(gui_list, gui_list->parent[screen])) + { vp.height -= list_title_height(gui_list,gui_list->parent[screen]); + } + vp.height -= (global_settings.statusbar?STATUSBAR_HEIGHT+1:0); +/* + DEBUGF("lines vp height\t%d\n\n",vp.height); +*/ #endif nb_lines = viewport_get_nb_lines(&vp); Index: apps/settings.h =================================================================== --- apps/settings.h (Revision 16821) +++ 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/menus/theme_menu.c =================================================================== --- apps/menus/theme_menu.c (Revision 16821) +++ apps/menus/theme_menu.c (Arbeitskopie) @@ -55,6 +55,31 @@ MENUITEM_FUNCTION(clear_main_bd, 0, ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop, NULL, NULL, Icon_NOICON); #endif + +#ifdef HAVE_LCD_BITMAP +static int reset_list_dimension(void) +{ + global_settings.listxpos=0; + global_settings.listypos=0; + global_settings.listwidth=LCD_WIDTH; + global_settings.listheight=LCD_HEIGHT; + settings_save(); + return 0; +} + +MENUITEM_SETTING(listxpos, &global_settings.listxpos, NULL); +MENUITEM_SETTING(listypos, &global_settings.listypos, NULL); +MENUITEM_SETTING(listwidth, &global_settings.listwidth, NULL); +MENUITEM_SETTING(listheight, &global_settings.listheight, NULL); +MENUITEM_FUNCTION(reset_list_dimensions, 0, ID2P(LANG_LIST_RESET_LIST), + reset_list_dimension, NULL, NULL, Icon_NOICON); + +MAKE_MENU(list_dimensions, ID2P(LANG_LIST_DIMENSION_SETTINGS), + NULL, Icon_NOICON, + &listxpos, &listypos, &listwidth, &listheight, &reset_list_dimensions + ); +#endif + #ifdef HAVE_LCD_COLOR enum Colors { @@ -189,4 +214,7 @@ #ifdef HAVE_LCD_COLOR &colors_settings, #endif +#ifdef HAVE_LCD_BITMAP + &list_dimensions, +#endif ); Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 16821) +++ apps/settings_list.c (Arbeitskopie) @@ -1197,6 +1197,26 @@ "remote viewers iconset", "", ICON_DIR "/", ".bmp", MAX_FILENAME+1), #endif /* HAVE_REMOTE_LCD */ + + /* Customizable list */ +#ifdef HAVE_LCD_BITMAP +/* + #define INT_SETTING(flags, var, lang_id, default, name, \ + unit, min, max, step, formatter, get_talk_id, cb) +*/ + INT_SETTING(0, listxpos, LANG_LIST_XPOS_SETTING, 0, + "listxpos", UNIT_INT, 0, LCD_WIDTH, 1, NULL,NULL,NULL), + + INT_SETTING(0, listypos, LANG_LIST_YPOS_SETTING, 0, + "listypos", UNIT_INT, 0, LCD_HEIGHT, 1, NULL,NULL,NULL), + + INT_SETTING(0, listwidth, LANG_LIST_WIDTH_SETTING,LCD_WIDTH, + "listwidth",UNIT_INT,0,LCD_WIDTH,1,NULL,NULL,NULL), + + INT_SETTING(0, listheight, LANG_LIST_HEIGHT_SETTING,LCD_HEIGHT, + "listheight",UNIT_INT,0,LCD_HEIGHT,1,NULL,NULL,NULL), +#endif + #ifdef HAVE_LCD_COLOR FILENAME_SETTING(F_THEMESETTING, colors_file, "filetype colours", "-", THEME_DIR "/", ".colours", MAX_FILENAME+1),