···575575 return false;
576576}
577577578578+int get_setting_info_for_bar(int setting_id, int *count, int *val)
579579+{
580580+ const struct settings_list *setting = &settings[setting_id];
581581+ int var_type = setting->flags&F_T_MASK;
582582+ void (*function)(int) = NULL;
583583+ int oldvalue;
584584+585585+ if (var_type == F_T_INT || var_type == F_T_UINT)
586586+ {
587587+ oldvalue = *(int*)setting->setting;
588588+ }
589589+ else if (var_type == F_T_BOOL)
590590+ {
591591+ oldvalue = *(bool*)setting->setting?1:0;
592592+ }
593593+ else
594594+ {
595595+ *val = 0;
596596+ *count = 1;
597597+ return false; /* only int/bools can go here */
598598+ }
599599+600600+ val_to_selection(setting, oldvalue, count, val, &function);
601601+ return true;
602602+}
+2
apps/gui/option_select.h
···4848/* only use this for int and bool settings */
4949int option_value_as_int(const struct settings_list *setting);
50505151+int get_setting_info_for_bar(int setting_id, int *count, int *val);
5252+5153#endif /* _GUI_OPTION_SELECT_H_ */
+8
apps/gui/skin_engine/skin_display.c
···4444#include "audio.h"
4545#include "tagcache.h"
4646#include "list.h"
4747+#include "option_select.h"
47484849#ifdef HAVE_LCD_BITMAP
4950#include "peakmeter.h"
···144145 skinlist_get_scrollbar(&val, &min, &max);
145146 end = val - min;
146147 length = max - min;
148148+ }
149149+ else if (pb->type == SKIN_TOKEN_SETTINGBAR)
150150+ {
151151+ int val, count;
152152+ get_setting_info_for_bar(pb->setting_id, &count, &val);
153153+ length = count - 1;
154154+ end = val;
147155 }
148156#if CONFIG_TUNER
149157 else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
···209209#endif
210210 case SKIN_TOKEN_VOLUMEBAR:
211211 case SKIN_TOKEN_BATTERY_PERCENTBAR:
212212+ case SKIN_TOKEN_SETTINGBAR:
212213#ifdef HAVE_LCD_BITMAP
213214 case SKIN_TOKEN_PROGRESSBAR:
214215 case SKIN_TOKEN_TUNER_RSSI_BAR:
+2
apps/gui/skin_engine/wps_internals.h
···112112 OFFSETTYPE(struct gui_img *) slider;
113113 bool horizontal;
114114 OFFSETTYPE(struct gui_img *) backdrop;
115115+ int setting_id; /* for the setting bar type */
116116+115117};
116118117119struct draw_rectangle {
+3-2
lib/skin_parser/tag_table.c
···211211 { SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii", 0 },
212212213213 { SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f", SKIN_REFRESH_STATIC|NOBREAK },
214214-215215- { SKIN_TOKEN_SETTING, "St" , "S", SKIN_REFRESH_DYNAMIC },
214214+ /* This uses the bar tag params also but the first item can be a string
215215+ * and we don't allow no params. */
216216+ { SKIN_TOKEN_SETTING, "St" , "[Si]|iiis*", SKIN_REFRESH_DYNAMIC },
216217 { SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S", SKIN_REFRESH_STATIC },
217218 { SKIN_TOKEN_LANG_IS_RTL, "Sr" , "", SKIN_REFRESH_STATIC },
218219
···360360 \config{\%St(<setting\tabnlindent{}name>)} & The value of the Rockbox
361361 setting with the specified name. See \reference{ref:config_file_options}
362362 for the list of the available settings.\\
363363+ \config{\%St(...)} & Draw a bar using from the setting.
364364+ See \reference{ref:bar_tags} for details.\\
363365 \end{tagmap}
364366365367Examples:
···715717 \opt{touchscreen}{
716718 \item[notouch] -- don't create the touchregion for progress/volume bars.
717719 }
720720+ \item[setting] -- Specify the setting name to draw the bar from (bar must be
721721+ \%St type), the next param is the settings config name.
718722\end{description}
719723720724Example: \config{\%pb(0,0,-,-,-,nofill, slider, slider\_image, invert)} -- draw