Removed lcd_getfontsize(). Removed font parameters to lcd_putsxy and lcd_getstringsize.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2403 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/credits.c b/apps/credits.c
index f8b060f..5743f2e 100644
--- a/apps/credits.c
+++ b/apps/credits.c
@@ -113,28 +113,28 @@
int height;
int width;
- lcd_getfontsize(FONT_UI, &width, &height);
+ lcd_getstringsize("A", &width, &height);
while(1) {
- lcd_clear_display();
- for ( i=0; i <= (64-y)/height; i++ )
- lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"", FONT_UI);
- snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
- line+1, numnames);
- lcd_putsxy(0, 0, buffer, FONT_UI);
- lcd_update();
+ lcd_clear_display();
+ for ( i=0; i <= (64-y)/height; i++ )
+ lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
+ snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
+ line+1, numnames);
+ lcd_putsxy(0, 0, buffer);
+ lcd_update();
- if (button_get_w_tmo(HZ/20))
- return;
+ if (button_get_w_tmo(HZ/20))
+ return;
- y--;
+ y--;
- if(y<0) {
- line++;
- if(line >= numnames)
- break;
- y+=height;
- }
+ if(y<0) {
+ line++;
+ if(line >= numnames)
+ break;
+ y+=height;
+ }
}
return;
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 199dca6..aa87ed3 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -88,20 +88,20 @@
debugf("read_bmp_file() returned %d, width %d height %d\n",
failure, width, height);
-
- for(i=0, eline=0; i < height; i+=8, eline++) {
- /* the bitmap function doesn't work with full-height bitmaps
- so we "stripe" the logo output */
- lcd_bitmap(&buffer[eline*width], 0, 10+i, width,
- (height-i)>8?8:height-i, false);
- }
+
+ for(i=0, eline=0; i < height; i+=8, eline++) {
+ /* the bitmap function doesn't work with full-height bitmaps
+ so we "stripe" the logo output */
+ lcd_bitmap(&buffer[eline*width], 0, 10+i, width,
+ (height-i)>8?8:height-i, false);
}
#endif
snprintf(version, sizeof(version), "Ver. %s", appsversion);
- lcd_getfontsize(FONT_SYSFIXED, &font_w, &font_h);
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_getstringsize("A", &font_w, &font_h);
lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2),
- LCD_HEIGHT-font_h, version, FONT_SYSFIXED);
+ LCD_HEIGHT-font_h, version);
lcd_update();
#else
diff --git a/apps/menu.c b/apps/menu.c
index ac5c857..96b0bfd 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -29,11 +29,11 @@
#include "panic.h"
#include "settings.h"
#include "status.h"
+#include "screens.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
#include "widgets.h"
-#include "screens.h"
#endif
struct menu {
@@ -95,7 +95,7 @@
#ifdef HAVE_LCD_BITMAP
int fh, fw;
int xpos, ypos;
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_getstringsize("A", &fw, &fh);
xpos = x*6;
ypos = y*fh + lcd_getymargin();
if ( fh > 8 )
@@ -134,7 +134,8 @@
#ifdef HAVE_LCD_BITMAP
int fw, fh;
int menu_lines;
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_setfont(FONT_UI);
+ lcd_getstringsize("A", &fw, &fh);
if (global_settings.statusbar)
menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
else
@@ -147,7 +148,6 @@
lcd_clear_display(); /* ...then clean the screen */
#ifdef HAVE_LCD_BITMAP
lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
- lcd_setfont(FONT_UI);
#endif
/* correct cursor pos if out of screen */
if (menus[m].cursor - menus[m].top >= menu_lines)
@@ -184,7 +184,7 @@
#ifdef HAVE_LCD_BITMAP
int fw, fh;
int menu_lines;
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_getstringsize("A", &fw, &fh);
if (global_settings.statusbar)
menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
else
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index fc11aef..cfb194e 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -224,7 +224,7 @@
}
snprintf(buffer, 30, "%s: %d",
values[show].what, values[show].num);
- lcd_putsxy(0, 56, buffer, 0);
+ lcd_putsxy(0, 56, buffer);
timeout--;
}
for(i=0, yy=y, xx=x;
@@ -241,13 +241,13 @@
}
-Menu bounce(void)
+bool bounce(void)
{
int w, h;
char *off = "[Off] to stop";
int len = strlen(SS_TITLE);
- lcd_getfontsize(SS_TITLE_FONT, &w, &h);
+ lcd_getstringsize(SS_TITLE,&w, &h);
/* Get horizontel centering for text */
len *= w;
@@ -262,10 +262,10 @@
h /= 2;
lcd_clear_display();
- lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT);
+ lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE);
- len = strlen(off);
- lcd_getfontsize(0, &w, &h);
+ len = 1;
+ lcd_getstringsize(off, &w, &h);
/* Get horizontel centering for text */
len *= w;
@@ -279,13 +279,13 @@
else
h /= 2;
- lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0);
+ lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off);
lcd_update();
sleep(HZ);
loopit();
- return MENU_OK;
+ return false;
}
#endif
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 76169fe..6414a17 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -235,10 +235,12 @@
/* display volume lever numerical? */
if (TIME_BEFORE(current_tick,switch_tick)) {
snprintf(buffer, sizeof(buffer), "%2d", percent);
- lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height);
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_getstringsize(buffer, &width, &height);
if (height <= STATUSBAR_HEIGHT)
lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 -
- width/2, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED);
+ width/2, STATUSBAR_Y_POS, buffer);
+ lcd_setfont(FONT_UI);
}
else { /* display volume bar */
volume = volume * 14 / 100;
@@ -246,7 +248,8 @@
if(i%2 == 0)
step++;
for(j=1; j <= step; j++)
- lcd_drawpixel(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 7 - j);
+ lcd_drawpixel(ICON_VOLUME_X_POS + i,
+ STATUSBAR_Y_POS + 7 - j);
}
}
}
@@ -307,8 +310,10 @@
strncpy(buffer, "--:--", sizeof buffer);
}
- lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height);
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_getstringsize(buffer, &width, &height);
if (height <= STATUSBAR_HEIGHT)
- lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED);
+ lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer);
+ lcd_setfont(FONT_UI);
}
#endif
diff --git a/apps/recorder/oscillograph.c b/apps/recorder/oscillograph.c
index c3b76c4..25ae10f 100644
--- a/apps/recorder/oscillograph.c
+++ b/apps/recorder/oscillograph.c
@@ -45,7 +45,7 @@
* hardware scrolling of the display. The user can change
* speed
*/
-Menu oscillograph(void)
+bool oscillograph(void)
{
/* stores current volume value left */
int left;
@@ -184,7 +184,7 @@
if (draw) {
char buf[16];
snprintf(buf, sizeof buf, "Speed: %d", -speed);
- lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf, 0);
+ lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf);
lcd_update_rect(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT,
LCD_WIDTH, 8);
}
@@ -197,5 +197,5 @@
lcd_update();
/* standard return */
- return MENU_OK;
+ return false;
}
diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c
index 3e5d447..68961f7 100644
--- a/apps/recorder/sokoban.c
+++ b/apps/recorder/sokoban.c
@@ -1846,14 +1846,14 @@
snprintf (s, sizeof(s), "%d", current_level+1);
- lcd_putsxy (86, 22, s, 0);
+ lcd_putsxy (86, 22, s);
snprintf (s, sizeof(s), "%d", moves);
- lcd_putsxy (86, 54, s, 0);
+ lcd_putsxy (86, 54, s);
lcd_drawrect (80,0,32,32);
lcd_drawrect (80,32,32,64);
- lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0);
- lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0);
+ lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL));
+ lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE));
/* print out the screen */
lcd_update();
}
@@ -2197,7 +2197,7 @@
if (current_level == NUM_LEVELS) {
for(ii=0; ii<30 ; ii++) {
lcd_clear_display();
- lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2);
+ lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN));
lcd_update();
lcd_invertrect(0,0,111,63);
lcd_update();
@@ -2220,12 +2220,12 @@
{
bool result;
int w, h;
- int len = strlen(SOKOBAN_TITLE);
+ int len;
- lcd_getfontsize(SOKOBAN_TITLE_FONT, &w, &h);
+ lcd_getstringsize(SOKOBAN_TITLE, &w, &h);
/* Get horizontel centering for text */
- len *= w;
+ len = w;
if (len%2 != 0)
len = ((len+1)/2)+(w/2);
else
@@ -2237,18 +2237,17 @@
h /= 2;
lcd_clear_display();
- lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE,
- SOKOBAN_TITLE_FONT);
+ lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE);
lcd_update();
sleep(HZ*2);
lcd_clear_display();
- lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0);
- lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0);
- lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0);
- lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0);
+ lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT));
+ lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1));
+ lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2));
+ lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3));
lcd_update();
sleep(HZ*2);
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c
index 5264b8e..53012fd 100644
--- a/apps/recorder/tetris.c
+++ b/apps/recorder/tetris.c
@@ -319,7 +319,7 @@
}
snprintf (s, sizeof(s), "%d Rows - Level %d", lines, level);
- lcd_putsxy (2, 42, s, 0);
+ lcd_putsxy (2, 42, s);
new_block();
move_block(0,0,0);
@@ -371,7 +371,7 @@
if(gameover())
{
lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52);
- lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0);
+ lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE));
lcd_update();
sleep(HZ * 3);
return false;
@@ -403,7 +403,7 @@
init_tetris();
draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y);
- lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0);
+ lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL));
lcd_update();
next_b = t_rand(blocks);
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c
index 0edd550..5fb48aa 100644
--- a/apps/recorder/wormlet.c
+++ b/apps/recorder/wormlet.c
@@ -1213,8 +1213,8 @@
snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED));
break;
}
- lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0);
- lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2, 0);
+ lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf);
+ lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2);
if (!worms[i].alive){
lcd_invertrect(FIELD_RECT_WIDTH + 2, y,
@@ -1224,9 +1224,9 @@
}
snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore);
#ifndef DEBUG_WORMLET
- lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0);
+ lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf);
#else
- lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout, 0);
+ lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout);
#endif
}
@@ -1451,7 +1451,7 @@
collision_count++;
}
snprintf(buf, sizeof buf, "collisions: %d", collision_count);
- lcd_putsxy(0, LCD_HEIGHT -8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT -8, buf);
lcd_update();
}
if (collision_count != FOOD_SIZE) {
@@ -1470,7 +1470,7 @@
collision_count ++;
}
snprintf(buf, sizeof buf, "collisions: %d", collision_count);
- lcd_putsxy(0, LCD_HEIGHT -8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT -8, buf);
lcd_update();
}
if (collision_count != FOOD_SIZE * 2) {
@@ -1518,7 +1518,7 @@
collision_count ++;
}
snprintf(buf, sizeof buf, "collisions: %d", collision_count);
- lcd_putsxy(0, LCD_HEIGHT -8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT -8, buf);
lcd_update();
}
if (collision_count != ARGH_SIZE * 2) {
@@ -1535,7 +1535,7 @@
collision_count ++;
}
snprintf(buf, sizeof buf, "collisions: %d", collision_count);
- lcd_putsxy(0, LCD_HEIGHT -8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT -8, buf);
lcd_update();
}
if (collision_count != ARGH_SIZE * 4) {
@@ -1562,7 +1562,7 @@
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
lcd_update();
- lcd_putsxy(0, 0, "failed 1", 0);
+ lcd_putsxy(0, 0, "failed 1");
button_get(true);
testfailed = 1;
}
@@ -1573,7 +1573,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 2", 0);
+ lcd_putsxy(0, 0, "failed 2");
lcd_update();
button_get(true);
testfailed = 2;
@@ -1585,7 +1585,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 3", 0);
+ lcd_putsxy(0, 0, "failed 3");
lcd_update();
button_get(true);
testfailed = 3;
@@ -1597,7 +1597,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 4", 0);
+ lcd_putsxy(0, 0, "failed 4");
lcd_update();
button_get(true);
testfailed = 4;
@@ -1609,7 +1609,7 @@
line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 5", 0);
+ lcd_putsxy(0, 0, "failed 5");
lcd_update();
button_get(true);
testfailed = 5;
@@ -1622,7 +1622,7 @@
line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 6", 0);
+ lcd_putsxy(0, 0, "failed 6");
lcd_update();
button_get(true);
testfailed = 6;
@@ -1637,7 +1637,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 7", 0);
+ lcd_putsxy(0, 0, "failed 7");
lcd_update();
button_get(true);
testfailed = 7;
@@ -1649,7 +1649,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 8", 0);
+ lcd_putsxy(0, 0, "failed 8");
lcd_update();
button_get(true);
testfailed = 8;
@@ -1661,7 +1661,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 9", 0);
+ lcd_putsxy(0, 0, "failed 9");
lcd_update();
button_get(true);
testfailed = 9;
@@ -1673,7 +1673,7 @@
!line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 10", 0);
+ lcd_putsxy(0, 0, "failed 10");
lcd_update();
button_get(true);
testfailed = 10;
@@ -1685,7 +1685,7 @@
line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 11", 0);
+ lcd_putsxy(0, 0, "failed 11");
lcd_update();
button_get(true);
testfailed = 11;
@@ -1698,7 +1698,7 @@
line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 12", 0);
+ lcd_putsxy(0, 0, "failed 12");
lcd_update();
button_get(true);
testfailed = 12;
@@ -1715,10 +1715,10 @@
x2 = 10;
y2 = 20;
if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) &&
- line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
+ line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
lcd_drawrect(rx, ry, rw, rh);
lcd_drawline(x1, y1, x2, y2);
- lcd_putsxy(0, 0, "failed 13", 0);
+ lcd_putsxy(0, 0, "failed 13");
lcd_update();
button_get(true);
testfailed = 13;
@@ -1735,10 +1735,10 @@
x2 = 10;
y2 = 19;
if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) &&
- line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
+ line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
lcd_drawline(x1, y1, x2, y2);
lcd_invertrect(rx, ry, rw, rh);
- lcd_putsxy(0, 0, "failed 14", 0);
+ lcd_putsxy(0, 0, "failed 14");
lcd_update();
button_get(true);
testfailed = 14;
@@ -1780,7 +1780,7 @@
}
lcd_invertpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y);
snprintf(buf, sizeof buf, "collisions %d", collisions);
- lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT - 8, buf);
lcd_update();
}
}
@@ -1837,7 +1837,7 @@
}
snprintf(buf, sizeof buf, "(%d;%d) fail%d try%d", x, y, failures, tries);
- lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT - 8, buf);
lcd_update();
lcd_invertrect(x + FIELD_RECT_X, y+ FIELD_RECT_Y, ARGH_SIZE, ARGH_SIZE);
lcd_update();
@@ -1875,7 +1875,7 @@
hit_count ++;
}
snprintf(buf, sizeof buf, "in 5 moves hits: %d", hit_count);
- lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0);
+ lcd_putsxy(0, LCD_HEIGHT - 8, buf);
lcd_update();
}
if (hit_count != ARGH_SIZE + 5) {
diff --git a/apps/screens.c b/apps/screens.c
index 04870d1..29888ff 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -62,24 +62,24 @@
lcd_clear_display();
ptr = str(LANG_PITCH_UP);
- lcd_getstringsize(ptr,FONT_UI,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr, FONT_UI);
+ lcd_getstringsize(ptr,&w,&h);
+ lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
LCD_WIDTH/2 - 3, h*2, 7, 8, true);
snprintf(buf, sizeof buf, "%d%%", pitch);
- lcd_getstringsize(buf,FONT_UI,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, h, buf, FONT_UI);
+ lcd_getstringsize(buf,&w,&h);
+ lcd_putsxy((LCD_WIDTH-w)/2, h, buf);
ptr = str(LANG_PITCH_DOWN);
- lcd_getstringsize(ptr,FONT_UI,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr, FONT_UI);
+ lcd_getstringsize(ptr,&w,&h);
+ lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
ptr = str(LANG_PAUSE);
- lcd_getstringsize(ptr,FONT_UI,&w,&h);
- lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr, FONT_UI);
+ lcd_getstringsize(ptr,&w,&h);
+ lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_Pause],
(LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8, true);
@@ -162,18 +162,18 @@
char buf[32];
/* Get the font height */
- lcd_getstringsize("A",FONT_UI,&w,&h);
+ lcd_getstringsize("A",&w,&h);
lcd_stop_scroll();
while (!exit) {
lcd_clear_display();
- lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE), FONT_UI);
- lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE), FONT_UI);
+ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
lcd_putsxy(0, LCD_HEIGHT/2,
global_settings.playlist_shuffle ?
- str(LANG_ON) : str(LANG_OFF), FONT_UI);
+ str(LANG_ON) : str(LANG_OFF));
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
@@ -181,8 +181,8 @@
global_settings.mp3filter ? str(LANG_ON) : str(LANG_OFF));
/* Get the string width and height */
- lcd_getstringsize(buf,FONT_UI,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf, FONT_UI);
+ lcd_getstringsize(buf,&w,&h);
+ lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
@@ -236,20 +236,20 @@
char* ptr;
ptr = str(LANG_F3_STATUS);
- lcd_getstringsize(ptr,FONT_UI,&w,&h);
+ lcd_getstringsize(ptr,&w,&h);
lcd_clear_display();
- lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL), FONT_UI);
- lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI);
+ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
lcd_putsxy(0, LCD_HEIGHT/2,
- global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI);
+ global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, FONT_UI);
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
- global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI);
+ global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
lcd_update();
@@ -288,5 +288,3 @@
return false;
}
#endif
-
-
diff --git a/apps/settings.c b/apps/settings.c
index 025a911..673bca7 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -866,33 +866,33 @@
lcd_puts(0, 1, buffer);
/* recalculate the positions and offsets */
- lcd_getstringsize(string, FONT_UI, &width, &prev_line_height);
- lcd_getstringsize(buffer, FONT_UI, &width, &line_height);
- lcd_getstringsize(":", FONT_UI, &separator_width, &height);
+ lcd_getstringsize(string, &width, &prev_line_height);
+ lcd_getstringsize(buffer, &width, &line_height);
+ lcd_getstringsize(":", &separator_width, &height);
strncpy(reffub, buffer, 2);
reffub[2] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[0][INDEX_X] = 0;
cursor[0][INDEX_Y] = prev_line_height;
cursor[0][INDEX_WIDTH] = width;
strncpy(reffub, buffer + 3, 2);
reffub[2] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width;
cursor[1][INDEX_Y] = prev_line_height;
cursor[1][INDEX_WIDTH] = width;
strncpy(reffub, buffer + 6, 2);
reffub[2] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width +
cursor[1][INDEX_WIDTH] + separator_width;
cursor[2][INDEX_Y] = prev_line_height;
cursor[2][INDEX_WIDTH] = width;
- lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height);
+ lcd_getstringsize(buffer, &width, &prev_line_height);
snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ",
dayname[timedate[6]],
@@ -902,22 +902,22 @@
lcd_puts(0, 2, buffer);
/* recalculate the positions and offsets */
- lcd_getstringsize(buffer, FONT_UI, &width, &line_height);
+ lcd_getstringsize(buffer, &width, &line_height);
strncpy(reffub, buffer, 3);
reffub[3] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &weekday_width, &height);
- lcd_getstringsize(" ", FONT_UI, &separator_width, &height);
+ lcd_getstringsize(reffub, &weekday_width, &height);
+ lcd_getstringsize(" ", &separator_width, &height);
strncpy(reffub, buffer + 4, 4);
reffub[4] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[3][INDEX_X] = weekday_width + separator_width;
cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
cursor[3][INDEX_WIDTH] = width;
strncpy(reffub, buffer + 9, 3);
reffub[3] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[4][INDEX_X] = weekday_width + separator_width +
cursor[3][INDEX_WIDTH] + separator_width;
cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
@@ -925,7 +925,7 @@
strncpy(reffub, buffer + 13, 2);
reffub[2] = '\0';
- lcd_getstringsize(reffub, FONT_UI, &width, &height);
+ lcd_getstringsize(reffub, &width, &height);
cursor[5][INDEX_X] = weekday_width + separator_width +
cursor[3][INDEX_WIDTH] + separator_width +
cursor[4][INDEX_WIDTH] + separator_width;
diff --git a/apps/tree.c b/apps/tree.c
index ce27f7b..3aba7fa 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -193,7 +193,8 @@
#ifdef HAVE_LCD_BITMAP
int line_height = LINE_HEIGTH;
int fw, fh;
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_setfont(FONT_UI);
+ lcd_getstringsize("A", &fw, &fh);
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
line_height = fh;
#else
@@ -591,7 +592,7 @@
bool lastshowhidden = global_settings.show_hidden_files;
#ifdef HAVE_LCD_BITMAP
int fw, fh;
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_getstringsize("A", &fw, &fh);
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
#else
tree_max_on_screen = TREE_MAX_ON_SCREEN;
@@ -740,16 +741,14 @@
lcd_puts(0, 0, str(LANG_LANGUAGE_LOADED));
#else
lcd_getstringsize(str(LANG_LANGUAGE_LOADED),
- FONT_UI, &fw, &fh);
+ &fw, &fh);
if(fw>LCD_WIDTH)
fw=0;
else
fw=LCD_WIDTH/2 - fw/2;
- lcd_putsxy(fw,
- LCD_HEIGHT/2 - fh/2,
- str(LANG_LANGUAGE_LOADED),
- FONT_UI);
+ lcd_putsxy(fw, LCD_HEIGHT/2 - fh/2,
+ str(LANG_LANGUAGE_LOADED));
#endif
lcd_update();
sleep(HZ);
@@ -762,7 +761,7 @@
snprintf(buf, sizeof buf, "%s/%s",
currdir, file->name);
font_load(buf);
- lcd_getfontsize(FONT_UI, &fw, &fh);
+ lcd_getstringsize("A", &fw, &fh);
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
/* make sure cursor is on screen */
while ( dircursor > tree_max_on_screen ) {
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 98a1d8b..ec1e9c7 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -548,7 +548,7 @@
#else
int w,h;
int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
- lcd_getstringsize("M",FONT_UI,&w,&h);
+ lcd_getstringsize("M",&w,&h);
slidebar(0, i*h + offset + 1, LCD_WIDTH, 6,
(id3->elapsed + ff_rewind_count) * 100 / id3->length,
Grow_Right);
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index 9f86d8f..fee42d9 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -228,17 +228,9 @@
curfont = newfont;
}
-void lcd_getfontsize(int font, int *width, int *height)
+int lcd_getstringsize(unsigned char *str, int *w, int *h)
{
- struct font* pf = font_get(font);
-
- *width = pf->maxwidth;
- *height = pf->height;
-}
-
-int lcd_getstringsize(unsigned char *str, int font, int *w, int *h)
-{
- struct font* pf = font_get(font);
+ struct font* pf = font_get(curfont);
int ch;
int width = 0;
@@ -279,10 +271,10 @@
if(!str || !str[0])
return;
- lcd_getstringsize(str, curfont, &w, &h);
+ lcd_getstringsize(str, &w, &h);
xpos = xmargin + x*w / strlen(str);
ypos = ymargin + y*h;
- lcd_putsxy( xpos, ypos, str, curfont);
+ lcd_putsxy(xpos, ypos, str);
lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h);
#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
@@ -293,10 +285,10 @@
}
/* put a string at a given pixel position */
-void lcd_putsxy(int x, int y, unsigned char *str, int font)
+void lcd_putsxy(int x, int y, unsigned char *str)
{
int ch;
- struct font* pf = font_get(font);
+ struct font* pf = font_get(curfont);
while (((ch = *str++) != '\0')) {
bitmap_t *bits;
@@ -645,15 +637,14 @@
struct scrollinfo* s = &scroll;
unsigned char ch[2];
int w, h;
- int width, height;
- lcd_getfontsize(curfont, &width, &height);
+ int width;
ch[1] = 0; /* zero terminate */
ch[0] = string[0];
width = 0;
s->space = 0;
while ( ch[0] &&
- (width + lcd_getstringsize(ch, curfont, &w, &h) <
+ (width + lcd_getstringsize(ch, &w, &h) <
(LCD_WIDTH - x*8))) {
width += w;
s->space++;
@@ -664,7 +655,7 @@
s->textlen = strlen(string);
s->space += 2;
- lcd_getstringsize(string,curfont,&w,&h);
+ lcd_getstringsize(string,&w,&h);
if ( w > LCD_WIDTH - xmargin ) {
s->offset=s->space;
s->startx=x;
@@ -688,7 +679,7 @@
struct scrollinfo* s = &scroll;
scroll_count = 0;
- lcd_getstringsize( s->text, FONT_UI, &w, &h);
+ lcd_getstringsize( s->text, &w, &h);
lcd_clearrect(xmargin + s->startx*w/s->textlen,
ymargin + s->starty*h,
LCD_WIDTH - xmargin,
@@ -745,7 +736,7 @@
s->offset = 0;
}
- lcd_getstringsize( s->text, FONT_UI, &w, &h);
+ lcd_getstringsize( s->text, &w, &h);
lcd_clearrect(xmargin + s->startx*w/s->textlen,
ymargin + s->starty*h,
LCD_WIDTH - xmargin,
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
index 76e3837..32f63605 100644
--- a/firmware/drivers/lcd.h
+++ b/firmware/drivers/lcd.h
@@ -117,11 +117,10 @@
extern void lcd_roll(int pixels);
extern void lcd_setfont(int font);
-extern void lcd_getfontsize(int font, int *width, int *height);
-extern void lcd_putsxy(int x, int y, unsigned char *string, int font);
+extern void lcd_putsxy(int x, int y, unsigned char *string);
+extern int lcd_getstringsize(unsigned char *str, int *w, int *h);
#endif /* CHARCELLS / BITMAP */
-extern int lcd_getstringsize(unsigned char *str, int font, int *w, int *h);
#endif /* __LCD_H__ */
diff --git a/firmware/panic.c b/firmware/panic.c
index 10ff454..fefde2e 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -50,8 +50,8 @@
#elif defined(HAVE_LCD_BITMAP)
lcd_clear_display();
- //FIXME putsxy may call panic...
- lcd_putsxy(0,0,panic_buf,FONT_SYSFIXED);
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_putsxy(0,0,panic_buf);
lcd_update();
#else
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 3360afe..3534497 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -98,11 +98,11 @@
(void)s;
}
-Menu simulate_usb(void)
+bool simulate_usb(void)
{
usb_display_info();
while (button_get(true) & BUTTON_REL);
- return MENU_OK;
+ return false;
}
void lcd_define_pattern (int which,char *pattern,int length)
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
index 2dc45eb..803cc64 100644
--- a/uisimulator/win32/Makefile
+++ b/uisimulator/win32/Makefile
@@ -72,7 +72,7 @@
MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
- APPS += snake.c tetris.c sokoban.c bounce.c snow.c bmp.c \
+ APPS += tetris.c sokoban.c bounce.c snow.c bmp.c \
widgets.c wormlet.c
endif
@@ -127,9 +127,6 @@
$(OBJDIR)/widgets.o: $(RECDIR)/widgets.c
$(CC) $(APPCFLAGS) -c $< -o $@
-$(OBJDIR)/snake.o: $(RECDIR)/snake.c
- $(CC) $(APPCFLAGS) -c $< -o $@
-
$(OBJDIR)/tetris.o: $(RECDIR)/tetris.c
$(CC) $(APPCFLAGS) -c $< -o $@
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index fa65130..abf63cb 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -87,7 +87,7 @@
MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
- APPS += tetris.c sokoban.c bounce.c snake.c snow.c bmp.c widgets.c wormlet.c
+ APPS += tetris.c sokoban.c bounce.c snow.c bmp.c widgets.c wormlet.c
endif
SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \
@@ -191,9 +191,6 @@
$(OBJDIR)/bounce.o: $(RECDIR)/bounce.c
$(CC) $(APPCFLAGS) -c $< -o $@
-$(OBJDIR)/snake.o: $(RECDIR)/snake.c
- $(CC) $(APPCFLAGS) -c $< -o $@
-
$(OBJDIR)/snow.o: $(RECDIR)/snow.c
$(CC) $(APPCFLAGS) -c $< -o $@