summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/main.c8
-rw-r--r--apps/menu.c9
-rw-r--r--apps/recorder/icons.c10
-rw-r--r--apps/recorder/icons.h1
-rw-r--r--apps/tree.c36
5 files changed, 48 insertions, 16 deletions
diff --git a/apps/main.c b/apps/main.c
index 4b8c9e1e7e..b13e5448b9 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -68,6 +68,7 @@ void init(void)
68 show_logo(); 68 show_logo();
69 settings_reset(); 69 settings_reset();
70 settings_load(); 70 settings_load();
71 font_load(ROCKBOX_DIR "/default.fon");
71 sleep(HZ/2); 72 sleep(HZ/2);
72} 73}
73 74
@@ -89,10 +90,7 @@ void init(void)
89 90
90 lcd_init(); 91 lcd_init();
91 92
92 // FIXME should call font_init before this, 93 font_init();
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(); 94 show_logo();
97 95
98#ifdef DEBUG 96#ifdef DEBUG
@@ -148,6 +146,7 @@ void init(void)
148 } 146 }
149 147
150 settings_load(); 148 settings_load();
149 font_load(ROCKBOX_DIR "/default.fon");
151 150
152 mpeg_init( global_settings.volume, 151 mpeg_init( global_settings.volume,
153 global_settings.bass, 152 global_settings.bass,
@@ -160,7 +159,6 @@ void init(void)
160 status_init(); 159 status_init();
161 usb_start_monitoring(); 160 usb_start_monitoring();
162 power_init(); 161 power_init();
163 font_init();
164} 162}
165 163
166int main(void) 164int main(void)
diff --git a/apps/menu.c b/apps/menu.c
index a42929ccf5..5f1b9b64ea 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -93,14 +93,19 @@ void put_cursorxy(int x, int y, bool on)
93{ 93{
94#ifdef HAVE_LCD_BITMAP 94#ifdef HAVE_LCD_BITMAP
95 int fh, fw; 95 int fh, fw;
96 int xpos, ypos;
96 lcd_getfontsize(FONT_UI, &fw, &fh); 97 lcd_getfontsize(FONT_UI, &fw, &fh);
98 xpos = x*6;
99 ypos = y*fh + lcd_getymargin();
100 if ( fh > 8 )
101 ypos += (fh - 8) / 2;
97#endif 102#endif
98 103
99 /* place the cursor */ 104 /* place the cursor */
100 if(on) { 105 if(on) {
101#ifdef HAVE_LCD_BITMAP 106#ifdef HAVE_LCD_BITMAP
102 lcd_bitmap ( bitmap_icons_6x8[Cursor], 107 lcd_bitmap ( bitmap_icons_6x8[Cursor],
103 x*6, y*fh + lcd_getymargin(), 4, 8, true); 108 xpos, ypos, 4, 8, true);
104#elif defined(SIMULATOR) 109#elif defined(SIMULATOR)
105 /* player simulator */ 110 /* player simulator */
106 unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; 111 unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
@@ -112,7 +117,7 @@ void put_cursorxy(int x, int y, bool on)
112 else { 117 else {
113#if defined(HAVE_LCD_BITMAP) 118#if defined(HAVE_LCD_BITMAP)
114 /* I use xy here since it needs to disregard the margins */ 119 /* I use xy here since it needs to disregard the margins */
115 lcd_clearrect (x*6, y*fh + lcd_getymargin(), 4, 8); 120 lcd_clearrect (xpos, ypos, 4, 8);
116#elif defined(SIMULATOR) 121#elif defined(SIMULATOR)
117 /* player simulator in action */ 122 /* player simulator in action */
118 lcd_clearrect (x*6, 12+y*16, 4, 8); 123 lcd_clearrect (x*6, 12+y*16, 4, 8);
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index fbfaf6cd8c..0e628d8255 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -69,6 +69,8 @@ unsigned char bitmap_icons_6x8[LastIcon][6] =
69 { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x00 }, 69 { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x00 },
70 /* Mod or ajz file */ 70 /* Mod or ajz file */
71 { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, 71 { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 },
72 /* Font file */
73 { 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e },
72}; 74};
73 75
74unsigned char bitmap_icons_7x8[][7] = 76unsigned char bitmap_icons_7x8[][7] =
@@ -234,10 +236,10 @@ void statusbar_icon_volume(int percent)
234 /* display volume lever numerical? */ 236 /* display volume lever numerical? */
235 if (TIME_BEFORE(current_tick,switch_tick)) { 237 if (TIME_BEFORE(current_tick,switch_tick)) {
236 snprintf(buffer, sizeof(buffer), "%2d", percent); 238 snprintf(buffer, sizeof(buffer), "%2d", percent);
237 lcd_getstringsize(buffer, FONT_UI, &width, &height); 239 lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height);
238 if (height <= STATUSBAR_HEIGHT) 240 if (height <= STATUSBAR_HEIGHT)
239 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 241 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 -
240 width/2, STATUSBAR_Y_POS, buffer, 0); 242 width/2, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED);
241 } 243 }
242 else { /* display volume bar */ 244 else { /* display volume bar */
243 volume = volume * 14 / 100; 245 volume = volume * 14 / 100;
@@ -309,8 +311,8 @@ void statusbar_time(int hour, int minute)
309 strncpy(buffer, "--:--", sizeof buffer); 311 strncpy(buffer, "--:--", sizeof buffer);
310 } 312 }
311 313
312 lcd_getstringsize(buffer, FONT_UI, &width, &height); 314 lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height);
313 if (height <= STATUSBAR_HEIGHT) 315 if (height <= STATUSBAR_HEIGHT)
314 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, 0); 316 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED);
315} 317}
316#endif 318#endif
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 3102093898..1cf75151da 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -28,6 +28,7 @@ enum icons_6x8 {
28 Box_Filled, Box_Empty, Slider_Horizontal, File, 28 Box_Filled, Box_Empty, Slider_Horizontal, File,
29 Folder, Directory, Playlist, Repeat, 29 Folder, Directory, Playlist, Repeat,
30 Selected, Cursor, Wps, Mod_Ajz, 30 Selected, Cursor, Wps, Mod_Ajz,
31 Font,
31 LastIcon 32 LastIcon
32}; 33};
33 34
diff --git a/apps/tree.c b/apps/tree.c
index 40d686490a..9689ac5ae9 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -137,7 +137,8 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
137#define TREE_ATTR_M3U 0x80 /* playlist */ 137#define TREE_ATTR_M3U 0x80 /* playlist */
138#define TREE_ATTR_WPS 0x100 /* wps config file */ 138#define TREE_ATTR_WPS 0x100 /* wps config file */
139#define TREE_ATTR_MOD 0x200 /* firmware file */ 139#define TREE_ATTR_MOD 0x200 /* firmware file */
140#define TREE_ATTR_EQ 0x300 /* EQ config file */ 140#define TREE_ATTR_EQ 0x400 /* EQ config file */
141#define TREE_ATTR_FONT 0x800 /* font file */
141#define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ 142#define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */
142 143
143static int build_playlist(int start_index) 144static int build_playlist(int start_index)
@@ -182,14 +183,12 @@ static int compare(const void* p1, const void* p2)
182static int showdir(char *path, int start) 183static int showdir(char *path, int start)
183{ 184{
184 int icon_type = 0; 185 int icon_type = 0;
185#ifdef HAVE_LCD_BITMAP
186 int line_height = LINE_HEIGTH;
187#endif
188 int i; 186 int i;
189 int tree_max_on_screen; 187 int tree_max_on_screen;
190 bool dir_buffer_full; 188 bool dir_buffer_full;
191 189
192#ifdef HAVE_LCD_BITMAP 190#ifdef HAVE_LCD_BITMAP
191 int line_height = LINE_HEIGTH;
193 int fw, fh; 192 int fw, fh;
194 lcd_getfontsize(FONT_UI, &fw, &fh); 193 lcd_getfontsize(FONT_UI, &fw, &fh);
195 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 194 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
@@ -255,6 +254,8 @@ static int showdir(char *path, int start)
255 else if (!strcasecmp(&entry->d_name[len-4], ".wps")) 254 else if (!strcasecmp(&entry->d_name[len-4], ".wps"))
256 dptr->attr |= TREE_ATTR_WPS; 255 dptr->attr |= TREE_ATTR_WPS;
257#ifdef HAVE_RECORDER_KEYPAD 256#ifdef HAVE_RECORDER_KEYPAD
257 else if (!strcasecmp(&entry->d_name[len-4], ".fnt"))
258 dptr->attr |= TREE_ATTR_FONT;
258 else if (!strcasecmp(&entry->d_name[len-4], ".ajz")) 259 else if (!strcasecmp(&entry->d_name[len-4], ".ajz"))
259#else 260#else
260 else if (!strcasecmp(&entry->d_name[len-4], ".mod")) 261 else if (!strcasecmp(&entry->d_name[len-4], ".mod"))
@@ -372,15 +373,24 @@ static int showdir(char *path, int start)
372 icon_type = Mod_Ajz; 373 icon_type = Mod_Ajz;
373 break; 374 break;
374 375
376#ifdef HAVE_LCD_BITMAP
377 case TREE_ATTR_FONT:
378 icon_type = Font;
379 break;
380#endif
375 default: 381 default:
376 icon_type = 0; 382 icon_type = 0;
377 } 383 }
378 384
379 if (icon_type) { 385 if (icon_type) {
380#ifdef HAVE_LCD_BITMAP 386#ifdef HAVE_LCD_BITMAP
387 int offset=0;
388 if ( line_height > 8 )
389 offset = (line_height - 8) / 2;
381 lcd_bitmap(bitmap_icons_6x8[icon_type], 390 lcd_bitmap(bitmap_icons_6x8[icon_type],
382 CURSOR_X * 6 + CURSOR_WIDTH, 391 CURSOR_X * 6 + CURSOR_WIDTH,
383 MARGIN_Y+(i-start)*line_height, 6, 8, true); 392 MARGIN_Y+(i-start)*line_height + offset,
393 6, 8, true);
384#else 394#else
385 lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); 395 lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8);
386 lcd_putc(LINE_X-1, i-start, i-start); 396 lcd_putc(LINE_X-1, i-start, i-start);
@@ -712,6 +722,22 @@ bool dirbrowse(char *root)
712 restore = true; 722 restore = true;
713 break; 723 break;
714 724
725#ifdef HAVE_LCD_BITMAP
726 case TREE_ATTR_FONT:
727 snprintf(buf, sizeof buf, "%s/%s",
728 currdir, file->name);
729 font_load(buf);
730 lcd_getfontsize(FONT_UI, &fw, &fh);
731 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
732 /* make sure cursor is on screen */
733 while ( dircursor > tree_max_on_screen ) {
734 dircursor--;
735 dirstart++;
736 }
737 restore = true;
738 break;
739#endif
740
715#ifndef SIMULATOR 741#ifndef SIMULATOR
716 /* firmware file */ 742 /* firmware file */
717 case TREE_ATTR_MOD: 743 case TREE_ATTR_MOD: