summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2006-09-03 11:33:03 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2006-09-03 11:33:03 +0000
commit85134105b9b1beddf657dd8a096101efdcc8d9e2 (patch)
tree35550c299c0596fd0ec933ddcc2c967c2fd094b9 /apps/screens.c
parentbfe1cd17c6ee7722ae0faee72c630463d13c2bcd (diff)
downloadrockbox-85134105b9b1beddf657dd8a096101efdcc8d9e2.tar.gz
rockbox-85134105b9b1beddf657dd8a096101efdcc8d9e2.zip
make the pitch screen use the remote screen also, and fix non-lcd iriver remote for the screen (again)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10865 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c101
1 files changed, 58 insertions, 43 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 86a377ecc5..067c544ea2 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -356,53 +356,64 @@ int charging_screen(void)
356 0 if no key was pressed 356 0 if no key was pressed
357 1 if USB was connected */ 357 1 if USB was connected */
358 358
359void pitch_screen_draw(int pitch) 359void pitch_screen_draw(struct screen *display, int pitch)
360{ 360{
361 unsigned char* ptr; 361 unsigned char* ptr;
362 unsigned char buf[32]; 362 unsigned char buf[32];
363 int w, h; 363 int w, h;
364 364
365 lcd_clear_display(); 365 display->clear_display();
366
367 if (display->nb_lines < 4) /* very small screen, just show the pitch value */
368 {
369 w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_SYSFONT_PITCH),
370 pitch / 10, pitch % 10 );
371 display->putsxy((display->width-(w*display->char_width))/2,
372 display->nb_lines/2,buf);
373 }
374 else /* bigger screen, show everything... */
375 {
366 376
367 /* UP: Pitch Up */ 377 /* UP: Pitch Up */
368 ptr = str(LANG_SYSFONT_PITCH_UP); 378 ptr = str(LANG_SYSFONT_PITCH_UP);
369 lcd_getstringsize(ptr,&w,&h); 379 display->getstringsize(ptr,&w,&h);
370 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); 380 display->putsxy((display->width-w)/2, 0, ptr);
371 lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], 381 display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
372 LCD_WIDTH/2 - 3, h, 7, 8); 382 display->width/2 - 3, h, 7, 8);
373 383
374 /* DOWN: Pitch Down */ 384 /* DOWN: Pitch Down */
375 ptr = str(LANG_SYSFONT_PITCH_DOWN); 385 ptr = str(LANG_SYSFONT_PITCH_DOWN);
376 lcd_getstringsize(ptr,&w,&h); 386 display->getstringsize(ptr,&w,&h);
377 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); 387 display->putsxy((display->width-w)/2, display->height - h, ptr);
378 lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], 388 display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
379 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*2, 7, 8); 389 display->width/2 - 3, display->height - h*2, 7, 8);
380 390
381 /* RIGHT: +2% */ 391 /* RIGHT: +2% */
382 ptr = "+2%"; 392 ptr = "+2%";
383 lcd_getstringsize(ptr,&w,&h); 393 display->getstringsize(ptr,&w,&h);
384 lcd_putsxy(LCD_WIDTH-w, (LCD_HEIGHT-h)/2, ptr); 394 display->putsxy(display->width-w, (display->height-h)/2, ptr);
385 lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 395 display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
386 LCD_WIDTH-w-8, (LCD_HEIGHT-h)/2, 7, 8); 396 display->width-w-8, (display->height-h)/2, 7, 8);
387 397
388 /* LEFT: -2% */ 398 /* LEFT: -2% */
389 ptr = "-2%"; 399 ptr = "-2%";
390 lcd_getstringsize(ptr,&w,&h); 400 display->getstringsize(ptr,&w,&h);
391 lcd_putsxy(0, (LCD_HEIGHT-h)/2, ptr); 401 display->putsxy(0, (display->height-h)/2, ptr);
392 lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 402 display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
393 w+1, (LCD_HEIGHT-h)/2, 7, 8); 403 w+1, (display->height-h)/2, 7, 8);
394 404
395 /* "Pitch" */ 405 /* "Pitch" */
396 snprintf((char *)buf, sizeof(buf), str(LANG_SYSFONT_PITCH)); 406 snprintf((char *)buf, sizeof(buf), str(LANG_SYSFONT_PITCH));
397 lcd_getstringsize(buf,&w,&h); 407 display->getstringsize(buf,&w,&h);
398 lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT/2)-h, buf); 408 display->putsxy((display->width-w)/2, (display->height/2)-h, buf);
399 /* "XX.X%" */ 409 /* "XX.X%" */
400 snprintf((char *)buf, sizeof(buf), "%d.%d%%", 410 snprintf((char *)buf, sizeof(buf), "%d.%d%%",
401 pitch / 10, pitch % 10 ); 411 pitch / 10, pitch % 10 );
402 lcd_getstringsize(buf,&w,&h); 412 display->getstringsize(buf,&w,&h);
403 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT/2, buf); 413 display->putsxy((display->width-w)/2, display->height/2, buf);
414 }
404 415
405 lcd_update(); 416 display->update();
406} 417}
407 418
408bool pitch_screen(void) 419bool pitch_screen(void)
@@ -410,6 +421,7 @@ bool pitch_screen(void)
410 int button; 421 int button;
411 int pitch = sound_get_pitch(); 422 int pitch = sound_get_pitch();
412 bool exit = false; 423 bool exit = false;
424 int i;
413 425
414 lcd_setfont(FONT_SYSFIXED); 426 lcd_setfont(FONT_SYSFIXED);
415#if CONFIG_CODEC == SWCODEC 427#if CONFIG_CODEC == SWCODEC
@@ -419,7 +431,8 @@ bool pitch_screen(void)
419 action_signalscreenchange(); 431 action_signalscreenchange();
420 while (!exit) 432 while (!exit)
421 { 433 {
422 pitch_screen_draw(pitch); 434 FOR_NB_SCREENS(i)
435 pitch_screen_draw(&screens[i],pitch);
423 436
424 button = get_action(CONTEXT_PITCHSCREEN,TIMEOUT_BLOCK); 437 button = get_action(CONTEXT_PITCHSCREEN,TIMEOUT_BLOCK);
425 switch (button) { 438 switch (button) {
@@ -456,7 +469,8 @@ bool pitch_screen(void)
456 { 469 {
457 pitch += 20; 470 pitch += 20;
458 sound_set_pitch(pitch); 471 sound_set_pitch(pitch);
459 pitch_screen_draw(pitch); 472 FOR_NB_SCREENS(i)
473 pitch_screen_draw(&screens[i],pitch);
460 } 474 }
461 break; 475 break;
462 case ACTION_PS_NUDGE_RIGHTOFF: 476 case ACTION_PS_NUDGE_RIGHTOFF:
@@ -469,7 +483,8 @@ bool pitch_screen(void)
469 { 483 {
470 pitch -= 20; 484 pitch -= 20;
471 sound_set_pitch(pitch); 485 sound_set_pitch(pitch);
472 pitch_screen_draw(pitch); 486 FOR_NB_SCREENS(i)
487 pitch_screen_draw(&screens[i],pitch);
473 } 488 }
474 break; 489 break;
475 case ACTION_PS_NUDGE_LEFTOFF: 490 case ACTION_PS_NUDGE_LEFTOFF: