summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-08-28 11:00:54 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-08-28 11:00:54 +0000
commit51edc1102cabf80d8e1fcc4dd800f57202b318e4 (patch)
treeb9b7c73e51e36d4ea2cf5a903223934eb58776d2 /apps
parenta60d001bcadf60f3211fe5b8da9e340c370c97db (diff)
downloadrockbox-51edc1102cabf80d8e1fcc4dd800f57202b318e4.zip
rockbox-51edc1102cabf80d8e1fcc4dd800f57202b318e4.tar.gz
rockbox-51edc1102cabf80d8e1fcc4dd800f57202b318e4.tar.bz2
rockbox-51edc1102cabf80d8e1fcc4dd800f57202b318e4.tar.xz
Change the way set_option() works so these settings are voiced again (recording settings mostly..) Fixes FS#7552
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14487 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/option_select.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index c57bb64..1a45f2f 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -452,35 +452,42 @@ bool option_screen(struct settings_list *setting,
Compatability functions
*******************************************************/
#define MAX_OPTIONS 32
+const struct opt_items *set_option_options;
+void set_option_formatter(char* buf, size_t size, int item, const char* unit)
+{
+ (void)unit;
+ const unsigned char *text = set_option_options[item].string;
+ snprintf(buf, size, "%s", P2STR(text));
+}
+long set_option_get_talk_id(int value)
+{
+ return set_option_options[value].voice_id;
+}
bool set_option(const char* string, void* variable, enum optiontype type,
const struct opt_items* options,
int numoptions, void (*function)(int))
{
int temp;
- char *strings[MAX_OPTIONS];
- struct choice_setting data;
struct settings_list item;
- for (temp=0; temp<MAX_OPTIONS && temp<numoptions; temp++)
- strings[temp] = (char*)options[temp].string;
+ struct int_setting data = {
+ function, UNIT_INT, 0, numoptions-1, 1,
+ set_option_formatter, set_option_get_talk_id
+ };
+ set_option_options = options;
+ item.int_setting = &data;
+ item.flags = F_INT_SETTING|F_T_INT;
+ item.lang_id = -1;
+ item.cfg_vals = (char*)string;
+ item.setting = &temp;
if (type == BOOL)
- {
temp = *(bool*)variable? 1: 0;
- item.setting = &temp;
- }
else
- item.setting = variable;
- item.flags = F_CHOICE_SETTING|F_T_INT;
- item.lang_id = -1;
- item.cfg_vals = (char*)string;
- data.count = numoptions<MAX_OPTIONS ? numoptions: MAX_OPTIONS;
- data.desc = (void*)strings; /* shutup gcc... */
- data.option_callback = function;
- item.choice_setting = &data;
+ temp = *(int*)variable;
option_screen(&item, false, NULL);
if (type == BOOL)
- {
*(bool*)variable = (temp == 1? true: false);
- }
+ else
+ *(int*)variable = temp;
return false;
}