mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
e8a51569ad
commit
7b1dd6b60a
7 changed files with 42 additions and 26 deletions
|
@ -594,7 +594,7 @@ bool option_screen(const struct settings_list *setting,
|
|||
return false;
|
||||
}
|
||||
|
||||
int get_setting_info_for_bar(const struct settings_list *setting, int *count, int *val)
|
||||
int get_setting_info_for_bar(const struct settings_list *setting, int offset, int *count, int *val)
|
||||
{
|
||||
int var_type = setting->flags&F_T_MASK;
|
||||
void (*function)(int) = NULL;
|
||||
|
@ -602,7 +602,9 @@ int get_setting_info_for_bar(const struct settings_list *setting, int *count, in
|
|||
|
||||
if (var_type == F_T_INT || var_type == F_T_UINT)
|
||||
{
|
||||
oldvalue = *(int*)setting->setting;
|
||||
if (!(setting->flags&F_EQSETTING) || offset > 2)
|
||||
offset = 0;
|
||||
oldvalue = ((int*)setting->setting)[offset];
|
||||
}
|
||||
else if (var_type == F_T_BOOL)
|
||||
{
|
||||
|
@ -620,14 +622,16 @@ int get_setting_info_for_bar(const struct settings_list *setting, int *count, in
|
|||
}
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
void update_setting_value_from_touch(const struct settings_list *setting, int selection)
|
||||
void update_setting_value_from_touch(const struct settings_list *setting, int offset, int selection)
|
||||
{
|
||||
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;
|
||||
if (!(setting->flags&F_EQSETTING) || offset > 2)
|
||||
offset = 0;
|
||||
((int*)setting->setting)[offset] = new_val;
|
||||
}
|
||||
else if (var_type == F_T_BOOL)
|
||||
{
|
||||
|
|
|
@ -46,9 +46,9 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
|
|||
/* only use this for int and bool settings */
|
||||
int option_value_as_int(const struct settings_list *setting);
|
||||
|
||||
int get_setting_info_for_bar(const struct settings_list *setting, int *count, int *val);
|
||||
int get_setting_info_for_bar(const struct settings_list *setting, int offset, int *count, int *val);
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
void update_setting_value_from_touch(const struct settings_list *setting, int selection);
|
||||
void update_setting_value_from_touch(const struct settings_list *setting, int offset, int selection);
|
||||
#endif
|
||||
|
||||
#endif /* _GUI_OPTION_SELECT_H_ */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -313,9 +313,9 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
|
|||
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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -708,6 +708,7 @@ display cycling round the defined sublines. See
|
|||
\opt{touchscreen}{
|
||||
\item[notouch] -- don't create the touchregion for progress/volume bars.
|
||||
}
|
||||
\item[soffset] -- For compound settings (such as the equalizer), this lets you pick which element in the set to use. The next param must be the number. Must be specified prior to the setting name.
|
||||
\item[setting] -- Specify the setting name to draw the bar from (bar must be
|
||||
\%St type), the next param is the settings config name.
|
||||
\end{description}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue