From ba93850ee30b3a2d8227735690546c7f8843f621 Mon Sep 17 00:00:00 2001 From: Markus Braun Date: Sat, 21 Sep 2002 14:21:31 +0000 Subject: Fixed time/date setting for new font system. Enbled time/date setting in simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2363 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 14 +++++++------- apps/settings_menu.c | 23 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/settings.c b/apps/settings.c index 5d1ffef4a4..5b2991a8ef 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -785,7 +785,7 @@ void set_option(char* string, int* variable, char* options[], lcd_stop_scroll(); } -#ifdef HAVE_RTC +#ifdef HAVE_LCD_BITMAP #define INDEX_X 0 #define INDEX_Y 1 #define INDEX_WIDTH 2 @@ -857,14 +857,14 @@ void set_time(char* string, int timedate[]) reffub[2] = '\0'; lcd_getstringsize(reffub, FONT_UI, &width, &height); cursor[0][INDEX_X] = 0; - cursor[0][INDEX_Y] = 1 + prev_line_height + 1; + cursor[0][INDEX_Y] = prev_line_height; cursor[0][INDEX_WIDTH] = width; strncpy(reffub, buffer + 3, 2); reffub[2] = '\0'; lcd_getstringsize(reffub, FONT_UI, &width, &height); cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; - cursor[1][INDEX_Y] = 1 + prev_line_height + 1; + cursor[1][INDEX_Y] = prev_line_height; cursor[1][INDEX_WIDTH] = width; strncpy(reffub, buffer + 6, 2); @@ -872,7 +872,7 @@ void set_time(char* string, int timedate[]) lcd_getstringsize(reffub, FONT_UI, &width, &height); cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + cursor[1][INDEX_WIDTH] + separator_width; - cursor[2][INDEX_Y] = 1 + prev_line_height + 1; + cursor[2][INDEX_Y] = prev_line_height; cursor[2][INDEX_WIDTH] = width; lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height); @@ -895,7 +895,7 @@ void set_time(char* string, int timedate[]) reffub[4] = '\0'; lcd_getstringsize(reffub, FONT_UI, &width, &height); cursor[3][INDEX_X] = weekday_width + separator_width; - cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; + cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; cursor[3][INDEX_WIDTH] = width; strncpy(reffub, buffer + 9, 3); @@ -903,7 +903,7 @@ void set_time(char* string, int timedate[]) lcd_getstringsize(reffub, FONT_UI, &width, &height); cursor[4][INDEX_X] = weekday_width + separator_width + cursor[3][INDEX_WIDTH] + separator_width; - cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; + cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; cursor[4][INDEX_WIDTH] = width; strncpy(reffub, buffer + 13, 2); @@ -912,7 +912,7 @@ void set_time(char* string, int timedate[]) cursor[5][INDEX_X] = weekday_width + separator_width + cursor[3][INDEX_WIDTH] + separator_width + cursor[4][INDEX_WIDTH] + separator_width; - cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; + cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; cursor[5][INDEX_WIDTH] = width; lcd_invertrect(cursor[cursorpos][INDEX_X], diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 678eda437e..5ad7a1e79c 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -116,12 +116,12 @@ static Menu deep_discharge(void) } #endif -#ifdef HAVE_RTC +#ifdef HAVE_LCD_BITMAP static Menu timedate_set(void) { int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */ - +#ifdef HAVE_RTC timedate[0] = rtc_read(0x03); /* hour */ timedate[1] = rtc_read(0x02); /* minute */ timedate[2] = rtc_read(0x01); /* second */ @@ -141,10 +141,24 @@ static Menu timedate_set(void) timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f); /* day */ timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); - +#else /* SIMULATOR */ + /* hour */ + timedate[0] = 0; + /* minute */ + timedate[1] = 0; + /* second */ + timedate[2] = 0; + /* year */ + timedate[3] = 0; + /* month */ + timedate[4] = 1; + /* day */ + timedate[5] = 1; +#endif set_time(str(LANG_TIME),timedate); +#ifdef HAVE_RTC if(timedate[0] != -1) { /* hour */ timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f; @@ -168,6 +182,7 @@ static Menu timedate_set(void) rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ } +#endif return MENU_OK; } #endif @@ -319,7 +334,7 @@ static Menu system_settings_menu(void) #ifdef HAVE_CHARGE_CTRL { str(LANG_DISCHARGE), deep_discharge }, #endif -#ifdef HAVE_RTC +#ifdef HAVE_LCD_BITMAP { str(LANG_TIME), timedate_set }, #endif { str(LANG_RESET), reset_settings }, -- cgit v1.2.3