A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Touchscreen: Show a line separator in lists.

This patch adds a configurable line separator between list items, very
similar to lists in Android. Additionally, below the list item there is a
thicker line. It can be disabled in the settings. Its color can
be configured as well.

Remote and monochrome displays are explicitly unsupported. If there is desire
this can be changed but it doesn't seem useful to me.

Change-Id: I005313b0d8f5ecd15864bf20e66ea4e3390d8b7d

+116 -14
+12 -1
apps/gui/bitmap/list.c
··· 106 line.height = list->line_height[screen]; 107 title_text_vp->height = line.height; 108 109 #ifdef HAVE_LCD_COLOR 110 if (list->title_color >= 0) 111 line.style |= (STYLE_COLORED|list->title_color); ··· 154 155 linedes.height = list->line_height[screen]; 156 linedes.nlines = list->selected_size; 157 - 158 start = list_start_item; 159 end = start + nb_lines; 160
··· 106 line.height = list->line_height[screen]; 107 title_text_vp->height = line.height; 108 109 + #if LCD_DEPTH > 1 110 + /* XXX: Do we want to support the separator on remote displays? */ 111 + if (display->screen_type == SCREEN_MAIN && global_settings.list_separator_height != 0) 112 + line.separator_height = abs(global_settings.list_separator_height) 113 + + (lcd_get_dpi() > 200 ? 2 : 1); 114 + #endif 115 + 116 #ifdef HAVE_LCD_COLOR 117 if (list->title_color >= 0) 118 line.style |= (STYLE_COLORED|list->title_color); ··· 161 162 linedes.height = list->line_height[screen]; 163 linedes.nlines = list->selected_size; 164 + #if LCD_DEPTH > 1 165 + /* XXX: Do we want to support the separator on remote displays? */ 166 + if (display->screen_type == SCREEN_MAIN) 167 + linedes.separator_height = abs(global_settings.list_separator_height); 168 + #endif 169 start = list_start_item; 170 end = start + nb_lines; 171
+26 -4
apps/gui/line.c
··· 305 int style = line->style; 306 int width = display->getwidth(); 307 int height = line->height == -1 ? display->getcharheight() : line->height; 308 309 /* mask out gradient and colorbar styles for non-color displays */ 310 if (display->depth < 16) ··· 322 #ifdef HAVE_LCD_COLOR 323 case STYLE_GRADIENT: 324 display->set_drawmode(DRMODE_FG); 325 - display->gradient_fillrect_part(x, y, width, height, 326 line->line_color, 327 line->line_end_color, 328 height*line->nlines, ··· 331 case STYLE_COLORBAR: 332 display->set_drawmode(DRMODE_FG); 333 display->set_foreground(line->line_color); 334 - display->fillrect(x, y, width - x, height); 335 break; 336 #endif 337 case STYLE_INVERT: 338 display->set_drawmode(DRMODE_FG); 339 - display->fillrect(x, y, width - x, height); 340 break; 341 case STYLE_DEFAULT: default: 342 display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); 343 - display->fillrect(x, y, width - x, height); 344 break; 345 case STYLE_NONE: 346 break;
··· 305 int style = line->style; 306 int width = display->getwidth(); 307 int height = line->height == -1 ? display->getcharheight() : line->height; 308 + int bar_height = height; 309 + 310 + /* mask out gradient and colorbar styles for non-color displays */ 311 + if (display->depth < 16 && (style & (STYLE_COLORBAR|STYLE_GRADIENT))) 312 + { 313 + style &= ~(STYLE_COLORBAR|STYLE_GRADIENT); 314 + style |= STYLE_INVERT; 315 + } 316 + 317 + if (line->separator_height > 0 && (line->line == line->nlines-1)) 318 + { 319 + int sep_height = MIN(line->separator_height, height); 320 + display->set_drawmode(DRMODE_FG); 321 + #if LCD_DEPTH > 1 322 + display->set_foreground(global_settings.list_separator_color); 323 + #endif 324 + display->fillrect(x, y + height - sep_height, width, sep_height); 325 + bar_height -= sep_height; 326 + #if LCD_DEPTH > 1 327 + display->set_foreground(global_settings.fg_color); 328 + #endif 329 + } 330 331 /* mask out gradient and colorbar styles for non-color displays */ 332 if (display->depth < 16) ··· 344 #ifdef HAVE_LCD_COLOR 345 case STYLE_GRADIENT: 346 display->set_drawmode(DRMODE_FG); 347 + display->gradient_fillrect_part(x, y, width, bar_height, 348 line->line_color, 349 line->line_end_color, 350 height*line->nlines, ··· 353 case STYLE_COLORBAR: 354 display->set_drawmode(DRMODE_FG); 355 display->set_foreground(line->line_color); 356 + display->fillrect(x, y, width - x, bar_height); 357 break; 358 #endif 359 case STYLE_INVERT: 360 display->set_drawmode(DRMODE_FG); 361 + display->fillrect(x, y, width - x, bar_height); 362 break; 363 case STYLE_DEFAULT: default: 364 display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); 365 + display->fillrect(x, y, width - x, bar_height); 366 break; 367 case STYLE_NONE: 368 break;
+4 -1
apps/gui/line.h
··· 74 enum line_styles style; 75 /* whether the line can scroll */ 76 bool scroll; 77 }; 78 79 /* default initializer, can be used for static initialitation also. 80 * This initializer will result in single lines without style that don't scroll */ 81 - #define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .line = 0, .nlines = 1, .scroll = false } 82 83 /** 84 * Print a line at a given pixel postion, using decoration information from
··· 74 enum line_styles style; 75 /* whether the line can scroll */ 76 bool scroll; 77 + /* height of the line separator (in pixels). 0 to disable drawing 78 + * of the separator */ 79 + int8_t separator_height; 80 }; 81 82 /* default initializer, can be used for static initialitation also. 83 * This initializer will result in single lines without style that don't scroll */ 84 + #define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .separator_height = 0, .line = 0, .nlines = 1, .scroll = false } 85 86 /** 87 * Print a line at a given pixel postion, using decoration information from
+28
apps/lang/english.lang
··· 12926 </voice> 12927 </phrase> 12928 <phrase> 12929 id: LANG_SHORTCUTS 12930 desc: Title in the shortcuts menu 12931 user: core
··· 12926 </voice> 12927 </phrase> 12928 <phrase> 12929 + id: LANG_LIST_SEPARATOR 12930 + desc: line between lines in lists 12931 + user: core 12932 + <source> 12933 + *: "Line Separator" 12934 + </source> 12935 + <dest> 12936 + *: "Line Separator" 12937 + </dest> 12938 + <voice> 12939 + *: "Line Separator" 12940 + </voice> 12941 + </phrase> 12942 + <phrase> 12943 + id: LANG_LIST_SEPARATOR_COLOR 12944 + desc: line between lines in lists 12945 + user: core 12946 + <source> 12947 + *: "Line Separator Colour" 12948 + </source> 12949 + <dest> 12950 + *: "Line Separator Colour" 12951 + </dest> 12952 + <voice> 12953 + *: "Line Separator Colour" 12954 + </voice> 12955 + </phrase> 12956 + <phrase> 12957 id: LANG_SHORTCUTS 12958 desc: Title in the shortcuts menu 12959 user: core
+14 -3
apps/menus/theme_menu.c
··· 68 COLOR_LSS, 69 COLOR_LSE, 70 COLOR_LST, 71 COLOR_COUNT 72 }; 73 static struct colour_info ··· 80 [COLOR_LSS] = {&global_settings.lss_color, LANG_SELECTOR_START_COLOR}, 81 [COLOR_LSE] = {&global_settings.lse_color, LANG_SELECTOR_END_COLOR}, 82 [COLOR_LST] = {&global_settings.lst_color, LANG_SELECTOR_TEXT_COLOR}, 83 }; 84 85 /** ··· 91 /* Don't let foreground be set the same as background and vice-versa */ 92 if (c == COLOR_BG) 93 banned_color = *colors[COLOR_FG].setting; 94 - else if (c == COLOR_FG) 95 banned_color = *colors[COLOR_BG].setting; 96 97 old_color = *colors[c].setting; ··· 113 global_settings.lss_color = LCD_DEFAULT_LS; 114 global_settings.lse_color = LCD_DEFAULT_BG; 115 global_settings.lst_color = LCD_DEFAULT_FG; 116 117 settings_save(); 118 settings_apply(false); ··· 129 set_color_func, (void*)COLOR_LSE, NULL, Icon_NOICON); 130 MENUITEM_FUNCTION(set_lst_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_TEXT_COLOR), 131 set_color_func, (void*)COLOR_LST, NULL, Icon_NOICON); 132 MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS), 133 reset_color, NULL, NULL, Icon_NOICON); 134 ··· 140 /* now the actual menu */ 141 MAKE_MENU(colors_settings, ID2P(LANG_COLORS_MENU), 142 NULL, Icon_Display_menu, 143 - &lss_settings, 144 &set_bg_col, &set_fg_col, &reset_colors 145 ); 146 ··· 388 #ifdef HAVE_LCD_BITMAP 389 MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL); 390 #endif 391 392 MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU), 393 NULL, Icon_Wps, ··· 418 #ifdef HAVE_LCD_BITMAP 419 &bars_menu, 420 &cursor_style, 421 #endif 422 #ifdef HAVE_LCD_COLOR 423 &colors_settings, 424 #endif 425 - );
··· 68 COLOR_LSS, 69 COLOR_LSE, 70 COLOR_LST, 71 + COLOR_SEP, 72 COLOR_COUNT 73 }; 74 static struct colour_info ··· 81 [COLOR_LSS] = {&global_settings.lss_color, LANG_SELECTOR_START_COLOR}, 82 [COLOR_LSE] = {&global_settings.lse_color, LANG_SELECTOR_END_COLOR}, 83 [COLOR_LST] = {&global_settings.lst_color, LANG_SELECTOR_TEXT_COLOR}, 84 + [COLOR_SEP] = {&global_settings.list_separator_color, LANG_LIST_SEPARATOR_COLOR}, 85 }; 86 87 /** ··· 93 /* Don't let foreground be set the same as background and vice-versa */ 94 if (c == COLOR_BG) 95 banned_color = *colors[COLOR_FG].setting; 96 + else if (c == COLOR_FG || c == COLOR_SEP) 97 banned_color = *colors[COLOR_BG].setting; 98 99 old_color = *colors[c].setting; ··· 115 global_settings.lss_color = LCD_DEFAULT_LS; 116 global_settings.lse_color = LCD_DEFAULT_BG; 117 global_settings.lst_color = LCD_DEFAULT_FG; 118 + global_settings.list_separator_color = LCD_DARKGRAY; 119 120 settings_save(); 121 settings_apply(false); ··· 132 set_color_func, (void*)COLOR_LSE, NULL, Icon_NOICON); 133 MENUITEM_FUNCTION(set_lst_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_TEXT_COLOR), 134 set_color_func, (void*)COLOR_LST, NULL, Icon_NOICON); 135 + MENUITEM_FUNCTION(set_sep_col, MENU_FUNC_USEPARAM, ID2P(LANG_LIST_SEPARATOR_COLOR), 136 + set_color_func, (void*)COLOR_SEP, NULL, Icon_NOICON); 137 MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS), 138 reset_color, NULL, NULL, Icon_NOICON); 139 ··· 145 /* now the actual menu */ 146 MAKE_MENU(colors_settings, ID2P(LANG_COLORS_MENU), 147 NULL, Icon_Display_menu, 148 + &lss_settings, &set_sep_col, 149 &set_bg_col, &set_fg_col, &reset_colors 150 ); 151 ··· 393 #ifdef HAVE_LCD_BITMAP 394 MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL); 395 #endif 396 + #if LCD_DEPTH > 1 397 + MENUITEM_SETTING(sep_menu, &global_settings.list_separator_height, NULL); 398 + #endif 399 400 MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU), 401 NULL, Icon_Wps, ··· 426 #ifdef HAVE_LCD_BITMAP 427 &bars_menu, 428 &cursor_style, 429 + #if LCD_DEPTH > 1 430 + &sep_menu, 431 #endif 432 #ifdef HAVE_LCD_COLOR 433 &colors_settings, 434 #endif 435 + #endif /* HAVE_LCD_BITMAP */ 436 + );
+5 -2
apps/settings.h
··· 531 #ifdef HAVE_LCD_BITMAP 532 int scrollbar; /* SCROLLBAR_* enum values */ 533 int scrollbar_width; 534 - #endif 535 536 #ifdef HAVE_TOUCHSCREEN 537 int list_line_padding; 538 #endif 539 - 540 /* goto current song when exiting WPS */ 541 bool browse_current; /* 1=goto current song, 542 0=goto previous location */
··· 531 #ifdef HAVE_LCD_BITMAP 532 int scrollbar; /* SCROLLBAR_* enum values */ 533 int scrollbar_width; 534 535 #ifdef HAVE_TOUCHSCREEN 536 int list_line_padding; 537 #endif 538 + #if LCD_DEPTH > 1 539 + int list_separator_height; /* -1=auto (== 1 currently), 0=disabled, X=height in pixels */ 540 + int list_separator_color; 541 + #endif 542 + #endif 543 /* goto current song when exiting WPS */ 544 bool browse_current; /* 1=goto current song, 545 0=goto previous location */
+9 -2
apps/settings_list.c
··· 282 #define DEFAULT_THEME_SELECTOR_START LCD_RGBPACK(0xff, 0xeb, 0x9c) 283 #define DEFAULT_THEME_SELECTOR_END LCD_RGBPACK(0xb5, 0x8e, 0x00) 284 #define DEFAULT_THEME_SELECTOR_TEXT LCD_RGBPACK(0x00, 0x00, 0x00) 285 286 #define DEFAULT_BACKDROP BACKDROP_DIR "/cabbiev2.bmp" 287 ··· 323 #define DEFAULT_TAGCACHE_SCAN_PATHS "/" 324 #endif 325 326 - #ifdef HAVE_TOUCHSCREEN 327 328 static const char* list_pad_formatter(char *buffer, size_t buffer_size, 329 int val, const char *unit) ··· 348 } 349 } 350 351 - #endif /* HAVE_TOUCHSCREEN */ 352 static const char* formatter_unit_0_is_off(char *buffer, size_t buffer_size, 353 int val, const char *unit) 354 { ··· 909 -1, "list padding", "auto,off", UNIT_PIXEL, list_pad_formatter, 910 list_pad_getlang, NULL, 16, 911 -1,0,2,4,6,8,10,12,16,20,24,28,32,38,44,50), 912 #endif 913 #if CONFIG_KEYPAD == RECORDER_PAD 914 OFFON_SETTING(F_THEMESETTING,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
··· 282 #define DEFAULT_THEME_SELECTOR_START LCD_RGBPACK(0xff, 0xeb, 0x9c) 283 #define DEFAULT_THEME_SELECTOR_END LCD_RGBPACK(0xb5, 0x8e, 0x00) 284 #define DEFAULT_THEME_SELECTOR_TEXT LCD_RGBPACK(0x00, 0x00, 0x00) 285 + #define DEFAULT_THEME_SEPARATOR LCD_RGBPACK(0x80, 0x80, 0x80) 286 287 #define DEFAULT_BACKDROP BACKDROP_DIR "/cabbiev2.bmp" 288 ··· 324 #define DEFAULT_TAGCACHE_SCAN_PATHS "/" 325 #endif 326 327 328 static const char* list_pad_formatter(char *buffer, size_t buffer_size, 329 int val, const char *unit) ··· 348 } 349 } 350 351 static const char* formatter_unit_0_is_off(char *buffer, size_t buffer_size, 352 int val, const char *unit) 353 { ··· 908 -1, "list padding", "auto,off", UNIT_PIXEL, list_pad_formatter, 909 list_pad_getlang, NULL, 16, 910 -1,0,2,4,6,8,10,12,16,20,24,28,32,38,44,50), 911 + #endif 912 + #if LCD_DEPTH > 1 913 + TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, list_separator_height, LANG_LIST_SEPARATOR, 914 + 0, "list separator height", "auto,off", UNIT_PIXEL, 915 + list_pad_formatter, list_pad_getlang, NULL, 15, 916 + -1,0,1,2,3,4,5,7,9,11,13,16,20,25,30), 917 + {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.list_separator_color,-1, 918 + INT(DEFAULT_THEME_SEPARATOR),"list separator color",NULL,UNUSED}, 919 #endif 920 #if CONFIG_KEYPAD == RECORDER_PAD 921 OFFON_SETTING(F_THEMESETTING,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
-1
firmware/export/lcd.h
··· 114 #define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \ 115 (h)):STRIDE_REMOTE((w),(h))) 116 117 - 118 #ifdef HAVE_LCD_BITMAP 119 #if LCD_DEPTH <=8 120 #if (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) \
··· 114 #define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \ 115 (h)):STRIDE_REMOTE((w),(h))) 116 117 #ifdef HAVE_LCD_BITMAP 118 #if LCD_DEPTH <=8 119 #if (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) \
+5
wps/WPSLIST
··· 202 show icons: on 203 statusbar: top 204 ui viewport: - 205 </main> 206 207 <remote>
··· 202 show icons: on 203 statusbar: top 204 ui viewport: - 205 + # Touchscreen: whether to show line separators or not. Default to yes only on touchscreen targets. 206 + list separator height: 0 207 + list separator height..+&touchscreen: auto 208 + list separator color: 808080 209 + 210 </main> 211 212 <remote>
+13
wps/wpsbuild.pl
··· 55 my $remotefont; 56 my $fgcolor; 57 my $bgcolor; 58 my $statusbar; 59 my $remotestatusbar; 60 my $author; ··· 291 push @out, "line selector start color: $lineselectstart\n" if($lineselectstart); 292 push @out, "line selector end color: $lineselectend\n" if($lineselectend);; 293 push @out, "line selector text color: $lineselecttextcolor\n" if($lineselecttextcolor); 294 } 295 296 push @out, "font: $font\n" if (defined($font)); ··· 430 undef $remotefont; 431 undef $fgcolor; 432 undef $bgcolor; 433 undef $statusbar; 434 undef $remotestatusbar; 435 undef $author; ··· 501 } 502 elsif($l =~ /^Background Color: *(.*)/i) { 503 $bgcolor = $1; 504 } 505 elsif($l =~ /^line selector start color: *(.*)/i) { 506 $lineselectstart = $1;
··· 55 my $remotefont; 56 my $fgcolor; 57 my $bgcolor; 58 + my $sepcolor; 59 + my $sep; 60 my $statusbar; 61 my $remotestatusbar; 62 my $author; ··· 293 push @out, "line selector start color: $lineselectstart\n" if($lineselectstart); 294 push @out, "line selector end color: $lineselectend\n" if($lineselectend);; 295 push @out, "line selector text color: $lineselecttextcolor\n" if($lineselecttextcolor); 296 + # list separator actually depends on HAVE_TOUCSCREEN 297 + push @out, "list separator height: $sep\n" if($sep); 298 + push @out, "list separator color: $sepcolor\n" if($sepcolor); 299 } 300 301 push @out, "font: $font\n" if (defined($font)); ··· 435 undef $remotefont; 436 undef $fgcolor; 437 undef $bgcolor; 438 + undef $sepcolor; 439 + undef $sep; 440 undef $statusbar; 441 undef $remotestatusbar; 442 undef $author; ··· 508 } 509 elsif($l =~ /^Background Color: *(.*)/i) { 510 $bgcolor = $1; 511 + } 512 + elsif($_ = check_res_feature($l, "list separator color")) { 513 + $sepcolor = $_; 514 + } 515 + elsif($_ = check_res_feature($l, "list separator height")) { 516 + $sep = $_; 517 } 518 elsif($l =~ /^line selector start color: *(.*)/i) { 519 $lineselectstart = $1;