diff options
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index a36e2f360e..8089d463bd 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -30,7 +30,7 @@ #include "editor_help.h" -#include "core/input/input_filter.h" +#include "core/input/input.h" #include "core/os/keyboard.h" #include "doc_data_compressed.gen.h" #include "editor/plugins/script_editor_plugin.h" @@ -47,12 +47,12 @@ void EditorHelp::_init_colors() { title_color = get_theme_color("accent_color", "Editor"); text_color = get_theme_color("default_color", "RichTextLabel"); headline_color = get_theme_color("headline_color", "EditorHelp"); - base_type_color = title_color.linear_interpolate(text_color, 0.5); + base_type_color = title_color.lerp(text_color, 0.5); comment_color = text_color * Color(1, 1, 1, 0.6); symbol_color = comment_color; value_color = text_color * Color(1, 1, 1, 0.6); qualifier_color = text_color * Color(1, 1, 1, 0.8); - type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); + type_color = get_theme_color("accent_color", "Editor").lerp(text_color, 0.5); class_desc->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE)); } @@ -196,9 +196,14 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { } } const Color text_color = get_theme_color("default_color", "RichTextLabel"); - const Color type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); + const Color type_color = get_theme_color("accent_color", "Editor").lerp(text_color, 0.5); class_desc->push_color(type_color); + bool add_array = false; if (can_ref) { + if (t.ends_with("[]")) { + add_array = true; + t = t.replace("[]", ""); + } if (p_enum.empty()) { class_desc->push_meta("#" + t); //class } else { @@ -206,8 +211,15 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { } } class_desc->add_text(t); - if (can_ref) + if (can_ref) { class_desc->pop(); + if (add_array) { + class_desc->add_text(" "); + class_desc->push_meta("#Array"); //class + class_desc->add_text("[]"); + class_desc->pop(); + } + } class_desc->pop(); } @@ -1210,11 +1222,14 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_theme_font("doc", "EditorFonts"); Ref<Font> doc_bold_font = p_rt->get_theme_font("doc_bold", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_theme_font("doc_source", "EditorFonts"); + Ref<Font> doc_kbd_font = p_rt->get_theme_font("doc_keyboard", "EditorFonts"); Color font_color_hl = p_rt->get_theme_color("headline_color", "EditorHelp"); Color accent_color = p_rt->get_theme_color("accent_color", "Editor"); - Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8); - Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6); + Color property_color = p_rt->get_theme_color("property_color", "Editor"); + Color link_color = accent_color.lerp(font_color_hl, 0.8); + Color code_color = accent_color.lerp(font_color_hl, 0.6); + Color kbd_color = accent_color.lerp(property_color, 0.6); String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges(); @@ -1325,6 +1340,14 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { code_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); + } else if (tag == "kbd") { + + //use keyboard font with custom color + p_rt->push_font(doc_kbd_font); + p_rt->push_color(kbd_color); + code_tag = true; // though not strictly a code tag, logic is similar + pos = brk_end + 1; + tag_stack.push_front(tag); } else if (tag == "center") { //align to center @@ -1832,7 +1855,7 @@ void FindBar::_search_text_changed(const String &p_text) { void FindBar::_search_text_entered(const String &p_text) { - if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) { + if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { search_prev(); } else { search_next(); |