summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-09-24 18:04:15 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-09-24 18:04:15 +0000
commita4c3b03f15eefd516224e429215258bffa0221de (patch)
tree84ab843fdeaed0010f09a5de80ba679258e4fcd3
parent614272c45f6235b01685d3aa48b5a154f9362c10 (diff)
downloadrockbox-a4c3b03f15eefd516224e429215258bffa0221de.tar.gz
rockbox-a4c3b03f15eefd516224e429215258bffa0221de.zip
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
-rw-r--r--apps/credits.c40
-rw-r--r--apps/main_menu.c18
-rw-r--r--apps/menu.c10
-rw-r--r--apps/recorder/bounce.c16
-rw-r--r--apps/recorder/icons.c15
-rw-r--r--apps/recorder/oscillograph.c6
-rw-r--r--apps/recorder/sokoban.c27
-rw-r--r--apps/recorder/tetris.c6
-rw-r--r--apps/recorder/wormlet.c54
-rw-r--r--apps/screens.c44
-rw-r--r--apps/settings.c26
-rw-r--r--apps/tree.c15
-rw-r--r--apps/wps-display.c2
-rw-r--r--firmware/drivers/lcd-recorder.c31
-rw-r--r--firmware/drivers/lcd.h5
-rw-r--r--firmware/panic.c4
-rw-r--r--uisimulator/common/stubs.c4
-rw-r--r--uisimulator/win32/Makefile5
-rw-r--r--uisimulator/x11/Makefile5
19 files changed, 159 insertions, 174 deletions
diff --git a/apps/credits.c b/apps/credits.c
index f8b060f31c..5743f2e7a5 100644
--- a/apps/credits.c
+++ b/apps/credits.c
@@ -113,28 +113,28 @@ void roll_credits(void)
113 int height; 113 int height;
114 int width; 114 int width;
115 115
116 lcd_getfontsize(FONT_UI, &width, &height); 116 lcd_getstringsize("A", &width, &height);
117 117
118 while(1) { 118 while(1) {
119 lcd_clear_display(); 119 lcd_clear_display();
120 for ( i=0; i <= (64-y)/height; i++ ) 120 for ( i=0; i <= (64-y)/height; i++ )
121 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"", FONT_UI); 121 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
122 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ", 122 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
123 line+1, numnames); 123 line+1, numnames);
124 lcd_putsxy(0, 0, buffer, FONT_UI); 124 lcd_putsxy(0, 0, buffer);
125 lcd_update(); 125 lcd_update();
126 126
127 if (button_get_w_tmo(HZ/20)) 127 if (button_get_w_tmo(HZ/20))
128 return; 128 return;
129 129
130 y--; 130 y--;
131 131
132 if(y<0) { 132 if(y<0) {
133 line++; 133 line++;
134 if(line >= numnames) 134 if(line >= numnames)
135 break; 135 break;
136 y+=height; 136 y+=height;
137 } 137 }
138 138
139 } 139 }
140 return; 140 return;
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 199dca66e7..aa87ed39a3 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -88,20 +88,20 @@ int show_logo( void )
88 88
89 debugf("read_bmp_file() returned %d, width %d height %d\n", 89 debugf("read_bmp_file() returned %d, width %d height %d\n",
90 failure, width, height); 90 failure, width, height);
91 91
92 for(i=0, eline=0; i < height; i+=8, eline++) { 92 for(i=0, eline=0; i < height; i+=8, eline++) {
93 /* the bitmap function doesn't work with full-height bitmaps 93 /* the bitmap function doesn't work with full-height bitmaps
94 so we "stripe" the logo output */ 94 so we "stripe" the logo output */
95 lcd_bitmap(&buffer[eline*width], 0, 10+i, width, 95 lcd_bitmap(&buffer[eline*width], 0, 10+i, width,
96 (height-i)>8?8:height-i, false); 96 (height-i)>8?8:height-i, false);
97 }
98 } 97 }
99#endif 98#endif
100 99
101 snprintf(version, sizeof(version), "Ver. %s", appsversion); 100 snprintf(version, sizeof(version), "Ver. %s", appsversion);
102 lcd_getfontsize(FONT_SYSFIXED, &font_w, &font_h); 101 lcd_setfont(FONT_SYSFIXED);
102 lcd_getstringsize("A", &font_w, &font_h);
103 lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2), 103 lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2),
104 LCD_HEIGHT-font_h, version, FONT_SYSFIXED); 104 LCD_HEIGHT-font_h, version);
105 lcd_update(); 105 lcd_update();
106 106
107#else 107#else
diff --git a/apps/menu.c b/apps/menu.c
index ac5c857a70..96b0bfdf02 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -29,11 +29,11 @@
29#include "panic.h" 29#include "panic.h"
30#include "settings.h" 30#include "settings.h"
31#include "status.h" 31#include "status.h"
32#include "screens.h"
32 33
33#ifdef HAVE_LCD_BITMAP 34#ifdef HAVE_LCD_BITMAP
34#include "icons.h" 35#include "icons.h"
35#include "widgets.h" 36#include "widgets.h"
36#include "screens.h"
37#endif 37#endif
38 38
39struct menu { 39struct menu {
@@ -95,7 +95,7 @@ void put_cursorxy(int x, int y, bool on)
95#ifdef HAVE_LCD_BITMAP 95#ifdef HAVE_LCD_BITMAP
96 int fh, fw; 96 int fh, fw;
97 int xpos, ypos; 97 int xpos, ypos;
98 lcd_getfontsize(FONT_UI, &fw, &fh); 98 lcd_getstringsize("A", &fw, &fh);
99 xpos = x*6; 99 xpos = x*6;
100 ypos = y*fh + lcd_getymargin(); 100 ypos = y*fh + lcd_getymargin();
101 if ( fh > 8 ) 101 if ( fh > 8 )
@@ -134,7 +134,8 @@ static void menu_draw(int m)
134#ifdef HAVE_LCD_BITMAP 134#ifdef HAVE_LCD_BITMAP
135 int fw, fh; 135 int fw, fh;
136 int menu_lines; 136 int menu_lines;
137 lcd_getfontsize(FONT_UI, &fw, &fh); 137 lcd_setfont(FONT_UI);
138 lcd_getstringsize("A", &fw, &fh);
138 if (global_settings.statusbar) 139 if (global_settings.statusbar)
139 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; 140 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
140 else 141 else
@@ -147,7 +148,6 @@ static void menu_draw(int m)
147 lcd_clear_display(); /* ...then clean the screen */ 148 lcd_clear_display(); /* ...then clean the screen */
148#ifdef HAVE_LCD_BITMAP 149#ifdef HAVE_LCD_BITMAP
149 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */ 150 lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
150 lcd_setfont(FONT_UI);
151#endif 151#endif
152 /* correct cursor pos if out of screen */ 152 /* correct cursor pos if out of screen */
153 if (menus[m].cursor - menus[m].top >= menu_lines) 153 if (menus[m].cursor - menus[m].top >= menu_lines)
@@ -184,7 +184,7 @@ static void put_cursor(int m, int target)
184#ifdef HAVE_LCD_BITMAP 184#ifdef HAVE_LCD_BITMAP
185 int fw, fh; 185 int fw, fh;
186 int menu_lines; 186 int menu_lines;
187 lcd_getfontsize(FONT_UI, &fw, &fh); 187 lcd_getstringsize("A", &fw, &fh);
188 if (global_settings.statusbar) 188 if (global_settings.statusbar)
189 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; 189 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
190 else 190 else
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index fc11aefe68..cfb194e7ec 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -224,7 +224,7 @@ static void loopit(void)
224 } 224 }
225 snprintf(buffer, 30, "%s: %d", 225 snprintf(buffer, 30, "%s: %d",
226 values[show].what, values[show].num); 226 values[show].what, values[show].num);
227 lcd_putsxy(0, 56, buffer, 0); 227 lcd_putsxy(0, 56, buffer);
228 timeout--; 228 timeout--;
229 } 229 }
230 for(i=0, yy=y, xx=x; 230 for(i=0, yy=y, xx=x;
@@ -241,13 +241,13 @@ static void loopit(void)
241} 241}
242 242
243 243
244Menu bounce(void) 244bool bounce(void)
245{ 245{
246 int w, h; 246 int w, h;
247 char *off = "[Off] to stop"; 247 char *off = "[Off] to stop";
248 int len = strlen(SS_TITLE); 248 int len = strlen(SS_TITLE);
249 249
250 lcd_getfontsize(SS_TITLE_FONT, &w, &h); 250 lcd_getstringsize(SS_TITLE,&w, &h);
251 251
252 /* Get horizontel centering for text */ 252 /* Get horizontel centering for text */
253 len *= w; 253 len *= w;
@@ -262,10 +262,10 @@ Menu bounce(void)
262 h /= 2; 262 h /= 2;
263 263
264 lcd_clear_display(); 264 lcd_clear_display();
265 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); 265 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE);
266 266
267 len = strlen(off); 267 len = 1;
268 lcd_getfontsize(0, &w, &h); 268 lcd_getstringsize(off, &w, &h);
269 269
270 /* Get horizontel centering for text */ 270 /* Get horizontel centering for text */
271 len *= w; 271 len *= w;
@@ -279,13 +279,13 @@ Menu bounce(void)
279 else 279 else
280 h /= 2; 280 h /= 2;
281 281
282 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0); 282 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off);
283 283
284 lcd_update(); 284 lcd_update();
285 sleep(HZ); 285 sleep(HZ);
286 loopit(); 286 loopit();
287 287
288 return MENU_OK; 288 return false;
289} 289}
290 290
291#endif 291#endif
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 76169fe0ee..6414a17418 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -235,10 +235,12 @@ void statusbar_icon_volume(int percent)
235 /* display volume lever numerical? */ 235 /* display volume lever numerical? */
236 if (TIME_BEFORE(current_tick,switch_tick)) { 236 if (TIME_BEFORE(current_tick,switch_tick)) {
237 snprintf(buffer, sizeof(buffer), "%2d", percent); 237 snprintf(buffer, sizeof(buffer), "%2d", percent);
238 lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); 238 lcd_setfont(FONT_SYSFIXED);
239 lcd_getstringsize(buffer, &width, &height);
239 if (height <= STATUSBAR_HEIGHT) 240 if (height <= STATUSBAR_HEIGHT)
240 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 241 lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 -
241 width/2, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); 242 width/2, STATUSBAR_Y_POS, buffer);
243 lcd_setfont(FONT_UI);
242 } 244 }
243 else { /* display volume bar */ 245 else { /* display volume bar */
244 volume = volume * 14 / 100; 246 volume = volume * 14 / 100;
@@ -246,7 +248,8 @@ void statusbar_icon_volume(int percent)
246 if(i%2 == 0) 248 if(i%2 == 0)
247 step++; 249 step++;
248 for(j=1; j <= step; j++) 250 for(j=1; j <= step; j++)
249 lcd_drawpixel(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 7 - j); 251 lcd_drawpixel(ICON_VOLUME_X_POS + i,
252 STATUSBAR_Y_POS + 7 - j);
250 } 253 }
251 } 254 }
252 } 255 }
@@ -307,8 +310,10 @@ void statusbar_time(int hour, int minute)
307 strncpy(buffer, "--:--", sizeof buffer); 310 strncpy(buffer, "--:--", sizeof buffer);
308 } 311 }
309 312
310 lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); 313 lcd_setfont(FONT_SYSFIXED);
314 lcd_getstringsize(buffer, &width, &height);
311 if (height <= STATUSBAR_HEIGHT) 315 if (height <= STATUSBAR_HEIGHT)
312 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); 316 lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer);
317 lcd_setfont(FONT_UI);
313} 318}
314#endif 319#endif
diff --git a/apps/recorder/oscillograph.c b/apps/recorder/oscillograph.c
index c3b76c4626..25ae10f01b 100644
--- a/apps/recorder/oscillograph.c
+++ b/apps/recorder/oscillograph.c
@@ -45,7 +45,7 @@ static int drawMode = DRAW_MODE_FILLED;
45 * hardware scrolling of the display. The user can change 45 * hardware scrolling of the display. The user can change
46 * speed 46 * speed
47 */ 47 */
48Menu oscillograph(void) 48bool oscillograph(void)
49{ 49{
50 /* stores current volume value left */ 50 /* stores current volume value left */
51 int left; 51 int left;
@@ -184,7 +184,7 @@ Menu oscillograph(void)
184 if (draw) { 184 if (draw) {
185 char buf[16]; 185 char buf[16];
186 snprintf(buf, sizeof buf, "Speed: %d", -speed); 186 snprintf(buf, sizeof buf, "Speed: %d", -speed);
187 lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf, 0); 187 lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf);
188 lcd_update_rect(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, 188 lcd_update_rect(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT,
189 LCD_WIDTH, 8); 189 LCD_WIDTH, 8);
190 } 190 }
@@ -197,5 +197,5 @@ Menu oscillograph(void)
197 lcd_update(); 197 lcd_update();
198 198
199 /* standard return */ 199 /* standard return */
200 return MENU_OK; 200 return false;
201} 201}
diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c
index 3e5d447ae9..68961f775d 100644
--- a/apps/recorder/sokoban.c
+++ b/apps/recorder/sokoban.c
@@ -1846,14 +1846,14 @@ static void update_screen(void) {
1846 1846
1847 1847
1848 snprintf (s, sizeof(s), "%d", current_level+1); 1848 snprintf (s, sizeof(s), "%d", current_level+1);
1849 lcd_putsxy (86, 22, s, 0); 1849 lcd_putsxy (86, 22, s);
1850 snprintf (s, sizeof(s), "%d", moves); 1850 snprintf (s, sizeof(s), "%d", moves);
1851 lcd_putsxy (86, 54, s, 0); 1851 lcd_putsxy (86, 54, s);
1852 1852
1853 lcd_drawrect (80,0,32,32); 1853 lcd_drawrect (80,0,32,32);
1854 lcd_drawrect (80,32,32,64); 1854 lcd_drawrect (80,32,32,64);
1855 lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0); 1855 lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL));
1856 lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0); 1856 lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE));
1857 /* print out the screen */ 1857 /* print out the screen */
1858 lcd_update(); 1858 lcd_update();
1859} 1859}
@@ -2197,7 +2197,7 @@ static bool sokoban_loop(void)
2197 if (current_level == NUM_LEVELS) { 2197 if (current_level == NUM_LEVELS) {
2198 for(ii=0; ii<30 ; ii++) { 2198 for(ii=0; ii<30 ; ii++) {
2199 lcd_clear_display(); 2199 lcd_clear_display();
2200 lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2); 2200 lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN));
2201 lcd_update(); 2201 lcd_update();
2202 lcd_invertrect(0,0,111,63); 2202 lcd_invertrect(0,0,111,63);
2203 lcd_update(); 2203 lcd_update();
@@ -2220,12 +2220,12 @@ bool sokoban(void)
2220{ 2220{
2221 bool result; 2221 bool result;
2222 int w, h; 2222 int w, h;
2223 int len = strlen(SOKOBAN_TITLE); 2223 int len;
2224 2224
2225 lcd_getfontsize(SOKOBAN_TITLE_FONT, &w, &h); 2225 lcd_getstringsize(SOKOBAN_TITLE, &w, &h);
2226 2226
2227 /* Get horizontel centering for text */ 2227 /* Get horizontel centering for text */
2228 len *= w; 2228 len = w;
2229 if (len%2 != 0) 2229 if (len%2 != 0)
2230 len = ((len+1)/2)+(w/2); 2230 len = ((len+1)/2)+(w/2);
2231 else 2231 else
@@ -2237,18 +2237,17 @@ bool sokoban(void)
2237 h /= 2; 2237 h /= 2;
2238 2238
2239 lcd_clear_display(); 2239 lcd_clear_display();
2240 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE, 2240 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE);
2241 SOKOBAN_TITLE_FONT);
2242 2241
2243 lcd_update(); 2242 lcd_update();
2244 sleep(HZ*2); 2243 sleep(HZ*2);
2245 2244
2246 lcd_clear_display(); 2245 lcd_clear_display();
2247 2246
2248 lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0); 2247 lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT));
2249 lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0); 2248 lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1));
2250 lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0); 2249 lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2));
2251 lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0); 2250 lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3));
2252 2251
2253 lcd_update(); 2252 lcd_update();
2254 sleep(HZ*2); 2253 sleep(HZ*2);
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c
index 5264b8e789..53012fd717 100644
--- a/apps/recorder/tetris.c
+++ b/apps/recorder/tetris.c
@@ -319,7 +319,7 @@ static void move_down(void)
319 } 319 }
320 320
321 snprintf (s, sizeof(s), "%d Rows - Level %d", lines, level); 321 snprintf (s, sizeof(s), "%d Rows - Level %d", lines, level);
322 lcd_putsxy (2, 42, s, 0); 322 lcd_putsxy (2, 42, s);
323 323
324 new_block(); 324 new_block();
325 move_block(0,0,0); 325 move_block(0,0,0);
@@ -371,7 +371,7 @@ static bool game_loop(void)
371 if(gameover()) 371 if(gameover())
372 { 372 {
373 lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); 373 lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52);
374 lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0); 374 lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE));
375 lcd_update(); 375 lcd_update();
376 sleep(HZ * 3); 376 sleep(HZ * 3);
377 return false; 377 return false;
@@ -403,7 +403,7 @@ bool tetris(void)
403 init_tetris(); 403 init_tetris();
404 404
405 draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y); 405 draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y);
406 lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0); 406 lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL));
407 lcd_update(); 407 lcd_update();
408 408
409 next_b = t_rand(blocks); 409 next_b = t_rand(blocks);
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c
index 0edd550966..5fb48aa48e 100644
--- a/apps/recorder/wormlet.c
+++ b/apps/recorder/wormlet.c
@@ -1213,8 +1213,8 @@ static void score_board(void)
1213 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED)); 1213 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED));
1214 break; 1214 break;
1215 } 1215 }
1216 lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0); 1216 lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf);
1217 lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2, 0); 1217 lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2);
1218 1218
1219 if (!worms[i].alive){ 1219 if (!worms[i].alive){
1220 lcd_invertrect(FIELD_RECT_WIDTH + 2, y, 1220 lcd_invertrect(FIELD_RECT_WIDTH + 2, y,
@@ -1224,9 +1224,9 @@ static void score_board(void)
1224 } 1224 }
1225 snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore); 1225 snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore);
1226#ifndef DEBUG_WORMLET 1226#ifndef DEBUG_WORMLET
1227 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0); 1227 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf);
1228#else 1228#else
1229 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout, 0); 1229 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout);
1230#endif 1230#endif
1231} 1231}
1232 1232
@@ -1451,7 +1451,7 @@ static void test_worm_food_collision(void) {
1451 collision_count++; 1451 collision_count++;
1452 } 1452 }
1453 snprintf(buf, sizeof buf, "collisions: %d", collision_count); 1453 snprintf(buf, sizeof buf, "collisions: %d", collision_count);
1454 lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); 1454 lcd_putsxy(0, LCD_HEIGHT -8, buf);
1455 lcd_update(); 1455 lcd_update();
1456 } 1456 }
1457 if (collision_count != FOOD_SIZE) { 1457 if (collision_count != FOOD_SIZE) {
@@ -1470,7 +1470,7 @@ static void test_worm_food_collision(void) {
1470 collision_count ++; 1470 collision_count ++;
1471 } 1471 }
1472 snprintf(buf, sizeof buf, "collisions: %d", collision_count); 1472 snprintf(buf, sizeof buf, "collisions: %d", collision_count);
1473 lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); 1473 lcd_putsxy(0, LCD_HEIGHT -8, buf);
1474 lcd_update(); 1474 lcd_update();
1475 } 1475 }
1476 if (collision_count != FOOD_SIZE * 2) { 1476 if (collision_count != FOOD_SIZE * 2) {
@@ -1518,7 +1518,7 @@ static void test_worm_argh_collision(void) {
1518 collision_count ++; 1518 collision_count ++;
1519 } 1519 }
1520 snprintf(buf, sizeof buf, "collisions: %d", collision_count); 1520 snprintf(buf, sizeof buf, "collisions: %d", collision_count);
1521 lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); 1521 lcd_putsxy(0, LCD_HEIGHT -8, buf);
1522 lcd_update(); 1522 lcd_update();
1523 } 1523 }
1524 if (collision_count != ARGH_SIZE * 2) { 1524 if (collision_count != ARGH_SIZE * 2) {
@@ -1535,7 +1535,7 @@ static void test_worm_argh_collision(void) {
1535 collision_count ++; 1535 collision_count ++;
1536 } 1536 }
1537 snprintf(buf, sizeof buf, "collisions: %d", collision_count); 1537 snprintf(buf, sizeof buf, "collisions: %d", collision_count);
1538 lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); 1538 lcd_putsxy(0, LCD_HEIGHT -8, buf);
1539 lcd_update(); 1539 lcd_update();
1540 } 1540 }
1541 if (collision_count != ARGH_SIZE * 4) { 1541 if (collision_count != ARGH_SIZE * 4) {
@@ -1562,7 +1562,7 @@ static int testline_in_rect(void) {
1562 lcd_drawrect(rx, ry, rw, rh); 1562 lcd_drawrect(rx, ry, rw, rh);
1563 lcd_drawline(x1, y1, x2, y2); 1563 lcd_drawline(x1, y1, x2, y2);
1564 lcd_update(); 1564 lcd_update();
1565 lcd_putsxy(0, 0, "failed 1", 0); 1565 lcd_putsxy(0, 0, "failed 1");
1566 button_get(true); 1566 button_get(true);
1567 testfailed = 1; 1567 testfailed = 1;
1568 } 1568 }
@@ -1573,7 +1573,7 @@ static int testline_in_rect(void) {
1573 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1573 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1574 lcd_drawrect(rx, ry, rw, rh); 1574 lcd_drawrect(rx, ry, rw, rh);
1575 lcd_drawline(x1, y1, x2, y2); 1575 lcd_drawline(x1, y1, x2, y2);
1576 lcd_putsxy(0, 0, "failed 2", 0); 1576 lcd_putsxy(0, 0, "failed 2");
1577 lcd_update(); 1577 lcd_update();
1578 button_get(true); 1578 button_get(true);
1579 testfailed = 2; 1579 testfailed = 2;
@@ -1585,7 +1585,7 @@ static int testline_in_rect(void) {
1585 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1585 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1586 lcd_drawrect(rx, ry, rw, rh); 1586 lcd_drawrect(rx, ry, rw, rh);
1587 lcd_drawline(x1, y1, x2, y2); 1587 lcd_drawline(x1, y1, x2, y2);
1588 lcd_putsxy(0, 0, "failed 3", 0); 1588 lcd_putsxy(0, 0, "failed 3");
1589 lcd_update(); 1589 lcd_update();
1590 button_get(true); 1590 button_get(true);
1591 testfailed = 3; 1591 testfailed = 3;
@@ -1597,7 +1597,7 @@ static int testline_in_rect(void) {
1597 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1597 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1598 lcd_drawrect(rx, ry, rw, rh); 1598 lcd_drawrect(rx, ry, rw, rh);
1599 lcd_drawline(x1, y1, x2, y2); 1599 lcd_drawline(x1, y1, x2, y2);
1600 lcd_putsxy(0, 0, "failed 4", 0); 1600 lcd_putsxy(0, 0, "failed 4");
1601 lcd_update(); 1601 lcd_update();
1602 button_get(true); 1602 button_get(true);
1603 testfailed = 4; 1603 testfailed = 4;
@@ -1609,7 +1609,7 @@ static int testline_in_rect(void) {
1609 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1609 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1610 lcd_drawrect(rx, ry, rw, rh); 1610 lcd_drawrect(rx, ry, rw, rh);
1611 lcd_drawline(x1, y1, x2, y2); 1611 lcd_drawline(x1, y1, x2, y2);
1612 lcd_putsxy(0, 0, "failed 5", 0); 1612 lcd_putsxy(0, 0, "failed 5");
1613 lcd_update(); 1613 lcd_update();
1614 button_get(true); 1614 button_get(true);
1615 testfailed = 5; 1615 testfailed = 5;
@@ -1622,7 +1622,7 @@ static int testline_in_rect(void) {
1622 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1622 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1623 lcd_drawrect(rx, ry, rw, rh); 1623 lcd_drawrect(rx, ry, rw, rh);
1624 lcd_drawline(x1, y1, x2, y2); 1624 lcd_drawline(x1, y1, x2, y2);
1625 lcd_putsxy(0, 0, "failed 6", 0); 1625 lcd_putsxy(0, 0, "failed 6");
1626 lcd_update(); 1626 lcd_update();
1627 button_get(true); 1627 button_get(true);
1628 testfailed = 6; 1628 testfailed = 6;
@@ -1637,7 +1637,7 @@ static int testline_in_rect(void) {
1637 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1637 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1638 lcd_drawrect(rx, ry, rw, rh); 1638 lcd_drawrect(rx, ry, rw, rh);
1639 lcd_drawline(x1, y1, x2, y2); 1639 lcd_drawline(x1, y1, x2, y2);
1640 lcd_putsxy(0, 0, "failed 7", 0); 1640 lcd_putsxy(0, 0, "failed 7");
1641 lcd_update(); 1641 lcd_update();
1642 button_get(true); 1642 button_get(true);
1643 testfailed = 7; 1643 testfailed = 7;
@@ -1649,7 +1649,7 @@ static int testline_in_rect(void) {
1649 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1649 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1650 lcd_drawrect(rx, ry, rw, rh); 1650 lcd_drawrect(rx, ry, rw, rh);
1651 lcd_drawline(x1, y1, x2, y2); 1651 lcd_drawline(x1, y1, x2, y2);
1652 lcd_putsxy(0, 0, "failed 8", 0); 1652 lcd_putsxy(0, 0, "failed 8");
1653 lcd_update(); 1653 lcd_update();
1654 button_get(true); 1654 button_get(true);
1655 testfailed = 8; 1655 testfailed = 8;
@@ -1661,7 +1661,7 @@ static int testline_in_rect(void) {
1661 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1661 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1662 lcd_drawrect(rx, ry, rw, rh); 1662 lcd_drawrect(rx, ry, rw, rh);
1663 lcd_drawline(x1, y1, x2, y2); 1663 lcd_drawline(x1, y1, x2, y2);
1664 lcd_putsxy(0, 0, "failed 9", 0); 1664 lcd_putsxy(0, 0, "failed 9");
1665 lcd_update(); 1665 lcd_update();
1666 button_get(true); 1666 button_get(true);
1667 testfailed = 9; 1667 testfailed = 9;
@@ -1673,7 +1673,7 @@ static int testline_in_rect(void) {
1673 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1673 !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1674 lcd_drawrect(rx, ry, rw, rh); 1674 lcd_drawrect(rx, ry, rw, rh);
1675 lcd_drawline(x1, y1, x2, y2); 1675 lcd_drawline(x1, y1, x2, y2);
1676 lcd_putsxy(0, 0, "failed 10", 0); 1676 lcd_putsxy(0, 0, "failed 10");
1677 lcd_update(); 1677 lcd_update();
1678 button_get(true); 1678 button_get(true);
1679 testfailed = 10; 1679 testfailed = 10;
@@ -1685,7 +1685,7 @@ static int testline_in_rect(void) {
1685 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1685 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1686 lcd_drawrect(rx, ry, rw, rh); 1686 lcd_drawrect(rx, ry, rw, rh);
1687 lcd_drawline(x1, y1, x2, y2); 1687 lcd_drawline(x1, y1, x2, y2);
1688 lcd_putsxy(0, 0, "failed 11", 0); 1688 lcd_putsxy(0, 0, "failed 11");
1689 lcd_update(); 1689 lcd_update();
1690 button_get(true); 1690 button_get(true);
1691 testfailed = 11; 1691 testfailed = 11;
@@ -1698,7 +1698,7 @@ static int testline_in_rect(void) {
1698 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { 1698 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) {
1699 lcd_drawrect(rx, ry, rw, rh); 1699 lcd_drawrect(rx, ry, rw, rh);
1700 lcd_drawline(x1, y1, x2, y2); 1700 lcd_drawline(x1, y1, x2, y2);
1701 lcd_putsxy(0, 0, "failed 12", 0); 1701 lcd_putsxy(0, 0, "failed 12");
1702 lcd_update(); 1702 lcd_update();
1703 button_get(true); 1703 button_get(true);
1704 testfailed = 12; 1704 testfailed = 12;
@@ -1715,10 +1715,10 @@ static int testline_in_rect(void) {
1715 x2 = 10; 1715 x2 = 10;
1716 y2 = 20; 1716 y2 = 20;
1717 if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && 1717 if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) &&
1718 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { 1718 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
1719 lcd_drawrect(rx, ry, rw, rh); 1719 lcd_drawrect(rx, ry, rw, rh);
1720 lcd_drawline(x1, y1, x2, y2); 1720 lcd_drawline(x1, y1, x2, y2);
1721 lcd_putsxy(0, 0, "failed 13", 0); 1721 lcd_putsxy(0, 0, "failed 13");
1722 lcd_update(); 1722 lcd_update();
1723 button_get(true); 1723 button_get(true);
1724 testfailed = 13; 1724 testfailed = 13;
@@ -1735,10 +1735,10 @@ static int testline_in_rect(void) {
1735 x2 = 10; 1735 x2 = 10;
1736 y2 = 19; 1736 y2 = 19;
1737 if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && 1737 if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) &&
1738 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { 1738 line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) {
1739 lcd_drawline(x1, y1, x2, y2); 1739 lcd_drawline(x1, y1, x2, y2);
1740 lcd_invertrect(rx, ry, rw, rh); 1740 lcd_invertrect(rx, ry, rw, rh);
1741 lcd_putsxy(0, 0, "failed 14", 0); 1741 lcd_putsxy(0, 0, "failed 14");
1742 lcd_update(); 1742 lcd_update();
1743 button_get(true); 1743 button_get(true);
1744 testfailed = 14; 1744 testfailed = 14;
@@ -1780,7 +1780,7 @@ static int test_specific_worm_collision(void) {
1780 } 1780 }
1781 lcd_invertpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y); 1781 lcd_invertpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y);
1782 snprintf(buf, sizeof buf, "collisions %d", collisions); 1782 snprintf(buf, sizeof buf, "collisions %d", collisions);
1783 lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); 1783 lcd_putsxy(0, LCD_HEIGHT - 8, buf);
1784 lcd_update(); 1784 lcd_update();
1785 } 1785 }
1786 } 1786 }
@@ -1837,7 +1837,7 @@ static void test_make_argh(void){
1837 } 1837 }
1838 1838
1839 snprintf(buf, sizeof buf, "(%d;%d) fail%d try%d", x, y, failures, tries); 1839 snprintf(buf, sizeof buf, "(%d;%d) fail%d try%d", x, y, failures, tries);
1840 lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); 1840 lcd_putsxy(0, LCD_HEIGHT - 8, buf);
1841 lcd_update(); 1841 lcd_update();
1842 lcd_invertrect(x + FIELD_RECT_X, y+ FIELD_RECT_Y, ARGH_SIZE, ARGH_SIZE); 1842 lcd_invertrect(x + FIELD_RECT_X, y+ FIELD_RECT_Y, ARGH_SIZE, ARGH_SIZE);
1843 lcd_update(); 1843 lcd_update();
@@ -1875,7 +1875,7 @@ static void test_worm_argh_collision_in_moves(void) {
1875 hit_count ++; 1875 hit_count ++;
1876 } 1876 }
1877 snprintf(buf, sizeof buf, "in 5 moves hits: %d", hit_count); 1877 snprintf(buf, sizeof buf, "in 5 moves hits: %d", hit_count);
1878 lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); 1878 lcd_putsxy(0, LCD_HEIGHT - 8, buf);
1879 lcd_update(); 1879 lcd_update();
1880 } 1880 }
1881 if (hit_count != ARGH_SIZE + 5) { 1881 if (hit_count != ARGH_SIZE + 5) {
diff --git a/apps/screens.c b/apps/screens.c
index 04870d1f1a..29888ff358 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -62,24 +62,24 @@ int on_screen(void)
62 lcd_clear_display(); 62 lcd_clear_display();
63 63
64 ptr = str(LANG_PITCH_UP); 64 ptr = str(LANG_PITCH_UP);
65 lcd_getstringsize(ptr,FONT_UI,&w,&h); 65 lcd_getstringsize(ptr,&w,&h);
66 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr, FONT_UI); 66 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
67 lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow], 67 lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
68 LCD_WIDTH/2 - 3, h*2, 7, 8, true); 68 LCD_WIDTH/2 - 3, h*2, 7, 8, true);
69 69
70 snprintf(buf, sizeof buf, "%d%%", pitch); 70 snprintf(buf, sizeof buf, "%d%%", pitch);
71 lcd_getstringsize(buf,FONT_UI,&w,&h); 71 lcd_getstringsize(buf,&w,&h);
72 lcd_putsxy((LCD_WIDTH-w)/2, h, buf, FONT_UI); 72 lcd_putsxy((LCD_WIDTH-w)/2, h, buf);
73 73
74 ptr = str(LANG_PITCH_DOWN); 74 ptr = str(LANG_PITCH_DOWN);
75 lcd_getstringsize(ptr,FONT_UI,&w,&h); 75 lcd_getstringsize(ptr,&w,&h);
76 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr, FONT_UI); 76 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
77 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 77 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
78 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 78 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
79 79
80 ptr = str(LANG_PAUSE); 80 ptr = str(LANG_PAUSE);
81 lcd_getstringsize(ptr,FONT_UI,&w,&h); 81 lcd_getstringsize(ptr,&w,&h);
82 lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr, FONT_UI); 82 lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr);
83 lcd_bitmap(bitmap_icons_7x8[Icon_Pause], 83 lcd_bitmap(bitmap_icons_7x8[Icon_Pause],
84 (LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8, true); 84 (LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8, true);
85 85
@@ -162,18 +162,18 @@ bool f2_screen(void)
162 char buf[32]; 162 char buf[32];
163 163
164 /* Get the font height */ 164 /* Get the font height */
165 lcd_getstringsize("A",FONT_UI,&w,&h); 165 lcd_getstringsize("A",&w,&h);
166 166
167 lcd_stop_scroll(); 167 lcd_stop_scroll();
168 168
169 while (!exit) { 169 while (!exit) {
170 lcd_clear_display(); 170 lcd_clear_display();
171 171
172 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE), FONT_UI); 172 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
173 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE), FONT_UI); 173 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
174 lcd_putsxy(0, LCD_HEIGHT/2, 174 lcd_putsxy(0, LCD_HEIGHT/2,
175 global_settings.playlist_shuffle ? 175 global_settings.playlist_shuffle ?
176 str(LANG_ON) : str(LANG_OFF), FONT_UI); 176 str(LANG_ON) : str(LANG_OFF));
177 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 177 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
178 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 178 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
179 179
@@ -181,8 +181,8 @@ bool f2_screen(void)
181 global_settings.mp3filter ? str(LANG_ON) : str(LANG_OFF)); 181 global_settings.mp3filter ? str(LANG_ON) : str(LANG_OFF));
182 182
183 /* Get the string width and height */ 183 /* Get the string width and height */
184 lcd_getstringsize(buf,FONT_UI,&w,&h); 184 lcd_getstringsize(buf,&w,&h);
185 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf, FONT_UI); 185 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, buf);
186 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 186 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
187 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 187 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
188 188
@@ -236,20 +236,20 @@ bool f3_screen(void)
236 char* ptr; 236 char* ptr;
237 237
238 ptr = str(LANG_F3_STATUS); 238 ptr = str(LANG_F3_STATUS);
239 lcd_getstringsize(ptr,FONT_UI,&w,&h); 239 lcd_getstringsize(ptr,&w,&h);
240 lcd_clear_display(); 240 lcd_clear_display();
241 241
242 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL), FONT_UI); 242 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
243 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI); 243 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
244 lcd_putsxy(0, LCD_HEIGHT/2, 244 lcd_putsxy(0, LCD_HEIGHT/2,
245 global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI); 245 global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
246 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 246 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
247 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 247 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
248 248
249 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, FONT_UI); 249 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
250 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR), FONT_UI); 250 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
251 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, 251 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
252 global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF), FONT_UI); 252 global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
253 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], 253 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
254 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); 254 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
255 lcd_update(); 255 lcd_update();
@@ -288,5 +288,3 @@ bool f3_screen(void)
288 return false; 288 return false;
289} 289}
290#endif 290#endif
291
292
diff --git a/apps/settings.c b/apps/settings.c
index 025a911557..673bca70d1 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -866,33 +866,33 @@ bool set_time(char* string, int timedate[])
866 lcd_puts(0, 1, buffer); 866 lcd_puts(0, 1, buffer);
867 867
868 /* recalculate the positions and offsets */ 868 /* recalculate the positions and offsets */
869 lcd_getstringsize(string, FONT_UI, &width, &prev_line_height); 869 lcd_getstringsize(string, &width, &prev_line_height);
870 lcd_getstringsize(buffer, FONT_UI, &width, &line_height); 870 lcd_getstringsize(buffer, &width, &line_height);
871 lcd_getstringsize(":", FONT_UI, &separator_width, &height); 871 lcd_getstringsize(":", &separator_width, &height);
872 872
873 strncpy(reffub, buffer, 2); 873 strncpy(reffub, buffer, 2);
874 reffub[2] = '\0'; 874 reffub[2] = '\0';
875 lcd_getstringsize(reffub, FONT_UI, &width, &height); 875 lcd_getstringsize(reffub, &width, &height);
876 cursor[0][INDEX_X] = 0; 876 cursor[0][INDEX_X] = 0;
877 cursor[0][INDEX_Y] = prev_line_height; 877 cursor[0][INDEX_Y] = prev_line_height;
878 cursor[0][INDEX_WIDTH] = width; 878 cursor[0][INDEX_WIDTH] = width;
879 879
880 strncpy(reffub, buffer + 3, 2); 880 strncpy(reffub, buffer + 3, 2);
881 reffub[2] = '\0'; 881 reffub[2] = '\0';
882 lcd_getstringsize(reffub, FONT_UI, &width, &height); 882 lcd_getstringsize(reffub, &width, &height);
883 cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; 883 cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width;
884 cursor[1][INDEX_Y] = prev_line_height; 884 cursor[1][INDEX_Y] = prev_line_height;
885 cursor[1][INDEX_WIDTH] = width; 885 cursor[1][INDEX_WIDTH] = width;
886 886
887 strncpy(reffub, buffer + 6, 2); 887 strncpy(reffub, buffer + 6, 2);
888 reffub[2] = '\0'; 888 reffub[2] = '\0';
889 lcd_getstringsize(reffub, FONT_UI, &width, &height); 889 lcd_getstringsize(reffub, &width, &height);
890 cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + 890 cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width +
891 cursor[1][INDEX_WIDTH] + separator_width; 891 cursor[1][INDEX_WIDTH] + separator_width;
892 cursor[2][INDEX_Y] = prev_line_height; 892 cursor[2][INDEX_Y] = prev_line_height;
893 cursor[2][INDEX_WIDTH] = width; 893 cursor[2][INDEX_WIDTH] = width;
894 894
895 lcd_getstringsize(buffer, FONT_UI, &width, &prev_line_height); 895 lcd_getstringsize(buffer, &width, &prev_line_height);
896 896
897 snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", 897 snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ",
898 dayname[timedate[6]], 898 dayname[timedate[6]],
@@ -902,22 +902,22 @@ bool set_time(char* string, int timedate[])
902 lcd_puts(0, 2, buffer); 902 lcd_puts(0, 2, buffer);
903 903
904 /* recalculate the positions and offsets */ 904 /* recalculate the positions and offsets */
905 lcd_getstringsize(buffer, FONT_UI, &width, &line_height); 905 lcd_getstringsize(buffer, &width, &line_height);
906 strncpy(reffub, buffer, 3); 906 strncpy(reffub, buffer, 3);
907 reffub[3] = '\0'; 907 reffub[3] = '\0';
908 lcd_getstringsize(reffub, FONT_UI, &weekday_width, &height); 908 lcd_getstringsize(reffub, &weekday_width, &height);
909 lcd_getstringsize(" ", FONT_UI, &separator_width, &height); 909 lcd_getstringsize(" ", &separator_width, &height);
910 910
911 strncpy(reffub, buffer + 4, 4); 911 strncpy(reffub, buffer + 4, 4);
912 reffub[4] = '\0'; 912 reffub[4] = '\0';
913 lcd_getstringsize(reffub, FONT_UI, &width, &height); 913 lcd_getstringsize(reffub, &width, &height);
914 cursor[3][INDEX_X] = weekday_width + separator_width; 914 cursor[3][INDEX_X] = weekday_width + separator_width;
915 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; 915 cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
916 cursor[3][INDEX_WIDTH] = width; 916 cursor[3][INDEX_WIDTH] = width;
917 917
918 strncpy(reffub, buffer + 9, 3); 918 strncpy(reffub, buffer + 9, 3);
919 reffub[3] = '\0'; 919 reffub[3] = '\0';
920 lcd_getstringsize(reffub, FONT_UI, &width, &height); 920 lcd_getstringsize(reffub, &width, &height);
921 cursor[4][INDEX_X] = weekday_width + separator_width + 921 cursor[4][INDEX_X] = weekday_width + separator_width +
922 cursor[3][INDEX_WIDTH] + separator_width; 922 cursor[3][INDEX_WIDTH] + separator_width;
923 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; 923 cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
@@ -925,7 +925,7 @@ bool set_time(char* string, int timedate[])
925 925
926 strncpy(reffub, buffer + 13, 2); 926 strncpy(reffub, buffer + 13, 2);
927 reffub[2] = '\0'; 927 reffub[2] = '\0';
928 lcd_getstringsize(reffub, FONT_UI, &width, &height); 928 lcd_getstringsize(reffub, &width, &height);
929 cursor[5][INDEX_X] = weekday_width + separator_width + 929 cursor[5][INDEX_X] = weekday_width + separator_width +
930 cursor[3][INDEX_WIDTH] + separator_width + 930 cursor[3][INDEX_WIDTH] + separator_width +
931 cursor[4][INDEX_WIDTH] + separator_width; 931 cursor[4][INDEX_WIDTH] + separator_width;
diff --git a/apps/tree.c b/apps/tree.c
index ce27f7b235..3aba7fa3b4 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -193,7 +193,8 @@ static int showdir(char *path, int start)
193#ifdef HAVE_LCD_BITMAP 193#ifdef HAVE_LCD_BITMAP
194 int line_height = LINE_HEIGTH; 194 int line_height = LINE_HEIGTH;
195 int fw, fh; 195 int fw, fh;
196 lcd_getfontsize(FONT_UI, &fw, &fh); 196 lcd_setfont(FONT_UI);
197 lcd_getstringsize("A", &fw, &fh);
197 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 198 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
198 line_height = fh; 199 line_height = fh;
199#else 200#else
@@ -591,7 +592,7 @@ bool dirbrowse(char *root)
591 bool lastshowhidden = global_settings.show_hidden_files; 592 bool lastshowhidden = global_settings.show_hidden_files;
592#ifdef HAVE_LCD_BITMAP 593#ifdef HAVE_LCD_BITMAP
593 int fw, fh; 594 int fw, fh;
594 lcd_getfontsize(FONT_UI, &fw, &fh); 595 lcd_getstringsize("A", &fw, &fh);
595 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 596 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
596#else 597#else
597 tree_max_on_screen = TREE_MAX_ON_SCREEN; 598 tree_max_on_screen = TREE_MAX_ON_SCREEN;
@@ -740,16 +741,14 @@ bool dirbrowse(char *root)
740 lcd_puts(0, 0, str(LANG_LANGUAGE_LOADED)); 741 lcd_puts(0, 0, str(LANG_LANGUAGE_LOADED));
741#else 742#else
742 lcd_getstringsize(str(LANG_LANGUAGE_LOADED), 743 lcd_getstringsize(str(LANG_LANGUAGE_LOADED),
743 FONT_UI, &fw, &fh); 744 &fw, &fh);
744 if(fw>LCD_WIDTH) 745 if(fw>LCD_WIDTH)
745 fw=0; 746 fw=0;
746 else 747 else
747 fw=LCD_WIDTH/2 - fw/2; 748 fw=LCD_WIDTH/2 - fw/2;
748 749
749 lcd_putsxy(fw, 750 lcd_putsxy(fw, LCD_HEIGHT/2 - fh/2,
750 LCD_HEIGHT/2 - fh/2, 751 str(LANG_LANGUAGE_LOADED));
751 str(LANG_LANGUAGE_LOADED),
752 FONT_UI);
753#endif 752#endif
754 lcd_update(); 753 lcd_update();
755 sleep(HZ); 754 sleep(HZ);
@@ -762,7 +761,7 @@ bool dirbrowse(char *root)
762 snprintf(buf, sizeof buf, "%s/%s", 761 snprintf(buf, sizeof buf, "%s/%s",
763 currdir, file->name); 762 currdir, file->name);
764 font_load(buf); 763 font_load(buf);
765 lcd_getfontsize(FONT_UI, &fw, &fh); 764 lcd_getstringsize("A", &fw, &fh);
766 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 765 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
767 /* make sure cursor is on screen */ 766 /* make sure cursor is on screen */
768 while ( dircursor > tree_max_on_screen ) { 767 while ( dircursor > tree_max_on_screen ) {
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 98a1d8b632..ec1e9c76e5 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -548,7 +548,7 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, bool refresh_all)
548#else 548#else
549 int w,h; 549 int w,h;
550 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 550 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
551 lcd_getstringsize("M",FONT_UI,&w,&h); 551 lcd_getstringsize("M",&w,&h);
552 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6, 552 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6,
553 (id3->elapsed + ff_rewind_count) * 100 / id3->length, 553 (id3->elapsed + ff_rewind_count) * 100 / id3->length,
554 Grow_Right); 554 Grow_Right);
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index 9f86d8f1c4..fee42d9ef4 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -228,17 +228,9 @@ void lcd_setfont(int newfont)
228 curfont = newfont; 228 curfont = newfont;
229} 229}
230 230
231void lcd_getfontsize(int font, int *width, int *height) 231int lcd_getstringsize(unsigned char *str, int *w, int *h)
232{ 232{
233 struct font* pf = font_get(font); 233 struct font* pf = font_get(curfont);
234
235 *width = pf->maxwidth;
236 *height = pf->height;
237}
238
239int lcd_getstringsize(unsigned char *str, int font, int *w, int *h)
240{
241 struct font* pf = font_get(font);
242 int ch; 234 int ch;
243 int width = 0; 235 int width = 0;
244 236
@@ -279,10 +271,10 @@ void lcd_puts(int x, int y, unsigned char *str)
279 if(!str || !str[0]) 271 if(!str || !str[0])
280 return; 272 return;
281 273
282 lcd_getstringsize(str, curfont, &w, &h); 274 lcd_getstringsize(str, &w, &h);
283 xpos = xmargin + x*w / strlen(str); 275 xpos = xmargin + x*w / strlen(str);
284 ypos = ymargin + y*h; 276 ypos = ymargin + y*h;
285 lcd_putsxy( xpos, ypos, str, curfont); 277 lcd_putsxy(xpos, ypos, str);
286 lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); 278 lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h);
287 279
288#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) 280#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
@@ -293,10 +285,10 @@ void lcd_puts(int x, int y, unsigned char *str)
293} 285}
294 286
295/* put a string at a given pixel position */ 287/* put a string at a given pixel position */
296void lcd_putsxy(int x, int y, unsigned char *str, int font) 288void lcd_putsxy(int x, int y, unsigned char *str)
297{ 289{
298 int ch; 290 int ch;
299 struct font* pf = font_get(font); 291 struct font* pf = font_get(curfont);
300 292
301 while (((ch = *str++) != '\0')) { 293 while (((ch = *str++) != '\0')) {
302 bitmap_t *bits; 294 bitmap_t *bits;
@@ -645,15 +637,14 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
645 struct scrollinfo* s = &scroll; 637 struct scrollinfo* s = &scroll;
646 unsigned char ch[2]; 638 unsigned char ch[2];
647 int w, h; 639 int w, h;
648 int width, height; 640 int width;
649 lcd_getfontsize(curfont, &width, &height);
650 641
651 ch[1] = 0; /* zero terminate */ 642 ch[1] = 0; /* zero terminate */
652 ch[0] = string[0]; 643 ch[0] = string[0];
653 width = 0; 644 width = 0;
654 s->space = 0; 645 s->space = 0;
655 while ( ch[0] && 646 while ( ch[0] &&
656 (width + lcd_getstringsize(ch, curfont, &w, &h) < 647 (width + lcd_getstringsize(ch, &w, &h) <
657 (LCD_WIDTH - x*8))) { 648 (LCD_WIDTH - x*8))) {
658 width += w; 649 width += w;
659 s->space++; 650 s->space++;
@@ -664,7 +655,7 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
664 s->textlen = strlen(string); 655 s->textlen = strlen(string);
665 656
666 s->space += 2; 657 s->space += 2;
667 lcd_getstringsize(string,curfont,&w,&h); 658 lcd_getstringsize(string,&w,&h);
668 if ( w > LCD_WIDTH - xmargin ) { 659 if ( w > LCD_WIDTH - xmargin ) {
669 s->offset=s->space; 660 s->offset=s->space;
670 s->startx=x; 661 s->startx=x;
@@ -688,7 +679,7 @@ void lcd_stop_scroll(void)
688 struct scrollinfo* s = &scroll; 679 struct scrollinfo* s = &scroll;
689 scroll_count = 0; 680 scroll_count = 0;
690 681
691 lcd_getstringsize( s->text, FONT_UI, &w, &h); 682 lcd_getstringsize( s->text, &w, &h);
692 lcd_clearrect(xmargin + s->startx*w/s->textlen, 683 lcd_clearrect(xmargin + s->startx*w/s->textlen,
693 ymargin + s->starty*h, 684 ymargin + s->starty*h,
694 LCD_WIDTH - xmargin, 685 LCD_WIDTH - xmargin,
@@ -745,7 +736,7 @@ static void scroll_thread(void)
745 s->offset = 0; 736 s->offset = 0;
746 } 737 }
747 738
748 lcd_getstringsize( s->text, FONT_UI, &w, &h); 739 lcd_getstringsize( s->text, &w, &h);
749 lcd_clearrect(xmargin + s->startx*w/s->textlen, 740 lcd_clearrect(xmargin + s->startx*w/s->textlen,
750 ymargin + s->starty*h, 741 ymargin + s->starty*h,
751 LCD_WIDTH - xmargin, 742 LCD_WIDTH - xmargin,
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
index 76e38375e4..32f636059c 100644
--- a/firmware/drivers/lcd.h
+++ b/firmware/drivers/lcd.h
@@ -117,11 +117,10 @@ extern void lcd_invertpixel(int x, int y);
117extern void lcd_roll(int pixels); 117extern void lcd_roll(int pixels);
118 118
119extern void lcd_setfont(int font); 119extern void lcd_setfont(int font);
120extern void lcd_getfontsize(int font, int *width, int *height); 120extern void lcd_putsxy(int x, int y, unsigned char *string);
121extern void lcd_putsxy(int x, int y, unsigned char *string, int font); 121extern int lcd_getstringsize(unsigned char *str, int *w, int *h);
122 122
123#endif /* CHARCELLS / BITMAP */ 123#endif /* CHARCELLS / BITMAP */
124 124
125extern int lcd_getstringsize(unsigned char *str, int font, int *w, int *h);
126 125
127#endif /* __LCD_H__ */ 126#endif /* __LCD_H__ */
diff --git a/firmware/panic.c b/firmware/panic.c
index 10ff454c40..fefde2eb34 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -50,8 +50,8 @@ void panicf( char *fmt, ...)
50#elif defined(HAVE_LCD_BITMAP) 50#elif defined(HAVE_LCD_BITMAP)
51 lcd_clear_display(); 51 lcd_clear_display();
52 52
53 //FIXME putsxy may call panic... 53 lcd_setfont(FONT_SYSFIXED);
54 lcd_putsxy(0,0,panic_buf,FONT_SYSFIXED); 54 lcd_putsxy(0,0,panic_buf);
55 lcd_update(); 55 lcd_update();
56 56
57#else 57#else
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 3360afefa7..3534497e45 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -98,11 +98,11 @@ void ata_spindown(int s)
98 (void)s; 98 (void)s;
99} 99}
100 100
101Menu simulate_usb(void) 101bool simulate_usb(void)
102{ 102{
103 usb_display_info(); 103 usb_display_info();
104 while (button_get(true) & BUTTON_REL); 104 while (button_get(true) & BUTTON_REL);
105 return MENU_OK; 105 return false;
106} 106}
107 107
108void lcd_define_pattern (int which,char *pattern,int length) 108void lcd_define_pattern (int which,char *pattern,int length)
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
index 2dc45ebdc5..803cc64fef 100644
--- a/uisimulator/win32/Makefile
+++ b/uisimulator/win32/Makefile
@@ -72,7 +72,7 @@ APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \
72MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c 72MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c
73 73
74ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) 74ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
75 APPS += snake.c tetris.c sokoban.c bounce.c snow.c bmp.c \ 75 APPS += tetris.c sokoban.c bounce.c snow.c bmp.c \
76 widgets.c wormlet.c 76 widgets.c wormlet.c
77endif 77endif
78 78
@@ -127,9 +127,6 @@ $(OBJDIR)/icons.o: $(MACHINEDIR)/icons.c
127$(OBJDIR)/widgets.o: $(RECDIR)/widgets.c 127$(OBJDIR)/widgets.o: $(RECDIR)/widgets.c
128 $(CC) $(APPCFLAGS) -c $< -o $@ 128 $(CC) $(APPCFLAGS) -c $< -o $@
129 129
130$(OBJDIR)/snake.o: $(RECDIR)/snake.c
131 $(CC) $(APPCFLAGS) -c $< -o $@
132
133$(OBJDIR)/tetris.o: $(RECDIR)/tetris.c 130$(OBJDIR)/tetris.o: $(RECDIR)/tetris.c
134 $(CC) $(APPCFLAGS) -c $< -o $@ 131 $(CC) $(APPCFLAGS) -c $< -o $@
135 132
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index fa65130555..abf63cba24 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -87,7 +87,7 @@ APPS = main.c tree.c menu.c credits.c main_menu.c language.c\
87MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c 87MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c
88 88
89ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) 89ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
90 APPS += tetris.c sokoban.c bounce.c snake.c snow.c bmp.c widgets.c wormlet.c 90 APPS += tetris.c sokoban.c bounce.c snow.c bmp.c widgets.c wormlet.c
91endif 91endif
92 92
93SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \ 93SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \
@@ -191,9 +191,6 @@ $(OBJDIR)/sokoban.o: $(RECDIR)/sokoban.c
191$(OBJDIR)/bounce.o: $(RECDIR)/bounce.c 191$(OBJDIR)/bounce.o: $(RECDIR)/bounce.c
192 $(CC) $(APPCFLAGS) -c $< -o $@ 192 $(CC) $(APPCFLAGS) -c $< -o $@
193 193
194$(OBJDIR)/snake.o: $(RECDIR)/snake.c
195 $(CC) $(APPCFLAGS) -c $< -o $@
196
197$(OBJDIR)/snow.o: $(RECDIR)/snow.c 194$(OBJDIR)/snow.o: $(RECDIR)/snow.c
198 $(CC) $(APPCFLAGS) -c $< -o $@ 195 $(CC) $(APPCFLAGS) -c $< -o $@
199 196