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