You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #103806 from arkology/find-replace-bar-ui
`FindReplaceBar`: Fix "Replace (All)" buttons repositioning, improve "Hide" button visual feedback
This commit is contained in:
@@ -138,10 +138,7 @@ void FindReplaceBar::_notification(int p_what) {
|
|||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
find_prev->set_button_icon(get_editor_theme_icon(SNAME("MoveUp")));
|
find_prev->set_button_icon(get_editor_theme_icon(SNAME("MoveUp")));
|
||||||
find_next->set_button_icon(get_editor_theme_icon(SNAME("MoveDown")));
|
find_next->set_button_icon(get_editor_theme_icon(SNAME("MoveDown")));
|
||||||
hide_button->set_texture_normal(get_editor_theme_icon(SNAME("Close")));
|
hide_button->set_button_icon(get_editor_theme_icon(SNAME("Close")));
|
||||||
hide_button->set_texture_hover(get_editor_theme_icon(SNAME("Close")));
|
|
||||||
hide_button->set_texture_pressed(get_editor_theme_icon(SNAME("Close")));
|
|
||||||
hide_button->set_custom_minimum_size(hide_button->get_texture_normal()->get_size());
|
|
||||||
_update_toggle_replace_button(replace_text->is_visible_in_tree());
|
_update_toggle_replace_button(replace_text->is_visible_in_tree());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@@ -759,7 +756,7 @@ FindReplaceBar::FindReplaceBar() {
|
|||||||
toggle_replace_button->set_focus_mode(FOCUS_NONE);
|
toggle_replace_button->set_focus_mode(FOCUS_NONE);
|
||||||
toggle_replace_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_toggle_replace_pressed));
|
toggle_replace_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_toggle_replace_pressed));
|
||||||
|
|
||||||
vbc_lineedit = memnew(VBoxContainer);
|
VBoxContainer *vbc_lineedit = memnew(VBoxContainer);
|
||||||
add_child(vbc_lineedit);
|
add_child(vbc_lineedit);
|
||||||
vbc_lineedit->set_alignment(BoxContainer::ALIGNMENT_CENTER);
|
vbc_lineedit->set_alignment(BoxContainer::ALIGNMENT_CENTER);
|
||||||
vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL);
|
vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
@@ -769,18 +766,20 @@ FindReplaceBar::FindReplaceBar() {
|
|||||||
add_child(vbc_option);
|
add_child(vbc_option);
|
||||||
|
|
||||||
HBoxContainer *hbc_button_search = memnew(HBoxContainer);
|
HBoxContainer *hbc_button_search = memnew(HBoxContainer);
|
||||||
vbc_button->add_child(hbc_button_search);
|
hbc_button_search->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
hbc_button_search->set_alignment(BoxContainer::ALIGNMENT_END);
|
hbc_button_search->set_alignment(BoxContainer::ALIGNMENT_END);
|
||||||
|
vbc_button->add_child(hbc_button_search);
|
||||||
hbc_button_replace = memnew(HBoxContainer);
|
hbc_button_replace = memnew(HBoxContainer);
|
||||||
vbc_button->add_child(hbc_button_replace);
|
hbc_button_replace->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
hbc_button_replace->set_alignment(BoxContainer::ALIGNMENT_END);
|
hbc_button_replace->set_alignment(BoxContainer::ALIGNMENT_END);
|
||||||
|
vbc_button->add_child(hbc_button_replace);
|
||||||
|
|
||||||
HBoxContainer *hbc_option_search = memnew(HBoxContainer);
|
HBoxContainer *hbc_option_search = memnew(HBoxContainer);
|
||||||
vbc_option->add_child(hbc_option_search);
|
vbc_option->add_child(hbc_option_search);
|
||||||
hbc_option_replace = memnew(HBoxContainer);
|
hbc_option_replace = memnew(HBoxContainer);
|
||||||
vbc_option->add_child(hbc_option_replace);
|
vbc_option->add_child(hbc_option_replace);
|
||||||
|
|
||||||
// Search toolbar
|
// Search toolbar.
|
||||||
search_text = memnew(LineEdit);
|
search_text = memnew(LineEdit);
|
||||||
search_text->set_keep_editing_on_text_submit(true);
|
search_text->set_keep_editing_on_text_submit(true);
|
||||||
vbc_lineedit->add_child(search_text);
|
vbc_lineedit->add_child(search_text);
|
||||||
@@ -824,7 +823,7 @@ FindReplaceBar::FindReplaceBar() {
|
|||||||
whole_words->set_focus_mode(FOCUS_NONE);
|
whole_words->set_focus_mode(FOCUS_NONE);
|
||||||
whole_words->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
|
whole_words->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
|
||||||
|
|
||||||
// Replace toolbar
|
// Replace toolbar.
|
||||||
replace_text = memnew(LineEdit);
|
replace_text = memnew(LineEdit);
|
||||||
vbc_lineedit->add_child(replace_text);
|
vbc_lineedit->add_child(replace_text);
|
||||||
replace_text->set_placeholder(TTR("Replace"));
|
replace_text->set_placeholder(TTR("Replace"));
|
||||||
@@ -849,13 +848,14 @@ FindReplaceBar::FindReplaceBar() {
|
|||||||
selection_only->set_focus_mode(FOCUS_NONE);
|
selection_only->set_focus_mode(FOCUS_NONE);
|
||||||
selection_only->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
|
selection_only->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
|
||||||
|
|
||||||
hide_button = memnew(TextureButton);
|
hide_button = memnew(Button);
|
||||||
add_child(hide_button);
|
hide_button->set_flat(true);
|
||||||
hide_button->set_tooltip_text(TTR("Hide"));
|
hide_button->set_tooltip_text(TTR("Hide"));
|
||||||
hide_button->set_accessibility_name(TTRC("Hide"));
|
hide_button->set_accessibility_name(TTRC("Hide"));
|
||||||
hide_button->set_focus_mode(FOCUS_NONE);
|
hide_button->set_focus_mode(FOCUS_NONE);
|
||||||
hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar));
|
hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar));
|
||||||
hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
|
hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||||
|
add_child(hide_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** CODE EDITOR ****/
|
/*** CODE EDITOR ****/
|
||||||
|
|||||||
@@ -79,14 +79,13 @@ class FindReplaceBar : public HBoxContainer {
|
|||||||
Button *find_next = nullptr;
|
Button *find_next = nullptr;
|
||||||
CheckBox *case_sensitive = nullptr;
|
CheckBox *case_sensitive = nullptr;
|
||||||
CheckBox *whole_words = nullptr;
|
CheckBox *whole_words = nullptr;
|
||||||
TextureButton *hide_button = nullptr;
|
Button *hide_button = nullptr;
|
||||||
|
|
||||||
LineEdit *replace_text = nullptr;
|
LineEdit *replace_text = nullptr;
|
||||||
Button *replace = nullptr;
|
Button *replace = nullptr;
|
||||||
Button *replace_all = nullptr;
|
Button *replace_all = nullptr;
|
||||||
CheckBox *selection_only = nullptr;
|
CheckBox *selection_only = nullptr;
|
||||||
|
|
||||||
VBoxContainer *vbc_lineedit = nullptr;
|
|
||||||
HBoxContainer *hbc_button_replace = nullptr;
|
HBoxContainer *hbc_button_replace = nullptr;
|
||||||
HBoxContainer *hbc_option_replace = nullptr;
|
HBoxContainer *hbc_option_replace = nullptr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user