summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2016-06-21 17:21:55 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2016-06-21 17:21:55 +0100
commit706895a922d69c5825d2d2a2d51ca205b1b81ea3 (patch)
tree7c869a01a07b302c19fe7b7be7fb69150db09240
parenta40cb680cae75342ef86443c6996024199b1391d (diff)
Added code completion selected color setting
-rw-r--r--scene/gui/text_edit.cpp5
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/resources/default_theme/default_theme.cpp6
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp1
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp1
6 files changed, 7 insertions, 9 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 326771e306..444b06291b 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1041,7 +1041,6 @@ void TextEdit::_notification(int p_what) {
if (completion_active) {
// code completion box
Ref<StyleBox> csb = get_stylebox("completion");
- Ref<StyleBox> csel = get_stylebox("completion_selected");
int maxlines = get_constant("completion_lines");
int cmax_width = get_constant("completion_max_width")*cache.font->get_char_size('x').x;
Color existing = get_color("completion_existing");
@@ -1093,8 +1092,7 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(completion_rect.pos,completion_rect.size+Size2(scrollw,0)),cache.completion_background_color);
}
int line_from = CLAMP(completion_index - lines/2, 0, completion_options.size() - lines);
- draw_style_box(csel,Rect2(Point2(completion_rect.pos.x,completion_rect.pos.y+(completion_index-line_from)*get_row_height()),Size2(completion_rect.size.width,get_row_height())));
-
+ VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(Point2(completion_rect.pos.x,completion_rect.pos.y+(completion_index-line_from)*get_row_height()),Size2(completion_rect.size.width,get_row_height())),cache.completion_selected_color);
draw_rect(Rect2(completion_rect.pos,Size2(nofs,completion_rect.size.height)),existing);
@@ -3287,6 +3285,7 @@ void TextEdit::_update_caches() {
cache.style_normal=get_stylebox("normal");
cache.style_focus=get_stylebox("focus");
cache.completion_background_color=get_color("completion_background_color");
+ cache.completion_selected_color=get_color("completion_selected_color");
cache.font=get_font("font");
cache.caret_color=get_color("caret_color");
cache.line_number_color=get_color("line_number_color");
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 0667cae5a5..336733611a 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -75,6 +75,7 @@ class TextEdit : public Control {
Ref<StyleBox> style_focus;
Ref<Font> font;
Color completion_background_color;
+ Color completion_selected_color;
Color caret_color;
Color line_number_color;
Color font_color;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 53a186f0c3..63e45b776d 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -696,12 +696,6 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
t->set_stylebox("cursor_unfocused","ItemList", focus );
- // TextEdit
-
- t->set_stylebox("completion_selected","TextEdit", tree_selected );
-
-
-
// TabContainer
Ref<StyleBoxTexture> tc_sb = sb_expand( make_stylebox( tab_container_bg_png,4,4,4,4,4,4,4,4),3,3,3,3);
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 0eca84179f..eec505c66b 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -675,6 +675,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
void EditorSettings::_load_default_text_editor_theme() {
set("text_editor/background_color",Color::html("3b000000"));
set("text_editor/completion_background_color", Color::html("2C2A32"));
+ set("text_editor/completion_selected_color", Color::html("434244"));
set("text_editor/caret_color",Color::html("aaaaaa"));
set("text_editor/line_number_color",Color::html("66aaaaaa"));
set("text_editor/text_color",Color::html("aaaaaa"));
@@ -908,6 +909,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
Ref<ConfigFile> cf = memnew( ConfigFile ); // hex is better?
cf->set_value(theme_section, "background_color", ((Color)get("text_editor/background_color")).to_html());
cf->set_value(theme_section, "completion_background_color", ((Color)get("text_editor/completion_background_color")).to_html());
+ cf->set_value(theme_section, "completion_selected_color", ((Color)get("text_editor/completion_selected_color")).to_html());
cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/caret_color")).to_html());
cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/line_number_color")).to_html());
cf->set_value(theme_section, "text_color", ((Color)get("text_editor/text_color")).to_html());
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 401f61f44b..8c8425c8e2 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -288,6 +288,7 @@ void ScriptTextEditor::_load_theme_settings() {
get_text_edit()->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0)));
get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0)));
+ get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244")));
get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0)));
get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0)));
get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0)));
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 066dd04410..339a57b0b1 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -79,6 +79,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0)));
get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0)));
+ get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244")));
get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0)));
get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0)));
get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0)));