summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-07-19 14:31:24 +0000
committerDave Chapman <dave@dchapman.com>2006-07-19 14:31:24 +0000
commit3ea74cc1b4583159adfe2e24a8edcacae078e2f3 (patch)
tree81188f5c10141408735d77575e17c0820d16afba
parent283de5f8690281e9ab098606edd2e1e5916e1b55 (diff)
downloadrockbox-3ea74cc1b4583159adfe2e24a8edcacae078e2f3.tar.gz
rockbox-3ea74cc1b4583159adfe2e24a8edcacae078e2f3.zip
Patch #5584 from Jonathan Gordon - fix the remote support for the colour picker
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10247 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/color_picker.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index fa3699bc7d..d1d805848d 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -16,6 +16,7 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h"
19#include "stdarg.h" 20#include "stdarg.h"
20#include "string.h" 21#include "string.h"
21#include "stdio.h" 22#include "stdio.h"
@@ -87,6 +88,7 @@ static void draw_screen(struct screen *display, char *title,
87 int slider_width = (display->width-SLIDER_START-(display->char_width*5)); 88 int slider_width = (display->width-SLIDER_START-(display->char_width*5));
88 int background_color = global_settings.bg_color; 89 int background_color = global_settings.bg_color;
89 int text_color = global_settings.fg_color; 90 int text_color = global_settings.fg_color;
91 bool display_three_rows = (display->height/6) > display->char_height;
90 92
91 display->clear_display(); 93 display->clear_display();
92 94
@@ -97,21 +99,23 @@ static void draw_screen(struct screen *display, char *title,
97 i = display->getstringsize(title,0,0); 99 i = display->getstringsize(title,0,0);
98 display->putsxy((display->width-i)/2,6,title ); 100 display->putsxy((display->width-i)/2,6,title );
99 101
100 for (i=0;i<3;i++) 102 text_top = display->char_height*2;
103 for (i=0; i<3 ;i++)
101 { 104 {
102 text_top =display->char_height*((i*2)+2); 105 if (!display_three_rows)
106 i = row;
103 107
104 if (i==row) 108 if (i==row)
105 { 109 {
106 if (global_settings.invert_cursor) 110 if ((global_settings.invert_cursor) && (display->depth >2))
107 { 111 {
108 display->fillrect(0,text_top-1,display->width,display->char_height+2); 112 display->fillrect(0,text_top-1,display->width,display->char_height+2);
109 bg_col = text_color; 113 bg_col = text_color;
110 } 114 }
111 else 115 else if (display_three_rows)
112 { 116 {
113 display->putsxy(0,text_top,">"); 117 display->putsxy(0,text_top,">");
114 display->putsxy(display->width-TEXT_MARGIN,text_top,"<"); 118 display->putsxy(display->width-display->char_width-2,text_top,"<");
115 bg_col = background_color; 119 bg_col = background_color;
116 } 120 }
117 if (display->depth > 1) 121 if (display->depth > 1)
@@ -145,6 +149,9 @@ static void draw_screen(struct screen *display, char *title,
145 gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width, 149 gui_scrollbar_draw(display,SLIDER_START,text_top,slider_width,
146 display->char_height/2, 150 display->char_height/2,
147 max_val[i],0,rgb_val[i],HORIZONTAL); 151 max_val[i],0,rgb_val[i],HORIZONTAL);
152 if (!display_three_rows)
153 break;
154 text_top += display->char_height;
148 } 155 }
149 156
150 if (display->depth > 1) { 157 if (display->depth > 1) {
@@ -152,7 +159,7 @@ static void draw_screen(struct screen *display, char *title,
152 display->set_foreground(text_color); 159 display->set_foreground(text_color);
153 } 160 }
154 161
155 if (text_top + (display->char_height*2) < (LCD_HEIGHT-40-display->char_height)) 162 if (text_top + (display->char_height*2) < (display->height-40-display->char_height))
156 text_top += (display->char_height*2); 163 text_top += (display->char_height*2);
157 else text_top += (display->char_height); 164 else text_top += (display->char_height);
158 165
@@ -162,7 +169,7 @@ static void draw_screen(struct screen *display, char *title,
162 RGB_UNPACK_GREEN(color), 169 RGB_UNPACK_GREEN(color),
163 RGB_UNPACK_BLUE(color)); 170 RGB_UNPACK_BLUE(color));
164 171
165 display->putsxy((LCD_WIDTH-(display->char_width*21))/2,text_top,buf); 172 display->putsxy((display->width-(display->char_width*11))/2,text_top,buf);
166 173
167 if (display->depth > 1) { 174 if (display->depth > 1) {
168 display->set_foreground(color); 175 display->set_foreground(color);
@@ -213,20 +220,22 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
213 newcolor = swap16((rgb_val[0] << 11) | (rgb_val[1] << 5) | (rgb_val[2])); 220 newcolor = swap16((rgb_val[0] << 11) | (rgb_val[1] << 5) | (rgb_val[2]));
214#endif 221#endif
215 FOR_NB_SCREENS(i) 222 FOR_NB_SCREENS(i)
223 {
216 draw_screen(&screens[i], title, rgb_val, newcolor, slider); 224 draw_screen(&screens[i], title, rgb_val, newcolor, slider);
217 225 }
226
218 button = button_get(true); 227 button = button_get(true);
219 switch (button) 228 switch (button)
220 { 229 {
221 case SLIDER_UP: 230 case SLIDER_UP:
222#ifdef HAVE_LCD_REMOTE 231#ifdef SLIDER_RC_UP
223 case SLIDER_RC_UP: 232 case SLIDER_RC_UP:
224#endif 233#endif
225 slider = (slider+2)%3; 234 slider = (slider+2)%3;
226 break; 235 break;
227 236
228 case SLIDER_DOWN: 237 case SLIDER_DOWN:
229#ifdef HAVE_LCD_REMOTE 238#ifdef SLIDER_RC_DOWN
230 case SLIDER_RC_DOWN: 239 case SLIDER_RC_DOWN:
231#endif 240#endif
232 slider = (slider+1)%3; 241 slider = (slider+1)%3;
@@ -234,7 +243,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
234 243
235 case SLIDER_RIGHT: 244 case SLIDER_RIGHT:
236 case SLIDER_RIGHT|BUTTON_REPEAT: 245 case SLIDER_RIGHT|BUTTON_REPEAT:
237#ifdef HAVE_LCD_REMOTE 246#ifdef SLIDER_RC_RIGHT
238 case SLIDER_RC_RIGHT: 247 case SLIDER_RC_RIGHT:
239 case SLIDER_RC_RIGHT|BUTTON_REPEAT: 248 case SLIDER_RC_RIGHT|BUTTON_REPEAT:
240#endif 249#endif
@@ -244,7 +253,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
244 253
245 case SLIDER_LEFT: 254 case SLIDER_LEFT:
246 case SLIDER_LEFT|BUTTON_REPEAT: 255 case SLIDER_LEFT|BUTTON_REPEAT:
247#ifdef HAVE_LCD_REMOTE 256#ifdef SLIDER_RC_LEFT
248 case SLIDER_RC_LEFT: 257 case SLIDER_RC_LEFT:
249 case SLIDER_RC_LEFT|BUTTON_REPEAT: 258 case SLIDER_RC_LEFT|BUTTON_REPEAT:
250#endif 259#endif
@@ -253,7 +262,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
253 break; 262 break;
254 263
255 case SLIDER_OK: 264 case SLIDER_OK:
256#ifdef HAVE_LCD_REMOTE 265#ifdef HAVE_REMOTE_LCD
257 case SLIDER_RC_OK: 266 case SLIDER_RC_OK:
258#endif 267#endif
259#ifdef SLIDER_OK2 268#ifdef SLIDER_OK2
@@ -269,7 +278,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
269 break; 278 break;
270 279
271 case SLIDER_CANCEL: 280 case SLIDER_CANCEL:
272#ifdef HAVE_LCD_REMOTE 281#ifdef HAVE_REMOTE_LCD
273 case SLIDER_RC_CANCEL: 282 case SLIDER_RC_CANCEL:
274#endif 283#endif
275 exit = 1; 284 exit = 1;