summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/option_select.c32
-rw-r--r--apps/gui/option_select.h1
-rw-r--r--apps/gui/quickscreen.c24
3 files changed, 15 insertions, 42 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index ffa8f1b0a1..288bf9098b 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -146,21 +146,24 @@ char *option_get_valuestring(struct settings_list *setting,
146 } 146 }
147 return buffer; 147 return buffer;
148} 148}
149void option_talk_value(const struct settings_list *setting, int value, bool enqueue) 149
150static int option_talk(int selected_item, void * data)
150{ 151{
152 struct settings_list *setting = (struct settings_list *)data;
153 int temp_var = selection_to_val(setting, selected_item);
151 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) 154 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
152 { 155 {
153 bool val = value==1?true:false; 156 bool val = temp_var==1?true:false;
154 talk_id(val? setting->bool_setting->lang_yes : 157 talk_id(val? setting->bool_setting->lang_yes :
155 setting->bool_setting->lang_no, enqueue); 158 setting->bool_setting->lang_no, false);
156 } 159 }
157#if 0 /* probably dont need this one */ 160#if 0 /* probably dont need this one */
158 else if ((setting->flags & F_FILENAME) == F_FILENAME) 161 else if ((setting->flags & F_FILENAME) == F_FILENAME)
159 { 162 {
160} 163 }
161#endif 164#endif
162 else if (((setting->flags & F_INT_SETTING) == F_INT_SETTING) || 165 else if (((setting->flags & F_INT_SETTING) == F_INT_SETTING) ||
163 ((setting->flags & F_TABLE_SETTING) == F_TABLE_SETTING)) 166 ((setting->flags & F_TABLE_SETTING) == F_TABLE_SETTING))
164 { 167 {
165 const struct int_setting *int_info = setting->int_setting; 168 const struct int_setting *int_info = setting->int_setting;
166 const struct table_setting *tbl_info = setting->table_setting; 169 const struct table_setting *tbl_info = setting->table_setting;
@@ -177,9 +180,9 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
177 get_talk_id = tbl_info->get_talk_id; 180 get_talk_id = tbl_info->get_talk_id;
178 } 181 }
179 if (get_talk_id) 182 if (get_talk_id)
180 talk_id(get_talk_id((int)value, unit), enqueue); 183 talk_id(get_talk_id((int)temp_var, unit), false);
181 else 184 else
182 talk_value((int)value, unit, enqueue); 185 talk_value((int)temp_var, unit, false);
183 } 186 }
184 else if ((setting->flags & F_T_SOUND) == F_T_SOUND) 187 else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
185 { 188 {
@@ -191,27 +194,20 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
191 talkunit = UNIT_PERCENT; 194 talkunit = UNIT_PERCENT;
192 else if (!strcmp(unit, "Hz")) 195 else if (!strcmp(unit, "Hz"))
193 talkunit = UNIT_HERTZ; 196 talkunit = UNIT_HERTZ;
194 talk_value((int)value, talkunit, false); 197 talk_value((int)temp_var, talkunit, false);
195 } 198 }
196 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) 199 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
197 { 200 {
198 int value = (int)value; 201 int value = (int)temp_var;
199 if (setting->flags & F_CHOICETALKS) 202 if (setting->flags & F_CHOICETALKS)
200 { 203 {
201 talk_id(setting->choice_setting->talks[value], enqueue); 204 talk_id(setting->choice_setting->talks[value], false);
202 } 205 }
203 else 206 else
204 { 207 {
205 talk_id(P2ID(setting->choice_setting->desc[value]), enqueue); 208 talk_id(P2ID(setting->choice_setting->desc[value]), false);
206 } 209 }
207 } 210 }
208}
209
210static int option_talk(int selected_item, void * data)
211{
212 struct settings_list *setting = (struct settings_list *)data;
213 int temp_var = selection_to_val(setting, selected_item);
214 option_talk_value(setting, temp_var, false);
215 return 0; 211 return 0;
216} 212}
217 213
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index 866b8cf0cd..7c9af4409b 100644
--- a/apps/gui/option_select.h
+++ b/apps/gui/option_select.h
@@ -33,5 +33,4 @@ void option_select_next_val(struct settings_list *setting,
33char *option_get_valuestring(struct settings_list *setting, 33char *option_get_valuestring(struct settings_list *setting,
34 char *buffer, int buf_len, 34 char *buffer, int buf_len,
35 intptr_t temp_var); 35 intptr_t temp_var);
36void option_talk_value(const struct settings_list *setting, int value, bool enqueue);
37#endif /* _GUI_OPTION_SELECT_H_ */ 36#endif /* _GUI_OPTION_SELECT_H_ */
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 36f3d82217..c62ad24717 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -35,7 +35,6 @@
35#include "viewport.h" 35#include "viewport.h"
36#include "audio.h" 36#include "audio.h"
37#include "quickscreen.h" 37#include "quickscreen.h"
38#include "talk.h"
39 38
40static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; 39static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT];
41static struct viewport vp_icons[NB_SCREENS]; 40static struct viewport vp_icons[NB_SCREENS];
@@ -221,15 +220,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs,
221 display->set_viewport(NULL); 220 display->set_viewport(NULL);
222} 221}
223 222
224static int option_value(const struct settings_list *setting) 223
225{
226 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
227 {
228 return *(bool*)setting->setting==true?1:0;
229 }
230 else
231 return *(int*)setting->setting;
232}
233/* 224/*
234 * Does the actions associated to the given button if any 225 * Does the actions associated to the given button if any
235 * - qs : the quickscreen 226 * - qs : the quickscreen
@@ -258,8 +249,6 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
258 return false; 249 return false;
259 } 250 }
260 option_select_next_val((struct settings_list *)qs->items[item], false, true); 251 option_select_next_val((struct settings_list *)qs->items[item], false, true);
261 option_talk_value((struct settings_list *)qs->items[item],
262 option_value((struct settings_list *)qs->items[item]), false);
263 return true; 252 return true;
264} 253}
265 254
@@ -282,17 +271,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
282 quickscreen_fix_viewports(qs, &screens[i], &vp[i]); 271 quickscreen_fix_viewports(qs, &screens[i], &vp[i]);
283 gui_quickscreen_draw(qs, &screens[i], &vp[i]); 272 gui_quickscreen_draw(qs, &screens[i], &vp[i]);
284 } 273 }
285 talk_id(qs->items[QUICKSCREEN_LEFT]->lang_id, false);
286 option_talk_value(qs->items[QUICKSCREEN_LEFT],
287 option_value(qs->items[QUICKSCREEN_LEFT]), true);
288
289 talk_id(qs->items[QUICKSCREEN_RIGHT]->lang_id, true);
290 option_talk_value(qs->items[QUICKSCREEN_RIGHT],
291 option_value(qs->items[QUICKSCREEN_RIGHT]), true);
292
293 talk_id(qs->items[QUICKSCREEN_BOTTOM]->lang_id, true);
294 option_talk_value(qs->items[QUICKSCREEN_BOTTOM],
295 option_value(qs->items[QUICKSCREEN_BOTTOM]), true);
296 while (true) { 274 while (true) {
297 button = get_action(CONTEXT_QUICKSCREEN,HZ/5); 275 button = get_action(CONTEXT_QUICKSCREEN,HZ/5);
298 if(default_event_handler(button) == SYS_USB_CONNECTED) 276 if(default_event_handler(button) == SYS_USB_CONNECTED)