summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-28 17:19:08 +0100
committerGitHub <noreply@github.com>2020-02-28 17:19:08 +0100
commit324e5a60dd068cbbff9c433802f8ecb78cff3364 (patch)
tree41edf077bcafa3c959a417aa4700318d483ff680 /editor/code_editor.cpp
parenta439131c2b06b3d452e5be13530b6d2caa72c1aa (diff)
parent32ccf306f9a820e2ac5811de7c12e99a736fdf05 (diff)
Merge pull request #36426 from akien-mga/calling-all-stations
Signals: Port connect calls to use callable_mp
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp74
1 files changed, 26 insertions, 48 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 948955eabd..c8f7e88082 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -200,7 +200,7 @@ void FindReplaceBar::_replace() {
void FindReplaceBar::_replace_all() {
- text_edit->disconnect_compat("text_changed", this, "_editor_text_changed");
+ text_edit->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
// Line as x so it gets priority in comparison, column as y.
Point2i orig_cursor(text_edit->cursor_get_line(), text_edit->cursor_get_column());
Point2i prev_match = Point2(-1, -1);
@@ -559,24 +559,14 @@ void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) {
results_count = -1;
text_edit = p_text_edit;
- text_edit->connect_compat("text_changed", this, "_editor_text_changed");
+ text_edit->connect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
}
void FindReplaceBar::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input);
- ClassDB::bind_method("_editor_text_changed", &FindReplaceBar::_editor_text_changed);
- ClassDB::bind_method("_search_text_changed", &FindReplaceBar::_search_text_changed);
- ClassDB::bind_method("_search_text_entered", &FindReplaceBar::_search_text_entered);
- ClassDB::bind_method("_replace_text_entered", &FindReplaceBar::_replace_text_entered);
ClassDB::bind_method("_search_current", &FindReplaceBar::search_current);
- ClassDB::bind_method("_search_next", &FindReplaceBar::search_next);
- ClassDB::bind_method("_search_prev", &FindReplaceBar::search_prev);
- ClassDB::bind_method("_replace_pressed", &FindReplaceBar::_replace);
- ClassDB::bind_method("_replace_all_pressed", &FindReplaceBar::_replace_all);
- ClassDB::bind_method("_search_options_changed", &FindReplaceBar::_search_options_changed);
- ClassDB::bind_method("_hide_pressed", &FindReplaceBar::_hide_bar);
ADD_SIGNAL(MethodInfo("search"));
ADD_SIGNAL(MethodInfo("error"));
@@ -613,8 +603,8 @@ FindReplaceBar::FindReplaceBar() {
search_text = memnew(LineEdit);
vbc_lineedit->add_child(search_text);
search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- search_text->connect_compat("text_changed", this, "_search_text_changed");
- search_text->connect_compat("text_entered", this, "_search_text_entered");
+ search_text->connect("text_changed", callable_mp(this, &FindReplaceBar::_search_text_changed));
+ search_text->connect("text_entered", callable_mp(this, &FindReplaceBar::_search_text_entered));
matches_label = memnew(Label);
hbc_button_search->add_child(matches_label);
@@ -623,51 +613,51 @@ FindReplaceBar::FindReplaceBar() {
find_prev = memnew(ToolButton);
hbc_button_search->add_child(find_prev);
find_prev->set_focus_mode(FOCUS_NONE);
- find_prev->connect_compat("pressed", this, "_search_prev");
+ find_prev->connect("pressed", callable_mp(this, &FindReplaceBar::search_prev));
find_next = memnew(ToolButton);
hbc_button_search->add_child(find_next);
find_next->set_focus_mode(FOCUS_NONE);
- find_next->connect_compat("pressed", this, "_search_next");
+ find_next->connect("pressed", callable_mp(this, &FindReplaceBar::search_next));
case_sensitive = memnew(CheckBox);
hbc_option_search->add_child(case_sensitive);
case_sensitive->set_text(TTR("Match Case"));
case_sensitive->set_focus_mode(FOCUS_NONE);
- case_sensitive->connect_compat("toggled", this, "_search_options_changed");
+ case_sensitive->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
whole_words = memnew(CheckBox);
hbc_option_search->add_child(whole_words);
whole_words->set_text(TTR("Whole Words"));
whole_words->set_focus_mode(FOCUS_NONE);
- whole_words->connect_compat("toggled", this, "_search_options_changed");
+ whole_words->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
// replace toolbar
replace_text = memnew(LineEdit);
vbc_lineedit->add_child(replace_text);
replace_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- replace_text->connect_compat("text_entered", this, "_replace_text_entered");
+ replace_text->connect("text_entered", callable_mp(this, &FindReplaceBar::_replace_text_entered));
replace = memnew(Button);
hbc_button_replace->add_child(replace);
replace->set_text(TTR("Replace"));
- replace->connect_compat("pressed", this, "_replace_pressed");
+ replace->connect("pressed", callable_mp(this, &FindReplaceBar::_replace));
replace_all = memnew(Button);
hbc_button_replace->add_child(replace_all);
replace_all->set_text(TTR("Replace All"));
- replace_all->connect_compat("pressed", this, "_replace_all_pressed");
+ replace_all->connect("pressed", callable_mp(this, &FindReplaceBar::_replace_all));
selection_only = memnew(CheckBox);
hbc_option_replace->add_child(selection_only);
selection_only->set_text(TTR("Selection Only"));
selection_only->set_focus_mode(FOCUS_NONE);
- selection_only->connect_compat("toggled", this, "_search_options_changed");
+ selection_only->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
hide_button = memnew(TextureButton);
add_child(hide_button);
hide_button->set_focus_mode(FOCUS_NONE);
- hide_button->connect_compat("pressed", this, "_hide_pressed");
+ hide_button->connect("pressed", callable_mp(this, &FindReplaceBar::_hide_bar));
hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
}
@@ -1643,18 +1633,6 @@ void CodeTextEditor::remove_all_bookmarks() {
void CodeTextEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input);
- ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
- ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed);
- ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed);
- ClassDB::bind_method("_on_settings_change", &CodeTextEditor::_on_settings_change);
- ClassDB::bind_method("_text_changed_idle_timeout", &CodeTextEditor::_text_changed_idle_timeout);
- ClassDB::bind_method("_code_complete_timer_timeout", &CodeTextEditor::_code_complete_timer_timeout);
- ClassDB::bind_method("_complete_request", &CodeTextEditor::_complete_request);
- ClassDB::bind_method("_font_resize_timeout", &CodeTextEditor::_font_resize_timeout);
- ClassDB::bind_method("_error_pressed", &CodeTextEditor::_error_pressed);
- ClassDB::bind_method("_toggle_scripts_pressed", &CodeTextEditor::_toggle_scripts_pressed);
- ClassDB::bind_method("_warning_button_pressed", &CodeTextEditor::_warning_button_pressed);
- ClassDB::bind_method("_warning_label_gui_input", &CodeTextEditor::_warning_label_gui_input);
ADD_SIGNAL(MethodInfo("validate_script"));
ADD_SIGNAL(MethodInfo("load_theme_settings"));
@@ -1718,7 +1696,7 @@ CodeTextEditor::CodeTextEditor() {
error_column = 0;
toggle_scripts_button = memnew(ToolButton);
- toggle_scripts_button->connect_compat("pressed", this, "_toggle_scripts_pressed");
+ toggle_scripts_button->connect("pressed", callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed));
status_bar->add_child(toggle_scripts_button);
toggle_scripts_button->hide();
@@ -1733,15 +1711,15 @@ CodeTextEditor::CodeTextEditor() {
scroll->add_child(error);
error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error->set_mouse_filter(MOUSE_FILTER_STOP);
- error->connect_compat("gui_input", this, "_error_pressed");
- find_replace_bar->connect_compat("error", error, "set_text");
+ error->connect("gui_input", callable_mp(this, &CodeTextEditor::_error_pressed));
+ find_replace_bar->connect("error", callable_mp(error, &Label::set_text));
// Warnings
warning_button = memnew(ToolButton);
status_bar->add_child(warning_button);
warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
- warning_button->connect_compat("pressed", this, "_warning_button_pressed");
+ warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed));
warning_button->set_tooltip(TTR("Warnings"));
warning_count_label = memnew(Label);
@@ -1753,7 +1731,7 @@ CodeTextEditor::CodeTextEditor() {
warning_count_label->set_tooltip(TTR("Warnings"));
warning_count_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor"));
warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
- warning_count_label->connect_compat("gui_input", this, "_warning_label_gui_input");
+ warning_count_label->connect("gui_input", callable_mp(this, &CodeTextEditor::_warning_label_gui_input));
is_warnings_panel_opened = false;
set_warning_nb(0);
@@ -1766,10 +1744,10 @@ CodeTextEditor::CodeTextEditor() {
line_and_col_txt->set_tooltip(TTR("Line and column numbers."));
line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP);
- text_editor->connect_compat("gui_input", this, "_text_editor_gui_input");
- text_editor->connect_compat("cursor_changed", this, "_line_col_changed");
- text_editor->connect_compat("text_changed", this, "_text_changed");
- text_editor->connect_compat("request_completion", this, "_complete_request");
+ text_editor->connect("gui_input", callable_mp(this, &CodeTextEditor::_text_editor_gui_input));
+ text_editor->connect("cursor_changed", callable_mp(this, &CodeTextEditor::_line_col_changed));
+ text_editor->connect("text_changed", callable_mp(this, &CodeTextEditor::_text_changed));
+ text_editor->connect("request_completion", callable_mp(this, &CodeTextEditor::_complete_request));
Vector<String> cs;
cs.push_back(".");
cs.push_back(",");
@@ -1777,9 +1755,9 @@ CodeTextEditor::CodeTextEditor() {
cs.push_back("=");
cs.push_back("$");
text_editor->set_completion(true, cs);
- idle->connect_compat("timeout", this, "_text_changed_idle_timeout");
+ idle->connect("timeout", callable_mp(this, &CodeTextEditor::_text_changed_idle_timeout));
- code_complete_timer->connect_compat("timeout", this, "_code_complete_timer_timeout");
+ code_complete_timer->connect("timeout", callable_mp(this, &CodeTextEditor::_code_complete_timer_timeout));
font_resize_val = 0;
font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
@@ -1787,7 +1765,7 @@ CodeTextEditor::CodeTextEditor() {
add_child(font_resize_timer);
font_resize_timer->set_one_shot(true);
font_resize_timer->set_wait_time(0.07);
- font_resize_timer->connect_compat("timeout", this, "_font_resize_timeout");
+ font_resize_timer->connect("timeout", callable_mp(this, &CodeTextEditor::_font_resize_timeout));
- EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_on_settings_change");
+ EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &CodeTextEditor::_on_settings_change));
}