diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
commit | ad4e3d665734b14a28f1ba5fa874663772dab3e7 (patch) | |
tree | bff44652495f1319a4d11ed63b3d4e90cb11197f /apps/plugins/euroconverter.c | |
parent | 165f62d0cd771660e4b8d2ba7475e14d0d6f2e9f (diff) | |
download | rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.tar.gz rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.zip |
First step of charcell LCD code rework: * Make it fully unicode aware so that adding non-ISO8859-1 scripts becomes possible (limited by the LCD capabilities of course). * Make the API more similar to the bitmap LCD code's API. * Moved hardware dependent parts to target tree. * Simplified code. * Jumpscroll temporarily non-functional.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12916 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/euroconverter.c')
-rw-r--r-- | apps/plugins/euroconverter.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 3cf36affea..97ec21dd98 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c | |||
@@ -138,7 +138,7 @@ static unsigned char *abbrev_str[12] = { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | 140 | ||
141 | static unsigned char heuro,hhome; /*Handles for the new patterns*/ | 141 | static unsigned long heuro,hhome; /*Handles for the new patterns*/ |
142 | 142 | ||
143 | static struct plugin_api* rb; | 143 | static struct plugin_api* rb; |
144 | 144 | ||
@@ -239,7 +239,6 @@ static void round(longlong_t* i, longlong_t* f, int n) | |||
239 | */ | 239 | */ |
240 | static void display(longlong_t euro, longlong_t home, bool pos) | 240 | static void display(longlong_t euro, longlong_t home, bool pos) |
241 | { | 241 | { |
242 | char c1,c2; | ||
243 | longlong_t i,f; | 242 | longlong_t i,f; |
244 | unsigned char str[20]; | 243 | unsigned char str[20]; |
245 | unsigned char s1[20]; | 244 | unsigned char s1[20]; |
@@ -247,52 +246,50 @@ static void display(longlong_t euro, longlong_t home, bool pos) | |||
247 | 246 | ||
248 | if (pos) | 247 | if (pos) |
249 | { /*Edit the second line*/ | 248 | { /*Edit the second line*/ |
250 | c1=0x20; | 249 | rb->strcpy(s1," %6d.%02d"); |
251 | rb->strcpy(s1,"%c%c%6d.%02d"); | ||
252 | c2=0x81; | ||
253 | if (nb_digit[country]==2) | 250 | if (nb_digit[country]==2) |
254 | rb->strcpy(s2,"%c%c%06d.%02d"); | 251 | rb->strcpy(s2,"\xee\x84\x90%06d.%02d"); |
255 | else | 252 | else |
256 | rb->strcpy(s2,"%c%c%09d"); | 253 | rb->strcpy(s2,"\xee\x84\x90%09d"); |
257 | } | 254 | } |
258 | else | 255 | else |
259 | { | 256 | { |
260 | c1=0x81; | 257 | rb->strcpy(s1,"\xee\x84\x90%06d.%02d"); |
261 | rb->strcpy(s1,"%c%c%06d.%02d"); | ||
262 | c2=0x20; | ||
263 | if (nb_digit[country]==2) | 258 | if (nb_digit[country]==2) |
264 | rb->strcpy(s2,"%c%c%6d.%02d"); | 259 | rb->strcpy(s2," %6d.%02d"); |
265 | else | 260 | else |
266 | rb->strcpy(s2,"%c%c%9d"); | 261 | rb->strcpy(s2," %9d"); |
267 | } | 262 | } |
268 | 263 | ||
269 | rb->lcd_remove_cursor(); | 264 | rb->lcd_remove_cursor(); |
270 | /*First line*/ | 265 | /*First line*/ |
266 | rb->lcd_putc(0,0,heuro); | ||
271 | split(euro,&i,&f); | 267 | split(euro,&i,&f); |
272 | if (pos) | 268 | if (pos) |
273 | round(&i,&f,2); | 269 | round(&i,&f,2); |
274 | rb->snprintf(str,sizeof(str),s1,heuro,c1,(int)i,(int)f); | 270 | rb->snprintf(str,sizeof(str),s1,(int)i,(int)f); |
275 | 271 | ||
276 | if (!pos) | 272 | if (!pos) |
277 | { | 273 | { |
278 | rb->lcd_puts(0,0,str); | 274 | rb->lcd_puts(1,0,str); |
279 | rb->lcd_put_cursor(10-cur_pos,0,0x5F); | 275 | rb->lcd_put_cursor(10-cur_pos,0,0x5F); |
280 | } | 276 | } |
281 | else | 277 | else |
282 | rb->lcd_puts_scroll(0,0,str); | 278 | rb->lcd_puts_scroll(1,0,str); |
283 | 279 | ||
284 | /*Second line*/ | 280 | /*Second line*/ |
281 | rb->lcd_putc(0,1,hhome); | ||
285 | split(home,&i,&f); | 282 | split(home,&i,&f); |
286 | if (!pos) | 283 | if (!pos) |
287 | round(&i,&f,nb_digit[country]); | 284 | round(&i,&f,nb_digit[country]); |
288 | rb->snprintf(str,sizeof(str),s2,hhome,c2,(int)i,(int)f); | 285 | rb->snprintf(str,sizeof(str),s2,(int)i,(int)f); |
289 | if (pos) | 286 | if (pos) |
290 | { | 287 | { |
291 | rb->lcd_puts(0,1,str); | 288 | rb->lcd_puts(1,1,str); |
292 | rb->lcd_put_cursor(10-cur_pos,1,0x5F); | 289 | rb->lcd_put_cursor(10-cur_pos,1,0x5F); |
293 | } | 290 | } |
294 | else | 291 | else |
295 | rb->lcd_puts_scroll(0,1,str); | 292 | rb->lcd_puts_scroll(1,1,str); |
296 | } | 293 | } |
297 | 294 | ||
298 | 295 | ||
@@ -363,7 +360,7 @@ static int euro_menu(void) | |||
363 | rb->lcd_clear_display(); | 360 | rb->lcd_clear_display(); |
364 | rb->lcd_puts(0,0," Currency"); | 361 | rb->lcd_puts(0,0," Currency"); |
365 | rb->lcd_puts(0,1," Exit"); | 362 | rb->lcd_puts(0,1," Exit"); |
366 | rb->lcd_putc(0,c,0x81); | 363 | rb->lcd_putc(0,c,0xe110); |
367 | 364 | ||
368 | switch (rb->button_get(true)) | 365 | switch (rb->button_get(true)) |
369 | { | 366 | { |