summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2012-07-06 14:28:34 +1000
committerJonathan Gordon <rockbox@jdgordon.info>2012-07-06 14:28:34 +1000
commit68ee7aac6e7a16804ac6880cc076c43502989c92 (patch)
treec352d6ee4e7517d2469c0677123a975f0f66646e
parent65f9df3083623484efccf502c33ecc959555d247 (diff)
downloadrockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.tar.gz
rockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.zip
skin_engine: Make pressing the setting bar touch region work
might need some tweaking, but works. Change-Id: I0784cd4fe9996531da6cc275491ff3b4e83cdbcf
-rw-r--r--apps/action.h1
-rw-r--r--apps/gui/option_select.c18
-rw-r--r--apps/gui/option_select.h3
-rw-r--r--apps/gui/skin_engine/skin_parser.c6
-rw-r--r--apps/gui/skin_engine/skin_touchsupport.c14
5 files changed, 41 insertions, 1 deletions
diff --git a/apps/action.h b/apps/action.h
index 508d9a31a6..e54d5deacf 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -254,6 +254,7 @@ enum {
254 ACTION_TOUCH_SCROLLBAR, 254 ACTION_TOUCH_SCROLLBAR,
255 ACTION_TOUCH_VOLUME, 255 ACTION_TOUCH_VOLUME,
256 ACTION_TOUCH_SOFTLOCK, 256 ACTION_TOUCH_SOFTLOCK,
257 ACTION_TOUCH_SETTING,
257#endif 258#endif
258 259
259 /* USB HID codes */ 260 /* USB HID codes */
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index f85570d699..d42d08188a 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -600,3 +600,21 @@ int get_setting_info_for_bar(int setting_id, int *count, int *val)
600 val_to_selection(setting, oldvalue, count, val, &function); 600 val_to_selection(setting, oldvalue, count, val, &function);
601 return true; 601 return true;
602} 602}
603
604#ifdef HAVE_TOUCHSCREEN
605void update_setting_value_from_touch(int setting_id, int selection)
606{
607 const struct settings_list *setting = &settings[setting_id];
608 int new_val = selection_to_val(setting, selection);
609 int var_type = setting->flags&F_T_MASK;
610
611 if (var_type == F_T_INT || var_type == F_T_UINT)
612 {
613 *(int*)setting->setting = new_val;
614 }
615 else if (var_type == F_T_BOOL)
616 {
617 *(bool*)setting->setting = new_val ? true : false;
618 }
619}
620#endif
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index 3a14a179a6..4ccc15a14e 100644
--- a/apps/gui/option_select.h
+++ b/apps/gui/option_select.h
@@ -49,5 +49,8 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
49int option_value_as_int(const struct settings_list *setting); 49int option_value_as_int(const struct settings_list *setting);
50 50
51int get_setting_info_for_bar(int setting_id, int *count, int *val); 51int get_setting_info_for_bar(int setting_id, int *count, int *val);
52#ifdef HAVE_TOUCHSCREEN
53void update_setting_value_from_touch(int setting_id, int selection);
54#endif
52 55
53#endif /* _GUI_OPTION_SELECT_H_ */ 56#endif /* _GUI_OPTION_SELECT_H_ */
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index cbc2ebed4e..237e4033e2 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1091,7 +1091,9 @@ static int parse_progressbar_tag(struct skin_element* element,
1091 1091
1092#ifdef HAVE_TOUCHSCREEN 1092#ifdef HAVE_TOUCHSCREEN
1093 if (!suppress_touchregion && 1093 if (!suppress_touchregion &&
1094 (token->type == SKIN_TOKEN_VOLUMEBAR || token->type == SKIN_TOKEN_PROGRESSBAR)) 1094 (token->type == SKIN_TOKEN_VOLUMEBAR ||
1095 token->type == SKIN_TOKEN_PROGRESSBAR ||
1096 token->type == SKIN_TOKEN_SETTINGBAR))
1095 { 1097 {
1096 struct touchregion *region = skin_buffer_alloc(sizeof(*region)); 1098 struct touchregion *region = skin_buffer_alloc(sizeof(*region));
1097 struct skin_token_list *item; 1099 struct skin_token_list *item;
@@ -1102,6 +1104,8 @@ static int parse_progressbar_tag(struct skin_element* element,
1102 1104
1103 if (token->type == SKIN_TOKEN_VOLUMEBAR) 1105 if (token->type == SKIN_TOKEN_VOLUMEBAR)
1104 region->action = ACTION_TOUCH_VOLUME; 1106 region->action = ACTION_TOUCH_VOLUME;
1107 else if (token->type == SKIN_TOKEN_SETTINGBAR)
1108 region->action = ACTION_TOUCH_SETTING;
1105 else 1109 else
1106 region->action = ACTION_TOUCH_SCROLLBAR; 1110 region->action = ACTION_TOUCH_SCROLLBAR;
1107 1111
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index f685cd0b70..337d3ef5f7 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -104,6 +104,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
104 { 104 {
105 case ACTION_TOUCH_SCROLLBAR: 105 case ACTION_TOUCH_SCROLLBAR:
106 case ACTION_TOUCH_VOLUME: 106 case ACTION_TOUCH_VOLUME:
107 case ACTION_TOUCH_SETTING:
107 if (edge_offset) 108 if (edge_offset)
108 { 109 {
109 struct progressbar *bar = 110 struct progressbar *bar =
@@ -284,6 +285,19 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
284 returncode = ACTION_REDRAW; 285 returncode = ACTION_REDRAW;
285 } 286 }
286 break; 287 break;
288 case ACTION_TOUCH_SETTING:
289 {
290 struct progressbar *bar =
291 SKINOFFSETTOPTR(skin_buffer, temp->bar);
292 if (bar && edge_offset)
293 {
294 int val, count;
295 get_setting_info_for_bar(bar->setting_id, &count, &val);
296 val = *edge_offset * count / 100;
297 update_setting_value_from_touch(bar->setting_id, val);
298 }
299 }
300 break;
287 } 301 }
288 return returncode; 302 return returncode;
289 } 303 }