Improve the text appearance in the script editor warnings panel
- Make the Ignore button's position identical across all warnings
by moving it to the left.
- Change the Ignore button's text and color to make it more obvious
that it can be clicked.
- Use the editor font instead of the default project font to match
the rest of the editor.
(cherry picked from commit 0c0ee427d2
)
This commit is contained in:
parent
b6c536317b
commit
e226947e21
|
@ -625,6 +625,18 @@ void ScriptTextEditor::_validate_script() {
|
||||||
for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) {
|
for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) {
|
||||||
ScriptLanguage::Warning w = E->get();
|
ScriptLanguage::Warning w = E->get();
|
||||||
|
|
||||||
|
Dictionary ignore_meta;
|
||||||
|
ignore_meta["line"] = w.line;
|
||||||
|
ignore_meta["code"] = w.string_code.to_lower();
|
||||||
|
warnings_panel->push_cell();
|
||||||
|
warnings_panel->push_meta(ignore_meta);
|
||||||
|
warnings_panel->push_color(
|
||||||
|
warnings_panel->get_color("accent_color", "Editor").linear_interpolate(warnings_panel->get_color("mono_color", "Editor"), 0.5));
|
||||||
|
warnings_panel->add_text(TTR("[Ignore]"));
|
||||||
|
warnings_panel->pop(); // Color.
|
||||||
|
warnings_panel->pop(); // Meta ignore.
|
||||||
|
warnings_panel->pop(); // Cell.
|
||||||
|
|
||||||
warnings_panel->push_cell();
|
warnings_panel->push_cell();
|
||||||
warnings_panel->push_meta(w.line - 1);
|
warnings_panel->push_meta(w.line - 1);
|
||||||
warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor"));
|
warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor"));
|
||||||
|
@ -637,15 +649,6 @@ void ScriptTextEditor::_validate_script() {
|
||||||
warnings_panel->push_cell();
|
warnings_panel->push_cell();
|
||||||
warnings_panel->add_text(w.message);
|
warnings_panel->add_text(w.message);
|
||||||
warnings_panel->pop(); // Cell.
|
warnings_panel->pop(); // Cell.
|
||||||
|
|
||||||
Dictionary ignore_meta;
|
|
||||||
ignore_meta["line"] = w.line;
|
|
||||||
ignore_meta["code"] = w.string_code.to_lower();
|
|
||||||
warnings_panel->push_cell();
|
|
||||||
warnings_panel->push_meta(ignore_meta);
|
|
||||||
warnings_panel->add_text(TTR("(ignore)"));
|
|
||||||
warnings_panel->pop(); // Meta ignore.
|
|
||||||
warnings_panel->pop(); // Cell.
|
|
||||||
}
|
}
|
||||||
warnings_panel->pop(); // Table.
|
warnings_panel->pop(); // Table.
|
||||||
|
|
||||||
|
@ -1805,6 +1808,8 @@ ScriptTextEditor::ScriptTextEditor() {
|
||||||
|
|
||||||
warnings_panel = memnew(RichTextLabel);
|
warnings_panel = memnew(RichTextLabel);
|
||||||
editor_box->add_child(warnings_panel);
|
editor_box->add_child(warnings_panel);
|
||||||
|
warnings_panel->add_font_override(
|
||||||
|
"normal_font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts"));
|
||||||
warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE));
|
warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE));
|
||||||
warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL);
|
warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
warnings_panel->set_meta_underline(true);
|
warnings_panel->set_meta_underline(true);
|
||||||
|
|
Loading…
Reference in New Issue