Merge pull request #73106 from YuriSizov/editor-help-theming-2000

Improve EditorHelp theming and make font size settings work
This commit is contained in:
Rémi Verschelde 2023-02-11 22:01:20 +01:00
commit b601f7959b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 340 additions and 284 deletions

File diff suppressed because it is too large Load Diff

View File

@ -125,25 +125,33 @@ class EditorHelp : public VBoxContainer {
String base_path;
Color text_color;
Color title_color;
Color headline_color;
Color comment_color;
Color symbol_color;
Color value_color;
Color qualifier_color;
Color type_color;
struct ThemeCache {
Ref<StyleBox> background_style;
Ref<Font> doc_font;
Ref<Font> doc_bold_font;
Ref<Font> doc_title_font;
Ref<Font> doc_code_font;
Color text_color;
Color title_color;
Color headline_color;
Color comment_color;
Color symbol_color;
Color value_color;
Color qualifier_color;
Color type_color;
int doc_title_font_size;
Ref<Font> doc_font;
Ref<Font> doc_bold_font;
Ref<Font> doc_italic_font;
Ref<Font> doc_title_font;
Ref<Font> doc_code_font;
Ref<Font> doc_kbd_font;
int doc_font_size = 0;
int doc_title_font_size = 0;
int doc_code_font_size = 0;
int doc_kbd_font_size = 0;
} theme_cache;
int scroll_to = -1;
void _update_theme();
void _help_callback(const String &p_topic);
void _add_text(const String &p_bbcode);
@ -156,6 +164,13 @@ class EditorHelp : public VBoxContainer {
void _add_bulletpoint();
void _push_normal_font();
void _pop_normal_font();
void _push_title_font();
void _pop_title_font();
void _push_code_font();
void _pop_code_font();
void _class_desc_finished();
void _class_list_select(const String &p_select);
void _class_desc_select(const String &p_select);
@ -181,6 +196,8 @@ class EditorHelp : public VBoxContainer {
static void _gen_doc_thread(void *p_udata);
protected:
virtual void _update_theme_item_cache() override;
void _notification(int p_what);
static void _bind_methods();

View File

@ -691,10 +691,11 @@ void EditorNode::_notification(int p_what) {
bool theme_changed =
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") ||
EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size");
if (theme_changed) {

View File

@ -586,9 +586,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Help
_initial_set("text_editor/help/show_help_index", true);
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_font_size", 15, "8,48,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_source_font_size", 14, "8,48,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_title_font_size", 23, "8,48,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_font_size", 16, "8,48,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_source_font_size", 15, "8,48,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_title_font_size", 23, "8,64,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "text_editor/help/class_reference_examples", 0, "GDScript,C#,GDScript and C#")
/* Editors */