summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorStéphane Doyon <s.doyon@videotron.ca>2007-10-21 00:22:49 +0000
committerStéphane Doyon <s.doyon@videotron.ca>2007-10-21 00:22:49 +0000
commit27615a4b6d8c14a580550c14f938bd2076fd2670 (patch)
treee93baa05fc093ae789ee53324d8cb04c421fcadc /apps
parent8e82a9057813e1e34991b5403cc66d1f7097827a (diff)
downloadrockbox-27615a4b6d8c14a580550c14f938bd2076fd2670.tar.gz
rockbox-27615a4b6d8c14a580550c14f938bd2076fd2670.zip
From FS#7774: use list voice callback in option selection (option_screen(()).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15233 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/option_select.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 3b26ab12d2..6777aeb769 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -42,6 +42,8 @@
42#define ASCENDING_INT_SETTINGS 42#define ASCENDING_INT_SETTINGS
43#endif 43#endif
44 44
45static int selection_to_val(struct settings_list *setting, int selection);
46
45static const char *unit_strings[] = 47static const char *unit_strings[] =
46{ 48{
47 [UNIT_INT] = "", [UNIT_MS] = "ms", 49 [UNIT_INT] = "", [UNIT_MS] = "ms",
@@ -131,10 +133,10 @@ static char *option_get_valuestring(struct settings_list *setting,
131 return buffer; 133 return buffer;
132} 134}
133 135
134static void option_talk(struct settings_list *setting, int temp_var) 136static int option_talk(int selected_item, void * data)
135{ 137{
136 if (!global_settings.talk_menu) 138 struct settings_list *setting = (struct settings_list *)data;
137 return; 139 int temp_var = selection_to_val(setting, selected_item);
138 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) 140 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
139 { 141 {
140 bool val = temp_var==1?true:false; 142 bool val = temp_var==1?true:false;
@@ -177,6 +179,7 @@ static void option_talk(struct settings_list *setting, int temp_var)
177 talk_id(P2ID(setting->choice_setting->desc[value]), false); 179 talk_id(P2ID(setting->choice_setting->desc[value]), false);
178 } 180 }
179 } 181 }
182 return 0;
180} 183}
181#if 0 184#if 0
182int option_select_next_val(struct settings_list *setting, 185int option_select_next_val(struct settings_list *setting,
@@ -335,6 +338,8 @@ bool option_screen(struct settings_list *setting,
335 338
336 gui_synclist_set_title(&lists, title, Icon_Questionmark); 339 gui_synclist_set_title(&lists, title, Icon_Questionmark);
337 gui_synclist_set_icon_callback(&lists, NULL); 340 gui_synclist_set_icon_callback(&lists, NULL);
341 if(global_settings.talk_menu)
342 gui_synclist_set_voice_callback(&lists, option_talk);
338 343
339 /* set the number of items and current selection */ 344 /* set the number of items and current selection */
340 if (var_type == F_T_INT || var_type == F_T_UINT) 345 if (var_type == F_T_INT || var_type == F_T_UINT)
@@ -390,13 +395,11 @@ bool option_screen(struct settings_list *setting,
390 gui_synclist_limit_scroll(&lists, true); 395 gui_synclist_limit_scroll(&lists, true);
391 gui_synclist_draw(&lists); 396 gui_synclist_draw(&lists);
392 /* talk the item */ 397 /* talk the item */
393 option_talk(setting, *variable); 398 gui_synclist_speak_item(&lists);
394 while (!done) 399 while (!done)
395 { 400 {
396 action = get_action(CONTEXT_LIST, TIMEOUT_BLOCK); 401 if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK,
397 if (action == ACTION_NONE) 402 &lists, &action,
398 continue;
399 if (gui_synclist_do_button(&lists, &action,
400 allow_wrap? LIST_WRAP_UNLESS_HELD: LIST_WRAP_OFF)) 403 allow_wrap? LIST_WRAP_UNLESS_HELD: LIST_WRAP_OFF))
401 { 404 {
402 selected = gui_synclist_get_sel_pos(&lists); 405 selected = gui_synclist_get_sel_pos(&lists);
@@ -406,9 +409,9 @@ bool option_screen(struct settings_list *setting,
406 if (!use_temp_var) 409 if (!use_temp_var)
407 *(bool*)setting->setting = selected==1?true:false; 410 *(bool*)setting->setting = selected==1?true:false;
408 } 411 }
409 /* talk */
410 option_talk(setting, *variable);
411 } 412 }
413 else if (action == ACTION_NONE)
414 continue;
412 else if (action == ACTION_STD_CANCEL) 415 else if (action == ACTION_STD_CANCEL)
413 { 416 {
414 bool show_cancel = false; 417 bool show_cancel = false;