diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 22 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 3 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 6 |
3 files changed, 29 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1315b67ea1..a680d5d873 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1111,7 +1111,7 @@ void TextEdit::_notification(int p_what) { int l = line_from + i; ERR_CONTINUE( l < 0 || l>= completion_options.size()); - Color text_color = cache.font_color; + Color text_color = cache.completion_font_color; for(int j=0;j<color_regions.size();j++) { if (completion_options[l].begins_with(color_regions[j].begin_key)) { text_color=color_regions[j].color; @@ -3312,6 +3312,7 @@ void TextEdit::_update_caches() { cache.completion_background_color=get_color("completion_background_color"); cache.completion_selected_color=get_color("completion_selected_color"); cache.completion_existing_color=get_color("completion_existing_color"); + cache.completion_font_color=get_color("completion_font_color"); cache.font=get_font("font"); cache.caret_color=get_color("caret_color"); cache.line_number_color=get_color("line_number_color"); @@ -3609,6 +3610,10 @@ void TextEdit::set_highlight_all_occurrences(const bool p_enabled) { update(); } +bool TextEdit::is_highlight_all_occurrences_enabled() const { + return highlight_all_occurrences; +} + int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column) { int col = -1; @@ -4318,6 +4323,10 @@ void TextEdit::set_show_line_numbers(bool p_show) { update(); } +bool TextEdit::is_show_line_numbers_enabled() const { + return line_numbers; +} + void TextEdit::set_draw_breakpoint_gutter(bool p_draw) { draw_breakpoint_gutter = p_draw; update(); @@ -4432,6 +4441,12 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("redo"),&TextEdit::redo); ObjectTypeDB::bind_method(_MD("clear_undo_history"),&TextEdit::clear_undo_history); + ObjectTypeDB::bind_method(_MD("set_show_line_numbers", "enable"), &TextEdit::set_show_line_numbers); + ObjectTypeDB::bind_method(_MD("is_show_line_numbers_enabled"), &TextEdit::is_show_line_numbers_enabled); + + ObjectTypeDB::bind_method(_MD("set_highlight_all_occurrences", "enable"), &TextEdit::set_highlight_all_occurrences); + ObjectTypeDB::bind_method(_MD("is_highlight_all_occurrences_enabled"), &TextEdit::is_highlight_all_occurrences_enabled); + ObjectTypeDB::bind_method(_MD("set_syntax_coloring","enable"),&TextEdit::set_syntax_coloring); ObjectTypeDB::bind_method(_MD("is_syntax_coloring_enabled"),&TextEdit::is_syntax_coloring_enabled); @@ -4444,7 +4459,10 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("menu_option"),&TextEdit::menu_option); ObjectTypeDB::bind_method(_MD("get_menu:PopupMenu"),&TextEdit::get_menu); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled"));; + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), _SCS("set_show_line_numbers"), _SCS("is_show_line_numbers_enabled")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), _SCS("set_highlight_all_occurrences"), _SCS("is_highlight_all_occurrences_enabled")); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1,10,0.1"), _SCS("cursor_set_blink_speed"),_SCS("cursor_get_blink_speed") ); ADD_SIGNAL(MethodInfo("cursor_changed")); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index acac687b59..270a1723b1 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -77,6 +77,7 @@ class TextEdit : public Control { Color completion_background_color; Color completion_selected_color; Color completion_existing_color; + Color completion_font_color; Color caret_color; Color line_number_color; Color font_color; @@ -427,6 +428,7 @@ public: void set_current_search_result(int line, int col); void set_highlight_all_occurrences(const bool p_enabled); + bool is_highlight_all_occurrences_enabled() const; bool is_selection_active() const; int get_selection_from_line() const; int get_selection_from_column() const; @@ -468,6 +470,7 @@ public: void menu_option(int p_option); void set_show_line_numbers(bool p_show); + bool is_show_line_numbers_enabled() const; void set_draw_breakpoint_gutter(bool p_draw); bool is_drawing_breakpoint_gutter() const; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 7ed83f50f8..182bc5dabc 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -473,6 +473,7 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F t->set_color("completion_selected_color", "TextEdit",Color::html("434244")); t->set_color("completion_existing_color", "TextEdit",Color::html("21dfdfdf")); t->set_color("completion_scroll_color","TextEdit", control_font_color_pressed ); + t->set_color("completion_font_color","TextEdit", Color::html("aaaaaa")); t->set_color("font_color","TextEdit", control_font_color ); t->set_color("font_color_selected","TextEdit", Color(0,0,0) ); t->set_color("selection_color","TextEdit", font_color_selection ); @@ -482,6 +483,11 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F t->set_color("caret_color","TextEdit", control_font_color ); t->set_color("symbol_color","TextEdit", control_font_color_hover ); t->set_color("brace_mismatch_color","TextEdit", Color(1,0.2,0.2) ); + t->set_color("line_number_color","TextEdit",Color::html("66aaaaaa")); + t->set_color("function_color","TextEdit",Color::html("66a2ce")); + t->set_color("member_variable_color","TextEdit",Color::html("e64e59")); + t->set_color("number_color","TextEdit",Color::html("EB9532")); + t->set_color("word_highlighted_color","TextEdit",Color(0.8,0.9,0.9,0.15)); t->set_constant("completion_lines","TextEdit", 7 ); t->set_constant("completion_max_width","TextEdit", 50 ); |