diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/gui/bitmap/list.c | 13 | ||||
| -rw-r--r-- | apps/gui/line.c | 30 | ||||
| -rw-r--r-- | apps/gui/line.h | 5 | ||||
| -rw-r--r-- | apps/lang/english.lang | 28 | ||||
| -rw-r--r-- | apps/menus/theme_menu.c | 17 | ||||
| -rw-r--r-- | apps/settings.h | 7 | ||||
| -rw-r--r-- | apps/settings_list.c | 11 |
7 files changed, 98 insertions, 13 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index f1def90..97eefce 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -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; diff --git a/apps/gui/line.c b/apps/gui/line.c index 55100f7..4a51c6e 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c @@ -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; diff --git a/apps/gui/line.h b/apps/gui/line.h index 9a0769d..c14f04d 100644 --- a/apps/gui/line.h +++ b/apps/gui/line.h @@ -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 diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 0778ab7..9914b16 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -12926,6 +12926,34 @@ </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 user: core diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 93511f8..f64ded1 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -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 */ +); diff --git a/apps/settings.h b/apps/settings.h index 62ae038..5b876d3 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 */ diff --git a/apps/settings_list.c b/apps/settings_list.c index 9b1ec44..681a3ab 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -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 |