diff options
Diffstat (limited to 'src/settings.c')
| -rw-r--r-- | src/settings.c | 138 |
1 files changed, 67 insertions, 71 deletions
diff --git a/src/settings.c b/src/settings.c index 425007f..f9249e8 100644 --- a/src/settings.c +++ b/src/settings.c @@ -46,103 +46,99 @@ void settings_page_update_render() platform_handle_events(&global_settings_page.window, &global_settings_page.mouse, &global_settings_page.keyboard); platform_set_cursor(&global_settings_page.window, CURSOR_DEFAULT); - render_clear(); - - camera_apply_transformations(&global_settings_page.window, &global_settings_page.camera); - - global_ui_context.layout.active_window = &global_settings_page.window; - global_ui_context.keyboard = &global_settings_page.keyboard; - global_ui_context.mouse = &global_settings_page.mouse; - - ui_begin(3); + if (global_settings_page.window.do_draw) { - ui_begin_menu_bar(); - { - if (ui_push_menu(localize("interface"))) - { - global_settings_page.selected_tab_index = 1; - } - } - ui_end_menu_bar(); + global_settings_page.window.do_draw = false; + + render_clear(); + + camera_apply_transformations(&global_settings_page.window, &global_settings_page.camera); - ui_push_separator(); - if (global_settings_page.selected_tab_index == 1) + global_ui_context.layout.active_window = &global_settings_page.window; + global_ui_context.keyboard = &global_settings_page.keyboard; + global_ui_context.mouse = &global_settings_page.mouse; + + ui_begin(3); { - ui_block_begin(LAYOUT_HORIZONTAL); + ui_begin_menu_bar(); { - ui_push_text(localize("language")); + if (ui_push_menu(localize("interface"))) + { + global_settings_page.selected_tab_index = 1; + } } - ui_block_end(); + ui_end_menu_bar(); - ui_block_begin(LAYOUT_HORIZONTAL); + ui_push_separator(); + if (global_settings_page.selected_tab_index == 1) { - if (ui_push_dropdown(&global_settings_page.dropdown_language, locale_get_name())) + ui_block_begin(LAYOUT_HORIZONTAL); + { + ui_push_text(localize("language")); + } + ui_block_end(); + + ui_block_begin(LAYOUT_HORIZONTAL); { - for (s32 i = 0; i < global_localization.mo_files.length; i++) + if (ui_push_dropdown(&global_settings_page.dropdown_language, locale_get_name())) { - mo_file *file = array_at(&global_localization.mo_files, i); - - if (ui_push_dropdown_item(file->icon, file->locale_full, i)) + for (s32 i = 0; i < global_localization.mo_files.length; i++) { - set_locale(file->locale_id); - //platform_window_set_title(&global_settings_page.window, - //localize("text_search_settings")); + mo_file *file = array_at(&global_localization.mo_files, i); + + if (ui_push_dropdown_item(file->icon, file->locale_full, i)) + { + set_locale(file->locale_id); + platform_window_set_title(&global_settings_page.window, + localize("mo_edit_settings")); + } } } } - } - ui_block_end(); - - ui_block_begin(LAYOUT_HORIZONTAL); - { - if (ui_push_hypertext_link(localize("copy_config_path"))) + ui_block_end(); + + ui_block_begin(LAYOUT_HORIZONTAL); { - char buffer[PATH_MAX]; - platform_set_clipboard(main_window, get_config_save_location(buffer)); + if (ui_push_hypertext_link(localize("copy_config_path"))) + { + char buffer[PATH_MAX]; + platform_set_clipboard(main_window, get_config_save_location(buffer)); + push_notification(localize("copied_to_clipboard")); + } } + ui_block_end(); } - ui_block_end(); -#if 0 + global_ui_context.layout.offset_y = global_settings_page.window.height - 33; + ui_block_begin(LAYOUT_HORIZONTAL); { - char license_text[30]; - sprintf(license_text, "%s: %s", localize("license"), license_key); - ui_push_text(license_text); + if (ui_push_button(&global_settings_page.btn_close, localize("close"))) + { + global_settings_page.active = false; + set_locale(global_settings_page.current_locale_id); + settings_page_hide_without_save(); + } + if (ui_push_button(&global_settings_page.btn_close, localize("save"))) + { + global_settings_page.active = false; + settings_page_hide(); + return; + } } ui_block_end(); -#endif } + ui_end(); - global_ui_context.layout.offset_y = global_settings_page.window.height - 33; - - ui_block_begin(LAYOUT_HORIZONTAL); + if (!global_settings_page.window.is_open) { - if (ui_push_button(&global_settings_page.btn_close, localize("close"))) - { - global_settings_page.active = false; - set_locale(global_settings_page.current_locale_id); - settings_page_hide(); - } - if (ui_push_button(&global_settings_page.btn_close, localize("save"))) - { - global_settings_page.active = false; - settings_page_hide(); - return; - } + global_settings_page.active = false; + settings_page_hide_without_save(); + return; } - ui_block_end(); - } - ui_end(); - - if (!global_settings_page.window.is_open) - { - global_settings_page.active = false; - settings_page_hide(); - return; + + platform_window_swap_buffers(&global_settings_page.window); } - - platform_window_swap_buffers(&global_settings_page.window); } } |
