FS#7808 by Tom Ross, Ken Fazzone and me, with help from Antoine Cellerier.

Add two new line selector types: solid colour and gradient. Solid colour only uses the primary colour setting.
The secondary colour setting is used for the gradient. Text colour for the selected item is also changeable.
These new settings are a bit controversial so they may be removed later.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14868 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-09-27 15:42:55 +00:00
parent 5353473b72
commit f3b015f73b
14 changed files with 327 additions and 33 deletions

View file

@ -200,7 +200,7 @@ static void draw_screen(struct screen *display, char *title,
set_drawinfo(display, DRMODE_SOLID, text_color, set_drawinfo(display, DRMODE_SOLID, text_color,
background_color); background_color);
if (global_settings.invert_cursor) if (global_settings.cursor_style != 0)
{ {
/* Draw solid bar selection bar */ /* Draw solid bar selection bar */
display->fillrect(0, display->fillrect(0,

View file

@ -141,7 +141,7 @@ static void gui_list_flash(struct gui_list * gui_list)
int selected_line=gui_list->selected_item-gui_list->start_item+SHOW_LIST_TITLE; int selected_line=gui_list->selected_item-gui_list->start_item+SHOW_LIST_TITLE;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
int line_ypos=display->getymargin()+display->char_height*selected_line; int line_ypos=display->getymargin()+display->char_height*selected_line;
if (global_settings.invert_cursor) if (global_settings.cursor_style)
{ {
int line_xpos=display->getxmargin(); int line_xpos=display->getxmargin();
display->set_drawmode(DRMODE_COMPLEMENT); display->set_drawmode(DRMODE_COMPLEMENT);
@ -313,7 +313,7 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
draw_scrollbar = (global_settings.scrollbar && draw_scrollbar = (global_settings.scrollbar &&
lines < gui_list->nb_items); lines < gui_list->nb_items);
draw_cursor = !global_settings.invert_cursor && draw_cursor = !global_settings.cursor_style &&
gui_list->show_selection_marker; gui_list->show_selection_marker;
text_pos = 0; /* here it's in pixels */ text_pos = 0; /* here it's in pixels */
if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's
@ -390,11 +390,28 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
current_item < gui_list->selected_item + gui_list->selected_size) current_item < gui_list->selected_item + gui_list->selected_size)
{/* The selected item must be displayed scrolling */ {/* The selected item must be displayed scrolling */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (global_settings.invert_cursor)/* Display inverted-line-style*/ if (global_settings.cursor_style == 1
#ifdef HAVE_REMOTE_LCD
|| display->screen_type == SCREEN_REMOTE
#endif
)
{ {
/* Display inverted-line-style */
style |= STYLE_INVERT; style |= STYLE_INVERT;
} }
else /* if (!global_settings.invert_cursor) */ #ifdef HAVE_LCD_COLOR
else if (global_settings.cursor_style == 2)
{
/* Display colour line selector */
style |= STYLE_COLORBAR;
}
else if (global_settings.cursor_style == 3)
{
/* Display gradient line selector */
style |= STYLE_GRADIENT;
}
#endif
else /* if (!global_settings.cursor_style) */
{ {
if (current_item % gui_list->selected_size != 0) if (current_item % gui_list->selected_size != 0)
draw_cursor = false; draw_cursor = false;

View file

@ -2899,15 +2899,15 @@
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Line Selector" lcd_bitmap: "Line Selector Type"
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Line Selector" lcd_bitmap: "Line Selector Type"
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Line Selector" lcd_bitmap: "Line Selector Type"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -11242,3 +11242,89 @@
usbstack: "Device Driver" usbstack: "Device Driver"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_SELECTOR_START_COLOR
desc: line selector color option
user:
<source>
*: none
lcd_color: "Line Selector Primary Colour"
</source>
<dest>
*: none
lcd_color: "Line Selector Primary Colour"
</dest>
<voice>
*: none
lcd_color: "Line Selector Primary Colour"
</voice>
</phrase>
<phrase>
id: LANG_SELECTOR_END_COLOR
desc: line selector color option
user:
<source>
*: none
lcd_color: "Line Selector Secondary Colour"
</source>
<dest>
*: none
lcd_color: "Line Selector Secondary Colour"
</dest>
<voice>
*: none
lcd_color: "Line Selector Secondary Colour"
</voice>
</phrase>
<phrase>
id: LANG_SELECTOR_TEXT_COLOR
desc: line selector text color option
user:
<source>
*: none
lcd_color: "Line Selector Text Colour"
</source>
<dest>
*: none
lcd_color: "Line Selector Text Colour"
</dest>
<voice>
*: none
lcd_color: "Line Selector Text Colour"
</voice>
</phrase>
<phrase>
id: LANG_INVERT_CURSOR_COLOR
desc: in settings_menu
user:
<source>
*: none
lcd_color: "Bar (Solid Colour)"
</source>
<dest>
*: none
lcd_color: "Bar (Solid Colour)"
</dest>
<voice>
*: none
lcd_color: "Bar (Solid Colour)"
</voice>
</phrase>
<phrase>
id: LANG_INVERT_CURSOR_GRADIENT
desc: in settings_menu
user:
<source>
*: none
lcd_color: "Bar (Gradient Colour)"
</source>
<dest>
*: none
lcd_color: "Bar (Gradient Colour)"
</dest>
<voice>
*: none
lcd_color: "Bar (Gradient Colour)"
</voice>
</phrase>

View file

@ -115,7 +115,7 @@ MENUITEM_SETTING(invert, &global_settings.invert, NULL);
#ifdef HAVE_LCD_FLIP #ifdef HAVE_LCD_FLIP
MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback); MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback);
#endif #endif
MENUITEM_SETTING(invert_cursor, &global_settings.invert_cursor, NULL); MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL);
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
/** /**
@ -157,13 +157,55 @@ static int set_bg_color(void)
settings_save(); settings_save();
return res; return res;
} }
/* Line selector colour */
static int set_lss_color(void)
{
int res;
res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_START_COLOR),
&global_settings.lss_color,-1);
screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color);
settings_save();
return res;
}
static int set_lse_color(void)
{
int res;
res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_END_COLOR),
&global_settings.lse_color,-1);
screens[SCREEN_MAIN].set_selector_end(global_settings.lse_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_TEXT_COLOR),
&global_settings.lst_color,global_settings.lss_color);
screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
settings_save();
return res;
}
static int reset_color(void) static int reset_color(void)
{ {
global_settings.fg_color = LCD_DEFAULT_FG; global_settings.fg_color = LCD_DEFAULT_FG;
global_settings.bg_color = LCD_DEFAULT_BG; global_settings.bg_color = LCD_DEFAULT_BG;
global_settings.lss_color = LCD_DEFAULT_LS;
global_settings.lse_color = LCD_DEFAULT_BG;
global_settings.lst_color = LCD_DEFAULT_FG;
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
screens[SCREEN_MAIN].set_background(global_settings.bg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color);
screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color);
screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color);
screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
settings_save(); settings_save();
return 0; return 0;
} }
@ -171,6 +213,12 @@ MENUITEM_FUNCTION(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR),
set_bg_color, NULL, NULL, Icon_NOICON); set_bg_color, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR), MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR),
set_fg_color, NULL, NULL, Icon_NOICON); set_fg_color, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(set_lss_col, 0, ID2P(LANG_SELECTOR_START_COLOR),
set_lss_color, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(set_lse_col, 0, ID2P(LANG_SELECTOR_END_COLOR),
set_lse_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), MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
reset_color, NULL, NULL, Icon_NOICON); reset_color, NULL, NULL, Icon_NOICON);
#endif #endif
@ -208,8 +256,11 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
# ifdef HAVE_LCD_FLIP # ifdef HAVE_LCD_FLIP
,&flip_display ,&flip_display
# endif # endif
,&invert_cursor ,&cursor_style
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_COLOR
,&set_lss_col, &set_lse_col, &set_lst_col
#endif
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
,&clear_main_bd, ,&clear_main_bd,
#endif #endif

