summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorKevin Ferrare <kevin@rockbox.org>2005-11-06 03:18:34 +0000
committerKevin Ferrare <kevin@rockbox.org>2005-11-06 03:18:34 +0000
commit9b5264d37faf0588f996a1716c41a6e51f4d16ea (patch)
tree03d6f571683fdaa2b2877c4df51fb75df9d76fae /apps/settings.c
parentec8f328d89f7db22f9894148e2c0431e44ebf191 (diff)
Corrected the bug with boolean settings (the inverted screen that couldn't be turned back to normal) added full multi-screen sound setting support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7761 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 6e863e7fa7..870376c8b2 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1418,12 +1418,14 @@ bool set_int(const char* string,
gui_syncselect_draw(&select);
talk_unit(voice_unit, *variable);
if ( function )
- function(gui_select_get_selected(&select));
+ function(*variable);
}
gui_syncstatusbar_draw(&statusbars, false);
if(gui_select_is_canceled(&select))
{
*variable=oldvalue;
+ if ( function )
+ function(*variable);
return false;
}
if(default_event_handler(button) == SYS_USB_CONNECTED)
@@ -1446,11 +1448,14 @@ bool set_int(const char* string,
else \
*(bool *)dest=value?true:false
-#define set_int_fromtype(type, dest, var) \
- if (type == INT) \
- dest=*(int *)var; \
- else \
- dest=*(bool *)var?1:0
+#define type_fromvoidptr(type, value) \
+ (type == INT)? \
+ (int)(*(int*)(value)) \
+ : \
+ (bool)(*(bool*)(value))
+
+#define get_int_fromtype(type, var) \
+ (type == INT)?*(int *)var:(*(bool *)var?1:0)
bool set_option(const char* string, void* variable, enum optiontype type,
const struct opt_items* options, int numoptions, void (*function)(int))
@@ -1458,12 +1463,12 @@ bool set_option(const char* string, void* variable, enum optiontype type,
int button;
int oldvalue;
/* oldvalue=*variable; */
- set_int_fromtype(type, oldvalue, variable);
+ oldvalue=get_int_fromtype(type, variable);
struct gui_select select;
gui_select_init_items(&select, string, oldvalue, options, numoptions);
gui_syncselect_draw(&select);
if (global_settings.talk_menu)
- talk_id(options[gui_select_get_selected(&select)].voice_id, false);
+ talk_id(options[gui_select_get_selected(&select)].voice_id, true);
while ( !gui_select_is_validated(&select) )
{
gui_syncstatusbar_draw(&statusbars, true);
@@ -1476,13 +1481,15 @@ bool set_option(const char* string, void* variable, enum optiontype type,
if (global_settings.talk_menu)
talk_id(options[gui_select_get_selected(&select)].voice_id, false);
if ( function )
- function(*(int *)variable);
+ function(type_fromvoidptr(type, variable));
}
gui_syncstatusbar_draw(&statusbars, false);
if(gui_select_is_canceled(&select))
{
/* *variable=oldvalue; */
set_type_fromint(type, variable, oldvalue);
+ if ( function )
+ function(type_fromvoidptr(type, variable));
return false;
}
if(default_event_handler(button) == SYS_USB_CONNECTED)