summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-01-13 10:56:23 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-01-13 10:56:23 +0000
commit605e2d0e90b335897cc1e29c575a27dabc778491 (patch)
tree55cb67f5e7abc0fe1f5d62090ffda4abb4948959 /apps/gui
parentded64f1db58e15bb310da2c685afed6b3dbce4b5 (diff)
downloadrockbox-605e2d0e90b335897cc1e29c575a27dabc778491.tar.gz
rockbox-605e2d0e90b335897cc1e29c575a27dabc778491.zip
New Touchscreen region type... 'mute' which un/mutes volume without pausing playback
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29046 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/skin_engine/skin_parser.c12
-rw-r--r--apps/gui/skin_engine/wps_internals.h5
-rw-r--r--apps/gui/statusbar-skinned.c19
-rw-r--r--apps/gui/wps.c15
4 files changed, 46 insertions, 5 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 5a90873d86..e23f84207e 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -880,6 +880,7 @@ static const struct touchaction touchactions[] = {
880 { "resumeplayback", ACTION_TREE_WPS}, /* returns to previous music, WPS/FM */ 880 { "resumeplayback", ACTION_TREE_WPS}, /* returns to previous music, WPS/FM */
881 /* not really WPS specific, but no equivilant ACTION_STD_* */ 881 /* not really WPS specific, but no equivilant ACTION_STD_* */
882 {"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP}, 882 {"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
883 {"mute", ACTION_TOUCH_MUTE },
883 884
884 /* generic settings changers */ 885 /* generic settings changers */
885 {"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC}, 886 {"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
@@ -945,7 +946,7 @@ static int parse_touchregion(struct skin_element *element,
945 region->wvp = curr_vp; 946 region->wvp = curr_vp;
946 region->armed = false; 947 region->armed = false;
947 region->reverse_bar = false; 948 region->reverse_bar = false;
948 region->extradata = NULL; 949 region->data = NULL;
949 action = element->params[4].data.text; 950 action = element->params[4].data.text;
950 951
951 strcpy(temp, action); 952 strcpy(temp, action);
@@ -998,7 +999,7 @@ static int parse_touchregion(struct skin_element *element,
998 break; 999 break;
999 if (j==nb_settings) 1000 if (j==nb_settings)
1000 return WPS_ERROR_INVALID_PARAM; 1001 return WPS_ERROR_INVALID_PARAM;
1001 region->extradata = (void*)&settings[j]; 1002 region->data = (void*)&settings[j];
1002 } 1003 }
1003 } 1004 }
1004 break; 1005 break;
@@ -1011,6 +1012,13 @@ static int parse_touchregion(struct skin_element *element,
1011 if (!item) 1012 if (!item)
1012 return WPS_ERROR_INVALID_PARAM; 1013 return WPS_ERROR_INVALID_PARAM;
1013 add_to_ll_chain(&wps_data->touchregions, item); 1014 add_to_ll_chain(&wps_data->touchregions, item);
1015
1016 if (region->action == ACTION_TOUCH_MUTE)
1017 {
1018 region->value = global_settings.volume;
1019 }
1020
1021
1014 return 0; 1022 return 0;
1015} 1023}
1016#endif 1024#endif
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 24edde7b93..02585f22b2 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -196,7 +196,10 @@ struct touchregion {
196 int action; /* action this button will return */ 196 int action; /* action this button will return */
197 bool armed; /* A region is armed on press. Only armed regions are triggered 197 bool armed; /* A region is armed on press. Only armed regions are triggered
198 on repeat or release. */ 198 on repeat or release. */
199 void* extradata; 199 union { /* Extra data, action dependant */
200 void* data;
201 int value;
202 };
200}; 203};
201#endif 204#endif
202 205
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index a5c751b804..ad89f7a6cb 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -39,6 +39,10 @@
39#include "font.h" 39#include "font.h"
40#include "icon.h" 40#include "icon.h"
41#include "option_select.h" 41#include "option_select.h"
42#ifdef HAVE_TOUCHSCREEN
43#include "sound.h"
44#include "misc.h"
45#endif
42 46
43/* initial setup of wps_data */ 47/* initial setup of wps_data */
44static int update_delay = DEFAULT_UPDATE_DELAY; 48static int update_delay = DEFAULT_UPDATE_DELAY;
@@ -296,10 +300,23 @@ int sb_touch_to_button(int context)
296 case ACTION_SETTINGS_INC: 300 case ACTION_SETTINGS_INC:
297 case ACTION_SETTINGS_DEC: 301 case ACTION_SETTINGS_DEC:
298 { 302 {
299 const struct settings_list *setting = region->extradata; 303 const struct settings_list *setting = region->data;
300 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true); 304 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
301 } 305 }
302 return ACTION_REDRAW; 306 return ACTION_REDRAW;
307 case ACTION_TOUCH_MUTE:
308 {
309 const int min_vol = sound_min(SOUND_VOLUME);
310 if (global_settings.volume == min_vol)
311 global_settings.volume = region->value;
312 else
313 {
314 region->value = global_settings.volume;
315 global_settings.volume = min_vol;
316 }
317 setvol();
318 }
319 return ACTION_REDRAW;
303 /* TODO */ 320 /* TODO */
304 } 321 }
305 return button; 322 return button;
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 7d633ad4e8..e528380576 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -242,10 +242,23 @@ static int skintouch_to_wps(struct wps_data *data)
242 case ACTION_SETTINGS_INC: 242 case ACTION_SETTINGS_INC:
243 case ACTION_SETTINGS_DEC: 243 case ACTION_SETTINGS_DEC:
244 { 244 {
245 const struct settings_list *setting = region->extradata; 245 const struct settings_list *setting = region->data;
246 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true); 246 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
247 } 247 }
248 return ACTION_REDRAW; 248 return ACTION_REDRAW;
249 case ACTION_TOUCH_MUTE:
250 {
251 const int min_vol = sound_min(SOUND_VOLUME);
252 if (global_settings.volume == min_vol)
253 global_settings.volume = region->value;
254 else
255 {
256 region->value = global_settings.volume;
257 global_settings.volume = min_vol;
258 }
259 setvol();
260 }
261 return ACTION_REDRAW;
249 } 262 }
250 return button; 263 return button;
251} 264}