diff options
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r-- | tools/editor/code_editor.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 71ae171dfe..c6de541d02 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -1051,7 +1051,11 @@ void CodeTextEditor::_code_complete_timer_timeout() { void CodeTextEditor::_complete_request() { List<String> entries; - _code_complete_script(text_editor->get_text_for_completion(),&entries); + String ctext = text_editor->get_text_for_completion(); + _code_complete_script(ctext,&entries); + if (code_complete_func) { + code_complete_func(code_complete_ud,ctext,&entries); + } // print_line("COMPLETE: "+p_request); if (entries.size()==0) return; @@ -1135,13 +1139,16 @@ void CodeTextEditor::_text_changed_idle_timeout() { _validate_script(); + emit_signal("validate_script"); } void CodeTextEditor::_notification(int p_what) { - if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) + if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { _load_theme_settings(); + emit_signal("load_theme_settings"); + } if (p_what==NOTIFICATION_ENTER_TREE) { _update_font(); } @@ -1157,10 +1164,21 @@ void CodeTextEditor::_bind_methods() { ObjectTypeDB::bind_method("_code_complete_timer_timeout",&CodeTextEditor::_code_complete_timer_timeout); ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); ObjectTypeDB::bind_method("_font_resize_timeout",&CodeTextEditor::_font_resize_timeout); + + ADD_SIGNAL(MethodInfo("validate_script")); + ADD_SIGNAL(MethodInfo("load_theme_settings")); + } +void CodeTextEditor::set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func,void * p_ud) { + code_complete_func=p_code_complete_func; + code_complete_ud=p_ud; +} + + CodeTextEditor::CodeTextEditor() { + code_complete_func=NULL; ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD|KEY_EQUAL); ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD|KEY_MINUS); ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD|KEY_0); |