summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorjonyrock <ilms@live.ru>2014-04-30 20:21:58 +0400
committerjonyrock <ilms@live.ru>2014-04-30 20:21:58 +0400
commitbb853d121ef7dfeda510d9325ebd94a06a0e5ae2 (patch)
tree66cccc416f0c10bc3be9d2fe1541b39239ca0c83 /scene/gui
parent2c683b0f993127a0bf2150359403479caa258da0 (diff)
EDITOR_DEF in the right place
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp17
-rw-r--r--scene/gui/text_edit.h9
2 files changed, 12 insertions, 14 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index bcfe6c1f95..87900306d4 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -44,8 +44,6 @@
#include "globals.h"
#include "message_queue.h"
-#include "tools/editor/editor_settings.h"
-
#define TAB_PIXELS
static bool _is_text_char(CharType c) {
@@ -64,7 +62,7 @@ static bool _is_pair_right_symbol(CharType c) {
c == '\'' ||
c == ')' ||
c == ']' ||
- c == '}';
+ c == '}';
}
static bool _is_pair_left_symbol(CharType c) {
@@ -839,8 +837,7 @@ void TextEdit::backspace_at_cursor() {
int prev_line = cursor.column?cursor.line:cursor.line-1;
int prev_column = cursor.column?(cursor.column-1):(text[cursor.line-1].length());
- bool auto_brace_complete = EDITOR_DEF("text_editor/auto_brace_complete", false);
- if(auto_brace_complete &&
+ if(auto_brace_completion_enabled &&
cursor.column > 0 &&
_is_pair_left_symbol(text[cursor.line][cursor.column - 1])) {
_consume_backspace_for_pair_symbol(prev_line, prev_column);
@@ -1246,8 +1243,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
default:
if (k.unicode>=32 && !k.mod.command && !k.mod.alt && !k.mod.meta)
clear=true;
- bool auto_brace_complete=EDITOR_DEF("text_editor/auto_brace_complete", false);
- if (auto_brace_complete && _is_pair_left_symbol(k.unicode))
+ if (auto_brace_completion_enabled && _is_pair_left_symbol(k.unicode))
clear=false;
}
@@ -1671,12 +1667,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (readonly)
break;
-
-
const CharType chr[2] = {k.unicode, 0};
- bool auto_brace_complete = EDITOR_DEF("text_editor/auto_brace_complete", false);
- if(auto_brace_complete && _is_pair_symbol(chr[0])) {
+ if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) {
_consume_pair_symbol(chr[0]);
} else {
_insert_text_at_cursor(chr);
@@ -2025,7 +2018,6 @@ void TextEdit::adjust_viewport_to_cursor() {
}
-
void TextEdit::cursor_set_column(int p_col) {
if (p_col<0)
@@ -3148,6 +3140,7 @@ TextEdit::TextEdit() {
tooltip_obj=NULL;
line_numbers=false;
next_operation_is_complex=false;
+ auto_brace_completion_enabled=false;
}
TextEdit::~TextEdit(){
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index ccbfae508c..58d62dea48 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -206,6 +206,8 @@ class TextEdit : public Control {
bool text_changed_dirty;
bool undo_enabled;
bool line_numbers;
+
+ bool auto_brace_completion_enabled;
uint64_t last_dblclk;
@@ -304,8 +306,11 @@ public:
String get_text();
String get_line(int line) const;
void backspace_at_cursor();
-
-
+
+ inline void set_auto_brace_completion(bool p_enabled) {
+ auto_brace_completion_enabled = p_enabled;
+ }
+
void cursor_set_column(int p_col);
void cursor_set_line(int p_row);