diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2016-11-09 15:47:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-09 15:47:15 +0100 |
commit | 7d1230a266f4eab3262ebfcbf4a89148dfcb3c48 (patch) | |
tree | 8c2d5368405c7bf1c591dde28dbca3faa3bec3d4 /scene/gui/text_edit.cpp | |
parent | 2ba1b5837496c66ee1b08a290d251112f435e3e5 (diff) | |
parent | 0e2c15e91a4b9b7d4e24a1e4d2e9b791b5bd9a93 (diff) |
Merge pull request #7052 from Paulb23/text_edit_color_uniformation
Made background and symbol color follow the color API
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r-- | scene/gui/text_edit.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9b3b047712..871a3ca68f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -492,10 +492,10 @@ void TextEdit::_notification(int p_what) { if (syntax_coloring) { - if (custom_bg_color.a>0.01) { + if (cache.background_color.a>0.01) { Point2i ofs = Point2i(cache.style_normal->get_offset())/2.0; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(ofs, get_size()-cache.style_normal->get_minimum_size()+ofs),custom_bg_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(ofs, get_size()-cache.style_normal->get_minimum_size()+ofs),cache.background_color); } //compute actual region to start (may be inside say, a comment). //slow in very large documments :( but ok for source! @@ -907,7 +907,7 @@ void TextEdit::_notification(int p_what) { else if (in_function_name) color=cache.function_color; else if (is_symbol) - color=symbol_color; + color=cache.symbol_color; else if (is_number) color=cache.number_color; @@ -3489,6 +3489,8 @@ void TextEdit::_update_caches() { cache.word_highlighted_color=get_color("word_highlighted_color"); cache.search_result_color=get_color("search_result_color"); cache.search_result_border_color=get_color("search_result_border_color"); + cache.symbol_color=get_color("symbol_color"); + cache.background_color=get_color("background_color"); cache.line_spacing=get_constant("line_spacing"); cache.row_height = cache.font->get_height() + cache.line_spacing; cache.tab_icon=get_icon("tab"); @@ -3500,15 +3502,8 @@ void TextEdit::_update_caches() { void TextEdit::clear_colors() { keywords.clear(); - color_regions.clear();; + color_regions.clear(); text.clear_caches(); - custom_bg_color=Color(0,0,0,0); -} - -void TextEdit::set_custom_bg_color(const Color& p_color) { - - custom_bg_color=p_color; - update(); } void TextEdit::add_keyword_color(const String& p_keyword,const Color& p_color) { @@ -3526,12 +3521,6 @@ void TextEdit::add_color_region(const String& p_begin_key,const String& p_end_ke } -void TextEdit::set_symbol_color(const Color& p_color) { - - symbol_color=p_color; - update(); -} - void TextEdit::set_syntax_coloring(bool p_enabled) { syntax_coloring=p_enabled; @@ -4689,8 +4678,6 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_keyword_color","keyword","color"),&TextEdit::add_keyword_color); ObjectTypeDB::bind_method(_MD("add_color_region","begin_key","end_key","color","line_only"),&TextEdit::add_color_region,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("set_symbol_color","color"),&TextEdit::set_symbol_color); - ObjectTypeDB::bind_method(_MD("set_custom_bg_color","color"),&TextEdit::set_custom_bg_color); ObjectTypeDB::bind_method(_MD("clear_colors"),&TextEdit::clear_colors); ObjectTypeDB::bind_method(_MD("menu_option"),&TextEdit::menu_option); ObjectTypeDB::bind_method(_MD("get_menu:PopupMenu"),&TextEdit::get_menu); @@ -4775,7 +4762,6 @@ TextEdit::TextEdit() { caret_blink_timer->connect("timeout", this,"_toggle_draw_caret"); cursor_set_blink_enabled(false); - custom_bg_color=Color(0,0,0,0); idle_detect = memnew( Timer ); add_child(idle_detect); idle_detect->set_one_shot(true); |