View file

@ -857,6 +857,16 @@ bool recording_screen(bool no_source)
ID2P(LANG_GIGABYTE) ID2P(LANG_GIGABYTE)
}; };
int style = STYLE_INVERT;
#ifdef HAVE_LCD_COLOR
if (global_settings.cursor_style == 2) {
style |= STYLE_COLORBAR;
}
else if (global_settings.cursor_style == 3) {
style |= STYLE_GRADIENT;
}
#endif
struct audio_recording_options rec_options; struct audio_recording_options rec_options;
if (check_dir(global_settings.rec_directory) == false) if (check_dir(global_settings.rec_directory) == false)
{ {
@ -930,7 +940,7 @@ bool recording_screen(bool no_source)
{ {
screens[i].setfont(FONT_SYSFIXED); screens[i].setfont(FONT_SYSFIXED);
screens[i].getstringsize("M", &w, &h); screens[i].getstringsize("M", &w, &h);
screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8); screens[i].setmargins(global_settings.cursor_style ? 0 : w, 8);
filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0); filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0);
pm_y[i] = 8 + h * (2 + filename_offset[i]); pm_y[i] = 8 + h * (2 + filename_offset[i]);
} }
@ -1331,7 +1341,7 @@ bool recording_screen(bool no_source)
{ {
screens[i].setfont(FONT_SYSFIXED); screens[i].setfont(FONT_SYSFIXED);
screens[i].setmargins( screens[i].setmargins(
global_settings.invert_cursor ? 0 : w, 8); global_settings.cursor_style ? 0 : w, 8);
} }
} }
} }
@ -1555,11 +1565,11 @@ bool recording_screen(bool no_source)
global_settings.volume, global_settings.volume,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (global_settings.invert_cursor && (pos++ == cursor)) if (global_settings.cursor_style && (pos++ == cursor))
{ {
for(i = 0; i < screen_update; i++) for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] + screens[i].puts_style_offset(0, filename_offset[i] +
PM_HEIGHT + 2, buf, STYLE_INVERT,0); PM_HEIGHT + 2, buf, style,0);
} }
else else
{ {
@ -1574,11 +1584,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_MIC_GAIN, fmt_gain(SOUND_MIC_GAIN,
global_settings.rec_mic_gain, global_settings.rec_mic_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) if(global_settings.cursor_style && ((1==cursor)||(2==cursor)))
{ {
for(i = 0; i < screen_update; i++) for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] + screens[i].puts_style_offset(0, filename_offset[i] +
PM_HEIGHT + 3, buf, STYLE_INVERT,0); PM_HEIGHT + 3, buf, style,0);
} }
else else
{ {
@ -1598,11 +1608,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_LEFT_GAIN, fmt_gain(SOUND_LEFT_GAIN,
global_settings.rec_left_gain, global_settings.rec_left_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) if(global_settings.cursor_style && ((1==cursor)||(2==cursor)))
{ {
for(i = 0; i < screen_update; i++) for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] + screens[i].puts_style_offset(0, filename_offset[i] +
PM_HEIGHT + 3, buf, STYLE_INVERT,0); PM_HEIGHT + 3, buf, style,0);
} }
else else
{ {
@ -1616,11 +1626,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_RIGHT_GAIN, fmt_gain(SOUND_RIGHT_GAIN,
global_settings.rec_right_gain, global_settings.rec_right_gain,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) if(global_settings.cursor_style && ((1==cursor)||(3==cursor)))
{ {
for(i = 0; i < screen_update; i++) for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] + screens[i].puts_style_offset(0, filename_offset[i] +
PM_HEIGHT + 4, buf, STYLE_INVERT,0); PM_HEIGHT + 4, buf, style,0);
} }
else else
{ {
@ -1701,11 +1711,11 @@ bool recording_screen(bool no_source)
global_settings.rec_right_gain)/2, global_settings.rec_right_gain)/2,
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if(global_settings.invert_cursor && ((cursor==4) || (cursor==5))) if(global_settings.cursor_style && ((cursor==4) || (cursor==5)))
{ {
for(i = 0; i < screen_update; i++) for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] + screens[i].puts_style_offset(0, filename_offset[i] +
PM_HEIGHT + line[i], buf, STYLE_INVERT,0); PM_HEIGHT + line[i], buf, style,0);
} }
else if ( else if (
global_settings.rec_source == AUDIO_SRC_MIC global_settings.rec_source == AUDIO_SRC_MIC
@ -1737,7 +1747,7 @@ bool recording_screen(bool no_source)
} }
#endif /* HAVE_AGC */ #endif /* HAVE_AGC */
if(!global_settings.invert_cursor) { if(!global_settings.cursor_style) {
switch(cursor) switch(cursor)
{ {
case 1: case 1:

View file

@ -77,6 +77,11 @@ struct screen screens[NB_SCREENS] =
.get_foreground=&lcd_get_foreground, .get_foreground=&lcd_get_foreground,
.set_background=&lcd_set_background, .set_background=&lcd_set_background,
.set_foreground=&lcd_set_foreground, .set_foreground=&lcd_set_foreground,
#ifdef HAVE_LCD_COLOR
.set_selector_start=&lcd_set_selector_start,
.set_selector_end=&lcd_set_selector_end,
.set_selector_text=&lcd_set_selector_text,
#endif
#endif /* LCD_DEPTH > 1 */ #endif /* LCD_DEPTH > 1 */
.update_rect=&lcd_update_rect, .update_rect=&lcd_update_rect,
.fillrect=&lcd_fillrect, .fillrect=&lcd_fillrect,

View file

@ -107,6 +107,11 @@ struct screen
void (*set_background)(unsigned background); void (*set_background)(unsigned background);
void (*set_foreground)(unsigned foreground); void (*set_foreground)(unsigned foreground);
#endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */ #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
#if defined(HAVE_LCD_COLOR)
void (*set_selector_start)(unsigned selector);
void (*set_selector_end)(unsigned selector);
void (*set_selector_text)(unsigned selector_text);
#endif
void (*update_rect)(int x, int y, int width, int height); void (*update_rect)(int x, int y, int width, int height);
void (*fillrect)(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); void (*drawrect)(int x, int y, int width, int height);

View file

@ -778,6 +778,9 @@ void settings_apply(void)
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
screens[SCREEN_MAIN].set_background(global_settings.bg_color); screens[SCREEN_MAIN].set_background(global_settings.bg_color);
screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color);
screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color);
screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
#endif #endif
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)

View file

@ -412,8 +412,7 @@ struct user_settings
int contrast; /* lcd contrast */ int contrast; /* lcd contrast */
#endif #endif
bool invert; /* invert display */ bool invert; /* invert display */
bool invert_cursor; /* invert the current file in dir browser and menu int cursor_style; /* style of the selection cursor */
instead of using the default cursor */
bool flip_display; /* turn display (and button layout) by 180 degrees */ bool flip_display; /* turn display (and button layout) by 180 degrees */
int poweroff; /* power off timer */ int poweroff; /* power off timer */
int backlight_timeout; /* backlight off timeout: 0-18 0=never, int backlight_timeout; /* backlight off timeout: 0-18 0=never,
@ -641,6 +640,9 @@ struct user_settings
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
int bg_color; /* background color native format */ int bg_color; /* background color native format */
int fg_color; /* foreground color native format */ int fg_color; /* foreground color native format */
int lss_color; /* background color for the selector or start color for the gradient */
int lse_color; /* end color for the selector gradient */
int lst_color; /* color of the text for the selector */
#endif #endif
bool party_mode; /* party mode - unstoppable music */ bool party_mode; /* party mode - unstoppable music */

View file

@ -457,8 +457,16 @@ const struct settings_list settings[] = {
OFFON_SETTING(0,flip_display, LANG_FLIP_DISPLAY, false,"flip display", NULL), OFFON_SETTING(0,flip_display, LANG_FLIP_DISPLAY, false,"flip display", NULL),
#endif #endif
/* display */ /* display */
BOOL_SETTING(F_TEMPVAR, invert_cursor, LANG_INVERT_CURSOR, true ,"invert cursor", off_on, CHOICE_SETTING(F_TEMPVAR|F_THEMESETTING, cursor_style, LANG_INVERT_CURSOR, 1,
LANG_INVERT_CURSOR_BAR, LANG_INVERT_CURSOR_POINTER, NULL), #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, OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
LANG_STATUS_BAR, true,"statusbar", NULL), LANG_STATUS_BAR, true,"statusbar", NULL),
OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL), OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL),
@ -625,6 +633,12 @@ const struct settings_list settings[] = {
"foreground color",NULL,UNUSED}, "foreground color",NULL,UNUSED},
{F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.bg_color,-1,INT(LCD_DEFAULT_BG), {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.bg_color,-1,INT(LCD_DEFAULT_BG),
"background color",NULL,UNUSED}, "background color",NULL,UNUSED},
{F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.lss_color,-1,INT(LCD_DEFAULT_LS),
"line selector start color",NULL,UNUSED},
{F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.lse_color,-1,INT(LCD_DEFAULT_BG),
"line selector end 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 #endif
/* more playback */ /* more playback */
OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL),

