MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / ScriptTextEditor

Method ScriptTextEditor

editor/script/script_text_editor.cpp:2821–2927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2819}
2820
2821ScriptTextEditor::ScriptTextEditor() {
2822 code_editor = memnew(CodeTextEditor);
2823 code_editor->set_toggle_list_control(ScriptEditor::get_singleton()->get_left_list_split());
2824 code_editor->add_theme_constant_override("separation", 2);
2825 code_editor->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
2826 code_editor->set_code_complete_func(_code_complete_scripts, this);
2827 code_editor->set_v_size_flags(SIZE_EXPAND_FILL);
2828
2829 code_editor->get_text_editor()->set_draw_breakpoints_gutter(true);
2830 code_editor->get_text_editor()->set_draw_executing_lines_gutter(true);
2831 code_editor->get_text_editor()->connect("breakpoint_toggled", callable_mp(this, &ScriptTextEditor::_breakpoint_toggled));
2832 code_editor->get_text_editor()->connect("caret_changed", callable_mp(this, &ScriptTextEditor::_on_caret_moved));
2833 code_editor->connect("navigation_preview_ended", callable_mp(this, &ScriptTextEditor::_on_caret_moved));
2834
2835 connection_gutter = 1;
2836 code_editor->get_text_editor()->add_gutter(connection_gutter);
2837 code_editor->get_text_editor()->set_gutter_name(connection_gutter, "connection_gutter");
2838 code_editor->get_text_editor()->set_gutter_draw(connection_gutter, false);
2839 code_editor->get_text_editor()->set_gutter_overwritable(connection_gutter, true);
2840 code_editor->get_text_editor()->set_gutter_type(connection_gutter, TextEdit::GUTTER_TYPE_ICON);
2841
2842 warnings_panel = memnew(RichTextLabel);
2843 warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE));
2844 warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL);
2845 warnings_panel->set_meta_underline(true);
2846 warnings_panel->set_selection_enabled(true);
2847 warnings_panel->set_context_menu_enabled(true);
2848 warnings_panel->set_focus_mode(FOCUS_CLICK);
2849 warnings_panel->hide();
2850
2851 errors_panel = memnew(RichTextLabel);
2852 errors_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE));
2853 errors_panel->set_h_size_flags(SIZE_EXPAND_FILL);
2854 errors_panel->set_meta_underline(true);
2855 errors_panel->set_selection_enabled(true);
2856 errors_panel->set_context_menu_enabled(true);
2857 errors_panel->set_focus_mode(FOCUS_CLICK);
2858 errors_panel->hide();
2859
2860 update_settings();
2861
2862 code_editor->get_text_editor()->set_symbol_lookup_on_click_enabled(true);
2863 code_editor->get_text_editor()->set_symbol_tooltip_on_hover_enabled(true);
2864 code_editor->get_text_editor()->set_context_menu_enabled(false);
2865
2866 context_menu = memnew(PopupMenu);
2867
2868 color_panel = memnew(PopupPanel);
2869
2870 edit_hb = memnew(HBoxContainer);
2871
2872 edit_menu = memnew(MenuButton);
2873 edit_menu->set_flat(false);
2874 edit_menu->set_theme_type_variation("FlatMenuButton");
2875 edit_menu->set_text(TTRC("Edit"));
2876 edit_menu->set_switch_on_hover(true);
2877 edit_menu->set_shortcut_context(this);
2878

Callers

nothing calls this directly

Calls 15

get_left_list_splitMethod · 0.80
set_v_size_flagsMethod · 0.80
get_text_editorMethod · 0.80
add_gutterMethod · 0.80
set_gutter_nameMethod · 0.80
set_gutter_drawMethod · 0.80
set_gutter_typeMethod · 0.80

Tested by

no test coverage detected