diff options
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 118 |
1 files changed, 4 insertions, 114 deletions
diff --git a/apps/menu.c b/apps/menu.c index 37d28eb12c..17fff25afb 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "panic.h" | 36 | #include "panic.h" |
37 | #include "settings.h" | 37 | #include "settings.h" |
38 | #include "settings_list.h" | 38 | #include "settings_list.h" |
39 | #include "option_select.h" | ||
39 | #include "status.h" | 40 | #include "status.h" |
40 | #include "screens.h" | 41 | #include "screens.h" |
41 | #include "talk.h" | 42 | #include "talk.h" |
@@ -259,120 +260,9 @@ bool do_setting_from_menu(const struct menu_item_ex *temp) | |||
259 | const struct settings_list *setting = find_setting( | 260 | const struct settings_list *setting = find_setting( |
260 | temp->variable, | 261 | temp->variable, |
261 | &setting_id); | 262 | &setting_id); |
262 | bool ret_val = false; | 263 | option_screen((struct settings_list *)setting, |
263 | unsigned char *title; | 264 | setting->flags&F_TEMPVAR); |
264 | if (setting) | 265 | return false; |
265 | { | ||
266 | if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) | ||
267 | title = temp->callback_and_desc->desc; | ||
268 | else | ||
269 | title = ID2P(setting->lang_id); | ||
270 | |||
271 | if ((setting->flags&F_BOOL_SETTING) == F_BOOL_SETTING) | ||
272 | { | ||
273 | bool temp_var, *var; | ||
274 | bool show_icons = global_settings.show_icons; | ||
275 | if (setting->flags&F_TEMPVAR) | ||
276 | { | ||
277 | temp_var = *(bool*)setting->setting; | ||
278 | var = &temp_var; | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | var = (bool*)setting->setting; | ||
283 | } | ||
284 | set_bool_options(P2STR(title), var, | ||
285 | STR(setting->bool_setting->lang_yes), | ||
286 | STR(setting->bool_setting->lang_no), | ||
287 | setting->bool_setting->option_callback); | ||
288 | if (setting->flags&F_TEMPVAR) | ||
289 | *(bool*)setting->setting = temp_var; | ||
290 | if (show_icons != global_settings.show_icons) | ||
291 | ret_val = true; | ||
292 | } | ||
293 | else if (setting->flags&F_T_SOUND) | ||
294 | { | ||
295 | set_sound(P2STR(title), setting->setting, | ||
296 | setting->sound_setting->setting); | ||
297 | } | ||
298 | else /* other setting, must be an INT type */ | ||
299 | { | ||
300 | int temp_var, *var; | ||
301 | if (setting->flags&F_TEMPVAR) | ||
302 | { | ||
303 | temp_var = *(int*)setting->setting; | ||
304 | var = &temp_var; | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | var = (int*)setting->setting; | ||
309 | } | ||
310 | if (setting->flags&F_INT_SETTING) | ||
311 | { | ||
312 | int min, max, step; | ||
313 | if (setting->flags&F_FLIPLIST) | ||
314 | { | ||
315 | min = setting->int_setting->max; | ||
316 | max = setting->int_setting->min; | ||
317 | step = -setting->int_setting->step; | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | max = setting->int_setting->max; | ||
322 | min = setting->int_setting->min; | ||
323 | step = setting->int_setting->step; | ||
324 | } | ||
325 | set_int_ex(P2STR(title), NULL, | ||
326 | setting->int_setting->unit,var, | ||
327 | setting->int_setting->option_callback, | ||
328 | step, min, max, | ||
329 | setting->int_setting->formatter, | ||
330 | setting->int_setting->get_talk_id); | ||
331 | } | ||
332 | else if (setting->flags&F_CHOICE_SETTING) | ||
333 | { | ||
334 | static struct opt_items options[MAX_OPTIONS]; | ||
335 | char buffer[256]; | ||
336 | char *buf_start = buffer; | ||
337 | int buf_free = 256; | ||
338 | int i,j, count = setting->choice_setting->count; | ||
339 | for (i=0, j=0; i<count && i<MAX_OPTIONS; i++) | ||
340 | { | ||
341 | if (setting->flags&F_CHOICETALKS) | ||
342 | { | ||
343 | if (cfg_int_to_string(setting_id, i, | ||
344 | buf_start, buf_free)) | ||
345 | { | ||
346 | int len = strlen(buf_start) +1; | ||
347 | options[j].string = buf_start; | ||
348 | buf_start += len; | ||
349 | buf_free -= len; | ||
350 | options[j].voice_id = | ||
351 | setting->choice_setting->talks[i]; | ||
352 | j++; | ||
353 | } | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | options[j].string = | ||
358 | P2STR(setting-> | ||
359 | choice_setting->desc[i]); | ||
360 | options[j].voice_id = | ||
361 | P2ID(setting-> | ||
362 | choice_setting->desc[i]); | ||
363 | j++; | ||
364 | } | ||
365 | } | ||
366 | set_option(P2STR(title), var, INT, | ||
367 | options,j, | ||
368 | setting-> | ||
369 | choice_setting->option_callback); | ||
370 | } | ||
371 | if (setting->flags&F_TEMPVAR) | ||
372 | *(int*)setting->setting = temp_var; | ||
373 | } | ||
374 | } | ||
375 | return ret_val; | ||
376 | } | 266 | } |
377 | 267 | ||
378 | int do_menu(const struct menu_item_ex *start_menu, int *start_selected) | 268 | int do_menu(const struct menu_item_ex *start_menu, int *start_selected) |