summaryrefslogtreecommitdiff
path: root/editor/plugins/script_text_editor.cpp
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2019-02-01 17:20:59 +0100
committerGilles Roudière <gilles.roudiere@gmail.com>2019-02-01 17:20:59 +0100
commit5f981d7fefe8fd720796c67547afb34421e742b2 (patch)
treee77766fbf907bf83f92db537d53f182dc2b8dde6 /editor/plugins/script_text_editor.cpp
parent463123a661151f119132f2ee9af78925a58a068a (diff)
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.cpp23
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();