summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-05-09 13:01:59 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-05-09 13:01:59 +0000
commit38ef849d06c7f206b4e9238058ce7b52fbc5d019 (patch)
tree9426af72e4ea2e7c64bec9b65935d363b0af19ae /apps/gui/skin_engine
parent382c23e10dc44a357c5ce65df01c38559d722314 (diff)
downloadrockbox-38ef849d06c7f206b4e9238058ce7b52fbc5d019.tar.gz
rockbox-38ef849d06c7f206b4e9238058ce7b52fbc5d019.zip
slightly rework peakmeter handling to make it cleaner and be able to be used in conditionals
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25913 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_display.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 9316294aad..9b42a7c18b 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -630,6 +630,10 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
630 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data; 630 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data;
631 bar->draw = false; 631 bar->draw = false;
632 } 632 }
633 else if (data->tokens[i].type == WPS_TOKEN_PEAKMETER)
634 {
635 data->peak_meter_enabled = false;
636 }
633#endif 637#endif
634#ifdef HAVE_ALBUMART 638#ifdef HAVE_ALBUMART
635 if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) 639 if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
@@ -692,6 +696,9 @@ static bool get_line(struct gui_wps *gwps,
692 break; 696 break;
693 697
694#ifdef HAVE_LCD_BITMAP 698#ifdef HAVE_LCD_BITMAP
699 case WPS_TOKEN_PEAKMETER:
700 data->peak_meter_enabled = true;
701 break;
695 case WPS_TOKEN_VOLUMEBAR: 702 case WPS_TOKEN_VOLUMEBAR:
696 case WPS_TOKEN_BATTERY_PERCENTBAR: 703 case WPS_TOKEN_BATTERY_PERCENTBAR:
697 case WPS_TOKEN_PROGRESSBAR: 704 case WPS_TOKEN_PROGRESSBAR:
@@ -1083,19 +1090,6 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1083 1090
1084 bool update_line, new_subline_refresh; 1091 bool update_line, new_subline_refresh;
1085 1092
1086#ifdef HAVE_LCD_BITMAP
1087
1088 /* to find out wether the peak meter is enabled we
1089 assume it wasn't until we find a line that contains
1090 the peak meter. We can't use peak_meter_enabled itself
1091 because that would mean to turn off the meter thread
1092 temporarily. (That shouldn't matter unless yield
1093 or sleep is called but who knows...)
1094 */
1095 bool enable_pm = false;
1096
1097#endif
1098
1099 /* reset to first subline if refresh all flag is set */ 1093 /* reset to first subline if refresh all flag is set */
1100 if (refresh_mode == WPS_REFRESH_ALL) 1094 if (refresh_mode == WPS_REFRESH_ALL)
1101 { 1095 {
@@ -1226,27 +1220,27 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1226 /* peakmeter */ 1220 /* peakmeter */
1227 if (flags & vp_refresh_mode & WPS_REFRESH_PEAK_METER) 1221 if (flags & vp_refresh_mode & WPS_REFRESH_PEAK_METER)
1228 { 1222 {
1229 /* the peakmeter should be alone on its line */ 1223 if (!data->peak_meter_enabled)
1230 update_line = false; 1224 {
1231 1225 peak_meter_enable(false);
1232 int h = font_get(skin_viewport->vp.font)->height;
1233 int peak_meter_y = line_count* h;
1234
1235 /* The user might decide to have the peak meter in the last
1236 line so that it is only displayed if no status bar is
1237 visible. If so we neither want do draw nor enable the
1238 peak meter. */
1239 if (peak_meter_y + h <= skin_viewport->vp.y+skin_viewport->vp.height) {
1240 /* found a line with a peak meter -> remember that we must
1241 enable it later */
1242 enable_pm = true;
1243 peak_meter_enabled = true;
1244 peak_meter_screen(gwps->display, 0, peak_meter_y,
1245 MIN(h, skin_viewport->vp.y+skin_viewport->vp.height - peak_meter_y));
1246 } 1226 }
1247 else 1227 else
1248 { 1228 {
1249 peak_meter_enabled = false; 1229 /* the peakmeter should be alone on its line */
1230 update_line = false;
1231
1232 int h = font_get(skin_viewport->vp.font)->height;
1233 int peak_meter_y = line_count* h;
1234
1235 /* The user might decide to have the peak meter in the last
1236 line so that it is only displayed if no status bar is
1237 visible. If so we neither want do draw nor enable the
1238 peak meter. */
1239 if (peak_meter_y + h <= skin_viewport->vp.y+skin_viewport->vp.height) {
1240 peak_meter_enable(true);
1241 peak_meter_screen(gwps->display, 0, peak_meter_y,
1242 MIN(h, skin_viewport->vp.y+skin_viewport->vp.height - peak_meter_y));
1243 }
1250 } 1244 }
1251 } 1245 }
1252 1246
@@ -1302,9 +1296,6 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1302#endif 1296#endif
1303 } 1297 }
1304 1298
1305#ifdef HAVE_LCD_BITMAP
1306 data->peak_meter_enabled = enable_pm;
1307#endif
1308 /* Restore the default viewport */ 1299 /* Restore the default viewport */
1309 display->set_viewport(NULL); 1300 display->set_viewport(NULL);
1310 1301