diff options
author | Markus Braun <markus.braun@krawel.de> | 2002-08-07 10:35:26 +0000 |
---|---|---|
committer | Markus Braun <markus.braun@krawel.de> | 2002-08-07 10:35:26 +0000 |
commit | de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9 (patch) | |
tree | 5cc60884b43b291f3878527413c4d7f21f210624 /apps | |
parent | 999e2127af292ffac2d36dcb54b78a2f1abce6bf (diff) | |
download | rockbox-de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9.tar.gz rockbox-de8fbf00a8a4a2c85fc9ee4b2758881f4ec435d9.zip |
Added status bar to file browser and wps
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1582 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 22 | ||||
-rw-r--r-- | apps/recorder/icons.c | 169 | ||||
-rw-r--r-- | apps/recorder/icons.h | 55 | ||||
-rw-r--r-- | apps/recorder/widgets.c | 161 | ||||
-rw-r--r-- | apps/recorder/widgets.h | 36 | ||||
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_menu.c | 10 | ||||
-rw-r--r-- | apps/status.c | 50 | ||||
-rw-r--r-- | apps/status.h | 11 | ||||
-rw-r--r-- | apps/tree.c | 97 | ||||
-rw-r--r-- | apps/wps.c | 91 | ||||
-rw-r--r-- | apps/wps.h | 2 |
13 files changed, 648 insertions, 67 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 44d1e34349..48c66dbc80 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -30,6 +30,13 @@ | |||
30 | #include "lcd.h" | 30 | #include "lcd.h" |
31 | #include "kernel.h" | 31 | #include "kernel.h" |
32 | #include "settings.h" | 32 | #include "settings.h" |
33 | #include "status.h" | ||
34 | |||
35 | #ifdef HAVE_LCD_BITMAP | ||
36 | #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ | ||
37 | #else /* HAVE_LCD_BITMAP */ | ||
38 | #define LINE_Y 0 /* Y position the entry-list starts at */ | ||
39 | #endif /* HAVE_LCD_BITMAP */ | ||
33 | 40 | ||
34 | playlist_info_t playlist; | 41 | playlist_info_t playlist; |
35 | 42 | ||
@@ -165,7 +172,8 @@ void play_list(char *dir, char *file, int start_index) | |||
165 | /* If file is NULL, the list is in RAM */ | 172 | /* If file is NULL, the list is in RAM */ |
166 | if(file) { | 173 | if(file) { |
167 | lcd_clear_display(); | 174 | lcd_clear_display(); |
168 | lcd_puts(0,0,"Loading..."); | 175 | lcd_puts(0,LINE_Y,"Loading..."); |
176 | status_draw(); | ||
169 | lcd_update(); | 177 | lcd_update(); |
170 | playlist.in_ram = false; | 178 | playlist.in_ram = false; |
171 | } else { | 179 | } else { |
@@ -194,14 +202,16 @@ void play_list(char *dir, char *file, int start_index) | |||
194 | 202 | ||
195 | if(global_settings.playlist_shuffle) { | 203 | if(global_settings.playlist_shuffle) { |
196 | if(!playlist.in_ram) { | 204 | if(!playlist.in_ram) { |
197 | lcd_puts(0,0,"Shuffling..."); | 205 | lcd_puts(0,LINE_Y,"Shuffling..."); |
206 | status_draw(); | ||
198 | lcd_update(); | 207 | lcd_update(); |
199 | } | 208 | } |
200 | randomise_playlist( current_tick ); | 209 | randomise_playlist( current_tick ); |
201 | } | 210 | } |
202 | 211 | ||
203 | if(!playlist.in_ram) { | 212 | if(!playlist.in_ram) { |
204 | lcd_puts(0,0,"Playing... "); | 213 | lcd_puts(0,LINE_Y,"Playing... "); |
214 | status_draw(); | ||
205 | lcd_update(); | 215 | lcd_update(); |
206 | } | 216 | } |
207 | /* also make the first song get playing */ | 217 | /* also make the first song get playing */ |
@@ -287,7 +297,8 @@ void add_indices_to_playlist(void) | |||
287 | next_tick = current_tick + HZ; | 297 | next_tick = current_tick + HZ; |
288 | snprintf(line, sizeof line, "%d files", | 298 | snprintf(line, sizeof line, "%d files", |
289 | playlist.amount); | 299 | playlist.amount); |
290 | lcd_puts(0,1,line); | 300 | lcd_puts(0,LINE_Y+1,line); |
301 | status_draw(); | ||
291 | lcd_update(); | 302 | lcd_update(); |
292 | } | 303 | } |
293 | } | 304 | } |
@@ -301,7 +312,8 @@ void add_indices_to_playlist(void) | |||
301 | } | 312 | } |
302 | if(!playlist.in_ram) { | 313 | if(!playlist.in_ram) { |
303 | snprintf(line, sizeof line, "%d files", playlist.amount); | 314 | snprintf(line, sizeof line, "%d files", playlist.amount); |
304 | lcd_puts(0,1,line); | 315 | lcd_puts(0,LINE_Y+1,line); |
316 | status_draw(); | ||
305 | lcd_update(); | 317 | lcd_update(); |
306 | close(fd); | 318 | close(fd); |
307 | } | 319 | } |
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 50475eb8c9..482c764b52 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -19,6 +19,12 @@ | |||
19 | #include <lcd.h> | 19 | #include <lcd.h> |
20 | 20 | ||
21 | #include "icons.h" | 21 | #include "icons.h" |
22 | #ifndef SIMULATOR | ||
23 | #include "sprintf.h" | ||
24 | #endif | ||
25 | #ifdef HAVE_RTC | ||
26 | #include "rtc.h" | ||
27 | #endif | ||
22 | 28 | ||
23 | #ifdef HAVE_LCD_BITMAP | 29 | #ifdef HAVE_LCD_BITMAP |
24 | 30 | ||
@@ -34,6 +40,12 @@ unsigned char slider_bar[] = | |||
34 | 0x7c, 0x28, 0x28, 0x28, 0x28, 0x38 | 40 | 0x7c, 0x28, 0x28, 0x28, 0x28, 0x38 |
35 | }; | 41 | }; |
36 | 42 | ||
43 | static unsigned char bitmap_icon_5x8[][5] = | ||
44 | { | ||
45 | /* Lock */ | ||
46 | {0x78,0x7f,0x49,0x7f,0x78} | ||
47 | }; | ||
48 | |||
37 | unsigned char bitmap_icons_6x8[LastIcon][6] = | 49 | unsigned char bitmap_icons_6x8[LastIcon][6] = |
38 | { | 50 | { |
39 | /* Box_Filled */ | 51 | /* Box_Filled */ |
@@ -58,6 +70,36 @@ unsigned char bitmap_icons_6x8[LastIcon][6] = | |||
58 | { 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x00 }, | 70 | { 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x00 }, |
59 | }; | 71 | }; |
60 | 72 | ||
73 | static unsigned char bitmap_icon_7x8[][7] = | ||
74 | { | ||
75 | /* Power plug */ | ||
76 | {0x08,0x1c,0x1c,0x3e,0x3e,0x14,0x14}, | ||
77 | /* Speaker */ | ||
78 | {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, | ||
79 | /* Speaker mute */ | ||
80 | {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, | ||
81 | /* Play */ | ||
82 | {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, | ||
83 | /* Stop */ | ||
84 | {0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f}, | ||
85 | /* Pause */ | ||
86 | {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00}, | ||
87 | /* Fast forward */ | ||
88 | {0x7f,0x3e,0x1c,0x7f,0x3e,0x1c,0x08}, | ||
89 | /* Fast backward */ | ||
90 | {0x08,0x1c,0x3e,0x7f,0x1c,0x3e,0x7f}, | ||
91 | /* Record */ | ||
92 | {0x1c,0x3e,0x7f,0x7f,0x7f,0x3e,0x1c}, | ||
93 | /* Record pause */ | ||
94 | {0x1c,0x3e,0x7f,0x00,0x7f,0x3e,0x1c}, | ||
95 | /* Normal playmode */ | ||
96 | {0x08,0x08,0x08,0x08,0x3e,0x1c,0x08}, | ||
97 | /* Repeat playmode */ | ||
98 | {0x38,0x44,0x44,0x4e,0x5f,0x44,0x38}, | ||
99 | /* Shuffle playmode (dice) */ | ||
100 | {0x3e,0x41,0x51,0x41,0x45,0x41,0x3e} | ||
101 | }; | ||
102 | |||
61 | unsigned char rockbox112x37[]={ | 103 | unsigned char rockbox112x37[]={ |
62 | 0x00, 0x00, 0x02, 0xff, 0x02, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, | 104 | 0x00, 0x00, 0x02, 0xff, 0x02, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, |
63 | 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, | 105 | 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, |
@@ -111,4 +153,131 @@ unsigned char rockbox112x37[]={ | |||
111 | 153 | ||
112 | }; | 154 | }; |
113 | 155 | ||
156 | /* | ||
157 | * Wipe statusbar | ||
158 | */ | ||
159 | void statusbar_wipe(void) | ||
160 | { | ||
161 | int x; | ||
162 | |||
163 | for (x = 0; x < LCD_WIDTH; x++) | ||
164 | lcd_framebuffer[x][STATUSBAR_Y_POS/8]=0x00; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Print battery icon to status bar | ||
169 | */ | ||
170 | void statusbar_icon_battery(int percent, bool charging) | ||
171 | { | ||
172 | int i,j; | ||
173 | int fill; | ||
174 | |||
175 | /* draw battery */ | ||
176 | for(i=0;i<17;i++) { | ||
177 | DRAW_PIXEL((ICON_BATTERY_X_POS+i),STATUSBAR_Y_POS); | ||
178 | DRAW_PIXEL((ICON_BATTERY_X_POS+i),(STATUSBAR_Y_POS+6)); | ||
179 | } | ||
180 | for(i=1;i<6;i++) { | ||
181 | DRAW_PIXEL(ICON_BATTERY_X_POS,(STATUSBAR_Y_POS+i)); | ||
182 | DRAW_PIXEL((ICON_BATTERY_X_POS+16),(STATUSBAR_Y_POS+i)); | ||
183 | } | ||
184 | for(i=2;i<5;i++) | ||
185 | DRAW_PIXEL((ICON_BATTERY_X_POS+17),(STATUSBAR_Y_POS+i)); | ||
186 | |||
187 | /* fill battery */ | ||
188 | fill=percent; | ||
189 | if(fill<0) | ||
190 | fill=0; | ||
191 | if(fill>100) | ||
192 | fill=100; | ||
193 | fill=fill*15/100; | ||
194 | |||
195 | for(i=1;i<=fill;i++) | ||
196 | for(j=1;j<6;j++) | ||
197 | DRAW_PIXEL((ICON_BATTERY_X_POS+i),(STATUSBAR_Y_POS+j)); | ||
198 | |||
199 | if(charging) | ||
200 | lcd_bitmap(bitmap_icon_7x8[Icon_Plug], ICON_PLUG_X_POS, STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); | ||
201 | }; | ||
202 | |||
203 | /* | ||
204 | * Print volume gauge to status bar | ||
205 | */ | ||
206 | void statusbar_icon_volume(int percent) | ||
207 | { | ||
208 | int i,j; | ||
209 | int volume; | ||
210 | int step=0; | ||
211 | |||
212 | volume=percent; | ||
213 | if(volume<0) | ||
214 | volume=0; | ||
215 | if(volume>100) | ||
216 | volume=100; | ||
217 | |||
218 | if(volume==0) | ||
219 | lcd_bitmap(bitmap_icon_7x8[Icon_Mute], ICON_VOLUME_X_POS+ICON_VOLUME_WIDTH/2-4, STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false); | ||
220 | else { | ||
221 | volume=volume*14/100; | ||
222 | for(i=0;i<volume;i++) { | ||
223 | if(i%2 == 0) | ||
224 | step++; | ||
225 | for(j=1;j<=step;j++) | ||
226 | DRAW_PIXEL((ICON_VOLUME_X_POS+i),(STATUSBAR_Y_POS+7-j)); | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /* | ||
232 | * Print play state to status bar | ||
233 | */ | ||
234 | void statusbar_icon_play_state(int state) | ||
235 | { | ||
236 | lcd_bitmap(bitmap_icon_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * Print play mode to status bar | ||
241 | */ | ||
242 | void statusbar_icon_play_mode(int mode) | ||
243 | { | ||
244 | lcd_bitmap(bitmap_icon_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS, ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT, false); | ||
245 | } | ||
246 | |||
247 | /* | ||
248 | * Print shuffle mode to status bar | ||
249 | */ | ||
250 | void statusbar_icon_shuffle(void) | ||
251 | { | ||
252 | lcd_bitmap(bitmap_icon_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT, false); | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * Print lock when keys are locked | ||
257 | */ | ||
258 | void statusbar_icon_lock(void) | ||
259 | { | ||
260 | lcd_bitmap(bitmap_icon_5x8[Icon_Lock], LOCK_X_POS, STATUSBAR_Y_POS, 5, 8, false); | ||
261 | } | ||
262 | |||
263 | #ifdef HAVE_RTC | ||
264 | /* | ||
265 | * Print time to status bar | ||
266 | */ | ||
267 | void statusbar_time(void) | ||
268 | { | ||
269 | int hour,minute; | ||
270 | unsigned char buffer[6]; | ||
271 | |||
272 | hour = rtc_read(0x03); | ||
273 | minute = rtc_read(0x02); | ||
274 | |||
275 | snprintf(buffer, sizeof(buffer), "%d%d:%d%d", | ||
276 | (hour & 0x30) >> 4, | ||
277 | hour & 0x0f, | ||
278 | (minute & 0xf0) >> 4, | ||
279 | minute & 0x0f); | ||
280 | lcd_putsxy(TIME_X_POS, STATUSBAR_Y_POS, buffer, 0); | ||
281 | } | ||
282 | #endif | ||
114 | #endif | 283 | #endif |
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 866e4888f2..da94c2269a 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -36,9 +36,56 @@ extern unsigned char rockbox112x37[]; | |||
36 | 36 | ||
37 | extern unsigned char slider_bar[]; | 37 | extern unsigned char slider_bar[]; |
38 | 38 | ||
39 | #endif /* End HAVE_LCD_BITMAP */ | 39 | #define STATUSBAR_X_POS 0 |
40 | 40 | #define STATUSBAR_Y_POS 0 // MUST be a multiple of 8 | |
41 | 41 | #define STATUSBAR_HEIGHT 8 | |
42 | 42 | #define STATUSBAR_WIDTH LCD_WIDTH | |
43 | #define ICON_BATTERY_X_POS 0 | ||
44 | #define ICON_BATTERY_WIDTH 18 | ||
45 | #define ICON_PLUG_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+2 | ||
46 | #define ICON_PLUG_WIDTH 7 | ||
47 | #define ICON_VOLUME_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+2+2 | ||
48 | #define ICON_VOLUME_WIDTH 14 | ||
49 | #define ICON_PLAY_STATE_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+2+2+2 | ||
50 | #define ICON_PLAY_STATE_WIDTH 7 | ||
51 | #define ICON_PLAY_MODE_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+ICON_PLAY_STATE_WIDTH+2+2+2+2 | ||
52 | #define ICON_PLAY_MODE_WIDTH 7 | ||
53 | #define ICON_SHUFFLE_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+ICON_PLAY_STATE_WIDTH+ICON_PLAY_MODE_WIDTH+2+2+2+2+2 | ||
54 | #define ICON_SHUFFLE_WIDTH 7 | ||
55 | #define LOCK_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+ICON_PLAY_STATE_WIDTH+ICON_PLAY_MODE_WIDTH+ICON_SHUFFLE_WIDTH+2+2+2+2+2+2 | ||
56 | #define LOCK_WIDTH 5 | ||
57 | #define TIME_X_POS STATUSBAR_WIDTH-5*6-1 | ||
43 | 58 | ||
59 | /* Symbolic names for icons */ | ||
60 | enum | ||
61 | { | ||
62 | Icon_Lock = 0 | ||
63 | }; | ||
64 | enum | ||
65 | { | ||
66 | Icon_Plug = 0, | ||
67 | Icon_Speaker, | ||
68 | Icon_Mute, | ||
69 | Icon_Play, | ||
70 | Icon_Stop, | ||
71 | Icon_Pause, | ||
72 | Icon_FastForward, | ||
73 | Icon_FastBackward, | ||
74 | Icon_Record, | ||
75 | Icon_RecPause, | ||
76 | Icon_Normal, | ||
77 | Icon_Repeat, | ||
78 | Icon_Shuffle | ||
79 | }; | ||
44 | 80 | ||
81 | extern void statusbar_wipe(void); | ||
82 | extern void statusbar_icon_battery(int percent, bool charging); | ||
83 | extern void statusbar_icon_volume(int percent); | ||
84 | extern void statusbar_icon_play_state(int state); | ||
85 | extern void statusbar_icon_play_mode(int mode); | ||
86 | extern void statusbar_icon_shuffle(void); | ||
87 | extern void statusbar_icon_lock(void); | ||
88 | #ifdef HAVE_RTC | ||
89 | extern void statusbar_time(void); | ||
90 | #endif | ||
91 | #endif /* End HAVE_LCD_BITMAP */ | ||
diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c new file mode 100644 index 0000000000..1c3f0b1a10 --- /dev/null +++ b/apps/recorder/widgets.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: not checked in | ||
9 | * | ||
10 | * Copyright (C) 2002 Markus Braun | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include <lcd.h> | ||
20 | |||
21 | #include "widgets.h" | ||
22 | |||
23 | #ifdef HAVE_LCD_BITMAP | ||
24 | /* | ||
25 | * Print a progress bar | ||
26 | */ | ||
27 | void progressbar(int x, int y, int width, int height, int percent, int direction) | ||
28 | { | ||
29 | int pos; | ||
30 | int i,j; | ||
31 | |||
32 | /* draw horizontal lines */ | ||
33 | for(i=x+1;i<=x+width-2;i++) { | ||
34 | DRAW_PIXEL(i,y); | ||
35 | DRAW_PIXEL(i,(y+height-1)); | ||
36 | } | ||
37 | |||
38 | /* draw vertical lines */ | ||
39 | for(i=1;i<height;i++) { | ||
40 | DRAW_PIXEL(x,(y+i)); | ||
41 | DRAW_PIXEL((x+width-1),(y+i)); | ||
42 | } | ||
43 | |||
44 | /* clear edge pixels */ | ||
45 | CLEAR_PIXEL(x,y); | ||
46 | CLEAR_PIXEL((x+width-1),y); | ||
47 | CLEAR_PIXEL(x,(y+height-1)); | ||
48 | CLEAR_PIXEL((x+width-1),(y+height-1)); | ||
49 | |||
50 | /* clear pixels in progress bar */ | ||
51 | for(i=1;i<=width-2;i++) { | ||
52 | for(j=1;j<=height-2;j++) { | ||
53 | CLEAR_PIXEL((x+i),(y+j)); | ||
54 | CLEAR_PIXEL((x+i),(y+j)); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | /* draw bar */ | ||
59 | pos=percent; | ||
60 | if(pos<0) | ||
61 | pos=0; | ||
62 | if(pos>100) | ||
63 | pos=100; | ||
64 | |||
65 | switch (direction) | ||
66 | { | ||
67 | case Grow_Right: | ||
68 | pos=(width-2)*pos/100; | ||
69 | for(i=1;i<=pos;i++) | ||
70 | for(j=1;j<height-1;j++) | ||
71 | DRAW_PIXEL((x+i),(y+j)); | ||
72 | break; | ||
73 | case Grow_Left: | ||
74 | pos=(width-2)*(100-pos)/100; | ||
75 | for(i=pos+1;i<=width-2;i++) | ||
76 | for(j=1;j<height-1;j++) | ||
77 | DRAW_PIXEL((x+i),(y+j)); | ||
78 | break; | ||
79 | case Grow_Down: | ||
80 | pos=(height-2)*pos/100; | ||
81 | for(i=1;i<=pos;i++) | ||
82 | for(j=1;j<width-1;j++) | ||
83 | DRAW_PIXEL((x+j),(y+i)); | ||
84 | break; | ||
85 | case Grow_Up: | ||
86 | pos=(height-2)*(100-pos)/100; | ||
87 | for(i=pos+1;i<=height-2;i++) | ||
88 | for(j=1;j<width-1;j++) | ||
89 | DRAW_PIXEL((x+j),(y+i)); | ||
90 | break; | ||
91 | } | ||
92 | |||
93 | } | ||
94 | |||
95 | |||
96 | /* | ||
97 | * Print a slidebar bar | ||
98 | */ | ||
99 | void slidebar(int x, int y, int width, int height, int percent, int direction) | ||
100 | { | ||
101 | int pos; | ||
102 | int i,j; | ||
103 | |||
104 | /* draw horizontal lines */ | ||
105 | for(i=x+1;i<=x+width-2;i++) { | ||
106 | DRAW_PIXEL(i,y); | ||
107 | DRAW_PIXEL(i,(y+height-1)); | ||
108 | } | ||
109 | |||
110 | /* draw vertical lines */ | ||
111 | for(i=1;i<height;i++) { | ||
112 | DRAW_PIXEL(x,(y+i)); | ||
113 | DRAW_PIXEL((x+width-1),(y+i)); | ||
114 | } | ||
115 | |||
116 | /* clear edge pixels */ | ||
117 | CLEAR_PIXEL(x,y); | ||
118 | CLEAR_PIXEL((x+width-1),y); | ||
119 | CLEAR_PIXEL(x,(y+height-1)); | ||
120 | CLEAR_PIXEL((x+width-1),(y+height-1)); | ||
121 | |||
122 | /* clear pixels in progress bar */ | ||
123 | for(i=1;i<=width-2;i++) | ||
124 | for(j=1;j<=height-2;j++) { | ||
125 | CLEAR_PIXEL((x+i),(y+j)); | ||
126 | CLEAR_PIXEL((x+i),(y+j)); | ||
127 | } | ||
128 | |||
129 | /* draw point */ | ||
130 | pos=percent; | ||
131 | if(pos<0) | ||
132 | pos=0; | ||
133 | if(pos>100) | ||
134 | pos=100; | ||
135 | |||
136 | switch (direction) | ||
137 | { | ||
138 | case Grow_Right: | ||
139 | pos=(width-height-1)*pos/100; | ||
140 | break; | ||
141 | case Grow_Left: | ||
142 | pos=(width-height-1)*(100-pos)/100; | ||
143 | break; | ||
144 | case Grow_Down: | ||
145 | pos=(height-width-1)*pos/100; | ||
146 | break; | ||
147 | case Grow_Up: | ||
148 | pos=(height-width-1)*(100-pos)/100; | ||
149 | break; | ||
150 | } | ||
151 | |||
152 | if(direction == Grow_Left || direction == Grow_Right) | ||
153 | for(i=1;i<height;i++) | ||
154 | for(j=1;j<height;j++) | ||
155 | DRAW_PIXEL((x+pos+i),(y+j)); | ||
156 | else | ||
157 | for(i=1;i<width;i++) | ||
158 | for(j=1;j<width;j++) | ||
159 | DRAW_PIXEL((x+i),(y+pos+j)); | ||
160 | } | ||
161 | #endif | ||
diff --git a/apps/recorder/widgets.h b/apps/recorder/widgets.h new file mode 100644 index 0000000000..bae9f391de --- /dev/null +++ b/apps/recorder/widgets.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: not checked in | ||
9 | * | ||
10 | * Copyright (C) 2002 Markus Braun | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef __WIDGETS_H__ | ||
20 | #define __WIDGETS_H__ | ||
21 | #include <lcd.h> | ||
22 | |||
23 | #ifdef HAVE_LCD_BITMAP | ||
24 | /* Directions for progressbar and scrollbar */ | ||
25 | enum | ||
26 | { | ||
27 | Grow_Right = 0, | ||
28 | Grow_Left, | ||
29 | Grow_Down, | ||
30 | Grow_Up | ||
31 | }; | ||
32 | |||
33 | extern void progressbar(int x, int y, int width, int height, int percent, int direction); | ||
34 | extern void slidebar(int x, int y, int width, int height, int percent, int direction); | ||
35 | #endif /* HAVE_LCD_BITMAP */ | ||
36 | #endif /* __WIDGETS_H__ */ | ||
diff --git a/apps/settings.c b/apps/settings.c index 4160721e8a..f3e7e554ad 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -275,6 +275,9 @@ int settings_save( void ) | |||
275 | 275 | ||
276 | rtc_config_block[0x11] = (unsigned char)global_settings.avc; | 276 | rtc_config_block[0x11] = (unsigned char)global_settings.avc; |
277 | 277 | ||
278 | rtc_config_block[0x12] = (unsigned char) | ||
279 | ((global_settings.statusbar & 1)); | ||
280 | |||
278 | memcpy(&rtc_config_block[0x24], &global_settings.total_uptime, 4); | 281 | memcpy(&rtc_config_block[0x24], &global_settings.total_uptime, 4); |
279 | 282 | ||
280 | if(save_config_buffer()) | 283 | if(save_config_buffer()) |
@@ -347,6 +350,10 @@ void settings_load(void) | |||
347 | 350 | ||
348 | if (rtc_config_block[0x11] != 0xFF) | 351 | if (rtc_config_block[0x11] != 0xFF) |
349 | global_settings.avc = rtc_config_block[0x11]; | 352 | global_settings.avc = rtc_config_block[0x11]; |
353 | |||
354 | if (rtc_config_block[0x12] != 0xFF) { | ||
355 | global_settings.statusbar = rtc_config_block[0x12] & 1; | ||
356 | } | ||
350 | 357 | ||
351 | if (rtc_config_block[0x24] != 0xFF) | 358 | if (rtc_config_block[0x24] != 0xFF) |
352 | memcpy(&global_settings.total_uptime, &rtc_config_block[0x24], 4); | 359 | memcpy(&global_settings.total_uptime, &rtc_config_block[0x24], 4); |
@@ -378,6 +385,7 @@ void settings_reset(void) { | |||
378 | global_settings.wps_display = DEFAULT_WPS_DISPLAY; | 385 | global_settings.wps_display = DEFAULT_WPS_DISPLAY; |
379 | global_settings.mp3filter = true; | 386 | global_settings.mp3filter = true; |
380 | global_settings.sort_case = false; | 387 | global_settings.sort_case = false; |
388 | global_settings.statusbar = true; | ||
381 | global_settings.playlist_shuffle = false; | 389 | global_settings.playlist_shuffle = false; |
382 | global_settings.discharge = 0; | 390 | global_settings.discharge = 0; |
383 | global_settings.total_uptime = 0; | 391 | global_settings.total_uptime = 0; |
diff --git a/apps/settings.h b/apps/settings.h index b39ac73c89..e66bf8f53d 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -62,6 +62,9 @@ struct user_settings | |||
62 | 62 | ||
63 | /* while playing screen settings */ | 63 | /* while playing screen settings */ |
64 | int wps_display; /* 0=id3, 1=file, 2=parse */ | 64 | int wps_display; /* 0=id3, 1=file, 2=parse */ |
65 | |||
66 | /* show status bar */ | ||
67 | bool statusbar; /* 0=hide, 1=show */ | ||
65 | 68 | ||
66 | /* geeky persistent statistics */ | 69 | /* geeky persistent statistics */ |
67 | unsigned int total_uptime; /* total uptime since rockbox was first booted */ | 70 | unsigned int total_uptime; /* total uptime since rockbox was first booted */ |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 98c47b753c..7ab1b0479d 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -76,6 +76,13 @@ static void deep_discharge(void) | |||
76 | } | 76 | } |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #ifdef HAVE_LCD_BITMAP | ||
80 | static void statusbar(void) | ||
81 | { | ||
82 | set_bool( "[Show status bar]", &global_settings.statusbar ); | ||
83 | } | ||
84 | #endif | ||
85 | |||
79 | void settings_menu(void) | 86 | void settings_menu(void) |
80 | { | 87 | { |
81 | int m; | 88 | int m; |
@@ -89,6 +96,9 @@ void settings_menu(void) | |||
89 | #ifdef HAVE_CHARGE_CTRL | 96 | #ifdef HAVE_CHARGE_CTRL |
90 | { "Deep discharge", deep_discharge }, | 97 | { "Deep discharge", deep_discharge }, |
91 | #endif | 98 | #endif |
99 | #ifdef HAVE_LCD_BITMAP | ||
100 | { "Status bar", statusbar }, | ||
101 | #endif | ||
92 | }; | 102 | }; |
93 | bool old_shuffle = global_settings.playlist_shuffle; | 103 | bool old_shuffle = global_settings.playlist_shuffle; |
94 | 104 | ||
diff --git a/apps/status.c b/apps/status.c index fde7146a88..c4bd958964 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -24,8 +24,18 @@ | |||
24 | #include "settings.h" | 24 | #include "settings.h" |
25 | #include "status.h" | 25 | #include "status.h" |
26 | #include "mpeg.h" | 26 | #include "mpeg.h" |
27 | #include "wps.h" | ||
28 | #ifdef HAVE_LCD_BITMAP | ||
29 | #include "icons.h" | ||
30 | #endif | ||
31 | #include "power.h" | ||
32 | |||
27 | static enum playmode current_mode; | 33 | static enum playmode current_mode; |
28 | 34 | ||
35 | #ifdef HAVE_LCD_BITMAP | ||
36 | bool statusbar_enabled = true; | ||
37 | #endif | ||
38 | |||
29 | void status_init(void) | 39 | void status_init(void) |
30 | { | 40 | { |
31 | status_set_playmode(STATUS_STOP); | 41 | status_set_playmode(STATUS_STOP); |
@@ -36,6 +46,22 @@ void status_set_playmode(enum playmode mode) | |||
36 | current_mode = mode; | 46 | current_mode = mode; |
37 | } | 47 | } |
38 | 48 | ||
49 | #ifdef HAVE_LCD_BITMAP | ||
50 | bool statusbar(bool state) | ||
51 | { | ||
52 | bool laststate=statusbar_enabled; | ||
53 | |||
54 | statusbar_enabled=state; | ||
55 | |||
56 | return(laststate); | ||
57 | } | ||
58 | |||
59 | void statusbar_toggle(void) | ||
60 | { | ||
61 | statusbar_enabled=!statusbar_enabled; | ||
62 | } | ||
63 | #endif | ||
64 | |||
39 | void status_draw(void) | 65 | void status_draw(void) |
40 | { | 66 | { |
41 | #if defined(HAVE_LCD_CHARCELLS) && !defined(SIMULATOR) | 67 | #if defined(HAVE_LCD_CHARCELLS) && !defined(SIMULATOR) |
@@ -97,4 +123,28 @@ void status_draw(void) | |||
97 | break; | 123 | break; |
98 | } | 124 | } |
99 | #endif | 125 | #endif |
126 | #ifdef HAVE_LCD_BITMAP | ||
127 | int battlevel = battery_level(); | ||
128 | int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume); | ||
129 | |||
130 | if(global_settings.statusbar && statusbar_enabled) { | ||
131 | statusbar_wipe(); | ||
132 | #ifdef HAVE_CHARGE_CTRL | ||
133 | statusbar_icon_battery(battlevel,charger_enabled); | ||
134 | #else | ||
135 | statusbar_icon_battery(battlevel,false); | ||
136 | #endif | ||
137 | statusbar_icon_volume(volume); | ||
138 | statusbar_icon_play_state(current_mode+Icon_Play); | ||
139 | if (global_settings.loop_playlist) | ||
140 | statusbar_icon_play_mode(Icon_Repeat); | ||
141 | else | ||
142 | statusbar_icon_play_mode(Icon_Normal); | ||
143 | if(global_settings.playlist_shuffle) statusbar_icon_shuffle(); | ||
144 | if (keys_locked) statusbar_icon_lock(); | ||
145 | #ifdef HAVE_RTC | ||
146 | statusbar_time(); | ||
147 | #endif | ||
148 | } | ||
149 | #endif | ||
100 | } | 150 | } |
diff --git a/apps/status.h b/apps/status.h index 344d12f91b..41251bef28 100644 --- a/apps/status.h +++ b/apps/status.h | |||
@@ -23,11 +23,20 @@ enum playmode | |||
23 | { | 23 | { |
24 | STATUS_PLAY, | 24 | STATUS_PLAY, |
25 | STATUS_STOP, | 25 | STATUS_STOP, |
26 | STATUS_PAUSE | 26 | STATUS_PAUSE, |
27 | STATUS_FASTFORWARD, | ||
28 | STATUS_FASTBACKWARD, | ||
29 | STATUS_RECORD, | ||
30 | STATUS_RECORD_PAUSE | ||
27 | }; | 31 | }; |
28 | 32 | ||
29 | void status_init(void); | 33 | void status_init(void); |
30 | void status_set_playmode(enum playmode mode); | 34 | void status_set_playmode(enum playmode mode); |
35 | #ifdef HAVE_LCD_BITMAP | ||
36 | extern bool statusbar_enabled; | ||
37 | bool statusbar(bool state); | ||
38 | void statusbar_toggle(void); | ||
39 | #endif | ||
31 | void status_draw(void); | 40 | void status_draw(void); |
32 | 41 | ||
33 | #endif | 42 | #endif |
diff --git a/apps/tree.c b/apps/tree.c index 733545aa17..68b893c78f 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -65,12 +65,12 @@ void browse_root(void) | |||
65 | 65 | ||
66 | #ifdef HAVE_LCD_BITMAP | 66 | #ifdef HAVE_LCD_BITMAP |
67 | 67 | ||
68 | #define TREE_MAX_ON_SCREEN ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH) | 68 | #define TREE_MAX_ON_SCREEN ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH-LINE_Y) |
69 | #define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */ | 69 | #define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */ |
70 | 70 | ||
71 | #define MARGIN_Y 0 /* Y pixel margin */ | 71 | #define MARGIN_Y 0 /* Y pixel margin */ |
72 | #define MARGIN_X 12 /* X pixel margin */ | 72 | #define MARGIN_X 12 /* X pixel margin */ |
73 | #define LINE_Y 0 /* Y position the entry-list starts at */ | 73 | #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ |
74 | #define LINE_X 2 /* X position the entry-list starts at */ | 74 | #define LINE_X 2 /* X position the entry-list starts at */ |
75 | #define LINE_HEIGTH 8 /* pixels for each text line */ | 75 | #define LINE_HEIGTH 8 /* pixels for each text line */ |
76 | 76 | ||
@@ -226,7 +226,7 @@ static int showdir(char *path, int start) | |||
226 | icon_type = File; | 226 | icon_type = File; |
227 | } | 227 | } |
228 | lcd_bitmap(bitmap_icons_6x8[icon_type], | 228 | lcd_bitmap(bitmap_icons_6x8[icon_type], |
229 | 6, MARGIN_Y+(i-start)*LINE_HEIGTH, 6, 8, true); | 229 | 6, MARGIN_Y+(LINE_Y+i-start)*LINE_HEIGTH, 6, 8, true); |
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | /* if MP3 filter is on, cut off the extension */ | 232 | /* if MP3 filter is on, cut off the extension */ |
@@ -264,6 +264,7 @@ bool dirbrowse(char *root) | |||
264 | { | 264 | { |
265 | char buf[MAX_PATH]; | 265 | char buf[MAX_PATH]; |
266 | int i; | 266 | int i; |
267 | int lasti=-1; | ||
267 | int rc; | 268 | int rc; |
268 | int button; | 269 | int button; |
269 | int browse_speed = 0; | 270 | int browse_speed = 0; |
@@ -274,33 +275,12 @@ bool dirbrowse(char *root) | |||
274 | if (numentries == -1) | 275 | if (numentries == -1) |
275 | return -1; /* root is not a directory */ | 276 | return -1; /* root is not a directory */ |
276 | 277 | ||
277 | put_cursorxy(0, CURSOR_Y + dircursor, true); | 278 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
278 | 279 | ||
279 | while(1) { | 280 | while(1) { |
280 | bool restore = false; | 281 | bool restore = false; |
281 | 282 | ||
282 | if ( numentries ) { | 283 | button = button_get_w_tmo(HZ/5); |
283 | i = start+dircursor; | ||
284 | |||
285 | /* if MP3 filter is on, cut off the extension */ | ||
286 | if (global_settings.mp3filter && | ||
287 | (dircacheptr[i]->attr & | ||
288 | (TREE_ATTR_M3U|TREE_ATTR_MP3))) | ||
289 | { | ||
290 | int len = strlen(dircacheptr[i]->name); | ||
291 | char temp = dircacheptr[i]->name[len-4]; | ||
292 | dircacheptr[i]->name[len-4] = 0; | ||
293 | lcd_puts_scroll(LINE_X, LINE_Y+dircursor, | ||
294 | dircacheptr[i]->name); | ||
295 | dircacheptr[i]->name[len-4] = temp; | ||
296 | } | ||
297 | else | ||
298 | lcd_puts_scroll(LINE_X, LINE_Y+dircursor, | ||
299 | dircacheptr[i]->name); | ||
300 | } | ||
301 | lcd_update(); | ||
302 | |||
303 | button = button_get(true); | ||
304 | switch ( button ) { | 284 | switch ( button ) { |
305 | case TREE_EXIT: | 285 | case TREE_EXIT: |
306 | i=strlen(currdir); | 286 | i=strlen(currdir); |
@@ -327,6 +307,8 @@ bool dirbrowse(char *root) | |||
327 | case BUTTON_OFF: | 307 | case BUTTON_OFF: |
328 | mpeg_stop(); | 308 | mpeg_stop(); |
329 | status_set_playmode(STATUS_STOP); | 309 | status_set_playmode(STATUS_STOP); |
310 | status_draw(); | ||
311 | restore = true; | ||
330 | break; | 312 | break; |
331 | #endif | 313 | #endif |
332 | 314 | ||
@@ -389,7 +371,7 @@ bool dirbrowse(char *root) | |||
389 | if (browse_speed < TREE_MAX_ON_SCREEN - 1) { | 371 | if (browse_speed < TREE_MAX_ON_SCREEN - 1) { |
390 | /* moving the cursor up through a full screen */ | 372 | /* moving the cursor up through a full screen */ |
391 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, | 373 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, |
392 | false); | 374 | false); |
393 | dircursor--; | 375 | dircursor--; |
394 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); | 376 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
395 | } | 377 | } |
@@ -489,7 +471,7 @@ bool dirbrowse(char *root) | |||
489 | dircursor=7; | 471 | dircursor=7; |
490 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); | 472 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
491 | } | 473 | } |
492 | 474 | ||
493 | } | 475 | } |
494 | else { | 476 | else { |
495 | /* leaving the cursor at bottom line and moving screen up */ | 477 | /* leaving the cursor at bottom line and moving screen up */ |
@@ -561,9 +543,15 @@ bool dirbrowse(char *root) | |||
561 | case TREE_MENU: { | 543 | case TREE_MENU: { |
562 | bool lastfilter = global_settings.mp3filter; | 544 | bool lastfilter = global_settings.mp3filter; |
563 | bool lastsortcase = global_settings.sort_case; | 545 | bool lastsortcase = global_settings.sort_case; |
546 | #ifdef HAVE_LCD_BITMAP | ||
547 | bool laststate=statusbar(false); | ||
548 | #endif | ||
564 | browse_speed = 0; | 549 | browse_speed = 0; |
565 | lcd_stop_scroll(); | 550 | lcd_stop_scroll(); |
566 | main_menu(); | 551 | main_menu(); |
552 | #ifdef HAVE_LCD_BITMAP | ||
553 | statusbar(laststate); | ||
554 | #endif | ||
567 | /* do we need to rescan dir? */ | 555 | /* do we need to rescan dir? */ |
568 | if ( lastfilter != global_settings.mp3filter || | 556 | if ( lastfilter != global_settings.mp3filter || |
569 | lastsortcase != global_settings.sort_case) | 557 | lastsortcase != global_settings.sort_case) |
@@ -591,8 +579,26 @@ bool dirbrowse(char *root) | |||
591 | } | 579 | } |
592 | break; | 580 | break; |
593 | 581 | ||
582 | #ifdef HAVE_RECORDER_KEYPAD | ||
583 | case BUTTON_F3: | ||
584 | #endif | ||
585 | #ifdef HAVE_LCD_BITMAP | ||
586 | if(global_settings.statusbar) { | ||
587 | statusbar_toggle(); | ||
588 | if(CURSOR_Y+LINE_Y+dircursor>TREE_MAX_ON_SCREEN) { | ||
589 | start++; | ||
590 | dircursor--; | ||
591 | } | ||
592 | restore = true; | ||
593 | } | ||
594 | #endif | ||
595 | break; | ||
596 | |||
594 | #ifndef SIMULATOR | 597 | #ifndef SIMULATOR |
595 | case SYS_USB_CONNECTED: | 598 | case SYS_USB_CONNECTED: { |
599 | #ifdef HAVE_LCD_BITMAP | ||
600 | bool laststate=statusbar(false); | ||
601 | #endif | ||
596 | /* Tell the USB thread that we are safe */ | 602 | /* Tell the USB thread that we are safe */ |
597 | DEBUGF("dirbrowse got SYS_USB_CONNECTED\n"); | 603 | DEBUGF("dirbrowse got SYS_USB_CONNECTED\n"); |
598 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 604 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
@@ -607,7 +613,11 @@ bool dirbrowse(char *root) | |||
607 | dirlevel = 0; | 613 | dirlevel = 0; |
608 | dircursor = 0; | 614 | dircursor = 0; |
609 | start = 0; | 615 | start = 0; |
610 | break; | 616 | #ifdef HAVE_LCD_BITMAP |
617 | statusbar(laststate); | ||
618 | #endif | ||
619 | } | ||
620 | break; | ||
611 | #endif | 621 | #endif |
612 | } | 622 | } |
613 | 623 | ||
@@ -617,7 +627,32 @@ bool dirbrowse(char *root) | |||
617 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); | 627 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
618 | } | 628 | } |
619 | 629 | ||
620 | lcd_stop_scroll(); | 630 | if ( numentries ) { |
631 | i = start+dircursor; | ||
632 | |||
633 | /* if MP3 filter is on, cut off the extension */ | ||
634 | if(lasti!=i || restore) { | ||
635 | lasti=i; | ||
636 | lcd_stop_scroll(); | ||
637 | if (global_settings.mp3filter && | ||
638 | (dircacheptr[i]->attr & | ||
639 | (TREE_ATTR_M3U|TREE_ATTR_MP3))) | ||
640 | { | ||
641 | int len = strlen(dircacheptr[i]->name); | ||
642 | char temp = dircacheptr[i]->name[len-4]; | ||
643 | dircacheptr[i]->name[len-4] = 0; | ||
644 | lcd_puts_scroll(LINE_X, LINE_Y+dircursor, | ||
645 | dircacheptr[i]->name); | ||
646 | dircacheptr[i]->name[len-4] = temp; | ||
647 | } | ||
648 | else | ||
649 | lcd_puts_scroll(LINE_X, LINE_Y+dircursor, | ||
650 | dircacheptr[i]->name); | ||
651 | } | ||
652 | } | ||
653 | status_draw(); | ||
654 | lcd_update(); | ||
655 | |||
621 | } | 656 | } |
622 | 657 | ||
623 | return false; | 658 | return false; |
diff --git a/apps/wps.c b/apps/wps.c index c3398e2ea4..db97a3c708 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -34,8 +34,16 @@ | |||
34 | #include "power.h" | 34 | #include "power.h" |
35 | #include "status.h" | 35 | #include "status.h" |
36 | #include "main_menu.h" | 36 | #include "main_menu.h" |
37 | #ifdef HAVE_LCD_BITMAP | ||
38 | #include "icons.h" | ||
39 | #include "widgets.h" | ||
40 | #endif | ||
37 | 41 | ||
38 | #define LINE_Y 1 /* initial line */ | 42 | #ifdef HAVE_LCD_BITMAP |
43 | #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ | ||
44 | #else /* HAVE_LCD_BITMAP */ | ||
45 | #define LINE_Y 0 /* Y position the entry-list starts at */ | ||
46 | #endif /* HAVE_LCD_BITMAP */ | ||
39 | 47 | ||
40 | #define PLAY_DISPLAY_DEFAULT 0 | 48 | #define PLAY_DISPLAY_DEFAULT 0 |
41 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 | 49 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 |
@@ -47,6 +55,8 @@ | |||
47 | #define RELEASE_MASK (BUTTON_MENU | BUTTON_STOP) | 55 | #define RELEASE_MASK (BUTTON_MENU | BUTTON_STOP) |
48 | #endif | 56 | #endif |
49 | 57 | ||
58 | bool keys_locked = false; | ||
59 | |||
50 | static void draw_screen(struct mp3entry* id3) | 60 | static void draw_screen(struct mp3entry* id3) |
51 | { | 61 | { |
52 | lcd_clear_display(); | 62 | lcd_clear_display(); |
@@ -83,14 +93,14 @@ static void draw_screen(struct mp3entry* id3) | |||
83 | strncpy(szArtist,szTok,sizeof(szArtist)); | 93 | strncpy(szArtist,szTok,sizeof(szArtist)); |
84 | szArtist[sizeof(szArtist)-1] = 0; | 94 | szArtist[sizeof(szArtist)-1] = 0; |
85 | szDelimit = strrchr(id3->path, ch); | 95 | szDelimit = strrchr(id3->path, ch); |
86 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); | 96 | lcd_puts(0,LINE_Y, szArtist?szArtist:"<nothing>"); |
87 | 97 | ||
88 | // removes the .mp3 from the end of the display buffer | 98 | // removes the .mp3 from the end of the display buffer |
89 | szPeriod = strrchr(szDelimit, '.'); | 99 | szPeriod = strrchr(szDelimit, '.'); |
90 | if (szPeriod != NULL) | 100 | if (szPeriod != NULL) |
91 | *szPeriod = 0; | 101 | *szPeriod = 0; |
92 | 102 | ||
93 | lcd_puts_scroll(0,LINE_Y,(++szDelimit)); | 103 | lcd_puts_scroll(0,LINE_Y+1,(++szDelimit)); |
94 | break; | 104 | break; |
95 | } | 105 | } |
96 | case PLAY_DISPLAY_FILENAME_SCROLL: | 106 | case PLAY_DISPLAY_FILENAME_SCROLL: |
@@ -99,14 +109,14 @@ static void draw_screen(struct mp3entry* id3) | |||
99 | char* szLast = strrchr(id3->path, ch); | 109 | char* szLast = strrchr(id3->path, ch); |
100 | 110 | ||
101 | if (szLast) | 111 | if (szLast) |
102 | lcd_puts_scroll(0,0, (++szLast)); | 112 | lcd_puts_scroll(0,LINE_Y, (++szLast)); |
103 | else | 113 | else |
104 | lcd_puts_scroll(0,0, id3->path); | 114 | lcd_puts_scroll(0,LINE_Y, id3->path); |
105 | break; | 115 | break; |
106 | } | 116 | } |
107 | case PLAY_DISPLAY_DEFAULT: | 117 | case PLAY_DISPLAY_DEFAULT: |
108 | { | 118 | { |
109 | int l = 0; | 119 | int l = LINE_Y; |
110 | #ifdef HAVE_LCD_BITMAP | 120 | #ifdef HAVE_LCD_BITMAP |
111 | char buffer[64]; | 121 | char buffer[64]; |
112 | 122 | ||
@@ -115,16 +125,28 @@ static void draw_screen(struct mp3entry* id3) | |||
115 | lcd_puts(0, l++, id3->album?id3->album:""); | 125 | lcd_puts(0, l++, id3->album?id3->album:""); |
116 | lcd_puts(0, l++, id3->artist?id3->artist:""); | 126 | lcd_puts(0, l++, id3->artist?id3->artist:""); |
117 | 127 | ||
118 | if(id3->vbr) | 128 | if(LINE_Y==0) { |
119 | snprintf(buffer, sizeof(buffer), "%d kbit (avg)", | 129 | if(id3->vbr) |
120 | id3->bitrate); | 130 | snprintf(buffer, sizeof(buffer), "%d kbit (avg)", |
121 | else | 131 | id3->bitrate); |
122 | snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate); | 132 | else |
133 | snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate); | ||
134 | |||
135 | lcd_puts(0, l++, buffer); | ||
123 | 136 | ||
124 | lcd_puts(0, l++, buffer); | 137 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); |
138 | lcd_puts(0, l++, buffer); | ||
139 | } | ||
140 | else { | ||
141 | if(id3->vbr) | ||
142 | snprintf(buffer, sizeof(buffer), "%dkbit(a) %dHz", | ||
143 | id3->bitrate, id3->frequency); | ||
144 | else | ||
145 | snprintf(buffer, sizeof(buffer), "%dkbit %dHz", | ||
146 | id3->bitrate, id3->frequency); | ||
125 | 147 | ||
126 | snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); | 148 | lcd_puts(0, l++, buffer); |
127 | lcd_puts(0, l++, buffer); | 149 | } |
128 | #else | 150 | #else |
129 | 151 | ||
130 | lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>"); | 152 | lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>"); |
@@ -166,7 +188,6 @@ void display_keylock_text(bool locked) | |||
166 | int wps_show(void) | 188 | int wps_show(void) |
167 | { | 189 | { |
168 | struct mp3entry* id3 = NULL; | 190 | struct mp3entry* id3 = NULL; |
169 | bool keys_locked = false; | ||
170 | bool dont_go_to_menu = false; | 191 | bool dont_go_to_menu = false; |
171 | bool menu_button_is_down = false; | 192 | bool menu_button_is_down = false; |
172 | bool pending_keylock = true; /* Keylock will go ON next time */ | 193 | bool pending_keylock = true; /* Keylock will go ON next time */ |
@@ -364,9 +385,15 @@ int wps_show(void) | |||
364 | #endif | 385 | #endif |
365 | if(!keys_locked && !dont_go_to_menu && menu_button_is_down) | 386 | if(!keys_locked && !dont_go_to_menu && menu_button_is_down) |
366 | { | 387 | { |
388 | #ifdef HAVE_LCD_BITMAP | ||
389 | bool laststate=statusbar(false); | ||
390 | #endif | ||
367 | lcd_stop_scroll(); | 391 | lcd_stop_scroll(); |
368 | button_set_release(old_release_mask); | 392 | button_set_release(old_release_mask); |
369 | main_menu(); | 393 | main_menu(); |
394 | #ifdef HAVE_LCD_BITMAP | ||
395 | statusbar(laststate); | ||
396 | #endif | ||
370 | old_release_mask = button_set_release(RELEASE_MASK); | 397 | old_release_mask = button_set_release(RELEASE_MASK); |
371 | id3 = mpeg_current_track(); | 398 | id3 = mpeg_current_track(); |
372 | draw_screen(id3); | 399 | draw_screen(id3); |
@@ -379,6 +406,17 @@ int wps_show(void) | |||
379 | break; | 406 | break; |
380 | 407 | ||
381 | #ifdef HAVE_RECORDER_KEYPAD | 408 | #ifdef HAVE_RECORDER_KEYPAD |
409 | case BUTTON_F3: | ||
410 | #ifdef HAVE_LCD_BITMAP | ||
411 | if(global_settings.statusbar) { | ||
412 | statusbar_toggle(); | ||
413 | draw_screen(id3); | ||
414 | } | ||
415 | #endif | ||
416 | break; | ||
417 | #endif | ||
418 | |||
419 | #ifdef HAVE_RECORDER_KEYPAD | ||
382 | case BUTTON_OFF: | 420 | case BUTTON_OFF: |
383 | #else | 421 | #else |
384 | case BUTTON_STOP: | 422 | case BUTTON_STOP: |
@@ -396,7 +434,10 @@ int wps_show(void) | |||
396 | return 0; | 434 | return 0; |
397 | 435 | ||
398 | #ifndef SIMULATOR | 436 | #ifndef SIMULATOR |
399 | case SYS_USB_CONNECTED: | 437 | case SYS_USB_CONNECTED: { |
438 | #ifdef HAVE_LCD_BITMAP | ||
439 | bool laststate=statusbar(false); | ||
440 | #endif | ||
400 | /* Tell the USB thread that we are safe */ | 441 | /* Tell the USB thread that we are safe */ |
401 | DEBUGF("wps got SYS_USB_CONNECTED\n"); | 442 | DEBUGF("wps got SYS_USB_CONNECTED\n"); |
402 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 443 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
@@ -404,16 +445,20 @@ int wps_show(void) | |||
404 | /* Wait until the USB cable is extracted again */ | 445 | /* Wait until the USB cable is extracted again */ |
405 | usb_wait_for_disconnect(&button_queue); | 446 | usb_wait_for_disconnect(&button_queue); |
406 | 447 | ||
448 | #ifdef HAVE_LCD_BITMAP | ||
449 | statusbar(laststate); | ||
450 | #endif | ||
407 | /* Signal to our caller that we have been in USB mode */ | 451 | /* Signal to our caller that we have been in USB mode */ |
408 | return SYS_USB_CONNECTED; | 452 | return SYS_USB_CONNECTED; |
409 | break; | 453 | break; |
454 | } | ||
410 | #endif | 455 | #endif |
411 | case BUTTON_NONE: /* Timeout */ | 456 | case BUTTON_NONE: /* Timeout */ |
412 | if (mpeg_is_playing() && id3) | 457 | if (mpeg_is_playing() && id3) |
413 | { | 458 | { |
414 | #ifdef HAVE_LCD_BITMAP | 459 | #ifdef HAVE_LCD_BITMAP |
415 | snprintf(buffer,sizeof(buffer), | 460 | snprintf(buffer,sizeof(buffer), |
416 | "Time: %d:%02d / %d:%02d", | 461 | "Time:%3d:%02d/%d:%02d", |
417 | id3->elapsed / 60000, | 462 | id3->elapsed / 60000, |
418 | id3->elapsed % 60000 / 1000, | 463 | id3->elapsed % 60000 / 1000, |
419 | id3->length / 60000, | 464 | id3->length / 60000, |
@@ -421,9 +466,9 @@ int wps_show(void) | |||
421 | 466 | ||
422 | lcd_puts(0, 6, buffer); | 467 | lcd_puts(0, 6, buffer); |
423 | 468 | ||
424 | lcd_slidebar(1, LCD_HEIGHT-7, LCD_WIDTH-2, 5, | 469 | slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, |
425 | id3->elapsed*100/id3->length, | 470 | id3->elapsed*100/id3->length, |
426 | BAR_RIGHT); | 471 | Grow_Right); |
427 | 472 | ||
428 | lcd_update(); | 473 | lcd_update(); |
429 | #else | 474 | #else |
@@ -432,7 +477,7 @@ int wps_show(void) | |||
432 | if (global_settings.wps_display == | 477 | if (global_settings.wps_display == |
433 | PLAY_DISPLAY_FILENAME_SCROLL) | 478 | PLAY_DISPLAY_FILENAME_SCROLL) |
434 | { | 479 | { |
435 | snprintf(buffer,sizeof(buffer), "%d:%02d/%d:%02d", | 480 | snprintf(buffer,sizeof(buffer), "Time:%3d:%02d/%d:%02d", |
436 | id3->elapsed / 60000, | 481 | id3->elapsed / 60000, |
437 | id3->elapsed % 60000 / 1000, | 482 | id3->elapsed % 60000 / 1000, |
438 | id3->length / 60000, | 483 | id3->length / 60000, |
@@ -445,12 +490,6 @@ int wps_show(void) | |||
445 | } | 490 | } |
446 | 491 | ||
447 | status_draw(); | 492 | status_draw(); |
448 | #ifdef HAVE_LCD_BITMAP | ||
449 | /* draw battery indicator line */ | ||
450 | lcd_clearline(0,LCD_HEIGHT-1,LCD_WIDTH-1, LCD_HEIGHT-1); | ||
451 | lcd_drawline(0,LCD_HEIGHT-1,battery_level() * | ||
452 | (LCD_WIDTH-1) / 100, LCD_HEIGHT-1); | ||
453 | #endif | ||
454 | break; | 493 | break; |
455 | } | 494 | } |
456 | } | 495 | } |
diff --git a/apps/wps.h b/apps/wps.h index 4b4e63efc5..b0673157f4 100644 --- a/apps/wps.h +++ b/apps/wps.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #include "id3.h" | 21 | #include "id3.h" |
22 | #include "playlist.h" | 22 | #include "playlist.h" |
23 | 23 | ||
24 | extern bool keys_locked; | ||
25 | |||
24 | int wps_show(void); | 26 | int wps_show(void); |
25 | 27 | ||
26 | #endif | 28 | #endif |