diff options
author | Zakk Roberts <midk@rockbox.org> | 2006-03-21 02:02:04 +0000 |
---|---|---|
committer | Zakk Roberts <midk@rockbox.org> | 2006-03-21 02:02:04 +0000 |
commit | b81f596486323c1ba4673354632f6fcb3c319e72 (patch) | |
tree | 485a1affd9b9f40a9df724c0d726d14fcfc7c75d | |
parent | c00ec115989529c72f1153871524c66253c5fb12 (diff) | |
download | rockbox-b81f596486323c1ba4673354632f6fcb3c319e72.tar.gz rockbox-b81f596486323c1ba4673354632f6fcb3c319e72.zip |
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
-rw-r--r-- | apps/gui/color_picker.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index f2813c7e16..fa3699bc7d 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) Jonathan Gordon (2006) | 10 | * Copyright (C) Jonathan Gordon (2006) |
11 | * | 11 | * |
@@ -38,6 +38,7 @@ | |||
38 | #define SLIDER_LEFT BUTTON_LEFT | 38 | #define SLIDER_LEFT BUTTON_LEFT |
39 | #define SLIDER_RIGHT BUTTON_RIGHT | 39 | #define SLIDER_RIGHT BUTTON_RIGHT |
40 | #define SLIDER_OK BUTTON_ON | 40 | #define SLIDER_OK BUTTON_ON |
41 | #define SLIDER_OK2 BUTTON_SELECT | ||
41 | #define SLIDER_CANCEL BUTTON_OFF | 42 | #define SLIDER_CANCEL BUTTON_OFF |
42 | 43 | ||
43 | #define SLIDER_RC_UP BUTTON_RC_REW | 44 | #define SLIDER_RC_UP BUTTON_RC_REW |
@@ -75,7 +76,7 @@ | |||
75 | 76 | ||
76 | static const int max_val[3] = {LCD_MAX_RED,LCD_MAX_GREEN,LCD_MAX_BLUE}; | 77 | static const int max_val[3] = {LCD_MAX_RED,LCD_MAX_GREEN,LCD_MAX_BLUE}; |
77 | 78 | ||
78 | static void draw_screen(struct screen *display, char *title, | 79 | static void draw_screen(struct screen *display, char *title, |
79 | int *rgb_val, int color, int row) | 80 | int *rgb_val, int color, int row) |
80 | { | 81 | { |
81 | int i; | 82 | int i; |
@@ -95,11 +96,11 @@ static void draw_screen(struct screen *display, char *title, | |||
95 | 96 | ||
96 | i = display->getstringsize(title,0,0); | 97 | i = display->getstringsize(title,0,0); |
97 | display->putsxy((display->width-i)/2,6,title ); | 98 | display->putsxy((display->width-i)/2,6,title ); |
98 | 99 | ||
99 | for (i=0;i<3;i++) | 100 | for (i=0;i<3;i++) |
100 | { | 101 | { |
101 | text_top =display->char_height*((i*2)+2); | 102 | text_top =display->char_height*((i*2)+2); |
102 | 103 | ||
103 | if (i==row) | 104 | if (i==row) |
104 | { | 105 | { |
105 | if (global_settings.invert_cursor) | 106 | if (global_settings.invert_cursor) |
@@ -107,7 +108,7 @@ static void draw_screen(struct screen *display, char *title, | |||
107 | display->fillrect(0,text_top-1,display->width,display->char_height+2); | 108 | display->fillrect(0,text_top-1,display->width,display->char_height+2); |
108 | bg_col = text_color; | 109 | bg_col = text_color; |
109 | } | 110 | } |
110 | else | 111 | else |
111 | { | 112 | { |
112 | display->putsxy(0,text_top,">"); | 113 | display->putsxy(0,text_top,">"); |
113 | display->putsxy(display->width-TEXT_MARGIN,text_top,"<"); | 114 | display->putsxy(display->width-TEXT_MARGIN,text_top,"<"); |
@@ -124,9 +125,9 @@ static void draw_screen(struct screen *display, char *title, | |||
124 | } | 125 | } |
125 | } | 126 | } |
126 | else | 127 | else |
127 | { | 128 | { |
128 | if (display->depth > 1) | 129 | if (display->depth > 1) |
129 | display->set_foreground(text_color); | 130 | display->set_foreground(text_color); |
130 | bg_col = background_color; | 131 | bg_col = background_color; |
131 | } | 132 | } |
132 | 133 | ||
@@ -138,12 +139,12 @@ static void draw_screen(struct screen *display, char *title, | |||
138 | display->putsxy(TEXT_MARGIN,text_top,rgb_dummy); | 139 | display->putsxy(TEXT_MARGIN,text_top,rgb_dummy); |
139 | snprintf(buf,3,"%02d",rgb_val[i]); | 140 | snprintf(buf,3,"%02d",rgb_val[i]); |
140 | display->putsxy(display->width-(display->char_width*4),text_top,buf); | 141 | display->putsxy(display->width-(display->char_width*4),text_top,buf); |
141 | 142 | ||
142 | text_top += display->char_height/4; | 143 | text_top += display->char_height/4; |
143 | 144 | ||
144 | gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width, | 145 | gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width, |
145 | display->char_height/2, | 146 | display->char_height/2, |
146 | max_val[i],0,rgb_val[i],HORIZONTAL); | 147 | max_val[i],0,rgb_val[i],HORIZONTAL); |
147 | } | 148 | } |
148 | 149 | ||
149 | if (display->depth > 1) { | 150 | if (display->depth > 1) { |
@@ -175,7 +176,7 @@ static void draw_screen(struct screen *display, char *title, | |||
175 | } | 176 | } |
176 | 177 | ||
177 | /*********** | 178 | /*********** |
178 | set_color | 179 | set_color |
179 | returns true if USB was inserted, false otherwise | 180 | returns true if USB was inserted, false otherwise |
180 | color is a pointer to the colour (in native format) to modify | 181 | color is a pointer to the colour (in native format) to modify |
181 | set banned_color to -1 to allow all | 182 | 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) | |||
215 | draw_screen(&screens[i], title, rgb_val, newcolor, slider); | 216 | draw_screen(&screens[i], title, rgb_val, newcolor, slider); |
216 | 217 | ||
217 | button = button_get(true); | 218 | button = button_get(true); |
218 | switch (button) | 219 | switch (button) |
219 | { | 220 | { |
220 | case SLIDER_UP: | 221 | case SLIDER_UP: |
221 | #ifdef HAVE_LCD_REMOTE | 222 | #ifdef HAVE_LCD_REMOTE |
@@ -250,16 +251,19 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color) | |||
250 | if (rgb_val[slider] > 0) | 251 | if (rgb_val[slider] > 0) |
251 | rgb_val[slider]--; | 252 | rgb_val[slider]--; |
252 | break; | 253 | break; |
253 | 254 | ||
254 | case SLIDER_OK: | 255 | case SLIDER_OK: |
255 | #ifdef HAVE_LCD_REMOTE | 256 | #ifdef HAVE_LCD_REMOTE |
256 | case SLIDER_RC_OK: | 257 | case SLIDER_RC_OK: |
257 | #endif | 258 | #endif |
259 | #ifdef SLIDER_OK2 | ||
260 | case SLIDER_OK2: | ||
261 | #endif | ||
258 | if ((banned_color!=-1) && (banned_color == newcolor)) | 262 | if ((banned_color!=-1) && (banned_color == newcolor)) |
259 | { | 263 | { |
260 | gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE)); | 264 | gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE)); |
261 | break; | 265 | break; |
262 | } | 266 | } |
263 | *color = newcolor; | 267 | *color = newcolor; |
264 | exit = 1; | 268 | exit = 1; |
265 | break; | 269 | break; |