diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 03914bec3b..b0ec346afe 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -88,23 +88,23 @@ GotoLineDialog::GotoLineDialog() { void FindReplaceBar::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); + find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); + hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process_unhandled_input(is_visible_in_tree()); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); + find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); + hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_THEME_CHANGED) { - matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); } else if (p_what == NOTIFICATION_PREDELETE) { if (base_text_editor) { base_text_editor->remove_find_replace_bar(); @@ -304,10 +304,10 @@ void FindReplaceBar::_replace_all() { } text_editor->set_v_scroll(vsval); - matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); matches_label->set_text(vformat(TTR("%d replaced."), rc)); - text_editor->call_deferred("connect", "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); + text_editor->call_deferred(SNAME("connect"), "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); results_count = -1; } @@ -368,7 +368,7 @@ void FindReplaceBar::_update_matches_label() { } else { matches_label->show(); - matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } @@ -480,10 +480,10 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { if (p_focus_replace) { search_text->deselect(); - replace_text->call_deferred("grab_focus"); + replace_text->call_deferred(SNAME("grab_focus")); } else { replace_text->deselect(); - search_text->call_deferred("grab_focus"); + search_text->call_deferred(SNAME("grab_focus")); } if (text_editor->is_selection_active() && !selection_only->is_pressed()) { @@ -585,7 +585,7 @@ bool FindReplaceBar::is_selection_only() const { } void FindReplaceBar::set_error(const String &p_label) { - emit_signal("error", p_label); + emit_signal(SNAME("error"), p_label); } void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) { @@ -760,10 +760,10 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMagnifyGesture> magnify_gesture = p_event; if (magnify_gesture.is_valid()) { - font_size = text_editor->get_theme_font_size("font_size"); + font_size = text_editor->get_theme_font_size(SNAME("font_size")); font_size *= powf(magnify_gesture->get_factor(), 0.25); - _add_font_size((int)font_size - text_editor->get_theme_font_size("font_size")); + _add_font_size((int)font_size - text_editor->get_theme_font_size(SNAME("font_size"))); return; } @@ -875,38 +875,38 @@ Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp if (has_theme_icon(p_option.display, "EditorIcons")) { tex = get_theme_icon(p_option.display, "EditorIcons"); } else { - tex = get_theme_icon("Object", "EditorIcons"); + tex = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } } break; case ScriptCodeCompletionOption::KIND_ENUM: - tex = get_theme_icon("Enum", "EditorIcons"); + tex = get_theme_icon(SNAME("Enum"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_FILE_PATH: - tex = get_theme_icon("File", "EditorIcons"); + tex = get_theme_icon(SNAME("File"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_NODE_PATH: - tex = get_theme_icon("NodePath", "EditorIcons"); + tex = get_theme_icon(SNAME("NodePath"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_VARIABLE: - tex = get_theme_icon("Variant", "EditorIcons"); + tex = get_theme_icon(SNAME("Variant"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_CONSTANT: - tex = get_theme_icon("MemberConstant", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberConstant"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_MEMBER: - tex = get_theme_icon("MemberProperty", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberProperty"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_SIGNAL: - tex = get_theme_icon("MemberSignal", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberSignal"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_FUNCTION: - tex = get_theme_icon("MemberMethod", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberMethod"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_PLAIN_TEXT: - tex = get_theme_icon("BoxMesh", "EditorIcons"); + tex = get_theme_icon(SNAME("BoxMesh"), SNAME("EditorIcons")); break; default: - tex = get_theme_icon("String", "EditorIcons"); + tex = get_theme_icon(SNAME("String"), SNAME("EditorIcons")); break; } return tex; @@ -919,7 +919,7 @@ void CodeTextEditor::_font_resize_timeout() { } bool CodeTextEditor::_add_font_size(int p_delta) { - int old_size = text_editor->get_theme_font_size("font_size"); + int old_size = text_editor->get_theme_font_size(SNAME("font_size")); int new_size = CLAMP(old_size + p_delta, 8 * EDSCALE, 96 * EDSCALE); if (new_size != old_size) { @@ -1411,19 +1411,19 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) { void CodeTextEditor::goto_line(int p_line) { text_editor->deselect(); text_editor->unfold_line(p_line); - text_editor->call_deferred("cursor_set_line", p_line); + text_editor->call_deferred(SNAME("cursor_set_line"), p_line); } void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { text_editor->unfold_line(p_line); - text_editor->call_deferred("cursor_set_line", p_line); - text_editor->call_deferred("cursor_set_column", p_begin); + text_editor->call_deferred(SNAME("cursor_set_line"), p_line); + text_editor->call_deferred(SNAME("cursor_set_column"), p_begin); text_editor->select(p_line, p_begin, p_line, p_end); } void CodeTextEditor::goto_line_centered(int p_line) { goto_line(p_line); - text_editor->call_deferred("center_viewport_to_cursor"); + text_editor->call_deferred(SNAME("center_viewport_to_cursor")); } void CodeTextEditor::set_executing_line(int p_line) { @@ -1542,20 +1542,20 @@ void CodeTextEditor::_update_text_editor_theme() { text_editor->add_theme_color_override("search_result_color", EDITOR_GET("text_editor/highlighting/search_result_color")); text_editor->add_theme_color_override("search_result_border_color", EDITOR_GET("text_editor/highlighting/search_result_border_color")); text_editor->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); - emit_signal("load_theme_settings"); + emit_signal(SNAME("load_theme_settings")); _load_theme_settings(); } void CodeTextEditor::_update_font() { - text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts")); - text_editor->add_theme_font_size_override("font_size", get_theme_font_size("source_size", "EditorFonts")); + text_editor->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + text_editor->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); - error->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts")); - error->add_theme_font_size_override("font_size", get_theme_font_size("status_source_size", "EditorFonts")); - error->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + error->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + error->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); + error->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - Ref<Font> status_bar_font = get_theme_font("status_source", "EditorFonts"); - int status_bar_font_size = get_theme_font_size("status_source_size", "EditorFonts"); + Ref<Font> status_bar_font = get_theme_font(SNAME("status_source"), SNAME("EditorFonts")); + int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")); error->add_theme_font_override("font", status_bar_font); error->add_theme_font_size_override("font_size", status_bar_font_size); int count = status_bar->get_child_count(); @@ -1614,7 +1614,7 @@ void CodeTextEditor::_on_settings_change() { void CodeTextEditor::_text_changed_idle_timeout() { _validate_script(); - emit_signal("validate_script"); + emit_signal(SNAME("validate_script")); } void CodeTextEditor::validate_script() { @@ -1633,19 +1633,19 @@ void CodeTextEditor::_warning_button_pressed() { void CodeTextEditor::_set_show_errors_panel(bool p_show) { is_errors_panel_opened = p_show; - emit_signal("show_errors_panel", p_show); + emit_signal(SNAME("show_errors_panel"), p_show); } void CodeTextEditor::_set_show_warnings_panel(bool p_show) { is_warnings_panel_opened = p_show; - emit_signal("show_warnings_panel", p_show); + emit_signal(SNAME("show_warnings_panel"), p_show); } void CodeTextEditor::_toggle_scripts_pressed() { if (is_layout_rtl()) { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Forward", "EditorIcons") : get_theme_icon("Back", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon(SNAME("Back"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Forward"), SNAME("EditorIcons"))); } } @@ -1666,8 +1666,8 @@ void CodeTextEditor::_notification(int p_what) { _update_font(); } break; case NOTIFICATION_ENTER_TREE: { - error_button->set_icon(get_theme_icon("StatusError", "EditorIcons")); - warning_button->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); + warning_button->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons"))); add_theme_constant_override("separation", 4 * EDSCALE); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -1779,9 +1779,9 @@ void CodeTextEditor::show_toggle_scripts_button() { void CodeTextEditor::update_toggle_scripts_button() { if (is_layout_rtl()) { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Forward", "EditorIcons") : get_theme_icon("Back", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon(SNAME("Back"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Forward"), SNAME("EditorIcons"))); } toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); } @@ -1871,9 +1871,9 @@ CodeTextEditor::CodeTextEditor() { error_button->connect("pressed", callable_mp(this, &CodeTextEditor::_error_button_pressed)); error_button->set_tooltip(TTR("Errors")); - error_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); - error_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - error_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + error_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), SNAME("Editor"))); + error_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + error_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); is_errors_panel_opened = false; set_error_count(0); @@ -1887,9 +1887,9 @@ CodeTextEditor::CodeTextEditor() { warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed)); warning_button->set_tooltip(TTR("Warnings")); - warning_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor")); - warning_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - warning_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + warning_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + warning_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + warning_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); is_warnings_panel_opened = false; set_warning_count(0); @@ -1898,8 +1898,8 @@ CodeTextEditor::CodeTextEditor() { line_and_col_txt = memnew(Label); status_bar->add_child(line_and_col_txt); line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); - line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - line_and_col_txt->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + line_and_col_txt->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); line_and_col_txt->set_tooltip(TTR("Line and column numbers.")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); |