summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp7
-rw-r--r--scene/gui/base_button.h1
-rw-r--r--scene/gui/box_container.cpp1
-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/center_container.cpp1
-rw-r--r--scene/gui/center_container.h1
-rw-r--r--scene/gui/check_box.cpp3
-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.cpp1
-rw-r--r--scene/gui/color_picker.h1
-rw-r--r--scene/gui/color_rect.cpp1
-rw-r--r--scene/gui/color_rect.h1
-rw-r--r--scene/gui/container.cpp1
-rw-r--r--scene/gui/container.h1
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/gui/control.h1
-rw-r--r--scene/gui/dialogs.cpp1
-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/gradient_edit.cpp3
-rw-r--r--scene/gui/gradient_edit.h14
-rw-r--r--scene/gui/graph_edit.cpp1
-rw-r--r--scene/gui/graph_edit.h3
-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/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.cpp1
-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.cpp1
-rw-r--r--scene/gui/menu_button.h1
-rw-r--r--scene/gui/nine_patch_rect.cpp1
-rw-r--r--scene/gui/nine_patch_rect.h1
-rw-r--r--scene/gui/option_button.cpp1
-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/popup.cpp1
-rw-r--r--scene/gui/popup.h1
-rw-r--r--scene/gui/popup_menu.cpp63
-rw-r--r--scene/gui/popup_menu.h2
-rw-r--r--scene/gui/progress_bar.cpp1
-rw-r--r--scene/gui/progress_bar.h1
-rw-r--r--scene/gui/range.cpp1
-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.cpp1
-rw-r--r--scene/gui/rich_text_label.h1
-rw-r--r--scene/gui/scroll_bar.cpp1
-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/shortcut.cpp1
-rw-r--r--scene/gui/shortcut.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.cpp1
-rw-r--r--scene/gui/split_container.h1
-rw-r--r--scene/gui/tab_container.cpp1
-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.cpp18
-rw-r--r--scene/gui/text_edit.h1
-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.cpp6
-rw-r--r--scene/gui/tree.h1
-rw-r--r--scene/gui/video_player.cpp9
-rw-r--r--scene/gui/video_player.h3
-rw-r--r--scene/gui/viewport_container.cpp1
-rw-r--r--scene/gui/viewport_container.h1
98 files changed, 158 insertions, 65 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 41ff000ac1..d765248cca 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "base_button.h"
#include "os/keyboard.h"
@@ -538,15 +539,15 @@ BaseButton::BaseButton() {
set_focus_mode(FOCUS_ALL);
enabled_focus_mode = FOCUS_ALL;
action_mode = ACTION_MODE_BUTTON_RELEASE;
+}
+
+BaseButton::~BaseButton() {
if (button_group.is_valid()) {
button_group->buttons.erase(this);
}
}
-BaseButton::~BaseButton() {
-}
-
void ButtonGroup::get_buttons(List<BaseButton *> *r_buttons) {
for (Set<BaseButton *>::Element *E = buttons.front(); E; E = E->next()) {
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 00c9fe959c..9e0e1493d1 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef BASE_BUTTON_H
#define BASE_BUTTON_H
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index b7f1dbaa70..12b9fe7c03 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "box_container.h"
#include "label.h"
#include "margin_container.h"
diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h
index b22b3e28e3..abc228f804 100644
--- a/scene/gui/box_container.h
+++ b/scene/gui/box_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef BOX_CONTAINER_H
#define BOX_CONTAINER_H
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index d5715d63b6..03b25a138f 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "button.h"
#include "print_string.h"
#include "servers/visual_server.h"
diff --git a/scene/gui/button.h b/scene/gui/button.h
index b3645fff7a..0b41b14f02 100644
--- a/scene/gui/button.h
+++ b/scene/gui/button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef BUTTON_H
#define BUTTON_H
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index bf9ca69be4..cf71f89830 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "center_container.h"
Size2 CenterContainer::get_minimum_size() const {
diff --git a/scene/gui/center_container.h b/scene/gui/center_container.h
index 97912b11c7..519e1493ec 100644
--- a/scene/gui/center_container.h
+++ b/scene/gui/center_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef CENTER_CONTAINER_H
#define CENTER_CONTAINER_H
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index 73db240468..0790f87ea7 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* check_button.cpp */
+/* check_box.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "check_box.h"
#include "servers/visual_server.h"
diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h
index e7358c1fb2..8375b46ca0 100644
--- a/scene/gui/check_box.h
+++ b/scene/gui/check_box.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef CHECK_BOX_H
#define CHECK_BOX_H
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index dbafcd4353..f9ed0ecdbb 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "check_button.h"
#include "print_string.h"
diff --git a/scene/gui/check_button.h b/scene/gui/check_button.h
index 8cf927de9b..a11749e3f6 100644
--- a/scene/gui/check_button.h
+++ b/scene/gui/check_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef CHECK_BUTTON_H
#define CHECK_BUTTON_H
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 63478886c6..08a39e9e79 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "color_picker.h"
#include "os/input.h"
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 1f6a8fb1bb..01ae1cc464 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef COLOR_PICKER_H
#define COLOR_PICKER_H
diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp
index d212ba9416..463f3911dc 100644
--- a/scene/gui/color_rect.cpp
+++ b/scene/gui/color_rect.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "color_rect.h"
void ColorRect::set_frame_color(const Color &p_color) {
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
index 747ae72997..a841008f76 100644
--- a/scene/gui/color_rect.h
+++ b/scene/gui/color_rect.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef COLOR_RECT_H
#define COLOR_RECT_H
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 20616d5dd8..7cb0ad5707 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "container.h"
#include "message_queue.h"
#include "scene/scene_string_names.h"
diff --git a/scene/gui/container.h b/scene/gui/container.h
index 2b9910dcf5..c472162f58 100644
--- a/scene/gui/container.h
+++ b/scene/gui/container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef CONTAINER_H
#define CONTAINER_H
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 6072653c54..979a65f455 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "control.h"
#include "project_settings.h"
#include "scene/main/canvas_layer.h"
@@ -860,6 +861,8 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
class_name = ClassDB::get_parent_class_nocheck(class_name);
}
+ class_name = type;
+
Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
if (parent)
@@ -868,8 +871,6 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
theme_owner = NULL;
}
- class_name = type;
-
while (class_name != StringName()) {
if (Theme::get_default()->has_stylebox(p_name, class_name))
return Theme::get_default()->get_stylebox(p_name, class_name);
@@ -2154,6 +2155,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) {
data.theme = p_theme;
if (!p_theme.is_null()) {
+ data.theme_owner = this;
_propagate_theme_changed(this, this);
} else {
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 8da40e7d3f..2d61ecb2af 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef CONTROL_H
#define CONTROL_H
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index a2cf0c951f..d9737fa21a 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "dialogs.h"
#include "line_edit.h"
#include "print_string.h"
diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h
index c4cde8ef22..e61ede7c3d 100644
--- a/scene/gui/dialogs.h
+++ b/scene/gui/dialogs.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef DIALOGS_H
#define DIALOGS_H
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 7bf06bc8c2..c4b2685012 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "file_dialog.h"
#include "os/keyboard.h"
#include "print_string.h"
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 04f004bf47..2a09494682 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef FILE_DIALOG_H
#define FILE_DIALOG_H
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 10cbac7d40..3985039716 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* color_ramp_edit.cpp */
+/* gradient_edit.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "gradient_edit.h"
#include "os/keyboard.h"
diff --git a/scene/gui/gradient_edit.h b/scene/gui/gradient_edit.h
index 5471b0a769..e7834ea0de 100644
--- a/scene/gui/gradient_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* color_ramp_edit.h */
+/* gradient_edit.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,8 +27,9 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef SCENE_GUI_COLOR_RAMP_EDIT_H_
-#define SCENE_GUI_COLOR_RAMP_EDIT_H_
+
+#ifndef GRADIENT_EDIT_H
+#define GRADIENT_EDIT_H
#include "scene/gui/color_picker.h"
#include "scene/gui/popup.h"
@@ -72,9 +73,4 @@ public:
virtual ~GradientEdit();
};
-/*class ColorRampEditPanel : public Panel
-{
- GDCLASS(ColorRampEditPanel, Panel );
-};*/
-
-#endif /* SCENE_GUI_COLOR_RAMP_EDIT_H_ */
+#endif // GRADIENT_EDIT_H
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index d0ab77ecf8..b8451d2f10 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "graph_edit.h"
#include "os/input.h"
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index d307765bc0..3bfde44854 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* graph_edit.cpp */
+/* graph_edit.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef GRAPH_EDIT_H
#define GRAPH_EDIT_H
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 12aa79bf65..c5d5da1219 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "graph_node.h"
#include "method_bind_ext.gen.inc"
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 13ef533134..20d25a69b0 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef GRAPH_NODE_H
#define GRAPH_NODE_H
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index a0d9b5f5ff..8c3f835be3 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "grid_container.h"
void GridContainer::_notification(int p_what) {
diff --git a/scene/gui/grid_container.h b/scene/gui/grid_container.h
index c52f8230b0..243d06f034 100644
--- a/scene/gui/grid_container.h
+++ b/scene/gui/grid_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef GRID_CONTAINER_H
#define GRID_CONTAINER_H
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 5a4a0b2106..3b3d7164b6 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "item_list.h"
#include "os/os.h"
#include "project_settings.h"
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index e56d5e5224..24e9498044 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef ITEMLIST_H
#define ITEMLIST_H
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index be065bc0fb..0a1d42c5e1 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "label.h"
#include "print_string.h"
#include "project_settings.h"
diff --git a/scene/gui/label.h b/scene/gui/label.h
index 160eb66e53..d5e0b60773 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef LABEL_H
#define LABEL_H
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index dff7722a9e..53f609723f 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "line_edit.h"
#include "label.h"
#include "os/keyboard.h"
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index f57fde2525..e15980d3c4 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef LINE_EDIT_H
#define LINE_EDIT_H
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index dca83dc31f..d862e8669c 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "link_button.h"
void LinkButton::set_text(const String &p_text) {
diff --git a/scene/gui/link_button.h b/scene/gui/link_button.h
index 610f481e4e..0821ad9c0d 100644
--- a/scene/gui/link_button.h
+++ b/scene/gui/link_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef LINKBUTTON_H
#define LINKBUTTON_H
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 97cc16c22d..5e1d53fe1d 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "margin_container.h"
Size2 MarginContainer::get_minimum_size() const {
diff --git a/scene/gui/margin_container.h b/scene/gui/margin_container.h
index 443e0769bc..ea75109248 100644
--- a/scene/gui/margin_container.h
+++ b/scene/gui/margin_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef MARGIN_CONTAINER_H
#define MARGIN_CONTAINER_H
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index caf3b90fa1..d25bd00f37 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "menu_button.h"
#include "os/keyboard.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index bfe168adf7..2356444ecb 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef MENU_BUTTON_H
#define MENU_BUTTON_H
diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp
index 0e753675f7..b8f6ffe6d2 100644
--- a/scene/gui/nine_patch_rect.cpp
+++ b/scene/gui/nine_patch_rect.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "nine_patch_rect.h"
#include "servers/visual_server.h"
diff --git a/scene/gui/nine_patch_rect.h b/scene/gui/nine_patch_rect.h
index dc6c5c8a28..b4b4602a7d 100644
--- a/scene/gui/nine_patch_rect.h
+++ b/scene/gui/nine_patch_rect.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef NINE_PATCH_RECT_H
#define NINE_PATCH_RECT_H
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index a447889971..ba35e6cd19 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "option_button.h"
#include "print_string.h"
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index c2854e9d1a..f65fa1b631 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef OPTION_BUTTON_H
#define OPTION_BUTTON_H
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 28a221b63e..4375e03a50 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "panel.h"
#include "print_string.h"
diff --git a/scene/gui/panel.h b/scene/gui/panel.h
index 8641be4423..db8b35372e 100644
--- a/scene/gui/panel.h
+++ b/scene/gui/panel.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef PANEL_H
#define PANEL_H
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 9d73b82952..a778d62659 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "panel_container.h"
Size2 PanelContainer::get_minimum_size() const {
diff --git a/scene/gui/panel_container.h b/scene/gui/panel_container.h
index 0a412cb091..267e2b921f 100644
--- a/scene/gui/panel_container.h
+++ b/scene/gui/panel_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef PANEL_CONTAINER_H
#define PANEL_CONTAINER_H
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 73bf867c37..d18a3a3f2f 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "popup.h"
#include "engine.h"
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index efe2ee88c2..550e803578 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef POPUP_H
#define POPUP_H
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 7999f50013..cf01ce8643 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "popup_menu.h"
#include "os/input.h"
#include "os/keyboard.h"
@@ -122,8 +123,7 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
for (int i = 0; i < items.size(); i++) {
- if (i > 0)
- ofs.y += vseparation;
+ ofs.y += vseparation;
float h;
if (!items[i].icon.is_null()) {
@@ -189,6 +189,26 @@ void PopupMenu::_submenu_timeout() {
submenu_over = -1;
}
+void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
+
+ const float global_y = get_global_position().y;
+
+ int vseparation = get_constant("vseparation");
+ Ref<Font> font = get_font("font");
+
+ float dy = (vseparation + font->get_height()) * 3 * p_factor;
+ if (dy > 0 && global_y < 0)
+ dy = MIN(dy, -global_y - 1);
+ else if (dy < 0 && global_y + get_size().y > get_viewport_rect().size.y)
+ dy = -MIN(-dy, global_y + get_size().y - get_viewport_rect().size.y - 1);
+ set_position(get_position() + Vector2(0, dy));
+
+ Ref<InputEventMouseMotion> ie;
+ ie.instance();
+ ie->set_position(p_over - Vector2(0, dy));
+ _gui_input(ie);
+}
+
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
@@ -286,39 +306,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
case BUTTON_WHEEL_DOWN: {
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_position();
- int s = (vseparation + font->get_height()) * 3;
- pos.y -= (s * b->get_factor());
- set_position(pos);
-
- //update hover
- Ref<InputEventMouseMotion> ie;
- ie.instance();
- ie->set_position(b->get_position() + Vector2(0, s));
- _gui_input(ie);
+ _scroll(-b->get_factor(), b->get_position());
}
} break;
case BUTTON_WHEEL_UP: {
if (get_global_position().y < 0) {
-
- int vseparation = get_constant("vseparation");
- Ref<Font> font = get_font("font");
-
- Point2 pos = get_position();
- int s = (vseparation + font->get_height()) * 3;
- pos.y += (s * b->get_factor());
- set_position(pos);
-
- //update hover
- Ref<InputEventMouseMotion> ie;
- ie.instance();
- ie->set_position(b->get_position() - Vector2(0, s));
- _gui_input(ie);
+ _scroll(b->get_factor(), b->get_position());
}
} break;
case BUTTON_LEFT: {
@@ -387,6 +381,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
update();
}
}
+
+ Ref<InputEventPanGesture> pan_gesture = p_event;
+ if (pan_gesture.is_valid()) {
+ if (get_global_position().y + get_size().y > get_viewport_rect().size.y || get_global_position().y < 0) {
+ _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position());
+ }
+ }
}
bool PopupMenu::has_point(const Point2 &p_point) const {
@@ -459,7 +460,7 @@ void PopupMenu::_notification(int p_what) {
if (i == mouse_over) {
- hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation * 2)));
+ hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation)));
}
if (items[i].separator) {
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index f51ba81c89..60f36e95ec 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef POPUP_MENU_H
#define POPUP_MENU_H
@@ -83,6 +84,7 @@ class PopupMenu : public Popup {
String _get_accel_text(int p_item) const;
int _get_mouse_over(const Point2 &p_over) const;
virtual Size2 get_minimum_size() const;
+ void _scroll(float p_factor, const Point2 &p_over);
void _gui_input(const Ref<InputEvent> &p_event);
void _activate_submenu(int over);
void _submenu_timeout();
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 505068f155..c85bed0451 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "progress_bar.h"
Size2 ProgressBar::get_minimum_size() const {
diff --git a/scene/gui/progress_bar.h b/scene/gui/progress_bar.h
index f7b2a194ba..d091c983b1 100644
--- a/scene/gui/progress_bar.h
+++ b/scene/gui/progress_bar.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef PROGRESS_BAR_H
#define PROGRESS_BAR_H
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index b1a33906d2..a74a577898 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "range.h"
void Range::_value_changed_notify() {
diff --git a/scene/gui/range.h b/scene/gui/range.h
index 521ce412cf..de9383afd8 100644
--- a/scene/gui/range.h
+++ b/scene/gui/range.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RANGE_H
#define RANGE_H
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 1b25965dab..5e25f43daf 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "reference_rect.h"
#include "engine.h"
diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h
index 3a062f1b6b..473e348c85 100644
--- a/scene/gui/reference_rect.h
+++ b/scene/gui/reference_rect.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef REFERENCE_RECT_H
#define REFERENCE_RECT_H
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index bf048ea1b6..49618d0138 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "rich_text_label.h"
#include "os/keyboard.h"
#include "os/os.h"
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index c942ecc00f..48f746e28d 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef RICH_TEXT_LABEL_H
#define RICH_TEXT_LABEL_H
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 3ac1ba0e48..d54500bc51 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "scroll_bar.h"
#include "os/keyboard.h"
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 9d0dc3ccbc..15e037f8bb 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SCROLL_BAR_H
#define SCROLL_BAR_H
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 42745a7042..1e324a303e 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "scroll_container.h"
#include "os/os.h"
bool ScrollContainer::clips_input() const {
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 997d03cbf2..6e3387918b 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SCROLL_CONTAINER_H
#define SCROLL_CONTAINER_H
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index f65d51cf86..cd0b06da81 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "separator.h"
Size2 Separator::get_minimum_size() const {
diff --git a/scene/gui/separator.h b/scene/gui/separator.h
index 985ccce31d..7949c7ca9b 100644
--- a/scene/gui/separator.h
+++ b/scene/gui/separator.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SEPARATOR_H
#define SEPARATOR_H
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 4f32786854..36490cf254 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "shortcut.h"
#include "os/keyboard.h"
diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h
index 1d5bfc8bd9..f9240642bf 100644
--- a/scene/gui/shortcut.h
+++ b/scene/gui/shortcut.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SHORTCUT_H
#define SHORTCUT_H
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 37b4d30e3c..a7a1b499c3 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "slider.h"
#include "os/keyboard.h"
diff --git a/scene/gui/slider.h b/scene/gui/slider.h
index c380ab25a5..e77a0b7423 100644
--- a/scene/gui/slider.h
+++ b/scene/gui/slider.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SLIDER_H
#define SLIDER_H
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 76bcde01af..3c5d524d80 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "spin_box.h"
#include "os/input.h"
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index ab969556d9..b8565ec082 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SPIN_BOX_H
#define SPIN_BOX_H
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index d0b7537665..e1d49019b3 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "split_container.h"
#include "label.h"
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index 2f3e480434..a31dc766d2 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef SPLIT_CONTAINER_H
#define SPLIT_CONTAINER_H
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index d00e360642..0312e58094 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "tab_container.h"
#include "message_queue.h"
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 7374fc2d77..0ba8c205ea 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TAB_CONTAINER_H
#define TAB_CONTAINER_H
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 3ab031a2ea..ba808566e1 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "tabs.h"
#include "message_queue.h"
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index ffc0944829..246b3cba67 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TABS_H
#define TABS_H
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 87043c65eb..a3f59b54fc 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "text_edit.h"
#include "message_queue.h"
@@ -1746,15 +1747,15 @@ void TextEdit::indent_left() {
void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) const {
float rows = p_mouse.y;
- rows -= cache.style_normal->get_margin(MARGIN_TOP);
rows /= get_row_height();
- int lsp = get_line_scroll_pos(true);
- int row = cursor.line_ofs + (rows + (round(v_scroll->get_value()) - lsp));
+ rows += v_scroll->get_value();
+ int row = Math::floor(rows);
if (is_hiding_enabled()) {
// row will be offset by the hidden rows
- int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(rows + 1, text.size() - cursor.line_ofs)) - 1;
- row = cursor.line_ofs + (f_ofs + (round(v_scroll->get_value()) - lsp));
+ int lsp = get_line_scroll_pos(true);
+ int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(row + 1 - cursor.line_ofs, text.size() - cursor.line_ofs)) - 1;
+ row = cursor.line_ofs + f_ofs;
row = CLAMP(row, 0, text.size() - num_lines_from(text.size() - 1, -1));
}
@@ -3640,9 +3641,10 @@ void TextEdit::center_viewport_to_cursor() {
int visible_rows = get_visible_rows();
if (h_scroll->is_visible_in_tree())
visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
-
- int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : num_lines_from(text.size() - 1, -visible_rows));
- cursor.line_ofs = CLAMP(cursor.line - num_lines_from(cursor.line - visible_rows / 2, -visible_rows / 2), 0, max_ofs);
+ if (text.size() >= visible_rows) {
+ int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : MAX(num_lines_from(text.size() - 1, -visible_rows), 0));
+ cursor.line_ofs = CLAMP(cursor.line - num_lines_from(MAX(cursor.line - visible_rows / 2, 0), -visible_rows / 2), 0, max_ofs);
+ }
int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
if (cursor_x > (cursor.x_ofs + visible_width))
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index ccd7ba8278..88121a06f0 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TEXT_EDIT_H
#define TEXT_EDIT_H
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index ec77fae1fa..07c9894611 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "texture_button.h"
Size2 TextureButton::get_minimum_size() const {
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index c6b05703ed..1cf4b66413 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TEXTURE_BUTTON_H
#define TEXTURE_BUTTON_H
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 5f0c7f7385..01b00c34ea 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "texture_progress.h"
#include "engine.h"
diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress.h
index ab1f42fe3b..77c3980e29 100644
--- a/scene/gui/texture_progress.h
+++ b/scene/gui/texture_progress.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TEXTURE_PROGRESS_H
#define TEXTURE_PROGRESS_H
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp
index 5b689cfce2..f4285525f6 100644
--- a/scene/gui/texture_rect.cpp
+++ b/scene/gui/texture_rect.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "texture_rect.h"
#include "servers/visual_server.h"
diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h
index b6ccdff217..b684ac816c 100644
--- a/scene/gui/texture_rect.h
+++ b/scene/gui/texture_rect.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TEXTURE_FRAME_H
#define TEXTURE_FRAME_H
diff --git a/scene/gui/tool_button.cpp b/scene/gui/tool_button.cpp
index e86776af90..4220a6b5ce 100644
--- a/scene/gui/tool_button.cpp
+++ b/scene/gui/tool_button.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "tool_button.h"
ToolButton::ToolButton() {
diff --git a/scene/gui/tool_button.h b/scene/gui/tool_button.h
index 14a7cdc2fe..b8be18e560 100644
--- a/scene/gui/tool_button.h
+++ b/scene/gui/tool_button.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TOOL_BUTTON_H
#define TOOL_BUTTON_H
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index b1a421c24f..fd5a47d875 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "tree.h"
#include <limits.h>
@@ -915,6 +916,7 @@ int Tree::compute_item_height(TreeItem *p_item) const {
if (p_item == root && hide_root)
return 0;
+ ERR_FAIL_COND_V(cache.font.is_null(), 0);
int height = cache.font->get_height();
for (int i = 0; i < columns.size(); i++) {
@@ -988,6 +990,8 @@ int Tree::get_item_height(TreeItem *p_item) const {
void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color) {
+ ERR_FAIL_COND(cache.font.is_null());
+
Rect2i rect = p_rect;
Ref<Font> font = cache.font;
String text = p_cell.text;
@@ -1057,6 +1061,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
//draw separation.
//if (p_item->get_parent()!=root || !hide_root)
+ ERR_FAIL_COND_V(cache.font.is_null(), -1);
Ref<Font> font = cache.font;
int font_ascent = font->get_ascent();
@@ -2793,6 +2798,7 @@ void Tree::update_scrollbars() {
int Tree::_get_title_button_height() const {
+ ERR_FAIL_COND_V(cache.font.is_null() || cache.title_button.is_null(), 0);
return show_column_titles ? cache.font->get_height() + cache.title_button->get_minimum_size().height : 0;
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index a6ebf6c3da..ccacb44e6b 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef TREE_H
#define TREE_H
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 06be83bf08..b0739a2f37 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "video_player.h"
#include "os/os.h"
@@ -37,11 +38,6 @@ int VideoPlayer::sp_get_channel_count() const {
return playback->get_channels();
}
-void VideoPlayer::sp_set_mix_rate(int p_rate) {
-
- server_mix_rate = p_rate;
-}
-
bool VideoPlayer::mix(AudioFrame *p_buffer, int p_frames) {
// Check the amount resampler can really handle.
@@ -240,7 +236,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) {
AudioServer::get_singleton()->lock();
if (channels > 0)
- resampler.setup(channels, playback->get_mix_rate(), server_mix_rate, buffering_ms, 0);
+ resampler.setup(channels, playback->get_mix_rate(), AudioServer::get_singleton()->get_mix_rate(), buffering_ms, 0);
else
resampler.clear();
AudioServer::get_singleton()->unlock();
@@ -493,7 +489,6 @@ VideoPlayer::VideoPlayer() {
bus_index = 0;
buffering_ms = 500;
- server_mix_rate = 44100;
// internal_stream.player=this;
// stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream);
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index e772851b0e..5c379b5620 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VIDEO_PLAYER_H
#define VIDEO_PLAYER_H
@@ -49,7 +50,6 @@ class VideoPlayer : public Control {
Ref<VideoStream> stream;
int sp_get_channel_count() const;
- void sp_set_mix_rate(int p_rate); //notify the stream of the mix rate
bool mix(AudioFrame *p_buffer, int p_frames);
RID stream_rid;
@@ -68,7 +68,6 @@ class VideoPlayer : public Control {
bool expand;
bool loops;
int buffering_ms;
- int server_mix_rate;
int audio_track;
int bus_index;
diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp
index e949c20c36..af849589cf 100644
--- a/scene/gui/viewport_container.cpp
+++ b/scene/gui/viewport_container.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "viewport_container.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/viewport_container.h b/scene/gui/viewport_container.h
index c28b3075aa..cd8b4dd5c1 100644
--- a/scene/gui/viewport_container.h
+++ b/scene/gui/viewport_container.h
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VIEWPORTCONTAINER_H
#define VIEWPORTCONTAINER_H