summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2020-07-30 11:41:05 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2020-09-10 20:35:28 +0100
commit33ab9cd621c9a1dc9b5a4febf266ce2b5894a10a (patch)
tree1b152da3b89aff78378ffae2bae228db4feea79c /scene/gui
parentd18a90b8f0a68c03a6682ec054f622d644b41cc5 (diff)
Move safe line color into editor
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/code_edit.cpp8
-rw-r--r--scene/gui/text_edit.cpp13
-rw-r--r--scene/gui/text_edit.h7
3 files changed, 6 insertions, 22 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 02a6366dad..56cf432b38 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -233,8 +233,12 @@ bool CodeEdit::is_line_numbers_zero_padded() const {
void CodeEdit::_line_number_draw_callback(int p_line, int p_gutter, const Rect2 &p_region) {
String fc = String::num(p_line + 1).lpad(line_number_digits, line_number_padding);
- int yofs = region.position.y + (cache.row_height - cache.font->get_height()) / 2;
- cache.font->draw(get_canvas_item(), Point2(region.position.x, yofs + cache.font->get_ascent()), fc, line_number_color);
+ int yofs = p_region.position.y + (cache.row_height - cache.font->get_height()) / 2;
+ Color number_color = get_line_gutter_item_color(p_line, line_number_gutter);
+ if (number_color == Color(1, 1, 1)) {
+ number_color = line_number_color;
+ }
+ cache.font->draw(get_canvas_item(), Point2(p_region.position.x, yofs + cache.font->get_ascent()), fc, number_color);
}
/* Fold Gutter */
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 03210c5648..957e1c11c7 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -196,7 +196,6 @@ void TextEdit::Text::insert(int p_at, const String &p_text) {
Line line;
line.gutters.resize(gutter_count);
line.marked = false;
- line.safe = false;
line.hidden = false;
line.width_cache = -1;
line.wrap_amount_cache = -1;
@@ -4723,7 +4722,6 @@ void TextEdit::_update_caches() {
cache.font = get_theme_font("font");
cache.caret_color = get_theme_color("caret_color");
cache.caret_background_color = get_theme_color("caret_background_color");
- cache.safe_line_number_color = get_theme_color("safe_line_number_color");
cache.font_color = get_theme_color("font_color");
cache.font_color_selected = get_theme_color("font_color_selected");
cache.font_color_readonly = get_theme_color("font_color_readonly");
@@ -5378,17 +5376,6 @@ void TextEdit::set_line_as_marked(int p_line, bool p_marked) {
update();
}
-void TextEdit::set_line_as_safe(int p_line, bool p_safe) {
- ERR_FAIL_INDEX(p_line, text.size());
- text.set_safe(p_line, p_safe);
- update();
-}
-
-bool TextEdit::is_line_set_as_safe(int p_line) const {
- ERR_FAIL_INDEX_V(p_line, text.size(), false);
- return text.is_safe(p_line);
-}
-
void TextEdit::set_line_as_hidden(int p_line, bool p_hidden) {
ERR_FAIL_INDEX(p_line, text.size());
if (is_hiding_enabled() || !p_hidden) {
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index f969311e57..17534cbbc8 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -82,14 +82,12 @@ private:
int width_cache : 24;
bool marked : 1;
bool hidden : 1;
- bool safe : 1;
int wrap_amount_cache : 24;
String data;
Line() {
width_cache = 0;
marked = false;
hidden = false;
- safe = false;
wrap_amount_cache = 0;
}
};
@@ -115,8 +113,6 @@ private:
bool is_marked(int p_line) const { return text[p_line].marked; }
void set_hidden(int p_line, bool p_hidden) { text.write[p_line].hidden = p_hidden; }
bool is_hidden(int p_line) const { return text[p_line].hidden; }
- void set_safe(int p_line, bool p_safe) { text.write[p_line].safe = p_safe; }
- bool is_safe(int p_line) const { return text[p_line].safe; }
void insert(int p_at, const String &p_text);
void remove(int p_at);
int size() const { return text.size(); }
@@ -455,7 +451,6 @@ protected:
Color completion_font_color;
Color caret_color;
Color caret_background_color;
- Color safe_line_number_color;
Color font_color;
Color font_color_selected;
Color font_color_readonly;
@@ -576,8 +571,6 @@ public:
void insert_at(const String &p_text, int at);
int get_line_count() const;
void set_line_as_marked(int p_line, bool p_marked);
- void set_line_as_safe(int p_line, bool p_safe);
- bool is_line_set_as_safe(int p_line) const;
void set_line_as_hidden(int p_line, bool p_hidden);
bool is_line_hidden(int p_line) const;