void settings_reset(void) { int i; for(i=0; i<nb_settings; i++) reset_setting(&settings[i], settings[i].setting); #if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC enc_global_settings_reset(); #endif }
void settings_reset(void) { for(int i=0; i<nb_settings; i++) reset_setting(&settings[i], settings[i].setting); #if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC enc_global_settings_reset(); #endif #ifdef HAVE_LCD_BITMAP FOR_NB_SCREENS(i) { if (screens[i].getuifont() > FONT_SYSFIXED) { font_unload(screens[i].getuifont()); screens[i].setuifont(FONT_SYSFIXED); screens[i].setfont(FONT_SYSFIXED); } } #endif }
bool option_screen(const struct settings_list *setting, struct viewport parent[NB_SCREENS], bool use_temp_var, unsigned char* option_title) { int action; bool done = false; struct gui_synclist lists; int oldvalue, nb_items = 0, selected = 0, temp_var; int *variable; bool allow_wrap = setting->flags & F_NO_WRAP ? false : true; int var_type = setting->flags&F_T_MASK; void (*function)(int) = NULL; char *title; if (var_type == F_T_INT || var_type == F_T_UINT) { variable = use_temp_var ? &temp_var: (int*)setting->setting; temp_var = oldvalue = *(int*)setting->setting; } else if (var_type == F_T_BOOL) { /* bools always use the temp variable... if use_temp_var is false it will be copied to setting->setting every change */ variable = &temp_var; temp_var = oldvalue = *(bool*)setting->setting?1:0; } else return false; /* only int/bools can go here */ gui_synclist_init(&lists, value_setting_get_name_cb, (void*)setting, false, 1, parent); if (setting->lang_id == -1) title = (char*)setting->cfg_vals; else title = P2STR(option_title); gui_synclist_set_title(&lists, title, Icon_Questionmark); gui_synclist_set_icon_callback(&lists, NULL); if(global_settings.talk_menu) gui_synclist_set_voice_callback(&lists, option_talk); val_to_selection(setting, oldvalue, &nb_items, &selected, &function); gui_synclist_set_nb_items(&lists, nb_items); gui_synclist_select_item(&lists, selected); gui_synclist_limit_scroll(&lists, true); gui_synclist_draw(&lists); /* talk the item */ gui_synclist_speak_item(&lists); while (!done) { if (list_do_action(CONTEXT_LIST, HZ, /* HZ so the status bar redraws */ &lists, &action, allow_wrap? LIST_WRAP_UNLESS_HELD: LIST_WRAP_OFF)) { /* setting changed */ selected = gui_synclist_get_sel_pos(&lists); *variable = selection_to_val(setting, selected); if (var_type == F_T_BOOL && !use_temp_var) *(bool*)setting->setting = (*variable==1); } else if (action == ACTION_NONE) continue; else if (action == ACTION_STD_CANCEL) { /* setting canceled, restore old value if changed */ if (*variable != oldvalue) { *variable = oldvalue; if (var_type == F_T_BOOL && !use_temp_var) *(bool*)setting->setting = (oldvalue==1); splash(HZ/2, ID2P(LANG_CANCEL)); } done = true; } else if (action == ACTION_STD_CONTEXT) { /* reset setting to default */ reset_setting(setting, variable); if (var_type == F_T_BOOL && !use_temp_var) *(bool*)setting->setting = (*variable==1); val_to_selection(setting, *variable, &nb_items, &selected, &function); gui_synclist_select_item(&lists, selected); gui_synclist_draw(&lists); gui_synclist_speak_item(&lists); } else if (action == ACTION_STD_OK) { /* setting accepted, store now if it used a temp var */ if (use_temp_var) { if (var_type == F_T_INT || var_type == F_T_UINT) *(int*)setting->setting = *variable; else *(bool*)setting->setting = (*variable==1); } settings_save(); done = true; } else if(default_event_handler(action) == SYS_USB_CONNECTED) return true; /* callback */ if ( function ) function(*variable); /* if the volume is changing we need to let the skins know */ if (function == sound_get_fn(SOUND_VOLUME)) global_status.last_volume_change = current_tick; } return false; }