summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uisimulator/app.c10
-rw-r--r--uisimulator/menu.c12
-rw-r--r--uisimulator/play.c94
-rw-r--r--uisimulator/screensaver.c10
-rw-r--r--uisimulator/tetris.c12
-rw-r--r--uisimulator/tree.c401
-rw-r--r--uisimulator/x11/Makefile4
-rw-r--r--uisimulator/x11/lcd-x11.c3
8 files changed, 294 insertions, 252 deletions
diff --git a/uisimulator/app.c b/uisimulator/app.c
index aa77fccd94..7c28e7a3da 100644
--- a/uisimulator/app.c
+++ b/uisimulator/app.c
@@ -97,15 +97,7 @@ void app_main(void)
97 lcd_puts(0,0, "Mooo!"); 97 lcd_puts(0,0, "Mooo!");
98 lcd_puts(1,1, " Rockbox!"); 98 lcd_puts(1,1, " Rockbox!");
99 99
100 while(1) { 100 browse_root();
101 key = button_get();
102
103 if(!key) {
104 sleep(1);
105 continue;
106 }
107
108 }
109 101
110} 102}
111 103
diff --git a/uisimulator/menu.c b/uisimulator/menu.c
index 0dc1599fe9..1619b33676 100644
--- a/uisimulator/menu.c
+++ b/uisimulator/menu.c
@@ -86,7 +86,7 @@ void move_cursor_down(void)
86 86
87void redraw_cursor(void) 87void redraw_cursor(void)
88{ 88{
89 lcd_puts(0, cursor*menu_line_height, "-", 0); 89 lcd_putsxy(0, cursor*menu_line_height, "-", 0);
90} 90}
91 91
92/* 92/*
@@ -96,9 +96,9 @@ void redraw_cursor(void)
96 */ 96 */
97void put_cursor(int target) 97void put_cursor(int target)
98{ 98{
99 lcd_puts(0, cursor*menu_line_height, " ", 0); 99 lcd_putsxy(0, cursor*menu_line_height, " ",0);
100 cursor = target; 100 cursor = target;
101 lcd_puts(0, cursor*menu_line_height, "-", 0); 101 lcd_putsxy(0, cursor*menu_line_height, "-",0);
102} 102}
103 103
104/* We call the function pointer related to the current cursor position */ 104/* We call the function pointer related to the current cursor position */
@@ -110,8 +110,8 @@ void execute_menu_item(void)
110 110
111void add_menu_item(int location, char *string) 111void add_menu_item(int location, char *string)
112{ 112{
113 lcd_puts(MENU_ITEM_Y_LOC, MENU_LINE_HEIGHT*location, 113 lcd_putsxy(MENU_ITEM_Y_LOC, MENU_LINE_HEIGHT*location, string,
114 string, MENU_ITEM_FONT); 114 MENU_ITEM_FONT);
115 if (location < menu_top) 115 if (location < menu_top)
116 menu_top = location; 116 menu_top = location;
117 if (location > menu_bottom) 117 if (location > menu_bottom)
@@ -130,7 +130,7 @@ void menu_init(void)
130 for (i = i; i < Last_Id; i++) 130 for (i = i; i < Last_Id; i++)
131 add_menu_item(items[i].menu_id, (char *) items[i].menu_desc); 131 add_menu_item(items[i].menu_id, (char *) items[i].menu_desc);
132 132
133 lcd_puts(8, 38, "Rockbox!", 2); 133 lcd_putsxy(8, 38, "Rockbox!",2);
134 redraw_cursor(); 134 redraw_cursor();
135} 135}
136 136
diff --git a/uisimulator/play.c b/uisimulator/play.c
index f9877134eb..735597962e 100644
--- a/uisimulator/play.c
+++ b/uisimulator/play.c
@@ -26,6 +26,7 @@
26#include <button.h> 26#include <button.h>
27#include "kernel.h" 27#include "kernel.h"
28#include "tree.h" 28#include "tree.h"
29#include "debug.h"
29 30
30#include "id3.h" 31#include "id3.h"
31 32
@@ -33,63 +34,70 @@
33#include "x11/mpegplay.h" 34#include "x11/mpegplay.h"
34#endif 35#endif
35 36
36#define LINE_Y 8 /* initial line */ 37#define LINE_Y 1 /* initial line */
37#define LINE_HEIGTH 8 /* line height in pixels */
38 38
39void playtune(char *dir, char *file) 39void playtune(char *dir, char *file)
40{ 40{
41 char buffer[256]; 41 char buffer[256];
42 int fd; 42 int fd;
43 mp3entry mp3; 43 mp3entry mp3;
44 bool good=1; 44 bool good=1;
45 45
46 sprintf(buffer, "%s/%s", dir, file); 46 sprintf(buffer, "%s/%s", dir, file);
47 47
48 if(mp3info(&mp3, buffer)) { 48 if(mp3info(&mp3, buffer)) {
49 debugf("id3 failure!"); 49 DEBUGF("id3 failure!");
50 good=0; 50 good=0;
51 } 51 }
52 lcd_clear_display();
52#ifdef HAVE_LCD_BITMAP 53#ifdef HAVE_LCD_BITMAP
53 lcd_clear_display(); 54 lcd_setmargins(0,0);
54 if(!good) { 55 lcd_setfont(0);
55 lcd_puts(0, 0, "[no id3 info]", 0); 56#endif
56 } 57
57 else { 58 if(!good) {
58 lcd_puts(0, 0, "[id3 info]", 0); 59 lcd_puts(0, 0, "[no id3 info]");
59 lcd_puts(0, LINE_Y, mp3.title?mp3.title:"", 0); 60 }
60 lcd_puts(0, LINE_Y+1*LINE_HEIGTH, mp3.album?mp3.album:"", 0); 61 else {
61 lcd_puts(0, LINE_Y+2*LINE_HEIGTH, mp3.artist?mp3.artist:"", 0); 62#ifdef HAVE_LCD_BITMAP
63 lcd_puts(0, 0, "[id3 info]");
64 lcd_puts(0, LINE_Y, mp3.title?mp3.title:"");
65 lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:"");
66 lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:"");
62 67
63 sprintf(buffer, "%d ms", mp3.length); 68 sprintf(buffer, "%d ms", mp3.length);
64 lcd_puts(0, LINE_Y+3*LINE_HEIGTH, buffer, 0); 69 lcd_puts(0, LINE_Y+3, buffer);
65 70
66 sprintf(buffer, "%d kbits", mp3.bitrate); 71 sprintf(buffer, "%d kbits", mp3.bitrate);
67 lcd_puts(0, LINE_Y+4*LINE_HEIGTH, buffer, 0); 72 lcd_puts(0, LINE_Y+4, buffer);
68 73
69 sprintf(buffer, "%d Hz", mp3.frequency); 74 sprintf(buffer, "%d Hz", mp3.frequency);
70 lcd_puts(0, LINE_Y+5*LINE_HEIGTH, buffer, 0); 75 lcd_puts(0, LINE_Y+5, buffer);
71 } 76#else
72 lcd_update(); 77 lcd_puts(0, 0, mp3.artist?mp3.artist:"<no artist>");
78 lcd_puts(0, 1, mp3.title?mp3.title:"<no title>");
73#endif 79#endif
80 }
81 lcd_update();
74 82
75#ifdef MPEG_PLAY 83#ifdef MPEG_PLAY
76 sprintf(buffer, "%s/%s", dir, file); 84 sprintf(buffer, "%s/%s", dir, file);
77 mpeg_play(buffer); 85 mpeg_play(buffer);
78 return; 86 return;
79#endif 87#endif
80 88
81 while(1) { 89 while(1) {
82 int key = button_get(); 90 int key = button_get();
83 91
84 if(!key) { 92 if(!key) {
85 sleep(30); 93 sleep(30);
86 continue; 94 continue;
87 } 95 }
88 switch(key) { 96 switch(key) {
89 case BUTTON_OFF: 97 case BUTTON_OFF:
90 case BUTTON_LEFT: 98 case BUTTON_LEFT:
91 return; 99 return;
92 break; 100 break;
101 }
93 } 102 }
94 }
95} 103}
diff --git a/uisimulator/screensaver.c b/uisimulator/screensaver.c
index a4166f20b4..a85ccf965d 100644
--- a/uisimulator/screensaver.c
+++ b/uisimulator/screensaver.c
@@ -84,11 +84,11 @@ void ss_loop(void)
84 84
85void screensaver(void) 85void screensaver(void)
86{ 86{
87 char w, h; 87 int w, h;
88 char *off = "[Off] to stop"; 88 char *off = "[Off] to stop";
89 int len = strlen(SS_TITLE); 89 int len = strlen(SS_TITLE);
90 90
91 lcd_fontsize(SS_TITLE_FONT, &w, &h); 91 lcd_getfontsize(SS_TITLE_FONT, &w, &h);
92 92
93 /* Get horizontel centering for text */ 93 /* Get horizontel centering for text */
94 len *= w; 94 len *= w;
@@ -103,10 +103,10 @@ void screensaver(void)
103 h /= 2; 103 h /= 2;
104 104
105 lcd_clear_display(); 105 lcd_clear_display();
106 lcd_puts(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); 106 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT);
107 107
108 len = strlen(off); 108 len = strlen(off);
109 lcd_fontsize(0, &w, &h); 109 lcd_getfontsize(0, &w, &h);
110 110
111 /* Get horizontel centering for text */ 111 /* Get horizontel centering for text */
112 len *= w; 112 len *= w;
@@ -120,7 +120,7 @@ void screensaver(void)
120 else 120 else
121 h /= 2; 121 h /= 2;
122 122
123 lcd_puts(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off, 0); 123 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0);
124 124
125 lcd_update(); 125 lcd_update();
126 sleep(150); 126 sleep(150);
diff --git a/uisimulator/tetris.c b/uisimulator/tetris.c
index 2f02e042d4..8884fd8964 100644
--- a/uisimulator/tetris.c
+++ b/uisimulator/tetris.c
@@ -310,14 +310,14 @@ void game_loop(void)
310 sleep(10); 310 sleep(10);
311 } 311 }
312 if(gameover()) { 312 if(gameover()) {
313 char w, h; 313 int w, h;
314 314
315 lcd_fontsize(TETRIS_TITLE_FONT, &w, &h); 315 lcd_getfontsize(TETRIS_TITLE_FONT, &w, &h);
316 lcd_clearrect(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, 316 lcd_clearrect(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC,
317 TETRIS_TITLE_XLOC+(w*sizeof(TETRIS_TITLE)), 317 TETRIS_TITLE_XLOC+(w*sizeof(TETRIS_TITLE)),
318 TETRIS_TITLE_YLOC-h); 318 TETRIS_TITLE_YLOC-h);
319 lcd_puts(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, 319 lcd_putsxy(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, "You lose!",
320 "You lose!", TETRIS_TITLE_FONT); 320 TETRIS_TITLE_FONT);
321 lcd_update(); 321 lcd_update();
322 sleep(2); 322 sleep(2);
323 return; 323 return;
@@ -349,8 +349,8 @@ void tetris(void)
349 init_tetris(); 349 init_tetris();
350 350
351 draw_frame(start_x-1,start_x+max_x,start_y-1,start_y+max_y); 351 draw_frame(start_x-1,start_x+max_x,start_y-1,start_y+max_y);
352 lcd_puts(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, 352 lcd_putsxy(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, TETRIS_TITLE,
353 TETRIS_TITLE, TETRIS_TITLE_FONT); 353 TETRIS_TITLE_FONT);
354 lcd_update(); 354 lcd_update();
355 355
356 next_b = t_rand(blocks); 356 next_b = t_rand(blocks);
diff --git a/uisimulator/tree.c b/uisimulator/tree.c
index ed7ebad000..0382547590 100644
--- a/uisimulator/tree.c
+++ b/uisimulator/tree.c
@@ -32,13 +32,8 @@
32 32
33#include "play.h" 33#include "play.h"
34 34
35#define TREE_MAX_FILENAMELEN 64 35
36#define TREE_MAX_ON_SCREEN 7 36#define TREE_MAX_FILENAMELEN 128
37#define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */
38
39void browse_root(void) {
40 dirbrowse("/");
41}
42 37
43struct entry { 38struct entry {
44 int file; /* TRUE if file, FALSE if dir */ 39 int file; /* TRUE if file, FALSE if dir */
@@ -46,204 +41,250 @@ struct entry {
46 int namelen; 41 int namelen;
47}; 42};
48 43
49#define LINE_Y 8 /* Y position the entry-list starts at */ 44void browse_root(void)
50#define LINE_X 12 /* X position the entry-list starts at */ 45{
51#define LINE_HEIGTH 8 /* pixels for each text line */ 46 dirbrowse("/");
47}
48
52 49
53#ifdef HAVE_LCD_BITMAP 50#ifdef HAVE_LCD_BITMAP
54 51
52#define TREE_MAX_ON_SCREEN 7
53#define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */
54
55#define MARGIN_Y 8 /* Y pixel margin */
56#define MARGIN_X 12 /* X pixel margin */
57#define LINE_Y 0 /* Y position the entry-list starts at */
58#define LINE_X 2 /* X position the entry-list starts at */
59#define LINE_HEIGTH 8 /* pixels for each text line */
60
55extern unsigned char bitmap_icons_6x8[LastIcon][6]; 61extern unsigned char bitmap_icons_6x8[LastIcon][6];
56extern icons_6x8; 62extern icons_6x8;
57 63
64#else /* HAVE_LCD_BITMAP */
65
66#define TREE_MAX_ON_SCREEN 2
67#define TREE_MAX_LEN_DISPLAY 11 /* max length that fits on screen */
68#define LINE_Y 0 /* Y position the entry-list starts at */
69#define LINE_X 1 /* X position the entry-list starts at */
70
71#endif /* HAVE_LCD_BITMAP */
72
58int static showdir(char *path, struct entry *buffer, int start, 73int static showdir(char *path, struct entry *buffer, int start,
59 int scrollpos, int* at_end) 74 int scrollpos, int* at_end)
60{ 75{
61 int i; 76 int i;
62 int j=0; 77 int j=0;
63 int icon_type = 0; 78 int icon_type = 0;
64 DIR *dir = opendir(path); 79 DIR *dir = opendir(path);
65 struct dirent *entry; 80 struct dirent *entry;
66
67 if(!dir)
68 return -1; /* not a directory */
69
70 i=start;
71 *at_end=0; /* Have we displayed the last directory entry? */
72 while((entry = readdir(dir))) {
73 int len;
74
75 if(entry->d_name[0] == '.')
76 /* skip names starting with a dot */
77 continue;
78
79 if(j++ < scrollpos)
80 continue ;
81
82 len = strlen(entry->d_name);
83 if(len < TREE_MAX_FILENAMELEN)
84 /* strncpy() is evil, we memcpy() instead, +1 includes the
85 trailing zero */
86 memcpy(buffer[i].name, entry->d_name, len+1);
87 else
88 memcpy(buffer[i].name, "too long", 9);
89
90 buffer[i].file = !(entry->attribute&ATTR_DIRECTORY);
91
92 buffer[i].file?(icon_type=File):(icon_type=Folder);
93 lcd_bitmap(bitmap_icons_6x8[icon_type], 6, LINE_Y+i*LINE_HEIGTH, 6,
94 8, TRUE);
95
96 if(len < TREE_MAX_LEN_DISPLAY)
97 lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0);
98 else {
99 char storage = buffer[i].name[TREE_MAX_LEN_DISPLAY];
100 buffer[i].name[TREE_MAX_LEN_DISPLAY]=0;
101 lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0);
102 buffer[i].name[TREE_MAX_LEN_DISPLAY]=storage;
103 }
104 81
105 if(++i >= TREE_MAX_ON_SCREEN) 82 if(!dir)
106 break; 83 return -1; /* not a directory */
107 } 84
108 85 i=start;
109 if (entry==0) { 86 *at_end=0; /* Have we displayed the last directory entry? */
110 *at_end=1; 87 while((entry = readdir(dir))) {
111 } else { 88 int len;
112 *at_end=(readdir(dir)==0);
113 }
114 j = i ;
115 while (j++ < TREE_MAX_ON_SCREEN) {
116 lcd_puts(LINE_X, LINE_Y+j*LINE_HEIGTH," ", 0);
117 }
118 closedir(dir);
119
120 return i;
121}
122 89
90 if(entry->d_name[0] == '.')
91 /* skip names starting with a dot */
92 continue;
93
94 if(j++ < scrollpos)
95 continue ;
96
97 len = strlen(entry->d_name);
98 if(len < TREE_MAX_FILENAMELEN)
99 /* strncpy() is evil, we memcpy() instead, +1 includes the
100 trailing zero */
101 memcpy(buffer[i].name, entry->d_name, len+1);
102 else
103 memcpy(buffer[i].name, "too long", 9);
104
105 buffer[i].file = !(entry->attribute&ATTR_DIRECTORY);
106
107#ifdef HAVE_LCD_BITMAP
108 if ( buffer[i].file )
109 icon_type=File;
110 else
111 icon_type=Folder;
112 lcd_bitmap(bitmap_icons_6x8[icon_type], 6, MARGIN_Y+i*LINE_HEIGTH, 6,
113 8, TRUE);
123#endif 114#endif
124 115
116 if(len < TREE_MAX_LEN_DISPLAY)
117 lcd_puts(LINE_X, LINE_Y+i, buffer[i].name);
118 else {
119 char storage = buffer[i].name[TREE_MAX_LEN_DISPLAY];
120 buffer[i].name[TREE_MAX_LEN_DISPLAY]=0;
121 lcd_puts(LINE_X, LINE_Y+i, buffer[i].name);
122 buffer[i].name[TREE_MAX_LEN_DISPLAY]=storage;
123 }
124
125 if(++i >= TREE_MAX_ON_SCREEN)
126 break;
127 }
128
129 if (entry==0) {
130 *at_end=1;
131 } else {
132 *at_end=(readdir(dir)==0);
133 }
134 j = i ;
135 while (j++ < TREE_MAX_ON_SCREEN) {
136 lcd_puts(LINE_X, LINE_Y+j," ");
137 }
138 closedir(dir);
139
140 return i;
141}
142
125bool dirbrowse(char *root) 143bool dirbrowse(char *root)
126{ 144{
127 struct entry buffer[TREE_MAX_ON_SCREEN]; 145 struct entry buffer[TREE_MAX_ON_SCREEN];
128 int numentries; 146 int numentries;
129 char buf[255]; 147 char buf[255];
130 char currdir[255]; 148 char currdir[255];
131 int dircursor=0; 149 int dircursor=0;
132 int i; 150 int i;
133 int start=0; 151 int start=0;
134 int at_end=0; 152 int at_end=0;
135 153
136#ifdef HAVE_LCD_BITMAP 154 lcd_clear_display();
137 lcd_clear_display();
138 155
139 lcd_puts(0,0, "[Browse]", 0); 156#ifdef HAVE_LCD_BITMAP
140 memcpy(currdir,root,sizeof(currdir)); 157 lcd_putsxy(0,0, "[Browse]",0);
158 lcd_setmargins(0,MARGIN_Y);
159 lcd_setfont(0);
160#endif
161 memcpy(currdir,root,sizeof(currdir));
141 162
142 numentries = showdir(root, buffer, 0, start, &at_end); 163 numentries = showdir(root, buffer, 0, start, &at_end);
143 164
144 if (numentries == -1) return -1; /* root is not a directory */ 165 if (numentries == -1)
166 return -1; /* root is not a directory */
145 167
146 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0); 168 lcd_puts(0, dircursor, "-");
169 lcd_update();
147 170
148 lcd_update(); 171 while(1) {
172 int key = button_get();
149 173
150 while(1) { 174 if(!key) {
151 int key = button_get(); 175 sleep(1);
176 continue;
177 }
178 switch(key) {
179 case BUTTON_OFF:
180 return FALSE;
181 break;
182
183 case BUTTON_LEFT:
184 i=strlen(currdir);
185 if (i==1) {
186 return FALSE;
187 }
188 else {
189 while (currdir[i-1]!='/')
190 i--;
191 strcpy(buf,&currdir[i]);
192 if (i==1)
193 currdir[i]=0;
194 else
195 currdir[i-1]=0;
196
197 lcd_clear_display();
198#ifdef HAVE_LCD_BITMAP
199 lcd_putsxy(0,0, "[Browse]",0);
200#endif
201 numentries = showdir(currdir, buffer, 0, 0, &at_end);
202 dircursor=0;
203 start=0;
204 while ( (dircursor < TREE_MAX_ON_SCREEN) &&
205 (strcmp(buffer[dircursor].name,buf)!=0))
206 dircursor++;
207 if (dircursor==TREE_MAX_ON_SCREEN)
208 dircursor=0;
209 lcd_puts(0, LINE_Y+dircursor, "-");
210 lcd_update();
211 }
212
213 break;
214
215 case BUTTON_RIGHT:
216 case BUTTON_PLAY:
217 if ((currdir[0]=='/') && (currdir[1]==0)) {
218 sprintf(buf,"%s%s",currdir,buffer[dircursor].name);
219 } else {
220 sprintf(buf,"%s/%s",currdir,buffer[dircursor].name);
221 }
222
223 if (!buffer[dircursor].file) {
224 memcpy(currdir,buf,sizeof(currdir));
225 dircursor=0;
226 start=0;
227 } else {
228 playtune(currdir, buffer[dircursor].name);
229#ifdef HAVE_LCD_BITMAP
230 lcd_setmargins(0, MARGIN_Y);
231 lcd_setfont(0);
232#endif
233 }
152 234
153 if(!key) { 235 lcd_clear_display();
154 sleep(1); 236 numentries = showdir(currdir, buffer, 0, start, &at_end);
155 continue; 237#ifdef HAVE_LCD_BITMAP
156 } 238 lcd_putsxy(0,0, "[Browse]",0);
157 switch(key) { 239#endif
158 case BUTTON_OFF: 240 lcd_puts(0, LINE_Y+dircursor, "-");
159 return FALSE; 241 lcd_update();
160 break; 242 break;
161
162 case BUTTON_LEFT:
163 i=strlen(currdir);
164 if (i==1) {
165 return FALSE;
166 } else {
167 while (currdir[i-1]!='/') i--;
168 strcpy(buf,&currdir[i]);
169 if (i==1) currdir[i]=0;
170 else currdir[i-1]=0;
171
172 lcd_clear_display();
173 lcd_puts(0,0, "[Browse]", 0);
174 numentries = showdir(currdir, buffer, 0, 0, &at_end);
175 dircursor=0;
176 start=0;
177 while ( (dircursor < TREE_MAX_ON_SCREEN) &&
178 (strcmp(buffer[dircursor].name,buf)!=0)) dircursor++;
179 if (dircursor==TREE_MAX_ON_SCREEN) dircursor=0;
180 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0);
181 lcd_update();
182 }
183
184 break;
185
186 case BUTTON_RIGHT:
187 case BUTTON_PLAY:
188 if ((currdir[0]=='/') && (currdir[1]==0)) {
189 sprintf(buf,"%s%s",currdir,buffer[dircursor].name);
190 } else {
191 sprintf(buf,"%s/%s",currdir,buffer[dircursor].name);
192 }
193
194 if (!buffer[dircursor].file) {
195 memcpy(currdir,buf,sizeof(currdir));
196 dircursor=0;
197 start=0;
198 } else {
199 playtune(currdir, buffer[dircursor].name);
200 }
201
202 lcd_clear_display();
203 lcd_puts(0,0, "[Browse]", 0);
204 numentries = showdir(currdir, buffer, 0, start, &at_end);
205 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0);
206 lcd_update();
207 break;
208 243
209 case BUTTON_UP: 244 case BUTTON_UP:
210 if(dircursor) { 245 if(dircursor) {
211 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, " ", 0); 246 lcd_puts(0, LINE_Y+dircursor, " ");
212 dircursor--; 247 dircursor--;
213 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0); 248 lcd_puts(0, LINE_Y+dircursor, "-");
214 lcd_update(); 249 lcd_update();
215 } else 250 } else
216 { 251 {
217 if (start) { 252 if (start) {
218 lcd_clear_display(); 253 lcd_clear_display();
219 lcd_puts(0,0, "[Browse]", 0); 254 start--;
220 numentries = showdir(currdir, buffer, 0, --start, &at_end); 255 numentries = showdir(currdir, buffer, 0,
221 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0); 256 start, &at_end);
222 lcd_update(); 257#ifdef HAVE_LCD_BITMAP
223 } 258 lcd_putsxy(0,0, "[Browse]",0);
224 } 259#endif
225 break; 260 lcd_puts(0, LINE_Y+dircursor, "-");
226 case BUTTON_DOWN: 261 lcd_update();
227 if(dircursor+1 < numentries) { 262 }
228 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, " ", 0); 263 }
229 dircursor++; 264 break;
230 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0); 265 case BUTTON_DOWN:
231 lcd_update(); 266 if(dircursor+1 < numentries) {
232 } else 267 lcd_puts(0, LINE_Y+dircursor, " ");
233 { 268 dircursor++;
234 if (!at_end) { 269 lcd_puts(0, LINE_Y+dircursor, "-");
235 lcd_clear_display(); 270 lcd_update();
236 lcd_puts(0,0, "[Browse]", 0); 271 } else
237 numentries = showdir(currdir, buffer, 0, ++start, &at_end); 272 {
238 273 if (!at_end) {
239 lcd_puts(0, LINE_Y+dircursor*LINE_HEIGTH, "-", 0); 274 lcd_clear_display();
240 lcd_update(); 275 start++;
276 numentries = showdir(currdir, buffer, 0,
277 start, &at_end);
278#ifdef HAVE_LCD_BITMAP
279 lcd_putsxy(0,0, "[Browse]",0);
280#endif
281 lcd_puts(0, LINE_Y+dircursor, "-");
282 lcd_update();
283 }
284 }
285 break;
241 } 286 }
242 }
243 break;
244 } 287 }
245 }
246#endif
247 288
248 return FALSE; 289 return FALSE;
249} 290}
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index 7cc8b088c3..1858ea5090 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -28,8 +28,8 @@ CC = gcc
28RM = rm -f 28RM = rm -f
29DEBUG = -g 29DEBUG = -g
30 30
31#DISPLAY = -DHAVE_LCD_CHARCELLS 31DISPLAY = -DHAVE_LCD_CHARCELLS
32DISPLAY = -DHAVE_LCD_BITMAP 32#DISPLAY = -DHAVE_LCD_BITMAP
33 33
34DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ 34DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
35-DHAVE_RECORDER_KEYPAD $(DISPLAY) 35-DHAVE_RECORDER_KEYPAD $(DISPLAY)
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index 4d2eb4be54..d454532aa2 100644
--- a/uisimulator/x11/lcd-x11.c
+++ b/uisimulator/x11/lcd-x11.c
@@ -120,6 +120,7 @@ void lcd_puts(int x, int y, char *string)
120 strncpy(buffer, string, 11); 120 strncpy(buffer, string, 11);
121 buffer[11]=0; 121 buffer[11]=0;
122 122
123 sim_lcd_puts(x*6, y*8, buffer, 0); 123 debugf("lcd_puts(%d,%d,%s)\n",x,y,string);
124 sim_lcd_puts(x, y, buffer, 0);
124} 125}
125#endif 126#endif