Patch 4765 by Jonathan Gordon - don't allow the same colors to be selected for foreground and background.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8900 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index efdbe1a..f2813c7 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -27,6 +27,7 @@
#include "settings.h"
#include "scrollbar.h"
#include "lang.h"
+#include "splash.h"
#define TEXT_MARGIN display->char_width+2
#define SLIDER_START 20
@@ -177,8 +178,9 @@
set_color
returns true if USB was inserted, false otherwise
color is a pointer to the colour (in native format) to modify
+ set banned_color to -1 to allow all
***********/
-bool set_color(struct screen *display,char *title, int* color)
+bool set_color(struct screen *display,char *title, int* color, int banned_color)
{
int exit = 0, button, slider=0;
int rgb_val[3]; /* native depth r,g,b*/;
@@ -253,6 +255,11 @@
#ifdef HAVE_LCD_REMOTE
case SLIDER_RC_OK:
#endif
+ if ((banned_color!=-1) && (banned_color == newcolor))
+ {
+ gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE));
+ break;
+ }
*color = newcolor;
exit = 1;
break;
diff --git a/apps/gui/color_picker.h b/apps/gui/color_picker.h
index 1fa35f0..f520083 100644
--- a/apps/gui/color_picker.h
+++ b/apps/gui/color_picker.h
@@ -20,6 +20,6 @@
#ifdef HAVE_LCD_COLOR /* this file is a bit useless on non color lcds.. */
-bool set_color(struct screen *display,char *title, int* color);
+bool set_color(struct screen *display,char *title, int* color, int banned_color);
#endif
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index bd7973e..b13f737 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3778,3 +3778,9 @@
eng: "Reset Colours"
voice:
new:
+
+id: LANG_COLOR_UNACCEPTABLE
+desc: splash number of tracks inserted
+eng: "Invalid color"
+voice: ""
+new:
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index d089960..b74b0a7 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -329,7 +329,7 @@
bool res;
res = set_color(&screens[SCREEN_MAIN],str(LANG_FOREGROUND_COLOR),
- &global_settings.fg_color);
+ &global_settings.fg_color,global_settings.bg_color);
screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
@@ -341,7 +341,7 @@
bool res;
res = set_color(&screens[SCREEN_MAIN],str(LANG_BACKGROUND_COLOR),
- &global_settings.bg_color);
+ &global_settings.bg_color,global_settings.fg_color);
screens[SCREEN_MAIN].set_background(global_settings.bg_color);