diff options
Diffstat (limited to 'scene/gui')
| -rw-r--r-- | scene/gui/base_button.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/graph_edit.cpp | 12 | ||||
| -rw-r--r-- | scene/gui/graph_edit_arranger.cpp | 28 | ||||
| -rw-r--r-- | scene/gui/graph_node.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/menu_bar.cpp | 5 | ||||
| -rw-r--r-- | scene/gui/popup_menu.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 29 | ||||
| -rw-r--r-- | scene/gui/tab_bar.cpp | 34 | ||||
| -rw-r--r-- | scene/gui/tab_container.cpp | 26 | ||||
| -rw-r--r-- | scene/gui/tab_container.h | 2 | ||||
| -rw-r--r-- | scene/gui/text_edit.cpp | 8 | ||||
| -rw-r--r-- | scene/gui/tree.cpp | 2 |
13 files changed, 113 insertions, 43 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index f57afb66b3..66b14dc967 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -380,7 +380,7 @@ void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) { queue_redraw(); accept_event(); - if (shortcut_feedback) { + if (shortcut_feedback && is_inside_tree()) { if (shortcut_feedback_timer == nullptr) { shortcut_feedback_timer = memnew(Timer); shortcut_feedback_timer->set_one_shot(true); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 1fc501e980..8dddbf78cf 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -598,7 +598,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) { // Determine slot height. int slot_index = graph_node->get_input_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); @@ -612,7 +612,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) { // Determine slot height. int slot_index = graph_node->get_output_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); if (is_in_output_hotzone(graph_node, j, p_point / zoom, port_size)) { @@ -643,7 +643,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { // Determine slot height. int slot_index = graph_node->get_output_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); if (is_in_output_hotzone(graph_node, j, click_pos, port_size)) { @@ -700,7 +700,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { // Determine slot height. int slot_index = graph_node->get_input_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); if (is_in_input_hotzone(graph_node, j, click_pos, port_size)) { @@ -777,7 +777,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { // Determine slot height. int slot_index = graph_node->get_output_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); int type = graph_node->get_output_port_type(j); @@ -801,7 +801,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { // Determine slot height. int slot_index = graph_node->get_input_port_slot(j); - Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index)); + Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false)); port_size.height = MAX(port_size.height, child ? child->get_size().y : 0); int type = graph_node->get_input_port_type(j); diff --git a/scene/gui/graph_edit_arranger.cpp b/scene/gui/graph_edit_arranger.cpp index 1dc778254b..3f2007f7e0 100644 --- a/scene/gui/graph_edit_arranger.cpp +++ b/scene/gui/graph_edit_arranger.cpp @@ -65,6 +65,9 @@ void GraphEditArranger::arrange_nodes() { float gap_v = 100.0f; float gap_h = 100.0f; + List<GraphEdit::Connection> connection_list; + graph_edit->get_connection_list(&connection_list); + for (int i = graph_edit->get_child_count() - 1; i >= 0; i--) { GraphNode *graph_element = Object::cast_to<GraphNode>(graph_edit->get_child(i)); if (!graph_element) { @@ -74,8 +77,6 @@ void GraphEditArranger::arrange_nodes() { if (graph_element->is_selected() || arrange_entire_graph) { selected_nodes.insert(graph_element->get_name()); HashSet<StringName> s; - List<GraphEdit::Connection> connection_list; - graph_edit->get_connection_list(&connection_list); for (List<GraphEdit::Connection>::Element *E = connection_list.front(); E; E = E->next()) { GraphNode *p_from = Object::cast_to<GraphNode>(node_names[E->get().from_node]); if (E->get().to_node == graph_element->get_name() && (p_from->is_selected() || arrange_entire_graph) && E->get().to_node != E->get().from_node) { @@ -85,12 +86,6 @@ void GraphEditArranger::arrange_nodes() { String s_connection = String(p_from->get_name()) + " " + String(E->get().to_node); StringName _connection(s_connection); Pair<int, int> ports(E->get().from_port, E->get().to_port); - if (port_info.has(_connection)) { - Pair<int, int> p_ports = port_info[_connection]; - if (p_ports.first < ports.first) { - ports = p_ports; - } - } port_info.insert(_connection, ports); } } @@ -216,13 +211,14 @@ int GraphEditArranger::_set_operations(SET_OPERATIONS p_operation, HashSet<Strin return 1; } break; case GraphEditArranger::DIFFERENCE: { - for (HashSet<StringName>::Iterator E = r_u.begin(); E;) { - HashSet<StringName>::Iterator N = E; - ++N; - if (r_v.has(*E)) { - r_u.remove(E); + Vector<StringName> common; + for (const StringName &E : r_u) { + if (r_v.has(E)) { + common.append(E); } - E = N; + } + for (const StringName &E : common) { + r_u.erase(E); } return r_u.size(); } break; @@ -260,9 +256,7 @@ HashMap<int, Vector<StringName>> GraphEditArranger::_layering(const HashSet<Stri selected = true; t.append_array(l[current_layer]); l.insert(current_layer, t); - HashSet<StringName> V; - V.insert(E); - _set_operations(GraphEditArranger::UNION, u, V); + u.insert(E); } } if (!selected) { diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index fdebca3d28..3b1c1a153f 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -620,7 +620,7 @@ void GraphNode::_port_pos_update() { port_cache.pos = Point2i(edgeofs, vertical_ofs + size.height / 2); port_cache.type = slot_table[i].type_left; port_cache.color = slot_table[i].color_left; - port_cache.slot_index = child->get_index(); // Index with internal nodes included. + port_cache.slot_index = child->get_index(false); left_port_cache.push_back(port_cache); } if (slot_table[i].enable_right) { @@ -628,7 +628,7 @@ void GraphNode::_port_pos_update() { port_cache.pos = Point2i(get_size().width - edgeofs, vertical_ofs + size.height / 2); port_cache.type = slot_table[i].type_right; port_cache.color = slot_table[i].color_right; - port_cache.slot_index = child->get_index(); // Index with internal nodes included. + port_cache.slot_index = child->get_index(false); right_port_cache.push_back(port_cache); } } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 12ffafadf7..5ed1a9d5e3 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2643,7 +2643,7 @@ void LineEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selecting_enabled"), "set_selecting_enabled", "is_selecting_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_and_drop_selection_enabled"), "set_drag_and_drop_selection_enabled", "is_drag_and_drop_selection_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "right_icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_right_icon", "get_right_icon"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "right_icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_right_icon", "get_right_icon"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_control_chars"), "set_draw_control_chars", "get_draw_control_chars"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "select_all_on_focus"), "set_select_all_on_focus", "is_select_all_on_focus"); diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp index 371d6c69af..7418ba7333 100644 --- a/scene/gui/menu_bar.cpp +++ b/scene/gui/menu_bar.cpp @@ -561,6 +561,7 @@ void MenuBar::add_child_notify(Node *p_child) { int index = DisplayServer::get_singleton()->global_menu_add_submenu_item("_main", atr(menu.name), submenu_name, _find_global_start_index() + menu_cache.size() - 1); DisplayServer::get_singleton()->global_menu_set_item_tag("_main", index, global_menu_name + "#" + itos(menu_cache.size() - 1)); } + update_minimum_size(); } void MenuBar::move_child_notify(Node *p_child) { @@ -621,6 +622,8 @@ void MenuBar::remove_child_notify(Node *p_child) { p_child->disconnect("renamed", callable_mp(this, &MenuBar::_refresh_menu_names)); p_child->disconnect("about_to_popup", callable_mp(this, &MenuBar::_popup_visibility_changed)); p_child->disconnect("popup_hide", callable_mp(this, &MenuBar::_popup_visibility_changed)); + + update_minimum_size(); } void MenuBar::_bind_methods() { @@ -808,6 +811,7 @@ void MenuBar::set_menu_title(int p_menu, const String &p_title) { if (!global_menu_name.is_empty()) { DisplayServer::get_singleton()->global_menu_set_item_text("_main", _find_global_start_index() + p_menu, atr(menu_cache[p_menu].name)); } + update_minimum_size(); } String MenuBar::get_menu_title(int p_menu) const { @@ -849,6 +853,7 @@ void MenuBar::set_menu_hidden(int p_menu, bool p_hidden) { if (!global_menu_name.is_empty()) { DisplayServer::get_singleton()->global_menu_set_item_hidden("_main", _find_global_start_index() + p_menu, p_hidden); } + update_minimum_size(); } bool MenuBar::is_menu_hidden(int p_menu) const { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index dfaf7d88b7..0cda27ec24 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1487,6 +1487,7 @@ void PopupMenu::add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, cons } void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_id) { + ERR_FAIL_COND_MSG(p_submenu.validate_node_name() != p_submenu, "Invalid node name for submenu, the following characters are not allowed:\n" + String::get_invalid_node_name_characters()); Item item; item.text = p_label; item.xl_text = atr(p_label); @@ -2186,6 +2187,7 @@ void PopupMenu::scroll_to_item(int p_idx) { } bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_for_global_only) { + ERR_FAIL_COND_V(p_event.is_null(), false); Key code = Key::NONE; Ref<InputEventKey> k = p_event; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 7768c2d84e..31ed5984a4 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -307,7 +307,7 @@ float RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font Size2 img_size = img->size; if (img->size_in_percent) { img_size = _get_image_size(img->image, p_width * img->rq_size.width / 100.f, p_width * img->rq_size.height / 100.f, img->region); - l.text_buf->resize_object((uint64_t)it, img_size, img->inline_align, 1); + l.text_buf->resize_object((uint64_t)it, img_size, img->inline_align); } } break; case ITEM_TABLE: { @@ -1219,7 +1219,14 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o Item *it = _get_item_at_pos(it_from, it_to, glyphs[i].start); Color font_color = _find_color(it, p_base_color); if (_find_underline(it) || (_find_meta(it, nullptr) && underline_meta)) { - if (!ul_started) { + if (ul_started && font_color != ul_color) { + float y_off = TS->shaped_text_get_underline_position(rid); + float underline_width = MAX(1.0, TS->shaped_text_get_underline_thickness(rid) * theme_cache.base_scale); + draw_line(ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), ul_color, underline_width); + ul_start = p_ofs + Vector2(off.x, off.y); + ul_color = font_color; + ul_color.a *= 0.5; + } else if (!ul_started) { ul_started = true; ul_start = p_ofs + Vector2(off.x, off.y); ul_color = font_color; @@ -1232,7 +1239,14 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o draw_line(ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), ul_color, underline_width); } if (_find_hint(it, nullptr) && underline_hint) { - if (!dot_ul_started) { + if (dot_ul_started && font_color != dot_ul_color) { + float y_off = TS->shaped_text_get_underline_position(rid); + float underline_width = MAX(1.0, TS->shaped_text_get_underline_thickness(rid) * theme_cache.base_scale); + draw_dashed_line(dot_ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), dot_ul_color, underline_width, MAX(2.0, underline_width * 2)); + dot_ul_start = p_ofs + Vector2(off.x, off.y); + dot_ul_color = font_color; + dot_ul_color.a *= 0.5; + } else if (!dot_ul_started) { dot_ul_started = true; dot_ul_start = p_ofs + Vector2(off.x, off.y); dot_ul_color = font_color; @@ -1245,7 +1259,14 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o draw_dashed_line(dot_ul_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), dot_ul_color, underline_width, MAX(2.0, underline_width * 2)); } if (_find_strikethrough(it)) { - if (!st_started) { + if (st_started && font_color != st_color) { + float y_off = -TS->shaped_text_get_ascent(rid) + TS->shaped_text_get_size(rid).y / 2; + float underline_width = MAX(1.0, TS->shaped_text_get_underline_thickness(rid) * theme_cache.base_scale); + draw_line(st_start + Vector2(0, y_off), p_ofs + Vector2(off.x, off.y + y_off), st_color, underline_width); + st_start = p_ofs + Vector2(off.x, off.y); + st_color = font_color; + st_color.a *= 0.5; + } else if (!st_started) { st_started = true; st_start = p_ofs + Vector2(off.x, off.y); st_color = font_color; diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index 29e6d3d10d..777ca96cc4 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -334,6 +334,12 @@ void TabBar::_shape(int p_tab) { void TabBar::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + if (scroll_to_selected) { + ensure_tab_visible(current); + } + } break; + case NOTIFICATION_INTERNAL_PROCESS: { Input *input = Input::get_singleton(); @@ -669,7 +675,7 @@ bool TabBar::select_previous_available() { if (target_tab < 0) { target_tab += get_tab_count(); } - if (!is_tab_disabled(target_tab)) { + if (!is_tab_disabled(target_tab) && !is_tab_hidden(target_tab)) { set_current_tab(target_tab); return true; } @@ -681,7 +687,7 @@ bool TabBar::select_next_available() { const int offset_end = (get_tab_count() - get_current_tab()); for (int i = 1; i < offset_end; i++) { int target_tab = (get_current_tab() + i) % get_tab_count(); - if (!is_tab_disabled(target_tab)) { + if (!is_tab_disabled(target_tab) && !is_tab_hidden(target_tab)) { set_current_tab(target_tab); return true; } @@ -1094,6 +1100,23 @@ void TabBar::remove_tab(int p_idx) { max_drawn_tab = 0; previous = 0; } else { + // Try to change to a valid tab if possible (without firing the `tab_selected` signal). + for (int i = current; i < tabs.size(); i++) { + if (!is_tab_disabled(i) && !is_tab_hidden(i)) { + current = i; + break; + } + } + // If nothing, try backwards. + if (is_tab_disabled(current) || is_tab_hidden(current)) { + for (int i = current - 1; i >= 0; i--) { + if (!is_tab_disabled(i) && !is_tab_hidden(i)) { + current = i; + break; + } + } + } + offset = MIN(offset, tabs.size() - 1); max_drawn_tab = MIN(max_drawn_tab, tabs.size() - 1); @@ -1745,7 +1768,10 @@ void TabBar::_bind_methods() { ADD_SIGNAL(MethodInfo("tab_hovered", PropertyInfo(Variant::INT, "tab"))); ADD_SIGNAL(MethodInfo("active_tab_rearranged", PropertyInfo(Variant::INT, "idx_to"))); - ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); + // "current_tab" property must come after "tab_count", otherwise the property isn't loaded correctly. + ADD_ARRAY_COUNT("Tabs", "tab_count", "set_tab_count", "get_tab_count", "tab_"); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1"), "set_current_tab", "get_current_tab"); ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_alignment", "get_tab_alignment"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_tabs"), "set_clip_tabs", "get_clip_tabs"); ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy"); @@ -1756,8 +1782,6 @@ void TabBar::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_to_selected"), "set_scroll_to_selected", "get_scroll_to_selected"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "select_with_rmb"), "set_select_with_rmb", "get_select_with_rmb"); - ADD_ARRAY_COUNT("Tabs", "tab_count", "set_tab_count", "get_tab_count", "tab_"); - BIND_ENUM_CONSTANT(ALIGNMENT_LEFT); BIND_ENUM_CONSTANT(ALIGNMENT_CENTER); BIND_ENUM_CONSTANT(ALIGNMENT_RIGHT); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index c21a9d14cb..aa9400847f 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -143,6 +143,13 @@ void TabContainer::_notification(int p_what) { } } break; + case NOTIFICATION_POST_ENTER_TREE: { + if (setup_current_tab >= 0) { + set_current_tab(setup_current_tab); + setup_current_tab = -1; + } + } break; + case NOTIFICATION_READY: case NOTIFICATION_RESIZED: { _update_margins(); @@ -330,14 +337,23 @@ Vector<Control *> TabContainer::_get_tab_controls() const { } Variant TabContainer::_get_drag_data_fw(const Point2 &p_point, Control *p_from_control) { + if (!drag_to_rearrange_enabled) { + return Variant(); + } return tab_bar->_handle_get_drag_data("tab_container_tab", p_point); } bool TabContainer::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) const { + if (!drag_to_rearrange_enabled) { + return false; + } return tab_bar->_handle_can_drop_data("tab_container_tab", p_point, p_data); } void TabContainer::_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) { + if (!drag_to_rearrange_enabled) { + return; + } return tab_bar->_handle_drop_data("tab_container_tab", p_point, p_data, callable_mp(this, &TabContainer::_drag_move_tab), callable_mp(this, &TabContainer::_drag_move_tab_from)); } @@ -519,6 +535,10 @@ int TabContainer::get_tab_count() const { } void TabContainer::set_current_tab(int p_current) { + if (!is_inside_tree()) { + setup_current_tab = p_current; + return; + } tab_bar->set_current_tab(p_current); } @@ -815,11 +835,11 @@ Popup *TabContainer::get_popup() const { } void TabContainer::set_drag_to_rearrange_enabled(bool p_enabled) { - tab_bar->set_drag_to_rearrange_enabled(p_enabled); + drag_to_rearrange_enabled = p_enabled; } bool TabContainer::get_drag_to_rearrange_enabled() const { - return tab_bar->get_drag_to_rearrange_enabled(); + return drag_to_rearrange_enabled; } void TabContainer::set_tabs_rearrange_group(int p_group_id) { @@ -903,7 +923,7 @@ void TabContainer::_bind_methods() { ADD_SIGNAL(MethodInfo("pre_popup_pressed")); ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_alignment", "get_tab_alignment"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1"), "set_current_tab", "get_current_tab"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_tabs"), "set_clip_tabs", "get_clip_tabs"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "all_tabs_in_front"), "set_all_tabs_in_front", "is_all_tabs_in_front"); diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index 5750c6b82e..450143cd0c 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -46,6 +46,8 @@ class TabContainer : public Container { bool use_hidden_tabs_for_min_size = false; bool theme_changing = false; Vector<Control *> children_removing; + bool drag_to_rearrange_enabled = false; + int setup_current_tab = -1; struct ThemeCache { int side_margin = 0; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 479480011c..86e726d9da 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2948,6 +2948,8 @@ void TextEdit::_update_placeholder() { return; // Not in tree? } + const String placeholder_translated = atr(placeholder_text); + // Placeholder is generally smaller then text documents, and updates less so this should be fast enough for now. placeholder_data_buf->clear(); placeholder_data_buf->set_width(text.get_width()); @@ -2958,9 +2960,9 @@ void TextEdit::_update_placeholder() { placeholder_data_buf->set_direction((TextServer::Direction)text_direction); } placeholder_data_buf->set_preserve_control(draw_control_chars); - placeholder_data_buf->add_string(placeholder_text, theme_cache.font, theme_cache.font_size, language); + placeholder_data_buf->add_string(placeholder_translated, theme_cache.font, theme_cache.font_size, language); - placeholder_bidi_override = structured_text_parser(st_parser, st_args, placeholder_text); + placeholder_bidi_override = structured_text_parser(st_parser, st_args, placeholder_translated); if (placeholder_bidi_override.is_empty()) { TS->shaped_text_set_bidi_override(placeholder_data_buf->get_rid(), placeholder_bidi_override); } @@ -2985,7 +2987,7 @@ void TextEdit::_update_placeholder() { placeholder_wraped_rows.clear(); for (int i = 0; i <= wrap_amount; i++) { Vector2i line_range = placeholder_data_buf->get_line_range(i); - placeholder_wraped_rows.push_back(placeholder_text.substr(line_range.x, line_range.y - line_range.x)); + placeholder_wraped_rows.push_back(placeholder_translated.substr(line_range.x, line_range.y - line_range.x)); } } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 2d3166270b..a4c239cf53 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2050,7 +2050,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 int text_width = item_width - theme_cache.inner_item_margin_left - theme_cache.inner_item_margin_right; if (p_item->cells[i].icon.is_valid()) { - text_width -= p_item->cells[i].get_icon_size().x + theme_cache.h_separation; + text_width -= _get_cell_icon_size(p_item->cells[i]).x + theme_cache.h_separation; } p_item->cells.write[i].text_buf->set_width(text_width); |
