diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-11 13:59:27 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-11 13:59:27 +0000 |
commit | aff220c9f50229be955878d603d4c05df65fc605 (patch) | |
tree | 547a89a6b10b90081a270ba90e42db7640284f4d /apps/screens.c | |
parent | 10df05438e329c7271c8cc7c4e9cdf2adace52dd (diff) | |
download | rockbox-aff220c9f50229be955878d603d4c05df65fc605.tar.gz rockbox-aff220c9f50229be955878d603d4c05df65fc605.zip |
and the time/date screen...
also change the order the yes/no screen clears the viewport.. stop_scroll should be called before clear or you might get artifacts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17455 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/apps/screens.c b/apps/screens.c index eb6956ab4e..fc5c0053ec 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include "splash.h" | 52 | #include "splash.h" |
53 | #include "statusbar.h" | 53 | #include "statusbar.h" |
54 | #include "screen_access.h" | 54 | #include "screen_access.h" |
55 | #include "quickscreen.h" | ||
56 | #include "pcmbuf.h" | 55 | #include "pcmbuf.h" |
57 | #include "list.h" | 56 | #include "list.h" |
58 | #include "yesno.h" | 57 | #include "yesno.h" |
@@ -449,6 +448,8 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
449 | unsigned int prev_line_height; | 448 | unsigned int prev_line_height; |
450 | int daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | 449 | int daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
451 | unsigned char buffer[20]; | 450 | unsigned char buffer[20]; |
451 | struct viewport vp[NB_SCREENS]; | ||
452 | int nb_lines; | ||
452 | 453 | ||
453 | /* 6 possible cursor possitions, 2 values stored for each: x, y */ | 454 | /* 6 possible cursor possitions, 2 values stored for each: x, y */ |
454 | unsigned int cursor[6][2]; | 455 | unsigned int cursor[6][2]; |
@@ -508,16 +509,18 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
508 | 509 | ||
509 | FOR_NB_SCREENS(s) | 510 | FOR_NB_SCREENS(s) |
510 | { | 511 | { |
512 | viewport_set_defaults(&vp[s], s); | ||
513 | nb_lines = viewport_get_nb_lines(&vp[s]); | ||
514 | |||
511 | /* minimum lines needed is 2 + title line */ | 515 | /* minimum lines needed is 2 + title line */ |
512 | gui_textarea_update_nblines(&screens[s]); | 516 | if (nb_lines < 4) |
513 | if (screens[s].nb_lines < 4) | ||
514 | { | 517 | { |
515 | screens[s].setfont(FONT_SYSFIXED); | 518 | vp[s].font = FONT_SYSFIXED; |
516 | gui_textarea_update_nblines(&screens[s]); | 519 | nb_lines = viewport_get_nb_lines(&vp[s]); |
517 | } | 520 | } |
518 | 521 | ||
519 | /* recalculate the positions and offsets */ | 522 | /* recalculate the positions and offsets */ |
520 | if (screens[s].nb_lines >= 3) | 523 | if (nb_lines >= 3) |
521 | screens[s].getstringsize(title, NULL, &prev_line_height); | 524 | screens[s].getstringsize(title, NULL, &prev_line_height); |
522 | else | 525 | else |
523 | prev_line_height = 0; | 526 | prev_line_height = 0; |
@@ -542,13 +545,15 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
542 | } | 545 | } |
543 | 546 | ||
544 | /* draw the screen */ | 547 | /* draw the screen */ |
545 | screens[s].set_drawmode(DRMODE_SOLID); | 548 | screens[s].set_viewport(&vp[s]); |
546 | gui_textarea_clear(&screens[s]); | 549 | screens[s].stop_scroll(); |
550 | screens[s].clear_viewport(); | ||
547 | /* display the screen title */ | 551 | /* display the screen title */ |
548 | screens[s].puts_scroll(0, 0, title); | 552 | screens[s].puts_scroll(0, 0, title); |
549 | 553 | ||
550 | /* these are not selectable, so we draw them outside the loop */ | 554 | /* these are not selectable, so we draw them outside the loop */ |
551 | screens[s].putsxy(0, cursor[3][INDEX_Y], str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); /* name of the week day */ | 555 | screens[s].putsxy(0, cursor[3][INDEX_Y], |
556 | str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); /* name of the week day */ | ||
552 | 557 | ||
553 | /* draw the selected item with drawmode set to | 558 | /* draw the selected item with drawmode set to |
554 | DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable | 559 | DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable |
@@ -556,23 +561,24 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
556 | for(i=0; i<6; i++) | 561 | for(i=0; i<6; i++) |
557 | { | 562 | { |
558 | if (cursorpos == (int)i) | 563 | if (cursorpos == (int)i) |
559 | screens[s].set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 564 | vp[s].drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
560 | 565 | ||
561 | screens[s].putsxy(cursor[i][INDEX_X], | 566 | screens[s].putsxy(cursor[i][INDEX_X], |
562 | cursor[i][INDEX_Y], ptr[i]); | 567 | cursor[i][INDEX_Y], ptr[i]); |
563 | 568 | ||
564 | screens[s].set_drawmode(DRMODE_SOLID); | 569 | vp[s].drawmode = DRMODE_SOLID; |
565 | 570 | ||
566 | screens[s].putsxy(cursor[i/4 +1][INDEX_X] - separator_width, | 571 | screens[s].putsxy(cursor[i/4 +1][INDEX_X] - separator_width, |
567 | cursor[0][INDEX_Y], SEPARATOR); | 572 | cursor[0][INDEX_Y], SEPARATOR); |
568 | } | 573 | } |
569 | 574 | ||
570 | /* print help text */ | 575 | /* print help text */ |
571 | if (screens[s].nb_lines > 4) | 576 | if (nb_lines > 4) |
572 | screens[s].puts(0, 4, str(LANG_TIME_SET_BUTTON)); | 577 | screens[s].puts(0, 4, str(LANG_TIME_SET_BUTTON)); |
573 | if (screens[s].nb_lines > 5) | 578 | if (nb_lines > 5) |
574 | screens[s].puts(0, 5, str(LANG_TIME_REVERT)); | 579 | screens[s].puts(0, 5, str(LANG_TIME_REVERT)); |
575 | screens[s].update(); | 580 | screens[s].update_viewport(); |
581 | screens[s].set_viewport(NULL); | ||
576 | } | 582 | } |
577 | gui_syncstatusbar_draw(&statusbars, true); | 583 | gui_syncstatusbar_draw(&statusbars, true); |
578 | 584 | ||
@@ -643,11 +649,6 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
643 | break; | 649 | break; |
644 | } | 650 | } |
645 | } | 651 | } |
646 | FOR_NB_SCREENS(i) | ||
647 | { | ||
648 | screens[i].setfont(FONT_UI); | ||
649 | gui_textarea_update_nblines(&screens[i]); | ||
650 | } | ||
651 | return false; | 652 | return false; |
652 | } | 653 | } |
653 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ | 654 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ |