From 28aef1f96ac06cdd094f46d4e47c148be17bc438 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 31 Oct 2009 14:55:13 +0000 Subject: Consolidate code duplication in WPS volume changing handling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23436 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/wps.c | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) (limited to 'apps') diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 8d1a0b9bf9..e449644502 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -707,6 +707,7 @@ long gui_wps_show(void) bool exit = false; bool bookmark = false; bool update = false; + bool vol_changed = false; int i; long last_left = 0, last_right = 0; @@ -867,40 +868,12 @@ long gui_wps_show(void) break; case ACTION_WPS_VOLUP: - { - FOR_NB_SCREENS(i) - gui_wps[i].data->button_time_volume = current_tick; global_settings.volume++; - bool res = false; - setvol(); - FOR_NB_SCREENS(i) - { - if(update_onvol_change(&gui_wps[i])) - res = true; - } - if (res) { - restore = true; - restoretimer = RESTORE_WPS_NEXT_SECOND; - } - } - break; + vol_changed = true; + break; case ACTION_WPS_VOLDOWN: - { - FOR_NB_SCREENS(i) - gui_wps[i].data->button_time_volume = current_tick; global_settings.volume--; - setvol(); - bool res = false; - FOR_NB_SCREENS(i) - { - if(update_onvol_change(&gui_wps[i])) - res = true; - } - if (res) { - restore = true; - restoretimer = RESTORE_WPS_NEXT_SECOND; - } - } + vol_changed = true; break; /* fast forward OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ @@ -1155,6 +1128,23 @@ long gui_wps_show(void) break; } + if (vol_changed) + { + FOR_NB_SCREENS(i) + gui_wps[i].data->button_time_volume = current_tick; + bool res = false; + setvol(); + FOR_NB_SCREENS(i) + { + if(update_onvol_change(&gui_wps[i])) + res = true; + } + if (res) { + restore = true; + restoretimer = RESTORE_WPS_NEXT_SECOND; + } + } + if (wps_sync_data.do_full_update || update) { #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) -- cgit v1.2.3