summaryrefslogtreecommitdiff
path: root/apps
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 /apps
parent65f9df3083623484efccf502c33ecc959555d247 (diff)
downloadrockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.zip
rockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.tar.gz
rockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.tar.bz2
rockbox-68ee7aac6e7a16804ac6880cc076c43502989c92.tar.xz
skin_engine: Make pressing the setting bar touch region work
might need some tweaking, but works. Change-Id: I0784cd4fe9996531da6cc275491ff3b4e83cdbcf
Diffstat (limited to 'apps')
-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 508d9a3..e54d5de 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -254,6 +254,7 @@ enum {
ACTION_TOUCH_SCROLLBAR,
ACTION_TOUCH_VOLUME,
ACTION_TOUCH_SOFTLOCK,
+ ACTION_TOUCH_SETTING,
#endif
/* USB HID codes */
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index f85570d..d42d081 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)
val_to_selection(setting, oldvalue, count, val, &function);
return true;
}
+
+#ifdef HAVE_TOUCHSCREEN
+void update_setting_value_from_touch(int setting_id, int selection)
+{
+ const struct settings_list *setting = &settings[setting_id];
+ int new_val = selection_to_val(setting, selection);
+ int var_type = setting->flags&F_T_MASK;
+
+ if (var_type == F_T_INT || var_type == F_T_UINT)
+ {
+ *(int*)setting->setting = new_val;
+ }
+ else if (var_type == F_T_BOOL)
+ {
+ *(bool*)setting->setting = new_val ? true : false;
+ }
+}
+#endif
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index 3a14a17..4ccc15a 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
int option_value_as_int(const struct settings_list *setting);
int get_setting_info_for_bar(int setting_id, int *count, int *val);
+#ifdef HAVE_TOUCHSCREEN
+void update_setting_value_from_touch(int setting_id, int selection);
+#endif
#endif /* _GUI_OPTION_SELECT_H_ */
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index cbc2ebe..237e403 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,
#ifdef HAVE_TOUCHSCREEN
if (!suppress_touchregion &&
- (token->type == SKIN_TOKEN_VOLUMEBAR || token->type == SKIN_TOKEN_PROGRESSBAR))
+ (token->type == SKIN_TOKEN_VOLUMEBAR ||
+ token->type == SKIN_TOKEN_PROGRESSBAR ||
+ token->type == SKIN_TOKEN_SETTINGBAR))
{
struct touchregion *region = skin_buffer_alloc(sizeof(*region));
struct skin_token_list *item;
@@ -1102,6 +1104,8 @@ static int parse_progressbar_tag(struct skin_element* element,
if (token->type == SKIN_TOKEN_VOLUMEBAR)
region->action = ACTION_TOUCH_VOLUME;
+ else if (token->type == SKIN_TOKEN_SETTINGBAR)
+ region->action = ACTION_TOUCH_SETTING;
else
region->action = ACTION_TOUCH_SCROLLBAR;
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index f685cd0..337d3ef 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,
{
case ACTION_TOUCH_SCROLLBAR:
case ACTION_TOUCH_VOLUME:
+ case ACTION_TOUCH_SETTING:
if (edge_offset)
{
struct progressbar *bar =
@@ -284,6 +285,19 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
returncode = ACTION_REDRAW;
}
break;
+ case ACTION_TOUCH_SETTING:
+ {
+ struct progressbar *bar =
+ SKINOFFSETTOPTR(skin_buffer, temp->bar);
+ if (bar && edge_offset)
+ {
+ int val, count;
+ get_setting_info_for_bar(bar->setting_id, &count, &val);
+ val = *edge_offset * count / 100;
+ update_setting_value_from_touch(bar->setting_id, val);
+ }
+ }
+ break;
}
return returncode;
}