Fix Output panel colors on theme changing
This commit is contained in:
parent
8cc599db64
commit
9ceeb5f9dd
|
@ -57,35 +57,43 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorLog::_update_theme() {
|
||||||
|
Ref<Font> normal_font = get_theme_font(SNAME("output_source"), SNAME("EditorFonts"));
|
||||||
|
if (normal_font.is_valid()) {
|
||||||
|
log->add_theme_font_override("normal_font", normal_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
|
||||||
|
log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
|
||||||
|
|
||||||
|
Ref<Font> bold_font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
|
if (bold_font.is_valid()) {
|
||||||
|
log->add_theme_font_override("bold_font", bold_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons")));
|
||||||
|
type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
|
||||||
|
type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
|
||||||
|
type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
|
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
||||||
|
copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
|
||||||
|
collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
|
||||||
|
show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
|
}
|
||||||
|
|
||||||
void EditorLog::_notification(int p_what) {
|
void EditorLog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
//button->set_icon(get_icon("Console","EditorIcons"));
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
log->add_theme_font_override("normal_font", get_theme_font(SNAME("output_source"), SNAME("EditorFonts")));
|
_update_theme();
|
||||||
log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
|
_load_state();
|
||||||
log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
|
} break;
|
||||||
log->add_theme_font_override("bold_font", get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
_update_theme();
|
||||||
type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons")));
|
_rebuild_log();
|
||||||
type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
|
} break;
|
||||||
type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
|
default:
|
||||||
type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
break;
|
||||||
|
|
||||||
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
|
||||||
copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
|
|
||||||
collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
|
|
||||||
show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
|
||||||
|
|
||||||
_load_state();
|
|
||||||
|
|
||||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
|
||||||
Ref<Font> df_output_code = get_theme_font(SNAME("output_source"), SNAME("EditorFonts"));
|
|
||||||
if (df_output_code.is_valid()) {
|
|
||||||
if (log != nullptr) {
|
|
||||||
log->add_theme_font_override("normal_font", get_theme_font(SNAME("output_source"), SNAME("EditorFonts")));
|
|
||||||
log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts")));
|
|
||||||
log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,8 @@ private:
|
||||||
void _save_state();
|
void _save_state();
|
||||||
void _load_state();
|
void _load_state();
|
||||||
|
|
||||||
|
void _update_theme();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|
Loading…
Reference in New Issue