summaryrefslogtreecommitdiffstats
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-20 15:12:11 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-20 15:12:11 +0200
commit68a183a2d91709537fe5cab3ed989f97a590845c (patch)
treefeb3978a5c4444a01bc5b3d5f72b8eda2c140cf6 /editor/code_editor.cpp
parent55fc347efd50d297de3b92a5bfc141e52e57c90f (diff)
parent215e036600809fd588ec67b8d39efe12ae1ff4c5 (diff)
downloadredot-engine-68a183a2d91709537fe5cab3ed989f97a590845c.tar.gz
Merge pull request #83626 from YuriSizov/control-less-is-more-as-in-less-excessive-notifications-is-more-performance
Add bulk change guards to successive theme overrides in Editor and GUI
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 014fe8a530..7e6a49d6c0 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1718,6 +1718,8 @@ void CodeTextEditor::_update_text_editor_theme() {
int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts));
error->add_theme_font_override("font", status_bar_font);
error->add_theme_font_size_override("font_size", status_bar_font_size);
+ error->end_bulk_theme_override();
+
int count = status_bar->get_child_count();
for (int i = 0; i < count; i++) {
Control *n = Object::cast_to<Control>(status_bar->get_child(i));
@@ -1726,7 +1728,6 @@ void CodeTextEditor::_update_text_editor_theme() {
n->add_theme_font_size_override("font_size", status_bar_font_size);
}
}
- error->end_bulk_theme_override();
}
void CodeTextEditor::_on_settings_change() {
@@ -1834,25 +1835,28 @@ void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
void CodeTextEditor::_update_status_bar_theme() {
error_button->set_icon(get_editor_theme_icon(SNAME("StatusError")));
+ warning_button->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
+
+ error_button->begin_bulk_theme_override();
error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
error_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ error_button->end_bulk_theme_override();
- warning_button->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
+ warning_button->begin_bulk_theme_override();
warning_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
warning_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
warning_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ warning_button->end_bulk_theme_override();
+ line_and_col_txt->begin_bulk_theme_override();
line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ line_and_col_txt->end_bulk_theme_override();
}
void CodeTextEditor::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE: {
- _update_status_bar_theme();
- } break;
-
case NOTIFICATION_THEME_CHANGED: {
_update_status_bar_theme();
if (toggle_scripts_button->is_visible()) {