diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-02-08 17:03:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 17:03:55 +0100 |
commit | 5e837b3f13ab1e3b31bb8d705e87820fa4eff21e (patch) | |
tree | 3091378b703ac76d45905cea9477dc23305f8ec1 /editor/plugins/script_text_editor.cpp | |
parent | b867ef0eec2975c7a87762498fb2926c575d6676 (diff) | |
parent | 5f981d7fefe8fd720796c67547afb34421e742b2 (diff) | |
download | redot-engine-5e837b3f13ab1e3b31bb8d705e87820fa4eff21e.tar.gz |
Merge pull request #25552 from groud/better_error_message
Displays errors and warnings in a better way in the script editor
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 60dc156782..c747e8fe5c 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -273,18 +273,12 @@ void ScriptTextEditor::_set_theme_for_script() { } } -void ScriptTextEditor::_toggle_warning_pannel(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - warnings_panel->set_visible(!warnings_panel->is_visible()); - } +void ScriptTextEditor::_toggle_warning_pannel() { + warnings_panel->set_visible(!warnings_panel->is_visible()); } -void ScriptTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - code_editor->goto_error(); - } +void ScriptTextEditor::_error_pressed() { + code_editor->goto_error(); } void ScriptTextEditor::_warning_clicked(Variant p_line) { @@ -468,7 +462,7 @@ void ScriptTextEditor::_validate_script() { } } - code_editor->get_warning_count_label()->set_text(itos(warnings.size())); + code_editor->set_warning_nb(warnings.size()); warnings_panel->clear(); warnings_panel->push_table(3); for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) { @@ -1427,7 +1421,7 @@ ScriptTextEditor::ScriptTextEditor() { code_editor = memnew(CodeTextEditor); editor_box->add_child(code_editor); - code_editor->add_constant_override("separation", 0); + code_editor->add_constant_override("separation", 2); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->connect("validate_script", this, "_validate_script"); code_editor->connect("load_theme_settings", this, "_load_theme_settings"); @@ -1445,9 +1439,8 @@ ScriptTextEditor::ScriptTextEditor() { warnings_panel->set_focus_mode(FOCUS_CLICK); warnings_panel->hide(); - code_editor->get_error_label()->connect("gui_input", this, "_error_pressed"); - code_editor->get_warning_label()->connect("gui_input", this, "_toggle_warning_pannel"); - code_editor->get_warning_count_label()->connect("gui_input", this, "_toggle_warning_pannel"); + code_editor->connect("error_pressed", this, "_error_pressed"); + code_editor->connect("warning_pressed", this, "_toggle_warning_pannel"); warnings_panel->connect("meta_clicked", this, "_warning_clicked"); update_settings(); |