summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/gwps-common.c39
-rw-r--r--apps/gui/gwps.c58
-rw-r--r--apps/gui/list.c2
-rw-r--r--apps/gui/viewport.c35
-rw-r--r--apps/gui/viewport.h13
5 files changed, 76 insertions, 71 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index e07436e565..2d65629f97 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -62,6 +62,7 @@
62#endif 62#endif
63#include "backdrop.h" 63#include "backdrop.h"
64#include "viewport.h" 64#include "viewport.h"
65#include "pcmbuf.h"
65 66
66#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ 67#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
67 /* 3% of 30min file == 54s step size */ 68 /* 3% of 30min file == 54s step size */
@@ -75,36 +76,6 @@
75#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ 76#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */
76 77
77 78
78/* draws the statusbar on the given wps-screen */
79#ifdef HAVE_LCD_BITMAP
80static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
81{
82 (void)force;
83 bool draw = global_settings.statusbar;
84
85 if (wps->data->wps_sb_tag)
86 draw = wps->data->show_sb_on_wps;
87
88#if NB_SCREENS > 1
89 /* multi screen targets could show the bars on one screen but not both
90 * so the viewportmanager can't be used in its current form...
91 * Also, the WPS is a special screen so doing this is reasonable.
92 */
93 if (draw)
94 {
95 struct gui_statusbar *bar;
96 bar = &statusbars.statusbars[wps->data->remote_wps?SCREEN_REMOTE:SCREEN_MAIN];
97 gui_statusbar_draw(bar, force);
98 }
99#else
100 viewportmanager_set_statusbar(draw);
101#endif
102}
103#else
104#define gui_wps_statusbar_draw(wps, force) viewportmanager_set_statusbar(true)
105#endif
106#include "pcmbuf.h"
107
108/* fades the volume */ 79/* fades the volume */
109bool wps_fading_out = false; 80bool wps_fading_out = false;
110void fade(bool fade_in, bool updatewps) 81void fade(bool fade_in, bool updatewps)
@@ -170,7 +141,6 @@ void fade(bool fade_in, bool updatewps)
170*/ 141*/
171bool update_onvol_change(struct gui_wps * gwps) 142bool update_onvol_change(struct gui_wps * gwps)
172{ 143{
173 gui_wps_statusbar_draw(gwps, false);
174 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 144 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
175 145
176#ifdef HAVE_LCD_CHARCELLS 146#ifdef HAVE_LCD_CHARCELLS
@@ -366,7 +336,6 @@ bool gui_wps_display(void)
366 } 336 }
367#endif 337#endif
368#endif 338#endif
369
370 gui_wps[i].display->clear_display(); 339 gui_wps[i].display->clear_display();
371 if (!gui_wps[i].data->wps_loaded) { 340 if (!gui_wps[i].data->wps_loaded) {
372 if ( !gui_wps[i].data->num_tokens ) { 341 if ( !gui_wps[i].data->num_tokens ) {
@@ -481,8 +450,6 @@ bool update(struct gui_wps *gwps)
481 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 450 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
482 } 451 }
483 452
484 gui_wps_statusbar_draw(gwps, false);
485
486 return retcode; 453 return retcode;
487} 454}
488 455
@@ -1978,7 +1945,6 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1978 bool update_line, new_subline_refresh; 1945 bool update_line, new_subline_refresh;
1979 1946
1980#ifdef HAVE_LCD_BITMAP 1947#ifdef HAVE_LCD_BITMAP
1981 gui_wps_statusbar_draw(gwps, true);
1982 1948
1983 /* to find out wether the peak meter is enabled we 1949 /* to find out wether the peak meter is enabled we
1984 assume it wasn't until we find a line that contains 1950 assume it wasn't until we find a line that contains
@@ -2195,7 +2161,8 @@ bool gui_wps_refresh(struct gui_wps *gwps,
2195 remote_backlight_on(); 2161 remote_backlight_on();
2196 } 2162 }
2197#endif 2163#endif
2198 2164 /* force a bars update if they are being displayed */
2165 viewportmanager_draw_statusbars(NULL);
2199 return true; 2166 return true;
2200} 2167}
2201 2168
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 6c387ef62e..1d8d7255bf 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -115,8 +115,24 @@ static void next_track(void)
115 115
116 audio_next(); 116 audio_next();
117} 117}
118 118static char fix_wps_bars(void)
119 119{
120#ifdef HAVE_LCD_BITMAP
121 int i;
122 char wpsbars = 0;
123 FOR_NB_SCREENS(i)
124 {
125 bool draw = global_settings.statusbar;
126 if (gui_wps[i].data->wps_sb_tag)
127 draw = gui_wps[i].data->show_sb_on_wps;
128 if (draw)
129 wpsbars |= VP_IGNORE_SB_SETTING(i)|(1<<i);
130 }
131 return wpsbars;
132#else
133 return 1;
134#endif
135}
120long gui_wps_show(void) 136long gui_wps_show(void)
121{ 137{
122 long button = 0; 138 long button = 0;
@@ -127,8 +143,8 @@ long gui_wps_show(void)
127 bool update_track = false; 143 bool update_track = false;
128 int i; 144 int i;
129 long last_left = 0, last_right = 0; 145 long last_left = 0, last_right = 0;
146 char wpsbars = 0, oldbars = 0;
130 147
131 viewportmanager_set_statusbar(false);
132 wps_state_init(); 148 wps_state_init();
133 149
134#ifdef HAVE_LCD_CHARCELLS 150#ifdef HAVE_LCD_CHARCELLS
@@ -149,6 +165,7 @@ long gui_wps_show(void)
149 ab_reset_markers(); 165 ab_reset_markers();
150#endif 166#endif
151 167
168 oldbars = viewportmanager_set_statusbar(0);
152 if(audio_status() & AUDIO_STATUS_PLAY) 169 if(audio_status() & AUDIO_STATUS_PLAY)
153 { 170 {
154 wps_state.id3 = audio_current_track(); 171 wps_state.id3 = audio_current_track();
@@ -156,12 +173,13 @@ long gui_wps_show(void)
156 if (wps_state.id3) { 173 if (wps_state.id3) {
157 if (gui_wps_display()) 174 if (gui_wps_display())
158 return 0; 175 return 0;
159 FOR_NB_SCREENS(i)
160 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
161 } 176 }
162 177
163 restore = true; 178 restore = true;
164 } 179 }
180 wpsbars = fix_wps_bars();
181 viewportmanager_set_statusbar(wpsbars);
182
165 while ( 1 ) 183 while ( 1 )
166 { 184 {
167 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; 185 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
@@ -259,20 +277,19 @@ long gui_wps_show(void)
259 { 277 {
260 case ACTION_WPS_CONTEXT: 278 case ACTION_WPS_CONTEXT:
261 { 279 {
262 bool bars;
263#if LCD_DEPTH > 1 280#if LCD_DEPTH > 1
264 show_main_backdrop(); 281 show_main_backdrop();
265#endif 282#endif
266#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 283#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
267 show_remote_main_backdrop(); 284 show_remote_main_backdrop();
268#endif 285#endif
269 bars = viewportmanager_set_statusbar(true); 286 viewportmanager_set_statusbar(oldbars);
270 /* if music is stopped in the context menu we want to exit the wps */ 287 /* if music is stopped in the context menu we want to exit the wps */
271 if (onplay(wps_state.id3->path, 288 if (onplay(wps_state.id3->path,
272 FILE_ATTR_AUDIO, CONTEXT_WPS) == ONPLAY_MAINMENU 289 FILE_ATTR_AUDIO, CONTEXT_WPS) == ONPLAY_MAINMENU
273 || !audio_status()) 290 || !audio_status())
274 return GO_TO_ROOT; 291 return GO_TO_ROOT;
275 viewportmanager_set_statusbar(bars); 292 viewportmanager_set_statusbar(wpsbars);
276 /* track might have changed */ 293 /* track might have changed */
277 update_track = true; 294 update_track = true;
278 295
@@ -527,7 +544,7 @@ long gui_wps_show(void)
527#ifdef HAVE_QUICKSCREEN 544#ifdef HAVE_QUICKSCREEN
528 case ACTION_WPS_QUICKSCREEN: 545 case ACTION_WPS_QUICKSCREEN:
529 { 546 {
530 bool bars = viewportmanager_set_statusbar(true); 547 viewportmanager_set_statusbar(oldbars);
531#if LCD_DEPTH > 1 548#if LCD_DEPTH > 1
532 show_main_backdrop(); 549 show_main_backdrop();
533#endif 550#endif
@@ -536,7 +553,8 @@ long gui_wps_show(void)
536#endif 553#endif
537 if (quick_screen_quick(button)) 554 if (quick_screen_quick(button))
538 return SYS_USB_CONNECTED; 555 return SYS_USB_CONNECTED;
539 viewportmanager_set_statusbar(bars); 556 wpsbars = fix_wps_bars();
557 viewportmanager_set_statusbar(wpsbars);
540#if LCD_DEPTH > 1 558#if LCD_DEPTH > 1
541 show_wps_backdrop(); 559 show_wps_backdrop();
542#endif 560#endif
@@ -552,7 +570,7 @@ long gui_wps_show(void)
552#ifdef BUTTON_F3 570#ifdef BUTTON_F3
553 case ACTION_F3: 571 case ACTION_F3:
554 { 572 {
555 bool bars = viewportmanager_set_statusbar(true); 573 viewportmanager_set_statusbar(oldbars);
556#if LCD_DEPTH > 1 574#if LCD_DEPTH > 1
557 show_main_backdrop(); 575 show_main_backdrop();
558#endif 576#endif
@@ -562,7 +580,8 @@ long gui_wps_show(void)
562 if (quick_screen_f3(BUTTON_F3)) 580 if (quick_screen_f3(BUTTON_F3))
563 return SYS_USB_CONNECTED; 581 return SYS_USB_CONNECTED;
564 restore = true; 582 restore = true;
565 viewportmanager_set_statusbar(bars); 583 wpsbars = fix_wps_bars();
584 viewportmanager_set_statusbar(wpsbars);
566 } 585 }
567 break; 586 break;
568#endif /* BUTTON_F3 */ 587#endif /* BUTTON_F3 */
@@ -571,7 +590,7 @@ long gui_wps_show(void)
571#ifdef HAVE_PITCHSCREEN 590#ifdef HAVE_PITCHSCREEN
572 case ACTION_WPS_PITCHSCREEN: 591 case ACTION_WPS_PITCHSCREEN:
573 { 592 {
574 bool bars = viewportmanager_set_statusbar(true); 593 viewportmanager_set_statusbar(oldbars);
575#if LCD_DEPTH > 1 594#if LCD_DEPTH > 1
576 show_main_backdrop(); 595 show_main_backdrop();
577#endif 596#endif
@@ -587,7 +606,7 @@ long gui_wps_show(void)
587 show_remote_wps_backdrop(); 606 show_remote_wps_backdrop();
588#endif 607#endif
589 restore = true; 608 restore = true;
590 viewportmanager_set_statusbar(bars); 609 viewportmanager_set_statusbar(wpsbars);
591 } 610 }
592 break; 611 break;
593#endif /* HAVE_PITCHSCREEN */ 612#endif /* HAVE_PITCHSCREEN */
@@ -613,7 +632,7 @@ long gui_wps_show(void)
613 632
614 case ACTION_WPS_ID3SCREEN: 633 case ACTION_WPS_ID3SCREEN:
615 { 634 {
616 bool bars = viewportmanager_set_statusbar(true); 635 viewportmanager_set_statusbar(oldbars);
617#if LCD_DEPTH > 1 636#if LCD_DEPTH > 1
618 show_main_backdrop(); 637 show_main_backdrop();
619#endif 638#endif
@@ -628,7 +647,7 @@ long gui_wps_show(void)
628 show_remote_wps_backdrop(); 647 show_remote_wps_backdrop();
629#endif 648#endif
630 restore = true; 649 restore = true;
631 viewportmanager_set_statusbar(bars); 650 viewportmanager_set_statusbar(wpsbars);
632 } 651 }
633 break; 652 break;
634 653
@@ -645,7 +664,7 @@ long gui_wps_show(void)
645 break; 664 break;
646#endif 665#endif
647 case SYS_POWEROFF: 666 case SYS_POWEROFF:
648 viewportmanager_set_statusbar(true); 667 viewportmanager_set_statusbar(oldbars);
649#if LCD_DEPTH > 1 668#if LCD_DEPTH > 1
650 show_main_backdrop(); 669 show_main_backdrop();
651#endif 670#endif
@@ -681,13 +700,10 @@ long gui_wps_show(void)
681 if (gui_wps_display()) { 700 if (gui_wps_display()) {
682 exit = true; 701 exit = true;
683 } 702 }
684 else if (wps_state.id3){
685 FOR_NB_SCREENS(i)
686 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
687 }
688 } 703 }
689 704
690 if (exit) { 705 if (exit) {
706 viewportmanager_set_statusbar(oldbars);
691#ifdef HAVE_LCD_CHARCELLS 707#ifdef HAVE_LCD_CHARCELLS
692 status_set_record(false); 708 status_set_record(false);
693 status_set_audio(false); 709 status_set_audio(false);
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 2107d3a593..7b8c2975c1 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -845,7 +845,7 @@ bool simplelist_show_list(struct simplelist_info *info)
845{ 845{
846 struct gui_synclist lists; 846 struct gui_synclist lists;
847 int action, old_line_count = simplelist_line_count; 847 int action, old_line_count = simplelist_line_count;
848 bool oldbars = viewportmanager_set_statusbar(true); 848 char oldbars = viewportmanager_set_statusbar(VP_ALLSCREENS);
849 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len); 849 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
850 int wrap = LIST_WRAP_UNLESS_HELD; 850 int wrap = LIST_WRAP_UNLESS_HELD;
851 if (info->get_name) 851 if (info->get_name)
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 24ba652498..3854430521 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -35,7 +35,7 @@
35#include "screen_access.h" 35#include "screen_access.h"
36#include "appevents.h" 36#include "appevents.h"
37 37
38static bool statusbar_enabled = true; 38static char statusbar_enabled = VP_ALLSCREENS;
39 39
40int viewport_get_nb_lines(struct viewport *vp) 40int viewport_get_nb_lines(struct viewport *vp)
41{ 41{
@@ -47,13 +47,19 @@ int viewport_get_nb_lines(struct viewport *vp)
47#endif 47#endif
48} 48}
49 49
50static bool showing_bars(enum screen_type screen)
51{
52 if (statusbar_enabled&(1<<screen))
53 return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4)));
54 return false;
55}
50 56
51void viewport_set_defaults(struct viewport *vp, enum screen_type screen) 57void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
52{ 58{
53 vp->x = 0; 59 vp->x = 0;
54 vp->width = screens[screen].lcdwidth; 60 vp->width = screens[screen].lcdwidth;
55 61
56 vp->y = statusbar_enabled?gui_statusbar_height():0; 62 vp->y = showing_bars(screen)?gui_statusbar_height():0;
57 vp->height = screens[screen].lcdheight - vp->y; 63 vp->height = screens[screen].lcdheight - vp->y;
58#ifdef HAVE_LCD_BITMAP 64#ifdef HAVE_LCD_BITMAP
59 vp->drawmode = DRMODE_SOLID; 65 vp->drawmode = DRMODE_SOLID;
@@ -87,17 +93,18 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
87} 93}
88 94
89/* returns true if it was enabled BEFORE this call */ 95/* returns true if it was enabled BEFORE this call */
90bool viewportmanager_set_statusbar(bool enabled) 96char viewportmanager_set_statusbar(char enabled)
91{ 97{
92 bool old = statusbar_enabled; 98 char old = statusbar_enabled;
93 if (enabled 99 if (enabled)
94#ifdef HAVE_LCD_BITMAP
95 && global_settings.statusbar
96#endif
97 )
98 { 100 {
101 int i;
102 FOR_NB_SCREENS(i)
103 {
104 if (showing_bars(i))
105 gui_statusbar_draw(&statusbars.statusbars[i], true);
106 }
99 add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars); 107 add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars);
100 gui_syncstatusbar_draw(&statusbars, true);
101 } 108 }
102 else 109 else
103 { 110 {
@@ -110,8 +117,12 @@ bool viewportmanager_set_statusbar(bool enabled)
110void viewportmanager_draw_statusbars(void* data) 117void viewportmanager_draw_statusbars(void* data)
111{ 118{
112 (void)data; 119 (void)data;
113 if (statusbar_enabled) 120 int i;
114 gui_syncstatusbar_draw(&statusbars, false); 121 FOR_NB_SCREENS(i)
122 {
123 if (showing_bars(i))
124 gui_statusbar_draw(&statusbars.statusbars[i], false);
125 }
115} 126}
116 127
117void viewportmanager_statusbar_changed(void* data) 128void viewportmanager_statusbar_changed(void* data)
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 53f522347f..02748527a4 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -41,7 +41,18 @@ int viewport_load_config(const char *config, struct viewport *vp);
41 41
42void viewport_set_defaults(struct viewport *vp, enum screen_type screen); 42void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
43 43
44bool viewportmanager_set_statusbar(bool enabled); 44/* viewportmanager_set_statusbar() is used to specify which screens the statusbar
45 * should be displayed on.
46 * *usually* enabled will be VP_ALLSCREENS which means display the bar if the setting
47 * is enabled. (and it will be on both screens)
48 * For the WPS (and other possible exceptions) use VP_IGNORE_SB_SETTING() to
49 * FORCE the statusbar on for the given screen (i.e it will show regardless of the setting
50 */
51#define VP_SB_ONSCREEN(screen) (1<<screen) /* turn the SB on "screen" only */
52#define VP_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) /* SB on for both screens */
53#define VP_IGNORE_SB_SETTING(screen) (1<<(4+screen))
54char viewportmanager_set_statusbar(char enabled);
55
45/* callbacks for GUI_EVENT_* events */ 56/* callbacks for GUI_EVENT_* events */
46void viewportmanager_draw_statusbars(void*data); 57void viewportmanager_draw_statusbars(void*data);
47void viewportmanager_statusbar_changed(void* data); 58void viewportmanager_statusbar_changed(void* data);