View file

@ -334,6 +334,7 @@ Peter Harley
Max Kelley Max Kelley
Alexander Eickhoff Alexander Eickhoff
Pinitnun Shanasabang Pinitnun Shanasabang
Ken Fazzone
The libmad team The libmad team
The wavpack team The wavpack team

View file

@ -51,9 +51,15 @@ static long lcd_backdrop_offset IDATA_ATTR = 0;
#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG;
static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG;
static unsigned lss_pattern IDATA_ATTR = LCD_DEFAULT_LS;
static unsigned lse_pattern IDATA_ATTR = LCD_DEFAULT_BG;
static unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG;
#else #else
unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG;
unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG;
unsigned lss_pattern IDATA_ATTR = LCD_DEFAULT_LS;
unsigned lse_pattern IDATA_ATTR = LCD_DEFAULT_BG;
unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG;
#endif #endif
static int drawmode = DRMODE_SOLID; static int drawmode = DRMODE_SOLID;
@ -103,6 +109,21 @@ unsigned lcd_get_background(void)
return bg_pattern; return bg_pattern;
} }
void lcd_set_selector_start(unsigned color)
{
lss_pattern = color;
}
void lcd_set_selector_end(unsigned color)
{
lse_pattern = color;
}
void lcd_set_selector_text(unsigned color)
{
lst_pattern = color;
}
void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color)
{ {
lcd_set_drawmode(mode); lcd_set_drawmode(mode);
@ -808,16 +829,48 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
ypos = ymargin + y*h; ypos = ymargin + y*h;
drawmode = (style & STYLE_INVERT) ? drawmode = (style & STYLE_INVERT) ?
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
if (style & STYLE_COLORED) { if (style & STYLE_GRADIENT || style & STYLE_COLORBAR) {
fg_pattern = lss_pattern;
}
else if (style & STYLE_COLORED) {
if (drawmode == DRMODE_SOLID) if (drawmode == DRMODE_SOLID)
fg_pattern = style & STYLE_COLOR_MASK; fg_pattern = style & STYLE_COLOR_MASK;
else else
bg_pattern = style & STYLE_COLOR_MASK; bg_pattern = style & STYLE_COLOR_MASK;
} }
lcd_putsxyofs(xpos, ypos, offset, str);
drawmode ^= DRMODE_INVERSEVID; drawmode ^= DRMODE_INVERSEVID;
xrect = xpos + MAX(w - offset, 0); xrect = xpos + MAX(w - offset, 0);
lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
if (style & STYLE_GRADIENT) {
int h_r = RGB_UNPACK_RED(lss_pattern) << 16;
int h_b = RGB_UNPACK_BLUE(lss_pattern) << 16;
int h_g = RGB_UNPACK_GREEN(lss_pattern) << 16;
int rstep = (h_r - ((signed)RGB_UNPACK_RED(lse_pattern) << 16)) / h;
int gstep = (h_g - ((signed)RGB_UNPACK_GREEN(lse_pattern) << 16)) / h;
int bstep = (h_b - ((signed)RGB_UNPACK_BLUE(lse_pattern) << 16)) / h;
int count;
drawmode = DRMODE_FG;
for(count = 0; count < h; count++) {
lcd_hline(xpos, LCD_WIDTH, ypos + count);
h_r -= rstep;
h_g -= gstep;
h_b -= bstep;
fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16);
}
fg_pattern = lst_pattern;
}
else if (style & STYLE_COLORBAR) {
drawmode = DRMODE_FG;
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, 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; drawmode = lastmode;
fg_pattern = oldfgcolor; fg_pattern = oldfgcolor;
bg_pattern = oldbgcolor; bg_pattern = oldbgcolor;
@ -852,7 +905,13 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
s->start_tick = current_tick + lcd_scroll_info.delay; s->start_tick = current_tick + lcd_scroll_info.delay;
s->invert = false; s->invert = false;
if (style & STYLE_INVERT) { 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_puts_style_offset(x,y,string,style,offset);
@ -961,8 +1020,37 @@ void lcd_scroll_fn(void)
} }
lastmode = drawmode; lastmode = drawmode;
drawmode = s->invert ? drawmode = s->invert == 1 ?
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
if (s->invert == 2) {
fg_pattern = lss_pattern;
drawmode = DRMODE_FG;
lcd_fillrect(0, ypos, LCD_WIDTH, pf->height);
fg_pattern = lst_pattern;
}
else if (s->invert == 3) {
int h_r = RGB_UNPACK_RED(lss_pattern) << 16;
int h_b = RGB_UNPACK_BLUE(lss_pattern) << 16;
int h_g = RGB_UNPACK_GREEN(lss_pattern) << 16;
int rstep = (h_r - ((signed)RGB_UNPACK_RED(lse_pattern) << 16))
/ pf->height;
int gstep = (h_g - ((signed)RGB_UNPACK_GREEN(lse_pattern) << 16))
/ pf->height;
int bstep = (h_b - ((signed)RGB_UNPACK_BLUE(lse_pattern) << 16))
/ pf->height;
unsigned int count;
fg_pattern = lss_pattern;
drawmode = DRMODE_FG;
for(count = 0; count < pf->height; count++) {
lcd_hline(0, LCD_WIDTH , ypos + count);
h_r -= rstep;
h_g -= gstep;
h_b -= bstep;
fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16);
}
fg_pattern = lst_pattern;
}
lcd_putsxyofs(xpos, ypos, s->offset, s->line); lcd_putsxyofs(xpos, ypos, s->offset, s->line);
drawmode = lastmode; drawmode = lastmode;
lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);

