Repository: godotengine/godot
File: editor/action_map_editor.cpp (C++)

Code before:
	// Disable the button and set its tooltip.
	_add_edit_text_changed(add_edit->get_text());

	show_builtin_actions_checkbutton = memnew(CheckButton);
	show_builtin_actions_checkbutton->set_pressed(false);
	show_builtin_actions_checkbutton->set_text(TTR("Show Built-in Actions"));
	show_builtin_actions_checkbutton->connect("toggled", callable_mp(this, &ActionMapEditor::set_show_builtin_actions));
	add_hbox->add_child(show_builtin_actions_checkbutton);

	main_vbox->add_child(add_hbox);

	// Action Editor Tree
	action_tree = memnew(Tree);
	action_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	action_tree->set_columns(3);
	action_tree->set_hide_root(true);
	action_tree->set_column_titles_visible(true);
	action_tree->set_column_title(0, TTR("Action"));
	action_tree->set_column_clip_content(0, true);
	action_tree->set_column_title(1, TTR("Deadzone"));
	action_tree->set_column_expand(1, false);
	action_tree->set_column_custom_minimum_width(1, 80 * EDSCALE);
	action_tree->set_column_expand(2, false);
	action_tree->set_column_custom_minimum_width(2, 50 * EDSCALE);
	action_tree->connect("item_edited", callable_mp(this, &ActionMapEditor::_action_edited));
	action_tree->connect("item_activated", callable_mp(this, &ActionMapEditor::_tree_item_activated));
	action_tree->connect("button_clicked", callable_mp(this, &ActionMapEditor::_tree_button_pressed));
	main_vbox->add_child(action_tree);

	action_tree->set_drag_forwarding_compat(this);

	// Adding event dialog
	event_config_dialog = memnew(InputEventConfigurationDialog);
	event_config_dialog->connect("confirmed", callable_mp(this, &ActionMapEditor::_event_config_confirmed));
	add_child(event_config_dialog);

	message = memnew(AcceptDialog);
	add_child(message);
}


Review comment (suggestion):
If the syntax is always like this, maybe we could have a macro that sets up all this at once?
`SETUP_DRAG_FW(action_tree, ActionMapEditor);`

Code after:
	show_builtin_actions_checkbutton->set_pressed(false);
	show_builtin_actions_checkbutton->set_text(TTR("Show Built-in Actions"));
	show_builtin_actions_checkbutton->connect("toggled", callable_mp(this, &ActionMapEditor::set_show_builtin_actions));
	add_hbox->add_child(show_builtin_actions_checkbutton);

	main_vbox->add_child(add_hbox);

	// Action Editor Tree
	action_tree = memnew(Tree);
	action_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	action_tree->set_columns(3);
	action_tree->set_hide_root(true);
	action_tree->set_column_titles_visible(true);
	action_tree->set_column_title(0, TTR("Action"));
	action_tree->set_column_clip_content(0, true);
	action_tree->set_column_title(1, TTR("Deadzone"));
	action_tree->set_column_expand(1, false);
	action_tree->set_column_custom_minimum_width(1, 80 * EDSCALE);
	action_tree->set_column_expand(2, false);
	action_tree->set_column_custom_minimum_width(2, 50 * EDSCALE);
	action_tree->connect("item_edited", callable_mp(this, &ActionMapEditor::_action_edited));
	action_tree->connect("item_activated", callable_mp(this, &ActionMapEditor::_tree_item_activated));
	action_tree->connect("button_clicked", callable_mp(this, &ActionMapEditor::_tree_button_pressed));
	main_vbox->add_child(action_tree);

	SET_DRAG_FORWARDING_GCD(action_tree, ActionMapEditor);

	// Adding event dialog
	event_config_dialog = memnew(InputEventConfigurationDialog);
	event_config_dialog->connect("confirmed", callable_mp(this, &ActionMapEditor::_event_config_confirmed));
	add_child(event_config_dialog);

	message = memnew(AcceptDialog);
	add_child(message);
}