summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang95
-rw-r--r--apps/settings.c50
2 files changed, 132 insertions, 13 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 846edde24a..a50b7c0b64 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -915,3 +915,98 @@ id: LANG_24_HOUR_CLOCK
915desc: option for 24 hour clock 915desc: option for 24 hour clock
916eng: "24 hour clock" 916eng: "24 hour clock"
917new: 917new:
918
919id: LANG_WEEKDAY_SUNDAY
920desc: abbreviation for weekday
921eng: "Sun"
922new:
923
924id: LANG_WEEKDAY_MONDAY
925desc: abbreviation for weekday
926eng: "Mon"
927new:
928
929id: LANG_WEEKDAY_TUESDAY
930desc: abbreviation for weekday
931eng: "Tue"
932new:
933
934id: LANG_WEEKDAY_WEDNESDAY
935desc: abbreviation for weekday
936eng: "Wed"
937new:
938
939id: LANF_WEEKDAY_THURSDAY
940desc: abbreviation for weekday
941eng: "Thu"
942new:
943
944id: LANG_WEEKDAY_FRIDAY
945desc: abbreviation for weekday
946eng: "Fri"
947new:
948
949id: LANG_WEEKDAY_SATURDAY
950desc: abbreviation for weekday
951eng: "Sat"
952new:
953
954id: LANG_MONTH_JANUARY
955desc: abbreviation for monthname
956eng: "Jan"
957new:
958
959id: LANG_MONTH_FEBRUARY
960desc: abbreviation for monthname
961eng: "Feb"
962new:
963
964id: LANG_MONTH_MARCH
965desc: abbreviation for monthname
966eng: "Mar"
967new:
968
969id: LANG_MONTH_APRIL
970desc: abbreviation for monthname
971eng: "Apr"
972new:
973
974id: LANG_MONTH_MAY
975desc: abbreviation for monthname
976eng: "May"
977new:
978
979id: LANG_MONTH_JUNE
980desc: abbreviation for monthname
981eng: "Jun"
982new:
983
984id: LANG_MONTH_JULY
985desc: abbreviation for monthname
986eng: "Jul"
987new:
988
989id: LANG_MONTH_AUGUST
990desc: abbreviation for monthname
991eng: "Aug"
992new:
993
994id: LANG_MONTH_SEPTEMBER
995desc: abbreviation for monthname
996eng: "Sep"
997new:
998
999id: LANG_MONTH_OCTOBER
1000desc: abbreviation for monthname
1001eng: "Oct"
1002new:
1003
1004id: LANG_MONTH_NOVEMBER
1005desc: abbreviation for monthname
1006eng: "Nov"
1007new:
1008
1009id: LANG_MONTH_DECEMBER
1010desc: abbreviation for monthname
1011eng: "Dec"
1012new:
diff --git a/apps/settings.c b/apps/settings.c
index 3dafebc368..6c0b21d088 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -881,13 +881,6 @@ bool set_option(char* string, int* variable, char* options[],
881#define INDEX_X 0 881#define INDEX_X 0
882#define INDEX_Y 1 882#define INDEX_Y 1
883#define INDEX_WIDTH 2 883#define INDEX_WIDTH 2
884char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
885char *monthname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
886 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
887char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12},
888 {24, 16, 24}, {54, 16, 18}, {78, 16, 12}};
889char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
890
891bool set_time(char* string, int timedate[]) 884bool set_time(char* string, int timedate[])
892{ 885{
893 bool done = false; 886 bool done = false;
@@ -903,6 +896,29 @@ bool set_time(char* string, int timedate[])
903 unsigned int width, height; 896 unsigned int width, height;
904 unsigned int separator_width, weekday_width; 897 unsigned int separator_width, weekday_width;
905 unsigned int line_height, prev_line_height; 898 unsigned int line_height, prev_line_height;
899 char *dayname[] = {str(LANG_WEEKDAY_SUNDAY),
900 str(LANG_WEEKDAY_MONDAY),
901 str(LANG_WEEKDAY_TUESDAY),
902 str(LANG_WEEKDAY_WEDNESDAY),
903 str(LANF_WEEKDAY_THURSDAY),
904 str(LANG_WEEKDAY_FRIDAY),
905 str(LANG_WEEKDAY_SATURDAY)};
906 char *monthname[] = {str(LANG_MONTH_JANUARY),
907 str(LANG_MONTH_FEBRUARY),
908 str(LANG_MONTH_MARCH),
909 str(LANG_MONTH_APRIL),
910 str(LANG_MONTH_MAY),
911 str(LANG_MONTH_JUNE),
912 str(LANG_MONTH_JULY),
913 str(LANG_MONTH_AUGUST),
914 str(LANG_MONTH_SEPTEMBER),
915 str(LANG_MONTH_OCTOBER),
916 str(LANG_MONTH_NOVEMBER),
917 str(LANG_MONTH_DECEMBER)};
918 char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12},
919 {24, 16, 24}, {54, 16, 18}, {78, 16, 12}};
920 char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
921
906 922
907#ifdef HAVE_LCD_BITMAP 923#ifdef HAVE_LCD_BITMAP
908 if(global_settings.statusbar) 924 if(global_settings.statusbar)
@@ -945,6 +961,7 @@ bool set_time(char* string, int timedate[])
945 lcd_getstringsize(buffer, &width, &line_height); 961 lcd_getstringsize(buffer, &width, &line_height);
946 lcd_getstringsize(":", &separator_width, &height); 962 lcd_getstringsize(":", &separator_width, &height);
947 963
964 /* hour */
948 strncpy(reffub, buffer, 2); 965 strncpy(reffub, buffer, 2);
949 reffub[2] = '\0'; 966 reffub[2] = '\0';
950 lcd_getstringsize(reffub, &width, &height); 967 lcd_getstringsize(reffub, &width, &height);
@@ -952,6 +969,7 @@ bool set_time(char* string, int timedate[])
952 cursor[0][INDEX_Y] = prev_line_height; 969 cursor[0][INDEX_Y] = prev_line_height;
953 cursor[0][INDEX_WIDTH] = width; 970 cursor[0][INDEX_WIDTH] = width;
954 971
972 /* minute */
955 strncpy(reffub, buffer + 3, 2); 973 strncpy(reffub, buffer + 3, 2);
956 reffub[2] = '\0'; 974 reffub[2] = '\0';
957 lcd_getstringsize(reffub, &width, &height); 975 lcd_getstringsize(reffub, &width, &height);
@@ -959,6 +977,7 @@ bool set_time(char* string, int timedate[])
959 cursor[1][INDEX_Y] = prev_line_height; 977 cursor[1][INDEX_Y] = prev_line_height;
960 cursor[1][INDEX_WIDTH] = width; 978 cursor[1][INDEX_WIDTH] = width;
961 979
980 /* second */
962 strncpy(reffub, buffer + 6, 2); 981 strncpy(reffub, buffer + 6, 2);
963 reffub[2] = '\0'; 982 reffub[2] = '\0';
964 lcd_getstringsize(reffub, &width, &height); 983 lcd_getstringsize(reffub, &width, &height);
@@ -978,27 +997,32 @@ bool set_time(char* string, int timedate[])
978 997
979 /* recalculate the positions and offsets */ 998 /* recalculate the positions and offsets */
980 lcd_getstringsize(buffer, &width, &line_height); 999 lcd_getstringsize(buffer, &width, &line_height);
981 strncpy(reffub, buffer, 3); 1000
982 reffub[3] = '\0'; 1001 /* weekday */
1002 strncpy(reffub, buffer, strlen(dayname[timedate[6]]));
1003 reffub[strlen(dayname[timedate[6]])] = '\0';
983 lcd_getstringsize(reffub, &weekday_width, &height); 1004 lcd_getstringsize(reffub, &weekday_width, &height);
984 lcd_getstringsize(" ", &separator_width, &height); 1005 lcd_getstringsize(" ", &separator_width, &height);
985 1006
986 strncpy(reffub, buffer + 4, 4); 1007 /* year */
1008 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 1, 4);
987 reffub[4] = '\0'; 1009 reffub[4] = '\0';
988 lcd_getstringsize(reffub, &width, &height); 1010 lcd_getstringsize(reffub, &width, &height);
989 cursor[3][INDEX_X] = weekday_width + separator_width; 1011 cursor[3][INDEX_X] = weekday_width + separator_width;
990 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; 1012 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
991 cursor[3][INDEX_WIDTH] = width; 1013 cursor[3][INDEX_WIDTH] = width;
992 1014
993 strncpy(reffub, buffer + 9, 3); 1015 /* month */
994 reffub[3] = '\0'; 1016 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + 6, strlen(monthname[timedate[4] - 1]));
1017 reffub[strlen(monthname[timedate[4] - 1])] = '\0';
995 lcd_getstringsize(reffub, &width, &height); 1018 lcd_getstringsize(reffub, &width, &height);
996 cursor[4][INDEX_X] = weekday_width + separator_width + 1019 cursor[4][INDEX_X] = weekday_width + separator_width +
997 cursor[3][INDEX_WIDTH] + separator_width; 1020 cursor[3][INDEX_WIDTH] + separator_width;
998 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; 1021 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
999 cursor[4][INDEX_WIDTH] = width; 1022 cursor[4][INDEX_WIDTH] = width;
1000 1023
1001 strncpy(reffub, buffer + 13, 2); 1024 /* day */
1025 strncpy(reffub, buffer + strlen(dayname[timedate[6]]) + strlen(monthname[timedate[4] - 1]) + 7, 2);
1002 reffub[2] = '\0'; 1026 reffub[2] = '\0';
1003 lcd_getstringsize(reffub, &width, &height); 1027 lcd_getstringsize(reffub, &width, &height);
1004 cursor[5][INDEX_X] = weekday_width + separator_width + 1028 cursor[5][INDEX_X] = weekday_width + separator_width +