summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-09-27 15:42:55 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-09-27 15:42:55 +0000
commitf3b015f73b29f2d3514c32a9b8b8f0338b52e358 (patch)
tree65e1694745947a9a7d673811d12155f3b2a03019 /apps
parent5353473b723749a7cd92d72e94423b74058287dc (diff)
downloadrockbox-f3b015f73b29f2d3514c32a9b8b8f0338b52e358.tar.gz
rockbox-f3b015f73b29f2d3514c32a9b8b8f0338b52e358.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/color_picker.c2
-rw-r--r--apps/gui/list.c25
-rw-r--r--apps/lang/english.lang92
-rw-r--r--apps/menus/display_menu.c55
-rw-r--r--apps/recorder/recording.c36
-rw-r--r--apps/screen_access.c5
-rw-r--r--apps/screen_access.h5
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h6
-rw-r--r--apps/settings_list.c18
10 files changed, 220 insertions, 27 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index 1116aaae23..513db74bf9 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -200,7 +200,7 @@ static void draw_screen(struct screen *display, char *title,
set_drawinfo(display, DRMODE_SOLID, text_color,
background_color);
- if (global_settings.invert_cursor)
+ if (global_settings.cursor_style != 0)
{
/* Draw solid bar selection bar */
display->fillrect(0,
diff --git a/apps/gui/list.c b/apps/gui/list.c
index a8bbce8cda..6a7d21cc4b 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -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;
#ifdef HAVE_LCD_BITMAP
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();
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 &&
lines < gui_list->nb_items);
- draw_cursor = !global_settings.invert_cursor &&
+ draw_cursor = !global_settings.cursor_style &&
gui_list->show_selection_marker;
text_pos = 0; /* here it's in pixels */
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)
{/* The selected item must be displayed scrolling */
#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;
}
- 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)
draw_cursor = false;
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 490f6d38b0..de254a3b1d 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2899,15 +2899,15 @@
user:
<source>
*: none
- lcd_bitmap: "Line Selector"
+ lcd_bitmap: "Line Selector Type"
</source>
<dest>
*: none
- lcd_bitmap: "Line Selector"
+ lcd_bitmap: "Line Selector Type"
</dest>
<voice>
*: none
- lcd_bitmap: "Line Selector"
+ lcd_bitmap: "Line Selector Type"
</voice>
</phrase>
<phrase>
@@ -11242,3 +11242,89 @@
usbstack: "Device Driver"
</voice>
</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>
+
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index c1e574a974..11d1f25e7f 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -115,7 +115,7 @@ MENUITEM_SETTING(invert, &global_settings.invert, NULL);
#ifdef HAVE_LCD_FLIP
MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback);
#endif
-MENUITEM_SETTING(invert_cursor, &global_settings.invert_cursor, NULL);
+MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL);
#endif /* HAVE_LCD_BITMAP */
#if LCD_DEPTH > 1
/**
@@ -157,13 +157,55 @@ static int set_bg_color(void)
settings_save();
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)
{
global_settings.fg_color = LCD_DEFAULT_FG;
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_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();
return 0;
}
@@ -171,6 +213,12 @@ MENUITEM_FUNCTION(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR),
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_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),
reset_color, NULL, NULL, Icon_NOICON);
#endif
@@ -208,8 +256,11 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
# ifdef HAVE_LCD_FLIP
,&flip_display
# endif
- ,&invert_cursor
+ ,&cursor_style
#endif /* HAVE_LCD_BITMAP */
+#ifdef HAVE_LCD_COLOR
+ ,&set_lss_col, &set_lse_col, &set_lst_col
+#endif
#if LCD_DEPTH > 1
,&clear_main_bd,
#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index f643b8442a..bd04d26929 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -857,6 +857,16 @@ bool recording_screen(bool no_source)
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;
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].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);
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].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,
buf2, sizeof(buf2)));
- if (global_settings.invert_cursor && (pos++ == cursor))
+ if (global_settings.cursor_style && (pos++ == cursor))
{
for(i = 0; i < screen_update; i++)
screens[i].puts_style_offset(0, filename_offset[i] +
- PM_HEIGHT + 2, buf, STYLE_INVERT,0);
+ PM_HEIGHT + 2, buf, style,0);
}
else
{
@@ -1574,11 +1584,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_MIC_GAIN,
global_settings.rec_mic_gain,
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++)
screens[i].puts_style_offset(0, filename_offset[i] +
- PM_HEIGHT + 3, buf, STYLE_INVERT,0);
+ PM_HEIGHT + 3, buf, style,0);
}
else
{
@@ -1598,11 +1608,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_LEFT_GAIN,
global_settings.rec_left_gain,
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++)
screens[i].puts_style_offset(0, filename_offset[i] +
- PM_HEIGHT + 3, buf, STYLE_INVERT,0);
+ PM_HEIGHT + 3, buf, style,0);
}
else
{
@@ -1616,11 +1626,11 @@ bool recording_screen(bool no_source)
fmt_gain(SOUND_RIGHT_GAIN,
global_settings.rec_right_gain,
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++)
screens[i].puts_style_offset(0, filename_offset[i] +
- PM_HEIGHT + 4, buf, STYLE_INVERT,0);
+ PM_HEIGHT + 4, buf, style,0);
}
else
{
@@ -1701,11 +1711,11 @@ bool recording_screen(bool no_source)
global_settings.rec_right_gain)/2,
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++)
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 (
global_settings.rec_source == AUDIO_SRC_MIC
@@ -1737,7 +1747,7 @@ bool recording_screen(bool no_source)
}
#endif /* HAVE_AGC */
- if(!global_settings.invert_cursor) {
+ if(!global_settings.cursor_style) {
switch(cursor)
{
case 1:
diff --git a/apps/screen_access.c b/apps/screen_access.c
index 251bd7e848..a10e96475e 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -77,6 +77,11 @@ struct screen screens[NB_SCREENS] =
.get_foreground=&lcd_get_foreground,
.set_background=&lcd_set_background,
.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 */
.update_rect=&lcd_update_rect,
.fillrect=&lcd_fillrect,
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 05a53d5d0f..6333251d29 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -107,6 +107,11 @@ struct screen
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_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 (*fillrect)(int x, int y, int width, int height);
void (*drawrect)(int x, int y, int width, int height);
diff --git a/apps/settings.c b/apps/settings.c
index 6e26574f6a..a020c18e1b 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -778,6 +778,9 @@ void settings_apply(void)
#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_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
#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
diff --git a/apps/settings.h b/apps/settings.h
index 72f607d693..ee8fd48831 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -412,8 +412,7 @@ struct user_settings
int contrast; /* lcd contrast */
#endif
bool invert; /* invert display */
- bool invert_cursor; /* invert the current file in dir browser and menu
- instead of using the default cursor */
+ int cursor_style; /* style of the selection cursor */
bool flip_display; /* turn display (and button layout) by 180 degrees */
int poweroff; /* power off timer */
int backlight_timeout; /* backlight off timeout: 0-18 0=never,
@@ -641,6 +640,9 @@ struct user_settings
#ifdef HAVE_LCD_COLOR
int bg_color; /* background 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
bool party_mode; /* party mode - unstoppable music */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 176d1cee69..51ac3eb473 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -457,8 +457,16 @@ const struct settings_list settings[] = {
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, cursor_style, 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,12 @@ const struct settings_list settings[] = {
"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.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
/* more playback */
OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL),