diff options
author | Kevin Ferrare <kevin@rockbox.org> | 2005-11-20 22:13:52 +0000 |
---|---|---|
committer | Kevin Ferrare <kevin@rockbox.org> | 2005-11-20 22:13:52 +0000 |
commit | 0d9c7b5bcbc1fd90a810780b5b58835ee8590f54 (patch) | |
tree | ebb75c26a31d219a21ecc7aeba30f3c9956a0f62 /apps/gui/gwps.c | |
parent | 6707892151dbfe4f09901fd4f33d172aac5a5d56 (diff) | |
download | rockbox-0d9c7b5bcbc1fd90a810780b5b58835ee8590f54.tar.gz rockbox-0d9c7b5bcbc1fd90a810780b5b58835ee8590f54.zip |
Applied Stephan Wezel's patch for the new wps %wd/%we tags (disable/enable statusbar in wps mode independantly from the global setting)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8015 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r-- | apps/gui/gwps.c | 80 |
1 files changed, 58 insertions, 22 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 5877cf7c4b..a93750770f 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #include "abrepeat.h" | 53 | #include "abrepeat.h" |
54 | #include "playback.h" | 54 | #include "playback.h" |
55 | 55 | ||
56 | #include "statusbar.h" | ||
57 | #include "splash.h" | 56 | #include "splash.h" |
58 | 57 | ||
59 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" | 58 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" |
@@ -68,6 +67,19 @@ bool keys_locked = false; | |||
68 | /* change the path to the current played track */ | 67 | /* change the path to the current played track */ |
69 | static void wps_state_update_ctp(const char *path); | 68 | static void wps_state_update_ctp(const char *path); |
70 | 69 | ||
70 | #ifdef HAVE_LCD_BITMAP | ||
71 | static void gui_wps_set_margine(struct gui_wps *gwps) | ||
72 | { | ||
73 | int offset = 0; | ||
74 | struct wps_data *data = gwps->data; | ||
75 | if(data->wps_sb_tag && data->show_sb_on_wps) | ||
76 | offset = STATUSBAR_HEIGHT; | ||
77 | else if ( global_settings.statusbar && !data->wps_sb_tag) | ||
78 | offset = STATUSBAR_HEIGHT; | ||
79 | gwps->display->setmargins(0, offset); | ||
80 | } | ||
81 | #endif | ||
82 | |||
71 | long gui_wps_show(void) | 83 | long gui_wps_show(void) |
72 | { | 84 | { |
73 | long button = 0, lastbutton = 0; | 85 | long button = 0, lastbutton = 0; |
@@ -88,8 +100,7 @@ long gui_wps_show(void) | |||
88 | #else | 100 | #else |
89 | FOR_NB_SCREENS(i) | 101 | FOR_NB_SCREENS(i) |
90 | { | 102 | { |
91 | gui_wps[i].display->setmargins(0, global_settings.statusbar? | 103 | gui_wps_set_margine(&gui_wps[i]); |
92 | STATUSBAR_HEIGHT:0); | ||
93 | } | 104 | } |
94 | #endif | 105 | #endif |
95 | 106 | ||
@@ -156,12 +167,12 @@ long gui_wps_show(void) | |||
156 | 167 | ||
157 | if (TIME_AFTER(current_tick, next_refresh)) { | 168 | if (TIME_AFTER(current_tick, next_refresh)) { |
158 | FOR_NB_SCREENS(i) | 169 | FOR_NB_SCREENS(i) |
159 | { | 170 | { |
160 | if(gui_wps[i].data->peak_meter_enabled) | 171 | if(gui_wps[i].data->peak_meter_enabled) |
161 | gui_wps_refresh(&gui_wps[i], 0, | 172 | gui_wps_refresh(&gui_wps[i], 0, |
162 | WPS_REFRESH_PEAK_METER); | 173 | WPS_REFRESH_PEAK_METER); |
163 | next_refresh += HZ / PEAK_METER_FPS; | 174 | next_refresh += HZ / PEAK_METER_FPS; |
164 | } | 175 | } |
165 | } | 176 | } |
166 | } | 177 | } |
167 | 178 | ||
@@ -215,6 +226,12 @@ long gui_wps_show(void) | |||
215 | case WPS_RC_CONTEXT: | 226 | case WPS_RC_CONTEXT: |
216 | #endif | 227 | #endif |
217 | onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); | 228 | onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); |
229 | #ifdef HAVE_LCD_BITMAP | ||
230 | FOR_NB_SCREENS(i) | ||
231 | { | ||
232 | gui_wps_set_margine(&gui_wps[i]); | ||
233 | } | ||
234 | #endif | ||
218 | restore = true; | 235 | restore = true; |
219 | break; | 236 | break; |
220 | #endif | 237 | #endif |
@@ -289,11 +306,20 @@ long gui_wps_show(void) | |||
289 | case WPS_RC_INCVOL: | 306 | case WPS_RC_INCVOL: |
290 | case WPS_RC_INCVOL | BUTTON_REPEAT: | 307 | case WPS_RC_INCVOL | BUTTON_REPEAT: |
291 | #endif | 308 | #endif |
309 | { | ||
292 | global_settings.volume++; | 310 | global_settings.volume++; |
293 | if (setvol()) { | 311 | bool res = false; |
312 | setvol(); | ||
313 | FOR_NB_SCREENS(i) | ||
314 | { | ||
315 | if(update_onvol_change(&gui_wps[i])) | ||
316 | res = true; | ||
317 | } | ||
318 | if (res) { | ||
294 | restore = true; | 319 | restore = true; |
295 | restoretimer = current_tick + HZ; | 320 | restoretimer = current_tick + HZ; |
296 | } | 321 | } |
322 | } | ||
297 | break; | 323 | break; |
298 | 324 | ||
299 | /* volume down */ | 325 | /* volume down */ |
@@ -303,11 +329,20 @@ long gui_wps_show(void) | |||
303 | case WPS_RC_DECVOL: | 329 | case WPS_RC_DECVOL: |
304 | case WPS_RC_DECVOL | BUTTON_REPEAT: | 330 | case WPS_RC_DECVOL | BUTTON_REPEAT: |
305 | #endif | 331 | #endif |
332 | { | ||
306 | global_settings.volume--; | 333 | global_settings.volume--; |
307 | if (setvol()) { | 334 | setvol(); |
335 | bool res = false; | ||
336 | FOR_NB_SCREENS(i) | ||
337 | { | ||
338 | if(update_onvol_change(&gui_wps[i])) | ||
339 | res = true; | ||
340 | } | ||
341 | if (res) { | ||
308 | restore = true; | 342 | restore = true; |
309 | restoretimer = current_tick + HZ; | 343 | restoretimer = current_tick + HZ; |
310 | } | 344 | } |
345 | } | ||
311 | break; | 346 | break; |
312 | 347 | ||
313 | /* fast forward / rewind */ | 348 | /* fast forward / rewind */ |
@@ -450,9 +485,7 @@ long gui_wps_show(void) | |||
450 | #ifdef HAVE_LCD_BITMAP | 485 | #ifdef HAVE_LCD_BITMAP |
451 | FOR_NB_SCREENS(i) | 486 | FOR_NB_SCREENS(i) |
452 | { | 487 | { |
453 | gui_wps[i].display->setmargins(0, | 488 | gui_wps_set_margine(&gui_wps[i]); |
454 | global_settings.statusbar? | ||
455 | STATUSBAR_HEIGHT:0); | ||
456 | } | 489 | } |
457 | #endif | 490 | #endif |
458 | restore = true; | 491 | restore = true; |
@@ -581,13 +614,13 @@ long gui_wps_show(void) | |||
581 | 614 | ||
582 | if (update_track) | 615 | if (update_track) |
583 | { | 616 | { |
584 | bool upt = false; | 617 | bool update_failed = false; |
585 | FOR_NB_SCREENS(i) | 618 | FOR_NB_SCREENS(i) |
586 | { | 619 | { |
587 | if(update(&gui_wps[i])) | 620 | if(update(&gui_wps[i])) |
588 | upt = true; | 621 | update_failed = true; |
589 | } | 622 | } |
590 | if (upt) | 623 | if (update_failed) |
591 | { | 624 | { |
592 | /* set dir browser to current playing song */ | 625 | /* set dir browser to current playing song */ |
593 | if (global_settings.browse_current && | 626 | if (global_settings.browse_current && |
@@ -670,6 +703,8 @@ void wps_data_init(struct wps_data *wps_data) | |||
670 | wps_data->img[i].display = false; | 703 | wps_data->img[i].display = false; |
671 | wps_data->img[i].always_display = false; | 704 | wps_data->img[i].always_display = false; |
672 | } | 705 | } |
706 | wps_data->wps_sb_tag = false; | ||
707 | wps_data->show_sb_on_wps = false; | ||
673 | #else /* HAVE_LCD_CHARCELLS */ | 708 | #else /* HAVE_LCD_CHARCELLS */ |
674 | for(i = 0; i < 8; i++) | 709 | for(i = 0; i < 8; i++) |
675 | wps_data->wps_progress_pat[i] = 0; | 710 | wps_data->wps_progress_pat[i] = 0; |
@@ -861,6 +896,7 @@ void gui_wps_init(struct gui_wps *gui_wps) | |||
861 | { | 896 | { |
862 | gui_wps->data = NULL; | 897 | gui_wps->data = NULL; |
863 | gui_wps->display = NULL; | 898 | gui_wps->display = NULL; |
899 | gui_wps->statusbar = NULL; | ||
864 | /* Currently no seperate wps_state needed/possible | 900 | /* Currently no seperate wps_state needed/possible |
865 | so use the only aviable ( "global" ) one */ | 901 | so use the only aviable ( "global" ) one */ |
866 | gui_wps->state = &wps_state; | 902 | gui_wps->state = &wps_state; |
@@ -877,14 +913,12 @@ void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display) | |||
877 | { | 913 | { |
878 | gui_wps->display = display; | 914 | gui_wps->display = display; |
879 | } | 915 | } |
880 | /* gui_wps end */ | ||
881 | 916 | ||
882 | void gui_sync_data_wps_init(void) | 917 | void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar) |
883 | { | 918 | { |
884 | int i; | 919 | gui_wps->statusbar = statusbar; |
885 | FOR_NB_SCREENS(i) | ||
886 | wps_data_init(&wps_datas[i]); | ||
887 | } | 920 | } |
921 | /* gui_wps end */ | ||
888 | 922 | ||
889 | void gui_sync_wps_screen_init(void) | 923 | void gui_sync_wps_screen_init(void) |
890 | { | 924 | { |
@@ -898,7 +932,9 @@ void gui_sync_wps_init(void) | |||
898 | int i; | 932 | int i; |
899 | FOR_NB_SCREENS(i) | 933 | FOR_NB_SCREENS(i) |
900 | { | 934 | { |
935 | wps_data_init(&wps_datas[i]); | ||
901 | gui_wps_init(&gui_wps[i]); | 936 | gui_wps_init(&gui_wps[i]); |
902 | gui_wps_set_data(&gui_wps[i], &wps_datas[i]); | 937 | gui_wps_set_data(&gui_wps[i], &wps_datas[i]); |
938 | gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); | ||
903 | } | 939 | } |
904 | } | 940 | } |