diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 95 | ||||
-rw-r--r-- | apps/settings.c | 50 |
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 | |||
915 | desc: option for 24 hour clock | 915 | desc: option for 24 hour clock |
916 | eng: "24 hour clock" | 916 | eng: "24 hour clock" |
917 | new: | 917 | new: |
918 | |||
919 | id: LANG_WEEKDAY_SUNDAY | ||
920 | desc: abbreviation for weekday | ||
921 | eng: "Sun" | ||
922 | new: | ||
923 | |||
924 | id: LANG_WEEKDAY_MONDAY | ||
925 | desc: abbreviation for weekday | ||
926 | eng: "Mon" | ||
927 | new: | ||
928 | |||
929 | id: LANG_WEEKDAY_TUESDAY | ||
930 | desc: abbreviation for weekday | ||
931 | eng: "Tue" | ||
932 | new: | ||
933 | |||
934 | id: LANG_WEEKDAY_WEDNESDAY | ||
935 | desc: abbreviation for weekday | ||
936 | eng: "Wed" | ||
937 | new: | ||
938 | |||
939 | id: LANF_WEEKDAY_THURSDAY | ||
940 | desc: abbreviation for weekday | ||
941 | eng: "Thu" | ||
942 | new: | ||
943 | |||
944 | id: LANG_WEEKDAY_FRIDAY | ||
945 | desc: abbreviation for weekday | ||
946 | eng: "Fri" | ||
947 | new: | ||
948 | |||
949 | id: LANG_WEEKDAY_SATURDAY | ||
950 | desc: abbreviation for weekday | ||
951 | eng: "Sat" | ||
952 | new: | ||
953 | |||
954 | id: LANG_MONTH_JANUARY | ||
955 | desc: abbreviation for monthname | ||
956 | eng: "Jan" | ||
957 | new: | ||
958 | |||
959 | id: LANG_MONTH_FEBRUARY | ||
960 | desc: abbreviation for monthname | ||
961 | eng: "Feb" | ||
962 | new: | ||
963 | |||
964 | id: LANG_MONTH_MARCH | ||
965 | desc: abbreviation for monthname | ||
966 | eng: "Mar" | ||
967 | new: | ||
968 | |||
969 | id: LANG_MONTH_APRIL | ||
970 | desc: abbreviation for monthname | ||
971 | eng: "Apr" | ||
972 | new: | ||
973 | |||
974 | id: LANG_MONTH_MAY | ||
975 | desc: abbreviation for monthname | ||
976 | eng: "May" | ||
977 | new: | ||
978 | |||
979 | id: LANG_MONTH_JUNE | ||
980 | desc: abbreviation for monthname | ||
981 | eng: "Jun" | ||
982 | new: | ||
983 | |||
984 | id: LANG_MONTH_JULY | ||
985 | desc: abbreviation for monthname | ||
986 | eng: "Jul" | ||
987 | new: | ||
988 | |||
989 | id: LANG_MONTH_AUGUST | ||
990 | desc: abbreviation for monthname | ||
991 | eng: "Aug" | ||
992 | new: | ||
993 | |||
994 | id: LANG_MONTH_SEPTEMBER | ||
995 | desc: abbreviation for monthname | ||
996 | eng: "Sep" | ||
997 | new: | ||
998 | |||
999 | id: LANG_MONTH_OCTOBER | ||
1000 | desc: abbreviation for monthname | ||
1001 | eng: "Oct" | ||
1002 | new: | ||
1003 | |||
1004 | id: LANG_MONTH_NOVEMBER | ||
1005 | desc: abbreviation for monthname | ||
1006 | eng: "Nov" | ||
1007 | new: | ||
1008 | |||
1009 | id: LANG_MONTH_DECEMBER | ||
1010 | desc: abbreviation for monthname | ||
1011 | eng: "Dec" | ||
1012 | new: | ||
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 |
884 | char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; | ||
885 | char *monthname[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", | ||
886 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | ||
887 | char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, | ||
888 | {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; | ||
889 | char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||
890 | |||
891 | bool set_time(char* string, int timedate[]) | 884 | bool 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 + |