summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
authorZakk Roberts <midk@rockbox.org>2006-03-21 07:59:23 +0000
committerZakk Roberts <midk@rockbox.org>2006-03-21 07:59:23 +0000
commit87afd0b0507a59e0731a79662ab820f89bf5b585 (patch)
tree7accd874658fb2c5865703ef5d0a8c3e2a131a31 /apps/screens.c
parentdd521146b735790549dd91898ed814af994ef6ea (diff)
downloadrockbox-87afd0b0507a59e0731a79662ab820f89bf5b585.tar.gz
rockbox-87afd0b0507a59e0731a79662ab820f89bf5b585.zip
Reworked pitch screen for easier adjustment and better looks. Added some button definitions for iPods - coming soon to a Sound Settings menu near you...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9146 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c169
1 files changed, 71 insertions, 98 deletions
diff --git a/apps/screens.c b/apps/screens.c
index f9867a2526..4c71667a91 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -345,147 +345,120 @@ int charging_screen(void)
345} 345}
346#endif /* HAVE_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */ 346#endif /* HAVE_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */
347 347
348 348#if (CONFIG_KEYPAD != IAUDIO_X5_PAD) && (CONFIG_KEYPAD != PLAYER_PAD)
349#if CONFIG_KEYPAD == RECORDER_PAD || CONFIG_KEYPAD == IRIVER_H100_PAD \
350 || CONFIG_KEYPAD == IRIVER_H300_PAD
351/* returns: 349/* returns:
352 0 if no key was pressed 350 0 if no key was pressed
353 1 if a key was pressed (or if ON was held down long enough to repeat) 351 1 if USB was connected */
354 2 if USB was connected */ 352bool pitch_screen(void)
355#if CONFIG_KEYPAD == RECORDER_PAD
356#define PITCH_PAUSE BUTTON_PLAY
357#elif CONFIG_KEYPAD == IRIVER_H100_PAD || CONFIG_KEYPAD == IRIVER_H300_PAD
358#define PITCH_PAUSE BUTTON_SELECT
359#endif
360int pitch_screen(void)
361{ 353{
362 int button; 354 int button;
363 int pitch = sound_get_pitch(); 355 int pitch = sound_get_pitch();
364 bool exit = false; 356 bool exit = false;
365 bool used = false;
366 357
367 while (!exit) { 358 while (!exit) {
359 unsigned char* ptr;
360 unsigned char buf[32];
361 int w, h;
368 362
369 if ( used ) { 363 lcd_clear_display();
370 unsigned char* ptr; 364 lcd_setfont(FONT_SYSFIXED);
371 unsigned char buf[32]; 365
372 int w, h; 366 /* UP: +0.1% */
373 367 ptr = "+0.1%";
374 lcd_clear_display(); 368 lcd_getstringsize(ptr,&w,&h);
375 lcd_setfont(FONT_SYSFIXED); 369 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
376 370 lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
377 ptr = str(LANG_PITCH_UP); 371 LCD_WIDTH/2 - 3, h, 7, 8);
378 lcd_getstringsize(ptr,&w,&h); 372
379 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); 373 /* DOWN: -0.1% */
380 lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], 374 ptr = "-0.1%";
381 LCD_WIDTH/2 - 3, h*2, 7, 8); 375 lcd_getstringsize(ptr,&w,&h);
382 376 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
383 snprintf((char *)buf, sizeof buf, "%d.%d%%", 377 lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
384 pitch / 10, pitch % 10 ); 378 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*2, 7, 8);
385 lcd_getstringsize(buf,&w,&h); 379
386 lcd_putsxy((LCD_WIDTH-w)/2, h, buf); 380 /* RIGHT: +2% */
387 381 ptr = "+2%";
388 ptr = str(LANG_PITCH_DOWN); 382 lcd_getstringsize(ptr,&w,&h);
389 lcd_getstringsize(ptr,&w,&h); 383 lcd_putsxy(LCD_WIDTH-w, (LCD_HEIGHT-h)/2, ptr);
390 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); 384 lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
391 lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], 385 LCD_WIDTH-w-8, (LCD_HEIGHT-h)/2, 7, 8);
392 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); 386
393 387 /* LEFT: -2% */
394 ptr = str(LANG_PAUSE); 388 ptr = "-2%";
395 lcd_getstringsize(ptr,&w,&h); 389 lcd_getstringsize(ptr,&w,&h);
396 lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr); 390 lcd_putsxy(0, (LCD_HEIGHT-h)/2, ptr);
397 lcd_mono_bitmap(bitmap_icons_7x8[Icon_Pause], 391 lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
398 (LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8); 392 w+1, (LCD_HEIGHT-h)/2, 7, 8);
393
394 /* "Pitch" */
395 snprintf((char *)buf, sizeof(buf), str(LANG_PITCH));
396 lcd_getstringsize(buf,&w,&h);
397 lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT/2)-h, buf);
398 /* "XX.X%" */
399 snprintf((char *)buf, sizeof(buf), "%d.%d%%",
400 pitch / 10, pitch % 10 );
401 lcd_getstringsize(buf,&w,&h);
402 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT/2, buf);
399 403
400 lcd_update(); 404 lcd_update();
401 }
402 405
403 /* use lastbutton, so the main loop can decide whether to 406 /* use lastbutton, so the main loop can decide whether to
404 exit to browser or not */ 407 exit to browser or not */
405 button = button_get(true); 408 button = button_get(true);
406 switch (button) { 409 switch (button) {
407 case BUTTON_UP: 410 case PITCH_UP:
408 case BUTTON_ON | BUTTON_UP: 411 case PITCH_UP | BUTTON_REPEAT:
409 case BUTTON_ON | BUTTON_UP | BUTTON_REPEAT:
410 used = true;
411 if ( pitch < 2000 ) 412 if ( pitch < 2000 )
412 pitch++; 413 pitch++;
413 sound_set_pitch(pitch); 414 sound_set_pitch(pitch);
414 break; 415 break;
415 416
416 case BUTTON_DOWN: 417 case PITCH_DOWN:
417 case BUTTON_ON | BUTTON_DOWN: 418 case PITCH_DOWN | BUTTON_REPEAT:
418 case BUTTON_ON | BUTTON_DOWN | BUTTON_REPEAT:
419 used = true;
420 if ( pitch > 500 ) 419 if ( pitch > 500 )
421 pitch--; 420 pitch--;
422 sound_set_pitch(pitch); 421 sound_set_pitch(pitch);
423 break; 422 break;
424 423
425 case BUTTON_ON | PITCH_PAUSE: 424 case PITCH_RIGHT:
426 audio_pause(); 425 case PITCH_RIGHT | BUTTON_REPEAT:
427 used = true; 426 if ( pitch < 1980 )
428 break;
429
430 case PITCH_PAUSE | BUTTON_REL:
431 audio_resume();
432 used = true;
433 break;
434
435 case BUTTON_ON | PITCH_PAUSE | BUTTON_REL:
436 audio_resume();
437 exit = true;
438 break;
439
440 case BUTTON_ON | BUTTON_RIGHT:
441 case BUTTON_LEFT | BUTTON_REL:
442 if ( pitch < 2000 ) {
443 pitch += 20; 427 pitch += 20;
444 sound_set_pitch(pitch); 428 else
445 } 429 pitch = 2000;
430 sound_set_pitch(pitch);
446 break; 431 break;
447 432
448 case BUTTON_ON | BUTTON_LEFT: 433 case PITCH_LEFT:
449 case BUTTON_RIGHT | BUTTON_REL: 434 case PITCH_LEFT | BUTTON_REPEAT:
450 if ( pitch > 500 ) { 435 if ( pitch > 520 )
451 pitch -= 20; 436 pitch -= 20;
452 sound_set_pitch(pitch); 437 else
453 } 438 pitch = 500;
454 break; 439 sound_set_pitch(pitch);
455
456#ifdef SIMULATOR
457 case BUTTON_ON:
458#else
459 case BUTTON_ON | BUTTON_REL:
460 case BUTTON_ON | BUTTON_UP | BUTTON_REL:
461 case BUTTON_ON | BUTTON_DOWN | BUTTON_REL:
462#endif
463 exit = true;
464 break;
465
466 case BUTTON_ON | BUTTON_REPEAT:
467 used = true;
468 break; 440 break;
469 441
470 case BUTTON_ON | BUTTON_OFF: 442 case PITCH_RESET:
471 pitch = 1000; 443 pitch = 1000;
472 sound_set_pitch( pitch ); 444 sound_set_pitch( pitch );
473 break; 445 break;
474 446
447 case PITCH_EXIT:
448 exit = true;
449 break;
450
475 default: 451 default:
476 if(default_event_handler(button) == SYS_USB_CONNECTED) 452 if(default_event_handler(button) == SYS_USB_CONNECTED)
477 return 2; 453 return 1;
478 break; 454 break;
479 } 455 }
480 } 456 }
481 457
482 lcd_setfont(FONT_UI); 458 lcd_setfont(FONT_UI);
483 459 return 0;
484 if ( used )
485 return 1;
486 else
487 return 0;
488} 460}
461
489#endif 462#endif
490 463
491#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\ 464#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\