diff options
Diffstat (limited to 'editor/groups_editor.cpp')
-rw-r--r-- | editor/groups_editor.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 98b216acda..f2a110ca03 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -198,7 +198,7 @@ void GroupDialog::_add_group(String p_name) { } String name = p_name.strip_edges(); - if (name.empty() || groups->get_item_with_text(name)) { + if (name.is_empty() || groups->get_item_with_text(name)) { return; } @@ -361,9 +361,16 @@ void GroupDialog::_delete_group_item(const String &p_name) { void GroupDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_TRANSLATION_CHANGED: + case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_ENTER_TREE: { - add_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons")); - remove_button->set_icon(groups->get_theme_icon("Back", "EditorIcons")); + if (is_layout_rtl()) { + add_button->set_icon(groups->get_theme_icon("Back", "EditorIcons")); + remove_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons")); + } else { + add_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons")); + remove_button->set_icon(groups->get_theme_icon("Back", "EditorIcons")); + } add_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons")); add_filter->set_clear_button_enabled(true); @@ -406,7 +413,7 @@ GroupDialog::GroupDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); - vbc->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); + vbc->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_child(hbc); @@ -477,7 +484,8 @@ GroupDialog::GroupDialog() { vbc_buttons->set_h_size_flags(Control::SIZE_SHRINK_CENTER); vbc_buttons->set_v_size_flags(Control::SIZE_SHRINK_CENTER); - add_button = memnew(ToolButton); + add_button = memnew(Button); + add_button->set_flat(true); add_button->set_text(TTR("Add")); add_button->connect("pressed", callable_mp(this, &GroupDialog::_add_pressed)); @@ -486,7 +494,8 @@ GroupDialog::GroupDialog() { vbc_buttons->add_spacer(); vbc_buttons->add_spacer(); - remove_button = memnew(ToolButton); + remove_button = memnew(Button); + remove_button->set_flat(true); remove_button->set_text(TTR("Remove")); remove_button->connect("pressed", callable_mp(this, &GroupDialog::_removed_pressed)); @@ -525,13 +534,13 @@ GroupDialog::GroupDialog() { group_empty->set_autowrap(true); group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); nodes_to_remove->add_child(group_empty); - group_empty->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); + group_empty->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); set_title(TTR("Group Editor")); error = memnew(ConfirmationDialog); add_child(error); - error->get_ok()->set_text(TTR("Close")); + error->get_ok_button()->set_text(TTR("Close")); } //////////////////////////////////////////////////////////////////////////////// @@ -542,7 +551,7 @@ void GroupsEditor::_add_group(const String &p_group) { } const String name = group_name->get_text().strip_edges(); - if (name.empty()) { + if (name.is_empty()) { return; } |