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
This commit is contained in:
Zakk Roberts 2006-03-04 10:55:54 +00:00
parent 8fc55d55eb
commit 87142ab6bb
4 changed files with 17 additions and 4 deletions

View file

@ -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 @@ static void draw_screen(struct screen *display, char *title,
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 @@ bool set_color(struct screen *display,char *title, int* color)
#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;

View file

@ -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

View file

@ -3778,3 +3778,9 @@ desc: menu
eng: "Reset Colours"
voice:
new:
id: LANG_COLOR_UNACCEPTABLE
desc: splash number of tracks inserted
eng: "Invalid color"
voice: ""
new:

View file

@ -329,7 +329,7 @@ static bool set_fg_color(void)
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 @@ static bool set_bg_color(void)
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);