diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-07-05 22:44:13 +1000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-07-05 23:30:06 +1000 |
commit | 65f9df3083623484efccf502c33ecc959555d247 (patch) | |
tree | 6d55b2eb2d874166be00306a5cc3a7c67ebea227 /apps/gui/option_select.c | |
parent | f6d6a4602c9bb94565f8bb421b465a06f215fb7d (diff) | |
download | rockbox-65f9df3083623484efccf502c33ecc959555d247.tar.gz rockbox-65f9df3083623484efccf502c33ecc959555d247.zip |
skin_engine: Allow the %St() (setting) skin tag be used as a bar
%St(<setting name>) or %St(<bar tags>, setting, <setting name>)
Change-Id: I71396d683634d4d1ad2357018c4029ecb4229677
Diffstat (limited to 'apps/gui/option_select.c')
-rw-r--r-- | apps/gui/option_select.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index ca206b86da..f85570d699 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -575,3 +575,28 @@ bool option_screen(const struct settings_list *setting, | |||
575 | return false; | 575 | return false; |
576 | } | 576 | } |
577 | 577 | ||
578 | int get_setting_info_for_bar(int setting_id, int *count, int *val) | ||
579 | { | ||
580 | const struct settings_list *setting = &settings[setting_id]; | ||
581 | int var_type = setting->flags&F_T_MASK; | ||
582 | void (*function)(int) = NULL; | ||
583 | int oldvalue; | ||
584 | |||
585 | if (var_type == F_T_INT || var_type == F_T_UINT) | ||
586 | { | ||
587 | oldvalue = *(int*)setting->setting; | ||
588 | } | ||
589 | else if (var_type == F_T_BOOL) | ||
590 | { | ||
591 | oldvalue = *(bool*)setting->setting?1:0; | ||
592 | } | ||
593 | else | ||
594 | { | ||
595 | *val = 0; | ||
596 | *count = 1; | ||
597 | return false; /* only int/bools can go here */ | ||
598 | } | ||
599 | |||
600 | val_to_selection(setting, oldvalue, count, val, &function); | ||
601 | return true; | ||
602 | } | ||