diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/icons.c | 181 | ||||
-rw-r--r-- | apps/recorder/icons.h | 2 | ||||
-rw-r--r-- | apps/recorder/keyboard.c | 20 | ||||
-rw-r--r-- | apps/recorder/radio.c | 38 | ||||
-rw-r--r-- | apps/recorder/recording.c | 6 |
5 files changed, 38 insertions, 209 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index baba77bc52..1306a1d770 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -73,11 +73,9 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ | 73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #if CONFIG_LED == LED_VIRTUAL | ||
77 | /* Disk/MMC activity */ | 76 | /* Disk/MMC activity */ |
78 | const unsigned char bitmap_icon_disk[12] = | 77 | const unsigned char bitmap_icon_disk[12] = |
79 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; | 78 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; |
80 | #endif | ||
81 | 79 | ||
82 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ | 80 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ |
83 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 81 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
@@ -341,130 +339,6 @@ const unsigned char rockbox160x53x2[] = { | |||
341 | #endif | 339 | #endif |
342 | 340 | ||
343 | /* | 341 | /* |
344 | * Print battery icon to status bar | ||
345 | */ | ||
346 | void statusbar_icon_battery(int percent) | ||
347 | { | ||
348 | int fill; | ||
349 | char buffer[5]; | ||
350 | unsigned int width, height; | ||
351 | |||
352 | /* fill battery */ | ||
353 | fill = percent; | ||
354 | if (fill < 0) | ||
355 | fill = 0; | ||
356 | if (fill > 100) | ||
357 | fill = 100; | ||
358 | |||
359 | #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */ | ||
360 | /* show graphical animation when charging instead of numbers */ | ||
361 | if ((global_settings.battery_display) && | ||
362 | (charge_state != 1) && | ||
363 | (percent > -1)) { | ||
364 | #else /* all others */ | ||
365 | if (global_settings.battery_display && (percent > -1)) { | ||
366 | #endif | ||
367 | /* Numeric display */ | ||
368 | snprintf(buffer, sizeof(buffer), "%3d", fill); | ||
369 | lcd_setfont(FONT_SYSFIXED); | ||
370 | lcd_getstringsize(buffer, &width, &height); | ||
371 | if (height <= STATUSBAR_HEIGHT) | ||
372 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - | ||
373 | width/2, STATUSBAR_Y_POS, buffer); | ||
374 | lcd_setfont(FONT_UI); | ||
375 | |||
376 | } | ||
377 | else { | ||
378 | /* draw battery */ | ||
379 | lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); | ||
380 | lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2, | ||
381 | STATUSBAR_Y_POS + 4); | ||
382 | |||
383 | fill = fill * 15 / 100; | ||
384 | lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); | ||
385 | } | ||
386 | |||
387 | if (percent == -1) { | ||
388 | lcd_setfont(FONT_SYSFIXED); | ||
389 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - 4, | ||
390 | STATUSBAR_Y_POS, "?"); | ||
391 | lcd_setfont(FONT_UI); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | /* | ||
396 | * Print volume gauge to status bar | ||
397 | */ | ||
398 | bool statusbar_icon_volume(int percent) | ||
399 | { | ||
400 | int i; | ||
401 | int volume; | ||
402 | int vol; | ||
403 | char buffer[4]; | ||
404 | unsigned int width, height; | ||
405 | bool needs_redraw = false; | ||
406 | int type = global_settings.volume_type; | ||
407 | static long switch_tick; | ||
408 | static int last_volume = -1; /* -1 means "first update ever" */ | ||
409 | |||
410 | volume = percent; | ||
411 | if (volume < 0) | ||
412 | volume = 0; | ||
413 | if (volume > 100) | ||
414 | volume = 100; | ||
415 | |||
416 | if (volume == 0) { | ||
417 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute], | ||
418 | ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, | ||
419 | STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); | ||
420 | } | ||
421 | else { | ||
422 | /* We want to redraw the icon later on */ | ||
423 | if (last_volume != volume && last_volume >= 0) { | ||
424 | switch_tick = current_tick + HZ; | ||
425 | } | ||
426 | |||
427 | /* If the timeout hasn't yet been reached, we show it numerically | ||
428 | and tell the caller that we want to be called again */ | ||
429 | if (TIME_BEFORE(current_tick,switch_tick)) { | ||
430 | type = 1; | ||
431 | needs_redraw = true; | ||
432 | } | ||
433 | |||
434 | /* display volume level numerical? */ | ||
435 | if (type) | ||
436 | { | ||
437 | snprintf(buffer, sizeof(buffer), "%2d", percent); | ||
438 | lcd_setfont(FONT_SYSFIXED); | ||
439 | lcd_getstringsize(buffer, &width, &height); | ||
440 | if (height <= STATUSBAR_HEIGHT) | ||
441 | lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - | ||
442 | width/2, STATUSBAR_Y_POS, buffer); | ||
443 | lcd_setfont(FONT_UI); | ||
444 | } else { | ||
445 | /* display volume bar */ | ||
446 | vol = volume * 14 / 100; | ||
447 | for(i=0; i < vol; i++) { | ||
448 | lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2, | ||
449 | STATUSBAR_Y_POS + 6); | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | last_volume = volume; | ||
454 | |||
455 | return needs_redraw; | ||
456 | } | ||
457 | |||
458 | /* | ||
459 | * Print play state to status bar | ||
460 | */ | ||
461 | void statusbar_icon_play_state(int state) | ||
462 | { | ||
463 | lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, | ||
464 | STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); | ||
465 | } | ||
466 | |||
467 | /* | ||
468 | * Print play mode to status bar | 342 | * Print play mode to status bar |
469 | */ | 343 | */ |
470 | void statusbar_icon_play_mode(int mode) | 344 | void statusbar_icon_play_mode(int mode) |
@@ -478,59 +352,6 @@ void statusbar_icon_play_mode(int mode) | |||
478 | */ | 352 | */ |
479 | void statusbar_icon_shuffle(void) | 353 | void statusbar_icon_shuffle(void) |
480 | { | 354 | { |
481 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, | 355 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, |
482 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); | 356 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); |
483 | } | 357 | } |
484 | |||
485 | /* | ||
486 | * Print lock when keys are locked | ||
487 | */ | ||
488 | void statusbar_icon_lock(void) | ||
489 | { | ||
490 | lcd_mono_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS, | ||
491 | STATUSBAR_Y_POS, 5, 8); | ||
492 | } | ||
493 | |||
494 | #if CONFIG_LED == LED_VIRTUAL | ||
495 | /* | ||
496 | * no real LED: disk activity in status bar | ||
497 | */ | ||
498 | void statusbar_led(void) | ||
499 | { | ||
500 | lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, | ||
501 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT); | ||
502 | } | ||
503 | #endif | ||
504 | |||
505 | #ifdef HAVE_RTC | ||
506 | /* | ||
507 | * Print time to status bar | ||
508 | */ | ||
509 | void statusbar_time(int hour, int minute) | ||
510 | { | ||
511 | unsigned char buffer[6]; | ||
512 | unsigned int width, height; | ||
513 | |||
514 | if ( hour >= 0 && | ||
515 | hour <= 23 && | ||
516 | minute >= 0 && | ||
517 | minute <= 59 ) { | ||
518 | if ( global_settings.timeformat ) { /* 12 hour clock */ | ||
519 | hour %= 12; | ||
520 | if ( hour == 0 ) { | ||
521 | hour += 12; | ||
522 | } | ||
523 | } | ||
524 | snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); | ||
525 | } | ||
526 | else { | ||
527 | strncpy(buffer, "--:--", sizeof buffer); | ||
528 | } | ||
529 | |||
530 | lcd_setfont(FONT_SYSFIXED); | ||
531 | lcd_getstringsize(buffer, &width, &height); | ||
532 | if (height <= STATUSBAR_HEIGHT) | ||
533 | lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer); | ||
534 | lcd_setfont(FONT_UI); | ||
535 | } | ||
536 | #endif | ||
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 6ffcc9cb80..c996fd92aa 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -74,9 +74,7 @@ enum icons_7x8 { | |||
74 | extern const unsigned char bitmap_icons_5x8[1][5]; | 74 | extern const unsigned char bitmap_icons_5x8[1][5]; |
75 | extern const unsigned char bitmap_icons_6x8[LastIcon][6]; | 75 | extern const unsigned char bitmap_icons_6x8[LastIcon][6]; |
76 | extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; | 76 | extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; |
77 | #if CONFIG_LED == LED_VIRTUAL | ||
78 | extern const unsigned char bitmap_icon_disk[]; | 77 | extern const unsigned char bitmap_icon_disk[]; |
79 | #endif | ||
80 | 78 | ||
81 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 79 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
82 | extern const unsigned char rockbox112x37[]; | 80 | extern const unsigned char rockbox112x37[]; |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 5ff340b596..31c0643e3c 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "font.h" | 27 | #include "font.h" |
28 | #include "screens.h" | 28 | #include "screens.h" |
29 | #include "status.h" | 29 | #include "statusbar.h" |
30 | #include "talk.h" | 30 | #include "talk.h" |
31 | #include "settings.h" | 31 | #include "settings.h" |
32 | #include "misc.h" | 32 | #include "misc.h" |
33 | #include "buttonbar.h" | ||
33 | 34 | ||
34 | #define KEYBOARD_MARGIN 3 | 35 | #define KEYBOARD_MARGIN 3 |
35 | 36 | ||
@@ -177,7 +178,11 @@ int kbd_input(char* text, int buflen) | |||
177 | char outline[256]; | 178 | char outline[256]; |
178 | struct font* font = font_get(FONT_SYSFIXED); | 179 | struct font* font = font_get(FONT_SYSFIXED); |
179 | int button, lastbutton = 0; | 180 | int button, lastbutton = 0; |
180 | 181 | #ifdef HAS_BUTTONBAR | |
182 | struct gui_buttonbar buttonbar; | ||
183 | gui_buttonbar_init(&buttonbar); | ||
184 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | ||
185 | #endif | ||
181 | lcd_setfont(FONT_SYSFIXED); | 186 | lcd_setfont(FONT_SYSFIXED); |
182 | font_w = font->maxwidth; | 187 | font_w = font->maxwidth; |
183 | font_h = font->height; | 188 | font_h = font->height; |
@@ -229,10 +234,10 @@ int kbd_input(char* text, int buflen) | |||
229 | i = (curpos + 1) * font_w; | 234 | i = (curpos + 1) * font_w; |
230 | lcd_vline(i, main_y, main_y + font_h); | 235 | lcd_vline(i, main_y, main_y + font_h); |
231 | 236 | ||
232 | #if CONFIG_KEYPAD == RECORDER_PAD | 237 | #ifdef HAS_BUTTONBAR |
233 | /* draw the status bar */ | 238 | /* draw the status bar */ |
234 | buttonbar_set("Shift", "OK", "Del"); | 239 | gui_buttonbar_set(&buttonbar, "Shift", "OK", "Del"); |
235 | buttonbar_draw(); | 240 | gui_buttonbar_draw(&buttonbar); |
236 | #endif | 241 | #endif |
237 | 242 | ||
238 | #ifdef KBD_MODES | 243 | #ifdef KBD_MODES |
@@ -245,8 +250,7 @@ int kbd_input(char* text, int buflen) | |||
245 | lcd_set_drawmode(DRMODE_SOLID); | 250 | lcd_set_drawmode(DRMODE_SOLID); |
246 | } | 251 | } |
247 | 252 | ||
248 | status_draw(true); | 253 | gui_syncstatusbar_draw(&statusbars, true); |
249 | |||
250 | lcd_update(); | 254 | lcd_update(); |
251 | } | 255 | } |
252 | 256 | ||
@@ -454,7 +458,7 @@ int kbd_input(char* text, int buflen) | |||
454 | #endif /* !KBD_MODES */ | 458 | #endif /* !KBD_MODES */ |
455 | 459 | ||
456 | case BUTTON_NONE: | 460 | case BUTTON_NONE: |
457 | status_draw(false); | 461 | gui_syncstatusbar_draw(&statusbars, false); |
458 | redraw = false; | 462 | redraw = false; |
459 | break; | 463 | break; |
460 | 464 | ||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index ff1d49bd2a..a6b540dd3d 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "textarea.h" | 56 | #include "textarea.h" |
57 | #include "splash.h" | 57 | #include "splash.h" |
58 | #include "yesno.h" | 58 | #include "yesno.h" |
59 | #include "buttonbar.h" | ||
59 | #include "power.h" | 60 | #include "power.h" |
60 | 61 | ||
61 | #ifdef CONFIG_TUNER | 62 | #ifdef CONFIG_TUNER |
@@ -298,9 +299,13 @@ bool radio_screen(void) | |||
298 | int hours, minutes; | 299 | int hours, minutes; |
299 | bool keep_playing = false; | 300 | bool keep_playing = false; |
300 | bool statusbar = global_settings.statusbar; | 301 | bool statusbar = global_settings.statusbar; |
302 | #ifdef HAS_BUTTONBAR | ||
303 | struct gui_buttonbar buttonbar; | ||
304 | gui_buttonbar_init(&buttonbar); | ||
305 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | ||
306 | #endif | ||
301 | /* always display status bar in radio screen for now */ | 307 | /* always display status bar in radio screen for now */ |
302 | global_settings.statusbar = true; | 308 | global_settings.statusbar = true; |
303 | |||
304 | FOR_NB_SCREENS(i){ | 309 | FOR_NB_SCREENS(i){ |
305 | gui_textarea_clear(&screens[i]); | 310 | gui_textarea_clear(&screens[i]); |
306 | screen_set_xmargin(&screens[i],0); | 311 | screen_set_xmargin(&screens[i],0); |
@@ -377,8 +382,8 @@ bool radio_screen(void) | |||
377 | radio_mode = RADIO_PRESET_MODE; | 382 | radio_mode = RADIO_PRESET_MODE; |
378 | #endif | 383 | #endif |
379 | 384 | ||
380 | #if CONFIG_KEYPAD == RECORDER_PAD | 385 | #ifdef HAS_BUTTONBAR |
381 | buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), | 386 | gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), |
382 | str(LANG_FM_BUTTONBAR_RECORD)); | 387 | str(LANG_FM_BUTTONBAR_RECORD)); |
383 | #endif | 388 | #endif |
384 | 389 | ||
@@ -613,10 +618,10 @@ bool radio_screen(void) | |||
613 | gui_textarea_clear(&screens[i]); | 618 | gui_textarea_clear(&screens[i]); |
614 | screen_set_xmargin(&screens[i],0); | 619 | screen_set_xmargin(&screens[i],0); |
615 | } | 620 | } |
616 | #if CONFIG_KEYPAD == RECORDER_PAD | 621 | #ifdef HAS_BUTTONBAR |
617 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 622 | gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), |
618 | str(LANG_FM_BUTTONBAR_PRESETS), | 623 | str(LANG_FM_BUTTONBAR_PRESETS), |
619 | str(LANG_FM_BUTTONBAR_RECORD)); | 624 | str(LANG_FM_BUTTONBAR_RECORD)); |
620 | #endif | 625 | #endif |
621 | update_screen = true; | 626 | update_screen = true; |
622 | break; | 627 | break; |
@@ -646,10 +651,11 @@ bool radio_screen(void) | |||
646 | gui_textarea_clear(&screens[i]); | 651 | gui_textarea_clear(&screens[i]); |
647 | screen_set_xmargin(&screens[i],0); | 652 | screen_set_xmargin(&screens[i],0); |
648 | } | 653 | } |
649 | #if CONFIG_KEYPAD == RECORDER_PAD | 654 | #ifdef HAS_BUTTONBAR |
650 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 655 | gui_buttonbar_set(&buttonbar, |
651 | str(LANG_FM_BUTTONBAR_PRESETS), | 656 | str(LANG_BUTTONBAR_MENU), |
652 | str(LANG_FM_BUTTONBAR_RECORD)); | 657 | str(LANG_FM_BUTTONBAR_PRESETS), |
658 | str(LANG_FM_BUTTONBAR_RECORD)); | ||
653 | #endif | 659 | #endif |
654 | update_screen = true; | 660 | update_screen = true; |
655 | break; | 661 | break; |
@@ -807,16 +813,16 @@ bool radio_screen(void) | |||
807 | screens[i].puts_scroll(0, top_of_screen + 4, buf); | 813 | screens[i].puts_scroll(0, top_of_screen + 4, buf); |
808 | } | 814 | } |
809 | } | 815 | } |
810 | 816 | ||
811 | #if CONFIG_KEYPAD == RECORDER_PAD | 817 | #if HAS_BUTTONBAR |
812 | buttonbar_draw(); | 818 | gui_buttonbar_draw(&buttonbar); |
813 | #endif | 819 | #endif |
814 | FOR_NB_SCREENS(i) | 820 | FOR_NB_SCREENS(i) |
815 | gui_textarea_update(&screens[i]); | 821 | gui_textarea_update(&screens[i]); |
816 | } | 822 | } |
817 | /* Only force the redraw if update_screen is true */ | 823 | /* Only force the redraw if update_screen is true */ |
818 | gui_syncstatusbar_draw(&statusbars,true); | 824 | gui_syncstatusbar_draw(&statusbars,true); |
819 | 825 | ||
820 | update_screen = false; | 826 | update_screen = false; |
821 | } | 827 | } |
822 | 828 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index eda56a5bf9..63cd513c78 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include "icons.h" | 45 | #include "icons.h" |
46 | #include "screens.h" | 46 | #include "screens.h" |
47 | #include "peakmeter.h" | 47 | #include "peakmeter.h" |
48 | #include "status.h" | 48 | #include "statusbar.h" |
49 | #include "menu.h" | 49 | #include "menu.h" |
50 | #include "sound_menu.h" | 50 | #include "sound_menu.h" |
51 | #include "timefuncs.h" | 51 | #include "timefuncs.h" |
@@ -831,7 +831,7 @@ bool recording_screen(void) | |||
831 | lcd_puts(0, 6, buf); | 831 | lcd_puts(0, 6, buf); |
832 | } | 832 | } |
833 | 833 | ||
834 | status_draw(true); | 834 | gui_syncstatusbar_draw(&statusbars, true); |
835 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 835 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
836 | 836 | ||
837 | lcd_update(); | 837 | lcd_update(); |
@@ -860,7 +860,7 @@ bool recording_screen(void) | |||
860 | if (audio_stat & AUDIO_STATUS_ERROR) | 860 | if (audio_stat & AUDIO_STATUS_ERROR) |
861 | { | 861 | { |
862 | gui_syncsplash(0, true, str(LANG_DISK_FULL)); | 862 | gui_syncsplash(0, true, str(LANG_DISK_FULL)); |
863 | status_draw(true); | 863 | gui_syncstatusbar_draw(&statusbars, true); |
864 | lcd_update(); | 864 | lcd_update(); |
865 | audio_error_clear(); | 865 | audio_error_clear(); |
866 | 866 | ||