diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-06 08:32:37 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-06 08:32:37 +0000 |
commit | d996804600bb7bd2a025f20b564cdc87654119ea (patch) | |
tree | 31c268c9710214e0eabf4def9c1a698e7e0c7ce5 /apps/screens.c | |
parent | fafd18c0f2cae9e47f7def42253ccf4a84bcbc37 (diff) | |
download | rockbox-d996804600bb7bd2a025f20b564cdc87654119ea.tar.gz rockbox-d996804600bb7bd2a025f20b564cdc87654119ea.zip |
Use pointer to screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22981 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/apps/screens.c b/apps/screens.c index 5162cc4d14..8fad3eb260 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -603,9 +603,10 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
603 | FOR_NB_SCREENS(s) | 603 | FOR_NB_SCREENS(s) |
604 | { | 604 | { |
605 | struct viewport *vp = &viewports[s]; | 605 | struct viewport *vp = &viewports[s]; |
606 | struct screen *screen = &screens[s]; | ||
606 | 607 | ||
607 | viewport_set_defaults(vp, s); | 608 | viewport_set_defaults(vp, s); |
608 | screens[s].set_viewport(vp); | 609 | screen->set_viewport(vp); |
609 | nb_lines = viewport_get_nb_lines(vp); | 610 | nb_lines = viewport_get_nb_lines(vp); |
610 | 611 | ||
611 | /* minimum lines needed is 2 + title line */ | 612 | /* minimum lines needed is 2 + title line */ |
@@ -617,16 +618,16 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
617 | 618 | ||
618 | /* recalculate the positions and offsets */ | 619 | /* recalculate the positions and offsets */ |
619 | if (nb_lines >= 3) | 620 | if (nb_lines >= 3) |
620 | screens[s].getstringsize(title, NULL, &prev_line_height); | 621 | screen->getstringsize(title, NULL, &prev_line_height); |
621 | else | 622 | else |
622 | prev_line_height = 0; | 623 | prev_line_height = 0; |
623 | 624 | ||
624 | screens[s].getstringsize(SEPARATOR, &separator_width, NULL); | 625 | screen->getstringsize(SEPARATOR, &separator_width, NULL); |
625 | 626 | ||
626 | /* weekday */ | 627 | /* weekday */ |
627 | screens[s].getstringsize(str(LANG_WEEKDAY_SUNDAY + tm->tm_wday), | 628 | screen->getstringsize(str(LANG_WEEKDAY_SUNDAY + tm->tm_wday), |
628 | &weekday_width, NULL); | 629 | &weekday_width, NULL); |
629 | screens[s].getstringsize(" ", &separator_width, NULL); | 630 | screen->getstringsize(" ", &separator_width, NULL); |
630 | 631 | ||
631 | for(i=0, j=0; i < 6; i++) | 632 | for(i=0, j=0; i < 6; i++) |
632 | { | 633 | { |
@@ -635,21 +636,21 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
635 | j = weekday_width + separator_width; | 636 | j = weekday_width + separator_width; |
636 | prev_line_height *= 2; | 637 | prev_line_height *= 2; |
637 | } | 638 | } |
638 | screens[s].getstringsize(ptr[i], &width, NULL); | 639 | screen->getstringsize(ptr[i], &width, NULL); |
639 | cursor[i][INDEX_Y] = prev_line_height + statusbar_height; | 640 | cursor[i][INDEX_Y] = prev_line_height + statusbar_height; |
640 | cursor[i][INDEX_X] = j; | 641 | cursor[i][INDEX_X] = j; |
641 | j += width + separator_width; | 642 | j += width + separator_width; |
642 | } | 643 | } |
643 | 644 | ||
644 | /* draw the screen */ | 645 | /* draw the screen */ |
645 | screens[s].set_viewport(vp); | 646 | screen->set_viewport(vp); |
646 | screens[s].clear_viewport(); | 647 | screen->clear_viewport(); |
647 | /* display the screen title */ | 648 | /* display the screen title */ |
648 | screens[s].puts_scroll(0, 0, title); | 649 | screen->puts_scroll(0, 0, title); |
649 | 650 | ||
650 | /* these are not selectable, so we draw them outside the loop */ | 651 | /* these are not selectable, so we draw them outside the loop */ |
651 | /* name of the week day */ | 652 | /* name of the week day */ |
652 | screens[s].putsxy(0, cursor[3][INDEX_Y], | 653 | screen->putsxy(0, cursor[3][INDEX_Y], |
653 | str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); | 654 | str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); |
654 | 655 | ||
655 | /* draw the selected item with drawmode set to | 656 | /* draw the selected item with drawmode set to |
@@ -660,22 +661,22 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
660 | if (cursorpos == (int)i) | 661 | if (cursorpos == (int)i) |
661 | vp->drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 662 | vp->drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
662 | 663 | ||
663 | screens[s].putsxy(cursor[i][INDEX_X], | 664 | screen->putsxy(cursor[i][INDEX_X], |
664 | cursor[i][INDEX_Y], ptr[i]); | 665 | cursor[i][INDEX_Y], ptr[i]); |
665 | 666 | ||
666 | vp->drawmode = DRMODE_SOLID; | 667 | vp->drawmode = DRMODE_SOLID; |
667 | 668 | ||
668 | screens[s].putsxy(cursor[i/4 +1][INDEX_X] - separator_width, | 669 | screen->putsxy(cursor[i/4 +1][INDEX_X] - separator_width, |
669 | cursor[0][INDEX_Y], SEPARATOR); | 670 | cursor[0][INDEX_Y], SEPARATOR); |
670 | } | 671 | } |
671 | 672 | ||
672 | /* print help text */ | 673 | /* print help text */ |
673 | if (nb_lines > 4) | 674 | if (nb_lines > 4) |
674 | screens[s].puts(0, 4, str(LANG_TIME_SET_BUTTON)); | 675 | screen->puts(0, 4, str(LANG_TIME_SET_BUTTON)); |
675 | if (nb_lines > 5) | 676 | if (nb_lines > 5) |
676 | screens[s].puts(0, 5, str(LANG_TIME_REVERT)); | 677 | screen->puts(0, 5, str(LANG_TIME_REVERT)); |
677 | screens[s].update_viewport(); | 678 | screen->update_viewport(); |
678 | screens[s].set_viewport(NULL); | 679 | screen->set_viewport(NULL); |
679 | } | 680 | } |
680 | 681 | ||
681 | /* set the most common numbers */ | 682 | /* set the most common numbers */ |