From ed00313a0b35c8d9b8e9ae2229e4de89782188e4 Mon Sep 17 00:00:00 2001 From: Cykyrios Date: Sun, 1 Sep 2019 13:28:57 +0200 Subject: [PATCH] Reorganize & rename text editor settings categories Add Navigation category for scroll and minimap settings. Rename Line Numbers category to Appearance. Rename Open Scripts category to Script List. Rename "Draw Minimap" setting to "Show Minimap" (this is more consistent with other settings). Reorder settings by category in code_editor.cpp to match settings list --- editor/code_editor.cpp | 40 ++++++++++++------------- editor/editor_settings.cpp | 38 ++++++++++++----------- editor/plugins/script_editor_plugin.cpp | 36 +++++++++++----------- editor/plugins/shader_editor_plugin.cpp | 6 ++-- 4 files changed, 61 insertions(+), 59 deletions(-) diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 61adff7c9c6..606b619cac4 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -887,33 +887,33 @@ bool CodeTextEditor::_add_font_size(int p_delta) { void CodeTextEditor::update_editor_settings() { - text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); - text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); + text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); + text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); + text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line")); text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type")); text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces")); - text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); - text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded")); - text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_length_guideline")); - text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_length_guideline_column")); - text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); - text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); - text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line")); + text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/smooth_scrolling")); + text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed")); + text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/navigation/show_minimap")); + text_editor->set_minimap_width(EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width")); + text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers")); + text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/line_numbers_zero_padded")); + text_editor->set_bookmark_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter")); + text_editor->set_breakpoint_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/show_breakpoint_gutter")); + text_editor->set_draw_info_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/show_info_gutter")); + text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding")); + text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding")); + text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap")); + text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guideline")); + text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_column")); + text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); + text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); - text_editor->set_bookmark_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_bookmark_gutter")); - text_editor->set_breakpoint_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter")); - text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding")); - text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding")); - text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/word_wrap")); - text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/line_numbers/draw_minimap")); - text_editor->set_minimap_width(EditorSettings::get_singleton()->get("text_editor/line_numbers/minimap_width")); - text_editor->set_draw_info_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_info_gutter")); - text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); - text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling")); - text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed")); + text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); } void CodeTextEditor::trim_trailing_whitespace() { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ea6361665ca..479fe5f0cb0 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -440,25 +440,27 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("text_editor/indent/draw_tabs", true); _initial_set("text_editor/indent/draw_spaces", false); - // Line numbers - _initial_set("text_editor/line_numbers/show_line_numbers", true); - _initial_set("text_editor/line_numbers/line_numbers_zero_padded", false); - _initial_set("text_editor/line_numbers/show_bookmark_gutter", true); - _initial_set("text_editor/line_numbers/show_breakpoint_gutter", true); - _initial_set("text_editor/line_numbers/show_info_gutter", true); - _initial_set("text_editor/line_numbers/code_folding", true); - _initial_set("text_editor/line_numbers/word_wrap", false); - _initial_set("text_editor/line_numbers/draw_minimap", true); - _initial_set("text_editor/line_numbers/minimap_width", 80); - hints["text_editor/line_numbers/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/minimap_width", PROPERTY_HINT_RANGE, "50,250,1"); - _initial_set("text_editor/line_numbers/show_line_length_guideline", false); - _initial_set("text_editor/line_numbers/line_length_guideline_column", 80); - hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 1"); + // Navigation + _initial_set("text_editor/navigation/smooth_scrolling", true); + _initial_set("text_editor/navigation/v_scroll_speed", 80); + _initial_set("text_editor/navigation/show_minimap", true); + _initial_set("text_editor/navigation/minimap_width", 80); + hints["text_editor/navigation/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/navigation/minimap_width", PROPERTY_HINT_RANGE, "50,250,1"); - // Open scripts - _initial_set("text_editor/open_scripts/smooth_scrolling", true); - _initial_set("text_editor/open_scripts/v_scroll_speed", 80); - _initial_set("text_editor/open_scripts/show_members_overview", true); + // Appearance + _initial_set("text_editor/appearance/show_line_numbers", true); + _initial_set("text_editor/appearance/line_numbers_zero_padded", false); + _initial_set("text_editor/appearance/show_bookmark_gutter", true); + _initial_set("text_editor/appearance/show_breakpoint_gutter", true); + _initial_set("text_editor/appearance/show_info_gutter", true); + _initial_set("text_editor/appearance/code_folding", true); + _initial_set("text_editor/appearance/word_wrap", false); + _initial_set("text_editor/appearance/show_line_length_guideline", false); + _initial_set("text_editor/appearance/line_length_guideline_column", 80); + hints["text_editor/appearance/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 1"); + + // Script list + _initial_set("text_editor/script_list/show_members_overview", true); // Files _initial_set("text_editor/files/trim_trailing_whitespace_on_save", false); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 76c7545874d..413843d536c 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1741,10 +1741,10 @@ void ScriptEditor::_update_help_overview() { void ScriptEditor::_update_script_colors() { - bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_enabled"); - bool highlight_current = EditorSettings::get_singleton()->get("text_editor/open_scripts/highlight_current_script"); + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_enabled"); + bool highlight_current = EditorSettings::get_singleton()->get("text_editor/script_list/highlight_current_script"); - int hist_size = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_history_size"); + int hist_size = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_history_size"); Color hot_color = get_color("accent_color", "Editor"); Color cold_color = get_color("font_color", "Editor"); @@ -1759,7 +1759,7 @@ void ScriptEditor::_update_script_colors() { bool current = tab_container->get_current_tab() == c; if (current && highlight_current) { - script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/open_scripts/current_script_background_color")); + script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/script_list/current_script_background_color")); } else if (script_temperature_enabled) { @@ -1792,9 +1792,9 @@ void ScriptEditor::_update_script_names() { } script_list->clear(); - bool split_script_help = EditorSettings::get_singleton()->get("text_editor/open_scripts/group_help_pages"); - ScriptSortBy sort_by = (ScriptSortBy)(int)EditorSettings::get_singleton()->get("text_editor/open_scripts/sort_scripts_by"); - ScriptListName display_as = (ScriptListName)(int)EditorSettings::get_singleton()->get("text_editor/open_scripts/list_script_names_as"); + bool split_script_help = EditorSettings::get_singleton()->get("text_editor/script_list/group_help_pages"); + ScriptSortBy sort_by = (ScriptSortBy)(int)EditorSettings::get_singleton()->get("text_editor/script_list/sort_scripts_by"); + ScriptListName display_as = (ScriptListName)(int)EditorSettings::get_singleton()->get("text_editor/script_list/list_script_names_as"); Vector<_ScriptEditorItemData> sedata; @@ -2318,7 +2318,7 @@ void ScriptEditor::_editor_settings_changed() { convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/indent/convert_indent_on_save"); use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type"); - members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview"); + members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/show_members_overview"); help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index"); _update_members_overview_visibility(); _update_help_overview_visibility(); @@ -3129,7 +3129,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { waiting_update_names = false; pending_auto_reload = false; auto_reload_running_scripts = true; - members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview"); + members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/script_list/show_members_overview"); help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index"); editor = p_editor; @@ -3554,15 +3554,15 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EDITOR_DEF("text_editor/files/open_dominant_script_on_scene_change", true); EDITOR_DEF("text_editor/external/use_external_editor", false); EDITOR_DEF("text_editor/external/exec_path", ""); - EDITOR_DEF("text_editor/open_scripts/script_temperature_enabled", true); - EDITOR_DEF("text_editor/open_scripts/highlight_current_script", true); - EDITOR_DEF("text_editor/open_scripts/script_temperature_history_size", 15); - EDITOR_DEF("text_editor/open_scripts/current_script_background_color", Color(1, 1, 1, 0.3)); - EDITOR_DEF("text_editor/open_scripts/group_help_pages", true); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/open_scripts/sort_scripts_by", PROPERTY_HINT_ENUM, "Name,Path,None")); - EDITOR_DEF("text_editor/open_scripts/sort_scripts_by", 0); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/open_scripts/list_script_names_as", PROPERTY_HINT_ENUM, "Name,Parent Directory And Name,Full Path")); - EDITOR_DEF("text_editor/open_scripts/list_script_names_as", 0); + EDITOR_DEF("text_editor/script_list/script_temperature_enabled", true); + EDITOR_DEF("text_editor/script_list/highlight_current_script", true); + EDITOR_DEF("text_editor/script_list/script_temperature_history_size", 15); + EDITOR_DEF("text_editor/script_list/current_script_background_color", Color(1, 1, 1, 0.3)); + EDITOR_DEF("text_editor/script_list/group_help_pages", true); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/script_list/sort_scripts_by", PROPERTY_HINT_ENUM, "Name,Path,None")); + EDITOR_DEF("text_editor/script_list/sort_scripts_by", 0); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/script_list/list_script_names_as", PROPERTY_HINT_ENUM, "Name,Parent Directory And Name,Full Path")); + EDITOR_DEF("text_editor/script_list/list_script_names_as", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_path", PROPERTY_HINT_GLOBAL_FILE)); EDITOR_DEF("text_editor/external/exec_flags", "{file}"); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_flags", PROPERTY_HINT_PLACEHOLDER_TEXT, "Call flags with placeholders: {project}, {file}, {col}, {line}.")); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 938dc8a1e7c..e81c97d5dd2 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -372,7 +372,7 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type")); shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); - shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); + shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers")); shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); shader_editor->get_text_edit()->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line")); @@ -380,8 +380,8 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing")); shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); - shader_editor->get_text_edit()->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling")); - shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed")); + shader_editor->get_text_edit()->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/smooth_scrolling")); + shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed")); } void ShaderEditor::_bind_methods() {