Index: apps/screen_access.c =================================================================== --- apps/screen_access.c (révision 14835) +++ apps/screen_access.c (copie de travail) @@ -77,6 +77,10 @@ .get_foreground=&lcd_get_foreground, .set_background=&lcd_set_background, .set_foreground=&lcd_set_foreground, +#ifdef HAVE_LCD_COLOR + .set_selector=&lcd_set_selector, + .set_selector_text=&lcd_set_selector_text, +#endif #endif /* LCD_DEPTH > 1 */ .update_rect=&lcd_update_rect, .fillrect=&lcd_fillrect, Index: apps/screen_access.h =================================================================== --- apps/screen_access.h (révision 14835) +++ apps/screen_access.h (copie de travail) @@ -107,6 +107,10 @@ void (*set_background)(unsigned background); void (*set_foreground)(unsigned foreground); #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */ +#if defined(HAVE_LCD_COLOR) + void (*set_selector)(unsigned selector); + void (*set_selector_text)(unsigned selector_text); +#endif void (*update_rect)(int x, int y, int width, int height); void (*fillrect)(int x, int y, int width, int height); void (*drawrect)(int x, int y, int width, int height); Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (révision 14835) +++ apps/lang/english.lang (copie de travail) @@ -2899,15 +2899,15 @@ user: *: none - lcd_bitmap: "Line Selector" + lcd_bitmap: "Line Selector Type" *: none - lcd_bitmap: "Line Selector" + lcd_bitmap: "Line Selector Type" *: none - lcd_bitmap: "Line Selector" + lcd_bitmap: "Line Selector Type" @@ -11242,3 +11242,60 @@ usbstack: "Device Driver" + + id: LANG_SELECTOR_COLOR + desc: line selector color option + user: + + *: "Line Selector Colour" + + + *: "Line Selector Colour" + + + *: "Line Selector Colour" + + + + id: LANG_SELECTOR_TEXT_COLOR + desc: line selector text color option + user: + + *: "Line Selector Text Colour" + + + *: "Line Selector Text Colour" + + + *: "Line Selector Text Colour" + + + + id: LANG_INVERT_CURSOR_COLOR + desc: in settings_menu + user: + + *: "Bar (Solid Colour)" + + + *: "Bar (Solid Colour)" + + + *: "Bar (Solid Colour)" + + + + id: LANG_INVERT_CURSOR_GRADIENT + desc: in settings_menu + user: + + *: "Bar (Gradient Colour)" + + + *: "Bar (Gradient Colour)" + + + *: "Bar (Gradient Colour)" + + + Index: apps/settings.c =================================================================== --- apps/settings.c (révision 14835) +++ apps/settings.c (copie de travail) @@ -778,6 +778,8 @@ #ifdef HAVE_LCD_COLOR screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color); + screens[SCREEN_MAIN].set_selector(global_settings.ls_color); + screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); #endif #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (révision 14835) +++ apps/gui/list.c (copie de travail) @@ -390,10 +390,23 @@ current_item < gui_list->selected_item + gui_list->selected_size) {/* The selected item must be displayed scrolling */ #ifdef HAVE_LCD_BITMAP - if (global_settings.invert_cursor)/* Display inverted-line-style*/ + if (global_settings.invert_cursor == 1) { + /* Display inverted-line-style */ style |= STYLE_INVERT; } +#ifdef HAVE_LCD_COLOR + else if (global_settings.invert_cursor == 2) + { + /* Display colour line selector */ + style |= STYLE_COLORBAR; + } + else if (global_settings.invert_cursor == 3) + { + /* Display gradient line selector */ + style |= STYLE_GRADIENT; + } +#endif else /* if (!global_settings.invert_cursor) */ { if (current_item % gui_list->selected_size != 0) Index: apps/settings.h =================================================================== --- apps/settings.h (révision 14835) +++ apps/settings.h (copie de travail) @@ -412,7 +412,7 @@ int contrast; /* lcd contrast */ #endif bool invert; /* invert display */ - bool invert_cursor; /* invert the current file in dir browser and menu + int invert_cursor; /* invert the current file in dir browser and menu instead of using the default cursor */ bool flip_display; /* turn display (and button layout) by 180 degrees */ int poweroff; /* power off timer */ @@ -641,6 +641,8 @@ #ifdef HAVE_LCD_COLOR int bg_color; /* background color native format */ int fg_color; /* foreground color native format */ + int ls_color; /* background color for the selector */ + int lst_color; /* color of the text for the selector */ #endif bool party_mode; /* party mode - unstoppable music */ Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (révision 14835) +++ apps/menus/display_menu.c (copie de travail) @@ -157,13 +157,42 @@ settings_save(); return res; } + +/* Line selector colour */ +static int set_ls_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_COLOR), + &global_settings.ls_color,-1); + + screens[SCREEN_MAIN].set_selector(global_settings.ls_color); + settings_save(); + return res; +} + +/* Line selector text colour */ +static int set_lst_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_COLOR), + &global_settings.lst_color,global_settings.ls_color); + + screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); + settings_save(); + return res; +} + static int reset_color(void) { global_settings.fg_color = LCD_DEFAULT_FG; global_settings.bg_color = LCD_DEFAULT_BG; + global_settings.ls_color = LCD_DEFAULT_LS; + global_settings.lst_color = LCD_DEFAULT_FG; screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color); + screens[SCREEN_MAIN].set_selector(global_settings.ls_color); + screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); settings_save(); return 0; } @@ -171,6 +200,10 @@ set_bg_color, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR), set_fg_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_ls_col, 0, ID2P(LANG_SELECTOR_COLOR), + set_ls_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_lst_col, 0, ID2P(LANG_SELECTOR_TEXT_COLOR), + set_lst_color, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS), reset_color, NULL, NULL, Icon_NOICON); #endif @@ -210,6 +243,9 @@ # endif ,&invert_cursor #endif /* HAVE_LCD_BITMAP */ +#ifdef HAVE_LCD_COLOR + ,&set_ls_col, &set_lst_col +#endif #if LCD_DEPTH > 1 ,&clear_main_bd, #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (révision 14835) +++ apps/settings_list.c (copie de travail) @@ -457,8 +457,16 @@ OFFON_SETTING(0,flip_display, LANG_FLIP_DISPLAY, false,"flip display", NULL), #endif /* display */ - BOOL_SETTING(F_TEMPVAR, invert_cursor, LANG_INVERT_CURSOR, true ,"invert cursor", off_on, - LANG_INVERT_CURSOR_BAR, LANG_INVERT_CURSOR_POINTER, NULL), + CHOICE_SETTING(F_TEMPVAR|F_THEMESETTING, invert_cursor, LANG_INVERT_CURSOR, 1, + #ifdef HAVE_LCD_COLOR + "selector type", "pointer,bar (inverse),bar (color),bar (gradient)", + NULL, 4, + ID2P(LANG_INVERT_CURSOR_POINTER), ID2P(LANG_INVERT_CURSOR_BAR), + ID2P(LANG_INVERT_CURSOR_COLOR), ID2P(LANG_INVERT_CURSOR_GRADIENT)), + #else + "selector type", "pointer,bar (inverse)", NULL, 2, + ID2P(LANG_INVERT_CURSOR_POINTER), ID2P(LANG_INVERT_CURSOR_BAR)), + #endif OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, LANG_STATUS_BAR, true,"statusbar", NULL), OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL), @@ -625,6 +633,10 @@ "foreground color",NULL,UNUSED}, {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.bg_color,-1,INT(LCD_DEFAULT_BG), "background color",NULL,UNUSED}, + {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.ls_color,-1,INT(LCD_DEFAULT_LS), + "line selector color",NULL,UNUSED}, + {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.lst_color,-1,INT(LCD_DEFAULT_FG), + "line selector text color",NULL,UNUSED}, #endif /* more playback */ OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), Index: firmware/export/scroll_engine.h =================================================================== --- firmware/export/scroll_engine.h (révision 14835) +++ firmware/export/scroll_engine.h (copie de travail) @@ -43,8 +43,12 @@ int startx; #ifdef HAVE_LCD_BITMAP int width; /* length of line in pixels */ - bool invert; /* invert the scrolled text */ +#ifdef HAVE_LCD_COLOR + int invert; /* invert the scrolled text */ +#else + bool invert; #endif +#endif/* HAVE_LCD_BITMAP */ bool backward; /* scroll presently forward or backward? */ bool bidir; long start_tick; Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (révision 14835) +++ firmware/export/lcd.h (copie de travail) @@ -27,6 +27,8 @@ #define STYLE_DEFAULT 0x00000000 #define STYLE_INVERT 0x20000000 #define STYLE_COLORED 0x10000000 +#define STYLE_COLORBAR 0x40000000 +#define STYLE_GRADIENT 0x80000000 #define STYLE_COLOR_MASK 0x0000FFFF #ifdef SIMULATOR @@ -231,6 +233,7 @@ #define LCD_WHITE LCD_RGBPACK(255, 255, 255) #define LCD_DEFAULT_FG LCD_BLACK #define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */ +#define LCD_DEFAULT_LS LCD_WHITE #elif LCD_DEPTH > 1 /* greyscale */ @@ -353,6 +356,10 @@ extern unsigned lcd_get_foreground(void); extern void lcd_set_background(unsigned background); extern unsigned lcd_get_background(void); +#ifdef HAVE_LCD_COLOR +extern void lcd_set_selector(unsigned selector); +extern void lcd_set_selector_text(unsigned selector_text); +#endif extern void lcd_set_drawinfo(int mode, unsigned foreground, unsigned background); void lcd_set_backdrop(fb_data* backdrop); Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (révision 14835) +++ firmware/drivers/lcd-16bit.c (copie de travail) @@ -51,9 +51,13 @@ #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; +static unsigned ls_pattern IDATA_ATTR = LCD_DEFAULT_LS; +static unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG; #else unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; +unsigned ls_pattern IDATA_ATTR = LCD_DEFAULT_LS; +unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG; #endif static int drawmode = DRMODE_SOLID; @@ -103,6 +107,16 @@ return bg_pattern; } +void lcd_set_selector(unsigned color) +{ + ls_pattern = color; +} + +void lcd_set_selector_text(unsigned color) +{ + lst_pattern = color; +} + void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) { lcd_set_drawmode(mode); @@ -796,7 +810,10 @@ int lastmode = drawmode; int oldfgcolor = fg_pattern; int oldbgcolor = bg_pattern; - + int h_r = _RGB_UNPACK_RED(ls_pattern); + int h_b = _RGB_UNPACK_BLUE(ls_pattern); + int h_g = _RGB_UNPACK_GREEN(ls_pattern); + int count = 0; /* make sure scrolling is turned off on the line we are updating */ lcd_scroll_info.lines &= ~(1 << y); @@ -808,16 +825,39 @@ ypos = ymargin + y*h; drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; - if (style & STYLE_COLORED) { + if (style & STYLE_GRADIENT || style & STYLE_COLORBAR) { + fg_pattern = ls_pattern; + } + else if (style & STYLE_COLORED) { if (drawmode == DRMODE_SOLID) fg_pattern = style & STYLE_COLOR_MASK; else bg_pattern = style & STYLE_COLOR_MASK; } - lcd_putsxyofs(xpos, ypos, offset, str); drawmode ^= DRMODE_INVERSEVID; xrect = xpos + MAX(w - offset, 0); - lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); + if (style & STYLE_GRADIENT) { + drawmode = DRMODE_FG; + for(count = 0; count < h; count++) { + lcd_hline(0, LCD_WIDTH , ypos + count); + h_r -= h_r/h; + h_g -= h_g/h; + h_b -= h_b/h; + fg_pattern = _RGBPACK(h_r,h_g,h_b); + } + fg_pattern = lst_pattern; + } + else if (style & STYLE_COLORBAR) { + drawmode = DRMODE_FG; + lcd_fillrect(0, ypos, LCD_WIDTH, h); + fg_pattern = lst_pattern; + } + else { + lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); + drawmode = (style & STYLE_INVERT) ? + (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + } + lcd_putsxyofs(xpos, ypos, offset, str); drawmode = lastmode; fg_pattern = oldfgcolor; bg_pattern = oldbgcolor; @@ -852,8 +892,14 @@ s->start_tick = current_tick + lcd_scroll_info.delay; s->invert = false; if (style & STYLE_INVERT) { - s->invert = true; + s->invert = 1; } + else if (style & STYLE_COLORBAR) { + s->invert = 2; + } + else if (style & STYLE_GRADIENT) { + s->invert = 3; + } lcd_puts_style_offset(x,y,string,style,offset); lcd_getstringsize(string, &w, &h); @@ -908,7 +954,12 @@ int lastmode; unsigned old_fgcolor = fg_pattern; unsigned old_bgcolor = bg_pattern; + int h_r = _RGB_UNPACK_RED(ls_pattern); + int h_b = _RGB_UNPACK_BLUE(ls_pattern); + int h_g = _RGB_UNPACK_GREEN(ls_pattern); + unsigned int count = 0; + for ( index = 0; index < LCD_SCROLLABLE_LINES; index++ ) { /* really scroll? */ if ((lcd_scroll_info.lines & (1 << index)) == 0) @@ -961,8 +1012,26 @@ } lastmode = drawmode; - drawmode = s->invert ? + drawmode = s->invert == 1 ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + if (s->invert == 2) { + fg_pattern = ls_pattern; + drawmode = DRMODE_FG; + lcd_fillrect(0, ypos, LCD_WIDTH, pf->height); + fg_pattern = lst_pattern; + } + else if (s->invert == 3) { + fg_pattern = ls_pattern; + drawmode = DRMODE_FG; + for(count = 0; count < pf->height; count++) { + lcd_hline(0, LCD_WIDTH , ypos + count); + h_r -= h_r/pf->height; + h_g -= h_g/pf->height; + h_b -= h_b/pf->height; + fg_pattern = _RGBPACK(h_r,h_g,h_b); + } + fg_pattern = lst_pattern; + } lcd_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);