diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 07c0945114..e09145c05b 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,6 +30,7 @@ #include "code_editor.h" #include "editor/editor_scale.h" +#include "editor_node.h" #include "editor_settings.h" #include "os/keyboard.h" #include "scene/gui/margin_container.h" @@ -91,6 +92,13 @@ void FindReplaceBar::_notification(int p_what) { } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process_unhandled_input(is_visible_in_tree()); + } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { + + find_prev->set_icon(get_icon("MoveUp", "EditorIcons")); + find_next->set_icon(get_icon("MoveDown", "EditorIcons")); + hide_button->set_normal_texture(get_icon("Close", "EditorIcons")); + hide_button->set_hover_texture(get_icon("CloseHover", "EditorIcons")); + hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); } } @@ -258,7 +266,6 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { int selection_from_col = text_edit->get_selection_from_column(); if (r_col >= selection_from_col && r_col <= text_edit->get_selection_to_column()) { - r_col = selection_line; r_col = selection_from_col; } } @@ -545,9 +552,7 @@ FindReplaceBar::FindReplaceBar() { error_label = memnew(Label); search_options->add_child(error_label); - error_label->add_color_override("font_color", Color(1, 1, 0, 1)); - error_label->add_color_override("font_color_shadow", Color(0, 0, 0, 1)); - error_label->add_constant_override("shadow_as_outline", 1); + error_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); search_options->add_spacer(); @@ -876,7 +881,6 @@ FindReplaceDialog::FindReplaceDialog() { search_text = memnew(LineEdit); vb->add_margin_child(TTR("Search"), search_text); search_text->connect("text_entered", this, "_search_text_entered"); - //search_text->set_self_opacity(0.7); replace_label = memnew(Label); replace_label->set_text(TTR("Replace By")); @@ -888,7 +892,7 @@ FindReplaceDialog::FindReplaceDialog() { replace_text->set_anchor(MARGIN_RIGHT, ANCHOR_END); replace_text->set_begin(Point2(15, 132)); replace_text->set_end(Point2(-15, 135)); - //replace_text->set_self_opacity(0.7); + replace_mc->add_child(replace_text); replace_text->connect("text_entered", this, "_replace_text_entered"); @@ -945,9 +949,7 @@ FindReplaceDialog::FindReplaceDialog() { error_label = memnew(Label); error_label->set_align(Label::ALIGN_CENTER); - error_label->add_color_override("font_color", Color(1, 0.4, 0.3)); - error_label->add_color_override("font_color_shadow", Color(0, 0, 0, 0.2)); - error_label->add_constant_override("shadow_as_outline", 1); + error_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); vb->add_child(error_label); @@ -1037,8 +1039,9 @@ void CodeTextEditor::_complete_request() { List<String> entries; String ctext = text_editor->get_text_for_completion(); _code_complete_script(ctext, &entries); + bool forced = false; if (code_complete_func) { - code_complete_func(code_complete_ud, ctext, &entries); + code_complete_func(code_complete_ud, ctext, &entries, forced); } // print_line("COMPLETE: "+p_request); if (entries.size() == 0) @@ -1051,7 +1054,7 @@ void CodeTextEditor::_complete_request() { strs[i++] = E->get(); } - text_editor->code_complete(strs); + text_editor->code_complete(strs, forced); } void CodeTextEditor::_font_resize_timeout() { @@ -1087,16 +1090,13 @@ void CodeTextEditor::update_editor_settings() { text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_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")); } void CodeTextEditor::set_error(const String &p_error) { - if (p_error != "") { - error->set_text(p_error); - error->show(); - } else { - error->hide(); - } + error->set_text(p_error); } void CodeTextEditor::_update_font() { @@ -1221,11 +1221,10 @@ CodeTextEditor::CodeTextEditor() { error = memnew(Label); status_bar->add_child(error); - error->hide(); + error->set_clip_text(true); //do not change, or else very long errors can push the whole container to the right error->set_valign(Label::VALIGN_CENTER); - error->add_color_override("font_color", Color(1, 0.7, 0.6, 0.9)); - - status_bar->add_spacer(); + error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch Label *line_txt = memnew(Label); status_bar->add_child(line_txt); @@ -1238,7 +1237,8 @@ CodeTextEditor::CodeTextEditor() { status_bar->add_child(line_nb); line_nb->set_valign(Label::VALIGN_CENTER); line_nb->set_v_size_flags(SIZE_FILL); - line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change + line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch + line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); Label *col_txt = memnew(Label); @@ -1252,7 +1252,8 @@ CodeTextEditor::CodeTextEditor() { status_bar->add_child(col_nb); col_nb->set_valign(Label::VALIGN_CENTER); col_nb->set_v_size_flags(SIZE_FILL); - col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change + col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch + col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE); text_editor->connect("gui_input", this, "_text_editor_gui_input"); @@ -1263,6 +1264,7 @@ CodeTextEditor::CodeTextEditor() { cs.push_back("."); cs.push_back(","); cs.push_back("("); + cs.push_back("="); cs.push_back("$"); text_editor->set_completion(true, cs); idle->connect("timeout", this, "_text_changed_idle_timeout"); |