diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-08-11 09:17:47 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-08-11 09:17:47 +0000 |
commit | cd225736f95555c7083b642675d013bff8057d76 (patch) | |
tree | b3e1bde3e0a22f11911401ea232e553341aee40c | |
parent | 13fdf7e5a5df4cd2f34615c15fddd56f92e84d91 (diff) | |
download | rockbox-cd225736f95555c7083b642675d013bff8057d76.tar.gz rockbox-cd225736f95555c7083b642675d013bff8057d76.zip |
First version of loadable fonts patch by Alex Gitelman
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1666 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/Makefile | 2 | ||||
-rw-r--r-- | apps/main.c | 13 | ||||
-rw-r--r-- | apps/menu.c | 40 | ||||
-rw-r--r-- | apps/tree.c | 44 | ||||
-rw-r--r-- | apps/wps.c | 47 | ||||
-rw-r--r-- | firmware/Makefile | 13 | ||||
-rw-r--r-- | firmware/common/dir.c | 1 | ||||
-rw-r--r-- | firmware/drivers/fat.c | 38 | ||||
-rw-r--r-- | firmware/drivers/lcd.c | 198 | ||||
-rw-r--r-- | firmware/drivers/lcd.h | 11 | ||||
-rw-r--r-- | firmware/mpeg.c | 2 | ||||
-rw-r--r-- | firmware/panic.c | 5 | ||||
-rw-r--r-- | tools/Makefile | 8 | ||||
-rwxr-xr-x | tools/configure | 38 | ||||
-rw-r--r-- | uisimulator/x11/Makefile | 27 |
15 files changed, 400 insertions, 87 deletions
diff --git a/apps/Makefile b/apps/Makefile index 3629813595..0347c03507 100644 --- a/apps/Makefile +++ b/apps/Makefile | |||
@@ -25,7 +25,7 @@ TARGET = -DARCHOS_PLAYER_OLD=1 | |||
25 | # store output files in this directory: | 25 | # store output files in this directory: |
26 | OBJDIR = . | 26 | OBJDIR = . |
27 | 27 | ||
28 | CFLAGS = -O -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" | 28 | CFLAGS = -O -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) |
29 | AFLAGS += -small -relax | 29 | AFLAGS += -small -relax |
30 | 30 | ||
31 | ifdef DEBUG | 31 | ifdef DEBUG |
diff --git a/apps/main.c b/apps/main.c index 895f79af3b..887c85b64e 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -44,10 +44,11 @@ | |||
44 | #include "backlight.h" | 44 | #include "backlight.h" |
45 | #include "status.h" | 45 | #include "status.h" |
46 | #include "debug_menu.h" | 46 | #include "debug_menu.h" |
47 | |||
48 | #include "version.h" | 47 | #include "version.h" |
49 | |||
50 | #include "sprintf.h" | 48 | #include "sprintf.h" |
49 | #ifdef LOADABLE_FONTS | ||
50 | #include "unicode.h" | ||
51 | #endif | ||
51 | 52 | ||
52 | char appsversion[]=APPSVERSION; | 53 | char appsversion[]=APPSVERSION; |
53 | 54 | ||
@@ -64,6 +65,9 @@ void app_main(void) | |||
64 | void init(void) | 65 | void init(void) |
65 | { | 66 | { |
66 | init_threads(); | 67 | init_threads(); |
68 | #ifdef LOADABLE_FONTS | ||
69 | unicode_init(); | ||
70 | #endif | ||
67 | lcd_init(); | 71 | lcd_init(); |
68 | show_logo(); | 72 | show_logo(); |
69 | settings_reset(); | 73 | settings_reset(); |
@@ -153,8 +157,11 @@ void init(void) | |||
153 | 157 | ||
154 | status_init(); | 158 | status_init(); |
155 | usb_start_monitoring(); | 159 | usb_start_monitoring(); |
156 | |||
157 | power_init(); | 160 | power_init(); |
161 | #ifdef LOADABLE_FONTS | ||
162 | unicode_init(); | ||
163 | lcd_init_fonts(); | ||
164 | #endif | ||
158 | } | 165 | } |
159 | 166 | ||
160 | int main(void) | 167 | int main(void) |
diff --git a/apps/menu.c b/apps/menu.c index c8a5d0e73d..7267afe193 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -22,11 +22,14 @@ | |||
22 | #include "button.h" | 22 | #include "button.h" |
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "debug.h" | 24 | #include "debug.h" |
25 | #include "panic.h" | ||
25 | 26 | ||
26 | #ifdef HAVE_LCD_BITMAP | 27 | #ifdef HAVE_LCD_BITMAP |
27 | #include "icons.h" | 28 | #include "icons.h" |
28 | #endif | 29 | #endif |
29 | 30 | #ifdef LOADABLE_FONTS | |
31 | #include "ajf.h" | ||
32 | #endif | ||
30 | struct menu { | 33 | struct menu { |
31 | int top; | 34 | int top; |
32 | int cursor; | 35 | int cursor; |
@@ -54,11 +57,19 @@ static bool inuse[MAX_MENUS] = { false }; | |||
54 | /* count in letter posistions, NOT pixels */ | 57 | /* count in letter posistions, NOT pixels */ |
55 | void put_cursorxy(int x, int y, bool on) | 58 | void put_cursorxy(int x, int y, bool on) |
56 | { | 59 | { |
60 | #ifdef LOADABLE_FONTS | ||
61 | int fh; | ||
62 | unsigned char* font = lcd_getcurrentldfont(); | ||
63 | fh = ajf_get_fontheight(font); | ||
64 | #else | ||
65 | int fh = 8; | ||
66 | #endif | ||
67 | |||
57 | /* place the cursor */ | 68 | /* place the cursor */ |
58 | if(on) { | 69 | if(on) { |
59 | #ifdef HAVE_LCD_BITMAP | 70 | #ifdef HAVE_LCD_BITMAP |
60 | lcd_bitmap ( bitmap_icons_6x8[Cursor], | 71 | lcd_bitmap ( bitmap_icons_6x8[Cursor], |
61 | x*6, y*8, 4, 8, true); | 72 | x*6, y*fh, 4, 8, true); |
62 | #elif defined(SIMULATOR) | 73 | #elif defined(SIMULATOR) |
63 | /* player simulator */ | 74 | /* player simulator */ |
64 | unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; | 75 | unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; |
@@ -70,7 +81,7 @@ void put_cursorxy(int x, int y, bool on) | |||
70 | else { | 81 | else { |
71 | #if defined(HAVE_LCD_BITMAP) | 82 | #if defined(HAVE_LCD_BITMAP) |
72 | /* I use xy here since it needs to disregard the margins */ | 83 | /* I use xy here since it needs to disregard the margins */ |
73 | lcd_clearrect (x*6, y*8, 4, 8); | 84 | lcd_clearrect (x*6, y*fh, 4, 8); |
74 | #elif defined(SIMULATOR) | 85 | #elif defined(SIMULATOR) |
75 | /* player simulator in action */ | 86 | /* player simulator in action */ |
76 | lcd_clearrect (x*6, 12+y*16, 4, 8); | 87 | lcd_clearrect (x*6, 12+y*16, 4, 8); |
@@ -83,6 +94,15 @@ void put_cursorxy(int x, int y, bool on) | |||
83 | static void menu_draw(int m) | 94 | static void menu_draw(int m) |
84 | { | 95 | { |
85 | int i = 0; | 96 | int i = 0; |
97 | #ifdef LOADABLE_FONTS | ||
98 | int menu_lines; | ||
99 | int fh; | ||
100 | unsigned char* font = lcd_getcurrentldfont(); | ||
101 | fh = ajf_get_fontheight(font); | ||
102 | menu_lines = LCD_HEIGHT/fh; | ||
103 | #else | ||
104 | int menu_lines = MENU_LINES; | ||
105 | #endif | ||
86 | 106 | ||
87 | lcd_clear_display(); | 107 | lcd_clear_display(); |
88 | lcd_stop_scroll(); | 108 | lcd_stop_scroll(); |
@@ -91,7 +111,7 @@ static void menu_draw(int m) | |||
91 | lcd_setfont(0); | 111 | lcd_setfont(0); |
92 | #endif | 112 | #endif |
93 | for (i = menus[m].top; | 113 | for (i = menus[m].top; |
94 | (i < menus[m].itemcount) && (i<menus[m].top+MENU_LINES); | 114 | (i < menus[m].itemcount) && (i<menus[m].top+menu_lines); |
95 | i++) { | 115 | i++) { |
96 | if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) | 116 | if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) |
97 | lcd_puts_scroll(1, i-menus[m].top, menus[m].items[i].desc); | 117 | lcd_puts_scroll(1, i-menus[m].top, menus[m].items[i].desc); |
@@ -111,7 +131,15 @@ static void menu_draw(int m) | |||
111 | static void put_cursor(int m, int target) | 131 | static void put_cursor(int m, int target) |
112 | { | 132 | { |
113 | bool do_update = true; | 133 | bool do_update = true; |
114 | 134 | #ifdef LOADABLE_FONTS | |
135 | int menu_lines; | ||
136 | int fh; | ||
137 | unsigned char* font = lcd_getcurrentldfont(); | ||
138 | fh = ajf_get_fontheight(font); | ||
139 | menu_lines = LCD_HEIGHT/fh; | ||
140 | #else | ||
141 | int menu_lines = MENU_LINES; | ||
142 | #endif | ||
115 | put_cursorxy(0, menus[m].cursor - menus[m].top, false); | 143 | put_cursorxy(0, menus[m].cursor - menus[m].top, false); |
116 | menus[m].cursor = target; | 144 | menus[m].cursor = target; |
117 | menu_draw(m); | 145 | menu_draw(m); |
@@ -121,7 +149,7 @@ static void put_cursor(int m, int target) | |||
121 | menu_draw(m); | 149 | menu_draw(m); |
122 | do_update = false; | 150 | do_update = false; |
123 | } | 151 | } |
124 | else if ( target-menus[m].top > MENU_LINES-1 ) { | 152 | else if ( target-menus[m].top > menu_lines-1 ) { |
125 | menus[m].top++; | 153 | menus[m].top++; |
126 | menu_draw(m); | 154 | menu_draw(m); |
127 | do_update = false; | 155 | do_update = false; |
diff --git a/apps/tree.c b/apps/tree.c index cbb19fc2bd..80af6e01d6 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -43,6 +43,10 @@ | |||
43 | #include "icons.h" | 43 | #include "icons.h" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef LOADABLE_FONTS | ||
47 | #include "ajf.h" | ||
48 | #endif | ||
49 | |||
46 | #define MAX_FILES_IN_DIR 200 | 50 | #define MAX_FILES_IN_DIR 200 |
47 | #define TREE_MAX_FILENAMELEN MAX_PATH | 51 | #define TREE_MAX_FILENAMELEN MAX_PATH |
48 | #define MAX_DIR_LEVELS 10 | 52 | #define MAX_DIR_LEVELS 10 |
@@ -152,8 +156,20 @@ static int showdir(char *path, int start) | |||
152 | { | 156 | { |
153 | #ifdef HAVE_LCD_BITMAP | 157 | #ifdef HAVE_LCD_BITMAP |
154 | int icon_type = 0; | 158 | int icon_type = 0; |
159 | int line_height = LINE_HEIGTH; | ||
155 | #endif | 160 | #endif |
156 | int i; | 161 | int i; |
162 | int tree_max_on_screen; | ||
163 | #ifdef LOADABLE_FONTS | ||
164 | int fh; | ||
165 | unsigned char *font = lcd_getcurrentldfont(); | ||
166 | fh = ajf_get_fontheight(font); | ||
167 | tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y; | ||
168 | line_height = fh; | ||
169 | #else | ||
170 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | ||
171 | #endif | ||
172 | |||
157 | 173 | ||
158 | /* new dir? cache it */ | 174 | /* new dir? cache it */ |
159 | if (strncmp(path,lastdir,sizeof(lastdir))) { | 175 | if (strncmp(path,lastdir,sizeof(lastdir))) { |
@@ -217,7 +233,7 @@ static int showdir(char *path, int start) | |||
217 | lcd_setfont(0); | 233 | lcd_setfont(0); |
218 | #endif | 234 | #endif |
219 | 235 | ||
220 | for ( i=start; i < start+TREE_MAX_ON_SCREEN; i++ ) { | 236 | for ( i=start; i < start+tree_max_on_screen; i++ ) { |
221 | int len; | 237 | int len; |
222 | 238 | ||
223 | if ( i >= filesindir ) | 239 | if ( i >= filesindir ) |
@@ -235,9 +251,10 @@ static int showdir(char *path, int start) | |||
235 | icon_type = File; | 251 | icon_type = File; |
236 | } | 252 | } |
237 | lcd_bitmap(bitmap_icons_6x8[icon_type], | 253 | lcd_bitmap(bitmap_icons_6x8[icon_type], |
238 | 6, MARGIN_Y+(LINE_Y+i-start)*LINE_HEIGTH, 6, 8, true); | 254 | 6, MARGIN_Y+(LINE_Y+i-start)*line_height, 6, 8, true); |
239 | #endif | 255 | #endif |
240 | 256 | ||
257 | |||
241 | /* if MP3 filter is on, cut off the extension */ | 258 | /* if MP3 filter is on, cut off the extension */ |
242 | if (global_settings.mp3filter && | 259 | if (global_settings.mp3filter && |
243 | (dircacheptr[i]->attr & (TREE_ATTR_M3U|TREE_ATTR_MP3))) | 260 | (dircacheptr[i]->attr & (TREE_ATTR_M3U|TREE_ATTR_MP3))) |
@@ -270,6 +287,15 @@ bool dirbrowse(char *root) | |||
270 | int rc; | 287 | int rc; |
271 | int button; | 288 | int button; |
272 | int start_index; | 289 | int start_index; |
290 | int tree_max_on_screen; | ||
291 | #ifdef LOADABLE_FONTS | ||
292 | int fh; | ||
293 | unsigned char *font = lcd_getcurrentldfont(); | ||
294 | fh = ajf_get_fontheight(font); | ||
295 | tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y; | ||
296 | #else | ||
297 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | ||
298 | #endif | ||
273 | 299 | ||
274 | memcpy(currdir,root,sizeof(currdir)); | 300 | memcpy(currdir,root,sizeof(currdir)); |
275 | numentries = showdir(root, start); | 301 | numentries = showdir(root, start); |
@@ -379,7 +405,7 @@ bool dirbrowse(char *root) | |||
379 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); | 405 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
380 | } | 406 | } |
381 | else { | 407 | else { |
382 | if (numentries < TREE_MAX_ON_SCREEN) { | 408 | if (numentries < tree_max_on_screen) { |
383 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, | 409 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, |
384 | false); | 410 | false); |
385 | dircursor = numentries - 1; | 411 | dircursor = numentries - 1; |
@@ -387,11 +413,11 @@ bool dirbrowse(char *root) | |||
387 | true); | 413 | true); |
388 | } | 414 | } |
389 | else { | 415 | else { |
390 | start = numentries - TREE_MAX_ON_SCREEN; | 416 | start = numentries - tree_max_on_screen; |
391 | dircursor = TREE_MAX_ON_SCREEN - 1; | 417 | dircursor = tree_max_on_screen - 1; |
392 | numentries = showdir(currdir, start); | 418 | numentries = showdir(currdir, start); |
393 | put_cursorxy(0, CURSOR_Y + LINE_Y + | 419 | put_cursorxy(0, CURSOR_Y + LINE_Y + |
394 | TREE_MAX_ON_SCREEN - 1, true); | 420 | tree_max_on_screen - 1, true); |
395 | } | 421 | } |
396 | } | 422 | } |
397 | } | 423 | } |
@@ -404,7 +430,7 @@ bool dirbrowse(char *root) | |||
404 | if(filesindir) | 430 | if(filesindir) |
405 | { | 431 | { |
406 | if (dircursor + start + 1 < numentries ) { | 432 | if (dircursor + start + 1 < numentries ) { |
407 | if(dircursor+1 < TREE_MAX_ON_SCREEN) { | 433 | if(dircursor+1 < tree_max_on_screen) { |
408 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, | 434 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, |
409 | false); | 435 | false); |
410 | dircursor++; | 436 | dircursor++; |
@@ -417,7 +443,7 @@ bool dirbrowse(char *root) | |||
417 | } | 443 | } |
418 | } | 444 | } |
419 | else { | 445 | else { |
420 | if(numentries < TREE_MAX_ON_SCREEN) { | 446 | if(numentries < tree_max_on_screen) { |
421 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, | 447 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, |
422 | false); | 448 | false); |
423 | start = dircursor = 0; | 449 | start = dircursor = 0; |
@@ -512,7 +538,7 @@ bool dirbrowse(char *root) | |||
512 | /* restore display */ | 538 | /* restore display */ |
513 | /* We need to adjust if the number of lines on screen have | 539 | /* We need to adjust if the number of lines on screen have |
514 | changed because of a status bar change */ | 540 | changed because of a status bar change */ |
515 | if(CURSOR_Y+LINE_Y+dircursor>TREE_MAX_ON_SCREEN) { | 541 | if(CURSOR_Y+LINE_Y+dircursor>tree_max_on_screen) { |
516 | start++; | 542 | start++; |
517 | dircursor--; | 543 | dircursor--; |
518 | } | 544 | } |
diff --git a/apps/wps.c b/apps/wps.c index 53458ca140..2bf384b20c 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -39,6 +39,10 @@ | |||
39 | #include "widgets.h" | 39 | #include "widgets.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #ifdef LOADABLE_FONTS | ||
43 | #include "ajf.h" | ||
44 | #endif | ||
45 | |||
42 | #ifdef HAVE_LCD_BITMAP | 46 | #ifdef HAVE_LCD_BITMAP |
43 | #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ | 47 | #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ |
44 | #else /* HAVE_LCD_BITMAP */ | 48 | #else /* HAVE_LCD_BITMAP */ |
@@ -59,6 +63,15 @@ bool keys_locked = false; | |||
59 | 63 | ||
60 | static void draw_screen(struct mp3entry* id3) | 64 | static void draw_screen(struct mp3entry* id3) |
61 | { | 65 | { |
66 | int font_height; | ||
67 | #ifdef LOADABLE_FONTS | ||
68 | unsigned char *font = lcd_getcurrentldfont(); | ||
69 | font_height = ajf_get_fontheight(font); | ||
70 | #else | ||
71 | font_height = 8; | ||
72 | #endif | ||
73 | |||
74 | |||
62 | lcd_clear_display(); | 75 | lcd_clear_display(); |
63 | if(!id3) | 76 | if(!id3) |
64 | { | 77 | { |
@@ -125,7 +138,7 @@ static void draw_screen(struct mp3entry* id3) | |||
125 | lcd_puts(0, l++, id3->album?id3->album:""); | 138 | lcd_puts(0, l++, id3->album?id3->album:""); |
126 | lcd_puts(0, l++, id3->artist?id3->artist:""); | 139 | lcd_puts(0, l++, id3->artist?id3->artist:""); |
127 | 140 | ||
128 | if(LINE_Y==0) { | 141 | if(LINE_Y==0&&font_height<=8) { |
129 | if(id3->vbr) | 142 | if(id3->vbr) |
130 | snprintf(buffer, sizeof(buffer), "%d kbit (avg)", | 143 | snprintf(buffer, sizeof(buffer), "%d kbit (avg)", |
131 | id3->bitrate); | 144 | id3->bitrate); |
@@ -133,7 +146,6 @@ static void draw_screen(struct mp3entry* id3) | |||
133 | snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate); | 146 | snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate); |
134 | 147 | ||
135 | lcd_puts(0, l++, buffer); | 148 | lcd_puts(0, l++, buffer); |
136 | |||
137 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); | 149 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); |
138 | lcd_puts(0, l++, buffer); | 150 | lcd_puts(0, l++, buffer); |
139 | } | 151 | } |
@@ -148,7 +160,6 @@ static void draw_screen(struct mp3entry* id3) | |||
148 | lcd_puts(0, l++, buffer); | 160 | lcd_puts(0, l++, buffer); |
149 | } | 161 | } |
150 | #else | 162 | #else |
151 | |||
152 | lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>"); | 163 | lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>"); |
153 | lcd_puts_scroll(0, l++, id3->title?id3->title:"<no title>"); | 164 | lcd_puts_scroll(0, l++, id3->title?id3->title:"<no title>"); |
154 | #endif | 165 | #endif |
@@ -444,13 +455,13 @@ int wps_show(void) | |||
444 | if(!keys_locked && !dont_go_to_menu && menu_button_is_down) | 455 | if(!keys_locked && !dont_go_to_menu && menu_button_is_down) |
445 | { | 456 | { |
446 | #ifdef HAVE_LCD_BITMAP | 457 | #ifdef HAVE_LCD_BITMAP |
447 | bool laststate=statusbar(false); | 458 | bool laststate=statusbar(false); |
448 | #endif | 459 | #endif |
449 | lcd_stop_scroll(); | 460 | lcd_stop_scroll(); |
450 | button_set_release(old_release_mask); | 461 | button_set_release(old_release_mask); |
451 | main_menu(); | 462 | main_menu(); |
452 | #ifdef HAVE_LCD_BITMAP | 463 | #ifdef HAVE_LCD_BITMAP |
453 | statusbar(laststate); | 464 | statusbar(laststate); |
454 | #endif | 465 | #endif |
455 | old_release_mask = button_set_release(RELEASE_MASK); | 466 | old_release_mask = button_set_release(RELEASE_MASK); |
456 | id3 = mpeg_current_track(); | 467 | id3 = mpeg_current_track(); |
@@ -464,14 +475,14 @@ int wps_show(void) | |||
464 | break; | 475 | break; |
465 | 476 | ||
466 | #ifdef HAVE_RECORDER_KEYPAD | 477 | #ifdef HAVE_RECORDER_KEYPAD |
467 | case BUTTON_F3: | 478 | case BUTTON_F3: |
468 | #ifdef HAVE_LCD_BITMAP | 479 | #ifdef HAVE_LCD_BITMAP |
469 | if(global_settings.statusbar) { | 480 | if(global_settings.statusbar) { |
470 | statusbar_toggle(); | 481 | statusbar_toggle(); |
471 | draw_screen(id3); | 482 | draw_screen(id3); |
472 | } | 483 | } |
473 | #endif | 484 | #endif |
474 | break; | 485 | break; |
475 | #endif | 486 | #endif |
476 | 487 | ||
477 | #ifdef HAVE_RECORDER_KEYPAD | 488 | #ifdef HAVE_RECORDER_KEYPAD |
@@ -504,19 +515,19 @@ int wps_show(void) | |||
504 | usb_wait_for_disconnect(&button_queue); | 515 | usb_wait_for_disconnect(&button_queue); |
505 | 516 | ||
506 | #ifdef HAVE_LCD_BITMAP | 517 | #ifdef HAVE_LCD_BITMAP |
507 | statusbar(laststate); | 518 | statusbar(laststate); |
508 | #endif | 519 | #endif |
509 | /* Signal to our caller that we have been in USB mode */ | 520 | /* Signal to our caller that we have been in USB mode */ |
510 | return SYS_USB_CONNECTED; | 521 | return SYS_USB_CONNECTED; |
511 | break; | 522 | break; |
512 | } | 523 | } |
513 | #endif | 524 | #endif |
514 | case BUTTON_NONE: /* Timeout */ | 525 | case BUTTON_NONE: /* Timeout */ |
515 | if (mpeg_is_playing() && id3) | 526 | if (mpeg_is_playing() && id3) |
516 | { | 527 | { |
517 | #ifdef HAVE_LCD_BITMAP | 528 | #ifdef HAVE_LCD_BITMAP |
518 | snprintf(buffer,sizeof(buffer), | 529 | snprintf(buffer,sizeof(buffer), |
519 | "Time:%3d:%02d/%d:%02d", | 530 | "Time:%3d:%02d/%d:%02d", |
520 | id3->elapsed / 60000, | 531 | id3->elapsed / 60000, |
521 | id3->elapsed % 60000 / 1000, | 532 | id3->elapsed % 60000 / 1000, |
522 | id3->length / 60000, | 533 | id3->length / 60000, |
@@ -524,9 +535,9 @@ int wps_show(void) | |||
524 | 535 | ||
525 | lcd_puts(0, 6, buffer); | 536 | lcd_puts(0, 6, buffer); |
526 | 537 | ||
527 | slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, | 538 | slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, |
528 | id3->elapsed*100/id3->length, | 539 | id3->elapsed*100/id3->length, |
529 | Grow_Right); | 540 | Grow_Right); |
530 | 541 | ||
531 | lcd_update(); | 542 | lcd_update(); |
532 | #else | 543 | #else |
@@ -535,7 +546,7 @@ int wps_show(void) | |||
535 | if (global_settings.wps_display == | 546 | if (global_settings.wps_display == |
536 | PLAY_DISPLAY_FILENAME_SCROLL) | 547 | PLAY_DISPLAY_FILENAME_SCROLL) |
537 | { | 548 | { |
538 | snprintf(buffer,sizeof(buffer), "%d:%02d/%d:%02d ", | 549 | snprintf(buffer,sizeof(buffer), "%d:%02d/%d:%02d ", |
539 | id3->elapsed / 60000, | 550 | id3->elapsed / 60000, |
540 | id3->elapsed % 60000 / 1000, | 551 | id3->elapsed % 60000 / 1000, |
541 | id3->length / 60000, | 552 | id3->length / 60000, |
diff --git a/firmware/Makefile b/firmware/Makefile index 69a27a1b40..eb173848f3 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -15,6 +15,8 @@ OC = sh-elf-objcopy | |||
15 | 15 | ||
16 | INCLUDES=-Iinclude -I. -Icommon -Idrivers | 16 | INCLUDES=-Iinclude -I. -Icommon -Idrivers |
17 | 17 | ||
18 | SYSTEM_FONT = fonts/alt6x10.bdf | ||
19 | |||
18 | # Pick a target to build for | 20 | # Pick a target to build for |
19 | TARGET = -DARCHOS_PLAYER=1 | 21 | TARGET = -DARCHOS_PLAYER=1 |
20 | #TARGET = -DARCHOS_PLAYER_OLD=1 | 22 | #TARGET = -DARCHOS_PLAYER_OLD=1 |
@@ -23,7 +25,7 @@ TARGET = -DARCHOS_PLAYER=1 | |||
23 | # store output files in this directory: | 25 | # store output files in this directory: |
24 | OBJDIR = . | 26 | OBJDIR = . |
25 | 27 | ||
26 | CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) | 28 | CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) |
27 | 29 | ||
28 | ifdef DEBUG | 30 | ifdef DEBUG |
29 | CFLAGS += -g -DDEBUG | 31 | CFLAGS += -g -DDEBUG |
@@ -39,7 +41,11 @@ DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc | |||
39 | 41 | ||
40 | OUTPUT = $(OBJDIR)/librockbox.a | 42 | OUTPUT = $(OBJDIR)/librockbox.a |
41 | 43 | ||
42 | $(OUTPUT): $(OBJS) | 44 | ifdef LOADABLE_FONTS |
45 | EXTRA_TARGETS = $(OBJDIR)/system.ajf | ||
46 | endif | ||
47 | |||
48 | $(OUTPUT): $(OBJS) $(EXTRA_TARGETS) | ||
43 | $(AR) ruv $@ $+ | 49 | $(AR) ruv $@ $+ |
44 | 50 | ||
45 | $(OBJDIR)/%.o: %.c | 51 | $(OBJDIR)/%.o: %.c |
@@ -50,6 +56,9 @@ $(OBJDIR)/%.o: %.S | |||
50 | @mkdir -p `dirname $@` | 56 | @mkdir -p `dirname $@` |
51 | $(CC) $(CFLAGS) -c $< -o $@ | 57 | $(CC) $(CFLAGS) -c $< -o $@ |
52 | 58 | ||
59 | $(OBJDIR)/system.ajf: ../tools/bdf2ajf $(SYSTEM_FONT) | ||
60 | ../tools/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/system.ajf | ||
61 | |||
53 | clean: | 62 | clean: |
54 | rm -f $(OBJS) $(OUTPUT) | 63 | rm -f $(OBJS) $(OUTPUT) |
55 | rm -rf $(OBJDIR)/$(DEPS) | 64 | rm -rf $(OBJDIR)/$(DEPS) |
diff --git a/firmware/common/dir.c b/firmware/common/dir.c index 473997bd37..809e1a28e5 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c | |||
@@ -107,6 +107,7 @@ struct dirent* readdir(DIR* dir) | |||
107 | 107 | ||
108 | if ( !entry.name[0] ) | 108 | if ( !entry.name[0] ) |
109 | return NULL; | 109 | return NULL; |
110 | |||
110 | 111 | ||
111 | strncpy(theent->d_name, entry.name, sizeof( theent->d_name ) ); | 112 | strncpy(theent->d_name, entry.name, sizeof( theent->d_name ) ); |
112 | theent->attribute = entry.attr; | 113 | theent->attribute = entry.attr; |
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 75915bd710..7fe011c863 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sys/timeb.h> | 27 | #include <sys/timeb.h> |
28 | #endif | 28 | #endif |
29 | #include <stdbool.h> | 29 | #include <stdbool.h> |
30 | #include <unicode.h> | ||
30 | #include "fat.h" | 31 | #include "fat.h" |
31 | #include "ata.h" | 32 | #include "ata.h" |
32 | #include "debug.h" | 33 | #include "debug.h" |
@@ -1029,12 +1030,14 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry) | |||
1029 | /* replace shortname with longname? */ | 1030 | /* replace shortname with longname? */ |
1030 | if ( longs ) { | 1031 | if ( longs ) { |
1031 | int j,k,l=0; | 1032 | int j,k,l=0; |
1032 | |||
1033 | /* iterate backwards through the dir entries */ | 1033 | /* iterate backwards through the dir entries */ |
1034 | for (j=longs-1; j>=0; j--) { | 1034 | for (j=longs-1; j>=0; j--) { |
1035 | unsigned char* ptr = dir->cached_buf; | 1035 | unsigned char* ptr = dir->cached_buf; |
1036 | int index = longarray[j]; | 1036 | int index = longarray[j]; |
1037 | 1037 | #ifdef LOADABLE_FONTS | |
1038 | int offset_idx = 0; | ||
1039 | unsigned char uni_char[2]; | ||
1040 | #endif | ||
1038 | /* current or cached sector? */ | 1041 | /* current or cached sector? */ |
1039 | if ( sectoridx >= SECTOR_SIZE ) { | 1042 | if ( sectoridx >= SECTOR_SIZE ) { |
1040 | if ( sectoridx >= SECTOR_SIZE*2 ) { | 1043 | if ( sectoridx >= SECTOR_SIZE*2 ) { |
@@ -1052,16 +1055,39 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry) | |||
1052 | index &= SECTOR_SIZE-1; | 1055 | index &= SECTOR_SIZE-1; |
1053 | } | 1056 | } |
1054 | 1057 | ||
1055 | /* piece together the name subcomponents. | 1058 | /* piece together the name subcomponents. */ |
1056 | names are stored in unicode, but we | 1059 | #ifdef LOADABLE_FONTS |
1057 | only grab the low byte (iso8859-1). | 1060 | for (k=0; k<5; k++) |
1058 | */ | 1061 | { |
1062 | offset_idx = index + k*2 + 1; | ||
1063 | uni_char[0] = ptr[offset_idx+1]; | ||
1064 | uni_char[1] = ptr[offset_idx]; | ||
1065 | entry->name[l++] = from_unicode(uni_char); | ||
1066 | } | ||
1067 | for (k=0; k<6; k++) | ||
1068 | { | ||
1069 | offset_idx = index + k*2 + 14; | ||
1070 | uni_char[0] = ptr[offset_idx+1]; | ||
1071 | uni_char[1] = ptr[offset_idx]; | ||
1072 | entry->name[l++] = from_unicode(uni_char); | ||
1073 | } | ||
1074 | for (k=0; k<2; k++) | ||
1075 | { | ||
1076 | offset_idx = index + k*2 + 28; | ||
1077 | uni_char[0] = ptr[offset_idx+1]; | ||
1078 | uni_char[1] = ptr[offset_idx]; | ||
1079 | entry->name[l++] = from_unicode(uni_char); | ||
1080 | } | ||
1081 | #else | ||
1082 | /* names are stored in unicode, but we | ||
1083 | only grab the low byte (iso8859-1). */ | ||
1059 | for (k=0; k<5; k++) | 1084 | for (k=0; k<5; k++) |
1060 | entry->name[l++] = ptr[index + k*2 + 1]; | 1085 | entry->name[l++] = ptr[index + k*2 + 1]; |
1061 | for (k=0; k<6; k++) | 1086 | for (k=0; k<6; k++) |
1062 | entry->name[l++] = ptr[index + k*2 + 14]; | 1087 | entry->name[l++] = ptr[index + k*2 + 14]; |
1063 | for (k=0; k<2; k++) | 1088 | for (k=0; k<2; k++) |
1064 | entry->name[l++] = ptr[index + k*2 + 28]; | 1089 | entry->name[l++] = ptr[index + k*2 + 28]; |
1090 | #endif | ||
1065 | } | 1091 | } |
1066 | entry->name[l]=0; | 1092 | entry->name[l]=0; |
1067 | } | 1093 | } |
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index a9cd8c65ac..806b812b82 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c | |||
@@ -27,6 +27,13 @@ | |||
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "system.h" | 28 | #include "system.h" |
29 | 29 | ||
30 | #ifdef LOADABLE_FONTS | ||
31 | #include "ajf.h" | ||
32 | #include "panic.h" | ||
33 | #endif | ||
34 | |||
35 | |||
36 | |||
30 | /*** definitions ***/ | 37 | /*** definitions ***/ |
31 | 38 | ||
32 | #define LCDR (PBDR_ADDR+1) | 39 | #define LCDR (PBDR_ADDR+1) |
@@ -296,21 +303,21 @@ static void lcd_write(bool command, int byte) | |||
296 | PBDR &= ~LCD_CS; /* enable lcd chip select */ | 303 | PBDR &= ~LCD_CS; /* enable lcd chip select */ |
297 | 304 | ||
298 | if ( command ) { | 305 | if ( command ) { |
299 | on=~(LCD_SD|LCD_SC|LCD_DS); | 306 | on=~(LCD_SD|LCD_SC|LCD_DS); |
300 | off=LCD_SC; | 307 | off=LCD_SC; |
301 | } | 308 | } |
302 | else { | 309 | else { |
303 | on=~(LCD_SD|LCD_SC); | 310 | on=~(LCD_SD|LCD_SC); |
304 | off=LCD_SC|LCD_DS; | 311 | off=LCD_SC|LCD_DS; |
305 | } | 312 | } |
306 | 313 | ||
307 | /* clock out each bit, MSB first */ | 314 | /* clock out each bit, MSB first */ |
308 | for (i=0x80;i;i>>=1) | 315 | for (i=0x80;i;i>>=1) |
309 | { | 316 | { |
310 | PBDR &= on; | 317 | PBDR &= on; |
311 | if (i & byte) | 318 | if (i & byte) |
312 | PBDR |= LCD_SD; | 319 | PBDR |= LCD_SD; |
313 | PBDR |= off; | 320 | PBDR |= off; |
314 | } | 321 | } |
315 | 322 | ||
316 | PBDR |= LCD_CS; /* disable lcd chip select */ | 323 | PBDR |= LCD_CS; /* disable lcd chip select */ |
@@ -322,9 +329,9 @@ static void lcd_write(bool command, int byte) | |||
322 | void lcd_backlight(bool on) | 329 | void lcd_backlight(bool on) |
323 | { | 330 | { |
324 | if ( on ) | 331 | if ( on ) |
325 | PAIOR |= LCD_BL; | 332 | PAIOR |= LCD_BL; |
326 | else | 333 | else |
327 | PAIOR &= ~LCD_BL; | 334 | PAIOR &= ~LCD_BL; |
328 | } | 335 | } |
329 | 336 | ||
330 | #endif /* SIMULATOR */ | 337 | #endif /* SIMULATOR */ |
@@ -431,7 +438,7 @@ void lcd_define_pattern (int which,char *pattern,int length) | |||
431 | int i; | 438 | int i; |
432 | lcd_write(true,LCD_PRAM|which); | 439 | lcd_write(true,LCD_PRAM|which); |
433 | for (i=0;i<length;i++) | 440 | for (i=0;i<length;i++) |
434 | lcd_write(false,pattern[i]); | 441 | lcd_write(false,pattern[i]); |
435 | } | 442 | } |
436 | 443 | ||
437 | void lcd_double_height(bool on) | 444 | void lcd_double_height(bool on) |
@@ -510,7 +517,9 @@ void lcd_init (void) | |||
510 | { | 517 | { |
511 | create_thread(scroll_thread, scroll_stack, | 518 | create_thread(scroll_thread, scroll_stack, |
512 | sizeof(scroll_stack), scroll_name); | 519 | sizeof(scroll_stack), scroll_name); |
513 | 520 | #if defined(LOADABLE_FONTS) && defined(SIMULATOR) | |
521 | lcd_init_fonts(); | ||
522 | #endif | ||
514 | memset(icon_mirror, sizeof(icon_mirror), 0); | 523 | memset(icon_mirror, sizeof(icon_mirror), 0); |
515 | } | 524 | } |
516 | #endif | 525 | #endif |
@@ -541,8 +550,8 @@ static int ymargin=0; | |||
541 | * This contains only the printable characters (0x20-0x7f). | 550 | * This contains only the printable characters (0x20-0x7f). |
542 | * Each element in this table is a character pattern bitmap. | 551 | * Each element in this table is a character pattern bitmap. |
543 | */ | 552 | */ |
544 | #define ASCII_MIN 0x20 /* First char in table */ | 553 | #define ASCII_MIN 0x20 /* First char in table */ |
545 | #define ASCII_MAX 0x7f /* Last char in table */ | 554 | #define ASCII_MAX 0x7f /* Last char in table */ |
546 | 555 | ||
547 | extern unsigned char char_gen_6x8[][5]; | 556 | extern unsigned char char_gen_6x8[][5]; |
548 | extern unsigned char char_gen_8x12[][14]; | 557 | extern unsigned char char_gen_8x12[][14]; |
@@ -550,9 +559,9 @@ extern unsigned char char_gen_12x16[][22]; | |||
550 | 559 | ||
551 | /* All zeros and ones bitmaps for area filling */ | 560 | /* All zeros and ones bitmaps for area filling */ |
552 | static unsigned char zeros[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 561 | static unsigned char zeros[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
553 | 0x00, 0x00 }; | 562 | 0x00, 0x00 }; |
554 | static unsigned char ones[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 563 | static unsigned char ones[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
555 | 0xff, 0xff }; | 564 | 0xff, 0xff }; |
556 | static char fonts[] = { 6,8,12 }; | 565 | static char fonts[] = { 6,8,12 }; |
557 | static char fontheight[] = { 8,12,16 }; | 566 | static char fontheight[] = { 8,12,16 }; |
558 | 567 | ||
@@ -654,6 +663,101 @@ void lcd_setmargins(int x, int y) | |||
654 | ymargin = y; | 663 | ymargin = y; |
655 | } | 664 | } |
656 | 665 | ||
666 | |||
667 | |||
668 | #ifdef LOADABLE_FONTS | ||
669 | |||
670 | static unsigned char* _font = NULL; | ||
671 | |||
672 | int lcd_init_fonts(void) | ||
673 | { | ||
674 | if (!_font) | ||
675 | _font = ajf_read_font("/system.ajf"); | ||
676 | |||
677 | if (!_font) | ||
678 | { | ||
679 | lcd_putsxy(0,0,"No font", 0); | ||
680 | return -1; | ||
681 | } | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | void lcd_setldfont(unsigned char* f) | ||
687 | { | ||
688 | _font = f; | ||
689 | } | ||
690 | |||
691 | unsigned char* lcd_getcurrentldfont() | ||
692 | { | ||
693 | if (!_font) | ||
694 | panicf("No font loaded!"); | ||
695 | return _font; | ||
696 | } | ||
697 | |||
698 | /* | ||
699 | * Return width and height of a string with a given font. | ||
700 | */ | ||
701 | int lcd_getstringsize(unsigned char *str, unsigned char* font, int *w, int *h) | ||
702 | { | ||
703 | int width=0; | ||
704 | int height=0; | ||
705 | unsigned char ch; | ||
706 | |||
707 | if (!font) | ||
708 | panicf("No font specified"); | ||
709 | |||
710 | while((ch = *str++)) | ||
711 | { | ||
712 | int dw,dh; | ||
713 | ajf_get_charsize(ch, font, &dw, &dh); | ||
714 | if (dh>height) | ||
715 | height = dh; | ||
716 | width+=dw; | ||
717 | } | ||
718 | *w = width; | ||
719 | *h = height; | ||
720 | |||
721 | return width; | ||
722 | } | ||
723 | |||
724 | /* | ||
725 | * Put a string at specified bit position | ||
726 | */ | ||
727 | |||
728 | void lcd_putsldfxy(int x, int y, unsigned char *str) | ||
729 | { | ||
730 | unsigned char ch; | ||
731 | int nx; | ||
732 | int ny=8; | ||
733 | int lcd_x = x; | ||
734 | int lcd_y = y; | ||
735 | if (!_font) | ||
736 | { | ||
737 | lcd_putsxy(0,0,"No font", 0); | ||
738 | return; | ||
739 | } | ||
740 | ny = (int)_font[2]; | ||
741 | while (((ch = *str++) != '\0')) | ||
742 | { | ||
743 | unsigned char *char_buf = ajf_get_charbuf(ch, _font, &nx, &ny); | ||
744 | if (!char_buf) | ||
745 | { | ||
746 | char_buf = ajf_get_charbuf('?', _font, &nx, &ny); | ||
747 | if (!char_buf) | ||
748 | panicf("Bad font"); | ||
749 | } | ||
750 | if(lcd_x + nx > LCD_WIDTH) | ||
751 | break; | ||
752 | |||
753 | lcd_clearrect (lcd_x, lcd_y, 1, ny); | ||
754 | lcd_bitmap (&char_buf[0], lcd_x, lcd_y, nx, ny, true); | ||
755 | lcd_x += nx+1; | ||
756 | } | ||
757 | } | ||
758 | #endif | ||
759 | |||
760 | |||
657 | #ifdef LCD_PROPFONTS | 761 | #ifdef LCD_PROPFONTS |
658 | 762 | ||
659 | extern unsigned char char_dw_8x8_prop[][9]; | 763 | extern unsigned char char_dw_8x8_prop[][9]; |
@@ -746,10 +850,19 @@ void lcd_puts(int x, int y, unsigned char *str) | |||
746 | ymargin = 8; | 850 | ymargin = 8; |
747 | #endif | 851 | #endif |
748 | 852 | ||
853 | if(!str || !str[0]) | ||
854 | return; | ||
855 | |||
749 | #ifdef LCD_PROPFONTS | 856 | #ifdef LCD_PROPFONTS |
750 | lcd_putspropxy( xmargin + x*fonts[font], | 857 | lcd_putspropxy( xmargin + x*fonts[font], |
751 | ymargin + y*fontheight[font], | 858 | ymargin + y*fontheight[font], |
752 | str, font ); | 859 | str, font ); |
860 | #elif LOADABLE_FONTS | ||
861 | { | ||
862 | int w,h; | ||
863 | lcd_getstringsize(str,_font,&w,&h); | ||
864 | lcd_putsldfxy( xmargin + x*w/strlen(str), ymargin + y*h, str ); | ||
865 | } | ||
753 | #else | 866 | #else |
754 | lcd_putsxy( xmargin + x*fonts[font], | 867 | lcd_putsxy( xmargin + x*fonts[font], |
755 | ymargin + y*fontheight[font], | 868 | ymargin + y*fontheight[font], |
@@ -1105,25 +1218,31 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
1105 | s->space = 11 - x; | 1218 | s->space = 11 - x; |
1106 | #else | 1219 | #else |
1107 | 1220 | ||
1108 | #ifdef LCD_PROPFONTS | 1221 | #if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS) |
1109 | unsigned char ch[2]; | 1222 | unsigned char ch[2]; |
1110 | int w, h; | 1223 | int w, h; |
1111 | #endif | 1224 | #endif |
1112 | int width, height; | 1225 | int width, height; |
1113 | lcd_getfontsize(font, &width, &height); | 1226 | lcd_getfontsize(font, &width, &height); |
1114 | #ifndef LCD_PROPFONTS | 1227 | #if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS) |
1115 | s->space = (LCD_WIDTH - xmargin - x*width) / width; | ||
1116 | #else | ||
1117 | ch[1] = 0; /* zero terminate */ | 1228 | ch[1] = 0; /* zero terminate */ |
1118 | ch[0] = string[0]; | 1229 | ch[0] = string[0]; |
1119 | width = 0; | 1230 | width = 0; |
1120 | for (s->space = 0; | 1231 | s->space = 0; |
1121 | ch[0] && | 1232 | while ( ch[0] && |
1122 | (width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8)); | 1233 | #ifdef LCD_PROPFONTS |
1123 | ) { | 1234 | (width + lcd_getstringsize(ch, 0, &w, &h) < |
1235 | (LCD_WIDTH - x*8))) { | ||
1236 | #else | ||
1237 | (width + lcd_getstringsize(ch, _font, &w, &h) < | ||
1238 | (LCD_WIDTH - x*8))) { | ||
1239 | #endif | ||
1124 | width += w; | 1240 | width += w; |
1125 | ch[0]=string[(int)++s->space]; | 1241 | s->space++; |
1242 | ch[0]=string[s->space]; | ||
1126 | } | 1243 | } |
1244 | #else | ||
1245 | s->space = (LCD_WIDTH - xmargin - x*width) / width; | ||
1127 | #endif | 1246 | #endif |
1128 | #endif | 1247 | #endif |
1129 | 1248 | ||
@@ -1148,11 +1267,25 @@ void lcd_stop_scroll(void) | |||
1148 | scroll_count = 0; | 1267 | scroll_count = 0; |
1149 | 1268 | ||
1150 | #ifdef LCD_PROPFONTS | 1269 | #ifdef LCD_PROPFONTS |
1270 | |||
1151 | lcd_clearrect(xmargin + s->startx*fonts[font], | 1271 | lcd_clearrect(xmargin + s->startx*fonts[font], |
1152 | ymargin + s->starty*fontheight[font], | 1272 | ymargin + s->starty*fontheight[font], |
1153 | LCD_WIDTH - xmargin, | 1273 | LCD_WIDTH - xmargin, |
1154 | fontheight[font]); | 1274 | fontheight[font]); |
1275 | |||
1276 | #elif defined(LOADABLE_FONTS) | ||
1277 | { | ||
1278 | int w,h; | ||
1279 | lcd_getstringsize( s->text, _font, &w, &h); | ||
1280 | lcd_clearrect(xmargin + s->startx*w/s->textlen, | ||
1281 | ymargin + s->starty*h, | ||
1282 | LCD_WIDTH - xmargin, | ||
1283 | h); | ||
1284 | |||
1285 | } | ||
1155 | #endif | 1286 | #endif |
1287 | |||
1288 | |||
1156 | /* restore scrolled row */ | 1289 | /* restore scrolled row */ |
1157 | lcd_puts(s->startx,s->starty,s->text); | 1290 | lcd_puts(s->startx,s->starty,s->text); |
1158 | lcd_update(); | 1291 | lcd_update(); |
@@ -1208,6 +1341,15 @@ static void scroll_thread(void) | |||
1208 | ymargin + s->starty*fontheight[font], | 1341 | ymargin + s->starty*fontheight[font], |
1209 | LCD_WIDTH - xmargin, | 1342 | LCD_WIDTH - xmargin, |
1210 | fontheight[font]); | 1343 | fontheight[font]); |
1344 | #elif defined(LOADABLE_FONTS) | ||
1345 | { | ||
1346 | int w,h; | ||
1347 | lcd_getstringsize( s->text, _font, &w, &h); | ||
1348 | lcd_clearrect(xmargin + s->startx*w/s->textlen, | ||
1349 | ymargin + s->starty*h, | ||
1350 | LCD_WIDTH - xmargin, | ||
1351 | h); | ||
1352 | } | ||
1211 | #endif | 1353 | #endif |
1212 | lcd_puts(s->startx,s->starty,s->line); | 1354 | lcd_puts(s->startx,s->starty,s->line); |
1213 | lcd_update(); | 1355 | lcd_update(); |
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index bc971dc117..ed2fe7ee45 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h | |||
@@ -105,4 +105,15 @@ extern void lcd_clearpixel(int x, int y); | |||
105 | 105 | ||
106 | #endif /* CHARCELLS / BITMAP */ | 106 | #endif /* CHARCELLS / BITMAP */ |
107 | 107 | ||
108 | #ifdef LOADABLE_FONTS | ||
109 | extern int lcd_init_fonts(void); | ||
110 | extern void lcd_putsldfxy(int x, int y, unsigned char *str); | ||
111 | extern int lcd_getstringsize(unsigned char *str, | ||
112 | unsigned char* font, | ||
113 | int *w, int *h); | ||
114 | extern void lcd_setldfont(unsigned char* f); | ||
115 | |||
116 | extern unsigned char* lcd_getcurrentldfont(void); | ||
117 | #endif | ||
118 | |||
108 | #endif /* __LCD_H__ */ | 119 | #endif /* __LCD_H__ */ |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index efe7570bff..a85545efce 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -967,6 +967,7 @@ static void mpeg_thread(void) | |||
967 | 967 | ||
968 | case SYS_USB_CONNECTED: | 968 | case SYS_USB_CONNECTED: |
969 | stop_playing(); | 969 | stop_playing(); |
970 | #ifndef SIMULATOR | ||
970 | 971 | ||
971 | /* Tell the USB thread that we are safe */ | 972 | /* Tell the USB thread that we are safe */ |
972 | DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); | 973 | DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); |
@@ -974,6 +975,7 @@ static void mpeg_thread(void) | |||
974 | 975 | ||
975 | /* Wait until the USB cable is extracted again */ | 976 | /* Wait until the USB cable is extracted again */ |
976 | usb_wait_for_disconnect(&mpeg_queue); | 977 | usb_wait_for_disconnect(&mpeg_queue); |
978 | #endif | ||
977 | break; | 979 | break; |
978 | } | 980 | } |
979 | } | 981 | } |
diff --git a/firmware/panic.c b/firmware/panic.c index f9023fe704..b130482495 100644 --- a/firmware/panic.c +++ b/firmware/panic.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by wavey@wavey.org | 10 | * Copyright (C) 2002 by wavey@wavey.org |
11 | * | 11 | *nn |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
14 | * | 14 | * |
@@ -48,8 +48,9 @@ void panicf( char *fmt, ...) | |||
48 | lcd_puts(0,0,panic_buf); | 48 | lcd_puts(0,0,panic_buf); |
49 | #elif defined(HAVE_LCD_BITMAP) | 49 | #elif defined(HAVE_LCD_BITMAP) |
50 | lcd_clear_display(); | 50 | lcd_clear_display(); |
51 | lcd_puts(0,0,panic_buf); | 51 | lcd_putsxy(0,0,panic_buf,0); |
52 | lcd_update(); | 52 | lcd_update(); |
53 | |||
53 | #else | 54 | #else |
54 | /* no LCD */ | 55 | /* no LCD */ |
55 | #endif | 56 | #endif |
diff --git a/tools/Makefile b/tools/Makefile index 92f621f51e..9d47a1c762 100644 --- a/tools/Makefile +++ b/tools/Makefile | |||
@@ -8,7 +8,7 @@ | |||
8 | # | 8 | # |
9 | CFLAGS := -O -s -ansi | 9 | CFLAGS := -O -s -ansi |
10 | 10 | ||
11 | TARGETS := scramble descramble sh2d | 11 | TARGETS := scramble descramble sh2d bdf2ajf |
12 | 12 | ||
13 | all: $(TARGETS) | 13 | all: $(TARGETS) |
14 | 14 | ||
@@ -18,5 +18,9 @@ descramble: descramble.c | |||
18 | 18 | ||
19 | sh2d: sh2d.c | 19 | sh2d: sh2d.c |
20 | 20 | ||
21 | bdf2ajf: bdf2ajf.c | ||
22 | gcc -O -ansi $+ -o $@ | ||
23 | |||
21 | clean: | 24 | clean: |
22 | rm -f $(TARGETS) *~ | 25 | rm -f $(TARGETS) $(shell for f in $(TARGETS) ; do echo $$f.exe $$f.o $$f.obj ; done) *.ajf *~ |
26 | |||
diff --git a/tools/configure b/tools/configure index 2ddfb72360..bf89d88929 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -11,6 +11,8 @@ | |||
11 | target=$1 | 11 | target=$1 |
12 | debug=$2 | 12 | debug=$2 |
13 | 13 | ||
14 | extra_defines="-" | ||
15 | |||
14 | input() { | 16 | input() { |
15 | read response | 17 | read response |
16 | echo $response | 18 | echo $response |
@@ -66,8 +68,9 @@ sed > Makefile \ | |||
66 | -e "s,@KEYPAD@,${keypad},g" \ | 68 | -e "s,@KEYPAD@,${keypad},g" \ |
67 | -e "s,@PWD@,${pwd},g" \ | 69 | -e "s,@PWD@,${pwd},g" \ |
68 | -e "s,@SIMVER@,${simver},g" \ | 70 | -e "s,@SIMVER@,${simver},g" \ |
71 | -e "s,@EXTRA_DEFINES@,${extra_defines},g" \ | ||
69 | <<EOF | 72 | <<EOF |
70 | ## Automaticly generated. http://bjorn.haxx.se/rockbox/ | 73 | ## Automaticly generated. http://rockbox.haxx.se |
71 | 74 | ||
72 | SIMDIR=@SIMDIR@ | 75 | SIMDIR=@SIMDIR@ |
73 | DEBUG=@DEBUG@ | 76 | DEBUG=@DEBUG@ |
@@ -77,13 +80,14 @@ KEYPAD=@KEYPAD@ | |||
77 | THISDIR="@PWD@" | 80 | THISDIR="@PWD@" |
78 | SIMVER=@SIMVER@ | 81 | SIMVER=@SIMVER@ |
79 | VERSION=\$(shell date +%y%m%d-%H%M) | 82 | VERSION=\$(shell date +%y%m%d-%H%M) |
83 | EXTRA_DEFINES=@EXTRA_DEFINES@ | ||
80 | 84 | ||
81 | .PHONY: | 85 | .PHONY: |
82 | 86 | ||
83 | all: sim | 87 | all: sim |
84 | 88 | ||
85 | sim: | 89 | sim: |
86 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) | 90 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES) |
87 | 91 | ||
88 | clean-sim: | 92 | clean-sim: |
89 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean | 93 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean |
@@ -121,6 +125,7 @@ if [ "$target" = "update" ]; then | |||
121 | echo "Existing generated Makefile found. Getting defaults from it." | 125 | echo "Existing generated Makefile found. Getting defaults from it." |
122 | target=`grep "^TARGET=" Makefile | cut -d= -f2-` | 126 | target=`grep "^TARGET=" Makefile | cut -d= -f2-` |
123 | debug=`grep "^DEBUG=" Makefile | cut -d= -f2-` | 127 | debug=`grep "^DEBUG=" Makefile | cut -d= -f2-` |
128 | extra_defines=`grep "^EXTRA_DEFINES=" Makefile | cut -d= -f2-` | ||
124 | 129 | ||
125 | if [ "$debug" = "SIMULATOR=1" ]; then | 130 | if [ "$debug" = "SIMULATOR=1" ]; then |
126 | simulator="yes" | 131 | simulator="yes" |
@@ -133,7 +138,7 @@ if [ "$target" = "update" ]; then | |||
133 | else | 138 | else |
134 | 139 | ||
135 | echo "Setup your Rockbox build environment." | 140 | echo "Setup your Rockbox build environment." |
136 | echo "http://bjorn.haxx.se/rockbox/" | 141 | echo "http://rockbox.haxx.se/" |
137 | echo "" | 142 | echo "" |
138 | 143 | ||
139 | fi | 144 | fi |
@@ -175,6 +180,25 @@ if [ -z "$target" ]; then | |||
175 | esac | 180 | esac |
176 | fi | 181 | fi |
177 | 182 | ||
183 | if [ "-" == "$extra_defines" ]; then | ||
184 | if [ "-DARCHOS_RECORDER" = "$target" ] ; then | ||
185 | |||
186 | echo "Loadable fonts support? (N)" | ||
187 | getit=`input`; | ||
188 | if [ "y" = "$getit" ] ; then | ||
189 | extra_defines="-DLOADABLE_FONTS" | ||
190 | else | ||
191 | echo "Proportional font support? (N)" | ||
192 | getit=`input`; | ||
193 | if [ "y" = "$getit" ] ; then | ||
194 | extra_defines="-DLCD_PROPFONTS" | ||
195 | else | ||
196 | extra_defines="" | ||
197 | fi | ||
198 | fi | ||
199 | fi | ||
200 | fi | ||
201 | |||
178 | if [ -z "$debug" ]; then | 202 | if [ -z "$debug" ]; then |
179 | ################################################################## | 203 | ################################################################## |
180 | # Figure out debug on/off | 204 | # Figure out debug on/off |
@@ -250,9 +274,10 @@ sed > Makefile \ | |||
250 | -e "s,@APPSDIR@,${appsdir},g" \ | 274 | -e "s,@APPSDIR@,${appsdir},g" \ |
251 | -e "s,@DEBUG@,${debug},g" \ | 275 | -e "s,@DEBUG@,${debug},g" \ |
252 | -e "s,@TARGET@,${target},g" \ | 276 | -e "s,@TARGET@,${target},g" \ |
277 | -e "s,@EXTRA_DEFINES@,${extra_defines},g" \ | ||
253 | -e "s,@PWD@,${pwd},g" \ | 278 | -e "s,@PWD@,${pwd},g" \ |
254 | <<EOF | 279 | <<EOF |
255 | ## Automaticly generated. http://bjorn.haxx.se/rockbox/ | 280 | ## Automaticly generated. http://rockbox.haxx.se |
256 | 281 | ||
257 | FIRMDIR=@FIRMDIR@ | 282 | FIRMDIR=@FIRMDIR@ |
258 | APPSDIR=@APPSDIR@ | 283 | APPSDIR=@APPSDIR@ |
@@ -261,15 +286,16 @@ TARGET=@TARGET@ | |||
261 | THISDIR="@PWD@" | 286 | THISDIR="@PWD@" |
262 | VERSION=\$(shell date +%y%m%d-%H%M) | 287 | VERSION=\$(shell date +%y%m%d-%H%M) |
263 | 288 | ||
289 | EXTRA_DEFINES=@EXTRA_DEFINES@ | ||
264 | .PHONY: firmware apps | 290 | .PHONY: firmware apps |
265 | 291 | ||
266 | all: firmware apps | 292 | all: firmware apps |
267 | 293 | ||
268 | firmware: | 294 | firmware: |
269 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) | 295 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) EXTRA_DEFINES=\$(EXTRA_DEFINES) |
270 | 296 | ||
271 | apps: | 297 | apps: |
272 | \$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) | 298 | \$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES) |
273 | 299 | ||
274 | clean-firmware: | 300 | clean-firmware: |
275 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean | 301 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean |
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index e64ae6f36c..b34bb48e08 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile | |||
@@ -25,6 +25,7 @@ FIRMWAREDIR = ../../firmware | |||
25 | DRIVERS = $(FIRMWAREDIR)/drivers | 25 | DRIVERS = $(FIRMWAREDIR)/drivers |
26 | COMMON = $(FIRMWAREDIR)/common | 26 | COMMON = $(FIRMWAREDIR)/common |
27 | LIBMADDIR = $(PREVAPPDIR)/common/libmad | 27 | LIBMADDIR = $(PREVAPPDIR)/common/libmad |
28 | TOOLSDIR = ../../tools | ||
28 | 29 | ||
29 | CC = gcc | 30 | CC = gcc |
30 | RM = rm -f | 31 | RM = rm -f |
@@ -42,7 +43,7 @@ DISPLAY = -DHAVE_LCD_BITMAP | |||
42 | KEYPAD = -DHAVE_RECORDER_KEYPAD | 43 | KEYPAD = -DHAVE_RECORDER_KEYPAD |
43 | 44 | ||
44 | DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ | 45 | DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ |
45 | $(KEYPAD) $(DISPLAY) #-DLCD_PROPFONTS | 46 | $(KEYPAD) $(DISPLAY) $(EXTRA_DEFINES) |
46 | 47 | ||
47 | LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl | 48 | LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl |
48 | 49 | ||
@@ -69,11 +70,17 @@ ifdef MPEG_PLAY | |||
69 | INCLUDES += -I$(PREVAPPDIR)/common | 70 | INCLUDES += -I$(PREVAPPDIR)/common |
70 | endif | 71 | endif |
71 | 72 | ||
72 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall | 73 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall |
73 | 74 | ||
74 | APPCFLAGS = $(DEBUG) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(APPINCLUDES) -W -Wall | 75 | APPCFLAGS = $(DEBUG) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(APPINCLUDES) -W -Wall |
75 | 76 | ||
76 | FIRMSRCS = chartables.c lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c powermgmt.c | 77 | FIRMSRCS = chartables.c lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c powermgmt.c |
78 | |||
79 | ifeq (LOADABLE_FONTS,$(findstring LOADABLE_FONTS, $(DEFINES))) | ||
80 | FIRMSRCS += unicode.c ajf.c panic.c | ||
81 | EXTRA_TARGETS = $(OBJDIR)/archos/system.ajf | ||
82 | SYSTEM_FONT = $(FIRMWAREDIR)/fonts/alt6x10.bdf | ||
83 | endif | ||
77 | 84 | ||
78 | APPS = main.c tree.c menu.c credits.c main_menu.c\ | 85 | APPS = main.c tree.c menu.c credits.c main_menu.c\ |
79 | playlist.c showtext.c wps.c settings.c status.c | 86 | playlist.c showtext.c wps.c settings.c status.c |
@@ -95,12 +102,15 @@ endif | |||
95 | 102 | ||
96 | OBJS := $(SRCS:%.c=$(OBJDIR)/%.o) | 103 | OBJS := $(SRCS:%.c=$(OBJDIR)/%.o) |
97 | 104 | ||
98 | all: $(TARGET) | 105 | all: $(TARGET) $(EXTRA_TARGETS) |
99 | 106 | ||
100 | clean: | 107 | clean: |
101 | $(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS) | 108 | $(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS) |
102 | $(RM) -r $(DEPS) | 109 | $(RM) -r $(DEPS) |
103 | 110 | ||
111 | $(OBJDIR)/archos/system.ajf: $(TOOLSDIR)/bdf2ajf $(SYSTEM_FONT) | ||
112 | $(TOOLSDIR)/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/archos/system.ajf | ||
113 | |||
104 | distclean: clean | 114 | distclean: clean |
105 | $(RM) config.cache | 115 | $(RM) config.cache |
106 | 116 | ||
@@ -218,6 +228,9 @@ $(OBJDIR)/id3.o: $(FIRMWAREDIR)/id3.c | |||
218 | $(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c | 228 | $(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c |
219 | $(CC) $(CFLAGS) -c $< -o $@ | 229 | $(CC) $(CFLAGS) -c $< -o $@ |
220 | 230 | ||
231 | $(OBJDIR)/panic.o: $(FIRMWAREDIR)/panic.c | ||
232 | $(CC) $(CFLAGS) -c $< -o $@ | ||
233 | |||
221 | $(OBJDIR)/mpeg.o: $(FIRMWAREDIR)/mpeg.c | 234 | $(OBJDIR)/mpeg.o: $(FIRMWAREDIR)/mpeg.c |
222 | $(CC) $(CFLAGS) -c $< -o $@ | 235 | $(CC) $(CFLAGS) -c $< -o $@ |
223 | 236 | ||
@@ -230,6 +243,12 @@ $(OBJDIR)/usb.o: $(FIRMWAREDIR)/usb.c | |||
230 | $(OBJDIR)/powermgmt.o: $(FIRMWAREDIR)/powermgmt.c | 243 | $(OBJDIR)/powermgmt.o: $(FIRMWAREDIR)/powermgmt.c |
231 | $(CC) $(CFLAGS) -c $< -o $@ | 244 | $(CC) $(CFLAGS) -c $< -o $@ |
232 | 245 | ||
246 | $(OBJDIR)/unicode.o: $(FIRMWAREDIR)/unicode.c | ||
247 | $(CC) $(CFLAGS) -c $< -o $@ | ||
248 | |||
249 | $(OBJDIR)/ajf.o: $(FIRMWAREDIR)/ajf.c | ||
250 | $(CC) $(CFLAGS) -c $< -o $@ | ||
251 | |||
233 | $(OBJDIR)/stubs.o: ../common/stubs.c | 252 | $(OBJDIR)/stubs.o: ../common/stubs.c |
234 | $(CC) $(CFLAGS) -c $< -o $@ | 253 | $(CC) $(CFLAGS) -c $< -o $@ |
235 | 254 | ||