diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-25 22:26:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 22:26:25 +0200 |
commit | 8fe8e730a01b44650ee1540d662f5122474fec9d (patch) | |
tree | 0ab81db09b5de237cd61631a541252ba54c492c7 | |
parent | dae02a90415b3af5ad2f14297e6259641cccef81 (diff) | |
parent | 79e506ff520b3d53680d131f8bd0ce5e0f0da6ec (diff) |
Merge pull request #11576 from volzhs/output-console
Add font size setting for output panel
-rw-r--r-- | editor/editor_fonts.cpp | 10 | ||||
-rw-r--r-- | editor/editor_log.cpp | 15 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 2 |
3 files changed, 20 insertions, 7 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 6e5726a16d..110b2a6a8c 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -158,6 +158,16 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("doc_source", "EditorFonts", df_doc_code); + Ref<DynamicFont> df_output_code; + df_output_code.instance(); + df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE); + df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); + df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); + df_output_code->set_font_data(dfmono); + MAKE_FALLBACKS(df_output_code); + + p_theme->set_font("output_source", "EditorFonts", df_output_code); + //replace default theme Ref<Texture> di; Ref<StyleBox> ds; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 481f2aaecf..3b20660013 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -31,6 +31,7 @@ #include "editor_node.h" #include "scene/gui/center_container.h" +#include "scene/resources/dynamic_font.h" #include "version.h" void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type) { @@ -51,7 +52,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f self->emit_signal("show_request"); */ - err_str = " " + err_str; self->add_message(err_str, true); } @@ -60,6 +60,13 @@ void EditorLog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { //button->set_icon(get_icon("Console","EditorIcons")); + log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); + } 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); + log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); + } } /*if (p_what==NOTIFICATION_DRAW) { @@ -85,15 +92,13 @@ void EditorLog::clear() { void EditorLog::add_message(const String &p_msg, bool p_error) { - Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts"); - log->push_font(doc_code_font); - log->add_newline(); if (p_error) { log->push_color(get_color("error_color", "Editor")); Ref<Texture> icon = get_icon("Error", "EditorIcons"); log->add_image(icon); + log->add_text(" "); //button->set_icon(icon); } else { //button->set_icon(Ref<Texture>()); @@ -104,8 +109,6 @@ void EditorLog::add_message(const String &p_msg, bool p_error) { if (p_error) log->pop(); - - log->pop(); // pop font; } /* diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 76e75cff0a..d71bc1838b 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1065,7 +1065,7 @@ void ScriptEditorDebugger::start() { int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); if (server->listen(remote_port) != OK) { - EditorNode::get_log()->add_message(String("** Error listening on port ") + itos(remote_port) + String(" **")); + EditorNode::get_log()->add_message(String("Error listening on port ") + itos(remote_port), true); return; } set_process(true); |