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 { 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 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) 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 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 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 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, #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 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, { 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; }