summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/button.cpp2
-rw-r--r--scene/gui/check_button.cpp2
-rw-r--r--scene/gui/color_picker.cpp6
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/control.cpp19
-rw-r--r--scene/gui/control.h6
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/file_dialog.cpp4
-rw-r--r--scene/gui/file_dialog.h2
-rw-r--r--scene/gui/gradient_edit.cpp66
-rw-r--r--scene/gui/gradient_edit.h2
-rw-r--r--scene/gui/graph_edit.cpp8
-rw-r--r--scene/gui/graph_node.cpp3
-rw-r--r--scene/gui/item_list.cpp4
-rw-r--r--scene/gui/label.cpp6
-rw-r--r--scene/gui/line_edit.cpp10
-rw-r--r--scene/gui/menu_button.cpp2
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/popup.cpp55
-rw-r--r--scene/gui/popup.h2
-rw-r--r--scene/gui/popup_menu.cpp8
-rw-r--r--scene/gui/reference_rect.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp26
-rw-r--r--scene/gui/scroll_bar.cpp6
-rw-r--r--scene/gui/scroll_container.cpp2
-rw-r--r--scene/gui/shortcut.cpp2
-rw-r--r--scene/gui/shortcut.h4
-rw-r--r--scene/gui/slider.cpp2
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/tab_container.cpp2
-rw-r--r--scene/gui/tabs.cpp2
-rw-r--r--scene/gui/text_edit.cpp104
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/texture_progress.cpp8
-rw-r--r--scene/gui/tree.cpp22
-rw-r--r--scene/gui/tree.h2
-rw-r--r--scene/gui/video_player.cpp2
39 files changed, 255 insertions, 154 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index d17ae1d84c..59590ea67b 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -30,7 +30,7 @@
#include "base_button.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index a34f2f1ad5..dd6d66ac62 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "button.h"
+#include "core/translation.h"
#include "servers/visual_server.h"
-#include "translation.h"
Size2 Button::get_minimum_size() const {
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index f9ed0ecdbb..fa9538da28 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -30,7 +30,7 @@
#include "check_button.h"
-#include "print_string.h"
+#include "core/print_string.h"
#include "servers/visual_server.h"
Size2 CheckButton::get_icon_size() const {
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 8e232c6f46..537a16fbc3 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -30,9 +30,9 @@
#include "color_picker.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "scene/gui/separator.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 7df03bf7c6..d606629041 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "container.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/scene_string_names.h"
void Container::_child_minsize_changed() {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index e094a063be..12349e0983 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -29,15 +29,15 @@
/*************************************************************************/
#include "control.h"
-#include "project_settings.h"
+#include "core/project_settings.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/viewport.h"
#include "servers/visual_server.h"
-#include "message_queue.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/message_queue.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
#include "scene/gui/label.h"
#include "scene/gui/panel.h"
#include "scene/scene_string_names.h"
@@ -2062,8 +2062,11 @@ void Control::grab_focus() {
if (!is_inside_tree()) {
ERR_FAIL_COND(!is_inside_tree());
}
- if (data.focus_mode == FOCUS_NONE)
+
+ if (data.focus_mode == FOCUS_NONE) {
+ WARN_PRINT("This control can't grab focus. Use set_focus_mode() to allow a control to get focus.");
return;
+ }
get_viewport()->_gui_control_grab_focus(this);
}
@@ -2874,7 +2877,7 @@ void Control::_bind_methods() {
ADD_GROUP("Mouse", "mouse_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertial split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertical split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
ADD_GROUP("Size Flags", "size_flags_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags");
@@ -2956,7 +2959,7 @@ void Control::_bind_methods() {
BIND_ENUM_CONSTANT(ANCHOR_END);
ADD_SIGNAL(MethodInfo("resized"));
- ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "ev", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
+ ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
ADD_SIGNAL(MethodInfo("focus_entered"));
diff --git a/scene/gui/control.h b/scene/gui/control.h
index c6bd2f097d..eb39d9ca0f 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -31,13 +31,13 @@
#ifndef CONTROL_H
#define CONTROL_H
-#include "rid.h"
+#include "core/math/transform_2d.h"
+#include "core/rid.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/shortcut.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/theme.h"
-#include "transform_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -76,7 +76,7 @@ public:
SIZE_EXPAND = 2,
SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
SIZE_SHRINK_CENTER = 4, //ignored by expand or fill
- SIZE_SHRINK_END = 8, //ignored by expand or fil
+ SIZE_SHRINK_END = 8, //ignored by expand or fill
};
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index d9737fa21a..e3a21eb10d 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "dialogs.h"
+#include "core/print_string.h"
+#include "core/translation.h"
#include "line_edit.h"
-#include "print_string.h"
-#include "translation.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_node.h"
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 9bddaa7d29..5f162a3652 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "file_dialog.h"
-#include "os/keyboard.h"
-#include "print_string.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
#include "scene/gui/label.h"
FileDialog::GetIconFunc FileDialog::get_icon_func = NULL;
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 3227f1c3a8..8bd15080d3 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -32,7 +32,7 @@
#define FILE_DIALOG_H
#include "box_container.h"
-#include "os/dir_access.h"
+#include "core/os/dir_access.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index e82c0c4ad1..19ffe681ef 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -29,7 +29,10 @@
/*************************************************************************/
#include "gradient_edit.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
+#include "editor/editor_scale.h"
+
+#define SPACING (3 * EDSCALE)
GradientEdit::GradientEdit() {
grabbed = -1;
@@ -49,11 +52,15 @@ GradientEdit::GradientEdit() {
int GradientEdit::_get_point_from_pos(int x) {
int result = -1;
- int total_w = get_size().width - get_size().height - 3;
+ int total_w = get_size().width - get_size().height - SPACING;
+ float min_distance = 1e20;
for (int i = 0; i < points.size(); i++) {
//Check if we clicked at point
- if (ABS(x - points[i].offset * total_w + 1) < (POINT_WIDTH / 2 + 1)) {
+ float distance = ABS(x - points[i].offset * total_w);
+ float min = (POINT_WIDTH / 2 * 1.7); //make it easier to grab
+ if (distance <= min && distance < min_distance) {
result = i;
+ min_distance = distance;
}
}
return result;
@@ -63,7 +70,16 @@ void GradientEdit::_show_color_picker() {
if (grabbed == -1)
return;
picker->set_pick_color(points[grabbed].color);
- popup->set_position(get_global_position() - popup->get_combined_minimum_size());
+ Size2 minsize = popup->get_combined_minimum_size();
+ bool show_above = false;
+ if (get_global_position().y + get_size().y + minsize.y > get_viewport_rect().size.y) {
+ show_above = true;
+ }
+ if (show_above) {
+ popup->set_position(get_global_position() - Vector2(0, minsize.y));
+ } else {
+ popup->set_position(get_global_position() + Vector2(0, get_size().y));
+ }
popup->popup();
}
@@ -112,7 +128,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = _get_point_from_pos(x);
if (grabbed != -1) {
- int total_w = get_size().width - get_size().height - 3;
+ int total_w = get_size().width - get_size().height - SPACING;
Gradient::Point newPoint = points[grabbed];
newPoint.offset = CLAMP(x / float(total_w), 0, 1);
@@ -130,14 +146,15 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
+ //select
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
update();
int x = mb->get_position().x;
- int total_w = get_size().width - get_size().height - 3;
+ int total_w = get_size().width - get_size().height - SPACING;
//Check if color selector was clicked.
- if (x > total_w + 3) {
+ if (x > total_w + SPACING) {
_show_color_picker();
return;
}
@@ -211,7 +228,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid() && grabbing) {
- int total_w = get_size().width - get_size().height - 3;
+ int total_w = get_size().width - get_size().height - SPACING;
int x = mm->get_position().x;
@@ -286,7 +303,7 @@ void GradientEdit::_notification(int p_what) {
if (w == 0 || h == 0)
return; //Safety check. We have division by 'h'. And in any case there is nothing to draw with such size
- int total_w = get_size().width - get_size().height - 3;
+ int total_w = get_size().width - get_size().height - SPACING;
//Draw checker pattern for ramp
_draw_checker(0, 0, total_w, h);
@@ -335,27 +352,36 @@ void GradientEdit::_notification(int p_what) {
//Draw point markers
for (int i = 0; i < points.size(); i++) {
- Color col = i == grabbed ? Color(1, 0.0, 0.0, 0.9) : points[i].color.contrasted();
+ Color col = points[i].color.contrasted();
col.a = 0.9;
draw_line(Vector2(points[i].offset * total_w, 0), Vector2(points[i].offset * total_w, h / 2), col);
- draw_rect(Rect2(points[i].offset * total_w - POINT_WIDTH / 2, h / 2, POINT_WIDTH, h / 2), Color(0.6, 0.6, 0.6, i == grabbed ? 0.9 : 0.4));
- draw_line(Vector2(points[i].offset * total_w - POINT_WIDTH / 2, h / 2), Vector2(points[i].offset * total_w - POINT_WIDTH / 2, h - 1), col);
- draw_line(Vector2(points[i].offset * total_w + POINT_WIDTH / 2, h / 2), Vector2(points[i].offset * total_w + POINT_WIDTH / 2, h - 1), col);
- draw_line(Vector2(points[i].offset * total_w - POINT_WIDTH / 2, h / 2), Vector2(points[i].offset * total_w + POINT_WIDTH / 2, h / 2), col);
- draw_line(Vector2(points[i].offset * total_w - POINT_WIDTH / 2, h - 1), Vector2(points[i].offset * total_w + POINT_WIDTH / 2, h - 1), col);
+ Rect2 rect = Rect2(points[i].offset * total_w - POINT_WIDTH / 2, h / 2, POINT_WIDTH, h / 2);
+ draw_rect(rect, points[i].color, true);
+ draw_rect(rect, col, false);
+ if (grabbed == i) {
+ rect = rect.grow(-1);
+ if (has_focus()) {
+ draw_rect(rect, Color(1, 0, 0, 0.9), false);
+ } else {
+ draw_rect(rect, Color(0.6, 0, 0, 0.9), false);
+ }
+
+ rect = rect.grow(-1);
+ draw_rect(rect, col, false);
+ }
}
//Draw "button" for color selector
- _draw_checker(total_w + 3, 0, h, h);
+ _draw_checker(total_w + SPACING, 0, h, h);
if (grabbed != -1) {
//Draw with selection color
- draw_rect(Rect2(total_w + 3, 0, h, h), points[grabbed].color);
+ draw_rect(Rect2(total_w + SPACING, 0, h, h), points[grabbed].color);
} else {
//if no color selected draw grey color with 'X' on top.
- draw_rect(Rect2(total_w + 3, 0, h, h), Color(0.5, 0.5, 0.5, 1));
- draw_line(Vector2(total_w + 3, 0), Vector2(total_w + 3 + h, h), Color(1, 1, 1, 0.6));
- draw_line(Vector2(total_w + 3, h), Vector2(total_w + 3 + h, 0), Color(1, 1, 1, 0.6));
+ draw_rect(Rect2(total_w + SPACING, 0, h, h), Color(0.5, 0.5, 0.5, 1));
+ draw_line(Vector2(total_w + SPACING, 0), Vector2(total_w + SPACING + h, h), Color(1, 1, 1, 0.6));
+ draw_line(Vector2(total_w + SPACING, h), Vector2(total_w + SPACING + h, 0), Color(1, 1, 1, 0.6));
}
//Draw borders around color ramp if in focus
diff --git a/scene/gui/gradient_edit.h b/scene/gui/gradient_edit.h
index e7834ea0de..f6927ad0b7 100644
--- a/scene/gui/gradient_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -36,7 +36,7 @@
#include "scene/resources/color_ramp.h"
#include "scene/resources/default_theme/theme_data.h"
-#define POINT_WIDTH 8
+#define POINT_WIDTH (8 * EDSCALE)
class GradientEdit : public Control {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index a7163adbe6..0ffaac20f6 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -30,8 +30,8 @@
#include "graph_edit.h"
-#include "os/input.h"
-#include "os/keyboard.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
#include "scene/gui/box_container.h"
#define ZOOM_SCALE 1.2
@@ -1279,7 +1279,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot")));
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
- ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node")));
+ ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
@@ -1304,7 +1304,7 @@ GraphEdit::GraphEdit() {
add_child(connections_layer);
connections_layer->connect("draw", this, "_connections_layer_draw");
connections_layer->set_name("CLAYER");
- connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offseted
+ connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset
connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE);
h_scroll = memnew(HScrollBar);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 24857d49fa..b189afd30b 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "graph_node.h"
-#include "method_bind_ext.gen.inc"
+
+#include "core/method_bind_ext.gen.inc"
bool GraphNode::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 9f5c12e87f..0d5fbee9ee 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "item_list.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 0b36e1663c..ce8de38b74 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "label.h"
-#include "print_string.h"
-#include "project_settings.h"
-#include "translation.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
+#include "core/translation.h"
void Label::set_autowrap(bool p_autowrap) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 1f3d5e6e13..9c43d5b308 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -29,12 +29,12 @@
/*************************************************************************/
#include "line_edit.h"
+#include "core/message_queue.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/translation.h"
#include "label.h"
-#include "message_queue.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "translation.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_scale.h"
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 87cf4dc334..95ec618c3b 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "menu_button.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
#include "scene/main/viewport.h"
void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 2901176a69..6b847c6483 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "option_button.h"
-#include "print_string.h"
+#include "core/print_string.h"
Size2 OptionButton::get_minimum_size() const {
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 4375e03a50..d3b7b72ee1 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "panel.h"
-#include "print_string.h"
+#include "core/print_string.h"
void Panel::_notification(int p_what) {
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 26d01ecc09..bfbe62e1c7 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -30,8 +30,8 @@
#include "popup.h"
-#include "engine.h"
-#include "os/keyboard.h"
+#include "core/engine.h"
+#include "core/os/keyboard.h"
void Popup::_gui_input(Ref<InputEvent> p_event) {
}
@@ -234,15 +234,46 @@ String Popup::get_configuration_warning() const {
Popup::~Popup() {
}
-void PopupPanel::set_child_rect(Control *p_child) {
- ERR_FAIL_NULL(p_child);
+Size2 PopupPanel::get_minimum_size() const {
Ref<StyleBox> p = get_stylebox("panel");
- p_child->set_anchors_preset(Control::PRESET_WIDE);
- p_child->set_margin(MARGIN_LEFT, p->get_margin(MARGIN_LEFT));
- p_child->set_margin(MARGIN_RIGHT, -p->get_margin(MARGIN_RIGHT));
- p_child->set_margin(MARGIN_TOP, p->get_margin(MARGIN_TOP));
- p_child->set_margin(MARGIN_BOTTOM, -p->get_margin(MARGIN_BOTTOM));
+
+ Size2 ms;
+
+ for (int i = 0; i < get_child_count(); i++) {
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+
+ if (c->is_set_as_toplevel())
+ continue;
+
+ Size2 cms = c->get_combined_minimum_size();
+ ms.x = MAX(cms.x, ms.x);
+ ms.y = MAX(cms.y, ms.y);
+ }
+
+ return ms + p->get_minimum_size();
+}
+
+void PopupPanel::_update_child_rects() {
+
+ Ref<StyleBox> p = get_stylebox("panel");
+
+ Vector2 cpos(p->get_offset());
+ Vector2 csize(get_size() - p->get_minimum_size());
+
+ for (int i = 0; i < get_child_count(); i++) {
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+
+ if (c->is_set_as_toplevel())
+ continue;
+
+ c->set_position(cpos);
+ c->set_size(csize);
+ }
}
void PopupPanel::_notification(int p_what) {
@@ -250,6 +281,12 @@ void PopupPanel::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
get_stylebox("panel")->draw(get_canvas_item(), Rect2(Point2(), get_size()));
+ } else if (p_what == NOTIFICATION_READY) {
+
+ _update_child_rects();
+ } else if (p_what == NOTIFICATION_RESIZED) {
+
+ _update_child_rects();
}
}
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index 550e803578..5b1ef7d6ca 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -77,10 +77,12 @@ class PopupPanel : public Popup {
GDCLASS(PopupPanel, Popup);
protected:
+ void _update_child_rects();
void _notification(int p_what);
public:
void set_child_rect(Control *p_child);
+ virtual Size2 get_minimum_size() const;
PopupPanel();
};
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 436dda41a4..3239641c2f 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "popup_menu.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "print_string.h"
-#include "translation.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/print_string.h"
+#include "core/translation.h"
String PopupMenu::_get_accel_text(int p_item) const {
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 74e68598f4..e96e5afb2a 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -30,7 +30,7 @@
#include "reference_rect.h"
-#include "engine.h"
+#include "core/engine.h"
void ReferenceRect::_notification(int p_what) {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index a5f9bea1b1..1e281471a6 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "rich_text_label.h"
-#include "os/keyboard.h"
-#include "os/os.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
@@ -1423,18 +1423,28 @@ bool RichTextLabel::remove_line(const int p_line) {
if (p_line >= current_frame->lines.size() || p_line < 0)
return false;
- int lines = p_line * 2;
+ int i = 0;
+ while (i < current->subitems.size() && current->subitems[i]->line < p_line) {
+ i++;
+ }
- if (current->subitems[lines]->type != ITEM_NEWLINE)
- _remove_item(current->subitems[lines], current->subitems[lines]->line, lines);
+ bool was_newline = false;
+ while (i < current->subitems.size()) {
+ was_newline = current->subitems[i]->type == ITEM_NEWLINE;
+ _remove_item(current->subitems[i], current->subitems[i]->line, p_line);
+ if (was_newline)
+ break;
+ }
- _remove_item(current->subitems[lines], current->subitems[lines]->line, lines);
+ if (!was_newline) {
+ current_frame->lines.remove(p_line);
+ }
- if (p_line == 0) {
+ if (p_line == 0 && current->subitems.size() > 0)
main->lines.write[0].from = main;
- }
main->first_invalid_line = 0;
+
return true;
}
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index e5bd1c453d..df27fb0e6b 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -30,9 +30,9 @@
#include "scroll_bar.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
bool ScrollBar::focus_by_default = false;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 495d618930..e3fb602065 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "scroll_container.h"
-#include "os/os.h"
+#include "core/os/os.h"
bool ScrollContainer::clips_input() const {
return true;
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 36490cf254..6fcf96f611 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -30,7 +30,7 @@
#include "shortcut.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
void ShortCut::set_shortcut(const Ref<InputEvent> &p_shortcut) {
diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h
index f9240642bf..7613a24e43 100644
--- a/scene/gui/shortcut.h
+++ b/scene/gui/shortcut.h
@@ -31,8 +31,8 @@
#ifndef SHORTCUT_H
#define SHORTCUT_H
-#include "os/input_event.h"
-#include "resource.h"
+#include "core/os/input_event.h"
+#include "core/resource.h"
class ShortCut : public Resource {
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index b820e2eafd..147c0518ec 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "slider.h"
-#include "os/keyboard.h"
+#include "core/os/keyboard.h"
Size2 Slider::get_minimum_size() const {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 145981d498..2221923093 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "spin_box.h"
-#include "os/input.h"
+#include "core/os/input.h"
Size2 SpinBox::get_minimum_size() const {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index c30fa96327..4c354768fe 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -30,7 +30,7 @@
#include "tab_container.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 2075f7ce70..c56b7d0f26 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -30,7 +30,7 @@
#include "tabs.h"
-#include "message_queue.h"
+#include "core/message_queue.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index ec98b01ced..a9566d9387 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -30,11 +30,11 @@
#include "text_edit.h"
-#include "message_queue.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "project_settings.h"
+#include "core/message_queue.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "scene/main/viewport.h"
#ifdef TOOLS_ENABLED
@@ -556,7 +556,6 @@ void TextEdit::_notification(int p_what) {
} break;
case NOTIFICATION_RESIZED: {
- cache.size = get_size();
_update_scrollbars();
update_wrap_at();
} break;
@@ -593,6 +592,7 @@ void TextEdit::_notification(int p_what) {
}
} break;
case NOTIFICATION_DRAW: {
+ Size2 size = get_size();
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
draw_caret = false;
}
@@ -634,17 +634,17 @@ void TextEdit::_notification(int p_what) {
RID ci = get_canvas_item();
VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width;
- int xmargin_end = cache.size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
+ int xmargin_end = size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
//let's do it easy for now:
- cache.style_normal->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_normal->draw(ci, Rect2(Point2(), size));
float readonly_alpha = 1.0; // used to set the input text color when in read-only mode
if (readonly) {
- cache.style_readonly->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_readonly->draw(ci, Rect2(Point2(), size));
readonly_alpha = .5;
draw_caret = false;
}
if (has_focus())
- cache.style_focus->draw(ci, Rect2(Point2(), cache.size));
+ cache.style_focus->draw(ci, Rect2(Point2(), size));
int ascent = cache.font->get_ascent();
@@ -1261,7 +1261,7 @@ void TextEdit::_notification(int p_what) {
if (line_length_guideline) {
int x = xmargin_beg + cache.font->get_char_size('0').width * line_length_guideline_col - cursor.x_ofs;
if (x > xmargin_beg && x < xmargin_end) {
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(x, 0), Point2(x, cache.size.height), cache.line_length_guideline_color);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(x, 0), Point2(x, size.height), cache.line_length_guideline_color);
}
}
@@ -1942,7 +1942,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int to_column = get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
deselect();
}
}
@@ -3119,16 +3119,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (selection.active) {
int ini = selection.from_line;
int end = selection.to_line;
+
for (int i = ini; i <= end; i++) {
- if (get_line(i).begins_with("#"))
- _remove_text(i, 0, i, 1);
+ _uncomment_line(i);
}
} else {
- if (get_line(cursor.line).begins_with("#")) {
- _remove_text(cursor.line, 0, cursor.line, 1);
- if (cursor.column >= get_line(cursor.line).length()) {
- cursor.column = MAX(0, get_line(cursor.line).length() - 1);
- }
+ _uncomment_line(cursor.line);
+ if (cursor.column >= get_line(cursor.line).length()) {
+ cursor.column = MAX(0, get_line(cursor.line).length() - 1);
}
}
update();
@@ -3208,6 +3206,24 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
+void TextEdit::_uncomment_line(int p_line) {
+ String line_text = get_line(p_line);
+ for (int i = 0; i < line_text.length(); i++) {
+ if (line_text[i] == '#') {
+ _remove_text(p_line, i, p_line, i + 1);
+ if (p_line == selection.to_line && selection.to_column > line_text.length() - 1) {
+ selection.to_column -= 1;
+ if (selection.to_column >= selection.from_column) {
+ selection.active = false;
+ }
+ }
+ return;
+ } else if (line_text[i] != '\t' && line_text[i] != ' ') {
+ return;
+ }
+ }
+}
+
void TextEdit::_scroll_up(real_t p_delta) {
if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta))
@@ -3609,7 +3625,7 @@ Size2 TextEdit::get_minimum_size() const {
int TextEdit::get_visible_rows() const {
- int total = cache.size.height;
+ int total = get_size().height;
total -= cache.style_normal->get_minimum_size().height;
if (h_scroll->is_visible_in_tree())
total -= h_scroll->get_size().height;
@@ -3636,7 +3652,7 @@ int TextEdit::get_total_visible_rows() const {
void TextEdit::update_wrap_at() {
- wrap_at = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
+ wrap_at = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
update_cursor_wrap_offset();
text.clear_wrap_cache();
@@ -3670,7 +3686,7 @@ void TextEdit::adjust_viewport_to_cursor() {
set_line_as_last_visible(cur_line, cur_wrap);
}
- int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
+ int visible_width = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
if (v_scroll->is_visible_in_tree())
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
@@ -3701,7 +3717,7 @@ void TextEdit::center_viewport_to_cursor() {
unfold_line(cursor.line);
set_line_as_center_visible(cursor.line, get_cursor_wrap_index());
- int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
+ int visible_width = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
if (v_scroll->is_visible_in_tree())
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
@@ -4158,7 +4174,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
}
}
- return CURSOR_IBEAM;
+ return get_default_cursor_shape();
}
void TextEdit::set_text(String p_text) {
@@ -4822,28 +4838,27 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
pos = -1;
- int pos_from = 0;
+ int pos_from = (p_search_flags & SEARCH_BACKWARDS) ? text_line.length() : 0;
int last_pos = -1;
while (true) {
- while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
-
- if (p_search_flags & SEARCH_BACKWARDS) {
-
- if (last_pos > from_column)
+ if (p_search_flags & SEARCH_BACKWARDS) {
+ while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.rfind(p_key, pos_from) : text_line.rfindn(p_key, pos_from)) != -1) {
+ if (last_pos <= from_column) {
+ pos = last_pos;
break;
- pos = last_pos;
-
- } else {
-
+ }
+ pos_from = last_pos - p_key.length();
+ }
+ } else {
+ while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
if (last_pos >= from_column) {
pos = last_pos;
break;
}
+ pos_from = last_pos + p_key.length();
}
-
- pos_from = last_pos + p_key.length();
}
bool is_match = true;
@@ -4856,11 +4871,15 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
is_match = false;
}
+ if (pos_from == -1) {
+ pos = -1;
+ }
+
if (is_match || last_pos == -1 || pos == -1) {
break;
}
- pos_from = pos + 1;
+ pos_from = (p_search_flags & SEARCH_BACKWARDS) ? pos - 1 : pos + 1;
pos = -1;
}
@@ -5543,7 +5562,7 @@ int TextEdit::get_last_visible_line_wrap_index() const {
double TextEdit::get_visible_rows_offset() const {
- double total = cache.size.height;
+ double total = get_size().height;
total -= cache.style_normal->get_minimum_size().height;
if (h_scroll->is_visible_in_tree())
total -= h_scroll->get_size().height;
@@ -5910,6 +5929,9 @@ void TextEdit::set_line(int line, String new_text) {
if (cursor.line == line) {
cursor.column = MIN(cursor.column, new_text.length());
}
+ if (is_selection_active() && line == selection.to_line && selection.to_column > text[line].length()) {
+ selection.to_column = text[line].length();
+ }
}
void TextEdit::insert_at(const String &p_text, int at) {
@@ -6227,7 +6249,6 @@ TextEdit::TextEdit() {
set_focus_mode(FOCUS_ALL);
syntax_highlighter = NULL;
_update_caches();
- cache.size = Size2(1, 1);
cache.row_height = 1;
cache.line_spacing = 1;
cache.line_number_w = 1;
@@ -6235,6 +6256,7 @@ TextEdit::TextEdit() {
breakpoint_gutter_width = 0;
cache.fold_gutter_width = 0;
fold_gutter_width = 0;
+ set_default_cursor_shape(CURSOR_IBEAM);
indent_size = 4;
text.set_indent_size(indent_size);
@@ -6400,8 +6422,8 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int
is_hex_notation = false;
}
- // check for dot or underscore or 'x' for hex notation in floating point number
- if ((str[j] == '.' || str[j] == 'x' || str[j] == '_' || str[j] == 'f') && !in_word && prev_is_number && !is_number) {
+ // check for dot or underscore or 'x' for hex notation in floating point number or 'e' for scientific notation
+ if ((str[j] == '.' || str[j] == 'x' || str[j] == '_' || str[j] == 'f' || str[j] == 'e') && !in_word && prev_is_number && !is_number) {
is_number = true;
is_symbol = false;
is_char = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 19b5d574c6..f0c18ad047 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -193,7 +193,6 @@ private:
int line_number_w;
int breakpoint_gutter_width;
int fold_gutter_width;
- Size2 size;
} cache;
Map<int, int> color_region_cache;
@@ -373,6 +372,7 @@ private:
void _update_selection_mode_word();
void _update_selection_mode_line();
+ void _uncomment_line(int p_line);
void _scroll_up(real_t p_delta);
void _scroll_down(real_t p_delta);
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index ff90576c1b..8188d1dcf8 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -30,7 +30,7 @@
#include "texture_progress.h"
-#include "engine.h"
+#include "core/engine.h"
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
@@ -466,9 +466,9 @@ void TextureProgress::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_progress", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_progress_texture", "get_progress_texture");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "fill_mode", PROPERTY_HINT_ENUM, "Left to Right,Right to Left,Top to Bottom,Bottom to Top,Clockwise,Counter Clockwise,Bilinear (Left and Right),Bilinear (Top and Bottom), Clockwise and Counter Clockwise"), "set_fill_mode", "get_fill_mode");
ADD_GROUP("Tint", "tint_");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_under", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_under", "get_tint_under");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_over", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_over", "get_tint_over");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_progress", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_progress", "get_tint_progress");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_under"), "set_tint_under", "get_tint_under");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_over"), "set_tint_over", "get_tint_over");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_progress"), "set_tint_progress", "get_tint_progress");
ADD_GROUP("Radial Fill", "radial_");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_initial_angle", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_radial_initial_angle", "get_radial_initial_angle");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_fill_degrees", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_fill_degrees", "get_fill_degrees");
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 6f09488b64..365a6a5cae 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -31,12 +31,12 @@
#include "tree.h"
#include <limits.h>
-#include "math_funcs.h"
-#include "os/input.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "project_settings.h"
+#include "core/math/math_funcs.h"
+#include "core/os/input.h"
+#include "core/os/keyboard.h"
+#include "core/os/os.h"
+#include "core/print_string.h"
+#include "core/project_settings.h"
#include "scene/main/viewport.h"
#ifdef TOOLS_ENABLED
@@ -1419,7 +1419,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
while (c) {
- if (cache.draw_relationship_lines == 1) {
+ if (cache.draw_relationship_lines == 1 && (c->get_parent() != root || c->get_parent() == root && !hide_root)) {
int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
@@ -1721,7 +1721,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
if (p_button == BUTTON_LEFT || (p_button == BUTTON_RIGHT && allow_rmb_select)) {
/* process selection */
- if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it' s confusing for check
+ if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check
emit_signal("item_activated");
incr_search.clear();
@@ -3831,16 +3831,16 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_selected"));
ADD_SIGNAL(MethodInfo("cell_selected"));
- ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
+ ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("item_rmb_edited"));
ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
ADD_SIGNAL(MethodInfo("item_double_clicked"));
- ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item")));
+ ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem")));
//ADD_SIGNAL( MethodInfo("item_doubleclicked" ) );
- ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("custom_popup_edited", PropertyInfo(Variant::BOOL, "arrow_clicked")));
ADD_SIGNAL(MethodInfo("item_activated"));
ADD_SIGNAL(MethodInfo("column_title_pressed", PropertyInfo(Variant::INT, "column")));
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 5af66c5faa..205cdbfb7e 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -516,7 +516,7 @@ protected:
static void _bind_methods();
//bind helpers
- Object *_create_item(Object *p_parent, int p_idx = -1) {
+ TreeItem *_create_item(Object *p_parent, int p_idx = -1) {
return create_item(Object::cast_to<TreeItem>(p_parent), p_idx);
}
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 88e1847533..17ab234551 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -31,7 +31,7 @@
#include "video_player.h"
#include "scene/scene_string_names.h"
-#include "os/os.h"
+#include "core/os/os.h"
#include "servers/audio_server.h"
int VideoPlayer::sp_get_channel_count() const {