Skip to content

Commit e2cbfb5

Browse files
committed
Deprecate TextEdit background_color
1 parent 0b5ad6c commit e2cbfb5

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

doc/classes/TextEdit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@
16271627
</constant>
16281628
</constants>
16291629
<theme_items>
1630-
<theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
1630+
<theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)" deprecated="Assign a [StyleBoxFlat] to [theme_item normal] instead, and set [member StyleBoxFlat.bg_color] to the desired background color.">
16311631
Sets the background [Color] of this [TextEdit].
16321632
</theme_item>
16331633
<theme_item name="caret_background_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">

editor/shader/visual_shader_editor_plugin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,6 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
13881388
node->add_child(expression_box);
13891389
register_expression_edit(p_id, expression_box);
13901390

1391-
Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color");
13921391
Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color");
13931392
Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
13941393
Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color");
@@ -1399,7 +1398,6 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
13991398
Color members_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
14001399

14011400
expression_box->set_syntax_highlighter(expression_syntax_highlighter);
1402-
expression_box->add_theme_color_override("background_color", background_color);
14031401

14041402
for (const String &E : editor->keyword_list) {
14051403
if (ShaderLanguage::is_control_flow_keyword(E)) {
@@ -5294,7 +5292,6 @@ void VisualShaderEditor::_notification(int p_what) {
52945292
shader_preview_button->set_button_icon(Control::get_editor_theme_icon(SNAME("SubViewport")));
52955293

52965294
{
5297-
Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color");
52985295
Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color");
52995296
Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
53005297
Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color");
@@ -5305,7 +5302,6 @@ void VisualShaderEditor::_notification(int p_what) {
53055302
Color members_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
53065303
Color error_color = get_theme_color(SNAME("error_color"), EditorStringName(Editor));
53075304

5308-
preview_text->add_theme_color_override("background_color", background_color);
53095305
varying_error_label->add_theme_color_override(SceneStringName(font_color), error_color);
53105306

53115307
for (const String &E : keyword_list) {

editor/themes/editor_theme_manager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,6 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref<EditorTheme> &p_
600600
p_theme->set_stylebox("read_only", "CodeEdit", code_edit_stylebox);
601601
p_theme->set_stylebox("focus", "CodeEdit", memnew(StyleBoxEmpty));
602602

603-
p_theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0)); // Unset any color, we use a stylebox.
604-
605603
/* clang-format off */
606604
p_theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_background_color"));
607605
p_theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_selected_color"));

editor/themes/theme_classic.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,6 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
909909
p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color);
910910
p_theme->set_color("caret_color", "TextEdit", p_config.font_color);
911911
p_theme->set_color("selection_color", "TextEdit", p_config.selection_color);
912-
p_theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
913912

914913
p_theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE);
915914
p_theme->set_constant("outline_size", "TextEdit", 0);

editor/themes/theme_modern.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,6 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
856856
p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color);
857857
p_theme->set_color("caret_color", "TextEdit", p_config.font_color);
858858
p_theme->set_color("selection_color", "TextEdit", p_config.selection_color);
859-
p_theme->set_color("background_color", "TextEdit", Color(1, 1, 1, 0));
860859

861860
p_theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE);
862861
p_theme->set_constant("outline_size", "TextEdit", 0);

scene/gui/text_edit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,11 @@ void TextEdit::_notification(int p_what) {
957957

958958
int visible_rows = get_visible_line_count() + 1;
959959

960+
#ifndef DISABLE_DEPRECATED
960961
if (theme_cache.background_color.a > 0.01) {
961962
RS::get_singleton()->canvas_item_add_rect(text_ci, Rect2(Point2i(), get_size()), theme_cache.background_color);
962963
}
964+
#endif // DISABLE_DEPRECATED
963965

964966
Vector<BraceMatchingData> brace_matching;
965967
if (highlight_matching_braces_enabled) {
@@ -7651,7 +7653,10 @@ void TextEdit::_bind_methods() {
76517653
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TextEdit, line_spacing);
76527654
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TextEdit, wrap_offset);
76537655

7656+
#ifndef DISABLE_DEPRECATED
76547657
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, background_color);
7658+
#endif // DISABLE_DEPRECATED
7659+
76557660
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, current_line_color);
76567661
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, word_highlighted_color);
76577662

scene/gui/text_edit.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,12 @@ class TextEdit : public Control {
642642
int line_spacing = 1;
643643
int wrap_offset = 10;
644644

645-
Color background_color = Color(1, 1, 1);
646645
Color current_line_color = Color(1, 1, 1);
647646
Color word_highlighted_color = Color(1, 1, 1);
647+
648+
#ifndef DISABLE_DEPRECATED
649+
Color background_color = Color(1, 1, 1);
650+
#endif // DISABLE_DEPRECATED
648651
} theme_cache;
649652

650653
bool window_has_focus = true;

scene/theme/default_theme.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
460460
theme->set_font(SceneStringName(font), "TextEdit", Ref<Font>());
461461
theme->set_font_size(SceneStringName(font_size), "TextEdit", -1);
462462

463+
#ifndef DISABLE_DEPRECATED
463464
theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
465+
#endif // DISABLE_DEPRECATED
464466
theme->set_color(SceneStringName(font_color), "TextEdit", control_font_color);
465467
theme->set_color("font_selected_color", "TextEdit", Color(0, 0, 0, 0));
466468
theme->set_color("font_readonly_color", "TextEdit", control_font_disabled_color);
@@ -501,7 +503,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
501503
theme->set_font(SceneStringName(font), "CodeEdit", Ref<Font>());
502504
theme->set_font_size(SceneStringName(font_size), "CodeEdit", -1);
503505

506+
#ifndef DISABLE_DEPRECATED
504507
theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0));
508+
#endif // DISABLE_DEPRECATED
505509
theme->set_color("completion_background_color", "CodeEdit", Color(0.17, 0.16, 0.2));
506510
theme->set_color("completion_selected_color", "CodeEdit", Color(0.26, 0.26, 0.27));
507511
theme->set_color("completion_existing_color", "CodeEdit", Color(0.87, 0.87, 0.87, 0.13));

0 commit comments

Comments
 (0)