View file

@ -27,6 +27,8 @@
#define STYLE_DEFAULT 0x00000000 #define STYLE_DEFAULT 0x00000000
#define STYLE_INVERT 0x20000000 #define STYLE_INVERT 0x20000000
#define STYLE_COLORED 0x10000000 #define STYLE_COLORED 0x10000000
#define STYLE_COLORBAR 0x40000000
#define STYLE_GRADIENT 0x80000000
#define STYLE_COLOR_MASK 0x0000FFFF #define STYLE_COLOR_MASK 0x0000FFFF
#ifdef SIMULATOR #ifdef SIMULATOR
@ -233,6 +235,7 @@ static inline unsigned lcd_color_to_native(unsigned color)
#define LCD_WHITE LCD_RGBPACK(255, 255, 255) #define LCD_WHITE LCD_RGBPACK(255, 255, 255)
#define LCD_DEFAULT_FG LCD_BLACK #define LCD_DEFAULT_FG LCD_BLACK
#define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */ #define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */
#define LCD_DEFAULT_LS LCD_WHITE
#elif LCD_DEPTH > 1 /* greyscale */ #elif LCD_DEPTH > 1 /* greyscale */
@ -355,6 +358,11 @@ extern void lcd_set_foreground(unsigned foreground);
extern unsigned lcd_get_foreground(void); extern unsigned lcd_get_foreground(void);
extern void lcd_set_background(unsigned background); extern void lcd_set_background(unsigned background);
extern unsigned lcd_get_background(void); extern unsigned lcd_get_background(void);
#ifdef HAVE_LCD_COLOR
extern void lcd_set_selector_start(unsigned selector);
extern void lcd_set_selector_end(unsigned selector);
extern void lcd_set_selector_text(unsigned selector_text);
#endif
extern void lcd_set_drawinfo(int mode, unsigned foreground, extern void lcd_set_drawinfo(int mode, unsigned foreground,
unsigned background); unsigned background);
void lcd_set_backdrop(fb_data* backdrop); void lcd_set_backdrop(fb_data* backdrop);

View file

@ -43,8 +43,12 @@ struct scrollinfo
int startx; int startx;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
int width; /* length of line in pixels */ 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
#endif/* HAVE_LCD_BITMAP */
bool backward; /* scroll presently forward or backward? */ bool backward; /* scroll presently forward or backward? */
bool bidir; bool bidir;
long start_tick; long start_tick;