Răsfoiți Sursa

Make use of a theme cache in EditorHelp and ensure it's updated

- Migrates the existing cache to the standard theme cache struct
- Moves some parts of the codebase to use cache instead of ad-hoc fetching
- Adds hooks to editor settings previously missing from theme regeneration
Yuri Sizov 2 ani în urmă
părinte
comite
bbbcd77217
3 a modificat fișierele cu 214 adăugiri și 202 ștergeri
  1. 187 185
      editor/editor_help.cpp
  2. 25 16
      editor/editor_help.h
  3. 2 1
      editor/editor_node.cpp

Fișier diff suprimat deoarece este prea mare
+ 187 - 185
editor/editor_help.cpp


+ 25 - 16
editor/editor_help.h

@@ -125,25 +125,32 @@ class EditorHelp : public VBoxContainer {
 
 
 	String base_path;
 	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;
-
-	Ref<Font> doc_font;
-	Ref<Font> doc_bold_font;
-	Ref<Font> doc_title_font;
-	Ref<Font> doc_code_font;
-
-	int doc_title_font_size;
+	struct ThemeCache {
+		Ref<StyleBox> background_style;
+
+		Color text_color;
+		Color title_color;
+		Color headline_color;
+		Color comment_color;
+		Color symbol_color;
+		Color value_color;
+		Color qualifier_color;
+		Color type_color;
+
+		Ref<Font> doc_font;
+		Ref<Font> doc_bold_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;
 	int scroll_to = -1;
 
 
-	void _update_theme();
 	void _help_callback(const String &p_topic);
 	void _help_callback(const String &p_topic);
 
 
 	void _add_text(const String &p_bbcode);
 	void _add_text(const String &p_bbcode);
@@ -181,6 +188,8 @@ class EditorHelp : public VBoxContainer {
 	static void _gen_doc_thread(void *p_udata);
 	static void _gen_doc_thread(void *p_udata);
 
 
 protected:
 protected:
+	virtual void _update_theme_item_cache() override;
+
 	void _notification(int p_what);
 	void _notification(int p_what);
 	static void _bind_methods();
 	static void _bind_methods();
 
 

+ 2 - 1
editor/editor_node.cpp

@@ -691,10 +691,11 @@ void EditorNode::_notification(int p_what) {
 
 
 			bool theme_changed =
 			bool theme_changed =
 					EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") ||
 					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/font") ||
 					EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_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("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");
 					EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size");
 
 
 			if (theme_changed) {
 			if (theme_changed) {

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff