Skip to content

Commit 32eafc1

Browse files
committed
Merge pull request #103806 from arkology/find-replace-bar-ui
`FindReplaceBar`: Fix "Replace (All)" buttons repositioning, improve "Hide" button visual feedback
2 parents 2428db2 + 186d687 commit 32eafc1

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

editor/code_editor.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ void FindReplaceBar::_notification(int p_what) {
138138
case NOTIFICATION_READY: {
139139
find_prev->set_button_icon(get_editor_theme_icon(SNAME("MoveUp")));
140140
find_next->set_button_icon(get_editor_theme_icon(SNAME("MoveDown")));
141-
hide_button->set_texture_normal(get_editor_theme_icon(SNAME("Close")));
142-
hide_button->set_texture_hover(get_editor_theme_icon(SNAME("Close")));
143-
hide_button->set_texture_pressed(get_editor_theme_icon(SNAME("Close")));
144-
hide_button->set_custom_minimum_size(hide_button->get_texture_normal()->get_size());
141+
hide_button->set_button_icon(get_editor_theme_icon(SNAME("Close")));
145142
_update_toggle_replace_button(replace_text->is_visible_in_tree());
146143
} break;
147144

@@ -759,7 +756,7 @@ FindReplaceBar::FindReplaceBar() {
759756
toggle_replace_button->set_focus_mode(FOCUS_NONE);
760757
toggle_replace_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_toggle_replace_pressed));
761758

762-
vbc_lineedit = memnew(VBoxContainer);
759+
VBoxContainer *vbc_lineedit = memnew(VBoxContainer);
763760
add_child(vbc_lineedit);
764761
vbc_lineedit->set_alignment(BoxContainer::ALIGNMENT_CENTER);
765762
vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -769,18 +766,20 @@ FindReplaceBar::FindReplaceBar() {
769766
add_child(vbc_option);
770767

771768
HBoxContainer *hbc_button_search = memnew(HBoxContainer);
772-
vbc_button->add_child(hbc_button_search);
769+
hbc_button_search->set_v_size_flags(SIZE_EXPAND_FILL);
773770
hbc_button_search->set_alignment(BoxContainer::ALIGNMENT_END);
771+
vbc_button->add_child(hbc_button_search);
774772
hbc_button_replace = memnew(HBoxContainer);
775-
vbc_button->add_child(hbc_button_replace);
773+
hbc_button_replace->set_v_size_flags(SIZE_EXPAND_FILL);
776774
hbc_button_replace->set_alignment(BoxContainer::ALIGNMENT_END);
775+
vbc_button->add_child(hbc_button_replace);
777776

778777
HBoxContainer *hbc_option_search = memnew(HBoxContainer);
779778
vbc_option->add_child(hbc_option_search);
780779
hbc_option_replace = memnew(HBoxContainer);
781780
vbc_option->add_child(hbc_option_replace);
782781

783-
// Search toolbar
782+
// Search toolbar.
784783
search_text = memnew(LineEdit);
785784
search_text->set_keep_editing_on_text_submit(true);
786785
vbc_lineedit->add_child(search_text);
@@ -824,7 +823,7 @@ FindReplaceBar::FindReplaceBar() {
824823
whole_words->set_focus_mode(FOCUS_NONE);
825824
whole_words->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
826825

827-
// Replace toolbar
826+
// Replace toolbar.
828827
replace_text = memnew(LineEdit);
829828
vbc_lineedit->add_child(replace_text);
830829
replace_text->set_placeholder(TTR("Replace"));
@@ -849,13 +848,14 @@ FindReplaceBar::FindReplaceBar() {
849848
selection_only->set_focus_mode(FOCUS_NONE);
850849
selection_only->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
851850

852-
hide_button = memnew(TextureButton);
853-
add_child(hide_button);
851+
hide_button = memnew(Button);
852+
hide_button->set_flat(true);
854853
hide_button->set_tooltip_text(TTR("Hide"));
855854
hide_button->set_accessibility_name(TTRC("Hide"));
856855
hide_button->set_focus_mode(FOCUS_NONE);
857856
hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar));
858857
hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
858+
add_child(hide_button);
859859
}
860860

861861
/*** CODE EDITOR ****/

editor/code_editor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,13 @@ class FindReplaceBar : public HBoxContainer {
7979
Button *find_next = nullptr;
8080
CheckBox *case_sensitive = nullptr;
8181
CheckBox *whole_words = nullptr;
82-
TextureButton *hide_button = nullptr;
82+
Button *hide_button = nullptr;
8383

8484
LineEdit *replace_text = nullptr;
8585
Button *replace = nullptr;
8686
Button *replace_all = nullptr;
8787
CheckBox *selection_only = nullptr;
8888

89-
VBoxContainer *vbc_lineedit = nullptr;
9089
HBoxContainer *hbc_button_replace = nullptr;
9190
HBoxContainer *hbc_option_replace = nullptr;
9291

0 commit comments

Comments
 (0)