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
This commit is contained in:
parent
20e114c1a0
commit
05a67d021c
10 changed files with 116 additions and 14 deletions
|
@ -106,6 +106,13 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
|
|||
line.height = list->line_height[screen];
|
||||
title_text_vp->height = line.height;
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
/* XXX: Do we want to support the separator on remote displays? */
|
||||
if (display->screen_type == SCREEN_MAIN && global_settings.list_separator_height != 0)
|
||||
line.separator_height = abs(global_settings.list_separator_height)
|
||||
+ (lcd_get_dpi() > 200 ? 2 : 1);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
if (list->title_color >= 0)
|
||||
line.style |= (STYLE_COLORED|list->title_color);
|
||||
|
@ -154,7 +161,11 @@ void list_draw(struct screen *display, struct gui_synclist *list)
|
|||
|
||||
linedes.height = list->line_height[screen];
|
||||
linedes.nlines = list->selected_size;
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
/* XXX: Do we want to support the separator on remote displays? */
|
||||
if (display->screen_type == SCREEN_MAIN)
|
||||
linedes.separator_height = abs(global_settings.list_separator_height);
|
||||
#endif
|
||||
start = list_start_item;
|
||||
end = start + nb_lines;
|
||||
|
||||
|
|
|
@ -305,6 +305,28 @@ static void style_line(struct screen *display,
|
|||
int style = line->style;
|
||||
int width = display->getwidth();
|
||||
int height = line->height == -1 ? display->getcharheight() : line->height;
|
||||
int bar_height = height;
|
||||
|
||||
/* mask out gradient and colorbar styles for non-color displays */
|
||||
if (display->depth < 16 && (style & (STYLE_COLORBAR|STYLE_GRADIENT)))
|
||||
{
|
||||
style &= ~(STYLE_COLORBAR|STYLE_GRADIENT);
|
||||
style |= STYLE_INVERT;
|
||||
}
|
||||
|
||||
if (line->separator_height > 0 && (line->line == line->nlines-1))
|
||||
{
|
||||
int sep_height = MIN(line->separator_height, height);
|
||||
display->set_drawmode(DRMODE_FG);
|
||||
#if LCD_DEPTH > 1
|
||||
display->set_foreground(global_settings.list_separator_color);
|
||||
#endif
|
||||
display->fillrect(x, y + height - sep_height, width, sep_height);
|
||||
bar_height -= sep_height;
|
||||
#if LCD_DEPTH > 1
|
||||
display->set_foreground(global_settings.fg_color);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* mask out gradient and colorbar styles for non-color displays */
|
||||
if (display->depth < 16)
|
||||
|
@ -322,7 +344,7 @@ static void style_line(struct screen *display,
|
|||
#ifdef HAVE_LCD_COLOR
|
||||
case STYLE_GRADIENT:
|
||||
display->set_drawmode(DRMODE_FG);
|
||||
display->gradient_fillrect_part(x, y, width, height,
|
||||
display->gradient_fillrect_part(x, y, width, bar_height,
|
||||
line->line_color,
|
||||
line->line_end_color,
|
||||
height*line->nlines,
|
||||
|
@ -331,16 +353,16 @@ static void style_line(struct screen *display,
|
|||
case STYLE_COLORBAR:
|
||||
display->set_drawmode(DRMODE_FG);
|
||||
display->set_foreground(line->line_color);
|
||||
display->fillrect(x, y, width - x, height);
|
||||
display->fillrect(x, y, width - x, bar_height);
|
||||
break;
|
||||
#endif
|
||||
case STYLE_INVERT:
|
||||
display->set_drawmode(DRMODE_FG);
|
||||
display->fillrect(x, y, width - x, height);
|
||||
display->fillrect(x, y, width - x, bar_height);
|
||||
break;
|
||||
case STYLE_DEFAULT: default:
|
||||
display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID);
|
||||
display->fillrect(x, y, width - x, height);
|
||||
display->fillrect(x, y, width - x, bar_height);
|
||||
break;
|
||||
case STYLE_NONE:
|
||||
break;
|
||||
|
|
|
@ -74,11 +74,14 @@ struct line_desc {
|
|||
enum line_styles style;
|
||||
/* whether the line can scroll */
|
||||
bool scroll;
|
||||
/* height of the line separator (in pixels). 0 to disable drawing
|
||||
* of the separator */
|
||||
int8_t separator_height;
|
||||
};
|
||||
|
||||
/* default initializer, can be used for static initialitation also.
|
||||
* This initializer will result in single lines without style that don't scroll */
|
||||
#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .line = 0, .nlines = 1, .scroll = false }
|
||||
#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .separator_height = 0, .line = 0, .nlines = 1, .scroll = false }
|
||||
|
||||
/**
|
||||
* Print a line at a given pixel postion, using decoration information from
|
||||
|
|
|
@ -12925,6 +12925,34 @@
|
|||
*: "Cancel Sleep Timer"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_LIST_SEPARATOR
|
||||
desc: line between lines in lists
|
||||
user: core
|
||||
<source>
|
||||
*: "Line Separator"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Line Separator"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Line Separator"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_LIST_SEPARATOR_COLOR
|
||||
desc: line between lines in lists
|
||||
user: core
|
||||
<source>
|
||||
*: "Line Separator Colour"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Line Separator Colour"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Line Separator Colour"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_SHORTCUTS
|
||||
desc: Title in the shortcuts menu
|
||||
|
|
|
@ -68,6 +68,7 @@ enum Colors {
|
|||
COLOR_LSS,
|
||||
COLOR_LSE,
|
||||
COLOR_LST,
|
||||
COLOR_SEP,
|
||||
COLOR_COUNT
|
||||
};
|
||||
static struct colour_info
|
||||
|
@ -80,6 +81,7 @@ static struct colour_info
|
|||
[COLOR_LSS] = {&global_settings.lss_color, LANG_SELECTOR_START_COLOR},
|
||||
[COLOR_LSE] = {&global_settings.lse_color, LANG_SELECTOR_END_COLOR},
|
||||
[COLOR_LST] = {&global_settings.lst_color, LANG_SELECTOR_TEXT_COLOR},
|
||||
[COLOR_SEP] = {&global_settings.list_separator_color, LANG_LIST_SEPARATOR_COLOR},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -91,7 +93,7 @@ static int set_color_func(void* color)
|
|||
/* Don't let foreground be set the same as background and vice-versa */
|
||||
if (c == COLOR_BG)
|
||||
banned_color = *colors[COLOR_FG].setting;
|
||||
else if (c == COLOR_FG)
|
||||
else if (c == COLOR_FG || c == COLOR_SEP)
|
||||
banned_color = *colors[COLOR_BG].setting;
|
||||
|
||||
old_color = *colors[c].setting;
|
||||
|
@ -113,6 +115,7 @@ static int reset_color(void)
|
|||
global_settings.lss_color = LCD_DEFAULT_LS;
|
||||
global_settings.lse_color = LCD_DEFAULT_BG;
|
||||
global_settings.lst_color = LCD_DEFAULT_FG;
|
||||
global_settings.list_separator_color = LCD_DARKGRAY;
|
||||
|
||||
settings_save();
|
||||
settings_apply(false);
|
||||
|
@ -129,6 +132,8 @@ MENUITEM_FUNCTION(set_lse_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_END_COLOR)
|
|||
set_color_func, (void*)COLOR_LSE, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(set_lst_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_TEXT_COLOR),
|
||||
set_color_func, (void*)COLOR_LST, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(set_sep_col, MENU_FUNC_USEPARAM, ID2P(LANG_LIST_SEPARATOR_COLOR),
|
||||
set_color_func, (void*)COLOR_SEP, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
|
||||
reset_color, NULL, NULL, Icon_NOICON);
|
||||
|
||||
|
@ -140,7 +145,7 @@ MAKE_MENU(lss_settings, ID2P(LANG_SELECTOR_COLOR_MENU),
|
|||
/* now the actual menu */
|
||||
MAKE_MENU(colors_settings, ID2P(LANG_COLORS_MENU),
|
||||
NULL, Icon_Display_menu,
|
||||
&lss_settings,
|
||||
&lss_settings, &set_sep_col,
|
||||
&set_bg_col, &set_fg_col, &reset_colors
|
||||
);
|
||||
|
||||
|
@ -388,6 +393,9 @@ MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM,
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL);
|
||||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
MENUITEM_SETTING(sep_menu, &global_settings.list_separator_height, NULL);
|
||||
#endif
|
||||
|
||||
MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU),
|
||||
NULL, Icon_Wps,
|
||||
|
@ -418,8 +426,11 @@ MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU),
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
&bars_menu,
|
||||
&cursor_style,
|
||||
#if LCD_DEPTH > 1
|
||||
&sep_menu,
|
||||
#endif
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
&colors_settings,
|
||||
#endif
|
||||
);
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
);
|
||||
|
|
|
@ -531,12 +531,15 @@ struct user_settings
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
int scrollbar; /* SCROLLBAR_* enum values */
|
||||
int scrollbar_width;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
int list_line_padding;
|
||||
#endif
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
int list_separator_height; /* -1=auto (== 1 currently), 0=disabled, X=height in pixels */
|
||||
int list_separator_color;
|
||||
#endif
|
||||
#endif
|
||||
/* goto current song when exiting WPS */
|
||||
bool browse_current; /* 1=goto current song,
|
||||
0=goto previous location */
|
||||
|
|
|
@ -282,6 +282,7 @@ static const char graphic_numeric[] = "graphic,numeric";
|
|||
#define DEFAULT_THEME_SELECTOR_START LCD_RGBPACK(0xff, 0xeb, 0x9c)
|
||||
#define DEFAULT_THEME_SELECTOR_END LCD_RGBPACK(0xb5, 0x8e, 0x00)
|
||||
#define DEFAULT_THEME_SELECTOR_TEXT LCD_RGBPACK(0x00, 0x00, 0x00)
|
||||
#define DEFAULT_THEME_SEPARATOR LCD_RGBPACK(0x80, 0x80, 0x80)
|
||||
|
||||
#define DEFAULT_BACKDROP BACKDROP_DIR "/cabbiev2.bmp"
|
||||
|
||||
|
@ -323,7 +324,6 @@ static const char graphic_numeric[] = "graphic,numeric";
|
|||
#define DEFAULT_TAGCACHE_SCAN_PATHS "/"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
|
||||
static const char* list_pad_formatter(char *buffer, size_t buffer_size,
|
||||
int val, const char *unit)
|
||||
|
@ -348,7 +348,6 @@ static int32_t list_pad_getlang(int value, int unit)
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_TOUCHSCREEN */
|
||||
static const char* formatter_unit_0_is_off(char *buffer, size_t buffer_size,
|
||||
int val, const char *unit)
|
||||
{
|
||||
|
@ -910,6 +909,14 @@ const struct settings_list settings[] = {
|
|||
list_pad_getlang, NULL, 16,
|
||||
-1,0,2,4,6,8,10,12,16,20,24,28,32,38,44,50),
|
||||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, list_separator_height, LANG_LIST_SEPARATOR,
|
||||
0, "list separator height", "auto,off", UNIT_PIXEL,
|
||||
list_pad_formatter, list_pad_getlang, NULL, 15,
|
||||
-1,0,1,2,3,4,5,7,9,11,13,16,20,25,30),
|
||||
{F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.list_separator_color,-1,
|
||||
INT(DEFAULT_THEME_SEPARATOR),"list separator color",NULL,UNUSED},
|
||||
#endif
|
||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||
OFFON_SETTING(F_THEMESETTING,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
|
||||
#endif
|
||||
|
|
|
@ -114,7 +114,6 @@ struct scrollinfo;
|
|||
#define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \
|
||||
(h)):STRIDE_REMOTE((w),(h)))
|
||||
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#if LCD_DEPTH <=8
|
||||
#if (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) \
|
||||
|
|
|
@ -202,6 +202,11 @@ viewers iconset..+x2: icons/tango_small_viewers_mono.bmp
|
|||
show icons: on
|
||||
statusbar: top
|
||||
ui viewport: -
|
||||
# Touchscreen: whether to show line separators or not. Default to yes only on touchscreen targets.
|
||||
list separator height: 0
|
||||
list separator height..+&touchscreen: auto
|
||||
list separator color: 808080
|
||||
|
||||
</main>
|
||||
|
||||
<remote>
|
||||
|
|
|
@ -55,6 +55,8 @@ my $font;
|
|||
my $remotefont;
|
||||
my $fgcolor;
|
||||
my $bgcolor;
|
||||
my $sepcolor;
|
||||
my $sep;
|
||||
my $statusbar;
|
||||
my $remotestatusbar;
|
||||
my $author;
|
||||
|
@ -291,6 +293,9 @@ MOO
|
|||
push @out, "line selector start color: $lineselectstart\n" if($lineselectstart);
|
||||
push @out, "line selector end color: $lineselectend\n" if($lineselectend);;
|
||||
push @out, "line selector text color: $lineselecttextcolor\n" if($lineselecttextcolor);
|
||||
# list separator actually depends on HAVE_TOUCSCREEN
|
||||
push @out, "list separator height: $sep\n" if($sep);
|
||||
push @out, "list separator color: $sepcolor\n" if($sepcolor);
|
||||
}
|
||||
|
||||
push @out, "font: $font\n" if (defined($font));
|
||||
|
@ -430,6 +435,8 @@ while(<WPS>) {
|
|||
undef $remotefont;
|
||||
undef $fgcolor;
|
||||
undef $bgcolor;
|
||||
undef $sepcolor;
|
||||
undef $sep;
|
||||
undef $statusbar;
|
||||
undef $remotestatusbar;
|
||||
undef $author;
|
||||
|
@ -502,6 +509,12 @@ while(<WPS>) {
|
|||
elsif($l =~ /^Background Color: *(.*)/i) {
|
||||
$bgcolor = $1;
|
||||
}
|
||||
elsif($_ = check_res_feature($l, "list separator color")) {
|
||||
$sepcolor = $_;
|
||||
}
|
||||
elsif($_ = check_res_feature($l, "list separator height")) {
|
||||
$sep = $_;
|
||||
}
|
||||
elsif($l =~ /^line selector start color: *(.*)/i) {
|
||||
$lineselectstart = $1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue