mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Slight cleanup of the calendar plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22884 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
66cb6f8fd3
commit
e2c2642afa
1 changed files with 6 additions and 20 deletions
|
@ -262,13 +262,6 @@ static const int days_in_month[2][13] = {
|
||||||
static const char *dayname_long[7] = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
|
static const char *dayname_long[7] = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
|
||||||
static const char *dayname_short[7] = {"M","T","W","T","F","S","S"};
|
static const char *dayname_short[7] = {"M","T","W","T","F","S","S"};
|
||||||
|
|
||||||
struct today {
|
|
||||||
int mday; /* day of the month */
|
|
||||||
int mon; /* month */
|
|
||||||
int year; /* year since 1900 */
|
|
||||||
int wday; /* day of the week */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct shown {
|
struct shown {
|
||||||
int mday; /* day of the month */
|
int mday; /* day of the month */
|
||||||
int mon; /* month */
|
int mon; /* month */
|
||||||
|
@ -297,13 +290,11 @@ static int calc_weekday( struct shown *shown )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calendar_init(struct today *today, struct shown *shown)
|
static void calendar_init(struct shown *shown)
|
||||||
{
|
{
|
||||||
int w,h;
|
int w,h;
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
#else
|
|
||||||
(void)today;
|
|
||||||
#endif
|
#endif
|
||||||
rb->lcd_getstringsize("A",&w,&h);
|
rb->lcd_getstringsize("A",&w,&h);
|
||||||
if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) )
|
if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) )
|
||||||
|
@ -314,14 +305,10 @@ static void calendar_init(struct today *today, struct shown *shown)
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
tm = rb->get_time();
|
tm = rb->get_time();
|
||||||
today->mon = tm->tm_mon +1;
|
shown->mday = tm->tm_mday;
|
||||||
today->year = 2000+tm->tm_year%100;
|
shown->mon = tm->tm_mon +1;
|
||||||
today->wday = tm->tm_wday-1;
|
shown->year = 2000+tm->tm_year%100;
|
||||||
today->mday = tm->tm_mday;
|
shown->wday = tm->tm_wday-1;
|
||||||
shown->mday = today->mday;
|
|
||||||
shown->mon = today->mon;
|
|
||||||
shown->year = today->year;
|
|
||||||
shown->wday = today->wday;
|
|
||||||
#endif
|
#endif
|
||||||
shown->firstday = calc_weekday(shown);
|
shown->firstday = calc_weekday(shown);
|
||||||
leap_year = is_leap_year(shown->year);
|
leap_year = is_leap_year(shown->year);
|
||||||
|
@ -813,14 +800,13 @@ static void prev_day(struct shown *shown, int step)
|
||||||
|
|
||||||
enum plugin_status plugin_start(const void* parameter)
|
enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
struct today today;
|
|
||||||
struct shown shown;
|
struct shown shown;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int button;
|
int button;
|
||||||
|
|
||||||
(void)(parameter);
|
(void)(parameter);
|
||||||
|
|
||||||
calendar_init(&today, &shown);
|
calendar_init(&shown);
|
||||||
load_memo(&shown);
|
load_memo(&shown);
|
||||||
any_events(&shown, false);
|
any_events(&shown, false);
|
||||||
draw_calendar(&shown);
|
draw_calendar(&shown);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue