diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/alarm_menu.c | 35 | ||||
-rw-r--r-- | apps/bookmark.c | 57 | ||||
-rw-r--r-- | apps/filetree.c | 1 | ||||
-rw-r--r-- | apps/gui/splash.c | 1 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 39 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 6 | ||||
-rw-r--r-- | apps/gui/textarea.c | 4 | ||||
-rw-r--r-- | apps/onplay.c | 4 | ||||
-rw-r--r-- | apps/player/keyboard.c | 6 | ||||
-rw-r--r-- | apps/recorder/icons.c | 181 | ||||
-rw-r--r-- | apps/recorder/icons.h | 2 | ||||
-rw-r--r-- | apps/recorder/keyboard.c | 20 | ||||
-rw-r--r-- | apps/recorder/radio.c | 38 | ||||
-rw-r--r-- | apps/recorder/recording.c | 6 | ||||
-rw-r--r-- | apps/screen_access.c | 8 | ||||
-rw-r--r-- | apps/screen_access.h | 1 | ||||
-rw-r--r-- | apps/screens.c | 18 | ||||
-rw-r--r-- | apps/sleeptimer.c | 4 | ||||
-rw-r--r-- | apps/sound_menu.c | 4 | ||||
-rw-r--r-- | apps/status.c | 278 | ||||
-rw-r--r-- | apps/status.h | 25 |
21 files changed, 132 insertions, 606 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index 9df664f8a8..ae5d5bb752 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c | |||
@@ -25,14 +25,12 @@ | |||
25 | #include "options.h" | 25 | #include "options.h" |
26 | 26 | ||
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "font.h" | ||
29 | #include "button.h" | 28 | #include "button.h" |
30 | #include "kernel.h" | 29 | #include "kernel.h" |
31 | #include "sprintf.h" | 30 | #include "sprintf.h" |
32 | #include <string.h> | 31 | #include <string.h> |
33 | #include "settings.h" | 32 | #include "settings.h" |
34 | #include "power.h" | 33 | #include "power.h" |
35 | #include "status.h" | ||
36 | #include "icons.h" | 34 | #include "icons.h" |
37 | #include "rtc.h" | 35 | #include "rtc.h" |
38 | #include "misc.h" | 36 | #include "misc.h" |
@@ -44,6 +42,8 @@ | |||
44 | #include "backlight.h" | 42 | #include "backlight.h" |
45 | 43 | ||
46 | #include "splash.h" | 44 | #include "splash.h" |
45 | #include "statusbar.h" | ||
46 | #include "textarea.h" | ||
47 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) | 47 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) |
48 | 48 | ||
49 | bool alarm_screen(void) | 49 | bool alarm_screen(void) |
@@ -54,6 +54,7 @@ bool alarm_screen(void) | |||
54 | struct tm *tm; | 54 | struct tm *tm; |
55 | int togo; | 55 | int togo; |
56 | int button; | 56 | int button; |
57 | int i; | ||
57 | bool update = true; | 58 | bool update = true; |
58 | 59 | ||
59 | rtc_get_alarm(&h, &m); | 60 | rtc_get_alarm(&h, &m); |
@@ -69,20 +70,22 @@ bool alarm_screen(void) | |||
69 | while(!done) { | 70 | while(!done) { |
70 | if(update) | 71 | if(update) |
71 | { | 72 | { |
72 | lcd_clear_display(); | 73 | FOR_NB_SCREENS(i) |
73 | status_draw(true); | 74 | { |
74 | lcd_setfont(FONT_SYSFIXED); | 75 | gui_textarea_clear(&screens[i]); |
75 | lcd_setmargins(0, MARGIN_Y); | 76 | screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS)); |
76 | lcd_puts(0, 3, str(LANG_ALARM_MOD_KEYS)); | 77 | } |
77 | update = false; | 78 | update = false; |
78 | } | 79 | } |
79 | |||
80 | snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m); | ||
81 | lcd_puts(0, 1, buf); | ||
82 | lcd_update(); | ||
83 | 80 | ||
81 | snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m); | ||
82 | FOR_NB_SCREENS(i) | ||
83 | { | ||
84 | screens[i].puts(0, 1, buf); | ||
85 | gui_textarea_update(&screens[i]); | ||
86 | } | ||
84 | button = button_get_w_tmo(HZ); | 87 | button = button_get_w_tmo(HZ); |
85 | 88 | ||
86 | switch(button) { | 89 | switch(button) { |
87 | case BUTTON_PLAY: | 90 | case BUTTON_PLAY: |
88 | /* prevent that an alarm occurs in the shutdown procedure */ | 91 | /* prevent that an alarm occurs in the shutdown procedure */ |
@@ -95,7 +98,7 @@ bool alarm_screen(void) | |||
95 | rtc_enable_alarm(true); | 98 | rtc_enable_alarm(true); |
96 | gui_syncsplash(HZ*2, true, str(LANG_ALARM_MOD_TIME_TO_GO), | 99 | gui_syncsplash(HZ*2, true, str(LANG_ALARM_MOD_TIME_TO_GO), |
97 | togo / 60, togo % 60); | 100 | togo / 60, togo % 60); |
98 | done = true; | 101 | done = true; |
99 | } else { | 102 | } else { |
100 | gui_syncsplash(HZ, true, str(LANG_ALARM_MOD_ERROR)); | 103 | gui_syncsplash(HZ, true, str(LANG_ALARM_MOD_ERROR)); |
101 | update = true; | 104 | update = true; |
@@ -125,9 +128,9 @@ bool alarm_screen(void) | |||
125 | if (h == -1) | 128 | if (h == -1) |
126 | h = 23; | 129 | h = 23; |
127 | break; | 130 | break; |
128 | 131 | ||
129 | #if CONFIG_KEYPAD == RECORDER_PAD | 132 | #if CONFIG_KEYPAD == RECORDER_PAD |
130 | /* inc(h) */ | 133 | /* inc(h) */ |
131 | case BUTTON_UP: | 134 | case BUTTON_UP: |
132 | case BUTTON_UP | BUTTON_REPEAT: | 135 | case BUTTON_UP | BUTTON_REPEAT: |
133 | h = (h+1) % 24; | 136 | h = (h+1) % 24; |
@@ -152,7 +155,7 @@ bool alarm_screen(void) | |||
152 | break; | 155 | break; |
153 | 156 | ||
154 | case BUTTON_NONE: | 157 | case BUTTON_NONE: |
155 | status_draw(false); | 158 | gui_syncstatusbar_draw(&statusbars, false); |
156 | break; | 159 | break; |
157 | 160 | ||
158 | default: | 161 | default: |
diff --git a/apps/bookmark.c b/apps/bookmark.c index c01567848a..4ca828089f 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -49,6 +49,8 @@ | |||
49 | #include "misc.h" | 49 | #include "misc.h" |
50 | #include "abrepeat.h" | 50 | #include "abrepeat.h" |
51 | #include "splash.h" | 51 | #include "splash.h" |
52 | #include "yesno.h" | ||
53 | |||
52 | #define MAX_BOOKMARKS 10 | 54 | #define MAX_BOOKMARKS 10 |
53 | #define MAX_BOOKMARK_SIZE 350 | 55 | #define MAX_BOOKMARK_SIZE 350 |
54 | #define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark" | 56 | #define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark" |
@@ -189,10 +191,6 @@ bool bookmark_mrb_load() | |||
189 | /* ----------------------------------------------------------------------- */ | 191 | /* ----------------------------------------------------------------------- */ |
190 | bool bookmark_autobookmark(void) | 192 | bool bookmark_autobookmark(void) |
191 | { | 193 | { |
192 | /* prompts the user as to create a bookmark */ | ||
193 | bool done = false; | ||
194 | int key = 0; | ||
195 | |||
196 | if (!system_check()) | 194 | if (!system_check()) |
197 | return false; | 195 | return false; |
198 | 196 | ||
@@ -208,42 +206,23 @@ bool bookmark_autobookmark(void) | |||
208 | case BOOKMARK_RECENT_ONLY_YES: | 206 | case BOOKMARK_RECENT_ONLY_YES: |
209 | return write_bookmark(false); | 207 | return write_bookmark(false); |
210 | } | 208 | } |
211 | |||
212 | /* Prompting user to confirm bookmark creation */ | ||
213 | lcd_clear_display(); | ||
214 | #ifdef HAVE_LCD_BITMAP | 209 | #ifdef HAVE_LCD_BITMAP |
215 | lcd_setmargins(0, STATUSBAR_HEIGHT); | 210 | char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), |
216 | lcd_puts(0,0, str(LANG_AUTO_BOOKMARK_QUERY)); | 211 | str(LANG_CONFIRM_WITH_PLAY_RECORDER), |
217 | lcd_puts(0,1, str(LANG_CONFIRM_WITH_PLAY_RECORDER)); | 212 | str(LANG_CANCEL_WITH_ANY_RECORDER)}; |
218 | lcd_puts(0,2, str(LANG_CANCEL_WITH_ANY_RECORDER)); | 213 | struct text_message message={lines, 3}; |
219 | #else | 214 | #else |
220 | status_draw(false); | 215 | char *lines[]={str(LANG_AUTO_BOOKMARK_QUERY), |
221 | lcd_puts(0,0, str(LANG_AUTO_BOOKMARK_QUERY)); | 216 | str(LANG_RESUME_CONFIRM_PLAYER)}; |
222 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); | 217 | struct text_message message={lines, 2}; |
223 | #endif | 218 | #endif |
224 | lcd_update(); | 219 | gui_syncstatusbar_draw(&statusbars, false); |
225 | 220 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) | |
226 | while (!done) | ||
227 | { | 221 | { |
228 | /* Wait for a key to be pushed */ | 222 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) |
229 | key = button_get(true); | 223 | return write_bookmark(false); |
230 | switch (key) | 224 | else |
231 | { | 225 | return write_bookmark(true); |
232 | case SETTINGS_OK: | ||
233 | if (global_settings.autocreatebookmark == | ||
234 | BOOKMARK_RECENT_ONLY_ASK) | ||
235 | return write_bookmark(false); | ||
236 | else | ||
237 | return write_bookmark(true); | ||
238 | break; | ||
239 | |||
240 | default: | ||
241 | /* Handle sys events, ignore button releases & repeats */ | ||
242 | if(default_event_handler(key) || | ||
243 | !(key & (BUTTON_REL|BUTTON_REPEAT))) | ||
244 | done = true; | ||
245 | break; | ||
246 | } | ||
247 | } | 226 | } |
248 | return false; | 227 | return false; |
249 | } | 228 | } |
@@ -434,7 +413,6 @@ bool bookmark_autoload(const char* file) | |||
434 | { | 413 | { |
435 | return false; | 414 | return false; |
436 | } | 415 | } |
437 | |||
438 | fd = open(global_bookmark_file_name, O_RDONLY); | 416 | fd = open(global_bookmark_file_name, O_RDONLY); |
439 | if(fd<0) | 417 | if(fd<0) |
440 | return false; | 418 | return false; |
@@ -444,7 +422,6 @@ bool bookmark_autoload(const char* file) | |||
444 | return false; | 422 | return false; |
445 | } | 423 | } |
446 | close(fd); | 424 | close(fd); |
447 | |||
448 | if(global_settings.autoloadbookmark == BOOKMARK_YES) | 425 | if(global_settings.autoloadbookmark == BOOKMARK_YES) |
449 | { | 426 | { |
450 | return bookmark_load(global_bookmark_file_name, true); | 427 | return bookmark_load(global_bookmark_file_name, true); |
@@ -453,6 +430,7 @@ bool bookmark_autoload(const char* file) | |||
453 | { | 430 | { |
454 | /* Prompting user to confirm bookmark load */ | 431 | /* Prompting user to confirm bookmark load */ |
455 | lcd_clear_display(); | 432 | lcd_clear_display(); |
433 | gui_syncstatusbar_draw(&statusbars, false); | ||
456 | #ifdef HAVE_LCD_BITMAP | 434 | #ifdef HAVE_LCD_BITMAP |
457 | lcd_setmargins(0, STATUSBAR_HEIGHT); | 435 | lcd_setmargins(0, STATUSBAR_HEIGHT); |
458 | lcd_puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY)); | 436 | lcd_puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY)); |
@@ -460,7 +438,6 @@ bool bookmark_autoload(const char* file) | |||
460 | lcd_puts(0,2, str(LANG_BOOKMARK_SELECT_LIST_BOOKMARKS)); | 438 | lcd_puts(0,2, str(LANG_BOOKMARK_SELECT_LIST_BOOKMARKS)); |
461 | lcd_puts(0,3, str(LANG_CANCEL_WITH_ANY_RECORDER)); | 439 | lcd_puts(0,3, str(LANG_CANCEL_WITH_ANY_RECORDER)); |
462 | #else | 440 | #else |
463 | status_draw(false); | ||
464 | lcd_puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY)); | 441 | lcd_puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY)); |
465 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); | 442 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); |
466 | #endif | 443 | #endif |
@@ -857,7 +834,7 @@ static void display_bookmark(const char* bookmark, | |||
857 | global_filename); | 834 | global_filename); |
858 | } | 835 | } |
859 | 836 | ||
860 | status_draw(false); | 837 | gui_syncstatusbar_draw(&statusbars, false); |
861 | lcd_puts_scroll(0,0,global_temp_buffer); | 838 | lcd_puts_scroll(0,0,global_temp_buffer); |
862 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); | 839 | lcd_puts(0,1,str(LANG_RESUME_CONFIRM_PLAYER)); |
863 | if (dot) | 840 | if (dot) |
diff --git a/apps/filetree.c b/apps/filetree.c index 236ee487d7..0a2c855375 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -342,7 +342,6 @@ int ft_enter(struct tree_context* c) | |||
342 | bool play = false; | 342 | bool play = false; |
343 | int start_index=0; | 343 | int start_index=0; |
344 | 344 | ||
345 | lcd_stop_scroll(); | ||
346 | gui_syncsplash(0, true, str(LANG_WAIT)); | 345 | gui_syncsplash(0, true, str(LANG_WAIT)); |
347 | switch ( file->attr & TREE_ATTR_MASK ) { | 346 | switch ( file->attr & TREE_ATTR_MASK ) { |
348 | case TREE_ATTR_M3U: | 347 | case TREE_ATTR_M3U: |
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index ce8b3cd995..551888544f 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -56,6 +56,7 @@ static void splash(struct screen * screen, | |||
56 | #ifdef HAVE_LCD_CHARCELLS | 56 | #ifdef HAVE_LCD_CHARCELLS |
57 | screen->double_height (false); | 57 | screen->double_height (false); |
58 | #endif | 58 | #endif |
59 | screen->stop_scroll(); | ||
59 | vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); | 60 | vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); |
60 | 61 | ||
61 | if(center) { | 62 | if(center) { |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index dad317e9e2..02c69815a1 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -107,17 +107,17 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
107 | #ifdef HAVE_LCD_BITMAP | 107 | #ifdef HAVE_LCD_BITMAP |
108 | if(!global_settings.statusbar) | 108 | if(!global_settings.statusbar) |
109 | return; | 109 | return; |
110 | #endif | 110 | #endif /* HAVE_LCD_BITMAP */ |
111 | 111 | ||
112 | struct screen * display = bar->display; | 112 | struct screen * display = bar->display; |
113 | 113 | ||
114 | #ifdef HAVE_RTC | 114 | #ifdef HAVE_RTC |
115 | struct tm* tm; /* For Time */ | 115 | struct tm* tm; /* For Time */ |
116 | #endif | 116 | #endif /* HAVE_RTC */ |
117 | 117 | ||
118 | #ifdef HAVE_LCD_CHARCELLS | 118 | #ifdef HAVE_LCD_CHARCELLS |
119 | (void)force_redraw; /* players always "redraw" */ | 119 | (void)force_redraw; /* players always "redraw" */ |
120 | #endif | 120 | #endif /* HAVE_LCD_CHARCELLS */ |
121 | 121 | ||
122 | bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); | 122 | bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); |
123 | bar->info.inserted = charger_inserted(); | 123 | bar->info.inserted = charger_inserted(); |
@@ -129,22 +129,22 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
129 | tm = get_time(); | 129 | tm = get_time(); |
130 | bar->info.hour = tm->tm_hour; | 130 | bar->info.hour = tm->tm_hour; |
131 | bar->info.minute = tm->tm_min; | 131 | bar->info.minute = tm->tm_min; |
132 | #endif | 132 | #endif /* HAVE_RTC */ |
133 | 133 | ||
134 | bar->info.shuffle = global_settings.playlist_shuffle; | 134 | bar->info.shuffle = global_settings.playlist_shuffle; |
135 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 135 | #if CONFIG_KEYPAD == IRIVER_H100_PAD |
136 | bar->info.keylock = button_hold(); | 136 | bar->info.keylock = button_hold(); |
137 | #else | 137 | #else |
138 | bar->info.keylock = keys_locked; | 138 | bar->info.keylock = keys_locked; |
139 | #endif | 139 | #endif /* CONFIG_KEYPAD == IRIVER_H100_PAD */ |
140 | bar->info.repeat = global_settings.repeat_mode; | 140 | bar->info.repeat = global_settings.repeat_mode; |
141 | bar->info.playmode = current_playmode(); | 141 | bar->info.playmode = current_playmode(); |
142 | #if CONFIG_LED == LED_VIRTUAL | 142 | if(!display->has_disk_led) |
143 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ | 143 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ |
144 | #endif | 144 | |
145 | #ifdef HAVE_USB_POWER | 145 | #ifdef HAVE_USB_POWER |
146 | bar->info.usb_power = usb_powered(); | 146 | bar->info.usb_power = usb_powered(); |
147 | #endif | 147 | #endif /* HAVE_USB_POWER */ |
148 | 148 | ||
149 | /* only redraw if forced to, or info has changed */ | 149 | /* only redraw if forced to, or info has changed */ |
150 | if (force_redraw || | 150 | if (force_redraw || |
@@ -161,7 +161,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
161 | 161 | ||
162 | /* players always "redraw" */ | 162 | /* players always "redraw" */ |
163 | { | 163 | { |
164 | #endif | 164 | #endif /* HAVE_LCD_BITMAP */ |
165 | 165 | ||
166 | #ifdef HAVE_CHARGING | 166 | #ifdef HAVE_CHARGING |
167 | if (bar->info.inserted) { | 167 | if (bar->info.inserted) { |
@@ -220,7 +220,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
220 | STATUSBAR_PLUG_X_POS, | 220 | STATUSBAR_PLUG_X_POS, |
221 | STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, | 221 | STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, |
222 | STATUSBAR_HEIGHT); | 222 | STATUSBAR_HEIGHT); |
223 | #endif | 223 | #endif /* HAVE_USB_POWER */ |
224 | 224 | ||
225 | bar->info.redraw_volume = gui_statusbar_icon_volume(bar, | 225 | bar->info.redraw_volume = gui_statusbar_icon_volume(bar, |
226 | bar->info.volume); | 226 | bar->info.volume); |
@@ -232,7 +232,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
232 | case REPEAT_AB: | 232 | case REPEAT_AB: |
233 | gui_statusbar_icon_play_mode(display, Icon_RepeatAB); | 233 | gui_statusbar_icon_play_mode(display, Icon_RepeatAB); |
234 | break; | 234 | break; |
235 | #endif | 235 | #endif /* AB_REPEAT_ENABLE */ |
236 | 236 | ||
237 | case REPEAT_ONE: | 237 | case REPEAT_ONE: |
238 | gui_statusbar_icon_play_mode(display, Icon_RepeatOne); | 238 | gui_statusbar_icon_play_mode(display, Icon_RepeatOne); |
@@ -249,14 +249,12 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
249 | gui_statusbar_icon_lock(display); | 249 | gui_statusbar_icon_lock(display); |
250 | #ifdef HAVE_RTC | 250 | #ifdef HAVE_RTC |
251 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); | 251 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); |
252 | #endif | 252 | #endif /* HAVE_RTC */ |
253 | #if CONFIG_LED == LED_VIRTUAL | 253 | if(!display->has_disk_led && bar->info.led) |
254 | if (bar->info.led) | 254 | gui_statusbar_led(display); |
255 | statusbar_led(); | ||
256 | #endif | ||
257 | display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT); | 255 | display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT); |
258 | bar->lastinfo = bar->info; | 256 | bar->lastinfo = bar->info; |
259 | #endif | 257 | #endif /* HAVE_LCD_BITMAP */ |
260 | } | 258 | } |
261 | 259 | ||
262 | 260 | ||
@@ -284,7 +282,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
284 | display->icon(ICON_AUDIO, audio); | 282 | display->icon(ICON_AUDIO, audio); |
285 | display->icon(ICON_PARAM, param); | 283 | display->icon(ICON_PARAM, param); |
286 | display->icon(ICON_USB, usb); | 284 | display->icon(ICON_USB, usb); |
287 | #endif | 285 | #endif /* HAVE_LCD_CHARCELLS */ |
288 | } | 286 | } |
289 | 287 | ||
290 | #ifdef HAVE_LCD_BITMAP | 288 | #ifdef HAVE_LCD_BITMAP |
@@ -448,7 +446,6 @@ void gui_statusbar_icon_lock(struct screen * display) | |||
448 | STATUSBAR_Y_POS, 5, 8); | 446 | STATUSBAR_Y_POS, 5, 8); |
449 | } | 447 | } |
450 | 448 | ||
451 | #if CONFIG_LED == LED_VIRTUAL | ||
452 | /* | 449 | /* |
453 | * no real LED: disk activity in status bar | 450 | * no real LED: disk activity in status bar |
454 | */ | 451 | */ |
@@ -459,8 +456,6 @@ void gui_statusbar_led(struct screen * display) | |||
459 | STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH, | 456 | STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH, |
460 | STATUSBAR_HEIGHT); | 457 | STATUSBAR_HEIGHT); |
461 | } | 458 | } |
462 | #endif | ||
463 | |||
464 | 459 | ||
465 | #ifdef HAVE_RTC | 460 | #ifdef HAVE_RTC |
466 | /* | 461 | /* |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index afbdce6d5a..77ceefd69f 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -42,9 +42,8 @@ struct status_info { | |||
42 | bool keylock; | 42 | bool keylock; |
43 | bool battery_safe; | 43 | bool battery_safe; |
44 | bool redraw_volume; /* true if the volume gauge needs updating */ | 44 | bool redraw_volume; /* true if the volume gauge needs updating */ |
45 | #if CONFIG_LED == LED_VIRTUAL | ||
46 | bool led; /* disk LED simulation in the status bar */ | 45 | bool led; /* disk LED simulation in the status bar */ |
47 | #endif | 46 | |
48 | #ifdef HAVE_USB_POWER | 47 | #ifdef HAVE_USB_POWER |
49 | bool usb_power; | 48 | bool usb_power; |
50 | #endif | 49 | #endif |
@@ -100,9 +99,8 @@ void gui_statusbar_icon_play_state(struct screen * display, int state); | |||
100 | void gui_statusbar_icon_play_mode(struct screen * display, int mode); | 99 | void gui_statusbar_icon_play_mode(struct screen * display, int mode); |
101 | void gui_statusbar_icon_shuffle(struct screen * display); | 100 | void gui_statusbar_icon_shuffle(struct screen * display); |
102 | void gui_statusbar_icon_lock(struct screen * display); | 101 | void gui_statusbar_icon_lock(struct screen * display); |
103 | #if CONFIG_LED == LED_VIRTUAL | ||
104 | void gui_statusbar_led(struct screen * display); | 102 | void gui_statusbar_led(struct screen * display); |
105 | #endif | 103 | |
106 | 104 | ||
107 | #ifdef HAVE_RTC | 105 | #ifdef HAVE_RTC |
108 | void gui_statusbar_time(struct screen * display, int hour, int minute); | 106 | void gui_statusbar_time(struct screen * display, int hour, int minute); |
diff --git a/apps/gui/textarea.c b/apps/gui/textarea.c index d73f20d0e7..28ca2c5b29 100644 --- a/apps/gui/textarea.c +++ b/apps/gui/textarea.c | |||
@@ -18,6 +18,7 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "textarea.h" | 20 | #include "textarea.h" |
21 | #include "font.h" | ||
21 | 22 | ||
22 | void gui_textarea_clear(struct screen * display) | 23 | void gui_textarea_clear(struct screen * display) |
23 | { | 24 | { |
@@ -27,6 +28,7 @@ void gui_textarea_clear(struct screen * display) | |||
27 | screen_clear_area(display, 0, y_start, display->width, y_end - y_start); | 28 | screen_clear_area(display, 0, y_start, display->width, y_end - y_start); |
28 | display->stop_scroll(); | 29 | display->stop_scroll(); |
29 | screen_set_ymargin(display, y_start); | 30 | screen_set_ymargin(display, y_start); |
31 | display->setfont(FONT_SYSFIXED); | ||
30 | #else | 32 | #else |
31 | display->clear_display(); | 33 | display->clear_display(); |
32 | #endif | 34 | #endif |
@@ -48,7 +50,7 @@ int gui_textarea_put_message(struct screen * display, | |||
48 | int i; | 50 | int i; |
49 | gui_textarea_clear(display); | 51 | gui_textarea_clear(display); |
50 | for(i=0;i<message->nb_lines && i+ystart<display->nb_lines;i++) | 52 | for(i=0;i<message->nb_lines && i+ystart<display->nb_lines;i++) |
51 | display->puts(0, i+ystart, message->message_lines[i]); | 53 | display->puts_scroll(0, i+ystart, message->message_lines[i]); |
52 | gui_textarea_update(display); | 54 | gui_textarea_update(display); |
53 | return(i); | 55 | return(i); |
54 | } | 56 | } |
diff --git a/apps/onplay.c b/apps/onplay.c index 704e0c04ec..df4ff15db9 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "tree.h" | 39 | #include "tree.h" |
40 | #include "buffer.h" | 40 | #include "buffer.h" |
41 | #include "settings.h" | 41 | #include "settings.h" |
42 | #include "status.h" | 42 | #include "statusbar.h" |
43 | #include "playlist_viewer.h" | 43 | #include "playlist_viewer.h" |
44 | #include "talk.h" | 44 | #include "talk.h" |
45 | #include "onplay.h" | 45 | #include "onplay.h" |
@@ -220,7 +220,7 @@ static bool add_to_playlist(int position, bool queue) | |||
220 | if (global_settings.playlist_shuffle) | 220 | if (global_settings.playlist_shuffle) |
221 | playlist_shuffle(current_tick, -1); | 221 | playlist_shuffle(current_tick, -1); |
222 | playlist_start(0,0); | 222 | playlist_start(0,0); |
223 | status_draw(false); | 223 | gui_syncstatusbar_draw(&statusbars, false); |
224 | onplay_result = ONPLAY_START_PLAY; | 224 | onplay_result = ONPLAY_START_PLAY; |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c index fb06a0dc7b..385532a6f3 100644 --- a/apps/player/keyboard.c +++ b/apps/player/keyboard.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "lcd-player-charset.h" | 27 | #include "lcd-player-charset.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "status.h" | 29 | #include "statusbar.h" |
30 | #include "talk.h" | 30 | #include "talk.h" |
31 | #include "misc.h" | 31 | #include "misc.h" |
32 | 32 | ||
@@ -153,7 +153,7 @@ int kbd_input(char* text, int buflen) | |||
153 | lcd_puts(1, 1, temptext); | 153 | lcd_puts(1, 1, temptext); |
154 | lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR); | 154 | lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR); |
155 | 155 | ||
156 | status_draw(true); | 156 | gui_syncstatusbar_draw(&statusbars, true); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* The default action is to redraw */ | 159 | /* The default action is to redraw */ |
@@ -251,7 +251,7 @@ int kbd_input(char* text, int buflen) | |||
251 | break; | 251 | break; |
252 | 252 | ||
253 | case BUTTON_NONE: | 253 | case BUTTON_NONE: |
254 | status_draw(false); | 254 | gui_syncstatusbar_draw(&statusbars, false); |
255 | redraw = false; | 255 | redraw = false; |
256 | break; | 256 | break; |
257 | 257 | ||
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index baba77bc52..1306a1d770 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -73,11 +73,9 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ | 73 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #if CONFIG_LED == LED_VIRTUAL | ||
77 | /* Disk/MMC activity */ | 76 | /* Disk/MMC activity */ |
78 | const unsigned char bitmap_icon_disk[12] = | 77 | const unsigned char bitmap_icon_disk[12] = |
79 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; | 78 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; |
80 | #endif | ||
81 | 79 | ||
82 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ | 80 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ |
83 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 81 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
@@ -341,130 +339,6 @@ const unsigned char rockbox160x53x2[] = { | |||
341 | #endif | 339 | #endif |
342 | 340 | ||
343 | /* | 341 | /* |
344 | * Print battery icon to status bar | ||
345 | */ | ||
346 | void statusbar_icon_battery(int percent) | ||
347 | { | ||
348 | int fill; | ||
349 | char buffer[5]; | ||
350 | unsigned int width, height; | ||
351 | |||
352 | /* fill battery */ | ||
353 | fill = percent; | ||
354 | if (fill < 0) | ||
355 | fill = 0; | ||
356 | if (fill > 100) | ||
357 | fill = 100; | ||
358 | |||
359 | #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */ | ||
360 | /* show graphical animation when charging instead of numbers */ | ||
361 | if ((global_settings.battery_display) && | ||
362 | (charge_state != 1) && | ||
363 | (percent > -1)) { | ||
364 | #else /* all others */ | ||
365 | if (global_settings.battery_display && (percent > -1)) { | ||
366 | #endif | ||
367 | /* Numeric display */ | ||
368 | snprintf(buffer, sizeof(buffer), "%3d", fill); | ||
369 | lcd_setfont(FONT_SYSFIXED); | ||
370 | lcd_getstringsize(buffer, &width, &height); | ||
371 | if (height <= STATUSBAR_HEIGHT) | ||
372 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - | ||
373 | width/2, STATUSBAR_Y_POS, buffer); | ||
374 | lcd_setfont(FONT_UI); | ||
375 | |||
376 | } | ||
377 | else { | ||
378 | /* draw battery */ | ||
379 | lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); | ||
380 | lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2, | ||
381 | STATUSBAR_Y_POS + 4); | ||
382 | |||
383 | fill = fill * 15 / 100; | ||
384 | lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); | ||
385 | } | ||
386 | |||
387 | if (percent == -1) { | ||
388 | lcd_setfont(FONT_SYSFIXED); | ||
389 | lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - 4, | ||
390 | STATUSBAR_Y_POS, "?"); | ||
391 | lcd_setfont(FONT_UI); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | /* | ||
396 | * Print volume gauge to status bar | ||
397 | */ | ||
398 | bool statusbar_icon_volume(int percent) | ||
399 | { | ||
400 | int i; | ||
401 | int volume; | ||
402 | int vol; | ||
403 | char buffer[4]; | ||
404 | unsigned int width, height; | ||
405 | bool needs_redraw = false; | ||
406 | int type = global_settings.volume_type; | ||
407 | static long switch_tick; | ||
408 | static int last_volume = -1; /* -1 means "first update ever" */ | ||
409 | |||
410 | volume = percent; | ||
411 | if (volume < 0) | ||
412 | volume = 0; | ||
413 | if (volume > 100) | ||
414 | volume = 100; | ||
415 | |||
416 | if (volume == 0) { | ||
417 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute], | ||
418 | ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, | ||
419 | STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); | ||
420 | } | ||
421 | else { | ||
422 | /* We want to redraw the icon later on */ | ||
423 | if (last_volume != volume && last_volume >= 0) { | ||
424 | switch_tick = current_tick + HZ; | ||
425 | } | ||
426 | |||
427 | /* If the timeout hasn't yet been reached, we show it numerically | ||
428 | and tell the caller that we want to be called again */ | ||
429 | if (TIME_BEFORE(current_tick,switch_tick)) { | ||
430 | type = 1; | ||
431 | needs_redraw = true; | ||
432 | } | ||
433 | |||
434 | /* display volume level numerical? */ | ||
435 | if (type) | ||
436 | { | ||
437 | snprintf(buffer, sizeof(buffer), "%2d", percent); | ||
438 | lcd_setfont(FONT_SYSFIXED); | ||
439 | lcd_getstringsize(buffer, &width, &height); | ||
440 | if (height <= STATUSBAR_HEIGHT) | ||
441 | lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - | ||
442 | width/2, STATUSBAR_Y_POS, buffer); | ||
443 | lcd_setfont(FONT_UI); | ||
444 | } else { | ||
445 | /* display volume bar */ | ||
446 | vol = volume * 14 / 100; | ||
447 | for(i=0; i < vol; i++) { | ||
448 | lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2, | ||
449 | STATUSBAR_Y_POS + 6); | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | last_volume = volume; | ||
454 | |||
455 | return needs_redraw; | ||
456 | } | ||
457 | |||
458 | /* | ||
459 | * Print play state to status bar | ||
460 | */ | ||
461 | void statusbar_icon_play_state(int state) | ||
462 | { | ||
463 | lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, | ||
464 | STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); | ||
465 | } | ||
466 | |||
467 | /* | ||
468 | * Print play mode to status bar | 342 | * Print play mode to status bar |
469 | */ | 343 | */ |
470 | void statusbar_icon_play_mode(int mode) | 344 | void statusbar_icon_play_mode(int mode) |
@@ -478,59 +352,6 @@ void statusbar_icon_play_mode(int mode) | |||
478 | */ | 352 | */ |
479 | void statusbar_icon_shuffle(void) | 353 | void statusbar_icon_shuffle(void) |
480 | { | 354 | { |
481 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, | 355 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, |
482 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); | 356 | STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT); |
483 | } | 357 | } |
484 | |||
485 | /* | ||
486 | * Print lock when keys are locked | ||
487 | */ | ||
488 | void statusbar_icon_lock(void) | ||
489 | { | ||
490 | lcd_mono_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS, | ||
491 | STATUSBAR_Y_POS, 5, 8); | ||
492 | } | ||
493 | |||
494 | #if CONFIG_LED == LED_VIRTUAL | ||
495 | /* | ||
496 | * no real LED: disk activity in status bar | ||
497 | */ | ||
498 | void statusbar_led(void) | ||
499 | { | ||
500 | lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, | ||
501 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT); | ||
502 | } | ||
503 | #endif | ||
504 | |||
505 | #ifdef HAVE_RTC | ||
506 | /* | ||
507 | * Print time to status bar | ||
508 | */ | ||
509 | void statusbar_time(int hour, int minute) | ||
510 | { | ||
511 | unsigned char buffer[6]; | ||
512 | unsigned int width, height; | ||
513 | |||
514 | if ( hour >= 0 && | ||
515 | hour <= 23 && | ||
516 | minute >= 0 && | ||
517 | minute <= 59 ) { | ||
518 | if ( global_settings.timeformat ) { /* 12 hour clock */ | ||
519 | hour %= 12; | ||
520 | if ( hour == 0 ) { | ||
521 | hour += 12; | ||
522 | } | ||
523 | } | ||
524 | snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); | ||
525 | } | ||
526 | else { | ||
527 | strncpy(buffer, "--:--", sizeof buffer); | ||
528 | } | ||
529 | |||
530 | lcd_setfont(FONT_SYSFIXED); | ||
531 | lcd_getstringsize(buffer, &width, &height); | ||
532 | if (height <= STATUSBAR_HEIGHT) | ||
533 | lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer); | ||
534 | lcd_setfont(FONT_UI); | ||
535 | } | ||
536 | #endif | ||
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 6ffcc9cb80..c996fd92aa 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -74,9 +74,7 @@ enum icons_7x8 { | |||
74 | extern const unsigned char bitmap_icons_5x8[1][5]; | 74 | extern const unsigned char bitmap_icons_5x8[1][5]; |
75 | extern const unsigned char bitmap_icons_6x8[LastIcon][6]; | 75 | extern const unsigned char bitmap_icons_6x8[LastIcon][6]; |
76 | extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; | 76 | extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; |
77 | #if CONFIG_LED == LED_VIRTUAL | ||
78 | extern const unsigned char bitmap_icon_disk[]; | 77 | extern const unsigned char bitmap_icon_disk[]; |
79 | #endif | ||
80 | 78 | ||
81 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 79 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
82 | extern const unsigned char rockbox112x37[]; | 80 | extern const unsigned char rockbox112x37[]; |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 5ff340b596..31c0643e3c 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "font.h" | 27 | #include "font.h" |
28 | #include "screens.h" | 28 | #include "screens.h" |
29 | #include "status.h" | 29 | #include "statusbar.h" |
30 | #include "talk.h" | 30 | #include "talk.h" |
31 | #include "settings.h" | 31 | #include "settings.h" |
32 | #include "misc.h" | 32 | #include "misc.h" |
33 | #include "buttonbar.h" | ||
33 | 34 | ||
34 | #define KEYBOARD_MARGIN 3 | 35 | #define KEYBOARD_MARGIN 3 |
35 | 36 | ||
@@ -177,7 +178,11 @@ int kbd_input(char* text, int buflen) | |||
177 | char outline[256]; | 178 | char outline[256]; |
178 | struct font* font = font_get(FONT_SYSFIXED); | 179 | struct font* font = font_get(FONT_SYSFIXED); |
179 | int button, lastbutton = 0; | 180 | int button, lastbutton = 0; |
180 | 181 | #ifdef HAS_BUTTONBAR | |
182 | struct gui_buttonbar buttonbar; | ||
183 | gui_buttonbar_init(&buttonbar); | ||
184 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | ||
185 | #endif | ||
181 | lcd_setfont(FONT_SYSFIXED); | 186 | lcd_setfont(FONT_SYSFIXED); |
182 | font_w = font->maxwidth; | 187 | font_w = font->maxwidth; |
183 | font_h = font->height; | 188 | font_h = font->height; |
@@ -229,10 +234,10 @@ int kbd_input(char* text, int buflen) | |||
229 | i = (curpos + 1) * font_w; | 234 | i = (curpos + 1) * font_w; |
230 | lcd_vline(i, main_y, main_y + font_h); | 235 | lcd_vline(i, main_y, main_y + font_h); |
231 | 236 | ||
232 | #if CONFIG_KEYPAD == RECORDER_PAD | 237 | #ifdef HAS_BUTTONBAR |
233 | /* draw the status bar */ | 238 | /* draw the status bar */ |
234 | buttonbar_set("Shift", "OK", "Del"); | 239 | gui_buttonbar_set(&buttonbar, "Shift", "OK", "Del"); |
235 | buttonbar_draw(); | 240 | gui_buttonbar_draw(&buttonbar); |
236 | #endif | 241 | #endif |
237 | 242 | ||
238 | #ifdef KBD_MODES | 243 | #ifdef KBD_MODES |
@@ -245,8 +250,7 @@ int kbd_input(char* text, int buflen) | |||
245 | lcd_set_drawmode(DRMODE_SOLID); | 250 | lcd_set_drawmode(DRMODE_SOLID); |
246 | } | 251 | } |
247 | 252 | ||
248 | status_draw(true); | 253 | gui_syncstatusbar_draw(&statusbars, true); |
249 | |||
250 | lcd_update(); | 254 | lcd_update(); |
251 | } | 255 | } |
252 | 256 | ||
@@ -454,7 +458,7 @@ int kbd_input(char* text, int buflen) | |||
454 | #endif /* !KBD_MODES */ | 458 | #endif /* !KBD_MODES */ |
455 | 459 | ||
456 | case BUTTON_NONE: | 460 | case BUTTON_NONE: |
457 | status_draw(false); | 461 | gui_syncstatusbar_draw(&statusbars, false); |
458 | redraw = false; | 462 | redraw = false; |
459 | break; | 463 | break; |
460 | 464 | ||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index ff1d49bd2a..a6b540dd3d 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "textarea.h" | 56 | #include "textarea.h" |
57 | #include "splash.h" | 57 | #include "splash.h" |
58 | #include "yesno.h" | 58 | #include "yesno.h" |
59 | #include "buttonbar.h" | ||
59 | #include "power.h" | 60 | #include "power.h" |
60 | 61 | ||
61 | #ifdef CONFIG_TUNER | 62 | #ifdef CONFIG_TUNER |
@@ -298,9 +299,13 @@ bool radio_screen(void) | |||
298 | int hours, minutes; | 299 | int hours, minutes; |
299 | bool keep_playing = false; | 300 | bool keep_playing = false; |
300 | bool statusbar = global_settings.statusbar; | 301 | bool statusbar = global_settings.statusbar; |
302 | #ifdef HAS_BUTTONBAR | ||
303 | struct gui_buttonbar buttonbar; | ||
304 | gui_buttonbar_init(&buttonbar); | ||
305 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | ||
306 | #endif | ||
301 | /* always display status bar in radio screen for now */ | 307 | /* always display status bar in radio screen for now */ |
302 | global_settings.statusbar = true; | 308 | global_settings.statusbar = true; |
303 | |||
304 | FOR_NB_SCREENS(i){ | 309 | FOR_NB_SCREENS(i){ |
305 | gui_textarea_clear(&screens[i]); | 310 | gui_textarea_clear(&screens[i]); |
306 | screen_set_xmargin(&screens[i],0); | 311 | screen_set_xmargin(&screens[i],0); |
@@ -377,8 +382,8 @@ bool radio_screen(void) | |||
377 | radio_mode = RADIO_PRESET_MODE; | 382 | radio_mode = RADIO_PRESET_MODE; |
378 | #endif | 383 | #endif |
379 | 384 | ||
380 | #if CONFIG_KEYPAD == RECORDER_PAD | 385 | #ifdef HAS_BUTTONBAR |
381 | buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), | 386 | gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), |
382 | str(LANG_FM_BUTTONBAR_RECORD)); | 387 | str(LANG_FM_BUTTONBAR_RECORD)); |
383 | #endif | 388 | #endif |
384 | 389 | ||
@@ -613,10 +618,10 @@ bool radio_screen(void) | |||
613 | gui_textarea_clear(&screens[i]); | 618 | gui_textarea_clear(&screens[i]); |
614 | screen_set_xmargin(&screens[i],0); | 619 | screen_set_xmargin(&screens[i],0); |
615 | } | 620 | } |
616 | #if CONFIG_KEYPAD == RECORDER_PAD | 621 | #ifdef HAS_BUTTONBAR |
617 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 622 | gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), |
618 | str(LANG_FM_BUTTONBAR_PRESETS), | 623 | str(LANG_FM_BUTTONBAR_PRESETS), |
619 | str(LANG_FM_BUTTONBAR_RECORD)); | 624 | str(LANG_FM_BUTTONBAR_RECORD)); |
620 | #endif | 625 | #endif |
621 | update_screen = true; | 626 | update_screen = true; |
622 | break; | 627 | break; |
@@ -646,10 +651,11 @@ bool radio_screen(void) | |||
646 | gui_textarea_clear(&screens[i]); | 651 | gui_textarea_clear(&screens[i]); |
647 | screen_set_xmargin(&screens[i],0); | 652 | screen_set_xmargin(&screens[i],0); |
648 | } | 653 | } |
649 | #if CONFIG_KEYPAD == RECORDER_PAD | 654 | #ifdef HAS_BUTTONBAR |
650 | buttonbar_set(str(LANG_BUTTONBAR_MENU), | 655 | gui_buttonbar_set(&buttonbar, |
651 | str(LANG_FM_BUTTONBAR_PRESETS), | 656 | str(LANG_BUTTONBAR_MENU), |
652 | str(LANG_FM_BUTTONBAR_RECORD)); | 657 | str(LANG_FM_BUTTONBAR_PRESETS), |
658 | str(LANG_FM_BUTTONBAR_RECORD)); | ||
653 | #endif | 659 | #endif |
654 | update_screen = true; | 660 | update_screen = true; |
655 | break; | 661 | break; |
@@ -807,16 +813,16 @@ bool radio_screen(void) | |||
807 | screens[i].puts_scroll(0, top_of_screen + 4, buf); | 813 | screens[i].puts_scroll(0, top_of_screen + 4, buf); |
808 | } | 814 | } |
809 | } | 815 | } |
810 | 816 | ||
811 | #if CONFIG_KEYPAD == RECORDER_PAD | 817 | #if HAS_BUTTONBAR |
812 | buttonbar_draw(); | 818 | gui_buttonbar_draw(&buttonbar); |
813 | #endif | 819 | #endif |
814 | FOR_NB_SCREENS(i) | 820 | FOR_NB_SCREENS(i) |
815 | gui_textarea_update(&screens[i]); | 821 | gui_textarea_update(&screens[i]); |
816 | } | 822 | } |
817 | /* Only force the redraw if update_screen is true */ | 823 | /* Only force the redraw if update_screen is true */ |
818 | gui_syncstatusbar_draw(&statusbars,true); | 824 | gui_syncstatusbar_draw(&statusbars,true); |
819 | 825 | ||
820 | update_screen = false; | 826 | update_screen = false; |
821 | } | 827 | } |
822 | 828 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index eda56a5bf9..63cd513c78 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include "icons.h" | 45 | #include "icons.h" |
46 | #include "screens.h" | 46 | #include "screens.h" |
47 | #include "peakmeter.h" | 47 | #include "peakmeter.h" |
48 | #include "status.h" | 48 | #include "statusbar.h" |
49 | #include "menu.h" | 49 | #include "menu.h" |
50 | #include "sound_menu.h" | 50 | #include "sound_menu.h" |
51 | #include "timefuncs.h" | 51 | #include "timefuncs.h" |
@@ -831,7 +831,7 @@ bool recording_screen(void) | |||
831 | lcd_puts(0, 6, buf); | 831 | lcd_puts(0, 6, buf); |
832 | } | 832 | } |
833 | 833 | ||
834 | status_draw(true); | 834 | gui_syncstatusbar_draw(&statusbars, true); |
835 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 835 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
836 | 836 | ||
837 | lcd_update(); | 837 | lcd_update(); |
@@ -860,7 +860,7 @@ bool recording_screen(void) | |||
860 | if (audio_stat & AUDIO_STATUS_ERROR) | 860 | if (audio_stat & AUDIO_STATUS_ERROR) |
861 | { | 861 | { |
862 | gui_syncsplash(0, true, str(LANG_DISK_FULL)); | 862 | gui_syncsplash(0, true, str(LANG_DISK_FULL)); |
863 | status_draw(true); | 863 | gui_syncstatusbar_draw(&statusbars, true); |
864 | lcd_update(); | 864 | lcd_update(); |
865 | audio_error_clear(); | 865 | audio_error_clear(); |
866 | 866 | ||
diff --git a/apps/screen_access.c b/apps/screen_access.c index 6bceb1747e..db64e27199 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -38,6 +38,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type) | |||
38 | #ifdef HAVE_REMOTE_LCD | 38 | #ifdef HAVE_REMOTE_LCD |
39 | case SCREEN_REMOTE: | 39 | case SCREEN_REMOTE: |
40 | screen->depth=LCD_REMOTE_DEPTH; | 40 | screen->depth=LCD_REMOTE_DEPTH; |
41 | screen->has_disk_led=false; | ||
42 | |||
41 | #if 1 /* all remote LCDs are bitmapped so far */ | 43 | #if 1 /* all remote LCDs are bitmapped so far */ |
42 | screen->width=LCD_REMOTE_WIDTH; | 44 | screen->width=LCD_REMOTE_WIDTH; |
43 | screen->height=LCD_REMOTE_HEIGHT; | 45 | screen->height=LCD_REMOTE_HEIGHT; |
@@ -87,13 +89,17 @@ void screen_init(struct screen * screen, enum screen_type screen_type) | |||
87 | screen->clear_display=&lcd_remote_clear_display; | 89 | screen->clear_display=&lcd_remote_clear_display; |
88 | screen->update=&lcd_remote_update; | 90 | screen->update=&lcd_remote_update; |
89 | screen->puts=&lcd_remote_puts; | 91 | screen->puts=&lcd_remote_puts; |
90 | |||
91 | break; | 92 | break; |
92 | #endif /* HAVE_REMOTE_LCD */ | 93 | #endif /* HAVE_REMOTE_LCD */ |
93 | 94 | ||
94 | case SCREEN_MAIN: | 95 | case SCREEN_MAIN: |
95 | default: | 96 | default: |
96 | screen->depth=LCD_DEPTH; | 97 | screen->depth=LCD_DEPTH; |
98 | #if CONFIG_LED == LED_VIRTUAL | ||
99 | screen->has_disk_led=false; | ||
100 | #else | ||
101 | screen->has_disk_led=true; | ||
102 | #endif | ||
97 | #ifdef HAVE_LCD_BITMAP | 103 | #ifdef HAVE_LCD_BITMAP |
98 | screen->width=LCD_WIDTH; | 104 | screen->width=LCD_WIDTH; |
99 | screen->height=LCD_HEIGHT; | 105 | screen->height=LCD_HEIGHT; |
diff --git a/apps/screen_access.h b/apps/screen_access.h index 782bd9219d..7f235a2480 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -54,6 +54,7 @@ struct screen | |||
54 | int depth; | 54 | int depth; |
55 | int char_width; | 55 | int char_width; |
56 | int char_height; | 56 | int char_height; |
57 | bool has_disk_led; | ||
57 | #ifdef HAS_BUTTONBAR | 58 | #ifdef HAS_BUTTONBAR |
58 | bool has_buttonbar; | 59 | bool has_buttonbar; |
59 | #endif | 60 | #endif |
diff --git a/apps/screens.c b/apps/screens.c index f861bb76c9..acfcd01dbe 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -48,6 +48,8 @@ | |||
48 | #include "abrepeat.h" | 48 | #include "abrepeat.h" |
49 | #include "gwps-common.h" | 49 | #include "gwps-common.h" |
50 | #include "splash.h" | 50 | #include "splash.h" |
51 | #include "statusbar.h" | ||
52 | |||
51 | #if defined(HAVE_LCD_BITMAP) | 53 | #if defined(HAVE_LCD_BITMAP) |
52 | #include "widgets.h" | 54 | #include "widgets.h" |
53 | #endif | 55 | #endif |
@@ -108,7 +110,7 @@ void usb_display_info(void) | |||
108 | lcd_mono_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2, | 110 | lcd_mono_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2, |
109 | LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo, | 111 | LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo, |
110 | BMPHEIGHT_usb_logo); | 112 | BMPHEIGHT_usb_logo); |
111 | status_draw(true); | 113 | gui_syncstatusbar_draw(&statusbars, true); |
112 | lcd_update(); | 114 | lcd_update(); |
113 | #else | 115 | #else |
114 | lcd_double_height(false); | 116 | lcd_double_height(false); |
@@ -116,7 +118,7 @@ void usb_display_info(void) | |||
116 | status_set_param(false); | 118 | status_set_param(false); |
117 | status_set_audio(false); | 119 | status_set_audio(false); |
118 | status_set_usb(true); | 120 | status_set_usb(true); |
119 | status_draw(false); | 121 | gui_syncstatusbar_draw(&statusbars, false); |
120 | #endif | 122 | #endif |
121 | } | 123 | } |
122 | 124 | ||
@@ -138,7 +140,7 @@ void usb_screen(void) | |||
138 | 140 | ||
139 | #endif | 141 | #endif |
140 | 142 | ||
141 | status_draw(false); | 143 | gui_syncstatusbar_draw(&statusbars, false); |
142 | } | 144 | } |
143 | } | 145 | } |
144 | #ifdef HAVE_LCD_CHARCELLS | 146 | #ifdef HAVE_LCD_CHARCELLS |
@@ -358,7 +360,7 @@ int charging_screen(void) | |||
358 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); | 360 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); |
359 | #endif | 361 | #endif |
360 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); | 362 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); |
361 | status_draw(true); | 363 | gui_syncstatusbar_draw(&statusbars, true); |
362 | 364 | ||
363 | #ifdef HAVE_LCD_CHARCELLS | 365 | #ifdef HAVE_LCD_CHARCELLS |
364 | logo_lock_patterns(true); | 366 | logo_lock_patterns(true); |
@@ -367,7 +369,7 @@ int charging_screen(void) | |||
367 | 369 | ||
368 | do | 370 | do |
369 | { | 371 | { |
370 | status_draw(false); | 372 | gui_syncstatusbar_draw(&statusbars, false); |
371 | charging_display_info(true); | 373 | charging_display_info(true); |
372 | button = button_get_w_tmo(HZ/3); | 374 | button = button_get_w_tmo(HZ/3); |
373 | if (button == BUTTON_ON) | 375 | if (button == BUTTON_ON) |
@@ -990,7 +992,7 @@ bool set_time_screen(const char* string, struct tm *tm) | |||
990 | lcd_puts(0, 4, str(LANG_TIME_SET)); | 992 | lcd_puts(0, 4, str(LANG_TIME_SET)); |
991 | lcd_puts(0, 5, str(LANG_TIME_REVERT)); | 993 | lcd_puts(0, 5, str(LANG_TIME_REVERT)); |
992 | #ifdef HAVE_LCD_BITMAP | 994 | #ifdef HAVE_LCD_BITMAP |
993 | status_draw(true); | 995 | gui_syncstatusbar_draw(&statusbars, true); |
994 | #endif | 996 | #endif |
995 | lcd_update(); | 997 | lcd_update(); |
996 | 998 | ||
@@ -1186,7 +1188,7 @@ bool browse_id3(void) | |||
1186 | char* body; | 1188 | char* body; |
1187 | 1189 | ||
1188 | lcd_clear_display(); | 1190 | lcd_clear_display(); |
1189 | status_draw(true); | 1191 | gui_syncstatusbar_draw(&statusbars, true); |
1190 | line = draw_id3_item(line, top, LANG_ID3_TITLE, id3->title); | 1192 | line = draw_id3_item(line, top, LANG_ID3_TITLE, id3->title); |
1191 | line = draw_id3_item(line, top, LANG_ID3_ARTIST, id3->artist); | 1193 | line = draw_id3_item(line, top, LANG_ID3_ARTIST, id3->artist); |
1192 | line = draw_id3_item(line, top, LANG_ID3_ALBUM, id3->album); | 1194 | line = draw_id3_item(line, top, LANG_ID3_ALBUM, id3->album); |
@@ -1260,7 +1262,7 @@ bool browse_id3(void) | |||
1260 | 1262 | ||
1261 | while (!exit && (top == old_top)) | 1263 | while (!exit && (top == old_top)) |
1262 | { | 1264 | { |
1263 | status_draw(false); | 1265 | gui_syncstatusbar_draw(&statusbars, false); |
1264 | lcd_update(); | 1266 | lcd_update(); |
1265 | button = button_get_w_tmo(HZ / 2); | 1267 | button = button_get_w_tmo(HZ / 2); |
1266 | 1268 | ||
diff --git a/apps/sleeptimer.c b/apps/sleeptimer.c index 4e6ca5313e..982cbe621a 100644 --- a/apps/sleeptimer.c +++ b/apps/sleeptimer.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "power.h" | 29 | #include "power.h" |
30 | #include "powermgmt.h" | 30 | #include "powermgmt.h" |
31 | #include "status.h" | 31 | #include "statusbar.h" |
32 | #include "debug.h" | 32 | #include "debug.h" |
33 | #include "talk.h" | 33 | #include "talk.h" |
34 | #include "icons.h" | 34 | #include "icons.h" |
@@ -155,7 +155,7 @@ bool sleeptimer_screen(void) | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | status_draw(true); | 158 | gui_syncstatusbar_draw(&statusbars, true); |
159 | 159 | ||
160 | lcd_update(); | 160 | lcd_update(); |
161 | } | 161 | } |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index f2d92d6df6..d8795ab8ae 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "button.h" | 26 | #include "button.h" |
27 | #include "mp3_playback.h" | 27 | #include "mp3_playback.h" |
28 | #include "settings.h" | 28 | #include "settings.h" |
29 | #include "status.h" | 29 | #include "statusbar.h" |
30 | #include "screens.h" | 30 | #include "screens.h" |
31 | #ifdef HAVE_LCD_BITMAP | 31 | #ifdef HAVE_LCD_BITMAP |
32 | #include "icons.h" | 32 | #include "icons.h" |
@@ -575,7 +575,7 @@ bool rectrigger(void) | |||
575 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 575 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
576 | lcd_fillrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height); | 576 | lcd_fillrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height); |
577 | lcd_set_drawmode(DRMODE_SOLID); | 577 | lcd_set_drawmode(DRMODE_SOLID); |
578 | status_draw(true); | 578 | gui_syncstatusbar_draw(&statusbars, true); |
579 | 579 | ||
580 | /* reselect FONT_SYSFONT as status_draw has changed the font */ | 580 | /* reselect FONT_SYSFONT as status_draw has changed the font */ |
581 | /*lcd_setfont(FONT_SYSFIXED);*/ | 581 | /*lcd_setfont(FONT_SYSFIXED);*/ |
diff --git a/apps/status.c b/apps/status.c index 00f8c5e1fe..e678c76674 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "audio.h" | 28 | #include "audio.h" |
29 | #include "gwps.h" | 29 | #include "gwps.h" |
30 | #include "abrepeat.h" | 30 | #include "abrepeat.h" |
31 | #include "statusbar.h" | ||
31 | #ifdef HAVE_RTC | 32 | #ifdef HAVE_RTC |
32 | #include "timefuncs.h" | 33 | #include "timefuncs.h" |
33 | #endif | 34 | #endif |
@@ -54,27 +55,6 @@ bool battery_state = true; | |||
54 | int battery_charge_step = 0; | 55 | int battery_charge_step = 0; |
55 | #endif | 56 | #endif |
56 | 57 | ||
57 | struct status_info { | ||
58 | int battlevel; | ||
59 | int volume; | ||
60 | int hour; | ||
61 | int minute; | ||
62 | int playmode; | ||
63 | int repeat; | ||
64 | bool inserted; | ||
65 | bool shuffle; | ||
66 | bool keylock; | ||
67 | bool battery_safe; | ||
68 | bool redraw_volume; /* true if the volume gauge needs updating */ | ||
69 | #if CONFIG_LED == LED_VIRTUAL | ||
70 | bool led; /* disk LED simulation in the status bar */ | ||
71 | #endif | ||
72 | #ifdef HAVE_USB_POWER | ||
73 | bool usb_power; | ||
74 | #endif | ||
75 | |||
76 | }; | ||
77 | |||
78 | void status_init(void) | 58 | void status_init(void) |
79 | { | 59 | { |
80 | ff_mode = 0; | 60 | ff_mode = 0; |
@@ -83,7 +63,7 @@ void status_init(void) | |||
83 | void status_set_ffmode(enum playmode mode) | 63 | void status_set_ffmode(enum playmode mode) |
84 | { | 64 | { |
85 | ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */ | 65 | ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */ |
86 | status_draw(false); | 66 | gui_syncstatusbar_draw(&statusbars, false); |
87 | } | 67 | } |
88 | 68 | ||
89 | enum playmode status_get_ffmode(void) | 69 | enum playmode status_get_ffmode(void) |
@@ -162,257 +142,3 @@ void status_set_usb(bool b) | |||
162 | } | 142 | } |
163 | 143 | ||
164 | #endif /* HAVE_LCD_CHARCELLS */ | 144 | #endif /* HAVE_LCD_CHARCELLS */ |
165 | |||
166 | void status_draw(bool force_redraw) | ||
167 | { | ||
168 | /* This is static because we use memcmp() below to check for changes, and | ||
169 | the unused bytes (due to struct member alignment) might change if | ||
170 | the struct is allocated on the stack. */ | ||
171 | static struct status_info info; | ||
172 | |||
173 | #ifdef HAVE_LCD_BITMAP | ||
174 | static struct status_info lastinfo; | ||
175 | struct tm* tm; | ||
176 | |||
177 | if ( !global_settings.statusbar ) | ||
178 | return; | ||
179 | #else | ||
180 | (void)force_redraw; /* players always "redraw" */ | ||
181 | #endif | ||
182 | |||
183 | info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); | ||
184 | info.inserted = charger_inserted(); | ||
185 | info.battlevel = battery_level(); | ||
186 | info.battery_safe = battery_level_safe(); | ||
187 | |||
188 | #ifdef HAVE_LCD_BITMAP | ||
189 | tm = get_time(); | ||
190 | info.hour = tm->tm_hour; | ||
191 | info.minute = tm->tm_min; | ||
192 | info.shuffle = global_settings.playlist_shuffle; | ||
193 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | ||
194 | info.keylock = button_hold(); | ||
195 | #else | ||
196 | info.keylock = keys_locked; | ||
197 | #endif | ||
198 | info.repeat = global_settings.repeat_mode; | ||
199 | info.playmode = current_playmode(); | ||
200 | #if CONFIG_LED == LED_VIRTUAL | ||
201 | info.led = led_read(HZ/2); /* delay should match polling interval */ | ||
202 | #endif | ||
203 | #ifdef HAVE_USB_POWER | ||
204 | info.usb_power = usb_powered(); | ||
205 | #endif | ||
206 | |||
207 | /* only redraw if forced to, or info has changed */ | ||
208 | if (force_redraw || | ||
209 | info.inserted || | ||
210 | !info.battery_safe || | ||
211 | info.redraw_volume || | ||
212 | memcmp(&info, &lastinfo, sizeof(struct status_info))) | ||
213 | { | ||
214 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
215 | lcd_fillrect(0,0,LCD_WIDTH,8); | ||
216 | lcd_set_drawmode(DRMODE_SOLID); | ||
217 | #else | ||
218 | /* players always "redraw" */ | ||
219 | { | ||
220 | #endif | ||
221 | |||
222 | #ifdef HAVE_CHARGING | ||
223 | if (info.inserted) { | ||
224 | battery_state = true; | ||
225 | #if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 | ||
226 | /* zero battery run time if charging */ | ||
227 | if (charge_state > 0) { | ||
228 | global_settings.runtime = 0; | ||
229 | lasttime = current_tick; | ||
230 | } | ||
231 | |||
232 | /* animate battery if charging */ | ||
233 | if ((charge_state == 1) || | ||
234 | (charge_state == 2)) { | ||
235 | #else | ||
236 | global_settings.runtime = 0; | ||
237 | lasttime = current_tick; | ||
238 | { | ||
239 | #endif | ||
240 | /* animate in three steps (34% per step for a better look) */ | ||
241 | info.battlevel = battery_charge_step * 34; | ||
242 | if (info.battlevel > 100) | ||
243 | info.battlevel = 100; | ||
244 | if(TIME_AFTER(current_tick, switch_tick)) { | ||
245 | battery_charge_step=(battery_charge_step+1)%4; | ||
246 | switch_tick = current_tick + HZ; | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | #endif /* HAVE_CHARGING */ | ||
252 | { | ||
253 | if (info.battery_safe) | ||
254 | battery_state = true; | ||
255 | else { | ||
256 | /* blink battery if level is low */ | ||
257 | if(TIME_AFTER(current_tick, switch_tick) && | ||
258 | (info.battlevel > -1)) { | ||
259 | switch_tick = current_tick+HZ; | ||
260 | battery_state =! battery_state; | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | #ifdef HAVE_LCD_BITMAP | ||
266 | if (battery_state) | ||
267 | statusbar_icon_battery(info.battlevel); | ||
268 | |||
269 | /* draw power plug if charging */ | ||
270 | if (info.inserted) | ||
271 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS, | ||
272 | STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT); | ||
273 | #ifdef HAVE_USB_POWER | ||
274 | else if (info.usb_power) | ||
275 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS, | ||
276 | STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT); | ||
277 | #endif | ||
278 | |||
279 | info.redraw_volume = statusbar_icon_volume(info.volume); | ||
280 | statusbar_icon_play_state(current_playmode() + Icon_Play); | ||
281 | switch (info.repeat) { | ||
282 | #ifdef AB_REPEAT_ENABLE | ||
283 | case REPEAT_AB: | ||
284 | statusbar_icon_play_mode(Icon_RepeatAB); | ||
285 | break; | ||
286 | #endif | ||
287 | |||
288 | case REPEAT_ONE: | ||
289 | statusbar_icon_play_mode(Icon_RepeatOne); | ||
290 | break; | ||
291 | |||
292 | case REPEAT_ALL: | ||
293 | case REPEAT_SHUFFLE: | ||
294 | statusbar_icon_play_mode(Icon_Repeat); | ||
295 | break; | ||
296 | } | ||
297 | if (info.shuffle) | ||
298 | statusbar_icon_shuffle(); | ||
299 | if (info.keylock) | ||
300 | statusbar_icon_lock(); | ||
301 | #ifdef HAVE_RTC | ||
302 | statusbar_time(info.hour, info.minute); | ||
303 | #endif | ||
304 | #if CONFIG_LED == LED_VIRTUAL | ||
305 | if (info.led) | ||
306 | statusbar_led(); | ||
307 | #endif | ||
308 | lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT); | ||
309 | lastinfo = info; | ||
310 | #endif | ||
311 | } | ||
312 | |||
313 | |||
314 | #if defined(HAVE_LCD_CHARCELLS) | ||
315 | if (info.battlevel > -1) | ||
316 | lcd_icon(ICON_BATTERY, battery_state); | ||
317 | lcd_icon(ICON_BATTERY_1, info.battlevel > 25); | ||
318 | lcd_icon(ICON_BATTERY_2, info.battlevel > 50); | ||
319 | lcd_icon(ICON_BATTERY_3, info.battlevel > 75); | ||
320 | |||
321 | lcd_icon(ICON_VOLUME, true); | ||
322 | lcd_icon(ICON_VOLUME_1, info.volume > 10); | ||
323 | lcd_icon(ICON_VOLUME_2, info.volume > 30); | ||
324 | lcd_icon(ICON_VOLUME_3, info.volume > 50); | ||
325 | lcd_icon(ICON_VOLUME_4, info.volume > 70); | ||
326 | lcd_icon(ICON_VOLUME_5, info.volume > 90); | ||
327 | |||
328 | lcd_icon(ICON_PLAY, current_playmode() == STATUS_PLAY); | ||
329 | lcd_icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE); | ||
330 | |||
331 | lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF); | ||
332 | lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE); | ||
333 | |||
334 | lcd_icon(ICON_RECORD, record); | ||
335 | lcd_icon(ICON_AUDIO, audio); | ||
336 | lcd_icon(ICON_PARAM, param); | ||
337 | lcd_icon(ICON_USB, usb); | ||
338 | #endif | ||
339 | |||
340 | } | ||
341 | |||
342 | #if defined(HAVE_LCD_BITMAP) && (CONFIG_KEYPAD == RECORDER_PAD) | ||
343 | static void draw_buttonbar_btn(int num, const char* caption) | ||
344 | { | ||
345 | int xpos, ypos, button_width, text_width; | ||
346 | int fw, fh; | ||
347 | |||
348 | lcd_setfont(FONT_SYSFIXED); | ||
349 | lcd_getstringsize("M", &fw, &fh); | ||
350 | |||
351 | button_width = LCD_WIDTH/3; | ||
352 | xpos = num * button_width; | ||
353 | ypos = LCD_HEIGHT - fh; | ||
354 | |||
355 | if(caption) | ||
356 | { | ||
357 | /* center the text */ | ||
358 | text_width = fw * strlen(caption); | ||
359 | lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption); | ||
360 | } | ||
361 | |||
362 | lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
363 | lcd_fillrect(xpos, ypos, button_width - 1, fh); | ||
364 | lcd_set_drawmode(DRMODE_SOLID); | ||
365 | } | ||
366 | |||
367 | static char stored_caption1[8]; | ||
368 | static char stored_caption2[8]; | ||
369 | static char stored_caption3[8]; | ||
370 | |||
371 | void buttonbar_set(const char* caption1, const char *caption2, | ||
372 | const char *caption3) | ||
373 | { | ||
374 | buttonbar_unset(); | ||
375 | if(caption1) | ||
376 | { | ||
377 | strncpy(stored_caption1, caption1, 7); | ||
378 | stored_caption1[7] = 0; | ||
379 | } | ||
380 | if(caption2) | ||
381 | { | ||
382 | strncpy(stored_caption2, caption2, 7); | ||
383 | stored_caption2[7] = 0; | ||
384 | } | ||
385 | if(caption3) | ||
386 | { | ||
387 | strncpy(stored_caption3, caption3, 7); | ||
388 | stored_caption3[7] = 0; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | void buttonbar_unset(void) | ||
393 | { | ||
394 | stored_caption1[0] = 0; | ||
395 | stored_caption2[0] = 0; | ||
396 | stored_caption3[0] = 0; | ||
397 | } | ||
398 | |||
399 | void buttonbar_draw(void) | ||
400 | { | ||
401 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
402 | lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | ||
403 | lcd_set_drawmode(DRMODE_SOLID); | ||
404 | draw_buttonbar_btn(0, stored_caption1); | ||
405 | draw_buttonbar_btn(1, stored_caption2); | ||
406 | draw_buttonbar_btn(2, stored_caption3); | ||
407 | } | ||
408 | |||
409 | bool buttonbar_isset(void) | ||
410 | { | ||
411 | /* If all buttons are unset, the button bar is considered disabled */ | ||
412 | return (global_settings.buttonbar && | ||
413 | ((stored_caption1[0] != 0) || | ||
414 | (stored_caption2[0] != 0) || | ||
415 | (stored_caption3[0] != 0))); | ||
416 | } | ||
417 | |||
418 | #endif | ||
diff --git a/apps/status.h b/apps/status.h index 25d3166d78..68319257b8 100644 --- a/apps/status.h +++ b/apps/status.h | |||
@@ -52,27 +52,14 @@ void status_set_ffmode(enum playmode mode); | |||
52 | enum playmode status_get_ffmode(void); | 52 | enum playmode status_get_ffmode(void); |
53 | int current_playmode(void); | 53 | int current_playmode(void); |
54 | 54 | ||
55 | #ifdef HAVE_LCD_BITMAP | 55 | #ifdef SIMULATOR |
56 | bool statusbar(bool state); | 56 | #include <time.h> |
57 | #if CONFIG_KEYPAD == RECORDER_PAD | 57 | #endif |
58 | void buttonbar_set(const char* caption1, const char* caption2, | 58 | #ifdef HAVE_LCD_CHARCELLS |
59 | const char* caption3); | ||
60 | void buttonbar_unset(void); | ||
61 | bool buttonbar_isset(void); | ||
62 | void buttonbar_draw(void); | ||
63 | #define BUTTONBAR_HEIGHT 8 | ||
64 | #endif /* CONFIG_KEYPAD == RECORDER_PAD */ | ||
65 | #endif /* HAVE_LCD_BITMAP */ | ||
66 | void status_draw(bool force_redraw); | ||
67 | |||
68 | #if defined(HAVE_LCD_CHARCELLS) | ||
69 | void status_set_record(bool b); | 59 | void status_set_record(bool b); |
70 | void status_set_audio(bool b); | 60 | void status_set_audio(bool b); |
71 | void status_set_param(bool b); | 61 | void status_set_param(bool b); |
72 | void status_set_usb(bool b); | 62 | void status_set_usb(bool b); |
73 | #endif | 63 | #endif /* HAVE_LCD_CHARCELLS */ |
74 | 64 | ||
75 | #ifdef SIMULATOR | 65 | #endif /* _STATUS_H */ |
76 | #include <time.h> | ||
77 | #endif | ||
78 | #endif | ||