diff options
Diffstat (limited to 'editor/editor_log.cpp')
-rw-r--r-- | editor/editor_log.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 803d7e10f7..b5cdc76115 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -65,7 +65,6 @@ void EditorLog::_notification(int p_what) { } else if (p_what == NOTIFICATION_THEME_CHANGED) { Ref<DynamicFont> df_output_code = get_font("output_source", "EditorFonts"); if (df_output_code.is_valid()) { - df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE); if (log != NULL) { log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); } @@ -79,10 +78,19 @@ void EditorLog::_clear_request() { tool_button->set_icon(Ref<Texture>()); } +void EditorLog::_copy_request() { + + log->selection_copy(); +} + void EditorLog::clear() { _clear_request(); } +void EditorLog::copy() { + _copy_request(); +} + void EditorLog::add_message(const String &p_msg, MessageType p_type) { log->add_newline(); @@ -126,13 +134,14 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { void EditorLog::_bind_methods() { ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request); + ClassDB::bind_method(D_METHOD("_copy_request"), &EditorLog::_copy_request); ADD_SIGNAL(MethodInfo("clear_request")); + ADD_SIGNAL(MethodInfo("copy_request")); } EditorLog::EditorLog() { VBoxContainer *vb = this; - add_constant_override("separation", get_constant("separation", "VBoxContainer")); HBoxContainer *hb = memnew(HBoxContainer); vb->add_child(hb); @@ -141,6 +150,12 @@ EditorLog::EditorLog() { title->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(title); + copybutton = memnew(Button); + hb->add_child(copybutton); + copybutton->set_text(TTR("Copy")); + copybutton->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C)); + copybutton->connect("pressed", this, "_copy_request"); + clearbutton = memnew(Button); hb->add_child(clearbutton); clearbutton->set_text(TTR("Clear")); @@ -163,6 +178,8 @@ EditorLog::EditorLog() { current = Thread::get_caller_id(); + add_constant_override("separation", get_constant("separation", "VBoxContainer")); + EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this); } |