From 6f4c6ed99007f89099b74bfbb95f5ca58b0ead3c Mon Sep 17 00:00:00 2001 From: Stéphane Doyon Date: Wed, 7 Nov 2007 01:37:00 +0000 Subject: Straighten out voicing of yesno dialogs. Make it so gui_syncyesno_run() does not modify the text_messages passed as argument, simplify the code and even reduce size a bit. The key is to support voicing at the level of the text_message itself. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15505 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/yesno.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'apps/gui/yesno.c') diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 4e86b017ca..891e73809b 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -101,25 +101,6 @@ static bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result) #include "debug.h" -/* Processes a text_message whose lines may be virtual pointers - representing language / voicefont IDs (see settings.h). Copies out - the IDs to the ids array, which is of length maxlen, and replaces - the pointers in the text_message with the actual language strings. - The ids array is terminated with the TALK_FINAL_ID sentinel - element. */ -static void extract_talk_ids(struct text_message *m, long *ids, int maxlen) -{ - int line, i=0; - if(m) - for(line=0; linenb_lines; line++) { - long id = P2ID((unsigned char *)m->message_lines[line]); - if(id>=0 && imessage_lines[line] = (char *)P2STR((unsigned char *)m->message_lines[line]); - } - ids[i] = TALK_FINAL_ID; -} - enum yesno_res gui_syncyesno_run(struct text_message * main_message, struct text_message * yes_message, struct text_message * no_message) @@ -129,13 +110,7 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message, int result=-1; bool result_displayed; struct gui_yesno yn[NB_SCREENS]; - long voice_ids[5]; long talked_tick = 0; - /* The text messages may contain virtual pointers to IDs (see - settings.h) instead of plain strings. Copy the IDs out so we - can speak them, and unwrap the actual language strings. */ - extract_talk_ids(main_message, voice_ids, - sizeof(voice_ids)/sizeof(voice_ids[0])); FOR_NB_SCREENS(i) { gui_yesno_init(&(yn[i]), main_message, yes_message, no_message); @@ -149,7 +124,7 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message, && (talked_tick==0 || TIME_AFTER(current_tick, talked_tick+HZ*5))) { talked_tick = current_tick; - talk_idarray(voice_ids, false); + talk_text_message(main_message, false); } button = get_action(CONTEXT_YESNOSCREEN, HZ*5); switch (button) @@ -168,16 +143,13 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message, } } - /* extract_talk_ids also converts ID to STR */ - extract_talk_ids((result == YESNO_YES) ? yes_message : no_message, - voice_ids, sizeof(voice_ids)/sizeof(voice_ids[0])); - FOR_NB_SCREENS(i) result_displayed=gui_yesno_draw_result(&(yn[i]), result); if (global_settings.talk_menu) { - talk_idarray(voice_ids, false); + talk_text_message((result == YESNO_YES) ? yes_message + : no_message, false); talk_force_enqueue_next(); } if(result_displayed) -- cgit v1.2.3