1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 #include "lcd-remote.h"
34 #include "statusbar.h"
35 #include "screen_access.h"
36 #include "appevents.h"
38 static int statusbar_enabled
= VP_SB_ALLSCREENS
;
40 int viewport_get_nb_lines(struct viewport
*vp
)
42 #ifdef HAVE_LCD_BITMAP
43 return vp
->height
/font_get(vp
->font
)->height
;
50 static bool showing_bars(enum screen_type screen
)
52 if (statusbar_enabled
& VP_SB_ONSCREEN(screen
))
53 return global_settings
.statusbar
||
54 (statusbar_enabled
& VP_SB_IGNORE_SETTING(screen
));
58 void viewport_set_defaults(struct viewport
*vp
, enum screen_type screen
)
61 vp
->width
= screens
[screen
].lcdwidth
;
63 vp
->y
= showing_bars(screen
)?STATUSBAR_HEIGHT
:0;
64 vp
->height
= screens
[screen
].lcdheight
- vp
->y
;
65 #ifdef HAVE_LCD_BITMAP
66 vp
->drawmode
= DRMODE_SOLID
;
67 vp
->font
= FONT_UI
; /* default to UI to discourage SYSFONT use */
70 #ifdef HAVE_REMOTE_LCD
71 /* We only need this test if there is a remote LCD */
72 if (screen
== SCREEN_MAIN
)
76 vp
->fg_pattern
= global_settings
.fg_color
;
77 vp
->bg_pattern
= global_settings
.bg_color
;
78 vp
->lss_pattern
= global_settings
.lss_color
;
79 vp
->lse_pattern
= global_settings
.lse_color
;
80 vp
->lst_pattern
= global_settings
.lst_color
;
82 vp
->fg_pattern
= LCD_DEFAULT_FG
;
83 vp
->bg_pattern
= LCD_DEFAULT_BG
;
87 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
88 if (screen
== SCREEN_REMOTE
)
90 vp
->fg_pattern
= LCD_REMOTE_DEFAULT_FG
;
91 vp
->bg_pattern
= LCD_REMOTE_DEFAULT_BG
;
97 int viewportmanager_set_statusbar(int enabled
)
99 int old
= statusbar_enabled
;
106 gui_statusbar_draw(&statusbars
.statusbars
[i
], true);
108 add_event(GUI_EVENT_ACTIONUPDATE
, false, viewportmanager_draw_statusbars
);
112 remove_event(GUI_EVENT_ACTIONUPDATE
, viewportmanager_draw_statusbars
);
114 statusbar_enabled
= enabled
;
118 void viewportmanager_draw_statusbars(void* data
)
125 gui_statusbar_draw(&statusbars
.statusbars
[i
], false);
129 void viewportmanager_statusbar_changed(void* data
)
132 viewportmanager_set_statusbar(statusbar_enabled
);