1
0
Fork 0
forked from len0rd/rockbox

Patch by Jonathan Gordon for bug report FS#4861 - map Select (Navi) to save the settings in the color picker in addition to Play.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9143 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Zakk Roberts 2006-03-21 02:02:04 +00:00
parent c00ec11598
commit b81f596486

View file

@ -5,7 +5,7 @@
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/ * \/ \/ \/ \/ \/
* $Id$ * $Id$
* *
* Copyright (C) Jonathan Gordon (2006) * Copyright (C) Jonathan Gordon (2006)
* *
@ -38,6 +38,7 @@
#define SLIDER_LEFT BUTTON_LEFT #define SLIDER_LEFT BUTTON_LEFT
#define SLIDER_RIGHT BUTTON_RIGHT #define SLIDER_RIGHT BUTTON_RIGHT
#define SLIDER_OK BUTTON_ON #define SLIDER_OK BUTTON_ON
#define SLIDER_OK2 BUTTON_SELECT
#define SLIDER_CANCEL BUTTON_OFF #define SLIDER_CANCEL BUTTON_OFF
#define SLIDER_RC_UP BUTTON_RC_REW #define SLIDER_RC_UP BUTTON_RC_REW
@ -75,7 +76,7 @@
static const int max_val[3] = {LCD_MAX_RED,LCD_MAX_GREEN,LCD_MAX_BLUE}; static const int max_val[3] = {LCD_MAX_RED,LCD_MAX_GREEN,LCD_MAX_BLUE};
static void draw_screen(struct screen *display, char *title, static void draw_screen(struct screen *display, char *title,
int *rgb_val, int color, int row) int *rgb_val, int color, int row)
{ {
int i; int i;
@ -95,11 +96,11 @@ static void draw_screen(struct screen *display, char *title,
i = display->getstringsize(title,0,0); i = display->getstringsize(title,0,0);
display->putsxy((display->width-i)/2,6,title ); display->putsxy((display->width-i)/2,6,title );
for (i=0;i<3;i++) for (i=0;i<3;i++)
{ {
text_top =display->char_height*((i*2)+2); text_top =display->char_height*((i*2)+2);
if (i==row) if (i==row)
{ {
if (global_settings.invert_cursor) if (global_settings.invert_cursor)
@ -107,7 +108,7 @@ static void draw_screen(struct screen *display, char *title,
display->fillrect(0,text_top-1,display->width,display->char_height+2); display->fillrect(0,text_top-1,display->width,display->char_height+2);
bg_col = text_color; bg_col = text_color;
} }
else else
{ {
display->putsxy(0,text_top,">"); display->putsxy(0,text_top,">");
display->putsxy(display->width-TEXT_MARGIN,text_top,"<"); display->putsxy(display->width-TEXT_MARGIN,text_top,"<");
@ -124,9 +125,9 @@ static void draw_screen(struct screen *display, char *title,
} }
} }
else else
{ {
if (display->depth > 1) if (display->depth > 1)
display->set_foreground(text_color); display->set_foreground(text_color);
bg_col = background_color; bg_col = background_color;
} }
@ -138,12 +139,12 @@ static void draw_screen(struct screen *display, char *title,
display->putsxy(TEXT_MARGIN,text_top,rgb_dummy); display->putsxy(TEXT_MARGIN,text_top,rgb_dummy);
snprintf(buf,3,"%02d",rgb_val[i]); snprintf(buf,3,"%02d",rgb_val[i]);
display->putsxy(display->width-(display->char_width*4),text_top,buf); display->putsxy(display->width-(display->char_width*4),text_top,buf);
text_top += display->char_height/4; text_top += display->char_height/4;
gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width, gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width,
display->char_height/2, display->char_height/2,
max_val[i],0,rgb_val[i],HORIZONTAL); max_val[i],0,rgb_val[i],HORIZONTAL);
} }
if (display->depth > 1) { if (display->depth > 1) {
@ -175,7 +176,7 @@ static void draw_screen(struct screen *display, char *title,
} }
/*********** /***********
set_color set_color
returns true if USB was inserted, false otherwise returns true if USB was inserted, false otherwise
color is a pointer to the colour (in native format) to modify color is a pointer to the colour (in native format) to modify
set banned_color to -1 to allow all set banned_color to -1 to allow all
@ -215,7 +216,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
draw_screen(&screens[i], title, rgb_val, newcolor, slider); draw_screen(&screens[i], title, rgb_val, newcolor, slider);
button = button_get(true); button = button_get(true);
switch (button) switch (button)
{ {
case SLIDER_UP: case SLIDER_UP:
#ifdef HAVE_LCD_REMOTE #ifdef HAVE_LCD_REMOTE
@ -250,16 +251,19 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
if (rgb_val[slider] > 0) if (rgb_val[slider] > 0)
rgb_val[slider]--; rgb_val[slider]--;
break; break;
case SLIDER_OK: case SLIDER_OK:
#ifdef HAVE_LCD_REMOTE #ifdef HAVE_LCD_REMOTE
case SLIDER_RC_OK: case SLIDER_RC_OK:
#endif
#ifdef SLIDER_OK2
case SLIDER_OK2:
#endif #endif
if ((banned_color!=-1) && (banned_color == newcolor)) if ((banned_color!=-1) && (banned_color == newcolor))
{ {
gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE)); gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE));
break; break;
} }
*color = newcolor; *color = newcolor;
exit = 1; exit = 1;
break; break;