From e2a9fe194315508329c8434592edb76cb727c224 Mon Sep 17 00:00:00 2001 From: Markus Braun Date: Thu, 15 Aug 2002 06:36:25 +0000 Subject: time/date setting works now with loadable and proportional fonts code makeup git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1749 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 241 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 197 insertions(+), 44 deletions(-) (limited to 'apps/settings.c') diff --git a/apps/settings.c b/apps/settings.c index 8c73aab87b..85bd41a55f 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -526,58 +526,208 @@ void set_option(char* string, int* variable, char* options[], int numoptions ) #define INDEX_X 0 #define INDEX_Y 1 #define INDEX_WIDTH 2 -char *dayname[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; -char *monthname[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; -char cursor[][3]={{0, 1, 2}, {3, 1, 2}, {6, 1, 2}, {4, 2, 4}, {9, 2, 3}, {13, 2, 2}}; -char daysinmonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; +char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; +char *monthname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, + {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; +char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; void set_time(char* string, int timedate[]) { bool done = false; int button; - int min=0,steps=0; - int cursorpos=0; - int lastcursorpos=!cursorpos; + int min = 0, steps = 0; + int cursorpos = 0; + int lastcursorpos = !cursorpos; unsigned char buffer[19]; int realyear; int julianday; int i; +#if defined(LOADABLE_FONTS) || defined(LCD_PROPFONTS) + unsigned char reffub[5]; + unsigned int width, height; + unsigned int separator_width, weekday_width; + unsigned int line_height, prev_line_height; +#if defined(LOADABLE_FONTS) + unsigned char *font = lcd_getcurrentldfont(); +#endif +#endif lcd_clear_display(); - lcd_puts_scroll(0,0,string); + lcd_puts_scroll(0, 0, string); while ( !done ) { /* calculate the number of days in febuary */ - realyear=timedate[3]+2000; - if((realyear%4==0 && !(realyear%100 == 0)) || realyear%400 == 0) /* for february depends on year */ - daysinmonth[1]=29; + realyear = timedate[3] + 2000; + if((realyear % 4 == 0 && !(realyear % 100 == 0)) || realyear % 400 == 0) + daysinmonth[1] = 29; else - daysinmonth[1]=28; + daysinmonth[1] = 28; /* fix day if month or year changed */ - timedate[5]=timedate[5] daysinmonth[timedate[4] - 1]) + timedate[5] = daysinmonth[timedate[4] - 1]; /* calculate day of week */ - julianday=0; - for(i=0;i