summaryrefslogtreecommitdiffstats
path: root/tools/editor/code_editor.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-04-05 12:39:30 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-04-05 12:39:30 -0300
commit9f33134c93ecbadda70e8eefc50563e29b2eb7f2 (patch)
tree299ded94fe74a61bf8094935d0f3283f6f30e435 /tools/editor/code_editor.cpp
parent35b84d2c85fd152bee05d7d5a05e20a5f602a285 (diff)
downloadredot-engine-9f33134c93ecbadda70e8eefc50563e29b2eb7f2.tar.gz
-Support for changing fonts
-Detect when free() might crash the project and throw error -fixed 2D Bounce in physics (3d still broken) -renamed “on_top” property to “behind_parent”, which makes more sense, old on_top remains there for compatibility but is invisible. -large amount of fixes
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r--tools/editor/code_editor.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index ca1e769ffa..ea87ac625b 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -510,6 +510,20 @@ void CodeTextEditor::set_error(const String& p_error) {
}
+void CodeTextEditor::_update_font() {
+
+ String editor_font = EditorSettings::get_singleton()->get("text_editor/font");
+ if (editor_font!="") {
+ Ref<Font> fnt = ResourceLoader::load(editor_font);
+ if (fnt.is_valid()) {
+ text_editor->add_font_override("font",fnt);
+ return;
+ }
+ }
+
+ text_editor->add_font_override("font",get_font("source","Fonts"));
+}
+
void CodeTextEditor::_text_changed_idle_timeout() {
@@ -527,8 +541,9 @@ void CodeTextEditor::_bind_methods() {
ObjectTypeDB::bind_method("_line_col_changed",&CodeTextEditor::_line_col_changed);
ObjectTypeDB::bind_method("_text_changed",&CodeTextEditor::_text_changed);
+ ObjectTypeDB::bind_method("_update_font",&CodeTextEditor::_update_font);
ObjectTypeDB::bind_method("_text_changed_idle_timeout",&CodeTextEditor::_text_changed_idle_timeout);
- ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request);
+ ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request);
}
CodeTextEditor::CodeTextEditor() {
@@ -571,4 +586,5 @@ CodeTextEditor::CodeTextEditor() {
text_editor->set_completion(true,cs);
idle->connect("timeout", this,"_text_changed_idle_timeout");
+ EditorSettings::get_singleton()->connect("settings_changed",this,"_update_font");
}