summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/credits.c8
-rw-r--r--apps/main.c17
-rw-r--r--apps/main_menu.c5
-rw-r--r--apps/menu.c39
-rw-r--r--apps/recorder/bounce.c1
-rw-r--r--apps/recorder/icons.c23
-rw-r--r--apps/recorder/wormlet.c4
-rw-r--r--apps/settings.c107
-rw-r--r--apps/tree.c36
-rw-r--r--apps/wps-display.c20
-rw-r--r--apps/wps.c46
11 files changed, 80 insertions, 226 deletions
diff --git a/apps/credits.c b/apps/credits.c
index f3bbd5992b..f8b060f31c 100644
--- a/apps/credits.c
+++ b/apps/credits.c
@@ -19,6 +19,7 @@
19 19
20#include "credits.h" 20#include "credits.h"
21#include "lcd.h" 21#include "lcd.h"
22#include "font.h"
22#include "kernel.h" 23#include "kernel.h"
23#include "button.h" 24#include "button.h"
24#include "sprintf.h" 25#include "sprintf.h"
@@ -64,6 +65,7 @@ char* credits[] = {
64 "Chad Lockwood", 65 "Chad Lockwood",
65 "John Pybus", 66 "John Pybus",
66 "Randy Wood", 67 "Randy Wood",
68 "Gregory Haerr",
67}; 69};
68 70
69#ifdef HAVE_LCD_BITMAP 71#ifdef HAVE_LCD_BITMAP
@@ -111,15 +113,15 @@ void roll_credits(void)
111 int height; 113 int height;
112 int width; 114 int width;
113 115
114 lcd_getfontsize(0, &width, &height); 116 lcd_getfontsize(FONT_UI, &width, &height);
115 117
116 while(1) { 118 while(1) {
117 lcd_clear_display(); 119 lcd_clear_display();
118 for ( i=0; i <= (64-y)/height; i++ ) 120 for ( i=0; i <= (64-y)/height; i++ )
119 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"", 0); 121 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"", FONT_UI);
120 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ", 122 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
121 line+1, numnames); 123 line+1, numnames);
122 lcd_putsxy(0, 0, buffer, 0); 124 lcd_putsxy(0, 0, buffer, FONT_UI);
123 lcd_update(); 125 lcd_update();
124 126
125 if (button_get_w_tmo(HZ/20)) 127 if (button_get_w_tmo(HZ/20))
diff --git a/apps/main.c b/apps/main.c
index 22fd8f6051..4b8c9e1e7e 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -45,9 +45,7 @@
45#include "debug_menu.h" 45#include "debug_menu.h"
46#include "version.h" 46#include "version.h"
47#include "sprintf.h" 47#include "sprintf.h"
48#ifdef LOADABLE_FONTS 48#include "font.h"
49#include "unicode.h"
50#endif
51 49
52 50
53char appsversion[]=APPSVERSION; 51char appsversion[]=APPSVERSION;
@@ -65,10 +63,8 @@ void app_main(void)
65void init(void) 63void init(void)
66{ 64{
67 init_threads(); 65 init_threads();
68#ifdef LOADABLE_FONTS
69 unicode_init();
70#endif
71 lcd_init(); 66 lcd_init();
67 font_init();
72 show_logo(); 68 show_logo();
73 settings_reset(); 69 settings_reset();
74 settings_load(); 70 settings_load();
@@ -93,6 +89,10 @@ void init(void)
93 89
94 lcd_init(); 90 lcd_init();
95 91
92 // FIXME should call font_init before this,
93 // because may use loadable font in show_logo().
94 // I didn't call font_init here, since
95 // disk system isn't up yet.
96 show_logo(); 96 show_logo();
97 97
98#ifdef DEBUG 98#ifdef DEBUG
@@ -160,10 +160,7 @@ void init(void)
160 status_init(); 160 status_init();
161 usb_start_monitoring(); 161 usb_start_monitoring();
162 power_init(); 162 power_init();
163#ifdef LOADABLE_FONTS 163 font_init();
164 unicode_init();
165 lcd_init_fonts();
166#endif
167} 164}
168 165
169int main(void) 166int main(void)
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 464b514bc3..8c0b6a01f3 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -23,6 +23,7 @@
23#include "tree.h" 23#include "tree.h"
24#include "credits.h" 24#include "credits.h"
25#include "lcd.h" 25#include "lcd.h"
26#include "font.h"
26#include "button.h" 27#include "button.h"
27#include "kernel.h" 28#include "kernel.h"
28#include "main_menu.h" 29#include "main_menu.h"
@@ -96,9 +97,9 @@ int show_logo( void )
96#endif 97#endif
97 98
98 snprintf(version, sizeof(version), "Ver. %s", appsversion); 99 snprintf(version, sizeof(version), "Ver. %s", appsversion);
99 lcd_getfontsize(0, &font_w, &font_h); 100 lcd_getfontsize(FONT_SYSFIXED, &font_w, &font_h);
100 lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2), 101 lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2),
101 height+10+font_h, version, 0); 102 LCD_HEIGHT-font_h, version, FONT_SYSFIXED);
102 lcd_update(); 103 lcd_update();
103 104
104#else 105#else
diff --git a/apps/menu.c b/apps/menu.c
index f690a1a381..dd5b9ba1e8 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -19,6 +19,7 @@
19#include <stdbool.h> 19#include <stdbool.h>
20 20
21#include "lcd.h" 21#include "lcd.h"
22#include "font.h"
22#include "backlight.h" 23#include "backlight.h"
23#include "menu.h" 24#include "menu.h"
24#include "button.h" 25#include "button.h"
@@ -34,10 +35,6 @@
34#include "widgets.h" 35#include "widgets.h"
35#endif 36#endif
36 37
37#ifdef LOADABLE_FONTS
38#include "ajf.h"
39#endif
40
41struct menu { 38struct menu {
42 int top; 39 int top;
43 int cursor; 40 int cursor;
@@ -54,8 +51,10 @@ struct menu {
54 51
55#define LINE_X 0 /* X position the entry-list starts at */ 52#define LINE_X 0 /* X position the entry-list starts at */
56#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */ 53#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
57#define LINE_HEIGTH 8 /* pixels for each text line */
58 54
55//FIXME remove
56#define LINE_HEIGTH 8 /* pixels for each text line */
57//FIXME remove
59#define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y) 58#define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y)
60 59
61#define CURSOR_X (global_settings.scrollbar ? 1 : 0) 60#define CURSOR_X (global_settings.scrollbar ? 1 : 0)
@@ -89,17 +88,12 @@ struct menu {
89static struct menu menus[MAX_MENUS]; 88static struct menu menus[MAX_MENUS];
90static bool inuse[MAX_MENUS] = { false }; 89static bool inuse[MAX_MENUS] = { false };
91 90
92/* count in letter posistions, NOT pixels */ 91/* count in letter positions, NOT pixels */
93void put_cursorxy(int x, int y, bool on) 92void put_cursorxy(int x, int y, bool on)
94{ 93{
95#ifdef HAVE_LCD_BITMAP 94#ifdef HAVE_LCD_BITMAP
96#ifdef LOADABLE_FONTS 95 int fh, fw;
97 int fh; 96 lcd_getfontsize(FONT_UI, &fw, &fh);
98 unsigned char* font = lcd_getcurrentldfont();
99 fh = ajf_get_fontheight(font);
100#else
101 int fh = 8;
102#endif
103#endif 97#endif
104 98
105 /* place the cursor */ 99 /* place the cursor */
@@ -131,11 +125,10 @@ void put_cursorxy(int x, int y, bool on)
131static void menu_draw(int m) 125static void menu_draw(int m)
132{ 126{
133 int i = 0; 127 int i = 0;
134#ifdef LOADABLE_FONTS 128#if LCD_PROPFONTS
129 int fw, fh;
135 int menu_lines; 130 int menu_lines;
136 int fh; 131 lcd_getfontsize(FONT_UI, &fw, &fh);
137 unsigned char* font = lcd_getcurrentldfont();
138 fh = ajf_get_fontheight(font);
139 if (global_settings.statusbar) 132 if (global_settings.statusbar)
140 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; 133 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
141 else 134 else
@@ -148,7 +141,7 @@ static void menu_draw(int m)
148 lcd_clear_display(); /* ...then clean the screen */ 141 lcd_clear_display(); /* ...then clean the screen */
149#ifdef HAVE_LCD_BITMAP 142#ifdef HAVE_LCD_BITMAP
150 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */ 143 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
151 lcd_setfont(0); 144 lcd_setfont(FONT_UI);
152#endif 145#endif
153 /* correct cursor pos if out of screen */ 146 /* correct cursor pos if out of screen */
154 if (menus[m].cursor - menus[m].top >= menu_lines) 147 if (menus[m].cursor - menus[m].top >= menu_lines)
@@ -182,18 +175,18 @@ static void menu_draw(int m)
182static void put_cursor(int m, int target) 175static void put_cursor(int m, int target)
183{ 176{
184 bool do_update = true; 177 bool do_update = true;
185#ifdef LOADABLE_FONTS 178#if LCD_PROPFONTS
179 int fw, fh;
186 int menu_lines; 180 int menu_lines;
187 int fh; 181 lcd_getfontsize(FONT_UI, &fw, &fh);
188 unsigned char* font = lcd_getcurrentldfont();
189 fh = ajf_get_fontheight(font);
190 if (global_settings.statusbar) 182 if (global_settings.statusbar)
191 menu_lines = (LCD_HEIGHT-STATUSBAR_HEIGHT)/fh; 183 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
192 else 184 else
193 menu_lines = LCD_HEIGHT/fh; 185 menu_lines = LCD_HEIGHT/fh;
194#else 186#else
195 int menu_lines = MENU_LINES; 187 int menu_lines = MENU_LINES;
196#endif 188#endif
189
197 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, false); 190 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, false);
198 menus[m].cursor = target; 191 menus[m].cursor = target;
199 menu_draw(m); 192 menu_draw(m);
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index 96291066e5..999ba47366 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -136,7 +136,6 @@ static void loopit(void)
136 lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20], 136 lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20],
137 xtable[xx%71], table[yy&63], 137 xtable[xx%71], table[yy&63],
138 11, 16, false); 138 11, 16, false);
139
140 lcd_update(); 139 lcd_update();
141 140
142 ysanke+= values[NUM_YSANKE].num; 141 ysanke+= values[NUM_YSANKE].num;
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 0501a3f0c0..fbfaf6cd8c 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -16,8 +16,9 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <lcd.h>
20#include <string.h> 19#include <string.h>
20#include "lcd.h"
21#include "font.h"
21#include "kernel.h" 22#include "kernel.h"
22#include "sprintf.h" 23#include "sprintf.h"
23#include "rtc.h" 24#include "rtc.h"
@@ -233,15 +234,7 @@ void statusbar_icon_volume(int percent)
233 /* display volume lever numerical? */ 234 /* display volume lever numerical? */
234 if (TIME_BEFORE(current_tick,switch_tick)) { 235 if (TIME_BEFORE(current_tick,switch_tick)) {
235 snprintf(buffer, sizeof(buffer), "%2d", percent); 236 snprintf(buffer, sizeof(buffer), "%2d", percent);
236#if defined(LCD_PROPFONTS) 237 lcd_getstringsize(buffer, FONT_UI, &width, &height);
237 lcd_getstringsize(buffer, 0, &width, &height);
238#elif defined(LOADABLE_FONTS)
239 font = lcd_getcurrentldfont();
240 lcd_getstringsize(buffer, font, &width, &height);
241#else
242 width = 6*strlen(buffer);
243 height = 8;
244#endif
245 if (height <= STATUSBAR_HEIGHT) 238 if (height <= STATUSBAR_HEIGHT)
246 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 239 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 -
247 width/2, STATUSBAR_Y_POS, buffer, 0); 240 width/2, STATUSBAR_Y_POS, buffer, 0);
@@ -316,15 +309,7 @@ void statusbar_time(int hour, int minute)
316 strncpy(buffer, "--:--", sizeof buffer); 309 strncpy(buffer, "--:--", sizeof buffer);
317 } 310 }
318 311
319#if defined(LCD_PROPFONTS) 312 lcd_getstringsize(buffer, FONT_UI, &width, &height);
320 lcd_getstringsize(buffer, 0, &width, &height);
321#elif defined(LOADABLE_FONTS)
322 font = lcd_getcurrentldfont();
323 lcd_getstringsize(buffer, font, &width, &height);
324#else
325 width = 6*strlen(buffer);
326 height = 8;
327#endif
328 if (height <= STATUSBAR_HEIGHT) 313 if (height <= STATUSBAR_HEIGHT)
329 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, 0); 314 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, 0);
330} 315}
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c
index ba96f6b9de..84ee55062c 100644
--- a/apps/recorder/wormlet.c
+++ b/apps/recorder/wormlet.c
@@ -67,11 +67,7 @@
67/* size of the field the worm lives in */ 67/* size of the field the worm lives in */
68#define FIELD_RECT_X 1 68#define FIELD_RECT_X 1
69#define FIELD_RECT_Y 1 69#define FIELD_RECT_Y 1
70#ifdef LCD_PROPFONTS
71#define FIELD_RECT_WIDTH (LCD_WIDTH - 39) 70#define FIELD_RECT_WIDTH (LCD_WIDTH - 39)
72#else
73#define FIELD_RECT_WIDTH (LCD_WIDTH - 46)
74#endif
75#define FIELD_RECT_HEIGHT (LCD_HEIGHT - 2) 71#define FIELD_RECT_HEIGHT (LCD_HEIGHT - 2)
76 72
77/* size of the ring of the worm 73/* size of the ring of the worm
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
45struct user_settings global_settings; 46struct 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
diff --git a/apps/tree.c b/apps/tree.c
index 47853f03c9..21aa78c74d 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -26,6 +26,7 @@
26#include "dir.h" 26#include "dir.h"
27#include "file.h" 27#include "file.h"
28#include "lcd.h" 28#include "lcd.h"
29#include "font.h"
29#include "backlight.h" 30#include "backlight.h"
30#include "button.h" 31#include "button.h"
31#include "kernel.h" 32#include "kernel.h"
@@ -49,10 +50,6 @@
49#include "widgets.h" 50#include "widgets.h"
50#endif 51#endif
51 52
52#ifdef LOADABLE_FONTS
53#include "ajf.h"
54#endif
55
56#define NAME_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH * MAX_FILES_IN_DIR) 53#define NAME_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH * MAX_FILES_IN_DIR)
57 54
58char name_buffer[NAME_BUFFER_SIZE]; 55char name_buffer[NAME_BUFFER_SIZE];
@@ -190,17 +187,16 @@ static int showdir(char *path, int start)
190 int i; 187 int i;
191 int tree_max_on_screen; 188 int tree_max_on_screen;
192 bool dir_buffer_full; 189 bool dir_buffer_full;
193#ifdef LOADABLE_FONTS 190
194 int fh; 191#ifdef HAVE_LCD_BITMAP
195 unsigned char *font = lcd_getcurrentldfont(); 192 int fw, fh;
196 fh = ajf_get_fontheight(font); 193 lcd_getfontsize(FONT_UI, &fw, &fh);
197 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 194 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
198 line_height = fh; 195 line_height = fh;
199#else 196#else
200 tree_max_on_screen = TREE_MAX_ON_SCREEN; 197 tree_max_on_screen = TREE_MAX_ON_SCREEN;
201#endif 198#endif
202 199
203
204 /* new dir? cache it */ 200 /* new dir? cache it */
205 if (strncmp(path,lastdir,sizeof(lastdir))) { 201 if (strncmp(path,lastdir,sizeof(lastdir))) {
206 DIR *dir = opendir(path); 202 DIR *dir = opendir(path);
@@ -339,7 +335,7 @@ static int showdir(char *path, int start)
339 lcd_clear_display(); 335 lcd_clear_display();
340#ifdef HAVE_LCD_BITMAP 336#ifdef HAVE_LCD_BITMAP
341 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */ 337 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
342 lcd_setfont(0); 338 lcd_setfont(FONT_UI);
343#endif 339#endif
344 340
345 for ( i=start; i < start+tree_max_on_screen; i++ ) { 341 for ( i=start; i < start+tree_max_on_screen; i++ ) {
@@ -573,10 +569,9 @@ bool dirbrowse(char *root)
573 bool lastfilter = global_settings.mp3filter; 569 bool lastfilter = global_settings.mp3filter;
574 bool lastsortcase = global_settings.sort_case; 570 bool lastsortcase = global_settings.sort_case;
575 bool lastshowhidden = global_settings.show_hidden_files; 571 bool lastshowhidden = global_settings.show_hidden_files;
576#ifdef LOADABLE_FONTS 572#ifdef HAVE_LCD_BITMAP
577 int fh; 573 int fw, fh;
578 unsigned char *font = lcd_getcurrentldfont(); 574 lcd_getfontsize(FONT_UI, &fw, &fh);
579 fh = ajf_get_fontheight(font);
580 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 575 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
581#else 576#else
582 tree_max_on_screen = TREE_MAX_ON_SCREEN; 577 tree_max_on_screen = TREE_MAX_ON_SCREEN;
@@ -743,10 +738,8 @@ bool dirbrowse(char *root)
743 reload_root = true; 738 reload_root = true;
744 global_settings.resume_index = -1; 739 global_settings.resume_index = -1;
745 } 740 }
746#ifdef LOADABLE_FONTS 741#ifdef HAVE_LCD_BITMAP
747 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 742 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
748#else
749 tree_max_on_screen = TREE_MAX_ON_SCREEN;
750#endif 743#endif
751 } 744 }
752 } 745 }
@@ -836,10 +829,8 @@ bool dirbrowse(char *root)
836 lcd_stop_scroll(); 829 lcd_stop_scroll();
837 if (wps_show() == SYS_USB_CONNECTED) 830 if (wps_show() == SYS_USB_CONNECTED)
838 reload_root = true; 831 reload_root = true;
839#ifdef LOADABLE_FONTS 832#ifdef HAVE_LCD_BITMAP
840 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 833 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
841#else
842 tree_max_on_screen = TREE_MAX_ON_SCREEN;
843#endif 834#endif
844 restore = true; 835 restore = true;
845 } 836 }
@@ -855,10 +846,9 @@ bool dirbrowse(char *root)
855 case BUTTON_F3: 846 case BUTTON_F3:
856 if (f3_screen()) 847 if (f3_screen())
857 reload_root = true; 848 reload_root = true;
858#ifdef LOADABLE_FONTS 849
850#ifdef HAVE_LCD_BITMAP
859 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 851 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
860#else
861 tree_max_on_screen = TREE_MAX_ON_SCREEN;
862#endif 852#endif
863 restore = true; 853 restore = true;
864 break; 854 break;
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 5d6290d244..8d33c723a4 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -27,6 +27,7 @@
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29#include "lcd.h" 29#include "lcd.h"
30#include "font.h"
30#include "mpeg.h" 31#include "mpeg.h"
31#include "id3.h" 32#include "id3.h"
32#include "settings.h" 33#include "settings.h"
@@ -42,10 +43,6 @@
42#include "widgets.h" 43#include "widgets.h"
43#endif 44#endif
44 45
45#ifdef LOADABLE_FONTS
46#include "ajf.h"
47#endif
48
49#define WPS_CONFIG ROCKBOX_DIR "/default.wps" 46#define WPS_CONFIG ROCKBOX_DIR "/default.wps"
50 47
51#ifdef HAVE_LCD_BITMAP 48#ifdef HAVE_LCD_BITMAP
@@ -551,11 +548,7 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_all)
551#else 548#else
552 int w,h; 549 int w,h;
553 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 550 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
554#ifdef LCD_PROPFONTS 551 lcd_getstringsize("M",FONT_UI,&w,&h);
555 lcd_getstringsize("M",0,&w,&h);
556#else
557 lcd_getfontsize(0,&w,&h);
558#endif
559 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6, 552 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6,
560 (id3->elapsed + ff_rewind_count) * 100 / id3->length, 553 (id3->elapsed + ff_rewind_count) * 100 / id3->length,
561 Grow_Right); 554 Grow_Right);
@@ -581,15 +574,6 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_all)
581 574
582void wps_display(struct mp3entry* id3) 575void wps_display(struct mp3entry* id3)
583{ 576{
584 int font_height;
585
586#ifdef LOADABLE_FONTS
587 unsigned char *font = lcd_getcurrentldfont();
588 font_height = ajf_get_fontheight(font);
589#else
590 font_height = 8;
591#endif
592
593 lcd_clear_display(); 577 lcd_clear_display();
594 578
595 if (!id3 && !mpeg_is_playing()) 579 if (!id3 && !mpeg_is_playing())
diff --git a/apps/wps.c b/apps/wps.c
index 4ac2476da7..d10eb92655 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -22,6 +22,7 @@
22 22
23#include "file.h" 23#include "file.h"
24#include "lcd.h" 24#include "lcd.h"
25#include "font.h"
25#include "backlight.h" 26#include "backlight.h"
26#include "button.h" 27#include "button.h"
27#include "kernel.h" 28#include "kernel.h"
@@ -40,10 +41,6 @@
40#include "icons.h" 41#include "icons.h"
41#endif 42#endif
42 43
43#ifdef LOADABLE_FONTS
44#include "ajf.h"
45#endif
46
47#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ 44#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
48 /* 3% of 30min file == 54s step size */ 45 /* 3% of 30min file == 54s step size */
49 46
@@ -634,21 +631,17 @@ bool f2_screen(void)
634 char buf[32]; 631 char buf[32];
635 632
636 /* Get the font height */ 633 /* Get the font height */
637#ifdef LCD_PROPFONTS 634 lcd_getstringsize("A",FONT_UI,&w,&h);
638 lcd_getstringsize("A",0,&w,&h);
639#else
640 lcd_getfontsize(0,&w,&h);
641#endif
642 635
643 lcd_stop_scroll(); 636 lcd_stop_scroll();
644 637
645 while (!exit) { 638 while (!exit) {
646 lcd_clear_display(); 639 lcd_clear_display();
647 640
648 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Shuffle", 0); 641 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Shuffle", FONT_UI);
649 lcd_putsxy(0, LCD_HEIGHT/2 - h, "mode:", 0); 642 lcd_putsxy(0, LCD_HEIGHT/2 - h, "mode:", FONT_UI);
650 lcd_putsxy(0, LCD_HEIGHT/2, 643 lcd_putsxy(0, LCD_HEIGHT/2,
651 global_settings.playlist_shuffle ? "on" : "off", 0); 644 global_settings.playlist_shuffle ? "on" : "off", FONT_UI);
652 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 645 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
653 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 646 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
654 647
@@ -656,13 +649,8 @@ bool f2_screen(void)
656 global_settings.mp3filter ? "on" : "off"); 649 global_settings.mp3filter ? "on" : "off");
657 650
658 /* Get the string width and height */ 651 /* Get the string width and height */
659#ifdef LCD_PROPFONTS 652 lcd_getstringsize(buf,FONT_UI,&w,&h);
660 lcd_getstringsize(buf,0,&w,&h); 653 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf, FONT_UI);
661#else
662 lcd_getfontsize(0,&w,&h);
663 w *= strlen(buf);
664#endif
665 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf, 0);
666 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 654 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
667 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 655 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
668 656
@@ -717,26 +705,20 @@ bool f3_screen(void)
717 char* ptr; 705 char* ptr;
718 706
719 ptr = "Status"; 707 ptr = "Status";
720#ifdef LCD_PROPFONTS 708 lcd_getstringsize(ptr,FONT_UI,&w,&h);
721 lcd_getstringsize(ptr,0,&w,&h);
722#else
723 lcd_getfontsize(0,&w,&h);
724 w *= strlen(ptr);
725#endif
726
727 lcd_clear_display(); 709 lcd_clear_display();
728 710
729 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Scroll", 0); 711 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Scroll", FONT_UI);
730 lcd_putsxy(0, LCD_HEIGHT/2 - h, "bar:", 0); 712 lcd_putsxy(0, LCD_HEIGHT/2 - h, "bar:", FONT_UI);
731 lcd_putsxy(0, LCD_HEIGHT/2, 713 lcd_putsxy(0, LCD_HEIGHT/2,
732 global_settings.scrollbar ? "on" : "off", 0); 714 global_settings.scrollbar ? "on" : "off", FONT_UI);
733 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 715 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
734 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 716 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
735 717
736 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, 0); 718 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, FONT_UI);
737 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, "bar:", 0); 719 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, "bar:", FONT_UI);
738 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, 720 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
739 global_settings.statusbar ? "on" : "off", 0 ); 721 global_settings.statusbar ? "on" : "off", FONT_UI);
740 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], 722 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
741 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); 723 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
742 lcd_update(); 724 lcd_update();