diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index a5943c952b5..48f2be450b6 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -926,38 +926,55 @@ bool CodeTextEditor::_add_font_size(int p_delta) { } void CodeTextEditor::update_editor_settings() { - completion_font_color = EDITOR_GET("text_editor/highlighting/completion_font_color"); - completion_string_color = EDITOR_GET("text_editor/highlighting/string_color"); - completion_comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); + // Theme: Highlighting + completion_font_color = EDITOR_GET("text_editor/theme/highlighting/completion_font_color"); + completion_string_color = EDITOR_GET("text_editor/theme/highlighting/string_color"); + completion_comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); - 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_enabled(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_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((int)EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width") * EDSCALE); - text_editor->set_draw_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_draw_bookmarks_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter")); - text_editor->set_line_folding_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_line_wrapping_mode((TextEdit::LineWrappingMode)EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap").operator int()); - text_editor->set_scroll_past_end_of_file_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); - text_editor->set_caret_type((TextEdit::CaretType)EditorSettings::get_singleton()->get("text_editor/cursor/type").operator int()); - text_editor->set_caret_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); - text_editor->set_caret_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); + // Appearance: Caret + text_editor->set_caret_type((TextEdit::CaretType)EditorSettings::get_singleton()->get("text_editor/appearance/caret/type").operator int()); + text_editor->set_caret_blink_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/caret/caret_blink")); + text_editor->set_caret_blink_speed(EditorSettings::get_singleton()->get("text_editor/appearance/caret/caret_blink_speed")); + text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/appearance/caret/highlight_current_line")); + text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/appearance/caret/highlight_all_occurrences")); + + // Appearance: Gutters + text_editor->set_draw_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/show_line_numbers")); + text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/line_numbers_zero_padded")); + text_editor->set_draw_bookmarks_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/gutters/show_bookmark_gutter")); + + // Appearance: Minimap + text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/appearance/minimap/show_minimap")); + text_editor->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/appearance/minimap/minimap_width") * EDSCALE); + + // Appearance: Lines + text_editor->set_line_folding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/lines/code_folding")); + text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/lines/code_folding")); + text_editor->set_line_wrapping_mode((TextEdit::LineWrappingMode)EditorSettings::get_singleton()->get("text_editor/appearance/lines/word_wrap").operator int()); + + // Appearance: Whitespace + text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/appearance/whitespace/draw_tabs")); + text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/appearance/whitespace/draw_spaces")); + + // Behavior: Navigation + text_editor->set_scroll_past_end_of_file_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/scroll_past_end_of_file")); + text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/smooth_scrolling")); + text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/behavior/navigation/v_scroll_speed")); + + // Behavior: indent + text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/behavior/indent/type")); + text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/behavior/indent/size")); + text_editor->set_auto_indent_enabled(EditorSettings::get_singleton()->get("text_editor/behavior/indent/auto_indent")); + + // Completion text_editor->set_auto_brace_completion_enabled(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); - if (EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guidelines")) { + // Appearance: Guidelines + if (EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/show_line_length_guidelines")) { TypedArray guideline_cols; - guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_hard_column")); - if (EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_soft_column") != guideline_cols[0]) { - guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_soft_column")); + guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_hard_column")); + if (EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_soft_column") != guideline_cols[0]) { + guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/guidelines/line_length_guideline_soft_column")); } text_editor->set_line_length_guidelines(guideline_cols); } @@ -1028,7 +1045,7 @@ void CodeTextEditor::insert_final_newline() { } void CodeTextEditor::convert_indent_to_spaces() { - int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); + int indent_size = EditorSettings::get_singleton()->get("text_editor/behavior/indent/size"); String indent = ""; for (int i = 0; i < indent_size; i++) { @@ -1072,7 +1089,7 @@ void CodeTextEditor::convert_indent_to_spaces() { } void CodeTextEditor::convert_indent_to_tabs() { - int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); + int indent_size = EditorSettings::get_singleton()->get("text_editor/behavior/indent/size"); indent_size -= 1; int cursor_line = text_editor->get_caret_line(); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 009a83994c3..3fc010c7019 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -492,68 +492,73 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { // Theme _initial_set("text_editor/theme/color_theme", "Default"); hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Default,Godot 2,Custom"); - _initial_set("text_editor/theme/line_spacing", 6); - hints["text_editor/theme/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/theme/line_spacing", PROPERTY_HINT_RANGE, "0,50,1"); + // Theme: Highlighting _load_godot2_text_editor_theme(); - // Highlighting - _initial_set("text_editor/highlighting/highlight_all_occurrences", true); - _initial_set("text_editor/highlighting/highlight_current_line", true); - _initial_set("text_editor/highlighting/highlight_type_safe_lines", true); - - // Indent - _initial_set("text_editor/indent/type", 0); - hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces"); - _initial_set("text_editor/indent/size", 4); - hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes. - _initial_set("text_editor/indent/auto_indent", true); - _initial_set("text_editor/indent/convert_indent_on_save", true); - _initial_set("text_editor/indent/draw_tabs", true); - _initial_set("text_editor/indent/draw_spaces", false); - - // 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"); - // 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_info_gutter", true); - _initial_set("text_editor/appearance/code_folding", true); - _initial_set("text_editor/appearance/word_wrap", 0); - hints["text_editor/appearance/word_wrap"] = PropertyInfo(Variant::INT, "text_editor/appearance/word_wrap", PROPERTY_HINT_ENUM, "None,Boundary"); + // Appearance: Caret + _initial_set("text_editor/appearance/caret/type", 0); + hints["text_editor/appearance/caret/type"] = PropertyInfo(Variant::INT, "text_editor/appearance/caret/type", PROPERTY_HINT_ENUM, "Line,Block"); + _initial_set("text_editor/appearance/caret/caret_blink", true); + _initial_set("text_editor/appearance/caret/caret_blink_speed", 0.5); + hints["text_editor/appearance/caret/caret_blink_speed"] = PropertyInfo(Variant::FLOAT, "text_editor/appearance/caret/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01"); + _initial_set("text_editor/appearance/caret/highlight_current_line", true); + _initial_set("text_editor/appearance/caret/highlight_all_occurrences", true); - _initial_set("text_editor/appearance/show_line_length_guidelines", true); - _initial_set("text_editor/appearance/line_length_guideline_soft_column", 80); - hints["text_editor/appearance/line_length_guideline_soft_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_soft_column", PROPERTY_HINT_RANGE, "20, 160, 1"); - _initial_set("text_editor/appearance/line_length_guideline_hard_column", 100); - hints["text_editor/appearance/line_length_guideline_hard_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_hard_column", PROPERTY_HINT_RANGE, "20, 160, 1"); + // Appearance: Guidelines + _initial_set("text_editor/appearance/guidelines/show_line_length_guidelines", true); + _initial_set("text_editor/appearance/guidelines/line_length_guideline_soft_column", 80); + hints["text_editor/appearance/guidelines/line_length_guideline_soft_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/guidelines/line_length_guideline_soft_column", PROPERTY_HINT_RANGE, "20, 160, 1"); + _initial_set("text_editor/appearance/guidelines/line_length_guideline_hard_column", 100); + hints["text_editor/appearance/guidelines/line_length_guideline_hard_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/guidelines/line_length_guideline_hard_column", PROPERTY_HINT_RANGE, "20, 160, 1"); + + // Appearance: Gutters + _initial_set("text_editor/appearance/gutters/show_line_numbers", true); + _initial_set("text_editor/appearance/gutters/line_numbers_zero_padded", false); + _initial_set("text_editor/appearance/gutters/highlight_type_safe_lines", true); + _initial_set("text_editor/appearance/gutters/show_bookmark_gutter", true); + _initial_set("text_editor/appearance/gutters/show_info_gutter", true); + + // Appearance: Minimap + _initial_set("text_editor/appearance/minimap/show_minimap", true); + _initial_set("text_editor/appearance/minimap/minimap_width", 80); + hints["text_editor/appearance/minimap/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/appearance/minimap/minimap_width", PROPERTY_HINT_RANGE, "50,250,1"); + + // Appearance: Lines + _initial_set("text_editor/appearance/lines/code_folding", true); + _initial_set("text_editor/appearance/lines/word_wrap", 0); + hints["text_editor/appearance/lines/word_wrap"] = PropertyInfo(Variant::INT, "text_editor/appearance/lines/word_wrap", PROPERTY_HINT_ENUM, "None,Boundary"); + + // Appearance: Whitespace + _initial_set("text_editor/appearance/whitespace/draw_tabs", true); + _initial_set("text_editor/appearance/whitespace/draw_spaces", false); + _initial_set("text_editor/appearance/whitespace/line_spacing", 6); + hints["text_editor/appearance/whitespace/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/appearance/whitespace/line_spacing", PROPERTY_HINT_RANGE, "0,50,1"); + + // Behavior + // Behavior: Navigation + _initial_set("text_editor/behavior/navigation/move_caret_on_right_click", true); + _initial_set("text_editor/behavior/navigation/scroll_past_end_of_file", false); + _initial_set("text_editor/behavior/navigation/smooth_scrolling", true); + _initial_set("text_editor/behavior/navigation/v_scroll_speed", 80); + + // Behavior: Indent + _initial_set("text_editor/behavior/indent/type", 0); + hints["text_editor/behavior/indent/type"] = PropertyInfo(Variant::INT, "text_editor/behavior/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces"); + _initial_set("text_editor/behavior/indent/size", 4); + hints["text_editor/behavior/indent/size"] = PropertyInfo(Variant::INT, "text_editor/behavior/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes. + _initial_set("text_editor/behavior/indent/auto_indent", true); + + // Behavior: Files + _initial_set("text_editor/behavior/files/trim_trailing_whitespace_on_save", false); + _initial_set("text_editor/behavior/files/autosave_interval_secs", 0); + _initial_set("text_editor/behavior/files/restore_scripts_on_load", true); + _initial_set("text_editor/behavior/files/convert_indent_on_save", true); // Script list _initial_set("text_editor/script_list/show_members_overview", true); - - // Files - _initial_set("text_editor/files/trim_trailing_whitespace_on_save", false); - _initial_set("text_editor/files/autosave_interval_secs", 0); - _initial_set("text_editor/files/restore_scripts_on_load", true); - - // Tools - _initial_set("text_editor/tools/create_signal_callbacks", true); - _initial_set("text_editor/tools/sort_members_outline_alphabetically", false); - - // Cursor - _initial_set("text_editor/cursor/scroll_past_end_of_file", false); - _initial_set("text_editor/cursor/type", 0); - hints["text_editor/cursor/type"] = PropertyInfo(Variant::INT, "text_editor/cursor/type", PROPERTY_HINT_ENUM, "Line,Block"); - _initial_set("text_editor/cursor/caret_blink", true); - _initial_set("text_editor/cursor/caret_blink_speed", 0.5); - hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::FLOAT, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01"); - _initial_set("text_editor/cursor/right_click_moves_caret", true); + _initial_set("text_editor/script_list/sort_members_outline_alphabetically", false); // Completion _initial_set("text_editor/completion/idle_parse_delay", 2.0); @@ -777,41 +782,41 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { void EditorSettings::_load_godot2_text_editor_theme() { // Godot 2 is only a dark theme; it doesn't have a light theme counterpart. - _initial_set("text_editor/highlighting/symbol_color", Color(0.73, 0.87, 1.0)); - _initial_set("text_editor/highlighting/keyword_color", Color(1.0, 1.0, 0.7)); - _initial_set("text_editor/highlighting/control_flow_keyword_color", Color(1.0, 0.85, 0.7)); - _initial_set("text_editor/highlighting/base_type_color", Color(0.64, 1.0, 0.83)); - _initial_set("text_editor/highlighting/engine_type_color", Color(0.51, 0.83, 1.0)); - _initial_set("text_editor/highlighting/user_type_color", Color(0.42, 0.67, 0.93)); - _initial_set("text_editor/highlighting/comment_color", Color(0.4, 0.4, 0.4)); - _initial_set("text_editor/highlighting/string_color", Color(0.94, 0.43, 0.75)); - _initial_set("text_editor/highlighting/background_color", Color(0.13, 0.12, 0.15)); - _initial_set("text_editor/highlighting/completion_background_color", Color(0.17, 0.16, 0.2)); - _initial_set("text_editor/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27)); - _initial_set("text_editor/highlighting/completion_existing_color", Color(0.13, 0.87, 0.87, 0.87)); - _initial_set("text_editor/highlighting/completion_scroll_color", Color(1, 1, 1)); - _initial_set("text_editor/highlighting/completion_font_color", Color(0.67, 0.67, 0.67)); - _initial_set("text_editor/highlighting/text_color", Color(0.67, 0.67, 0.67)); - _initial_set("text_editor/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4)); - _initial_set("text_editor/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6)); - _initial_set("text_editor/highlighting/caret_color", Color(0.67, 0.67, 0.67)); - _initial_set("text_editor/highlighting/caret_background_color", Color(0, 0, 0)); - _initial_set("text_editor/highlighting/text_selected_color", Color(0, 0, 0)); - _initial_set("text_editor/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35)); - _initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); - _initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); - _initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1)); - _initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); - _initial_set("text_editor/highlighting/number_color", Color(0.92, 0.58, 0.2)); - _initial_set("text_editor/highlighting/function_color", Color(0.4, 0.64, 0.81)); - _initial_set("text_editor/highlighting/member_variable_color", Color(0.9, 0.31, 0.35)); - _initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); - _initial_set("text_editor/highlighting/bookmark_color", Color(0.08, 0.49, 0.98)); - _initial_set("text_editor/highlighting/breakpoint_color", Color(0.9, 0.29, 0.3)); - _initial_set("text_editor/highlighting/executing_line_color", Color(0.98, 0.89, 0.27)); - _initial_set("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); - _initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); - _initial_set("text_editor/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38)); + _initial_set("text_editor/theme/highlighting/symbol_color", Color(0.73, 0.87, 1.0)); + _initial_set("text_editor/theme/highlighting/keyword_color", Color(1.0, 1.0, 0.7)); + _initial_set("text_editor/theme/highlighting/control_flow_keyword_color", Color(1.0, 0.85, 0.7)); + _initial_set("text_editor/theme/highlighting/base_type_color", Color(0.64, 1.0, 0.83)); + _initial_set("text_editor/theme/highlighting/engine_type_color", Color(0.51, 0.83, 1.0)); + _initial_set("text_editor/theme/highlighting/user_type_color", Color(0.42, 0.67, 0.93)); + _initial_set("text_editor/theme/highlighting/comment_color", Color(0.4, 0.4, 0.4)); + _initial_set("text_editor/theme/highlighting/string_color", Color(0.94, 0.43, 0.75)); + _initial_set("text_editor/theme/highlighting/background_color", Color(0.13, 0.12, 0.15)); + _initial_set("text_editor/theme/highlighting/completion_background_color", Color(0.17, 0.16, 0.2)); + _initial_set("text_editor/theme/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27)); + _initial_set("text_editor/theme/highlighting/completion_existing_color", Color(0.13, 0.87, 0.87, 0.87)); + _initial_set("text_editor/theme/highlighting/completion_scroll_color", Color(1, 1, 1)); + _initial_set("text_editor/theme/highlighting/completion_font_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/theme/highlighting/text_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/theme/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4)); + _initial_set("text_editor/theme/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6)); + _initial_set("text_editor/theme/highlighting/caret_color", Color(0.67, 0.67, 0.67)); + _initial_set("text_editor/theme/highlighting/caret_background_color", Color(0, 0, 0)); + _initial_set("text_editor/theme/highlighting/text_selected_color", Color(0, 0, 0)); + _initial_set("text_editor/theme/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35)); + _initial_set("text_editor/theme/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); + _initial_set("text_editor/theme/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); + _initial_set("text_editor/theme/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1)); + _initial_set("text_editor/theme/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); + _initial_set("text_editor/theme/highlighting/number_color", Color(0.92, 0.58, 0.2)); + _initial_set("text_editor/theme/highlighting/function_color", Color(0.4, 0.64, 0.81)); + _initial_set("text_editor/theme/highlighting/member_variable_color", Color(0.9, 0.31, 0.35)); + _initial_set("text_editor/theme/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); + _initial_set("text_editor/theme/highlighting/bookmark_color", Color(0.08, 0.49, 0.98)); + _initial_set("text_editor/theme/highlighting/breakpoint_color", Color(0.9, 0.29, 0.3)); + _initial_set("text_editor/theme/highlighting/executing_line_color", Color(0.98, 0.89, 0.27)); + _initial_set("text_editor/theme/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); + _initial_set("text_editor/theme/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); + _initial_set("text_editor/theme/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38)); } bool EditorSettings::_save_text_editor_theme(String p_file) { @@ -823,8 +828,8 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { keys.sort(); for (const String &key : keys) { - if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) { - cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html()); + if (key.begins_with("text_editor/theme/highlighting/") && key.find("color") >= 0) { + cf->set_value(theme_section, key.replace("text_editor/theme/highlighting/", ""), ((Color)props[key].variant).to_html()); } } @@ -1340,10 +1345,10 @@ void EditorSettings::load_text_editor_theme() { String val = cf->get_value("color_theme", key); // don't load if it's not already there! - if (has_setting("text_editor/highlighting/" + key)) { + if (has_setting("text_editor/theme/highlighting/" + key)) { // make sure it is actually a color if (val.is_valid_html_color() && key.find("color") >= 0) { - props["text_editor/highlighting/" + key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam + props["text_editor/theme/highlighting/" + key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam } } } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index e93c8a1a059..2c83fb2df67 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1061,7 +1061,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("folded", "CodeEdit", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); theme->set_icon("can_fold", "CodeEdit", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); theme->set_icon("executing_line", "CodeEdit", theme->get_icon("MainPlay", "EditorIcons")); - theme->set_constant("line_spacing", "CodeEdit", EDITOR_DEF("text_editor/theme/line_spacing", 6)); + theme->set_constant("line_spacing", "CodeEdit", EDITOR_DEF("text_editor/appearance/whitespace/line_spacing", 6)); // H/VSplitContainer theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1)); @@ -1433,67 +1433,67 @@ Ref create_editor_theme(const Ref p_theme) { EditorSettings *setting = EditorSettings::get_singleton(); String text_editor_color_theme = setting->get("text_editor/theme/color_theme"); if (text_editor_color_theme == "Default") { - setting->set_initial_value("text_editor/highlighting/symbol_color", symbol_color, true); - setting->set_initial_value("text_editor/highlighting/keyword_color", keyword_color, true); - setting->set_initial_value("text_editor/highlighting/control_flow_keyword_color", control_flow_keyword_color, true); - setting->set_initial_value("text_editor/highlighting/base_type_color", basetype_color, true); - setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color, true); - setting->set_initial_value("text_editor/highlighting/user_type_color", usertype_color, true); - setting->set_initial_value("text_editor/highlighting/comment_color", comment_color, true); - setting->set_initial_value("text_editor/highlighting/string_color", string_color, true); - setting->set_initial_value("text_editor/highlighting/background_color", te_background_color, true); - setting->set_initial_value("text_editor/highlighting/completion_background_color", completion_background_color, true); - setting->set_initial_value("text_editor/highlighting/completion_selected_color", completion_selected_color, true); - setting->set_initial_value("text_editor/highlighting/completion_existing_color", completion_existing_color, true); - setting->set_initial_value("text_editor/highlighting/completion_scroll_color", completion_scroll_color, true); - setting->set_initial_value("text_editor/highlighting/completion_font_color", completion_font_color, true); - setting->set_initial_value("text_editor/highlighting/text_color", text_color, true); - setting->set_initial_value("text_editor/highlighting/line_number_color", line_number_color, true); - setting->set_initial_value("text_editor/highlighting/safe_line_number_color", safe_line_number_color, true); - setting->set_initial_value("text_editor/highlighting/caret_color", caret_color, true); - setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color, true); - setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color, true); - setting->set_initial_value("text_editor/highlighting/selection_color", selection_color, true); - setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color, true); - setting->set_initial_value("text_editor/highlighting/current_line_color", current_line_color, true); - setting->set_initial_value("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color, true); - setting->set_initial_value("text_editor/highlighting/word_highlighted_color", word_highlighted_color, true); - setting->set_initial_value("text_editor/highlighting/number_color", number_color, true); - setting->set_initial_value("text_editor/highlighting/function_color", function_color, true); - setting->set_initial_value("text_editor/highlighting/member_variable_color", member_variable_color, true); - setting->set_initial_value("text_editor/highlighting/mark_color", mark_color, true); - setting->set_initial_value("text_editor/highlighting/bookmark_color", bookmark_color, true); - setting->set_initial_value("text_editor/highlighting/breakpoint_color", breakpoint_color, true); - setting->set_initial_value("text_editor/highlighting/executing_line_color", executing_line_color, true); - setting->set_initial_value("text_editor/highlighting/code_folding_color", code_folding_color, true); - setting->set_initial_value("text_editor/highlighting/search_result_color", search_result_color, true); - setting->set_initial_value("text_editor/highlighting/search_result_border_color", search_result_border_color, true); + setting->set_initial_value("text_editor/theme/highlighting/symbol_color", symbol_color, true); + setting->set_initial_value("text_editor/theme/highlighting/keyword_color", keyword_color, true); + setting->set_initial_value("text_editor/theme/highlighting/control_flow_keyword_color", control_flow_keyword_color, true); + setting->set_initial_value("text_editor/theme/highlighting/base_type_color", basetype_color, true); + setting->set_initial_value("text_editor/theme/highlighting/engine_type_color", type_color, true); + setting->set_initial_value("text_editor/theme/highlighting/user_type_color", usertype_color, true); + setting->set_initial_value("text_editor/theme/highlighting/comment_color", comment_color, true); + setting->set_initial_value("text_editor/theme/highlighting/string_color", string_color, true); + setting->set_initial_value("text_editor/theme/highlighting/background_color", te_background_color, true); + setting->set_initial_value("text_editor/theme/highlighting/completion_background_color", completion_background_color, true); + setting->set_initial_value("text_editor/theme/highlighting/completion_selected_color", completion_selected_color, true); + setting->set_initial_value("text_editor/theme/highlighting/completion_existing_color", completion_existing_color, true); + setting->set_initial_value("text_editor/theme/highlighting/completion_scroll_color", completion_scroll_color, true); + setting->set_initial_value("text_editor/theme/highlighting/completion_font_color", completion_font_color, true); + setting->set_initial_value("text_editor/theme/highlighting/text_color", text_color, true); + setting->set_initial_value("text_editor/theme/highlighting/line_number_color", line_number_color, true); + setting->set_initial_value("text_editor/theme/highlighting/safe_line_number_color", safe_line_number_color, true); + setting->set_initial_value("text_editor/theme/highlighting/caret_color", caret_color, true); + setting->set_initial_value("text_editor/theme/highlighting/caret_background_color", caret_background_color, true); + setting->set_initial_value("text_editor/theme/highlighting/text_selected_color", text_selected_color, true); + setting->set_initial_value("text_editor/theme/highlighting/selection_color", selection_color, true); + setting->set_initial_value("text_editor/theme/highlighting/brace_mismatch_color", brace_mismatch_color, true); + setting->set_initial_value("text_editor/theme/highlighting/current_line_color", current_line_color, true); + setting->set_initial_value("text_editor/theme/highlighting/line_length_guideline_color", line_length_guideline_color, true); + setting->set_initial_value("text_editor/theme/highlighting/word_highlighted_color", word_highlighted_color, true); + setting->set_initial_value("text_editor/theme/highlighting/number_color", number_color, true); + setting->set_initial_value("text_editor/theme/highlighting/function_color", function_color, true); + setting->set_initial_value("text_editor/theme/highlighting/member_variable_color", member_variable_color, true); + setting->set_initial_value("text_editor/theme/highlighting/mark_color", mark_color, true); + setting->set_initial_value("text_editor/theme/highlighting/bookmark_color", bookmark_color, true); + setting->set_initial_value("text_editor/theme/highlighting/breakpoint_color", breakpoint_color, true); + setting->set_initial_value("text_editor/theme/highlighting/executing_line_color", executing_line_color, true); + setting->set_initial_value("text_editor/theme/highlighting/code_folding_color", code_folding_color, true); + setting->set_initial_value("text_editor/theme/highlighting/search_result_color", search_result_color, true); + setting->set_initial_value("text_editor/theme/highlighting/search_result_border_color", search_result_border_color, true); } else if (text_editor_color_theme == "Godot 2") { setting->load_text_editor_theme(); } // Now theme is loaded, apply it to CodeEdit. - theme->set_color("background_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/background_color")); - theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_background_color")); - theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_selected_color")); - theme->set_color("completion_existing_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_existing_color")); - theme->set_color("completion_scroll_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_scroll_color")); - theme->set_color("completion_font_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/completion_font_color")); - theme->set_color("font_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/text_color")); - theme->set_color("line_number_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/line_number_color")); - theme->set_color("caret_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/caret_color")); - theme->set_color("font_selected_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/text_selected_color")); - theme->set_color("selection_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/selection_color")); - theme->set_color("brace_mismatch_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/brace_mismatch_color")); - theme->set_color("current_line_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/current_line_color")); - theme->set_color("line_length_guideline_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/line_length_guideline_color")); - theme->set_color("word_highlighted_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/word_highlighted_color")); - theme->set_color("bookmark_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/bookmark_color")); - theme->set_color("breakpoint_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/breakpoint_color")); - theme->set_color("executing_line_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/executing_line_color")); - theme->set_color("code_folding_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/code_folding_color")); - theme->set_color("search_result_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/search_result_color")); - theme->set_color("search_result_border_color", "CodeEdit", EDITOR_GET("text_editor/highlighting/search_result_border_color")); + theme->set_color("background_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/background_color")); + theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_background_color")); + theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_selected_color")); + theme->set_color("completion_existing_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_existing_color")); + theme->set_color("completion_scroll_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_scroll_color")); + theme->set_color("completion_font_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_font_color")); + theme->set_color("font_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_color")); + theme->set_color("line_number_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/line_number_color")); + theme->set_color("caret_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/caret_color")); + theme->set_color("font_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_selected_color")); + theme->set_color("selection_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/selection_color")); + theme->set_color("brace_mismatch_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/brace_mismatch_color")); + theme->set_color("current_line_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/current_line_color")); + theme->set_color("line_length_guideline_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/line_length_guideline_color")); + theme->set_color("word_highlighted_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/word_highlighted_color")); + theme->set_color("bookmark_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/bookmark_color")); + theme->set_color("breakpoint_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/breakpoint_color")); + theme->set_color("executing_line_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/executing_line_color")); + theme->set_color("code_folding_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/code_folding_color")); + theme->set_color("search_result_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_color")); + theme->set_color("search_result_border_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_border_color")); return theme; } diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index d47bd2d4108..95f68d5f7f1 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -505,12 +505,12 @@ Ref EditorScriptPreviewPlugin::generate(const RES &p_from, const Size int thumbnail_size = MAX(p_size.x, p_size.y); img->create(thumbnail_size, thumbnail_size, false, Image::FORMAT_RGBA8); - Color bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"); - Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"); - Color control_flow_keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/control_flow_keyword_color"); - Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); - Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"); - Color comment_color = EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"); + Color bg_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/background_color"); + Color keyword_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/keyword_color"); + Color control_flow_keyword_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/control_flow_keyword_color"); + Color text_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/text_color"); + Color symbol_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/symbol_color"); + Color comment_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/comment_color"); if (bg_color.a == 0) { bg_color = Color(0, 0, 0, 0); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index e6762826dd2..226a54b966a 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -94,13 +94,13 @@ void EditorStandardSyntaxHighlighter::_update_cache() { highlighter->clear_member_keyword_colors(); highlighter->clear_color_regions(); - highlighter->set_symbol_color(EDITOR_GET("text_editor/highlighting/symbol_color")); - highlighter->set_function_color(EDITOR_GET("text_editor/highlighting/function_color")); - highlighter->set_number_color(EDITOR_GET("text_editor/highlighting/number_color")); - highlighter->set_member_variable_color(EDITOR_GET("text_editor/highlighting/member_variable_color")); + highlighter->set_symbol_color(EDITOR_GET("text_editor/theme/highlighting/symbol_color")); + highlighter->set_function_color(EDITOR_GET("text_editor/theme/highlighting/function_color")); + highlighter->set_number_color(EDITOR_GET("text_editor/theme/highlighting/number_color")); + highlighter->set_member_variable_color(EDITOR_GET("text_editor/theme/highlighting/member_variable_color")); /* Engine types. */ - const Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color"); + const Color type_color = EDITOR_GET("text_editor/theme/highlighting/engine_type_color"); List types; ClassDB::get_class_list(&types); for (const StringName &E : types) { @@ -112,7 +112,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { } /* User types. */ - const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color"); + const Color usertype_color = EDITOR_GET("text_editor/theme/highlighting/user_type_color"); List global_classes; ScriptServer::get_global_class_list(&global_classes); for (const StringName &E : global_classes) { @@ -131,7 +131,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Ref