summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp1
-rw-r--r--scene/gui/base_button.h1
-rw-r--r--scene/gui/box_container.cpp3
-rw-r--r--scene/gui/box_container.h1
-rw-r--r--scene/gui/button.cpp1
-rw-r--r--scene/gui/button.h1
-rw-r--r--scene/gui/button_array.cpp1
-rw-r--r--scene/gui/button_array.h1
-rw-r--r--scene/gui/button_group.cpp1
-rw-r--r--scene/gui/button_group.h1
-rw-r--r--scene/gui/center_container.cpp1
-rw-r--r--scene/gui/center_container.h1
-rw-r--r--scene/gui/check_box.cpp1
-rw-r--r--scene/gui/check_box.h1
-rw-r--r--scene/gui/check_button.cpp1
-rw-r--r--scene/gui/check_button.h1
-rw-r--r--scene/gui/color_picker.cpp3
-rw-r--r--scene/gui/color_picker.h1
-rw-r--r--scene/gui/color_ramp_edit.cpp3
-rw-r--r--scene/gui/color_ramp_edit.h1
-rw-r--r--scene/gui/color_rect.cpp1
-rw-r--r--scene/gui/color_rect.h1
-rw-r--r--scene/gui/container.cpp3
-rw-r--r--scene/gui/container.h1
-rw-r--r--scene/gui/control.cpp51
-rw-r--r--scene/gui/control.h9
-rw-r--r--scene/gui/dialogs.cpp63
-rw-r--r--scene/gui/dialogs.h1
-rw-r--r--scene/gui/file_dialog.cpp1
-rw-r--r--scene/gui/file_dialog.h1
-rw-r--r--scene/gui/graph_edit.cpp21
-rw-r--r--scene/gui/graph_edit.h1
-rw-r--r--scene/gui/graph_node.cpp1
-rw-r--r--scene/gui/graph_node.h1
-rw-r--r--scene/gui/grid_container.cpp1
-rw-r--r--scene/gui/grid_container.h1
-rw-r--r--scene/gui/input_action.cpp1
-rw-r--r--scene/gui/input_action.h1
-rw-r--r--scene/gui/item_list.cpp1
-rw-r--r--scene/gui/item_list.h1
-rw-r--r--scene/gui/label.cpp1
-rw-r--r--scene/gui/label.h1
-rw-r--r--scene/gui/line_edit.cpp3
-rw-r--r--scene/gui/line_edit.h1
-rw-r--r--scene/gui/link_button.cpp1
-rw-r--r--scene/gui/link_button.h1
-rw-r--r--scene/gui/margin_container.cpp1
-rw-r--r--scene/gui/margin_container.h1
-rw-r--r--scene/gui/menu_button.cpp7
-rw-r--r--scene/gui/menu_button.h1
-rw-r--r--scene/gui/option_button.cpp3
-rw-r--r--scene/gui/option_button.h1
-rw-r--r--scene/gui/panel.cpp1
-rw-r--r--scene/gui/panel.h1
-rw-r--r--scene/gui/panel_container.cpp1
-rw-r--r--scene/gui/panel_container.h1
-rw-r--r--scene/gui/patch_9_rect.cpp35
-rw-r--r--scene/gui/patch_9_rect.h1
-rw-r--r--scene/gui/popup.cpp17
-rw-r--r--scene/gui/popup.h1
-rw-r--r--scene/gui/popup_menu.cpp19
-rw-r--r--scene/gui/popup_menu.h1
-rw-r--r--scene/gui/progress_bar.cpp1
-rw-r--r--scene/gui/progress_bar.h1
-rw-r--r--scene/gui/range.cpp11
-rw-r--r--scene/gui/range.h1
-rw-r--r--scene/gui/reference_rect.cpp1
-rw-r--r--scene/gui/reference_rect.h1
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/rich_text_label.h1
-rw-r--r--scene/gui/scroll_bar.cpp3
-rw-r--r--scene/gui/scroll_bar.h1
-rw-r--r--scene/gui/scroll_container.cpp1
-rw-r--r--scene/gui/scroll_container.h1
-rw-r--r--scene/gui/separator.cpp1
-rw-r--r--scene/gui/separator.h1
-rw-r--r--scene/gui/slider.cpp1
-rw-r--r--scene/gui/slider.h1
-rw-r--r--scene/gui/spin_box.cpp1
-rw-r--r--scene/gui/spin_box.h1
-rw-r--r--scene/gui/split_container.cpp3
-rw-r--r--scene/gui/split_container.h1
-rw-r--r--scene/gui/tab_container.cpp5
-rw-r--r--scene/gui/tab_container.h1
-rw-r--r--scene/gui/tabs.cpp1
-rw-r--r--scene/gui/tabs.h1
-rw-r--r--scene/gui/text_edit.cpp171
-rw-r--r--scene/gui/text_edit.h17
-rw-r--r--scene/gui/texture_button.cpp1
-rw-r--r--scene/gui/texture_button.h1
-rw-r--r--scene/gui/texture_progress.cpp1
-rw-r--r--scene/gui/texture_progress.h1
-rw-r--r--scene/gui/texture_rect.cpp1
-rw-r--r--scene/gui/texture_rect.h1
-rw-r--r--scene/gui/tool_button.cpp1
-rw-r--r--scene/gui/tool_button.h1
-rw-r--r--scene/gui/tree.cpp27
-rw-r--r--scene/gui/tree.h1
-rw-r--r--scene/gui/video_player.cpp1
-rw-r--r--scene/gui/video_player.h1
-rw-r--r--scene/gui/viewport_container.cpp1
-rw-r--r--scene/gui/viewport_container.h1
102 files changed, 377 insertions, 183 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index eceee8e317..ee4f8736d7 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index e382df61c9..62b6633bfc 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 7c1487c42f..e7f4a274d5 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -98,7 +99,7 @@ void BoxContainer::_resort() {
elements exist */
bool has_stretched = false;
- while (stretch_ratio_total > 0) { // first of all, dont even be here if no stretchable objects exist
+ while (stretch_ratio_total > 0) { // first of all, don't even be here if no stretchable objects exist
has_stretched = true;
bool refit_successful = true; //assume refit-test will go well
diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h
index 04b074896b..d544ff79d1 100644
--- a/scene/gui/box_container.h
+++ b/scene/gui/box_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 23915c51a8..6fcc878e11 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button.h b/scene/gui/button.h
index 38605bd3ef..499e44c0e1 100644
--- a/scene/gui/button.h
+++ b/scene/gui/button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
index c1cb9ad855..eccf3ea64a 100644
--- a/scene/gui/button_array.cpp
+++ b/scene/gui/button_array.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
index dac130e79a..f2f7bea9c6 100644
--- a/scene/gui/button_array.h
+++ b/scene/gui/button_array.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp
index 21c1559b8f..75fe438448 100644
--- a/scene/gui/button_group.cpp
+++ b/scene/gui/button_group.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/button_group.h b/scene/gui/button_group.h
index 38acd06984..93c3aaaeb3 100644
--- a/scene/gui/button_group.h
+++ b/scene/gui/button_group.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index 9cee8c0cc1..bdc811870d 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/center_container.h b/scene/gui/center_container.h
index c2deb823f1..30b526e893 100644
--- a/scene/gui/center_container.h
+++ b/scene/gui/center_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index c7e2f4e7f9..b61d516599 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h
index 9b682de177..ec8e097bae 100644
--- a/scene/gui/check_box.h
+++ b/scene/gui/check_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 6b24e0889a..1c3d4df308 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/check_button.h b/scene/gui/check_button.h
index adf210a1e1..8634858cfe 100644
--- a/scene/gui/check_button.h
+++ b/scene/gui/check_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 0f982167bf..adb5e2f0b6 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -590,7 +591,7 @@ void ColorPickerButton::_color_changed(const Color &p_color) {
void ColorPickerButton::pressed() {
Size2 ms = Size2(300, picker->get_combined_minimum_size().height + 10);
- popup->set_pos(get_global_pos() - Size2(0, ms.height));
+ popup->set_position(get_global_position() - Size2(0, ms.height));
popup->set_size(ms);
popup->popup();
picker->set_focus_on_line_edit();
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index bd1abeecbe..bce1ae07f7 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/color_ramp_edit.cpp
index 131638bb70..c6f73fe6e6 100644
--- a/scene/gui/color_ramp_edit.cpp
+++ b/scene/gui/color_ramp_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -61,7 +62,7 @@ void ColorRampEdit::_show_color_picker() {
return;
Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10);
picker->set_pick_color(points[grabbed].color);
- popup->set_pos(get_global_pos() - Vector2(ms.width - get_size().width, ms.height));
+ popup->set_position(get_global_position() - Vector2(ms.width - get_size().width, ms.height));
popup->set_size(ms);
popup->popup();
}
diff --git a/scene/gui/color_ramp_edit.h b/scene/gui/color_ramp_edit.h
index bb12064ddf..38176d2e77 100644
--- a/scene/gui/color_ramp_edit.h
+++ b/scene/gui/color_ramp_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp
index 7febecc0b9..0641302b1c 100644
--- a/scene/gui/color_rect.cpp
+++ b/scene/gui/color_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
index c6d0164ac9..65da3d9a7c 100644
--- a/scene/gui/color_rect.h
+++ b/scene/gui/color_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 811b41863c..c428d524a4 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -106,7 +107,7 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) {
for (int i = 0; i < 4; i++)
p_child->set_anchor(Margin(i), ANCHOR_BEGIN);
- p_child->set_pos(r.pos);
+ p_child->set_position(r.pos);
p_child->set_size(r.size);
p_child->set_rotation(0);
p_child->set_scale(Vector2(1, 1));
diff --git a/scene/gui/container.h b/scene/gui/container.h
index 78f647f59d..bff24c6d55 100644
--- a/scene/gui/container.h
+++ b/scene/gui/container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index a8e364a4cd..e62a993651 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -57,7 +58,7 @@ void Control::edit_set_state(const Variant &p_state) {
Dictionary s = p_state;
Rect2 state = s["rect"];
- set_pos(state.pos);
+ set_position(state.pos);
set_size(state.size);
set_rotation(s["rot"]);
set_scale(s["scale"]);
@@ -95,13 +96,13 @@ void Control::edit_set_rect(const Rect2 &p_edit_rect) {
postxf.set_rotation_and_scale(data.rotation, data.scale);
Vector2 new_pos = postxf.xform(p_edit_rect.pos);
- Vector2 pos = get_pos() + new_pos;
+ Vector2 pos = get_position() + new_pos;
Rect2 new_rect = get_rect();
new_rect.pos = pos.snapped(Vector2(1, 1));
new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1));
- set_pos(new_rect.pos);
+ set_position(new_rect.pos);
set_size(new_rect.size);
}
@@ -352,7 +353,7 @@ void Control::remove_child_notify(Node *p_child) {
void Control::_update_canvas_item_transform() {
- Transform2D xform = Transform2D(data.rotation, get_pos());
+ Transform2D xform = Transform2D(data.rotation, get_position());
xform.scale_basis(data.scale);
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);
}
@@ -485,7 +486,7 @@ void Control::_notification(int p_notification) {
} break;
case NOTIFICATION_MOVED_IN_PARENT: {
// some parents need to know the order of the childrens to draw (like TabContainer)
- // update if necesary
+ // update if necessary
if (data.parent)
data.parent->update();
update();
@@ -1347,12 +1348,12 @@ Control::AnchorType Control::get_anchor(Margin p_margin) const {
void Control::_change_notify_margins() {
// this avoids sending the whole object data again on a change
- _change_notify("margin/left");
- _change_notify("margin/top");
- _change_notify("margin/right");
- _change_notify("margin/bottom");
- _change_notify("rect/pos");
- _change_notify("rect/size");
+ _change_notify("margin_left");
+ _change_notify("margin_top");
+ _change_notify("margin_right");
+ _change_notify("margin_bottom");
+ _change_notify("rect_pos");
+ _change_notify("rect_size");
}
void Control::set_margin(Margin p_margin, float p_value) {
@@ -1389,12 +1390,12 @@ Size2 Control::get_end() const {
return Size2(data.margin[2], data.margin[3]);
}
-Point2 Control::get_global_pos() const {
+Point2 Control::get_global_position() const {
return get_global_transform().get_origin();
}
-void Control::set_global_pos(const Point2 &p_point) {
+void Control::set_global_position(const Point2 &p_point) {
Transform2D inv;
@@ -1403,10 +1404,10 @@ void Control::set_global_pos(const Point2 &p_point) {
inv = data.parent_canvas_item->get_global_transform().affine_inverse();
}
- set_pos(inv.xform(p_point));
+ set_position(inv.xform(p_point));
}
-void Control::set_pos(const Size2 &p_point) {
+void Control::set_position(const Size2 &p_point) {
float pw = _get_parent_range(0);
float ph = _get_parent_range(1);
@@ -1458,7 +1459,7 @@ void Control::set_size(const Size2 &p_size) {
_size_changed();
}
-Size2 Control::get_pos() const {
+Size2 Control::get_position() const {
return data.pos_cache;
}
@@ -1470,7 +1471,7 @@ Size2 Control::get_size() const {
Rect2 Control::get_global_rect() const {
- return Rect2(get_global_pos(), get_size());
+ return Rect2(get_global_position(), get_size());
}
Rect2 Control::get_window_rect() const {
@@ -1482,7 +1483,7 @@ Rect2 Control::get_window_rect() const {
Rect2 Control::get_rect() const {
- return Rect2(get_pos(), get_size());
+ return Rect2(get_position(), get_size());
}
Rect2 Control::get_item_rect() const {
@@ -1885,7 +1886,7 @@ Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const {
Transform2D Control::get_transform() const {
- Transform2D xform = Transform2D(data.rotation, get_pos());
+ Transform2D xform = Transform2D(data.rotation, get_position());
xform.scale_basis(data.scale);
return xform;
}
@@ -2158,7 +2159,7 @@ void Control::set_rotation(float p_radians) {
data.rotation = p_radians;
update();
_notify_transform();
- _change_notify("rect/rotation");
+ _change_notify("rect_rotation");
}
float Control::get_rotation() const {
@@ -2314,10 +2315,10 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin);
ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
- ClassDB::bind_method(D_METHOD("set_pos", "pos"), &Control::set_pos);
+ ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
- ClassDB::bind_method(D_METHOD("set_global_pos", "pos"), &Control::set_global_pos);
+ ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg);
// TODO: Obsolete this method (old name) properly (GH-4397)
@@ -2326,7 +2327,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_margin", "margin"), &Control::get_margin);
ClassDB::bind_method(D_METHOD("get_begin"), &Control::get_begin);
ClassDB::bind_method(D_METHOD("get_end"), &Control::get_end);
- ClassDB::bind_method(D_METHOD("get_pos"), &Control::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &Control::get_position);
ClassDB::bind_method(D_METHOD("get_size"), &Control::get_size);
ClassDB::bind_method(D_METHOD("get_rotation"), &Control::get_rotation);
ClassDB::bind_method(D_METHOD("get_rotation_deg"), &Control::get_rotation_deg);
@@ -2335,7 +2336,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scale"), &Control::get_scale);
ClassDB::bind_method(D_METHOD("get_custom_minimum_size"), &Control::get_custom_minimum_size);
ClassDB::bind_method(D_METHOD("get_parent_area_size"), &Control::get_size);
- ClassDB::bind_method(D_METHOD("get_global_pos"), &Control::get_global_pos);
+ ClassDB::bind_method(D_METHOD("get_global_position"), &Control::get_global_position);
ClassDB::bind_method(D_METHOD("get_rect"), &Control::get_rect);
ClassDB::bind_method(D_METHOD("get_global_rect"), &Control::get_global_rect);
ClassDB::bind_method(D_METHOD("set_area_as_parent_rect", "margin"), &Control::set_area_as_parent_rect, DEFVAL(0));
@@ -2437,7 +2438,7 @@ void Control::_bind_methods() {
ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_BOTTOM);
ADD_GROUP("Rect", "rect_");
- ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_pos", "get_pos");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_deg", "get_rotation_deg");
diff --git a/scene/gui/control.h b/scene/gui/control.h
index a18567123b..5834d1550a 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -276,12 +277,12 @@ public:
Point2 get_begin() const;
Point2 get_end() const;
- void set_pos(const Point2 &p_point);
+ void set_position(const Point2 &p_point);
void set_size(const Size2 &p_size);
- void set_global_pos(const Point2 &p_point);
+ void set_global_position(const Point2 &p_point);
- Point2 get_pos() const;
- Point2 get_global_pos() const;
+ Point2 get_position() const;
+ Point2 get_global_position() const;
Size2 get_size() const;
Rect2 get_rect() const;
Rect2 get_global_rect() const;
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index a58e62f061..835775e13b 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -35,6 +36,8 @@
#include "editor/editor_node.h"
#endif
+// WindowDialog
+
void WindowDialog::_post_popup() {
drag_type = DRAG_NONE; // just in case
@@ -42,23 +45,23 @@ void WindowDialog::_post_popup() {
void WindowDialog::_fix_size() {
- // Perhaps this should be called when the viewport resizes aswell or windows go out of bounds...
+ // Perhaps this should be called when the viewport resizes as well or windows go out of bounds...
// Ensure the whole window is visible.
- Point2i pos = get_global_pos();
+ Point2i pos = get_global_position();
Size2i size = get_size();
Size2i viewport_size = get_viewport_rect().size;
// Windows require additional padding to keep the window chrome visible.
- Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
- float top = panel->get_margin(MARGIN_TOP);
- float left = panel->get_margin(MARGIN_LEFT);
- float bottom = panel->get_margin(MARGIN_BOTTOM);
- float right = panel->get_margin(MARGIN_RIGHT);
+ Ref<StyleBoxTexture> panel = get_stylebox("panel", "WindowDialog");
+ float top = panel->get_expand_margin_size(MARGIN_TOP);
+ float left = panel->get_expand_margin_size(MARGIN_LEFT);
+ float bottom = panel->get_expand_margin_size(MARGIN_BOTTOM);
+ float right = panel->get_expand_margin_size(MARGIN_RIGHT);
pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right));
pos.y = MAX(top, MIN(pos.y, viewport_size.y - size.y - bottom));
- set_global_pos(pos);
+ set_global_position(pos);
// Also resize the window to fit if a resize should be possible at all.
if (resizable) {
@@ -73,9 +76,9 @@ bool WindowDialog::has_point(const Point2 &p_point) const {
Rect2 r(Point2(), get_size());
// Enlarge upwards for title bar.
- int titlebar_height = get_constant("titlebar_height", "WindowDialog");
- r.pos.y -= titlebar_height;
- r.size.y += titlebar_height;
+ int title_height = get_constant("title_height", "WindowDialog");
+ r.pos.y -= title_height;
+ r.size.y += title_height;
// Inflate by the resizable border thickness.
if (resizable) {
@@ -97,8 +100,8 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
// Begin a possible dragging operation.
drag_type = _drag_hit_test(Point2(p_event.mouse_button.x, p_event.mouse_button.y));
if (drag_type != DRAG_NONE)
- drag_offset = get_global_mouse_pos() - get_pos();
- drag_offset_far = get_pos() + get_size() - get_global_mouse_pos();
+ drag_offset = get_global_mouse_position() - get_position();
+ drag_offset_far = get_position() + get_size() - get_global_mouse_position();
} else if (drag_type != DRAG_NONE && !p_event.mouse_button.pressed) {
// End a dragging operation.
drag_type = DRAG_NONE;
@@ -135,7 +138,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
set_default_cursor_shape(cursor);
} else {
// Update while in a dragging operation.
- Point2 global_pos = get_global_mouse_pos();
+ Point2 global_pos = get_global_mouse_position();
global_pos.y = MAX(global_pos.y, 0); // Ensure title bar stays visible.
Rect2 rect = get_rect();
@@ -163,7 +166,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
}
set_size(rect.size);
- set_pos(rect.pos);
+ set_position(rect.pos);
}
}
}
@@ -172,19 +175,21 @@ void WindowDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
-
RID canvas = get_canvas_item();
- Size2 size = get_size();
+ // Draw the background.
Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
- panel->draw(canvas, Rect2(Point2(), size));
+ Size2 size = get_size();
+ panel->draw(canvas, Rect2(0, 0, size.x, size.y));
- int title_height = get_constant("title_height", "WindowDialog");
+ // Draw the title bar text.
+ Ref<Font> title_font = get_font("title_font", "WindowDialog");
Color title_color = get_color("title_color", "WindowDialog");
- Ref<Font> font = get_font("title_font", "WindowDialog");
- int ofs = (size.width - font->get_string_size(title).width) / 2;
- draw_string(font, Point2(ofs, -title_height + font->get_ascent()), title, title_color, size.width - panel->get_minimum_size().width);
-
+ int title_height = get_constant("title_height", "WindowDialog");
+ int font_height = title_font->get_height() - title_font->get_descent() * 2;
+ int x = (size.x - title_font->get_string_size(title).x) / 2;
+ int y = (-title_height + font_height) / 2;
+ title_font->draw(canvas, Point2(x, y), title, title_color, size.x - panel->get_minimum_size().x);
} break;
case NOTIFICATION_THEME_CHANGED:
@@ -226,12 +231,12 @@ int WindowDialog::_drag_hit_test(const Point2 &pos) const {
int drag_type = DRAG_NONE;
if (resizable) {
- int titlebar_height = get_constant("titlebar_height", "WindowDialog");
+ int title_height = get_constant("title_height", "WindowDialog");
int scaleborder_size = get_constant("scaleborder_size", "WindowDialog");
Rect2 rect = get_rect();
- if (pos.y < (-titlebar_height + scaleborder_size))
+ if (pos.y < (-title_height + scaleborder_size))
drag_type = DRAG_RESIZE_TOP;
else if (pos.y >= (rect.size.height - scaleborder_size))
drag_type = DRAG_RESIZE_BOTTOM;
@@ -305,6 +310,8 @@ WindowDialog::WindowDialog() {
WindowDialog::~WindowDialog() {
}
+// PopupDialog
+
void PopupDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
@@ -404,14 +411,14 @@ void AcceptDialog::_update_child_rects() {
if (c == hbc || c == label || c == get_close_button() || c->is_set_as_toplevel())
continue;
- c->set_pos(cpos);
+ c->set_position(cpos);
c->set_size(csize);
}
cpos.y += csize.y + margin;
csize.y = hminsize.y;
- hbc->set_pos(cpos);
+ hbc->set_position(cpos);
hbc->set_size(csize);
}
@@ -542,6 +549,8 @@ AcceptDialog::AcceptDialog() {
AcceptDialog::~AcceptDialog() {
}
+// ConfirmationDialog
+
void ConfirmationDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_cancel:Button"), &ConfirmationDialog::get_cancel);
diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h
index a729a8f907..2365df3d79 100644
--- a/scene/gui/dialogs.h
+++ b/scene/gui/dialogs.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index d4643b399d..2f1af318e9 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 397b0feba2..2afd0227c6 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 6a3b5e713c..0c092a4e17 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -139,13 +140,13 @@ void GraphEdit::_update_scroll_offset() {
Point2 pos = gn->get_offset() * zoom;
pos -= Point2(h_scroll->get_value(), v_scroll->get_value());
- gn->set_pos(pos);
+ gn->set_position(pos);
if (gn->get_scale() != Vector2(zoom, zoom)) {
gn->set_scale(Vector2(zoom, zoom));
}
}
- connections_layer->set_pos(-Point2(h_scroll->get_value(), v_scroll->get_value()));
+ connections_layer->set_position(-Point2(h_scroll->get_value(), v_scroll->get_value()));
set_block_minimum_size_adjust(false);
awaiting_scroll_offset_update = false;
}
@@ -349,14 +350,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r)
return true;
}
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r) {
return true;
}
@@ -382,7 +383,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
@@ -429,7 +430,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
@@ -496,7 +497,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
if (!connecting_out) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
int type = gn->get_connection_output_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
@@ -511,7 +512,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
int type = gn->get_connection_input_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
connecting_target = true;
@@ -703,7 +704,7 @@ void GraphEdit::_top_layer_draw() {
pos = from->get_connection_output_pos(connecting_index);
else
pos = from->get_connection_input_pos(connecting_index);
- pos += from->get_pos();
+ pos += from->get_position();
Vector2 topos;
topos = connecting_to;
@@ -1228,7 +1229,7 @@ GraphEdit::GraphEdit() {
HBoxContainer *zoom_hb = memnew(HBoxContainer);
top_layer->add_child(zoom_hb);
- zoom_hb->set_pos(Vector2(10, 10));
+ zoom_hb->set_position(Vector2(10, 10));
zoom_minus = memnew(ToolButton);
zoom_hb->add_child(zoom_minus);
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 5166f82310..ff3867a059 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index afbb0bbad7..f7bb866f6f 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index bab78dedb9..e98d0b3d07 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index aae11255ed..06a58d69b2 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/grid_container.h b/scene/gui/grid_container.h
index 61dda4e223..aaa6a295ff 100644
--- a/scene/gui/grid_container.h
+++ b/scene/gui/grid_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/input_action.cpp b/scene/gui/input_action.cpp
index 9576bb07e4..5b03338286 100644
--- a/scene/gui/input_action.cpp
+++ b/scene/gui/input_action.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/input_action.h b/scene/gui/input_action.h
index a0f5cf2c11..c33490ae1d 100644
--- a/scene/gui/input_action.h
+++ b/scene/gui/input_action.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 1db748a6b1..c2d5775b64 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 5de58cfde8..4b896de77c 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 0dec69d9b3..f3a279bada 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/label.h b/scene/gui/label.h
index 769e4b2256..dce68f4422 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 20725194cf..9abf9649c0 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -50,7 +51,7 @@ void LineEdit::_gui_input(InputEvent p_event) {
const InputEventMouseButton &b = p_event.mouse_button;
if (b.pressed && b.button_index == BUTTON_RIGHT) {
- menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 0746547115..a969095947 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index 17e549c902..9cb67b75e2 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/link_button.h b/scene/gui/link_button.h
index 97c2bfc3c8..98a3dc66f6 100644
--- a/scene/gui/link_button.h
+++ b/scene/gui/link_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index b7824e9037..2bc9db529b 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/margin_container.h b/scene/gui/margin_container.h
index 9f0829a34d..1cdb3a36cc 100644
--- a/scene/gui/margin_container.h
+++ b/scene/gui/margin_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index f2e2c9b255..cf468f2257 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -49,10 +50,10 @@ void MenuButton::pressed() {
emit_signal("about_to_show");
Size2 size = get_size();
- Point2 gp = get_global_pos();
- popup->set_global_pos(gp + Size2(0, size.height));
+ Point2 gp = get_global_position();
+ popup->set_global_position(gp + Size2(0, size.height));
popup->set_size(Size2(size.width, 0));
- popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_pos()), get_size()));
+ popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
popup->popup();
popup->call_deferred("grab_click_focus");
popup->set_invalidate_click_until_motion();
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index 4acb62cf37..e07627c07c 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 43f68d92ab..0806d35d48 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -86,7 +87,7 @@ void OptionButton::_selected(int p_which) {
void OptionButton::pressed() {
Size2 size = get_size();
- popup->set_global_pos(get_global_pos() + Size2(0, size.height));
+ popup->set_global_position(get_global_position() + Size2(0, size.height));
popup->set_size(Size2(size.width, 0));
popup->popup();
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index 55a98cb50c..887d199c90 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 536f0baf73..f3c6142f9e 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/panel.h b/scene/gui/panel.h
index 3d2c0a3e98..eac8f2d4e8 100644
--- a/scene/gui/panel.h
+++ b/scene/gui/panel.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 9dc7a6b32e..86874f7cfd 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/panel_container.h b/scene/gui/panel_container.h
index 13ed1c935c..f8f1fb6494 100644
--- a/scene/gui/panel_container.h
+++ b/scene/gui/panel_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp
index d0bd45e435..0c2b94d700 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/patch_9_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -37,27 +38,13 @@ void NinePatchRect::_notification(int p_what) {
if (texture.is_null())
return;
- Size2 s = get_size();
+ Rect2 rect = Rect2(Point2(), get_size());
+ Rect2 src_rect = region_rect;
+
+ texture->get_rect_region(rect, src_rect, rect, src_rect);
+
RID ci = get_canvas_item();
- VS::get_singleton()->canvas_item_add_nine_patch(ci, Rect2(Point2(), s), region_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
- //draw_texture_rect(texture,Rect2(Point2(),s),false,modulate);
-
- /*
- Vector<Point2> points;
- points.resize(4);
- points[0]=Point2(0,0);
- points[1]=Point2(s.x,0);
- points[2]=Point2(s.x,s.y);
- points[3]=Point2(0,s.y);
- Vector<Point2> uvs;
- uvs.resize(4);
- uvs[0]=Point2(0,0);
- uvs[1]=Point2(1,0);
- uvs[2]=Point2(1,1);
- uvs[3]=Point2(0,1);
-
- VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid());
-*/
+ VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
}
}
@@ -116,16 +103,16 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) {
minimum_size_changed();
switch (p_margin) {
case MARGIN_LEFT:
- _change_notify("patch_margin/left");
+ _change_notify("patch_margin_left");
break;
case MARGIN_TOP:
- _change_notify("patch_margin/top");
+ _change_notify("patch_margin_top");
break;
case MARGIN_RIGHT:
- _change_notify("patch_margin/right");
+ _change_notify("patch_margin_right");
break;
case MARGIN_BOTTOM:
- _change_notify("patch_margin/bottom");
+ _change_notify("patch_margin_bottom");
break;
}
}
diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h
index 09663e62f6..ba978f2f81 100644
--- a/scene/gui/patch_9_rect.h
+++ b/scene/gui/patch_9_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 52ad37e9ab..7d0b91a366 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -57,12 +58,12 @@ void Popup::_notification(int p_what) {
void Popup::_fix_size() {
#if 0
- Point2 pos = get_pos();
+ Point2 pos = get_position();
Size2 size = get_size();
Point2 window_size = window==this ? get_parent_area_size() :window->get_size();
#else
- Point2 pos = get_global_pos();
+ Point2 pos = get_global_position();
Size2 size = get_size();
Point2 window_size = get_viewport_rect().size;
@@ -78,10 +79,10 @@ void Popup::_fix_size() {
pos.y = 0;
#if 0
if (pos!=get_pos())
- set_pos(pos);
+ set_position(pos);
#else
- if (pos != get_pos())
- set_global_pos(pos);
+ if (pos != get_position())
+ set_global_position(pos);
#endif
}
@@ -170,7 +171,7 @@ void Popup::popup_centered(const Size2 &p_size) {
rect.size = p_size == Size2() ? get_size() : p_size;
rect.pos = ((window_size - rect.size) / 2.0).floor();
- set_pos(rect.pos);
+ set_position(rect.pos);
set_size(rect.size);
show_modal(exclusive);
@@ -193,7 +194,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
Point2 window_size = get_viewport_rect().size;
rect.size = (window_size * p_screen_ratio).floor();
rect.pos = ((window_size - rect.size) / 2.0).floor();
- set_pos(rect.pos);
+ set_position(rect.pos);
set_size(rect.size);
show_modal(exclusive);
@@ -215,7 +216,7 @@ void Popup::popup(const Rect2 &bounds) {
// Fit the popup into the optionally provided bounds.
if (!bounds.has_no_area()) {
- set_pos(bounds.pos);
+ set_position(bounds.pos);
set_size(bounds.size);
}
_fix_size();
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index d80daaad10..950aa65fa4 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index a2a670fa1f..6ac6eac655 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -168,7 +169,7 @@ void PopupMenu::_activate_submenu(int over) {
if (pm->is_visible_in_tree())
return; //already visible!
- Point2 p = get_global_pos();
+ Point2 p = get_global_position();
Rect2 pr(p, get_size());
Ref<StyleBox> style = get_stylebox("panel");
@@ -178,13 +179,13 @@ void PopupMenu::_activate_submenu(int over) {
if (pos.x + size.width > get_viewport_rect().size.width)
pos.x = p.x - size.width;
- pm->set_pos(pos);
+ pm->set_position(pos);
pm->popup();
PopupMenu *pum = pm->cast_to<PopupMenu>();
if (pum) {
- pr.pos -= pum->get_global_pos();
+ pr.pos -= pum->get_global_position();
pum->clear_autohide_areas();
pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y, pr.size.x, items[over]._ofs_cache));
if (over < items.size() - 1) {
@@ -265,15 +266,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) {
case BUTTON_WHEEL_DOWN: {
- if (get_global_pos().y + get_size().y > get_viewport_rect().size.y) {
+ if (get_global_position().y + get_size().y > get_viewport_rect().size.y) {
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
- Point2 pos = get_pos();
+ Point2 pos = get_position();
int s = (vseparation + font->get_height()) * 3;
pos.y -= s;
- set_pos(pos);
+ set_position(pos);
//update hover
InputEvent ie;
@@ -285,15 +286,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) {
} break;
case BUTTON_WHEEL_UP: {
- if (get_global_pos().y < 0) {
+ if (get_global_position().y < 0) {
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
- Point2 pos = get_pos();
+ Point2 pos = get_position();
int s = (vseparation + font->get_height()) * 3;
pos.y += s;
- set_pos(pos);
+ set_position(pos);
//update hover
InputEvent ie;
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 186d40f6d3..de809f29d3 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 86dea6cd96..13d368d253 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/progress_bar.h b/scene/gui/progress_bar.h
index b5820d1682..1121a78aab 100644
--- a/scene/gui/progress_bar.h
+++ b/scene/gui/progress_bar.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index f15f3a6078..7158592bb1 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -33,7 +34,7 @@ void Range::_value_changed_notify() {
_value_changed(shared->val);
emit_signal("value_changed", shared->val);
update();
- _change_notify("range/value");
+ _change_notify("value");
}
void Range::Shared::emit_value_changed() {
@@ -87,26 +88,26 @@ void Range::set_min(double p_min) {
shared->min = p_min;
set_value(shared->val);
- shared->emit_changed("range/min");
+ shared->emit_changed("min");
}
void Range::set_max(double p_max) {
shared->max = p_max;
set_value(shared->val);
- shared->emit_changed("range/max");
+ shared->emit_changed("max");
}
void Range::set_step(double p_step) {
shared->step = p_step;
- shared->emit_changed("range/step");
+ shared->emit_changed("step");
}
void Range::set_page(double p_page) {
shared->page = p_page;
set_value(shared->val);
- shared->emit_changed("range/page");
+ shared->emit_changed("page");
}
double Range::get_value() const {
diff --git a/scene/gui/range.h b/scene/gui/range.h
index 105bd08a4f..fdcbbb09ee 100644
--- a/scene/gui/range.h
+++ b/scene/gui/range.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index cc38b896d9..400ff299a9 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h
index b64f479829..b118425eb6 100644
--- a/scene/gui/reference_rect.h
+++ b/scene/gui/reference_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 322d9dee20..e5a17298e4 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -125,7 +126,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (cfont.is_null())
cfont = p_base_font;
- //line height should be the font height for the first time, this ensures that an empty line will never have zero height and succesive newlines are displayed
+ //line height should be the font height for the first time, this ensures that an empty line will never have zero height and successive newlines are displayed
int line_height = cfont->get_height();
Variant meta;
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index a5f23d0ba9..05d98b3ee8 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 37f7b46e22..6475371eb9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -705,7 +706,7 @@ void ScrollBar::mouse_motion(const Point2& p_pos, const Point2& p_rel, int b.but
if (value_ofs>(get_max()-get_page()))
value_ofs=get_max()-get_page();
if (get_val()==value_ofs)
- return; //dont bother if the value is the same
+ return; //don't bother if the value is the same
set_val( value_ofs );
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 5227fa45ac..9f035b4901 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index c543b783b9..9146fa9393 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 07b127843a..bbc6d829ef 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index e256b8f928..3b00ab4605 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/separator.h b/scene/gui/separator.h
index 7913531748..9a5fe2ac66 100644
--- a/scene/gui/separator.h
+++ b/scene/gui/separator.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 365d450ed6..d2a2ff7966 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/slider.h b/scene/gui/slider.h
index f649a4d150..61ad76e31e 100644
--- a/scene/gui/slider.h
+++ b/scene/gui/slider.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3f21093fb7..049adc6fb4 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index eba58402fa..338ae875f0 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 5b6f17e0f7..df24fa84d8 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -185,7 +186,7 @@ void SplitContainer::_resort() {
}
update();
- _change_notify("split/offset");
+ _change_notify("split_offset");
}
Size2 SplitContainer::get_minimum_size() const {
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index 8db6bfa658..12722c9f95 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 89769937d4..0c7a58dc16 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -78,11 +79,11 @@ void TabContainer::_gui_input(const InputEvent &p_event) {
if (popup && pos.x > size.width - menu->get_width()) {
emit_signal("pre_popup_pressed");
- Vector2 popup_pos = get_global_pos();
+ Vector2 popup_pos = get_global_position();
popup_pos.x += size.width - popup->get_size().width;
popup_pos.y += menu->get_height();
- popup->set_global_pos(popup_pos);
+ popup->set_global_position(popup_pos);
popup->popup();
return;
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 2594611844..87a99c82b8 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 3197553876..fb27f3b017 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 39811f13c2..2392327206 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 3b7ad910d6..3c8545bd75 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -100,15 +101,15 @@ void TextEdit::Text::set_font(const Ref<Font> &p_font) {
font = p_font;
}
-void TextEdit::Text::set_tab_size(int p_tab_size) {
+void TextEdit::Text::set_indent_size(int p_indent_size) {
- tab_size = p_tab_size;
+ indent_size = p_indent_size;
}
void TextEdit::Text::_update_line_cache(int p_line) const {
int w = 0;
- int tab_w = font->get_char_size(' ').width * tab_size;
+ int tab_w = font->get_char_size(' ').width * indent_size;
int len = text[p_line].data.length();
const CharType *str = text[p_line].data.c_str();
@@ -359,7 +360,7 @@ void TextEdit::_click_selection_held() {
if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) {
- Point2 mp = Input::get_singleton()->get_mouse_pos() - get_global_pos();
+ Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position();
int row, col;
_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
@@ -455,7 +456,7 @@ void TextEdit::_notification(int p_what) {
int visible_rows = get_visible_rows();
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
Color color = cache.font_color;
int in_region = -1;
@@ -812,8 +813,8 @@ void TextEdit::_notification(int p_what) {
keyword_color = *col;
}
- if (select_identifiers_enabled && hilighted_word != String()) {
- if (hilighted_word == range) {
+ if (select_identifiers_enabled && highlighted_word != String()) {
+ if (highlighted_word == range) {
underlined = true;
}
}
@@ -1304,7 +1305,38 @@ void TextEdit::backspace_at_cursor() {
_is_pair_left_symbol(text[cursor.line][cursor.column - 1])) {
_consume_backspace_for_pair_symbol(prev_line, prev_column);
} else {
- _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ // handle space indentation
+ if (cursor.column - indent_size >= 0 && indent_using_spaces) {
+
+ // if there is enough spaces to count as a tab
+ bool unindent = true;
+ for (int i = 1; i <= indent_size; i++) {
+ if (text[cursor.line][cursor.column - i] != ' ') {
+ unindent = false;
+ break;
+ }
+ }
+
+ // and it is before the first character
+ int i = 0;
+ while (i < cursor.column && i < text[cursor.line].length()) {
+ if (text[cursor.line][i] != ' ' && text[cursor.line][i] != '\t') {
+ unindent = false;
+ break;
+ }
+ i++;
+ }
+
+ // then we can remove it as a single character.
+ if (unindent) {
+ _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column);
+ prev_column = cursor.column - indent_size;
+ } else {
+ _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ }
+ } else {
+ _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ }
}
cursor_set_line(prev_line);
@@ -1327,7 +1359,11 @@ void TextEdit::indent_selection_right() {
for (int i = start_line; i <= end_line; i++) {
String line_text = get_line(i);
- line_text = '\t' + line_text;
+ if (indent_using_spaces) {
+ line_text = space_indent + line_text;
+ } else {
+ line_text = '\t' + line_text;
+ }
set_line(i, line_text);
}
@@ -1358,8 +1394,8 @@ void TextEdit::indent_selection_left() {
if (line_text.begins_with("\t")) {
line_text = line_text.substr(1, line_text.length());
set_line(i, line_text);
- } else if (line_text.begins_with(" ")) {
- line_text = line_text.substr(4, line_text.length());
+ } else if (line_text.begins_with(space_indent)) {
+ line_text = line_text.substr(indent_size, line_text.length());
set_line(i, line_text);
}
}
@@ -1463,9 +1499,9 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
int row, col;
_get_mouse_pos(Point2i(mb.x, mb.y), row, col);
- if (mb.mod.command && hilighted_word != String()) {
+ if (mb.mod.command && highlighted_word != String()) {
- emit_signal("symbol_lookup", hilighted_word, row, col);
+ emit_signal("symbol_lookup", highlighted_word, row, col);
return;
}
@@ -1585,7 +1621,7 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (mb.button_index == BUTTON_RIGHT && context_menu_enabled) {
- menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -1608,13 +1644,13 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (mm.mod.command && mm.button_mask == 0) {
String new_word = get_word_at_pos(Vector2(mm.x, mm.y));
- if (new_word != hilighted_word) {
- hilighted_word = new_word;
+ if (new_word != highlighted_word) {
+ highlighted_word = new_word;
update();
}
} else {
- if (hilighted_word != String()) {
- hilighted_word = String();
+ if (highlighted_word != String()) {
+ highlighted_word = String();
update();
}
}
@@ -1655,11 +1691,11 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (k.pressed) {
- hilighted_word = get_word_at_pos(get_local_mouse_pos());
+ highlighted_word = get_word_at_pos(get_local_mouse_pos());
update();
} else {
- hilighted_word = String();
+ highlighted_word = String();
update();
}
}
@@ -1930,17 +1966,39 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
String ins = "\n";
//keep indentation
+ int space_count = 0;
for (int i = 0; i < text[cursor.line].length(); i++) {
- if (text[cursor.line][i] == '\t')
- ins += "\t";
- else
+ if (text[cursor.line][i] == '\t') {
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
+ space_count = 0;
+ } else if (text[cursor.line][i] == ' ') {
+ space_count++;
+
+ if (space_count == indent_size) {
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
+ space_count = 0;
+ }
+ } else {
break;
+ }
}
if (auto_indent) {
// indent once again if previous line will end with ':'
// (i.e. colon precedes current cursor position)
if (cursor.column > 0 && text[cursor.line][cursor.column - 1] == ':') {
- ins += "\t";
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
}
}
@@ -1986,15 +2044,36 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
} else {
if (k.mod.shift) {
+ //simple unindent
int cc = cursor.column;
- if (cc > 0 && cc <= text[cursor.line].length() && text[cursor.line][cursor.column - 1] == '\t') {
- //simple unindent
+ if (cc > 0 && cc <= text[cursor.line].length()) {
+ if (text[cursor.line][cursor.column - 1] == '\t') {
+ backspace_at_cursor();
+ } else {
+ if (cursor.column - indent_size >= 0) {
+
+ bool unindent = true;
+ for (int i = 1; i <= indent_size; i++) {
+ if (text[cursor.line][cursor.column - i] != ' ') {
+ unindent = false;
+ break;
+ }
+ }
- backspace_at_cursor();
+ if (unindent) {
+ _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column);
+ cursor_set_column(cursor.column - indent_size);
+ }
+ }
+ }
}
} else {
//simple indent
- _insert_text_at_cursor("\t");
+ if (indent_using_spaces) {
+ _insert_text_at_cursor(space_indent);
+ } else {
+ _insert_text_at_cursor("\t");
+ }
}
}
@@ -3102,7 +3181,7 @@ int TextEdit::get_char_pos_for(int p_px, String p_str) const {
int px = 0;
int c = 0;
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
while (c < p_str.length()) {
@@ -3134,7 +3213,7 @@ int TextEdit::get_column_x_offset(int p_char, String p_str) {
int px = 0;
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
for (int i = 0; i < p_char; i++) {
@@ -3174,7 +3253,7 @@ void TextEdit::insert_text_at_cursor(const String &p_text) {
}
Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
- if (hilighted_word != String())
+ if (highlighted_word != String())
return CURSOR_POINTING_HAND;
int gutter = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width;
@@ -3951,10 +4030,24 @@ void TextEdit::_push_current_op() {
current_op.chain_forward = false;
}
-void TextEdit::set_tab_size(const int p_size) {
+void TextEdit::set_indent_using_spaces(const bool p_use_spaces) {
+ indent_using_spaces = p_use_spaces;
+}
+
+bool TextEdit::is_indent_using_spaces() const {
+ return indent_using_spaces;
+}
+
+void TextEdit::set_indent_size(const int p_size) {
ERR_FAIL_COND(p_size <= 0);
- tab_size = p_size;
- text.set_tab_size(p_size);
+ indent_size = p_size;
+ text.set_indent_size(p_size);
+
+ space_indent = "";
+ for (int i = 0; i < p_size; i++) {
+ space_indent += " ";
+ }
+
update();
}
@@ -4447,8 +4540,8 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_text"), &TextEdit::get_text);
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
- ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport"), &TextEdit::cursor_set_line, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport"), &TextEdit::cursor_set_line, DEFVAL(true));
ClassDB::bind_method(D_METHOD("cursor_get_column"), &TextEdit::cursor_get_column);
ClassDB::bind_method(D_METHOD("cursor_get_line"), &TextEdit::cursor_get_line);
@@ -4541,8 +4634,8 @@ TextEdit::TextEdit() {
cache.breakpoint_gutter_width = 0;
breakpoint_gutter_width = 0;
- tab_size = 4;
- text.set_tab_size(tab_size);
+ indent_size = 4;
+ text.set_indent_size(indent_size);
text.clear();
//text.insert(1,"Mongolia..");
//text.insert(2,"PAIS GENEROSO!!");
@@ -4630,6 +4723,8 @@ TextEdit::TextEdit() {
auto_brace_completion_enabled = false;
brace_matching_enabled = false;
highlight_all_occurrences = false;
+ indent_using_spaces = false;
+ space_indent = " ";
auto_indent = false;
insert_mode = false;
window_has_focus = true;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index e38d484b0d..905ea46bd7 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -140,12 +141,12 @@ class TextEdit : public Control {
const Vector<ColorRegion> *color_regions;
mutable Vector<Line> text;
Ref<Font> font;
- int tab_size;
+ int indent_size;
void _update_line_cache(int p_line) const;
public:
- void set_tab_size(int p_tab_size);
+ void set_indent_size(int p_indent_size);
void set_font(const Ref<Font> &p_font);
void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
int get_line_width(int p_line) const;
@@ -162,7 +163,7 @@ class TextEdit : public Control {
void clear();
void clear_caches();
_FORCE_INLINE_ const String &operator[](int p_line) const { return text[p_line].data; }
- Text() { tab_size = 4; }
+ Text() { indent_size = 4; }
};
struct TextOperation {
@@ -220,7 +221,9 @@ class TextEdit : public Control {
int max_chars;
bool readonly;
bool syntax_coloring;
- int tab_size;
+ bool indent_using_spaces;
+ int indent_size;
+ String space_indent;
Timer *caret_blink_timer;
bool caret_blink_enabled;
@@ -252,7 +255,7 @@ class TextEdit : public Control {
bool raised_from_completion;
- String hilighted_word;
+ String highlighted_word;
uint64_t last_dblclk;
@@ -460,7 +463,9 @@ public:
void redo();
void clear_undo_history();
- void set_tab_size(const int p_size);
+ void set_indent_using_spaces(const bool p_use_spaces);
+ bool is_indent_using_spaces() const;
+ void set_indent_size(const int p_size);
void set_draw_tabs(bool p_draw);
bool is_drawing_tabs() const;
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 54f09cbf68..33d9b76b70 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index fc5079dbf9..9c31912a32 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 914d17d2dc..081c7ddb73 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress.h
index 0d9b5e6b1a..c0c2779cf9 100644
--- a/scene/gui/texture_progress.h
+++ b/scene/gui/texture_progress.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp
index ea35ee8b52..92a3db6a74 100644
--- a/scene/gui/texture_rect.cpp
+++ b/scene/gui/texture_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h
index 2cc6b97b13..dcc6c3f9bd 100644
--- a/scene/gui/texture_rect.h
+++ b/scene/gui/texture_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tool_button.cpp b/scene/gui/tool_button.cpp
index 817b506f10..5fc4b6ecf8 100644
--- a/scene/gui/tool_button.cpp
+++ b/scene/gui/tool_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tool_button.h b/scene/gui/tool_button.h
index 02d2bfaef1..d243b5559f 100644
--- a/scene/gui/tool_button.h
+++ b/scene/gui/tool_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index d63ef41239..bc7b7485d8 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
@@ -1040,7 +1041,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
cache.selected->draw(ci, r);
}
if (text_editor->is_visible_in_tree()) {
- text_editor->set_pos(get_global_pos() + r.pos);
+ text_editor->set_position(get_global_position() + r.pos);
}
}
@@ -1502,7 +1503,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
cache.click_id = c.buttons[j].id;
cache.click_item = p_item;
cache.click_column = col;
- cache.click_pos = get_global_mouse_pos() - get_global_pos();
+ cache.click_pos = get_global_mouse_position() - get_global_position();
update();
//emit_signal("button_pressed");
return -1;
@@ -1626,7 +1627,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
}
popup_menu->set_size(Size2(col_width, 0));
- popup_menu->set_pos(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset);
+ popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset);
popup_menu->popup();
popup_edited_item = p_item;
popup_edited_item_col = col;
@@ -1692,7 +1693,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
case TreeItem::CELL_MODE_CUSTOM: {
edited_item = p_item;
edited_col = col;
- custom_popup_rect = Rect2i(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
+ custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2))));
bring_up_editor = false;
@@ -1709,7 +1710,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
popup_edited_item = p_item;
popup_edited_item_col = col;
- pressing_item_rect = Rect2(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h));
+ pressing_item_rect = Rect2(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h));
pressing_for_editor_text = editor_text;
pressing_for_editor = true;
@@ -2378,7 +2379,7 @@ bool Tree::edit_selected() {
edited_item = s;
edited_col = col;
- custom_popup_rect = Rect2i(get_global_pos() + rect.pos, rect.size);
+ custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size);
emit_signal("custom_popup_edited", false);
item_edited(col, s);
@@ -2393,7 +2394,7 @@ bool Tree::edit_selected() {
}
popup_menu->set_size(Size2(rect.size.width, 0));
- popup_menu->set_pos(get_global_pos() + rect.pos + Point2i(0, rect.size.height));
+ popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height));
popup_menu->popup();
popup_edited_item = s;
popup_edited_item_col = col;
@@ -2401,8 +2402,8 @@ bool Tree::edit_selected() {
} else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
- Point2i textedpos = get_global_pos() + rect.pos;
- text_editor->set_pos(textedpos);
+ Point2i textedpos = get_global_position() + rect.pos;
+ text_editor->set_position(textedpos);
text_editor->set_size(rect.size);
text_editor->clear();
text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step)));
@@ -2410,7 +2411,7 @@ bool Tree::edit_selected() {
if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
- value_editor->set_pos(textedpos + Point2i(0, text_editor->get_size().height));
+ value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height));
value_editor->set_size(Size2(rect.size.width, 1));
value_editor->show_modal();
updating_value_editor = true;
@@ -2528,7 +2529,7 @@ void Tree::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAG_BEGIN) {
single_select_defer = NULL;
- if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) {
+ if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) {
scrolling = true;
set_fixed_process(true);
}
@@ -2576,7 +2577,7 @@ void Tree::_notification(int p_what) {
}
if (scrolling) {
- Point2 point = get_viewport()->get_mouse_pos() - get_global_pos();
+ Point2 point = get_viewport()->get_mouse_position() - get_global_position();
if (point.x < cache.scroll_border) {
point.x -= cache.scroll_border;
} else if (point.x > get_size().width - cache.scroll_border) {
@@ -2912,7 +2913,7 @@ int Tree::get_column_width(int p_column) const {
if (expand_area < expanding_total)
return columns[p_column].min_width;
- ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldnt happen
+ ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldn't happen
return expand_area * columns[p_column].min_width / expanding_total;
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 68d4453156..3830c3e8ca 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 433cc546a6..e1a149d801 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index 4f2894cdc2..c3a839c514 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp
index 93789d945d..dbc2699867 100644
--- a/scene/gui/viewport_container.cpp
+++ b/scene/gui/viewport_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */
diff --git a/scene/gui/viewport_container.h b/scene/gui/viewport_container.h
index 96b352b1cc..27eb6ec81b 100644
--- a/scene/gui/viewport_container.h
+++ b/scene/gui/viewport_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 */