diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 2a11f70274..a7a51cb93d 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -673,7 +673,7 @@ void CodeTextEditor::_reset_zoom() { if (font.is_valid()) { EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14); font->set_size(14); - zoom_nb->set_text("100%"); + font_size_nb->set_text("14 (100%)"); } } @@ -748,7 +748,7 @@ bool CodeTextEditor::_add_font_size(int p_delta) { if (font.is_valid()) { int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE); - zoom_nb->set_text(itos(100 * new_size / (14 * EDSCALE)) + "%"); + font_size_nb->set_text(itos(new_size) + " (" + itos(100 * new_size / (14 * EDSCALE)) + "%)"); if (new_size != font->get_size()) { EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE); @@ -768,6 +768,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type")); text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); + text_editor->set_draw_indent_guides(EditorSettings::get_singleton()->get("text_editor/indent/draw_indent_guides")); text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded")); @@ -1162,6 +1163,9 @@ void CodeTextEditor::_on_settings_change() { _update_font(); + font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); + font_size_nb->set_text(itos(font_size) + " (" + itos(100 * font_size / (14 * EDSCALE)) + "%)"); + // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( EDITOR_DEF("text_editor/completion/auto_brace_complete", true)); @@ -1296,23 +1300,23 @@ CodeTextEditor::CodeTextEditor() { warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); warning_count_label->set_text("0"); - Label *zoom_txt = memnew(Label); - status_bar->add_child(zoom_txt); - zoom_txt->set_align(Label::ALIGN_RIGHT); - zoom_txt->set_valign(Label::VALIGN_CENTER); - zoom_txt->set_v_size_flags(SIZE_FILL); - zoom_txt->set_text(TTR("Zoom:")); - zoom_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - - zoom_nb = memnew(Label); - status_bar->add_child(zoom_nb); - zoom_nb->set_valign(Label::VALIGN_CENTER); - zoom_nb->set_v_size_flags(SIZE_FILL); - zoom_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch - zoom_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch - zoom_nb->set_custom_minimum_size(Size2(60, 1) * EDSCALE); - zoom_nb->set_align(Label::ALIGN_RIGHT); - zoom_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + Label *font_size_txt = memnew(Label); + status_bar->add_child(font_size_txt); + font_size_txt->set_align(Label::ALIGN_RIGHT); + font_size_txt->set_valign(Label::VALIGN_CENTER); + font_size_txt->set_v_size_flags(SIZE_FILL); + font_size_txt->set_text(TTR("Font Size:")); + font_size_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + + font_size_nb = memnew(Label); + status_bar->add_child(font_size_nb); + font_size_nb->set_valign(Label::VALIGN_CENTER); + font_size_nb->set_v_size_flags(SIZE_FILL); + font_size_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch + font_size_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch + font_size_nb->set_custom_minimum_size(Size2(100, 1) * EDSCALE); + font_size_nb->set_align(Label::ALIGN_RIGHT); + font_size_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); Label *line_txt = memnew(Label); status_bar->add_child(line_txt); @@ -1368,7 +1372,7 @@ CodeTextEditor::CodeTextEditor() { font_resize_val = 0; font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); - zoom_nb->set_text(itos(100 * font_size / (14 * EDSCALE)) + "%"); + font_size_nb->set_text(itos(font_size) + " (" + itos(100 * font_size / (14 * EDSCALE)) + "%)"); font_resize_timer = memnew(Timer); add_child(font_resize_timer); font_resize_timer->set_one_shot(true); |