From 7b1dd6b60a1b39468be02bb7a1e71f4be354ce0f Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 8 Dec 2023 20:30:59 -0500 Subject: RFC: Extend skin engine to handle EQ settings EQ settings are actually an array of 3 ints. I added a skin parameter token that allows specifying which array element to use. So instead of this now-incorrect syntax: %St(0,0,-,-,image,eqbar.bmp,vertical,setting,eq band 1 gain) You would use: %St(0,0,-,-,image,eqbar.bmp,vertical,soffset,2,setting,eq peak filter 1) (the 'gain' is the third element in the eq setting array, thus soffset 2) Change-Id: Ibda712ab87759efb45420566c967742bcefb513b --- apps/gui/skin_engine/skin_display.c | 2 +- apps/gui/skin_engine/skin_parser.c | 17 ++++++++++++++--- apps/gui/skin_engine/skin_touchsupport.c | 26 +++++++++++++------------- apps/gui/skin_engine/wps_internals.h | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-) (limited to 'apps/gui/skin_engine') diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 913bdcfbc4..aa2184a407 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -217,7 +217,7 @@ void draw_progressbar(struct gui_wps *gwps, struct skin_viewport* skin_viewport, else if (pb->type == SKIN_TOKEN_SETTINGBAR) { int val, count; - get_setting_info_for_bar(pb->setting, &count, &val); + get_setting_info_for_bar(pb->setting, pb->setting_offset, &count, &val); length = count - 1; end = val; } diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 39029f79c6..ac68b0dcba 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -960,6 +960,7 @@ static int parse_progressbar_tag(struct skin_element* element, struct viewport *vp = &curr_vp->vp; struct skin_tag_parameter *param = get_param(element, 0); int curr_param = 0; + int setting_offset = 0; char *image_filename = NULL; #ifdef HAVE_TOUCHSCREEN bool suppress_touchregion = false; @@ -1082,7 +1083,7 @@ static int parse_progressbar_tag(struct skin_element* element, enum { eINVERT = 0, eNOFILL, eNOBORDER, eNOBAR, eSLIDER, eIMAGE, - eBACKDROP, eVERTICAL, eHORIZONTAL, eNOTOUCH, eSETTING, + eBACKDROP, eVERTICAL, eHORIZONTAL, eNOTOUCH, eSETTING, eSETTING_OFFSET, e_PB_TAG_COUNT }; @@ -1090,7 +1091,7 @@ static int parse_progressbar_tag(struct skin_element* element, [eNOFILL] = "nofill", [eNOBORDER] = "noborder", [eNOBAR] = "nobar", [eSLIDER] = "slider", [eIMAGE] = "image", [eBACKDROP] = "backdrop", [eVERTICAL] = "vertical", [eHORIZONTAL] = "horizontal", - [eNOTOUCH] = "notouch", [eSETTING] = "setting", [e_PB_TAG_COUNT] = NULL}; + [eNOTOUCH] = "notouch", [eSETTING] = "setting", [eSETTING_OFFSET] = "soffset", [e_PB_TAG_COUNT] = NULL}; int pb_op; while (curr_param < element->params_count) @@ -1158,6 +1159,15 @@ static int parse_progressbar_tag(struct skin_element* element, else if (pb_op == eNOTOUCH) suppress_touchregion = true; #endif + else if (token->type == SKIN_TOKEN_SETTING && pb_op == eSETTING_OFFSET) + { + if (curr_param+1 < element->params_count) + { + curr_param++; + param++; + setting_offset = param->data.number; + } + } else if (token->type == SKIN_TOKEN_SETTING && pb_op == eSETTING) { if (curr_param+1 < element->params_count) @@ -1169,6 +1179,7 @@ static int parse_progressbar_tag(struct skin_element* element, pb->setting = find_setting_by_cfgname(text); if (!pb->setting) return WPS_ERROR_INVALID_PARAM; + pb->setting_offset = setting_offset; #endif } } @@ -1223,7 +1234,7 @@ static int parse_progressbar_tag(struct skin_element* element, else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR) token->type = SKIN_TOKEN_LIST_SCROLLBAR; else if (token->type == SKIN_TOKEN_SETTING) - token->type = SKIN_TOKEN_SETTINGBAR; + token->type = SKIN_TOKEN_SETTINGBAR; pb->type = token->type; #ifdef HAVE_TOUCHSCREEN diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index b952709562..cd2f5b6cd2 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -18,7 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ - + #include "config.h" #include #include "action.h" @@ -80,7 +80,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) regions = SKINOFFSETTOPTR(skin_buffer, regions->next); continue; } - if (data->touchscreen_locked && + if (data->touchscreen_locked && (r->action != ACTION_TOUCH_SOFTLOCK && !r->allow_while_locked)) { regions = SKINOFFSETTOPTR(skin_buffer, regions->next); @@ -143,7 +143,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) r->last_press = current_tick; break; default: - if (r->armed && ((repeated && needs_repeat) || + if (r->armed && ((repeated && needs_repeat) || (released && !needs_repeat))) { returncode = r->action; @@ -166,7 +166,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) skin_disarm_touchregions(gwps); if (temp && temp->press_length == LONG_PRESS) temp->armed = false; - + if (returncode != ACTION_NONE) { if (global_settings.party_mode) @@ -227,9 +227,9 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) case ACTION_SETTINGS_INC: case ACTION_SETTINGS_DEC: { - const struct settings_list *setting = + const struct settings_list *setting = temp->setting_data.setting; - option_select_next_val(setting, + option_select_next_val(setting, returncode == ACTION_SETTINGS_DEC, true); returncode = ACTION_REDRAW; @@ -245,7 +245,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) case F_T_CUSTOM: s->custom_setting ->load_from_cfg(s->setting, SKINOFFSETTOPTR(skin_buffer, data->value.text)); - break; + break; case F_T_INT: case F_T_UINT: *(int*)s->setting = data->value.number; @@ -287,7 +287,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) break; case ACTION_TOUCH_SHUFFLE: /* toggle shuffle mode */ { - global_settings.playlist_shuffle = + global_settings.playlist_shuffle = !global_settings.playlist_shuffle; replaygain_update(); if (global_settings.playlist_shuffle) @@ -299,7 +299,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) break; case ACTION_TOUCH_REPMODE: /* cycle the repeat mode setting */ { - const struct settings_list *rep_setting = + const struct settings_list *rep_setting = find_setting(&global_settings.repeat_mode); option_select_next_val(rep_setting, false, true); audio_flush_and_reload_tracks(); @@ -307,15 +307,15 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) } 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, &count, &val); + get_setting_info_for_bar(bar->setting, bar->setting_offset, &count, &val); val = *edge_offset * count / 1000; - update_setting_value_from_touch(bar->setting, val); + update_setting_value_from_touch(bar->setting, bar->setting_offset, val); } } break; diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 8ad8325e66..6e20ed8da9 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -132,9 +132,9 @@ struct progressbar { bool nobar; OFFSETTYPE(struct gui_img *) slider; bool horizontal; + char setting_offset; OFFSETTYPE(struct gui_img *) backdrop; const struct settings_list *setting; - }; struct draw_rectangle { -- cgit v1.2.3