diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-09-12 13:33:59 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-09-12 13:33:59 +0000 |
commit | 93b231c69366563ba441dc4907bfb036fe3b4c55 (patch) | |
tree | 0783ad028211f59e63925a354e4260a7209ffa24 /apps/settings.c | |
parent | 5ed78ea80cdaa0ede4df89568f0781fa477a5738 (diff) | |
download | rockbox-93b231c69366563ba441dc4907bfb036fe3b4c55.tar.gz rockbox-93b231c69366563ba441dc4907bfb036fe3b4c55.zip |
Greg Haerr's new loadable font. No more #ifdef font-style, removed old
propfont and loadable font code. New font file format.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2269 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 107 |
1 files changed, 16 insertions, 91 deletions
diff --git a/apps/settings.c b/apps/settings.c index a1bbe4a3db..ce2b28f16b 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "atoi.h" | 40 | #include "atoi.h" |
41 | #ifdef HAVE_LCD_BITMAP | 41 | #ifdef HAVE_LCD_BITMAP |
42 | #include "icons.h" | 42 | #include "icons.h" |
43 | #include "font.h" | ||
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | struct user_settings global_settings; | 46 | struct user_settings global_settings; |
@@ -772,15 +773,10 @@ void set_time(char* string, int timedate[]) | |||
772 | int realyear; | 773 | int realyear; |
773 | int julianday; | 774 | int julianday; |
774 | int i; | 775 | int i; |
775 | #if defined(LOADABLE_FONTS) || defined(LCD_PROPFONTS) | ||
776 | unsigned char reffub[5]; | 776 | unsigned char reffub[5]; |
777 | unsigned int width, height; | 777 | unsigned int width, height; |
778 | unsigned int separator_width, weekday_width; | 778 | unsigned int separator_width, weekday_width; |
779 | unsigned int line_height, prev_line_height; | 779 | unsigned int line_height, prev_line_height; |
780 | #if defined(LOADABLE_FONTS) | ||
781 | unsigned char *font = lcd_getcurrentldfont(); | ||
782 | #endif | ||
783 | #endif | ||
784 | 780 | ||
785 | #ifdef HAVE_LCD_BITMAP | 781 | #ifdef HAVE_LCD_BITMAP |
786 | if(global_settings.statusbar) | 782 | if(global_settings.statusbar) |
@@ -817,65 +813,35 @@ void set_time(char* string, int timedate[]) | |||
817 | timedate[1], | 813 | timedate[1], |
818 | timedate[2]); | 814 | timedate[2]); |
819 | lcd_puts(0, 1, buffer); | 815 | lcd_puts(0, 1, buffer); |
820 | #if defined(LCD_PROPFONTS) | 816 | |
821 | /* recalculate the positions and offsets */ | 817 | /* recalculate the positions and offsets */ |
822 | lcd_getstringsize(string, 0, &width, &prev_line_height); | 818 | lcd_getstringsize(string, FONT_UI, &width, &prev_line_height); |
823 | lcd_getstringsize(buffer, 0, &width, &line_height); | 819 | lcd_getstringsize(buffer, FONT_UI, &width, &line_height); |
824 | lcd_getstringsize(":", 0, &separator_width, &height); | 820 | lcd_getstringsize(":", FONT_UI, &separator_width, &height); |
825 | 821 | ||
826 | strncpy(reffub, buffer, 2); | 822 | strncpy(reffub, buffer, 2); |
827 | reffub[2] = '\0'; | 823 | reffub[2] = '\0'; |
828 | lcd_getstringsize(reffub, 0, &width, &height); | 824 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
829 | cursor[0][INDEX_X] = 0; | 825 | cursor[0][INDEX_X] = 0; |
830 | cursor[0][INDEX_Y] = 1 + prev_line_height + 1; | 826 | cursor[0][INDEX_Y] = 1 + prev_line_height + 1; |
831 | cursor[0][INDEX_WIDTH] = width; | 827 | cursor[0][INDEX_WIDTH] = width; |
832 | 828 | ||
833 | strncpy(reffub, buffer + 3, 2); | 829 | strncpy(reffub, buffer + 3, 2); |
834 | reffub[2] = '\0'; | 830 | reffub[2] = '\0'; |
835 | lcd_getstringsize(reffub, 0, &width, &height); | 831 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
836 | cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; | 832 | cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; |
837 | cursor[1][INDEX_Y] = 1 + prev_line_height + 1; | 833 | cursor[1][INDEX_Y] = 1 + prev_line_height + 1; |
838 | cursor[1][INDEX_WIDTH] = width; | 834 | cursor[1][INDEX_WIDTH] = width; |
839 | 835 | ||
840 | strncpy(reffub, buffer + 6, 2); | 836 | strncpy(reffub, buffer + 6, 2); |
841 | reffub[2] = '\0'; | 837 | reffub[2] = '\0'; |
842 | lcd_getstringsize(reffub, 0, &width, &height); | 838 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
843 | cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + | 839 | cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + |
844 | cursor[1][INDEX_WIDTH] + separator_width; | 840 | cursor[1][INDEX_WIDTH] + separator_width; |
845 | cursor[2][INDEX_Y] = 1 + prev_line_height + 1; | 841 | cursor[2][INDEX_Y] = 1 + prev_line_height + 1; |
846 | cursor[2][INDEX_WIDTH] = width; | 842 | cursor[2][INDEX_WIDTH] = width; |
847 | 843 | ||
848 | lcd_getstringsize(buffer, 0, &width, &prev_line_height); | 844 | lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height); |
849 | #elif defined(LOADABLE_FONTS) | ||
850 | /* recalculate the positions and offsets */ | ||
851 | lcd_getstringsize(string, font, &width, &prev_line_height); | ||
852 | lcd_getstringsize(buffer, font, &width, &line_height); | ||
853 | lcd_getstringsize(":", font, &separator_width, &height); | ||
854 | |||
855 | strncpy(reffub, buffer, 2); | ||
856 | reffub[2] = '\0'; | ||
857 | lcd_getstringsize(reffub, font, &width, &height); | ||
858 | cursor[0][INDEX_X] = 0; | ||
859 | cursor[0][INDEX_Y] = prev_line_height; | ||
860 | cursor[0][INDEX_WIDTH] = width; | ||
861 | |||
862 | strncpy(reffub, buffer + 3, 2); | ||
863 | reffub[2] = '\0'; | ||
864 | lcd_getstringsize(reffub, font, &width, &height); | ||
865 | cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; | ||
866 | cursor[1][INDEX_Y] = prev_line_height; | ||
867 | cursor[1][INDEX_WIDTH] = width; | ||
868 | |||
869 | strncpy(reffub, buffer + 6, 2); | ||
870 | reffub[2] = '\0'; | ||
871 | lcd_getstringsize(reffub, font, &width, &height); | ||
872 | cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + | ||
873 | cursor[1][INDEX_WIDTH] + separator_width; | ||
874 | cursor[2][INDEX_Y] = prev_line_height; | ||
875 | cursor[2][INDEX_WIDTH] = width; | ||
876 | |||
877 | lcd_getstringsize(buffer, font, &width, &prev_line_height); | ||
878 | #endif | ||
879 | 845 | ||
880 | snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", | 846 | snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", |
881 | dayname[timedate[6]], | 847 | dayname[timedate[6]], |
@@ -883,24 +849,24 @@ void set_time(char* string, int timedate[]) | |||
883 | monthname[timedate[4] - 1], | 849 | monthname[timedate[4] - 1], |
884 | timedate[5]); | 850 | timedate[5]); |
885 | lcd_puts(0, 2, buffer); | 851 | lcd_puts(0, 2, buffer); |
886 | #if defined(LCD_PROPFONTS) | 852 | |
887 | /* recalculate the positions and offsets */ | 853 | /* recalculate the positions and offsets */ |
888 | lcd_getstringsize(buffer, 0, &width, &line_height); | 854 | lcd_getstringsize(buffer, FONT_UI, &width, &line_height); |
889 | strncpy(reffub, buffer, 3); | 855 | strncpy(reffub, buffer, 3); |
890 | reffub[3] = '\0'; | 856 | reffub[3] = '\0'; |
891 | lcd_getstringsize(reffub, 0, &weekday_width, &height); | 857 | lcd_getstringsize(reffub, FONT_UI, &weekday_width, &height); |
892 | lcd_getstringsize(" ", 0, &separator_width, &height); | 858 | lcd_getstringsize(" ", FONT_UI, &separator_width, &height); |
893 | 859 | ||
894 | strncpy(reffub, buffer + 4, 4); | 860 | strncpy(reffub, buffer + 4, 4); |
895 | reffub[4] = '\0'; | 861 | reffub[4] = '\0'; |
896 | lcd_getstringsize(reffub, 0, &width, &height); | 862 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
897 | cursor[3][INDEX_X] = weekday_width + separator_width; | 863 | cursor[3][INDEX_X] = weekday_width + separator_width; |
898 | cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; | 864 | cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; |
899 | cursor[3][INDEX_WIDTH] = width; | 865 | cursor[3][INDEX_WIDTH] = width; |
900 | 866 | ||
901 | strncpy(reffub, buffer + 9, 3); | 867 | strncpy(reffub, buffer + 9, 3); |
902 | reffub[3] = '\0'; | 868 | reffub[3] = '\0'; |
903 | lcd_getstringsize(reffub, 0, &width, &height); | 869 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
904 | cursor[4][INDEX_X] = weekday_width + separator_width + | 870 | cursor[4][INDEX_X] = weekday_width + separator_width + |
905 | cursor[3][INDEX_WIDTH] + separator_width; | 871 | cursor[3][INDEX_WIDTH] + separator_width; |
906 | cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; | 872 | cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height + 1; |
@@ -908,7 +874,7 @@ void set_time(char* string, int timedate[]) | |||
908 | 874 | ||
909 | strncpy(reffub, buffer + 13, 2); | 875 | strncpy(reffub, buffer + 13, 2); |
910 | reffub[2] = '\0'; | 876 | reffub[2] = '\0'; |
911 | lcd_getstringsize(reffub, 0, &width, &height); | 877 | lcd_getstringsize(reffub, FONT_UI, &width, &height); |
912 | cursor[5][INDEX_X] = weekday_width + separator_width + | 878 | cursor[5][INDEX_X] = weekday_width + separator_width + |
913 | cursor[3][INDEX_WIDTH] + separator_width + | 879 | cursor[3][INDEX_WIDTH] + separator_width + |
914 | cursor[4][INDEX_WIDTH] + separator_width; | 880 | cursor[4][INDEX_WIDTH] + separator_width; |
@@ -919,48 +885,7 @@ void set_time(char* string, int timedate[]) | |||
919 | cursor[cursorpos][INDEX_Y] + lcd_getymargin(), | 885 | cursor[cursorpos][INDEX_Y] + lcd_getymargin(), |
920 | cursor[cursorpos][INDEX_WIDTH], | 886 | cursor[cursorpos][INDEX_WIDTH], |
921 | line_height); | 887 | line_height); |
922 | #elif defined(LOADABLE_FONTS) | ||
923 | /* recalculate the positions and offsets */ | ||
924 | lcd_getstringsize(buffer, font, &width, &line_height); | ||
925 | strncpy(reffub, buffer, 3); | ||
926 | reffub[3] = '\0'; | ||
927 | lcd_getstringsize(reffub, font, &weekday_width, &height); | ||
928 | lcd_getstringsize(" ", font, &separator_width, &height); | ||
929 | 888 | ||
930 | strncpy(reffub, buffer + 4, 4); | ||
931 | reffub[4] = '\0'; | ||
932 | lcd_getstringsize(reffub, font, &width, &height); | ||
933 | cursor[3][INDEX_X] = weekday_width + separator_width; | ||
934 | cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
935 | cursor[3][INDEX_WIDTH] = width; | ||
936 | |||
937 | strncpy(reffub, buffer + 9, 3); | ||
938 | reffub[3] = '\0'; | ||
939 | lcd_getstringsize(reffub, font, &width, &height); | ||
940 | cursor[4][INDEX_X] = weekday_width + separator_width + | ||
941 | cursor[3][INDEX_WIDTH] + separator_width; | ||
942 | cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
943 | cursor[4][INDEX_WIDTH] = width; | ||
944 | |||
945 | strncpy(reffub, buffer + 13, 2); | ||
946 | reffub[2] = '\0'; | ||
947 | lcd_getstringsize(reffub, font, &width, &height); | ||
948 | cursor[5][INDEX_X] = weekday_width + separator_width + | ||
949 | cursor[3][INDEX_WIDTH] + separator_width + | ||
950 | cursor[4][INDEX_WIDTH] + separator_width; | ||
951 | cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
952 | cursor[5][INDEX_WIDTH] = width; | ||
953 | |||
954 | lcd_invertrect(cursor[cursorpos][INDEX_X], | ||
955 | cursor[cursorpos][INDEX_Y] + lcd_getymargin(), | ||
956 | cursor[cursorpos][INDEX_WIDTH], | ||
957 | line_height); | ||
958 | #else | ||
959 | lcd_invertrect(cursor[cursorpos][INDEX_X], | ||
960 | cursor[cursorpos][INDEX_Y] + lcd_getymargin(), | ||
961 | cursor[cursorpos][INDEX_WIDTH], | ||
962 | 8); | ||
963 | #endif | ||
964 | lcd_puts(0, 4, "ON to set"); | 889 | lcd_puts(0, 4, "ON to set"); |
965 | lcd_puts(0, 5, "OFF to revert"); | 890 | lcd_puts(0, 5, "OFF to revert"); |
966 | #ifdef HAVE_LCD_BITMAP | 891 | #ifdef HAVE_LCD_BITMAP |